@base44-preview/sdk 0.8.20-pr.136.aa1c529 → 0.8.20-pr.136.e0d0374

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.
@@ -185,7 +185,7 @@ export interface AuthModule {
185
185
  * - `'microsoft'`: {@link https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow | Microsoft OAuth}. Enable Microsoft in your app's authentication settings before specifying this provider.
186
186
  * - `'facebook'`: {@link https://developers.facebook.com/docs/facebook-login | Facebook Login}. Enable Facebook in your app's authentication settings before using.
187
187
  * - `'apple'`: {@link https://developer.apple.com/sign-in-with-apple/ | Sign in with Apple}. Enable Apple in your app's authentication settings before using this provider.
188
- * - `'sso'`: Enterprise SSO. Enable SSO in your app's authentication settings before using this provider.
188
+ * - `'sso'`: Enterprise SSO. {@link https://docs.base44.com/Setting-up-your-app/Setting-up-SSO | Set up an SSO provider} in your app's authentication settings before using this provider.
189
189
  *
190
190
  * @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, `'apple'`, or `'sso'`.
191
191
  * @param fromUrl - URL to redirect to after successful authentication. Defaults to `'/'`.
@@ -24,7 +24,7 @@ export interface ConnectorAccessTokenResponse {
24
24
  connection_config: Record<string, string> | null;
25
25
  }
26
26
  /**
27
- * Camel-cased connection details returned by {@linkcode ConnectorsModule.getConnection | getConnection()}.
27
+ * Connection details.
28
28
  */
29
29
  export interface ConnectorConnectionResponse {
30
30
  /** The OAuth access token for the external service. */
@@ -44,7 +44,7 @@ export interface ConnectorConnectionResponse {
44
44
  *
45
45
  * ## Available connectors
46
46
  *
47
- * All connectors work through [`getAccessToken()`](#getaccesstoken). Pass the integration type string and use the returned OAuth token to call the external service's API directly.
47
+ * All connectors work through [`getConnection()`](#getconnection). Pass the integration type string and use the returned OAuth token to call the external service's API directly.
48
48
  *
49
49
  * | Service | Type identifier |
50
50
  * |---|---|
@@ -65,11 +65,10 @@ export interface ConnectorConnectionResponse {
65
65
  * | Slack Bot | `slackbot` |
66
66
  * | TikTok | `tiktok` |
67
67
  *
68
- * Some connectors have dedicated setup guides: {@link https://docs.base44.com/Integrations/gmail-connector | Gmail}, {@link https://docs.base44.com/Integrations/linkedin-connector | LinkedIn}, and {@link https://docs.base44.com/Integrations/slack-connector | Slack} (covers both `slack` and `slackbot`).
68
+ * See the integration guides for more details:
69
69
  *
70
- * ### Slack User vs Slack Bot
71
- *
72
- * Base44 provides two Slack connectors: `slack` uses a user token and acts as the connected user, while `slackbot` uses a bot token with a customizable display name. Use `slack` when your app needs to read Slack data or act with a user's permissions. Use `slackbot` for sending automated messages as a branded bot. See the {@link https://docs.base44.com/Integrations/slack-connector | Slack connectors} guide for full details.
70
+ * - **Scopes and permissions**: {@link https://docs.base44.com/Integrations/gmail-connector#gmail-scopes-and-permissions | Gmail}, {@link https://docs.base44.com/Integrations/linkedin-connector#linkedin-scopes-and-permissions | LinkedIn}, {@link https://docs.base44.com/Integrations/slack-connector#slack-scopes-and-permissions | Slack}
71
+ * - **Slack connector types**: {@link https://docs.base44.com/Integrations/slack-connector#about-the-slack-connectors | About the Slack connectors} explains the difference between `slack` and `slackbot`
73
72
  *
74
73
  * ## Authentication Modes
75
74
  *
@@ -83,7 +82,7 @@ export interface ConnectorsModule {
83
82
  /**
84
83
  * Retrieves an OAuth access token for a specific [external integration type](#available-connectors).
85
84
  *
86
- * @deprecated Use {@link getConnection} and use the returned `accessToken` (and `connectionConfig` when needed) instead.
85
+ * @deprecated Use {@link getConnection} instead.
87
86
  *
88
87
  * Returns the OAuth token string for an external service that an app builder
89
88
  * has connected to. This token represents the connected app builder's account
@@ -153,36 +152,60 @@ export interface ConnectorsModule {
153
152
  * Retrieves the OAuth access token and connection configuration for a specific external integration type.
154
153
  *
155
154
  * Returns both the OAuth token and any additional connection configuration
156
- * that the connector provides. This is useful when the external service requires
157
- * extra parameters beyond the access token (e.g., a shop domain, account ID, or API base URL).
155
+ * that the connector provides. Some connectors require connection-specific
156
+ * parameters to build API requests. For example, a service might need a
157
+ * subdomain to construct the API URL (`{subdomain}.example.com`), which
158
+ * is available in `connectionConfig`. Most connectors only need the
159
+ * `accessToken`; `connectionConfig` will be `null` when there are no
160
+ * extra parameters.
158
161
  *
159
162
  * @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, or `'github'`.
160
163
  * @returns Promise resolving to a {@link ConnectorConnectionResponse} with `accessToken` and `connectionConfig`.
161
164
  *
162
165
  * @example
163
166
  * ```typescript
164
- * // Basic usage
165
- * const connection = await base44.asServiceRole.connectors.getConnection('googlecalendar');
166
- * console.log(connection.accessToken);
167
- * console.log(connection.connectionConfig);
167
+ * // Google Calendar connection
168
+ * // Get Google Calendar OAuth token and fetch upcoming events
169
+ * const { accessToken } = await base44.asServiceRole.connectors.getConnection('googlecalendar');
170
+ *
171
+ * const timeMin = new Date().toISOString();
172
+ * const url = `https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=${timeMin}`;
173
+ *
174
+ * const calendarResponse = await fetch(url, {
175
+ * headers: { Authorization: `Bearer ${accessToken}` }
176
+ * });
177
+ *
178
+ * const events = await calendarResponse.json();
179
+ * ```
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * // Slack connection
184
+ * // Get Slack OAuth token and list channels
185
+ * const { accessToken } = await base44.asServiceRole.connectors.getConnection('slack');
186
+ *
187
+ * const url = 'https://slack.com/api/conversations.list?types=public_channel,private_channel&limit=100';
188
+ *
189
+ * const slackResponse = await fetch(url, {
190
+ * headers: { Authorization: `Bearer ${accessToken}` }
191
+ * });
192
+ *
193
+ * const data = await slackResponse.json();
168
194
  * ```
169
195
  *
170
196
  * @example
171
197
  * ```typescript
172
- * // Shopify: connectionConfig has subdomain (e.g. "my-store" for my-store.myshopify.com)
173
- * const connection = await base44.asServiceRole.connectors.getConnection('shopify');
174
- * const { accessToken, connectionConfig } = connection;
175
- * const shop = connectionConfig?.subdomain
176
- * ? `https://${connectionConfig.subdomain}.myshopify.com`
177
- * : null;
178
- *
179
- * if (shop) {
180
- * const response = await fetch(
181
- * `${shop}/admin/api/2024-01/products.json?limit=10`,
182
- * { headers: { 'X-Shopify-Access-Token': accessToken } }
183
- * );
184
- * const { products } = await response.json();
185
- * }
198
+ * // Using connectionConfig
199
+ * // Some connectors return a subdomain or other params needed to build the API URL
200
+ * const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getConnection('myservice');
201
+ *
202
+ * const subdomain = connectionConfig?.subdomain;
203
+ * const response = await fetch(
204
+ * `https://${subdomain}.example.com/api/v1/resources`,
205
+ * { headers: { Authorization: `Bearer ${accessToken}` } }
206
+ * );
207
+ *
208
+ * const data = await response.json();
186
209
  * ```
187
210
  */
188
211
  getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.20-pr.136.aa1c529",
3
+ "version": "0.8.20-pr.136.e0d0374",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",