Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions clerk-typedoc/backend/auth-object.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Properties

| Property | Type | Description |
| ---------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="debug"></a> `debug` | <code>() => \{ [key: string]: any; \}</code> | Used to help debug issues when using Clerk in development. |
| <a id="gettoken"></a> `getToken` | <code>ServerGetToken \| () => Promise\<string\> \| () => Promise\<null\></code> | A function that gets the current user's [session token](/docs/backend-requests/resources/session-tokens) or a [custom JWT template](/docs/backend-requests/jwt-templates). |
| <a id="has"></a> `has` | [`CheckAuthorizationFromSessionClaims`](../types/check-authorization-from-session-claims.mdx) | A function that checks if the user has an organization role or custom permission. |
| <a id="tokentype"></a> `tokenType` | <code>"session_token" \| "api_key" \| "machine_token" \| "oauth_token"</code> | The allowed token type. |
| Property | Type | Description |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="debug"></a> `debug` | <code>() => \{ [key: string]: any; \}</code> | Used to help debug issues when using Clerk in development. |
| <a id="gettoken"></a> `getToken` | <code>() => Promise\<null\> \| () => Promise\<string\> \| [ServerGetToken](../types/server-get-token.mdx) \| () => Promise\<null\></code> | A function that gets the current user's [session token](/docs/backend-requests/resources/session-tokens) or a [custom JWT template](/docs/backend-requests/jwt-templates). |
| <a id="has"></a> `has` | <code>[CheckAuthorizationFromSessionClaims](../types/check-authorization-from-session-claims.mdx) \| () => false</code> | A function that checks if the user has an organization role or custom permission. |
| <a id="tokentype"></a> `tokenType` | <code>null \| "api_key" \| "session_token" \| "m2m_token" \| "oauth_token"</code> | The allowed token type. |
47 changes: 24 additions & 23 deletions clerk-typedoc/backend/authenticate-request-options.mdx

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions clerk-typedoc/backend/commerce-plan-json.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**`Experimental`**

This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
It is advised to pin the SDK version to avoid breaking changes.

## Properties

| Property | Type | Description | Overrides |
| ---------------------------------------------------- | ---------------------------- | ---------------------------------------------------------- | -------------------------- |
| <a id="annual_fee"></a> `annual_fee` | `CommerceFeeJSON` | **`Experimental`** | - |
| <a id="annual_monthly_fee"></a> `annual_monthly_fee` | `CommerceFeeJSON` | **`Experimental`** | - |
| <a id="description"></a> `description?` | `string` | **`Experimental`** | - |
| <a id="features"></a> `features` | <code>FeatureJSON[]</code> | **`Experimental`** | - |
| <a id="fee"></a> `fee` | `CommerceFeeJSON` | **`Experimental`** | - |
| <a id="for_payer_type"></a> `for_payer_type` | <code>"user" \| "org"</code> | **`Experimental`** | - |
| <a id="has_base_fee"></a> `has_base_fee` | `boolean` | **`Experimental`** | - |
| <a id="id"></a> `id` | `string` | **`Experimental`** The unique identifier for the resource. | `ClerkResourceJSON.id` |
| <a id="is_default"></a> `is_default` | `boolean` | **`Experimental`** | - |
| <a id="is_recurring"></a> `is_recurring` | `boolean` | **`Experimental`** | - |
| <a id="name"></a> `name` | `string` | **`Experimental`** | - |
| <a id="object"></a> `object` | `"commerce_plan"` | **`Experimental`** The type of the resource. | `ClerkResourceJSON.object` |
| <a id="product_id"></a> `product_id` | `string` | **`Experimental`** | - |
| <a id="publicly_visible"></a> `publicly_visible` | `boolean` | **`Experimental`** | - |
| <a id="slug"></a> `slug` | `string` | **`Experimental`** | - |
68 changes: 68 additions & 0 deletions clerk-typedoc/backend/commerce-plan.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
**`Experimental`**

This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
It is advised to pin the SDK version to avoid breaking changes.

## Constructors

### Constructor

**`Experimental`**

#### Parameters

| Parameter | Type | Description |
| ------------------ | -------------------------------- | --------------------------------------------------------------- |
| `id` | `string` | The unique identifier for the plan. |
| `productId` | `string` | The id of the product the plan belongs to. |
| `name` | `string` | The name of the plan. |
| `slug` | `string` | The URL-friendly identifier of the plan. |
| `description` | <code>undefined \| string</code> | The description of the plan. |
| `isDefault` | `boolean` | Whether the plan is the default plan. |
| `isRecurring` | `boolean` | Whether the plan is recurring. |
| `hasBaseFee` | `boolean` | Whether the plan has a base fee. |
| `publiclyVisible` | `boolean` | Whether the plan is displayed in the `<PriceTable/>` component. |
| `fee` | `CommerceFee` | The monthly fee of the plan. |
| `annualFee` | `CommerceFee` | The annual fee of the plan. |
| `annualMonthlyFee` | `CommerceFee` | The annual fee of the plan on a monthly basis. |
| `forPayerType` | <code>"user" \| "org"</code> | The type of payer for the plan. |
| `features` | <code>Feature[]</code> | The features the plan offers. |

#### Returns

`CommercePlan`

## Properties

| Property | Type | Description |
| ------------------------------------------------ | -------------------------------- | ---------------------------------------------------------------------------------- |
| <a id="annualfee"></a> `annualFee` | `CommerceFee` | **`Experimental`** The annual fee of the plan. |
| <a id="annualmonthlyfee"></a> `annualMonthlyFee` | `CommerceFee` | **`Experimental`** The annual fee of the plan on a monthly basis. |
| <a id="description"></a> `description` | <code>undefined \| string</code> | **`Experimental`** The description of the plan. |
| <a id="features"></a> `features` | <code>Feature[]</code> | **`Experimental`** The features the plan offers. |
| <a id="fee"></a> `fee` | `CommerceFee` | **`Experimental`** The monthly fee of the plan. |
| <a id="forpayertype"></a> `forPayerType` | <code>"user" \| "org"</code> | **`Experimental`** The type of payer for the plan. |
| <a id="hasbasefee"></a> `hasBaseFee` | `boolean` | **`Experimental`** Whether the plan has a base fee. |
| <a id="id"></a> `id` | `string` | **`Experimental`** The unique identifier for the plan. |
| <a id="isdefault"></a> `isDefault` | `boolean` | **`Experimental`** Whether the plan is the default plan. |
| <a id="isrecurring"></a> `isRecurring` | `boolean` | **`Experimental`** Whether the plan is recurring. |
| <a id="name"></a> `name` | `string` | **`Experimental`** The name of the plan. |
| <a id="productid"></a> `productId` | `string` | **`Experimental`** The id of the product the plan belongs to. |
| <a id="publiclyvisible"></a> `publiclyVisible` | `boolean` | **`Experimental`** Whether the plan is displayed in the `<PriceTable/>` component. |
| <a id="slug"></a> `slug` | `string` | **`Experimental`** The URL-friendly identifier of the plan. |

## Methods

### fromJSON()

**`Experimental`**

#### Parameters

| Parameter | Type |
| --------- | -------------------------------------------- |
| `data` | [`CommercePlanJSON`](commerce-plan-json.mdx) |

#### Returns

`CommercePlan`
101 changes: 101 additions & 0 deletions clerk-typedoc/backend/get-auth-fn.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Shared generic overload type for getAuth() helpers across SDKs.

- Parameterized by the request type (RequestType).
- Handles different accepted token types and their corresponding return types.

## Call Signature

Shared generic overload type for getAuth() helpers across SDKs.

- Parameterized by the request type (RequestType).
- Handles different accepted token types and their corresponding return types.

### Parameters

| Parameter | Type |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `req` | `RequestType` |
| `options` | <code>\{ treatPendingAsSignedOut?: boolean; \}</code> & <code>\{ acceptsToken?: "api_key" \| "session_token" \| "m2m_token" \| "oauth_token" \| ("api_key" \| "session_token" \| "m2m_token" \| "oauth_token")[] \| "any"; \}</code> & <code>\{ acceptsToken: T; \}</code> |

### Returns

`MaybePromise`\<<code>InvalidTokenAuthObject \| [InferAuthObjectFromTokenArray](infer-auth-object-from-token-array.mdx)\<T, SessionAuthObject, MachineAuthObject\<Exclude\<T\[number\], "session_token"\>\>\></code>, `ReturnsPromise`\>

### Example

```ts
const auth = await getAuth(req, { acceptsToken: ["session_token", "api_key"] });
```

## Call Signature

Shared generic overload type for getAuth() helpers across SDKs.

- Parameterized by the request type (RequestType).
- Handles different accepted token types and their corresponding return types.

### Parameters

| Parameter | Type |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `req` | `RequestType` |
| `options` | <code>\{ treatPendingAsSignedOut?: boolean; \}</code> & <code>\{ acceptsToken?: "api_key" \| "session_token" \| "m2m_token" \| "oauth_token" \| ("api_key" \| "session_token" \| "m2m_token" \| "oauth_token")[] \| "any"; \}</code> & <code>\{ acceptsToken: T; \}</code> |

### Returns

`MaybePromise`\<[`InferAuthObjectFromToken`](infer-auth-object-from-token.mdx)\<`T`, `SessionAuthObject`, `MachineAuthObject`\<`Exclude`\<`T`, `"session_token"`\>\>\>, `ReturnsPromise`\>

### Example

```ts
const auth = await getAuth(req, { acceptsToken: "session_token" });
```

## Call Signature

Shared generic overload type for getAuth() helpers across SDKs.

- Parameterized by the request type (RequestType).
- Handles different accepted token types and their corresponding return types.

### Parameters

| Parameter | Type |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `req` | `RequestType` |
| `options` | <code>\{ treatPendingAsSignedOut?: boolean; \}</code> & <code>\{ acceptsToken?: "api_key" \| "session_token" \| "m2m_token" \| "oauth_token" \| ("api_key" \| "session_token" \| "m2m_token" \| "oauth_token")[] \| "any"; \}</code> & <code>\{ acceptsToken: "any"; \}</code> |

### Returns

`MaybePromise`\<[`AuthObject`](auth-object.mdx), `ReturnsPromise`\>

### Example

```ts
const auth = await getAuth(req, { acceptsToken: "any" });
```

## Call Signature

Shared generic overload type for getAuth() helpers across SDKs.

- Parameterized by the request type (RequestType).
- Handles different accepted token types and their corresponding return types.

### Parameters

| Parameter | Type | Description |
| ---------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `req` | `RequestType` | - |
| `options?` | <code>\{ treatPendingAsSignedOut?: boolean; \}</code> | - |
| `options.treatPendingAsSignedOut?` | `boolean` | A boolean that indicates whether pending sessions are considered as signed out or not. Defaults to `true`. |

### Returns

`MaybePromise`\<`SessionAuthObject`, `ReturnsPromise`\>

### Example

```ts
const auth = await getAuth(req);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Infers auth object type from an array of token types.

- Session token only -> SessionType
- Mixed tokens -> SessionType | MachineType
- Machine tokens only -> MachineType
2 changes: 2 additions & 0 deletions clerk-typedoc/backend/infer-auth-object-from-token.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Infers auth object type from a single token type.
Returns SessionType for session tokens, or MachineType for machine tokens.
Loading