@depup/base44__sdk 0.8.41-depup.1 → 0.8.43-depup.0
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/README.md +2 -2
- package/changes.json +1 -1
- package/dist/actor.d.ts +17 -8
- package/dist/actor.js +19 -7
- package/dist/client.js +1 -0
- package/dist/modules/analytics.d.ts +13 -2
- package/dist/modules/analytics.js +39 -2
- package/dist/modules/auth.d.ts +2 -2
- package/dist/modules/auth.js +42 -1
- package/dist/modules/auth.types.d.ts +23 -0
- package/dist/modules/connectors.types.d.ts +23 -19
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/base44__sdk
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@base44/sdk](https://www.npmjs.com/package/@base44/sdk) @ 0.8.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@base44/sdk](https://www.npmjs.com/package/@base44/sdk) @ 0.8.43 |
|
|
17
|
+
| Processed | 2026-08-18 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 3 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/dist/actor.d.ts
CHANGED
|
@@ -15,12 +15,9 @@ import type { Base44Client } from "./client";
|
|
|
15
15
|
*/
|
|
16
16
|
export interface Conn<Send = unknown> {
|
|
17
17
|
/** Unique per-connection id (one per socket/tab), the same value the client
|
|
18
|
-
* receives from `subscribe()`.
|
|
19
|
-
*
|
|
18
|
+
* receives from `subscribe()`. Identifies a distinct client, so multiple
|
|
19
|
+
* tabs are separate connections. */
|
|
20
20
|
id: string;
|
|
21
|
-
userId: string;
|
|
22
|
-
appId: string;
|
|
23
|
-
instanceId: string;
|
|
24
21
|
send(data: Send): void;
|
|
25
22
|
reject(code: number, reason: string): void;
|
|
26
23
|
}
|
|
@@ -57,12 +54,26 @@ export declare abstract class Actor<Incoming = unknown, Outgoing = unknown> {
|
|
|
57
54
|
* connection is handled — safe to load persisted state here.
|
|
58
55
|
*/
|
|
59
56
|
handleStart(): void | Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Optional handler for scheduled wakes. Runs when a timer armed via
|
|
59
|
+
* {@link schedule} comes due, receiving the same `key` that was scheduled.
|
|
60
|
+
* The schedule is one-shot: it fires once and is cleared before this runs.
|
|
61
|
+
*/
|
|
62
|
+
protected handleWake(_key: string): void | Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Arm a one-shot wake at `at` (epoch ms or a `Date`), identified by `key`.
|
|
65
|
+
* When it comes due the platform calls {@link handleWake} with this `key`.
|
|
66
|
+
* Scheduling the same `key` again reschedules it.
|
|
67
|
+
*/
|
|
68
|
+
protected schedule(_key: string, _at: number | Date): Promise<void>;
|
|
69
|
+
/** Cancel a pending wake previously armed with {@link schedule}. */
|
|
70
|
+
protected cancelSchedule(_key: string): Promise<void>;
|
|
60
71
|
/**
|
|
61
72
|
* Managed ticker (opt-in). Override {@link shouldTick} and the platform runs
|
|
62
73
|
* {@link handleTick} on a timer of {@link tickIntervalMs} while it returns true,
|
|
63
74
|
* and stops (letting the Durable Object hibernate — no compute cost) when it
|
|
64
75
|
* returns false. The platform owns scheduling, rescheduling, self-heal, and
|
|
65
|
-
* error-safety
|
|
76
|
+
* error-safety.
|
|
66
77
|
*
|
|
67
78
|
* Re-evaluated after every connect/message/close and on every tick, so keep it
|
|
68
79
|
* cheap and pure (no async, no side effects). Example: `return this.players >= 2`.
|
|
@@ -71,8 +82,6 @@ export declare abstract class Actor<Incoming = unknown, Outgoing = unknown> {
|
|
|
71
82
|
protected shouldTick?(): boolean;
|
|
72
83
|
protected broadcast(_data: Outgoing): void;
|
|
73
84
|
protected getConnections(): Conn<Outgoing>[];
|
|
74
|
-
protected startLoop(_ms: number): Promise<void>;
|
|
75
|
-
protected stopLoop(): Promise<void>;
|
|
76
85
|
protected get instanceId(): string;
|
|
77
86
|
protected get storage(): Storage;
|
|
78
87
|
/**
|
package/dist/actor.js
CHANGED
|
@@ -30,7 +30,7 @@ export class Actor {
|
|
|
30
30
|
* {@link handleTick} on a timer of {@link tickIntervalMs} while it returns true,
|
|
31
31
|
* and stops (letting the Durable Object hibernate — no compute cost) when it
|
|
32
32
|
* returns false. The platform owns scheduling, rescheduling, self-heal, and
|
|
33
|
-
* error-safety
|
|
33
|
+
* error-safety.
|
|
34
34
|
*
|
|
35
35
|
* Re-evaluated after every connect/message/close and on every tick, so keep it
|
|
36
36
|
* cheap and pure (no async, no side effects). Example: `return this.players >= 2`.
|
|
@@ -42,18 +42,30 @@ export class Actor {
|
|
|
42
42
|
* connection is handled — safe to load persisted state here.
|
|
43
43
|
*/
|
|
44
44
|
handleStart() { }
|
|
45
|
+
/**
|
|
46
|
+
* Optional handler for scheduled wakes. Runs when a timer armed via
|
|
47
|
+
* {@link schedule} comes due, receiving the same `key` that was scheduled.
|
|
48
|
+
* The schedule is one-shot: it fires once and is cleared before this runs.
|
|
49
|
+
*/
|
|
50
|
+
handleWake(_key) { }
|
|
51
|
+
/**
|
|
52
|
+
* Arm a one-shot wake at `at` (epoch ms or a `Date`), identified by `key`.
|
|
53
|
+
* When it comes due the platform calls {@link handleWake} with this `key`.
|
|
54
|
+
* Scheduling the same `key` again reschedules it.
|
|
55
|
+
*/
|
|
56
|
+
schedule(_key, _at) {
|
|
57
|
+
throw new Error("Actor.schedule() is only available inside a deployed actor");
|
|
58
|
+
}
|
|
59
|
+
/** Cancel a pending wake previously armed with {@link schedule}. */
|
|
60
|
+
cancelSchedule(_key) {
|
|
61
|
+
throw new Error("Actor.cancelSchedule() is only available inside a deployed actor");
|
|
62
|
+
}
|
|
45
63
|
broadcast(_data) {
|
|
46
64
|
throw new Error("Actor.broadcast() is only available inside a deployed actor");
|
|
47
65
|
}
|
|
48
66
|
getConnections() {
|
|
49
67
|
throw new Error("Actor.getConnections() is only available inside a deployed actor");
|
|
50
68
|
}
|
|
51
|
-
startLoop(_ms) {
|
|
52
|
-
throw new Error("Actor.startLoop() is only available inside a deployed actor");
|
|
53
|
-
}
|
|
54
|
-
stopLoop() {
|
|
55
|
-
throw new Error("Actor.stopLoop() is only available inside a deployed actor");
|
|
56
|
-
}
|
|
57
69
|
get instanceId() {
|
|
58
70
|
throw new Error("Actor.instanceId is only available inside a deployed actor");
|
|
59
71
|
}
|
package/dist/client.js
CHANGED
|
@@ -113,6 +113,7 @@ export function createClient(config) {
|
|
|
113
113
|
const userAuthModule = createAuthModule(axiosClient, functionsAxiosClient, appId, {
|
|
114
114
|
appBaseUrl: normalizedAppBaseUrl,
|
|
115
115
|
serverUrl,
|
|
116
|
+
token,
|
|
116
117
|
});
|
|
117
118
|
// Apply the access token before any module that may issue authenticated
|
|
118
119
|
// requests during construction (notably analytics, which fires an init
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { TrackEventParams, AnalyticsModuleOptions } from "./analytics.types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { InternalAuthModule } from "./auth.types";
|
|
4
4
|
export declare const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
|
|
5
5
|
export declare const ANALYTICS_INITIALIZATION_EVENT_NAME = "__initialization_event__";
|
|
6
6
|
export declare const ANALYTICS_SESSION_DURATION_EVENT_NAME = "__session_duration_event__";
|
|
@@ -10,11 +10,22 @@ export interface AnalyticsModuleArgs {
|
|
|
10
10
|
axiosClient: AxiosInstance;
|
|
11
11
|
serverUrl: string;
|
|
12
12
|
appId: string;
|
|
13
|
-
userAuthModule:
|
|
13
|
+
userAuthModule: InternalAuthModule;
|
|
14
14
|
}
|
|
15
15
|
export declare const createAnalyticsModule: ({ axiosClient, serverUrl, appId, userAuthModule, }: AnalyticsModuleArgs) => {
|
|
16
16
|
track: (params: TrackEventParams) => void;
|
|
17
17
|
cleanup: () => void;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Clears the memoized analytics session context.
|
|
21
|
+
*
|
|
22
|
+
* The context holds the `user_id` resolved by `auth.me()` and is reused for the
|
|
23
|
+
* lifetime of the session, so it has to be dropped whenever the identity
|
|
24
|
+
* changes. Without this, a visitor who loads a page anonymously and then logs in
|
|
25
|
+
* keeps reporting `user_id: null` on every subsequent event.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function resetAnalyticsSessionContext(): void;
|
|
19
30
|
export declare function getAnalyticsConfigFromUrlParams(): AnalyticsModuleOptions | undefined;
|
|
20
31
|
export declare function getAnalyticsSessionId(): string;
|
|
@@ -165,7 +165,12 @@ async function startAnalyticsProcessor(handleTrack, options) {
|
|
|
165
165
|
}
|
|
166
166
|
function startHeartBeatProcessor(track) {
|
|
167
167
|
var _a;
|
|
168
|
-
|
|
168
|
+
// Browser-only, like the other automatic events here (initialization, session
|
|
169
|
+
// duration, visibility). Outside a browser this timer fired a `me()` every
|
|
170
|
+
// interval for the lifetime of a long-lived server-side client, and kept the
|
|
171
|
+
// Node event loop alive. Explicit `analytics.track()` calls still work.
|
|
172
|
+
if (typeof window === "undefined" ||
|
|
173
|
+
analyticsSharedState.isHeartBeatProcessing ||
|
|
169
174
|
((_a = analyticsSharedState.config.heartBeatInterval) !== null && _a !== void 0 ? _a : 0) < 10) {
|
|
170
175
|
return () => { };
|
|
171
176
|
}
|
|
@@ -226,8 +231,29 @@ function transformEventDataToApiRequestData(sessionContext) {
|
|
|
226
231
|
});
|
|
227
232
|
}
|
|
228
233
|
let sessionContextPromise = null;
|
|
234
|
+
/**
|
|
235
|
+
* Clears the memoized analytics session context.
|
|
236
|
+
*
|
|
237
|
+
* The context holds the `user_id` resolved by `auth.me()` and is reused for the
|
|
238
|
+
* lifetime of the session, so it has to be dropped whenever the identity
|
|
239
|
+
* changes. Without this, a visitor who loads a page anonymously and then logs in
|
|
240
|
+
* keeps reporting `user_id: null` on every subsequent event.
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
export function resetAnalyticsSessionContext() {
|
|
245
|
+
analyticsSharedState.sessionContext = null;
|
|
246
|
+
sessionContextPromise = null;
|
|
247
|
+
}
|
|
229
248
|
async function getSessionContext(userAuthModule) {
|
|
230
249
|
if (!analyticsSharedState.sessionContext) {
|
|
250
|
+
// With no token there is no identity to resolve: `me()` can only answer 401,
|
|
251
|
+
// which the browser logs to the console before any handler here sees it. On
|
|
252
|
+
// a public page that request is the sole reason an error appears, so skip
|
|
253
|
+
// it. This is not memoized — a visitor who logs in later must still resolve.
|
|
254
|
+
if (!userAuthModule.hasToken()) {
|
|
255
|
+
return { user_id: null, session_id: getAnalyticsSessionId() };
|
|
256
|
+
}
|
|
231
257
|
if (!sessionContextPromise) {
|
|
232
258
|
const sessionId = getAnalyticsSessionId();
|
|
233
259
|
sessionContextPromise = userAuthModule
|
|
@@ -241,7 +267,18 @@ async function getSessionContext(userAuthModule) {
|
|
|
241
267
|
session_id: sessionId,
|
|
242
268
|
}));
|
|
243
269
|
}
|
|
244
|
-
|
|
270
|
+
const pending = sessionContextPromise;
|
|
271
|
+
const context = await pending;
|
|
272
|
+
// Publish only if this lookup is still the current one. A reset that lands
|
|
273
|
+
// while the request is in flight nulls `sessionContextPromise`, and an
|
|
274
|
+
// unconditional write here would put the pre-reset identity back and pin it
|
|
275
|
+
// for the rest of the session. The awaited value is still returned: these
|
|
276
|
+
// events were queued before the identity changed, so that is who they
|
|
277
|
+
// belong to.
|
|
278
|
+
if (sessionContextPromise === pending) {
|
|
279
|
+
analyticsSharedState.sessionContext = context;
|
|
280
|
+
}
|
|
281
|
+
return context;
|
|
245
282
|
}
|
|
246
283
|
return analyticsSharedState.sessionContext;
|
|
247
284
|
}
|
package/dist/modules/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import {
|
|
2
|
+
import { AuthModuleOptions, InternalAuthModule } from "./auth.types";
|
|
3
3
|
/**
|
|
4
4
|
* Creates the auth module for the Base44 SDK.
|
|
5
5
|
*
|
|
@@ -10,4 +10,4 @@ import { AuthModule, AuthModuleOptions } from "./auth.types";
|
|
|
10
10
|
* @returns Auth module with authentication and user management methods
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
export declare function createAuthModule(axios: AxiosInstance, functionsAxiosClient: AxiosInstance, appId: string, options: AuthModuleOptions):
|
|
13
|
+
export declare function createAuthModule(axios: AxiosInstance, functionsAxiosClient: AxiosInstance, appId: string, options: AuthModuleOptions): InternalAuthModule;
|
package/dist/modules/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resetAnalyticsSessionContext } from "./analytics.js";
|
|
1
2
|
function isInsideIframe() {
|
|
2
3
|
if (typeof window === "undefined")
|
|
3
4
|
return false;
|
|
@@ -63,10 +64,40 @@ function loginViaPopup(url, redirectUrl, expectedOrigin) {
|
|
|
63
64
|
* @internal
|
|
64
65
|
*/
|
|
65
66
|
export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
67
|
+
// In-flight `me()` request, shared by concurrent callers. The analytics
|
|
68
|
+
// module resolves its session context through `me()` at client construction,
|
|
69
|
+
// at the same moment most apps issue their own `me()`. Browsers serialize the
|
|
70
|
+
// two identical GETs, so the second pays the first's full latency on every
|
|
71
|
+
// cold load.
|
|
72
|
+
//
|
|
73
|
+
// This shares the pending promise only — it is cleared as soon as the request
|
|
74
|
+
// settles, so no resolved user is ever retained. Caching the user across
|
|
75
|
+
// requests would leave the app rendering a stale identity after logout or a
|
|
76
|
+
// session swap.
|
|
77
|
+
let pendingMe = null;
|
|
78
|
+
const clearPendingMe = () => {
|
|
79
|
+
pendingMe = null;
|
|
80
|
+
};
|
|
81
|
+
// Tracked here rather than read off `axios.defaults` so the answer stays tied
|
|
82
|
+
// to the identity transitions below (`setToken`, `logout`) instead of to the
|
|
83
|
+
// header a caller may have set on the instance directly.
|
|
84
|
+
let hasAccessToken = Boolean(options.token);
|
|
66
85
|
return {
|
|
86
|
+
hasToken() {
|
|
87
|
+
return hasAccessToken;
|
|
88
|
+
},
|
|
67
89
|
// Get current user information
|
|
68
90
|
async me() {
|
|
69
|
-
|
|
91
|
+
const request = pendingMe !== null && pendingMe !== void 0 ? pendingMe : axios.get(`/apps/${appId}/entities/User/me`).finally(() => {
|
|
92
|
+
// Only retire this request if it is still the shared one. An identity
|
|
93
|
+
// change mid-flight clears `pendingMe` and the next caller starts a
|
|
94
|
+
// fresh request; an unconditional clear here would retire that newer
|
|
95
|
+
// request instead, so a third caller would issue a duplicate.
|
|
96
|
+
if (pendingMe === request)
|
|
97
|
+
pendingMe = null;
|
|
98
|
+
});
|
|
99
|
+
pendingMe = request;
|
|
100
|
+
return request;
|
|
70
101
|
},
|
|
71
102
|
// Update current user data
|
|
72
103
|
async updateMe(data) {
|
|
@@ -116,6 +147,11 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
116
147
|
logout(redirectUrl) {
|
|
117
148
|
// Remove token from axios headers (always do this)
|
|
118
149
|
delete axios.defaults.headers.common["Authorization"];
|
|
150
|
+
// Drop identity resolved under the previous session: a `me()` already in
|
|
151
|
+
// flight would otherwise resolve into callers that run after the logout.
|
|
152
|
+
clearPendingMe();
|
|
153
|
+
resetAnalyticsSessionContext();
|
|
154
|
+
hasAccessToken = false;
|
|
119
155
|
// Only do the rest if in a browser environment
|
|
120
156
|
if (typeof window !== "undefined") {
|
|
121
157
|
// Remove token from localStorage
|
|
@@ -140,6 +176,11 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
140
176
|
setToken(token, saveToStorage = true) {
|
|
141
177
|
if (!token)
|
|
142
178
|
return;
|
|
179
|
+
// Same reasoning as in `logout`: the identity changes here, so anything
|
|
180
|
+
// resolved for the previous one must not be handed to later callers.
|
|
181
|
+
clearPendingMe();
|
|
182
|
+
resetAnalyticsSessionContext();
|
|
183
|
+
hasAccessToken = true;
|
|
143
184
|
// handle token change for axios clients
|
|
144
185
|
axios.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
145
186
|
functionsAxiosClient.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
@@ -92,6 +92,12 @@ export interface AuthModuleOptions {
|
|
|
92
92
|
serverUrl: string;
|
|
93
93
|
/** Base URL for the app (used for login redirects). */
|
|
94
94
|
appBaseUrl: string;
|
|
95
|
+
/**
|
|
96
|
+
* Access token the client was constructed with, if any. Seeds the module's
|
|
97
|
+
* view of whether a session exists before {@link AuthModule.setToken} runs,
|
|
98
|
+
* which is how the server-side SDK reports a token it never sets explicitly.
|
|
99
|
+
*/
|
|
100
|
+
token?: string;
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
97
103
|
* Authentication module for managing user authentication and authorization. The module automatically stores tokens in local storage when available and manages authorization headers for API requests.
|
|
@@ -515,3 +521,20 @@ export interface AuthModule {
|
|
|
515
521
|
*/
|
|
516
522
|
changePassword(params: ChangePasswordParams): Promise<any>;
|
|
517
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* The auth module as constructed internally, before it is narrowed to
|
|
526
|
+
* {@link AuthModule} on the public client. Not exported from the package
|
|
527
|
+
* index — SDK consumers see only {@link AuthModule}.
|
|
528
|
+
*
|
|
529
|
+
* @internal
|
|
530
|
+
*/
|
|
531
|
+
export interface InternalAuthModule extends AuthModule {
|
|
532
|
+
/**
|
|
533
|
+
* Whether an access token is currently set on the client.
|
|
534
|
+
*
|
|
535
|
+
* Reports only the presence of a token, never its validity — an expired or
|
|
536
|
+
* revoked token still reads as `true`. Callers use this to skip requests that
|
|
537
|
+
* could not succeed without a session, not to decide that one is valid.
|
|
538
|
+
*/
|
|
539
|
+
hasToken(): boolean;
|
|
540
|
+
}
|
|
@@ -53,11 +53,14 @@ 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.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* Shared connectors come in two forms, depending on how the connector is set up. Both return the same app-wide token, so they differ only in how you identify the connector in code:
|
|
59
|
+
*
|
|
60
|
+
* - **Platform connectors** are connected from the app's Integration settings or with the [`connectors push`](/developers/references/cli/commands/connectors-push) CLI command, and are identified by an [integration type](#available-connectors) string. Retrieve them with {@linkcode getConnection | getConnection()}.
|
|
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.
|
|
61
64
|
*
|
|
62
65
|
* ## App user connectors
|
|
63
66
|
*
|
|
@@ -70,7 +73,7 @@ export interface AppUserConnectorConnectionResponse {
|
|
|
70
73
|
*
|
|
71
74
|
* ## Available connectors
|
|
72
75
|
*
|
|
73
|
-
*
|
|
76
|
+
* The connectors below can be used as shared connectors or as app user connectors. For a shared platform connector, pass the integration type string to {@linkcode getConnection | getConnection()}. For a connector you register in Workspace Settings with your own OAuth app, use the connector ID with {@linkcode getWorkspaceConnection | getWorkspaceConnection()} for a shared token, or with {@linkcode getCurrentAppUserConnection | getCurrentAppUserConnection()} for a per-user token.
|
|
74
77
|
*
|
|
75
78
|
* | Service | Type identifier |
|
|
76
79
|
* |---|---|
|
|
@@ -204,6 +207,8 @@ export interface ConnectorsModule {
|
|
|
204
207
|
*
|
|
205
208
|
* 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.
|
|
206
209
|
*
|
|
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
|
+
*
|
|
207
212
|
* Some connectors require connection-specific parameters to build API calls.
|
|
208
213
|
* 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`.
|
|
209
214
|
*
|
|
@@ -257,28 +262,27 @@ export interface ConnectorsModule {
|
|
|
257
262
|
*/
|
|
258
263
|
getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
|
|
259
264
|
/**
|
|
260
|
-
* Retrieves the OAuth access token and connection configuration for a
|
|
261
|
-
* (a connector backed by an OAuth app registered in the workspace, consented to once by the app builder).
|
|
265
|
+
* Retrieves the shared OAuth access token and connection configuration for a [workspace-registered connector](#shared-connectors).
|
|
262
266
|
*
|
|
263
|
-
* Use this
|
|
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.
|
|
267
|
+
* Use this for a connector backed by your own OAuth app that you register in Workspace Settings, such as Databricks or Snowflake. The app builder consents to the connector once, and the returned token is shared across all app users of the app. This is the shared-token counterpart to {@linkcode getCurrentAppUserConnection | getCurrentAppUserConnection()}, which returns a per-user token for the same kind of connector. The semantics match {@linkcode getConnection | getConnection()}, except that you identify the connector by ID rather than by integration type.
|
|
268
268
|
*
|
|
269
|
-
*
|
|
269
|
+
* Some connectors require connection-specific parameters to build API calls. In such cases, the returned `connectionConfig` is an object with those parameters, such as the account subdomain used to construct the API URL. When no extra parameters are needed, `connectionConfig` is `null`.
|
|
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.
|
|
270
272
|
* @returns Promise resolving to a {@link ConnectorConnectionResponse} with `accessToken` and `connectionConfig`.
|
|
271
273
|
*
|
|
272
274
|
* @example
|
|
273
275
|
* ```typescript
|
|
274
|
-
* //
|
|
275
|
-
*
|
|
276
|
-
*
|
|
276
|
+
* // Snowflake connection
|
|
277
|
+
* // Retrieve the shared token and run a statement against the account
|
|
278
|
+
* const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getWorkspaceConnection('abc123def');
|
|
279
|
+
*
|
|
280
|
+
* const response = await fetch(
|
|
281
|
+
* `https://${connectionConfig?.subdomain}.snowflakecomputing.com/api/v2/statements`,
|
|
282
|
+
* { headers: { Authorization: `Bearer ${accessToken}` } }
|
|
277
283
|
* );
|
|
278
284
|
*
|
|
279
|
-
* const
|
|
280
|
-
* headers: { Authorization: `Bearer ${accessToken}` },
|
|
281
|
-
* });
|
|
285
|
+
* const data = await response.json();
|
|
282
286
|
* ```
|
|
283
287
|
*/
|
|
284
288
|
getWorkspaceConnection(connectorId: string): Promise<ConnectorConnectionResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/base44__sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.43-depup.0",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API (with updated dependencies)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
},
|
|
89
89
|
"depsUpdated": 3,
|
|
90
90
|
"originalPackage": "@base44/sdk",
|
|
91
|
-
"originalVersion": "0.8.
|
|
92
|
-
"processedAt": "2026-
|
|
91
|
+
"originalVersion": "0.8.43",
|
|
92
|
+
"processedAt": "2026-08-18T08:10:35.872Z",
|
|
93
93
|
"smokeTest": "passed"
|
|
94
94
|
}
|
|
95
95
|
}
|