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
40 changes: 40 additions & 0 deletions docs-mdx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: @base44/sdk
description: - createClient - createClientFromRequest - getAccessToken -
---

## Classes

- [Base44Error](classes/Base44Error.md)

## Interfaces

- [AppMessageContent](interfaces/AppMessageContent.md)
- [AppConversationMessage](interfaces/AppConversationMessage.md)
- [AppConversationLike](interfaces/AppConversationLike.md)
- [DenoProjectLike](interfaces/DenoProjectLike.md)
- [AppLike](interfaces/AppLike.md)
- [UserLike](interfaces/UserLike.md)
- [UserEntityLike](interfaces/UserEntityLike.md)
- [AuthConfigLike](interfaces/AuthConfigLike.md)
- [LoginViaEmailPasswordResponse](interfaces/LoginViaEmailPasswordResponse.md)
- [AuthMethods](interfaces/AuthMethods.md)

## Type Aliases

- [Base44Client](types/Base44Client.md)
- [AgentConversation](types/AgentConversation.md)
- [AgentMessage](types/AgentMessage.md)
- [LoginInfoResponse](types/LoginInfoResponse.md)
- [ConnectorIntegrationType](types/ConnectorIntegrationType.md)
- [ConnectorAccessTokenResponse](types/ConnectorAccessTokenResponse.md)
- [ModelFilterParams](types/ModelFilterParams.md)

## Functions

- [createClient](functions/createClient.md)
- [createClientFromRequest](functions/createClientFromRequest.md)
- [getAccessToken](functions/getAccessToken.md)
- [saveAccessToken](functions/saveAccessToken.md)
- [removeAccessToken](functions/removeAccessToken.md)
- [getLoginUrl](functions/getLoginUrl.md)
100 changes: 100 additions & 0 deletions docs-mdx/classes/Base44Error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: "Class: Base44Error"
description: "utils/axios-client.ts:27"
---

## Hierarchy

- `Error`

↳ **`Base44Error`**

## Constructors

### constructor

• **new Base44Error**(`message`, `status`, `code`, `data`, `originalError`): [`Base44Error`](Base44Error.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `message` | `string` |
| `status` | `number` |
| `code` | `string` |
| `data` | `any` |
| `originalError` | `unknown` |

#### Returns

[`Base44Error`](Base44Error.md)

#### Overrides

Error.constructor

#### Defined in

[utils/axios-client.ts:11](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L11)

## Properties

### status

• **status**: `number`

#### Defined in

[utils/axios-client.ts:6](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L6)

___

### code

• **code**: `string`

#### Defined in

[utils/axios-client.ts:7](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L7)

___

### data

• **data**: `any`

#### Defined in

[utils/axios-client.ts:8](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L8)

___

### originalError

• **originalError**: `unknown`

#### Defined in

[utils/axios-client.ts:9](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L9)

## Methods

### toJSON

▸ **toJSON**(): `Object`

#### Returns

`Object`

| Name | Type |
| :------ | :------ |
| `name` | `string` |
| `message` | `string` |
| `status` | `number` |
| `code` | `string` |
| `data` | `any` |

#### Defined in

[utils/axios-client.ts:27](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/axios-client.ts#L27)
82 changes: 82 additions & 0 deletions docs-mdx/functions/createClient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: "Function: createClient"
description: "client.ts:30"
---

▸ **createClient**(`config`): `Object`

Create a Base44 client instance

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `config` | `Object` | Client configuration |
| `config.serverUrl?` | `string` | API server URL |
| `config.appBaseUrl?` | `string` | Application base URL |
| `config.appId` | `string` | Application ID |
| `config.token?` | `string` | Authentication token |
| `config.serviceToken?` | `string` | Service role authentication token |
| `config.requiresAuth?` | `boolean` | Whether the app requires authentication |
| `config.functionsVersion?` | `string` | - |
| `config.headers?` | `Record`\<..., ...\> | - |
| `config.options?` | `CreateClientOptions` | - |

#### Returns

[**Base44Client**](../types/Base44Client.md)

Base44 client instance

<details>
<summary>View full type definition</summary>

| Name | Type |
| :------ | :------ |
| `entities` | {} |
| `integrations` | {} |
| `auth` | [`AuthMethods`](../interfaces/AuthMethods.md) |
| `functions` | \{ `invoke`: (`functionName`: `string`, `data`: `Record`\<..., ...\>) => `Promise`\<...\> } |
| `functions.invoke` | [object Object] |
| `agents` | \{ `getConversations`: () => ... ; `getConversation`: (`conversationId`: ...) => ... ; `listConversations`: (`filterParams`: ...) => ... ; `createConversation`: (`conversation`: ...) => ... ; `addMessage`: (`conversation`: ..., `message`: ...) => ... ; `subscribeToConversation`: (`conversationId`: ..., `onUpdate?`: ...) => ... ; `getWhatsAppConnectURL`: (`agentName`: ...) => ... } |
| `agents.getConversations` | () => ... |
| `agents.getConversation` | (`conversationId`: ...) => ... |
| `agents.listConversations` | (`filterParams`: ...) => ... |
| `agents.createConversation` | (`conversation`: ...) => ... |
| `agents.addMessage` | (`conversation`: ..., `message`: ...) => ... |
| `agents.subscribeToConversation` | (`conversationId`: ..., `onUpdate?`: ...) => ... |
| `agents.getWhatsAppConnectURL` | (`agentName`: ...) => ... |
| `appLogs` | \{ `logUserInApp`: (`pageName`: `string`) => `Promise`\<...\> ; `fetchLogs`: (`params`: `Record`\<..., ...\>) => `Promise`\<...\> ; `getStats`: (`params`: `Record`\<..., ...\>) => `Promise`\<...\> } |
| `appLogs.logUserInApp` | [object Object] |
| `appLogs.fetchLogs` | [object Object] |
| `appLogs.getStats` | [object Object] |
| `cleanup` | () => `void` |
| `setToken` | (`newToken`: `string`) => `void` |
| `getConfig` | () => \{ `serverUrl`: `string` ; `appId`: `string` ; `requiresAuth`: `boolean` } |
| `asServiceRole` | \{ `entities`: {} ; `integrations`: {} ; `sso`: \{ `getAccessToken`: (`userid`: ...) => ... } ; `connectors`: \{ `getAccessToken`: (`integrationType`: ...) => ... } ; `functions`: \{ `invoke`: (`functionName`: ..., `data`: ...) => ... } ; `agents`: \{ `getConversations`: ... ; `getConversation`: ... ; `listConversations`: ... ; `createConversation`: ... ; `addMessage`: ... ; `subscribeToConversation`: ... ; `getWhatsAppConnectURL`: ... } ; `appLogs`: \{ `logUserInApp`: (`pageName`: ...) => ... ; `fetchLogs`: (`params`: ...) => ... ; `getStats`: (`params`: ...) => ... } ; `cleanup`: () => ... } |
| `asServiceRole.entities` | {} |
| `asServiceRole.integrations` | {} |
| `asServiceRole.sso` | \{ `getAccessToken`: (`userid`: ...) => ... } |
| `asServiceRole.sso.getAccessToken` | [object Object] |
| `asServiceRole.connectors` | \{ `getAccessToken`: (`integrationType`: ...) => ... } |
| `asServiceRole.connectors.getAccessToken` | [object Object] |
| `asServiceRole.functions` | \{ `invoke`: (`functionName`: ..., `data`: ...) => ... } |
| `asServiceRole.functions.invoke` | [object Object] |
| `asServiceRole.agents` | \{ `getConversations`: ... ; `getConversation`: ... ; `listConversations`: ... ; `createConversation`: ... ; `addMessage`: ... ; `subscribeToConversation`: ... ; `getWhatsAppConnectURL`: ... } |
| `asServiceRole.agents.getConversations` | ... |
| `asServiceRole.agents.getConversation` | ... |
| `asServiceRole.agents.listConversations` | ... |
| `asServiceRole.agents.createConversation` | ... |
| `asServiceRole.agents.addMessage` | ... |
| `asServiceRole.agents.subscribeToConversation` | ... |
| `asServiceRole.agents.getWhatsAppConnectURL` | ... |
| `asServiceRole.appLogs` | \{ `logUserInApp`: (`pageName`: ...) => ... ; `fetchLogs`: (`params`: ...) => ... ; `getStats`: (`params`: ...) => ... } |
| `asServiceRole.appLogs.logUserInApp` | [object Object] |
| `asServiceRole.appLogs.fetchLogs` | [object Object] |
| `asServiceRole.appLogs.getStats` | [object Object] |
| `asServiceRole.cleanup` | () => ... |

</details>
#### Defined in

[client.ts:30](https://github.com/base44-dev/javascript-sdk/blob/main/src/client.ts#L30)
65 changes: 65 additions & 0 deletions docs-mdx/functions/createClientFromRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "Function: createClientFromRequest"
description: "client.ts:215"
---

▸ **createClientFromRequest**(`request`): `Object`

#### Parameters

| Name | Type |
| :------ | :------ |
| `request` | `Request` |

#### Returns

`Object`

| Name | Type |
| :------ | :------ |
| `entities` | {} |
| `integrations` | {} |
| `auth` | [`AuthMethods`](../interfaces/AuthMethods.md) |
| `functions` | \{ `invoke`: (`functionName`: `string`, `data`: `Record`\<..., ...\>) => `Promise`\<...\> } |
| `functions.invoke` | [object Object] |
| `agents` | \{ `getConversations`: () => ... ; `getConversation`: (`conversationId`: ...) => ... ; `listConversations`: (`filterParams`: ...) => ... ; `createConversation`: (`conversation`: ...) => ... ; `addMessage`: (`conversation`: ..., `message`: ...) => ... ; `subscribeToConversation`: (`conversationId`: ..., `onUpdate?`: ...) => ... ; `getWhatsAppConnectURL`: (`agentName`: ...) => ... } |
| `agents.getConversations` | () => ... |
| `agents.getConversation` | (`conversationId`: ...) => ... |
| `agents.listConversations` | (`filterParams`: ...) => ... |
| `agents.createConversation` | (`conversation`: ...) => ... |
| `agents.addMessage` | (`conversation`: ..., `message`: ...) => ... |
| `agents.subscribeToConversation` | (`conversationId`: ..., `onUpdate?`: ...) => ... |
| `agents.getWhatsAppConnectURL` | (`agentName`: ...) => ... |
| `appLogs` | \{ `logUserInApp`: (`pageName`: `string`) => `Promise`\<...\> ; `fetchLogs`: (`params`: `Record`\<..., ...\>) => `Promise`\<...\> ; `getStats`: (`params`: `Record`\<..., ...\>) => `Promise`\<...\> } |
| `appLogs.logUserInApp` | [object Object] |
| `appLogs.fetchLogs` | [object Object] |
| `appLogs.getStats` | [object Object] |
| `cleanup` | () => `void` |
| `setToken` | (`newToken`: `string`) => `void` |
| `getConfig` | () => \{ `serverUrl`: `string` ; `appId`: `string` ; `requiresAuth`: `boolean` } |
| `asServiceRole` | \{ `entities`: {} ; `integrations`: {} ; `sso`: \{ `getAccessToken`: (`userid`: ...) => ... } ; `connectors`: \{ `getAccessToken`: (`integrationType`: ...) => ... } ; `functions`: \{ `invoke`: (`functionName`: ..., `data`: ...) => ... } ; `agents`: \{ `getConversations`: ... ; `getConversation`: ... ; `listConversations`: ... ; `createConversation`: ... ; `addMessage`: ... ; `subscribeToConversation`: ... ; `getWhatsAppConnectURL`: ... } ; `appLogs`: \{ `logUserInApp`: (`pageName`: ...) => ... ; `fetchLogs`: (`params`: ...) => ... ; `getStats`: (`params`: ...) => ... } ; `cleanup`: () => ... } |
| `asServiceRole.entities` | {} |
| `asServiceRole.integrations` | {} |
| `asServiceRole.sso` | \{ `getAccessToken`: (`userid`: ...) => ... } |
| `asServiceRole.sso.getAccessToken` | [object Object] |
| `asServiceRole.connectors` | \{ `getAccessToken`: (`integrationType`: ...) => ... } |
| `asServiceRole.connectors.getAccessToken` | [object Object] |
| `asServiceRole.functions` | \{ `invoke`: (`functionName`: ..., `data`: ...) => ... } |
| `asServiceRole.functions.invoke` | [object Object] |
| `asServiceRole.agents` | \{ `getConversations`: ... ; `getConversation`: ... ; `listConversations`: ... ; `createConversation`: ... ; `addMessage`: ... ; `subscribeToConversation`: ... ; `getWhatsAppConnectURL`: ... } |
| `asServiceRole.agents.getConversations` | ... |
| `asServiceRole.agents.getConversation` | ... |
| `asServiceRole.agents.listConversations` | ... |
| `asServiceRole.agents.createConversation` | ... |
| `asServiceRole.agents.addMessage` | ... |
| `asServiceRole.agents.subscribeToConversation` | ... |
| `asServiceRole.agents.getWhatsAppConnectURL` | ... |
| `asServiceRole.appLogs` | \{ `logUserInApp`: (`pageName`: ...) => ... ; `fetchLogs`: (`params`: ...) => ... ; `getStats`: (`params`: ...) => ... } |
| `asServiceRole.appLogs.logUserInApp` | [object Object] |
| `asServiceRole.appLogs.fetchLogs` | [object Object] |
| `asServiceRole.appLogs.getStats` | [object Object] |
| `asServiceRole.cleanup` | () => ... |

#### Defined in

[client.ts:215](https://github.com/base44-dev/javascript-sdk/blob/main/src/client.ts#L215)
28 changes: 28 additions & 0 deletions docs-mdx/functions/getAccessToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Function: getAccessToken"
description: "utils/auth-utils.ts:15"
---

▸ **getAccessToken**(`options?`): ``null`` \| `string`

Retrieves an access token from either localStorage or URL parameters

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | `Object` | Configuration options |
| `options.storageKey?` | `string` | The key to use in localStorage |
| `options.paramName?` | `string` | The URL parameter name |
| `options.saveToStorage?` | `boolean` | Whether to save the token to localStorage if found in URL |
| `options.removeFromUrl?` | `boolean` | Whether to remove the token from URL after retrieval |

#### Returns

``null`` \| `string`

The access token or null if not found

#### Defined in

[utils/auth-utils.ts:15](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/auth-utils.ts#L15)
28 changes: 28 additions & 0 deletions docs-mdx/functions/getLoginUrl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Function: getLoginUrl"
description: "utils/auth-utils.ts:138"
---

▸ **getLoginUrl**(`nextUrl`, `options`): `string`

Constructs the absolute URL for the login page

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `nextUrl` | `string` | URL to redirect back to after login |
| `options` | `Object` | Configuration options |
| `options.serverUrl` | `string` | Server URL (e.g., 'https://base44.app') |
| `options.appId` | `string` | Application ID |
| `options.loginPath?` | `string` | Path to the login endpoint |

#### Returns

`string`

The complete login URL

#### Defined in

[utils/auth-utils.ts:138](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/auth-utils.ts#L138)
25 changes: 25 additions & 0 deletions docs-mdx/functions/removeAccessToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "Function: removeAccessToken"
description: "utils/auth-utils.ts:112"
---

▸ **removeAccessToken**(`options`): `boolean`

Removes the access token from localStorage

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | `Object` | Configuration options |
| `options.storageKey?` | `string` | The key to use in localStorage |

#### Returns

`boolean`

Success status

#### Defined in

[utils/auth-utils.ts:112](https://github.com/base44-dev/javascript-sdk/blob/main/src/utils/auth-utils.ts#L112)
Loading
Loading