quickbase-js 0.1.0-beta.12 → 0.1.0-beta.14

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.
Files changed (168) hide show
  1. package/README.md +48 -18
  2. package/dist/esm/quickbase.d.ts +13 -3
  3. package/dist/esm/quickbase.js +416 -49
  4. package/dist/esm/quickbase.js.map +1 -1
  5. package/dist/esm/quickbase.min.js +1 -1
  6. package/dist/esm/quickbase.min.js.map +1 -1
  7. package/dist/umd/quickbase.umd.js +416 -49
  8. package/dist/umd/quickbase.umd.js.map +1 -1
  9. package/dist/umd/quickbase.umd.min.js +1 -1
  10. package/dist/umd/quickbase.umd.min.js.map +1 -1
  11. package/package.json +11 -4
  12. package/CHANGELOG.md +0 -227
  13. package/build-common.js +0 -131
  14. package/build-esm.js +0 -71
  15. package/build-umd.js +0 -69
  16. package/docs/.vitepress/cache/deps/@theme_index.js +0 -275
  17. package/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
  18. package/docs/.vitepress/cache/deps/_metadata.json +0 -40
  19. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js +0 -12542
  20. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js.map +0 -7
  21. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js +0 -9719
  22. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js.map +0 -7
  23. package/docs/.vitepress/cache/deps/package.json +0 -3
  24. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4504
  25. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  26. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -583
  27. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  28. package/docs/.vitepress/cache/deps/vue.js +0 -343
  29. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  30. package/docs/.vitepress/config.mts +0 -26
  31. package/docs/api-examples.md +0 -49
  32. package/docs/index.md +0 -59
  33. package/docs/markdown-examples.md +0 -85
  34. package/docs-data/api-docs.json +0 -4143
  35. package/examples/quicbase-jsCDN.html +0 -36
  36. package/examples/react.js +0 -48
  37. package/examples/vanillajs.html +0 -47
  38. package/index.md +0 -25
  39. package/open-api/fix-spec-main.ts +0 -133
  40. package/open-api/generate-unified-interface.ts +0 -104
  41. package/open-api/generateDocsJson.ts +0 -24
  42. package/open-api/output/quickbase-fixed.json +0 -11191
  43. package/open-api/post-process-generated.ts +0 -226
  44. package/open-api/regenerate-client.ts +0 -117
  45. package/open-api/schema/enhance-general.ts +0 -111
  46. package/open-api/schema/fix-arrays.ts +0 -68
  47. package/open-api/schema/tags/apps.ts +0 -90
  48. package/open-api/schema/tags/fields.ts +0 -471
  49. package/open-api/schema/tags/groups.ts +0 -51
  50. package/open-api/schema/tags/index.ts +0 -66
  51. package/open-api/schema/tags/records.ts +0 -115
  52. package/open-api/schema/tags/tables.ts +0 -211
  53. package/open-api/schema/tags/users.ts +0 -47
  54. package/open-api/types/spec.ts +0 -42
  55. package/open-api/utils/common.ts +0 -29
  56. package/open-api/utils/generateJsDoc.ts +0 -74
  57. package/open-api/utils/infer-schema.ts +0 -40
  58. package/open-api/utils/naming.ts +0 -10
  59. package/open-api/utils/sharedUtils.ts +0 -352
  60. package/playwright.config.ts +0 -37
  61. package/rollup.config.js +0 -114
  62. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  63. package/specs/split/apps.json +0 -1315
  64. package/specs/split/auth.json +0 -191
  65. package/specs/split/fields.json +0 -3869
  66. package/specs/split/records.json +0 -754
  67. package/specs/split/reports.json +0 -619
  68. package/specs/split/tables.json +0 -1605
  69. package/src/RateLimitError.ts +0 -12
  70. package/src/ThrottleBucket.ts +0 -77
  71. package/src/authorizationStrategy.ts +0 -310
  72. package/src/generated-unified/QuickbaseClient.ts +0 -1135
  73. package/src/generated-unified/missing-types-report.json +0 -3
  74. package/src/index.ts +0 -1
  75. package/src/invokeMethod.ts +0 -212
  76. package/src/quickbaseClient.ts +0 -199
  77. package/src/rateLimiter.ts +0 -30
  78. package/src/tokenCache.ts +0 -39
  79. package/src/utils.ts +0 -50
  80. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
  81. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
  82. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
  83. package/tests/playwright/qb/auth/getAppWithTempTokenConcurrency.test.ts +0 -208
  84. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
  85. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
  86. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
  87. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
  88. package/tests/setup.ts +0 -53
  89. package/tests/vitest/qb/ThrottleBucket.test.ts +0 -77
  90. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  91. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  92. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  93. package/tests/vitest/qb/apps/getApp.test.ts +0 -44
  94. package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
  95. package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
  96. package/tests/vitest/qb/auth/mockQuickbaseServer.ts +0 -60
  97. package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -73
  98. package/tests/vitest/qb/auth/ssoTokenConcurrency.test.ts +0 -68
  99. package/tests/vitest/qb/auth/ssoTokenIntegrationWithServer.test.ts +0 -65
  100. package/tests/vitest/qb/auth/userTokenConcurrency.test.ts +0 -63
  101. package/tests/vitest/qb/fields/createField.test.ts +0 -77
  102. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
  103. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  104. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -82
  105. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  106. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  107. package/tests/vitest/qb/fields/updateField.test.ts +0 -93
  108. package/tests/vitest/qb/formulas/runFormula.test.ts +0 -96
  109. package/tests/vitest/qb/index.ts +0 -29
  110. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  111. package/tests/vitest/qb/records/runQuery.test.ts +0 -146
  112. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  113. package/tests/vitest/qb/tables/createRelationship.test.ts +0 -102
  114. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  115. package/tests/vitest/qb/tables/deleteRelationship.test.ts +0 -143
  116. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  117. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  118. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  119. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  120. package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -250
  121. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  122. package/tests/vitest/unit/ThrottleBucket.test.ts +0 -101
  123. package/tests/vitest/unit/apps/copyApp.test.ts +0 -581
  124. package/tests/vitest/unit/apps/createApp.test.ts +0 -186
  125. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
  126. package/tests/vitest/unit/apps/getApp.test.ts +0 -128
  127. package/tests/vitest/unit/apps/getAppConcurrency.test.ts +0 -151
  128. package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
  129. package/tests/vitest/unit/apps/updateApp.test.ts +0 -412
  130. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -81
  131. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -119
  132. package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -95
  133. package/tests/vitest/unit/auth/retryTempTokenMaxRetries.test.ts +0 -206
  134. package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -69
  135. package/tests/vitest/unit/auth/ssoTokenRefresh.test.ts +0 -325
  136. package/tests/vitest/unit/auth/userTokenConcurrency.test.ts +0 -62
  137. package/tests/vitest/unit/fields/createField.test.ts +0 -451
  138. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  139. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  140. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -180
  141. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  142. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  143. package/tests/vitest/unit/fields/updateField.test.ts +0 -285
  144. package/tests/vitest/unit/formulas/runFormula.test.ts +0 -205
  145. package/tests/vitest/unit/index.ts +0 -34
  146. package/tests/vitest/unit/quickbaseClientHttpMethods.test.ts +0 -139
  147. package/tests/vitest/unit/rateLimit.test.ts +0 -191
  148. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  149. package/tests/vitest/unit/records/runQuery.test.ts +0 -102
  150. package/tests/vitest/unit/records/upsert.test.ts +0 -234
  151. package/tests/vitest/unit/tables/createRelationship.test.ts +0 -212
  152. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  153. package/tests/vitest/unit/tables/deleteRelationship.test.ts +0 -97
  154. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  155. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  156. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  157. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  158. package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -307
  159. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  160. package/tests/vitest/unit/tokenLifespan.test.ts +0 -204
  161. package/tests/vitest/unit/umd.test.ts +0 -8
  162. package/tools/log-gen.ts +0 -251
  163. package/tools/log-gen.yaml +0 -4829
  164. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  165. package/tsconfig.build.json +0 -17
  166. package/tsconfig.json +0 -32
  167. package/versionrc.json +0 -9
  168. package/vitest.config.ts +0 -27
@@ -1,12 +0,0 @@
1
- // src/RateLimitError.ts
2
- export class RateLimitError extends Error {
3
- public readonly status: number;
4
- public readonly retryAfter?: number;
5
-
6
- constructor(message: string, status: number, retryAfter?: number) {
7
- super(message);
8
- this.name = "RateLimitError";
9
- this.status = status;
10
- this.retryAfter = retryAfter; // Seconds from Retry-After header, if present
11
- }
12
- }
@@ -1,77 +0,0 @@
1
- // src/ThrottleBucket.ts
2
- export class ConcurrentThrottleBucket {
3
- private tokens: number;
4
- private maxTokens: number;
5
- private refillRate: number;
6
- private lastRefill: number;
7
- private semaphore: Semaphore;
8
-
9
- constructor(rate: number, burst: number) {
10
- this.tokens = burst;
11
- this.maxTokens = burst;
12
- this.refillRate = rate;
13
- this.lastRefill = Date.now();
14
- this.semaphore = new Semaphore(burst);
15
- }
16
-
17
- private refill(): void {
18
- const now = Date.now();
19
- const elapsed = (now - this.lastRefill) / 1000;
20
- const newTokens = elapsed * this.refillRate;
21
- this.tokens = Math.min(this.maxTokens, this.tokens + newTokens);
22
- this.lastRefill = now;
23
- }
24
-
25
- async acquire(): Promise<void> {
26
- await this.semaphore.acquire();
27
- try {
28
- this.refill();
29
- while (this.tokens < 1) {
30
- const waitTime = ((1 - this.tokens) / this.refillRate) * 1000;
31
- await new Promise((resolve) => setTimeout(resolve, waitTime));
32
- this.refill();
33
- }
34
- this.tokens -= 1;
35
- } catch (error) {
36
- this.semaphore.release();
37
- throw error;
38
- }
39
- }
40
-
41
- release(): void {
42
- this.semaphore.release();
43
- }
44
- }
45
-
46
- class Semaphore {
47
- private permits: number;
48
- private waiting: Array<{ resolve: () => void; reject: (err: any) => void }> =
49
- [];
50
-
51
- constructor(maxPermits: number) {
52
- this.permits = maxPermits;
53
- }
54
-
55
- async acquire(): Promise<void> {
56
- if (this.permits > 0) {
57
- this.permits -= 1;
58
- return;
59
- }
60
- return new Promise((resolve, reject) => {
61
- this.waiting.push({ resolve, reject });
62
- });
63
- }
64
-
65
- release(): void {
66
- this.permits += 1;
67
- if (this.waiting.length > 0 && this.permits > 0) {
68
- const { resolve } = this.waiting.shift()!;
69
- this.permits -= 1;
70
- resolve();
71
- }
72
- }
73
-
74
- available(): number {
75
- return this.permits;
76
- }
77
- }
@@ -1,310 +0,0 @@
1
- // src/authorizationStrategy.ts
2
- import { TokenCache } from "./tokenCache";
3
-
4
- export interface AuthorizationStrategy {
5
- getToken(dbid: string): Promise<string | undefined>;
6
- applyHeaders(headers: Record<string, string>, token: string): void;
7
- handleError(
8
- status: number,
9
- params: any,
10
- attempt: number,
11
- maxAttempts: number,
12
- debug?: boolean,
13
- methodName?: string
14
- ): Promise<string | null>;
15
- }
16
-
17
- export class TempTokenStrategy implements AuthorizationStrategy {
18
- private pendingFetches: Map<string, Promise<string>> = new Map();
19
-
20
- constructor(
21
- private tokenCache: TokenCache,
22
- private initialTempToken: string | undefined,
23
- private fetchApi: typeof fetch,
24
- private realm: string,
25
- private baseUrl: string = "https://api.quickbase.com/v1"
26
- ) {}
27
-
28
- async fetchTempToken(dbid: string): Promise<string> {
29
- const headers = {
30
- "QB-Realm-Hostname": `${this.realm}.quickbase.com`,
31
- "Content-Type": "application/json",
32
- };
33
- const response = await this.fetchApi(
34
- `${this.baseUrl}/auth/temporary/${dbid}`,
35
- {
36
- method: "GET",
37
- headers,
38
- credentials: "include",
39
- }
40
- );
41
-
42
- if (!response.ok) {
43
- const errorBody = await response.json().catch(() => ({}));
44
- const message = errorBody.message || "Unknown error";
45
- throw new Error(`API Error: ${message} (Status: ${response.status})`);
46
- }
47
-
48
- const tokenResult = await response.json();
49
- const token = tokenResult.temporaryAuthorization;
50
- if (!token) {
51
- throw new Error(
52
- "API Error: No temporary token returned from API (Status: 200)"
53
- );
54
- }
55
- this.tokenCache.set(dbid, token);
56
- console.log(`Fetched and cached new token for dbid: ${dbid}`, token);
57
- return token;
58
- }
59
-
60
- async getToken(dbid: string): Promise<string | undefined> {
61
- let token = this.tokenCache.get(dbid) || this.initialTempToken;
62
- if (!token && dbid) {
63
- if (this.pendingFetches.has(dbid)) {
64
- console.log(`[getToken] Waiting for existing fetch for dbid: ${dbid}`);
65
- return this.pendingFetches.get(dbid);
66
- }
67
- const fetchPromise = this.fetchTempToken(dbid).finally(() =>
68
- this.pendingFetches.delete(dbid)
69
- );
70
- this.pendingFetches.set(dbid, fetchPromise);
71
- token = await fetchPromise;
72
- }
73
- return token;
74
- }
75
-
76
- applyHeaders(headers: Record<string, string>, token: string): void {
77
- headers["Authorization"] = `QB-TEMP-TOKEN ${token}`;
78
- }
79
-
80
- async handleError(
81
- status: number,
82
- params: any,
83
- attempt: number,
84
- maxAttempts: number,
85
- debug?: boolean,
86
- methodName?: string
87
- ): Promise<string | null> {
88
- if (status !== 401 || attempt >= maxAttempts - 1) return null;
89
- if (debug)
90
- console.log(
91
- `Authorization error for ${
92
- methodName || "method"
93
- } (temp token), refreshing token:`
94
- );
95
- const dbid = extractDbid(params);
96
- if (!dbid) {
97
- if (debug)
98
- console.log(
99
- `No dbid available for ${
100
- methodName || "method"
101
- }, skipping token refresh`
102
- );
103
- return null;
104
- }
105
- if (debug) console.log(`Refreshing temp token for dbid: ${dbid}`);
106
- // Invalidate the cache for this dbid to force a fresh fetch
107
- this.tokenCache.delete(dbid);
108
- try {
109
- const newToken = await this.getToken(dbid);
110
- if (newToken) {
111
- this.tokenCache.set(dbid, newToken);
112
- return newToken;
113
- }
114
- return null;
115
- } catch (error) {
116
- if (debug)
117
- console.log(
118
- `[${methodName || "method"}] Failed to refresh token:`,
119
- error
120
- );
121
- throw error;
122
- }
123
- }
124
- }
125
-
126
- export class UserTokenStrategy implements AuthorizationStrategy {
127
- constructor(
128
- private userToken: string,
129
- private baseUrl: string = "https://api.quickbase.com/v1"
130
- ) {}
131
-
132
- async getToken(_dbid: string): Promise<string> {
133
- return this.userToken;
134
- }
135
-
136
- applyHeaders(headers: Record<string, string>, token: string): void {
137
- headers["Authorization"] = `QB-USER-TOKEN ${token}`;
138
- }
139
-
140
- async handleError(
141
- status: number,
142
- _params: any,
143
- attempt: number,
144
- maxAttempts: number,
145
- debug?: boolean,
146
- methodName?: string
147
- ): Promise<string | null> {
148
- if (status !== 401 || attempt >= maxAttempts - 1) return null;
149
- if (debug)
150
- console.log(
151
- `Retrying ${
152
- methodName || "method"
153
- } with existing user token: ${this.userToken.substring(0, 10)}...`
154
- );
155
- return this.userToken;
156
- }
157
- }
158
-
159
- export class SsoTokenStrategy implements AuthorizationStrategy {
160
- private currentToken: string | undefined;
161
- private pendingFetches: Map<string, Promise<string>> = new Map();
162
-
163
- constructor(
164
- private samlToken: string,
165
- private realm: string,
166
- private fetchApi: typeof fetch,
167
- private debug: boolean = false,
168
- private baseUrl: string = "https://api.quickbase.com/v1"
169
- ) {}
170
-
171
- async getToken(_dbid: string): Promise<string | undefined> {
172
- if (!this.currentToken) {
173
- if (this.pendingFetches.has("sso")) {
174
- if (this.debug)
175
- console.log("[getToken] Waiting for existing SSO fetch");
176
- return this.pendingFetches.get("sso");
177
- }
178
- const fetchPromise = this.fetchSsoToken({
179
- grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
180
- requested_token_type:
181
- "urn:quickbase:params:oauth:token-type:temp_token",
182
- subject_token: this.samlToken,
183
- subject_token_type: "urn:ietf:params:oauth:token-type:saml2",
184
- }).finally(() => this.pendingFetches.delete("sso"));
185
- this.pendingFetches.set("sso", fetchPromise);
186
- this.currentToken = await fetchPromise;
187
- }
188
- return this.currentToken;
189
- }
190
-
191
- applyHeaders(headers: Record<string, string>, token: string): void {
192
- headers["Authorization"] = `QB-TEMP-TOKEN ${token}`;
193
- }
194
-
195
- async handleError(
196
- status: number,
197
- _params: any,
198
- attempt: number,
199
- maxAttempts: number,
200
- debug?: boolean,
201
- methodName?: string
202
- ): Promise<string | null> {
203
- if (status !== 401 || attempt >= maxAttempts - 1) return null;
204
-
205
- if (debug || this.debug) {
206
- console.log(
207
- `Authorization error for ${
208
- methodName || "method"
209
- } (SSO), refreshing token`
210
- );
211
- }
212
-
213
- const newToken = await this.refreshSsoToken(debug || this.debug);
214
- if (newToken) {
215
- this.currentToken = newToken;
216
- return newToken;
217
- }
218
- return null;
219
- }
220
-
221
- private async refreshSsoToken(debug: boolean = false): Promise<string> {
222
- const payload = {
223
- grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
224
- requested_token_type: "urn:quickbase:params:oauth:token-type:temp_token",
225
- subject_token: this.samlToken,
226
- subject_token_type: "urn:ietf:params:oauth:token-type:saml2",
227
- };
228
-
229
- const response = await this.fetchApi(`${this.baseUrl}/auth/oauth/token`, {
230
- method: "POST",
231
- headers: {
232
- "QB-Realm-Hostname": `${this.realm}.quickbase.com`,
233
- "Content-Type": "application/json",
234
- },
235
- body: JSON.stringify(payload),
236
- credentials: "omit",
237
- });
238
-
239
- if (!response.ok) {
240
- const errorBody = await response.json().catch(() => ({}));
241
- if (debug) {
242
- console.log(`[SSO Refresh] Failed: ${response.status}`, errorBody);
243
- }
244
- throw new Error(
245
- `SSO token refresh failed: ${errorBody.message || "Unknown error"}`
246
- );
247
- }
248
-
249
- const result = await response.json();
250
- const newToken = result.access_token;
251
- if (!newToken) {
252
- throw new Error("No access token returned from SSO token exchange");
253
- }
254
-
255
- if (debug) {
256
- console.log(`[SSO Refresh] New token: ${newToken.substring(0, 10)}...`);
257
- }
258
- return newToken;
259
- }
260
-
261
- private async fetchSsoToken(params: {
262
- grant_type: string;
263
- requested_token_type: string;
264
- subject_token: string;
265
- subject_token_type: string;
266
- }): Promise<string> {
267
- const response = await this.fetchApi(`${this.baseUrl}/auth/oauth/token`, {
268
- method: "POST",
269
- headers: {
270
- "QB-Realm-Hostname": `${this.realm}.quickbase.com`,
271
- "Content-Type": "application/json",
272
- },
273
- body: JSON.stringify(params),
274
- credentials: "omit",
275
- });
276
-
277
- if (!response.ok) {
278
- const errorBody = await response.json().catch(() => ({}));
279
- if (this.debug) {
280
- console.log(`[fetchSsoToken] Failed: ${response.status}`, errorBody);
281
- }
282
- throw new Error(
283
- `SSO token fetch failed: ${errorBody.message || "Unknown error"}`
284
- );
285
- }
286
-
287
- const result = await response.json();
288
- const newToken = result.access_token;
289
- if (!newToken) {
290
- throw new Error("No access token returned from SSO token exchange");
291
- }
292
-
293
- if (this.debug) {
294
- console.log(
295
- `[fetchSsoToken] Fetched token: ${newToken.substring(0, 10)}...`
296
- );
297
- }
298
- return newToken;
299
- }
300
- }
301
-
302
- export function extractDbid(params: any): string | undefined {
303
- return (
304
- params.dbid ||
305
- params.tableId ||
306
- params.appId ||
307
- params.body?.from ||
308
- params.body?.to
309
- );
310
- }