quickbase-js 1.0.1-beta.0 → 1.1.0-beta.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{quickbaseClient.d.ts → quickbase.d.ts} +344 -339
  3. package/dist/{quickbaseClient.js → quickbase.js} +350 -266
  4. package/dist/quickbase.js.map +1 -0
  5. package/log-gen.yaml +3565 -0
  6. package/package.json +11 -7
  7. package/rollup.config.js +2 -2
  8. package/src/code-generation/fix-spec-definitions.ts +417 -68
  9. package/src/code-generation/fix-spec-paths.ts +207 -2
  10. package/src/code-generation/output/quickbase-fixed.json +646 -1122
  11. package/src/generated-unified/QuickbaseClient.ts +9 -8
  12. package/src/log-gen.ts +82 -35
  13. package/src/quickbaseClient.ts +39 -42
  14. package/test-artifacts/test-results.json +173 -1145
  15. package/tests/playwright/qb/auth/cacheSwitching.test.ts +2 -2
  16. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +2 -2
  17. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +2 -2
  18. package/tests/playwright/qb/auth/getTempToken.test.ts +2 -2
  19. package/tests/playwright/qb/auth/tokenPrefetch.test.ts +2 -2
  20. package/tests/playwright/qb/auth/tokenRenewal.test.ts +2 -2
  21. package/tests/setup.ts +16 -8
  22. package/tests/vitest/qb/apps/getApp.test.ts +37 -43
  23. package/tests/vitest/qb/records/deleteRecords.test.ts +78 -0
  24. package/tests/vitest/qb/records/upsert.test.ts +72 -0
  25. package/tests/vitest/qb/tables/createTable.test.ts +55 -0
  26. package/tests/vitest/qb/tables/deleteTable.test.ts +50 -0
  27. package/tests/vitest/qb/tables/getAppTables.test.ts +43 -64
  28. package/tests/vitest/qb/tables/getTable.test.ts +26 -0
  29. package/tests/vitest/qb/tables/updateTable.test.ts +48 -0
  30. package/tests/vitest/unit/apps/getApp.test.ts +1 -1
  31. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +4 -3
  32. package/tests/vitest/unit/auth/getTempToken.test.ts +8 -9
  33. package/tests/vitest/unit/auth/retryOn401.test.ts +1 -1
  34. package/tests/vitest/unit/auth/two401s.test.ts +1 -1
  35. package/tests/vitest/unit/fields/getFields.test.ts +1 -1
  36. package/tests/vitest/unit/records/deleteRecords.test.ts +118 -0
  37. package/tests/vitest/unit/records/upsert.test.ts +228 -0
  38. package/tests/vitest/unit/tables/createTable.test.ts +62 -0
  39. package/tests/vitest/unit/tables/deleteTable.test.ts +68 -0
  40. package/tests/vitest/unit/tables/getAppTables.test.ts +1 -1
  41. package/tests/vitest/unit/tables/getTable.test.ts +212 -0
  42. package/tests/vitest/unit/tables/updateTable.test.ts +74 -0
  43. package/tsconfig.json +3 -2
  44. package/vitest.config.ts +3 -2
  45. package/dist/quickbaseClient.js.map +0 -1
  46. package/logGen.yaml +0 -1820
  47. package/src/utils.ts +0 -5
package/package.json CHANGED
@@ -1,33 +1,37 @@
1
1
  {
2
2
  "name": "quickbase-js",
3
- "main": "dist/quickbaseClient.js",
4
- "types": "dist/quickbaseClient.d.ts",
5
- "version": "1.0.1-beta.0",
3
+ "main": "dist/quickbase.js",
4
+ "types": "dist/quickbase.d.ts",
5
+ "version": "1.1.0-beta.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "description": "QuickBase JavaScript client for frameworks and vanilla JS",
10
- "module": "dist/quickbaseClient.js",
10
+ "module": "dist/quickbase.js",
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "import": "./dist/quickbaseClient.js",
15
- "types": "./dist/quickbaseClient.d.ts"
14
+ "import": "./dist/quickbase.js",
15
+ "types": "./dist/quickbase.d.ts"
16
16
  }
17
17
  },
18
18
  "scripts": {
19
19
  "release": "standard-version",
20
20
  "release:beta": "standard-version --prerelease beta",
21
21
  "release:alpha": "standard-version --prerelease alpha",
22
+ "release:push": "npm run release:beta && git push --follow-tags origin main",
23
+ "release:publish": "npm run release:push && npm publish --tag beta",
22
24
  "fix-spec": "node --loader ts-node/esm src/code-generation/fix-spec-main.ts",
23
25
  "regenerate": "node --loader ts-node/esm src/code-generation/regenerate-client.ts",
24
26
  "generate-unified": "node --loader ts-node/esm src/code-generation/generate-unified-interface.ts",
27
+ "update-client": "npm run fix-spec && npm run regenerate && npm run generate-unified",
25
28
  "log-gen": "node --loader ts-node/esm src/log-gen.ts",
26
29
  "build": "rimraf dist && rollup -c",
27
30
  "build:prod": "rm -rf dist/* && NODE_ENV=production rollup -c",
28
- "test": "vitest run tests/vitest/**/**/*.test.ts",
29
31
  "test:pw:qb:all": "playwright test tests/playwright/qb --config playwright.config.ts",
32
+ "test:vitest:all": "vitest run tests/vitest/**/**/*.test.ts",
30
33
  "test:vitest:qb": "vitest run tests/vitest/qb/**/*.test.ts",
34
+ "test:vitest:unit": "vitest run tests/vitest/unit/**/*.test.ts",
31
35
  "test:vitest:qb:apps": "vitest run tests/vitest/qb/apps/**/*.test.ts",
32
36
  "test:vitest:qb:auth": "vitest run tests/vitest/qb/auth/**/*.test.ts",
33
37
  "test:vitest:qb:fields": "vitest run tests/vitest/qb/fields/**/*.test.ts",
package/rollup.config.js CHANGED
@@ -14,7 +14,7 @@ export default [
14
14
  format: "esm",
15
15
  sourcemap: true,
16
16
  compact: isProd,
17
- entryFileNames: "quickbaseClient.js",
17
+ entryFileNames: "quickbase.js",
18
18
  },
19
19
  external: [
20
20
  "node:http",
@@ -42,7 +42,7 @@ export default [
42
42
  {
43
43
  input: "src/quickbaseClient.ts",
44
44
  output: {
45
- file: "dist/quickbaseClient.d.ts",
45
+ file: "dist/quickbase.d.ts",
46
46
  format: "esm",
47
47
  // Optional: sourcemap for .d.ts if needed for debugging
48
48
  // sourcemap: true,
@@ -1,6 +1,8 @@
1
+ // src/code-generation/fix-spec-definitions.ts
1
2
  export const definitions = {
2
3
  App: {
3
4
  type: "object",
5
+ required: ["id", "name"],
4
6
  properties: {
5
7
  id: { type: "string" },
6
8
  name: { type: "string" },
@@ -10,31 +12,140 @@ export const definitions = {
10
12
  timeZone: { type: "string" },
11
13
  dateFormat: { type: "string" },
12
14
  hasEveryoneOnTheInternet: { type: "boolean" },
15
+ memoryInfo: { $ref: "#/definitions/AppMemoryInfo" },
16
+ securityProperties: { $ref: "#/definitions/AppSecurityProperties" },
17
+ },
18
+ },
19
+ AppMemoryInfo: {
20
+ type: "object",
21
+ properties: {
22
+ estMemory: { type: "number" },
23
+ estMemoryInclDependentApps: { type: "number" },
24
+ },
25
+ },
26
+ AppSecurityProperties: {
27
+ type: "object",
28
+ properties: {
29
+ allowClone: { type: "boolean" },
30
+ allowExport: { type: "boolean" },
31
+ enableAppTokens: { type: "boolean" },
32
+ hideFromPublic: { type: "boolean" },
33
+ mustBeRealmApproved: { type: "boolean" },
34
+ useIPFilter: { type: "boolean" },
35
+ },
36
+ },
37
+ CreateAppRequest: {
38
+ type: "object",
39
+ required: ["name"],
40
+ properties: {
41
+ name: {
42
+ type: "string",
43
+ description:
44
+ "The app name. Multiple apps with the same name are allowed in the same realm.",
45
+ },
46
+ assignToken: {
47
+ type: "boolean",
48
+ description:
49
+ "Set to true to assign the app to the user token used to create it. Default is false.",
50
+ },
51
+ description: {
52
+ type: "string",
53
+ description:
54
+ "The description for the app. Defaults to blank if omitted.",
55
+ },
56
+ securityProperties: {
57
+ $ref: "#/definitions/AppSecurityProperties",
58
+ description: "Application security properties.",
59
+ },
60
+ variables: {
61
+ type: "array",
62
+ items: {
63
+ type: "object",
64
+ properties: {
65
+ name: { type: "string" },
66
+ value: { type: "string" },
67
+ },
68
+ required: ["name", "value"],
69
+ },
70
+ description:
71
+ "App variables (max 10, optional). See About Application Variables.",
72
+ },
73
+ },
74
+ },
75
+ CreateApp200Response: {
76
+ type: "object",
77
+ properties: {
78
+ id: {
79
+ type: "string",
80
+ description: "The unique identifier for this application.",
81
+ },
82
+ name: {
83
+ type: "string",
84
+ description: "The app name.",
85
+ },
86
+ description: {
87
+ type: "string",
88
+ description: "The description for the app.",
89
+ },
90
+ created: {
91
+ type: "string",
92
+ format: "date-time",
93
+ description: "The time and date the app was created (ISO 8601, UTC).",
94
+ },
95
+ updated: {
96
+ type: "string",
97
+ format: "date-time",
98
+ description:
99
+ "The time and date the app was last updated (ISO 8601, UTC).",
100
+ },
101
+ dateFormat: {
102
+ type: "string",
103
+ description:
104
+ "The format used for displaying dates in the app (e.g., MM-DD-YYYY).",
105
+ },
106
+ timeZone: {
107
+ type: "string",
108
+ description:
109
+ "The time zone used for displaying time values (e.g., (UTC-08:00) Pacific Time).",
110
+ },
13
111
  memoryInfo: {
14
- type: "object",
15
- properties: {
16
- estMemory: { type: "number" },
17
- estMemoryInclDependentApps: { type: "number" },
112
+ $ref: "#/definitions/AppMemoryInfo",
113
+ description: "Application memory information.",
114
+ },
115
+ hasEveryoneOnTheInternet: {
116
+ type: "boolean",
117
+ description:
118
+ "Indicates if the app includes Everyone On The Internet access.",
119
+ },
120
+ variables: {
121
+ type: "array",
122
+ items: {
123
+ type: "object",
124
+ properties: {
125
+ name: { type: "string" },
126
+ value: { type: "string" },
127
+ },
128
+ required: ["name", "value"],
18
129
  },
130
+ description: "The app variables.",
131
+ },
132
+ dataClassification: {
133
+ type: "string",
134
+ description:
135
+ "The Data Classification label assigned to the app (optional, may be 'None').",
19
136
  },
20
137
  securityProperties: {
21
- type: "object",
22
- properties: {
23
- allowClone: { type: "boolean" },
24
- allowExport: { type: "boolean" },
25
- enableAppTokens: { type: "boolean" },
26
- hideFromPublic: { type: "boolean" },
27
- mustBeRealmApproved: { type: "boolean" },
28
- useIPFilter: { type: "boolean" },
29
- },
138
+ $ref: "#/definitions/AppSecurityProperties",
139
+ description: "Security properties of the application.",
30
140
  },
31
141
  },
32
142
  required: ["id", "name"],
33
143
  },
34
144
  Field: {
35
145
  type: "object",
146
+ required: ["id", "label", "fieldType"],
36
147
  properties: {
37
- id: { type: "number" },
148
+ id: { type: "integer" },
38
149
  label: { type: "string" },
39
150
  fieldType: { type: "string" },
40
151
  noWrap: { type: "boolean" },
@@ -46,91 +157,329 @@ export const definitions = {
46
157
  doesDataCopy: { type: "boolean" },
47
158
  fieldHelp: { type: "string" },
48
159
  audited: { type: "boolean" },
49
- properties: {
50
- type: "object",
51
- properties: {
52
- primaryKey: { type: "boolean" },
53
- foreignKey: { type: "boolean" },
54
- numLines: { type: "number" },
55
- maxLength: { type: "number" },
56
- appendOnly: { type: "boolean" },
57
- allowHTML: { type: "boolean" },
58
- allowMentions: { type: "boolean" },
59
- sortAsGiven: { type: "boolean" },
60
- carryChoices: { type: "boolean" },
61
- allowNewChoices: { type: "boolean" },
62
- formula: { type: "string" },
63
- defaultValue: { type: "string" },
64
- },
65
- },
160
+ properties: { $ref: "#/definitions/FieldProperties" },
66
161
  permissions: {
67
162
  type: "array",
68
- items: {
69
- type: "object",
70
- properties: {
71
- permissionType: { type: "string" },
72
- role: { type: "string" },
73
- roleId: { type: "number" },
74
- },
75
- },
163
+ items: { $ref: "#/definitions/FieldPermissionsInner" },
76
164
  },
77
165
  },
78
- required: ["id", "label", "fieldType"],
79
166
  },
80
- Table: {
167
+ FieldProperties: {
81
168
  type: "object",
82
169
  properties: {
83
- id: { type: "string" },
84
- name: { type: "string" },
85
- alias: { type: "string" },
86
- created: { type: "string", format: "date-time" },
87
- defaultSortFieldId: { type: "number" },
88
- defaultSortOrder: { type: "string" },
89
- description: { type: "string" },
90
- keyFieldId: { type: "number" },
91
- nextFieldId: { type: "number" },
92
- nextRecordId: { type: "number" },
93
- pluralRecordName: { type: "string" },
94
- singleRecordName: { type: "string" },
95
- sizeLimit: { type: "string" },
96
- spaceRemaining: { type: "string" },
97
- spaceUsed: { type: "string" },
98
- updated: { type: "string", format: "date-time" },
170
+ primaryKey: { type: "boolean" },
171
+ foreignKey: { type: "boolean" },
172
+ numLines: { type: "integer" },
173
+ maxLength: { type: "integer" },
174
+ appendOnly: { type: "boolean" },
175
+ allowHTML: { type: "boolean" },
176
+ allowMentions: { type: "boolean" },
177
+ sortAsGiven: { type: "boolean" },
178
+ carryChoices: { type: "boolean" },
179
+ allowNewChoices: { type: "boolean" },
180
+ formula: { type: "string" },
181
+ defaultValue: { type: "string" },
182
+ },
183
+ },
184
+ FieldPermissionsInner: {
185
+ type: "object",
186
+ properties: {
187
+ permissionType: { type: "string" },
188
+ role: { type: "string" },
189
+ roleId: { type: "integer" },
99
190
  },
191
+ },
192
+ Table: {
193
+ type: "object",
100
194
  required: ["id", "name"],
195
+ properties: {
196
+ id: {
197
+ type: "string",
198
+ description: "The unique identifier (dbid) of the table.",
199
+ },
200
+ name: {
201
+ type: "string",
202
+ description: "The name of the table.",
203
+ },
204
+ alias: {
205
+ type: "string",
206
+ description: "The automatically-created table alias for the table.",
207
+ },
208
+ description: {
209
+ type: "string",
210
+ description:
211
+ "The description of the table, as configured by an application administrator.",
212
+ },
213
+ created: {
214
+ type: "string",
215
+ format: "date-time",
216
+ description:
217
+ "The time and date when the table was created, in ISO 8601 format (UTC).",
218
+ },
219
+ updated: {
220
+ type: "string",
221
+ format: "date-time",
222
+ description:
223
+ "The time and date when the table schema or data was last updated, in ISO 8601 format (UTC).",
224
+ },
225
+ nextRecordId: {
226
+ type: "integer",
227
+ description:
228
+ "The incremental Record ID that will be used when the next record is created.",
229
+ },
230
+ nextFieldId: {
231
+ type: "integer",
232
+ description:
233
+ "The incremental Field ID that will be used when the next field is created.",
234
+ },
235
+ defaultSortFieldId: {
236
+ type: "integer",
237
+ description:
238
+ "The id of the field that is configured for default sorting.",
239
+ },
240
+ defaultSortOrder: {
241
+ type: "string",
242
+ enum: ["ASC", "DESC"],
243
+ description:
244
+ "The default sort order for the table, either ascending (ASC) or descending (DESC).",
245
+ },
246
+ keyFieldId: {
247
+ type: "integer",
248
+ description:
249
+ "The id of the field that is configured to be the key on this table, usually the Quickbase Record ID.",
250
+ },
251
+ singleRecordName: {
252
+ type: "string",
253
+ description: "The builder-configured singular noun of the table.",
254
+ },
255
+ pluralRecordName: {
256
+ type: "string",
257
+ description: "The builder-configured plural noun of the table.",
258
+ },
259
+ sizeLimit: {
260
+ type: "string",
261
+ description: "The size limit for the table (e.g., '150 MB').",
262
+ },
263
+ spaceUsed: {
264
+ type: "string",
265
+ description:
266
+ "The amount of space currently being used by the table (e.g., '17 MB').",
267
+ },
268
+ spaceRemaining: {
269
+ type: "string",
270
+ description:
271
+ "The amount of space remaining for use by the table (e.g., '133 MB').",
272
+ },
273
+ },
274
+ },
275
+ UpdateTableRequest: {
276
+ type: "object",
277
+ properties: {
278
+ name: {
279
+ type: "string",
280
+ description: "The new name for the table.",
281
+ },
282
+ singleRecordName: {
283
+ type: "string",
284
+ description:
285
+ "The new singular noun for records in the table. Defaults to 'Record' if not provided.",
286
+ },
287
+ pluralRecordName: {
288
+ type: "string",
289
+ description:
290
+ "The new plural noun for records in the table. Defaults to 'Records' if not provided.",
291
+ },
292
+ description: {
293
+ type: "string",
294
+ description:
295
+ "The new description for the table. Defaults to blank if not provided.",
296
+ },
297
+ },
298
+ description:
299
+ "Request body for updating table properties. At least one property must be provided.",
300
+ },
301
+ DeleteTableResponse: {
302
+ type: "object",
303
+ properties: {
304
+ deletedTableId: {
305
+ type: "string",
306
+ description: "The deleted table id.",
307
+ },
308
+ },
101
309
  },
102
310
  Record: {
103
311
  type: "object",
104
312
  properties: {
105
- id: { type: "number" },
106
- fields: {
107
- type: "object",
108
- additionalProperties: { type: "string" },
313
+ _dummy: {
314
+ type: "string",
315
+ description: "Unused dummy property to force model generation.",
316
+ nullable: true,
317
+ },
318
+ },
319
+ additionalProperties: {
320
+ type: "object",
321
+ properties: {
322
+ value: {
323
+ type: ["string", "number", "boolean", "object", "array", "null"],
324
+ },
325
+ },
326
+ description: "The value object for a field ID key.",
327
+ },
328
+ description:
329
+ "A record with field ID keys (e.g., '6') and value objects (e.g., { value: 'data' }).",
330
+ },
331
+ UpsertRequest: {
332
+ type: "object",
333
+ required: ["to"],
334
+ properties: {
335
+ to: { type: "string", description: "The table identifier (dbid)." },
336
+ data: {
337
+ type: "array",
338
+ items: { $ref: "#/definitions/Record" },
339
+ description: "Array of records to upsert.",
340
+ },
341
+ mergeFieldId: {
342
+ type: "integer",
343
+ description: "The field ID to merge on (optional).",
344
+ },
345
+ fieldsToReturn: {
346
+ type: "array",
347
+ items: { type: "integer" },
348
+ description: "Field IDs to return in the response (optional).",
109
349
  },
110
350
  },
111
- required: ["id"],
112
351
  },
113
352
  Upsert200Response: {
114
353
  type: "object",
115
354
  properties: {
116
- id: { type: "number" },
117
- status: { type: "string" },
355
+ data: {
356
+ type: "array",
357
+ items: {
358
+ type: "object",
359
+ additionalProperties: {
360
+ type: "object",
361
+ properties: {
362
+ value: { type: "any" },
363
+ },
364
+ },
365
+ },
366
+ description: "Array of upserted records with field IDs and values.",
367
+ },
368
+ metadata: {
369
+ type: "object",
370
+ properties: {
371
+ createdRecordIds: {
372
+ type: "array",
373
+ items: { type: "integer" },
374
+ description: "IDs of newly created records.",
375
+ },
376
+ updatedRecordIds: {
377
+ type: "array",
378
+ items: { type: "integer" },
379
+ description: "IDs of updated records.",
380
+ },
381
+ unchangedRecordIds: {
382
+ type: "array",
383
+ items: { type: "integer" },
384
+ description: "IDs of unchanged records.",
385
+ },
386
+ totalNumberOfRecordsProcessed: {
387
+ type: "integer",
388
+ description: "Total records processed.",
389
+ },
390
+ },
391
+ required: ["totalNumberOfRecordsProcessed"],
392
+ },
393
+ },
394
+ },
395
+ Upsert207Response: {
396
+ type: "object",
397
+ properties: {
398
+ data: {
399
+ type: "array",
400
+ items: {
401
+ type: "object",
402
+ additionalProperties: {
403
+ type: "object",
404
+ properties: {
405
+ value: { type: "any" },
406
+ },
407
+ },
408
+ },
409
+ description: "Array of successfully upserted records (may be empty).",
410
+ },
411
+ metadata: {
412
+ type: "object",
413
+ properties: {
414
+ createdRecordIds: {
415
+ type: "array",
416
+ items: { type: "integer" },
417
+ },
418
+ updatedRecordIds: {
419
+ type: "array",
420
+ items: { type: "integer" },
421
+ },
422
+ unchangedRecordIds: {
423
+ type: "array",
424
+ items: { type: "integer" },
425
+ },
426
+ lineErrors: {
427
+ type: "object",
428
+ additionalProperties: {
429
+ type: "array",
430
+ items: { type: "string" },
431
+ },
432
+ description: "Errors by line number (1-based index).",
433
+ },
434
+ totalNumberOfRecordsProcessed: {
435
+ type: "integer",
436
+ },
437
+ },
438
+ required: ["totalNumberOfRecordsProcessed"],
439
+ },
118
440
  },
119
- required: ["id"],
120
441
  },
121
442
  ReportRunResponse: {
122
443
  type: "object",
123
444
  properties: {
124
445
  id: { type: "string" },
125
- data: { type: "object" }, // Placeholder
446
+ data: { type: "object" },
126
447
  },
127
- required: ["id"],
128
448
  },
129
449
  GetTempTokenDBID200Response: {
130
450
  type: "object",
451
+ required: ["temporaryAuthorization"],
131
452
  properties: {
132
453
  temporaryAuthorization: { type: "string" },
133
454
  },
134
- required: ["temporaryAuthorization"],
455
+ },
456
+ DeleteRecordsRequest: {
457
+ type: "object",
458
+ required: ["from", "where"],
459
+ properties: {
460
+ from: {
461
+ type: "string",
462
+ description:
463
+ "The table identifier (dbid) from which to delete records.",
464
+ },
465
+ where: {
466
+ type: "string",
467
+ description:
468
+ "A QuickBase query string specifying which records to delete.",
469
+ },
470
+ },
471
+ description:
472
+ "Request body for deleting records from a table using a query.",
473
+ },
474
+ DeleteRecords200Response: {
475
+ type: "object",
476
+ properties: {
477
+ numberDeleted: {
478
+ type: "integer",
479
+ description: "The number of records successfully deleted.",
480
+ },
481
+ },
482
+ required: ["numberDeleted"],
483
+ description: "Response body for successful deletion of records.",
135
484
  },
136
485
  };