@base44-preview/sdk 0.8.22-pr.150.8a73523 → 0.8.23-pr.152.92acbf4
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.
package/dist/client.js
CHANGED
|
@@ -71,6 +71,7 @@ export function createClient(config) {
|
|
|
71
71
|
};
|
|
72
72
|
const headers = {
|
|
73
73
|
...optionalHeaders,
|
|
74
|
+
"X-App-Id": String(appId),
|
|
74
75
|
};
|
|
75
76
|
const functionHeaders = functionsVersion
|
|
76
77
|
? {
|
|
@@ -91,9 +92,13 @@ export function createClient(config) {
|
|
|
91
92
|
interceptResponses: false,
|
|
92
93
|
onError: options === null || options === void 0 ? void 0 : options.onError,
|
|
93
94
|
});
|
|
95
|
+
const serviceRoleHeaders = {
|
|
96
|
+
...headers,
|
|
97
|
+
...(token ? { "on-behalf-of": `Bearer ${token}` } : {}),
|
|
98
|
+
};
|
|
94
99
|
const serviceRoleAxiosClient = createAxiosClient({
|
|
95
100
|
baseURL: `${serverUrl}/api`,
|
|
96
|
-
headers,
|
|
101
|
+
headers: serviceRoleHeaders,
|
|
97
102
|
token: serviceToken,
|
|
98
103
|
onError: options === null || options === void 0 ? void 0 : options.onError,
|
|
99
104
|
});
|
|
@@ -157,7 +162,7 @@ export function createClient(config) {
|
|
|
157
162
|
getSocket,
|
|
158
163
|
}),
|
|
159
164
|
integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
|
|
160
|
-
sso: createSsoModule(serviceRoleAxiosClient, appId
|
|
165
|
+
sso: createSsoModule(serviceRoleAxiosClient, appId),
|
|
161
166
|
connectors: createConnectorsModule(serviceRoleAxiosClient, appId),
|
|
162
167
|
functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId, {
|
|
163
168
|
getAuthHeaders: () => {
|
|
@@ -33,6 +33,14 @@ export function createConnectorsModule(axios, appId) {
|
|
|
33
33
|
connectionConfig: (_a = data.connection_config) !== null && _a !== void 0 ? _a : null,
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
+
async getCurrentAppUserAccessToken(connectorId) {
|
|
37
|
+
if (!connectorId || typeof connectorId !== "string") {
|
|
38
|
+
throw new Error("Connector ID is required and must be a string");
|
|
39
|
+
}
|
|
40
|
+
const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
|
|
41
|
+
const data = response;
|
|
42
|
+
return data.access_token;
|
|
43
|
+
},
|
|
36
44
|
};
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
@@ -45,14 +53,6 @@ export function createConnectorsModule(axios, appId) {
|
|
|
45
53
|
*/
|
|
46
54
|
export function createUserConnectorsModule(axios, appId) {
|
|
47
55
|
return {
|
|
48
|
-
async getCurrentAppUserAccessToken(connectorId) {
|
|
49
|
-
if (!connectorId || typeof connectorId !== "string") {
|
|
50
|
-
throw new Error("Connector ID is required and must be a string");
|
|
51
|
-
}
|
|
52
|
-
const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
|
|
53
|
-
const data = response;
|
|
54
|
-
return data.access_token;
|
|
55
|
-
},
|
|
56
56
|
async connectAppUser(connectorId) {
|
|
57
57
|
if (!connectorId || typeof connectorId !== "string") {
|
|
58
58
|
throw new Error("Connector ID is required and must be a string");
|
|
@@ -223,20 +223,6 @@ export interface ConnectorsModule {
|
|
|
223
223
|
* ```
|
|
224
224
|
*/
|
|
225
225
|
getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* User-scoped connectors module for managing app-user OAuth connections.
|
|
229
|
-
*
|
|
230
|
-
* This module provides methods for app-user OAuth flows: initiating an OAuth connection,
|
|
231
|
-
* retrieving the end user's access token, and disconnecting the end user's connection.
|
|
232
|
-
*
|
|
233
|
-
* Unlike {@link ConnectorsModule | ConnectorsModule} which manages app-scoped tokens,
|
|
234
|
-
* this module manages tokens scoped to individual end users. Methods are keyed on
|
|
235
|
-
* the connector ID (the OrgConnector's database ID) rather than the integration type.
|
|
236
|
-
*
|
|
237
|
-
* Available via `base44.connectors`.
|
|
238
|
-
*/
|
|
239
|
-
export interface UserConnectorsModule {
|
|
240
226
|
/**
|
|
241
227
|
* Retrieves an OAuth access token for an end user's connection to a specific connector.
|
|
242
228
|
*
|
|
@@ -249,7 +235,7 @@ export interface UserConnectorsModule {
|
|
|
249
235
|
* @example
|
|
250
236
|
* ```typescript
|
|
251
237
|
* // Get the end user's access token for a connector
|
|
252
|
-
* const token = await base44.connectors.getCurrentAppUserAccessToken('abc123def');
|
|
238
|
+
* const token = await base44.asServiceRole.connectors.getCurrentAppUserAccessToken('abc123def');
|
|
253
239
|
*
|
|
254
240
|
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
255
241
|
* headers: { 'Authorization': `Bearer ${token}` }
|
|
@@ -257,6 +243,20 @@ export interface UserConnectorsModule {
|
|
|
257
243
|
* ```
|
|
258
244
|
*/
|
|
259
245
|
getCurrentAppUserAccessToken(connectorId: string): Promise<string>;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* User-scoped connectors module for managing app-user OAuth connections.
|
|
249
|
+
*
|
|
250
|
+
* This module provides methods for app-user OAuth flows: initiating an OAuth connection,
|
|
251
|
+
* retrieving the end user's access token, and disconnecting the end user's connection.
|
|
252
|
+
*
|
|
253
|
+
* Unlike {@link ConnectorsModule | ConnectorsModule} which manages app-scoped tokens,
|
|
254
|
+
* this module manages tokens scoped to individual end users. Methods are keyed on
|
|
255
|
+
* the connector ID (the OrgConnector's database ID) rather than the integration type.
|
|
256
|
+
*
|
|
257
|
+
* Available via `base44.connectors`.
|
|
258
|
+
*/
|
|
259
|
+
export interface UserConnectorsModule {
|
|
260
260
|
/**
|
|
261
261
|
* Initiates the app-user OAuth flow for a specific connector.
|
|
262
262
|
*
|
|
@@ -175,8 +175,13 @@ export interface CoreIntegrations {
|
|
|
175
175
|
/**
|
|
176
176
|
* Create AI-generated images from text prompts.
|
|
177
177
|
*
|
|
178
|
+
* Images are generated as PNG files at approximately 1024px on the shorter side. The
|
|
179
|
+
* exact dimensions vary by aspect ratio.
|
|
180
|
+
*
|
|
181
|
+
* Prompts that violate the AI provider's content policy will be refused.
|
|
182
|
+
*
|
|
178
183
|
* @param params - Parameters for image generation
|
|
179
|
-
* @returns Promise resolving to the generated image
|
|
184
|
+
* @returns Promise resolving to an object containing the URL of the generated PNG image.
|
|
180
185
|
*
|
|
181
186
|
* @example
|
|
182
187
|
* ```typescript
|
package/dist/modules/sso.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ import { SsoModule } from "./sso.types";
|
|
|
9
9
|
* @returns SSO module with authentication methods
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export declare function createSsoModule(axios: AxiosInstance, appId: string
|
|
12
|
+
export declare function createSsoModule(axios: AxiosInstance, appId: string): SsoModule;
|
package/dist/modules/sso.js
CHANGED
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
* @returns SSO module with authentication methods
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export function createSsoModule(axios, appId
|
|
10
|
+
export function createSsoModule(axios, appId) {
|
|
11
11
|
return {
|
|
12
12
|
// Get SSO access token for a specific user
|
|
13
13
|
async getAccessToken(userid) {
|
|
14
14
|
const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
|
|
15
|
-
|
|
16
|
-
const headers = {};
|
|
17
|
-
if (userToken) {
|
|
18
|
-
headers["on-behalf-of"] = `Bearer ${userToken}`;
|
|
19
|
-
}
|
|
20
|
-
return axios.get(url, { headers });
|
|
15
|
+
return axios.get(url);
|
|
21
16
|
},
|
|
22
17
|
};
|
|
23
18
|
}
|