@base44-preview/sdk 0.8.40-pr.238.591b34c → 0.8.40-pr.240.b2b8abe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -53,14 +53,11 @@ export interface AppUserConnectorConnectionResponse {
|
|
|
53
53
|
*
|
|
54
54
|
* ## Shared connectors
|
|
55
55
|
*
|
|
56
|
-
* All app users share a single OAuth token. Use this for shared accounts. For example, posting to a company Slack channel or reading from a shared Google Calendar.
|
|
56
|
+
* All app users share a single OAuth token. Use this for shared accounts. For example, posting to a company Slack channel or reading from a shared Google Calendar. To use a shared connector:
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* - **Workspace-registered connectors** are backed by your own OAuth app, registered once in Workspace Settings and consented to by the app builder. They are identified by a connector ID instead of an integration type. Retrieve them with {@linkcode getWorkspaceConnection | getWorkspaceConnection()}. Connectors whose OAuth app is specific to your own account, such as Databricks and Snowflake, work this way.
|
|
62
|
-
*
|
|
63
|
-
* To use a shared connector, call the matching method on the service role client `base44.asServiceRole.connectors` from a backend function, then use the returned `accessToken` to call the external service's API directly. Some connectors also return a `connectionConfig` with additional values, such as a subdomain, that you need to build the API URL.
|
|
58
|
+
* 1. Connect the external service account in the app's Integration settings or using the [`connectors push`](/developers/references/cli/commands/connectors-push) CLI command.
|
|
59
|
+
* 2. In a backend function, call {@linkcode getConnection | getConnection()} using the service role client (`base44.asServiceRole.connectors`) with an [integration type](#available-connectors) string to retrieve the shared OAuth token.
|
|
60
|
+
* 3. Use the returned `accessToken` to call the external service's API directly. Some connectors also return a `connectionConfig` with additional values such as a subdomain for building the API URL.
|
|
64
61
|
*
|
|
65
62
|
* ## App user connectors
|
|
66
63
|
*
|
|
@@ -73,7 +70,7 @@ export interface AppUserConnectorConnectionResponse {
|
|
|
73
70
|
*
|
|
74
71
|
* ## Available connectors
|
|
75
72
|
*
|
|
76
|
-
*
|
|
73
|
+
* All connectors listed below support both shared and app user connections. For shared connectors, pass the integration type string to {@linkcode getConnection | getConnection()}. For app user connectors, register the connector in Workspace Settings and use the connector ID with {@linkcode getCurrentAppUserConnection | getCurrentAppUserConnection()}.
|
|
77
74
|
*
|
|
78
75
|
* | Service | Type identifier |
|
|
79
76
|
* |---|---|
|
|
@@ -207,8 +204,6 @@ export interface ConnectorsModule {
|
|
|
207
204
|
*
|
|
208
205
|
* Use this when a single shared account is connected and all app users access the same token. For per-user tokens, use [`getCurrentAppUserConnection()`](#getcurrentappuserconnection) instead.
|
|
209
206
|
*
|
|
210
|
-
* This form is for platform connectors identified by an integration type. Connectors backed by your own OAuth app registered in Workspace Settings, such as Databricks and Snowflake, are retrieved by connector ID with {@linkcode getWorkspaceConnection | getWorkspaceConnection()} instead.
|
|
211
|
-
*
|
|
212
207
|
* Some connectors require connection-specific parameters to build API calls.
|
|
213
208
|
* In such cases, the returned `connectionConfig` is an object with the additional parameters. If there are no extra parameters needed for the connection, the `connectionConfig` is `null`.
|
|
214
209
|
*
|
|
@@ -262,27 +257,28 @@ export interface ConnectorsModule {
|
|
|
262
257
|
*/
|
|
263
258
|
getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
|
|
264
259
|
/**
|
|
265
|
-
* Retrieves the
|
|
260
|
+
* Retrieves the OAuth access token and connection configuration for a **workspace-registered** connector
|
|
261
|
+
* (a connector backed by an OAuth app registered in the workspace, consented to once by the app builder).
|
|
266
262
|
*
|
|
267
|
-
* Use this
|
|
263
|
+
* Use this method when the app's backend function needs to use a connector identified by its
|
|
264
|
+
* workspace-connector ID rather than a platform integration type. The token returned represents
|
|
265
|
+
* the app builder's consent against the workspace's OAuth app and is shared across all app users
|
|
266
|
+
* of the app — identical semantics to the platform-shared {@link getConnection} form,
|
|
267
|
+
* differing only in which OAuth app was used to produce the token.
|
|
268
268
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* @param connectorId - The ID of the workspace connector, not the integration type string. You can find it on the connector's settings page in Workspace Settings.
|
|
269
|
+
* @param connectorId - The ID of the workspace connector (the `OrganizationConnector` database ID) as surfaced in the builder chat context.
|
|
272
270
|
* @returns Promise resolving to a {@link ConnectorConnectionResponse} with `accessToken` and `connectionConfig`.
|
|
273
271
|
*
|
|
274
272
|
* @example
|
|
275
273
|
* ```typescript
|
|
276
|
-
* //
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* const response = await fetch(
|
|
281
|
-
* `https://${connectionConfig?.subdomain}.snowflakecomputing.com/api/v2/statements`,
|
|
282
|
-
* { headers: { Authorization: `Bearer ${accessToken}` } }
|
|
274
|
+
* // Get the connection for a workspace-registered connector
|
|
275
|
+
* const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getWorkspaceConnection(
|
|
276
|
+
* 'abc123def',
|
|
283
277
|
* );
|
|
284
278
|
*
|
|
285
|
-
* const
|
|
279
|
+
* const response = await fetch(`https://${connectionConfig?.subdomain}.snowflakecomputing.com/api/v2/statements`, {
|
|
280
|
+
* headers: { Authorization: `Bearer ${accessToken}` },
|
|
281
|
+
* });
|
|
286
282
|
* ```
|
|
287
283
|
*/
|
|
288
284
|
getWorkspaceConnection(connectorId: string): Promise<ConnectorConnectionResponse>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Response from SSO access token endpoint.
|
|
3
|
-
* @internal
|
|
4
3
|
*/
|
|
5
4
|
export interface SsoAccessTokenResponse {
|
|
6
5
|
access_token: string;
|
|
@@ -14,8 +13,6 @@ export interface SsoAccessTokenResponse {
|
|
|
14
13
|
*
|
|
15
14
|
* This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.
|
|
16
15
|
*
|
|
17
|
-
* @internal
|
|
18
|
-
*
|
|
19
16
|
* @example
|
|
20
17
|
* ```typescript
|
|
21
18
|
* // Access SSO module with service role
|
|
@@ -53,6 +50,7 @@ export interface SsoModule {
|
|
|
53
50
|
*
|
|
54
51
|
* @example
|
|
55
52
|
* ```typescript
|
|
53
|
+
* // Get the user's ID token to read identity claims such as email
|
|
56
54
|
* import { createClientFromRequest } from 'npm:@base44/sdk';
|
|
57
55
|
*
|
|
58
56
|
* Deno.serve(async (req) => {
|