quickbase-js 1.0.1-beta.0 → 1.1.0-beta.1
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/CHANGELOG.md +38 -0
- package/dist/{quickbaseClient.d.ts → quickbase.d.ts} +344 -339
- package/dist/{quickbaseClient.js → quickbase.js} +350 -266
- package/dist/quickbase.js.map +1 -0
- package/examples/react.js +42 -16
- package/examples/vanillajs.html +32 -8
- package/log-gen.yaml +3513 -0
- package/package.json +13 -9
- package/rollup.config.js +2 -2
- package/src/code-generation/fix-spec-definitions.ts +473 -66
- package/src/code-generation/fix-spec-paths.ts +210 -18
- package/src/code-generation/generate-unified-interface.ts +1 -8
- package/src/code-generation/output/quickbase-fixed.json +783 -1138
- package/src/generated-unified/QuickbaseClient.ts +10 -9
- package/src/log-gen.ts +82 -35
- package/src/quickbaseClient.ts +39 -42
- package/test-artifacts/test-results.json +173 -1145
- package/tests/playwright/qb/auth/cacheSwitching.test.ts +4 -4
- package/tests/playwright/qb/auth/fetchTempToken401.test.ts +2 -2
- package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +2 -2
- package/tests/playwright/qb/auth/getTempToken.test.ts +2 -2
- package/tests/playwright/qb/auth/tokenPrefetch.test.ts +2 -2
- package/tests/playwright/qb/auth/tokenRenewal.test.ts +2 -2
- package/tests/setup.ts +37 -9
- package/tests/vitest/qb/apps/getApp.test.ts +37 -43
- package/tests/vitest/qb/fields/getFields.test.ts +3 -5
- package/tests/vitest/qb/records/deleteRecords.test.ts +78 -0
- package/tests/vitest/qb/records/runQuery.test.ts +82 -0
- package/tests/vitest/qb/records/upsert.test.ts +72 -0
- package/tests/vitest/qb/tables/createTable.test.ts +55 -0
- package/tests/vitest/qb/tables/deleteTable.test.ts +50 -0
- package/tests/vitest/qb/tables/getAppTables.test.ts +43 -64
- package/tests/vitest/qb/tables/getTable.test.ts +26 -0
- package/tests/vitest/qb/tables/updateTable.test.ts +48 -0
- package/tests/vitest/unit/apps/getApp.test.ts +17 -12
- package/tests/vitest/unit/auth/fetchTempToken401.test.ts +32 -6
- package/tests/vitest/unit/auth/getTempToken.test.ts +36 -24
- package/tests/vitest/unit/auth/retryOn401.test.ts +39 -5
- package/tests/vitest/unit/auth/two401s.test.ts +1 -1
- package/tests/vitest/unit/fields/getFields.test.ts +14 -7
- package/tests/vitest/unit/records/deleteRecords.test.ts +112 -0
- package/tests/vitest/unit/records/runQuery.test.ts +102 -0
- package/tests/vitest/unit/records/upsert.test.ts +218 -0
- package/tests/vitest/unit/tables/createTable.test.ts +70 -0
- package/tests/vitest/unit/tables/deleteTable.test.ts +77 -0
- package/tests/vitest/unit/tables/getAppTables.test.ts +41 -28
- package/tests/vitest/unit/tables/getTable.test.ts +233 -0
- package/tests/vitest/unit/tables/updateTable.test.ts +80 -0
- package/tsconfig.json +3 -2
- package/vitest.config.ts +8 -2
- package/dist/quickbaseClient.js.map +0 -1
- package/logGen.yaml +0 -1820
- package/src/utils.ts +0 -5
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
// src/code-generation/fix-spec-paths.ts
|
|
2
2
|
export const paths = {
|
|
3
|
+
"/apps": {
|
|
4
|
+
post: {
|
|
5
|
+
operationId: "createApp",
|
|
6
|
+
summary: "Create a new application",
|
|
7
|
+
tags: ["Apps"],
|
|
8
|
+
parameters: [
|
|
9
|
+
{
|
|
10
|
+
name: "body",
|
|
11
|
+
in: "body",
|
|
12
|
+
required: true,
|
|
13
|
+
schema: { $ref: "#/definitions/CreateAppRequest" },
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
responses: {
|
|
17
|
+
200: {
|
|
18
|
+
description: "Success - application created",
|
|
19
|
+
schema: { $ref: "#/definitions/CreateApp200Response" },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
3
24
|
"/apps/{appId}": {
|
|
4
25
|
get: {
|
|
5
26
|
operationId: "getApp",
|
|
@@ -11,6 +32,7 @@ export const paths = {
|
|
|
11
32
|
in: "path",
|
|
12
33
|
required: true,
|
|
13
34
|
type: "string",
|
|
35
|
+
description: "The application identifier.",
|
|
14
36
|
},
|
|
15
37
|
],
|
|
16
38
|
responses: {
|
|
@@ -32,12 +54,14 @@ export const paths = {
|
|
|
32
54
|
in: "query",
|
|
33
55
|
required: true,
|
|
34
56
|
type: "string",
|
|
57
|
+
description: "The table identifier (dbid).",
|
|
35
58
|
},
|
|
36
59
|
{
|
|
37
60
|
name: "includeFieldPerms",
|
|
38
61
|
in: "query",
|
|
39
62
|
required: false,
|
|
40
63
|
type: "boolean",
|
|
64
|
+
description: "Whether to include field permissions.",
|
|
41
65
|
},
|
|
42
66
|
],
|
|
43
67
|
responses: {
|
|
@@ -62,6 +86,7 @@ export const paths = {
|
|
|
62
86
|
in: "query",
|
|
63
87
|
required: true,
|
|
64
88
|
type: "string",
|
|
89
|
+
description: "The application identifier.",
|
|
65
90
|
},
|
|
66
91
|
],
|
|
67
92
|
responses: {
|
|
@@ -74,37 +99,202 @@ export const paths = {
|
|
|
74
99
|
},
|
|
75
100
|
},
|
|
76
101
|
},
|
|
77
|
-
},
|
|
78
|
-
"/records/query": {
|
|
79
102
|
post: {
|
|
80
|
-
operationId: "
|
|
81
|
-
summary: "
|
|
82
|
-
tags: ["
|
|
103
|
+
operationId: "createTable",
|
|
104
|
+
summary: "Create a new table in an app",
|
|
105
|
+
tags: ["Tables"],
|
|
83
106
|
parameters: [
|
|
84
107
|
{
|
|
85
|
-
name: "
|
|
108
|
+
name: "appId",
|
|
109
|
+
in: "query",
|
|
110
|
+
required: true,
|
|
111
|
+
type: "string",
|
|
112
|
+
description:
|
|
113
|
+
"The unique identifier of the app where the table will be created.",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "body",
|
|
86
117
|
in: "body",
|
|
87
118
|
required: true,
|
|
88
119
|
schema: {
|
|
89
|
-
type: "
|
|
90
|
-
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
name: { type: "string", description: "The name of the table." },
|
|
123
|
+
description: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "The description of the table.",
|
|
126
|
+
},
|
|
127
|
+
singleRecordName: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Singular noun for records.",
|
|
130
|
+
},
|
|
131
|
+
pluralRecordName: {
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "Plural noun for records.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
required: ["name"],
|
|
91
137
|
},
|
|
92
138
|
},
|
|
93
139
|
],
|
|
94
140
|
responses: {
|
|
95
141
|
200: {
|
|
96
|
-
description: "Success",
|
|
97
|
-
schema: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
142
|
+
description: "Success - table created",
|
|
143
|
+
schema: { $ref: "#/definitions/Table" },
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
"/tables/{tableId}": {
|
|
149
|
+
get: {
|
|
150
|
+
operationId: "getTable",
|
|
151
|
+
summary: "Get a table by ID",
|
|
152
|
+
tags: ["Tables"],
|
|
153
|
+
parameters: [
|
|
154
|
+
{
|
|
155
|
+
name: "tableId",
|
|
156
|
+
in: "path",
|
|
157
|
+
required: true,
|
|
158
|
+
type: "string",
|
|
159
|
+
description: "The table identifier (dbid).",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "appId",
|
|
163
|
+
in: "query",
|
|
164
|
+
required: true,
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "The unique identifier of the app containing the table.",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
responses: {
|
|
170
|
+
200: {
|
|
171
|
+
description: "Success - table retrieved",
|
|
172
|
+
schema: { $ref: "#/definitions/Table" },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
post: {
|
|
177
|
+
operationId: "updateTable",
|
|
178
|
+
summary: "Update a table by ID",
|
|
179
|
+
tags: ["Tables"],
|
|
180
|
+
parameters: [
|
|
181
|
+
{
|
|
182
|
+
name: "tableId",
|
|
183
|
+
in: "path",
|
|
184
|
+
required: true,
|
|
185
|
+
type: "string",
|
|
186
|
+
description: "The table identifier (dbid).",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "appId",
|
|
190
|
+
in: "query",
|
|
191
|
+
required: true,
|
|
192
|
+
type: "string",
|
|
193
|
+
description: "The unique identifier of the app containing the table.",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "body",
|
|
197
|
+
in: "body",
|
|
198
|
+
required: true,
|
|
199
|
+
schema: { $ref: "#/definitions/UpdateTableRequest" },
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
responses: {
|
|
203
|
+
200: {
|
|
204
|
+
description: "Success - table updated",
|
|
205
|
+
schema: { $ref: "#/definitions/Table" },
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
delete: {
|
|
210
|
+
operationId: "deleteTable",
|
|
211
|
+
summary: "Delete a table by ID",
|
|
212
|
+
tags: ["Tables"],
|
|
213
|
+
parameters: [
|
|
214
|
+
{
|
|
215
|
+
name: "tableId",
|
|
216
|
+
in: "path",
|
|
217
|
+
required: true,
|
|
218
|
+
type: "string",
|
|
219
|
+
description: "The table identifier (dbid).",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "appId",
|
|
223
|
+
in: "query",
|
|
224
|
+
required: true,
|
|
225
|
+
type: "string",
|
|
226
|
+
description: "The unique identifier of the app containing the table.",
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
responses: {
|
|
230
|
+
200: {
|
|
231
|
+
description: "Success - table deleted",
|
|
232
|
+
schema: { $ref: "#/definitions/DeleteTableResponse" },
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
"/records": {
|
|
238
|
+
post: {
|
|
239
|
+
operationId: "upsert",
|
|
240
|
+
summary: "Upsert records in a table",
|
|
241
|
+
tags: ["Records"],
|
|
242
|
+
parameters: [
|
|
243
|
+
{
|
|
244
|
+
name: "body",
|
|
245
|
+
in: "body",
|
|
246
|
+
required: true,
|
|
247
|
+
schema: { $ref: "#/definitions/UpsertRequest" },
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
responses: {
|
|
251
|
+
200: {
|
|
252
|
+
description: "Success - all records processed successfully",
|
|
253
|
+
schema: { $ref: "#/definitions/Upsert200Response" },
|
|
101
254
|
},
|
|
102
255
|
207: {
|
|
103
|
-
description: "Multi-Status
|
|
104
|
-
schema: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
256
|
+
description: "Multi-Status - partial success with some errors",
|
|
257
|
+
schema: { $ref: "#/definitions/Upsert207Response" },
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
delete: {
|
|
262
|
+
operationId: "deleteRecords",
|
|
263
|
+
summary: "Delete records in a table",
|
|
264
|
+
tags: ["Records"],
|
|
265
|
+
parameters: [
|
|
266
|
+
{
|
|
267
|
+
name: "body",
|
|
268
|
+
in: "body",
|
|
269
|
+
required: true,
|
|
270
|
+
schema: { $ref: "#/definitions/DeleteRecordsRequest" },
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
responses: {
|
|
274
|
+
200: {
|
|
275
|
+
description: "Success - records deleted",
|
|
276
|
+
schema: { $ref: "#/definitions/DeleteRecords200Response" },
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
"/records/query": {
|
|
282
|
+
post: {
|
|
283
|
+
operationId: "runQuery",
|
|
284
|
+
summary: "Query records in a table",
|
|
285
|
+
tags: ["Records"],
|
|
286
|
+
parameters: [
|
|
287
|
+
{
|
|
288
|
+
name: "body",
|
|
289
|
+
in: "body",
|
|
290
|
+
required: true,
|
|
291
|
+
schema: { $ref: "#/definitions/RunQueryRequest" },
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
responses: {
|
|
295
|
+
200: {
|
|
296
|
+
description: "Success - records returned",
|
|
297
|
+
schema: { $ref: "#/definitions/RunQueryResponse" },
|
|
108
298
|
},
|
|
109
299
|
},
|
|
110
300
|
},
|
|
@@ -120,6 +310,7 @@ export const paths = {
|
|
|
120
310
|
in: "path",
|
|
121
311
|
required: true,
|
|
122
312
|
type: "string",
|
|
313
|
+
description: "The report identifier.",
|
|
123
314
|
},
|
|
124
315
|
{
|
|
125
316
|
name: "generated",
|
|
@@ -150,6 +341,7 @@ export const paths = {
|
|
|
150
341
|
in: "path",
|
|
151
342
|
required: true,
|
|
152
343
|
type: "string",
|
|
344
|
+
description: "The database identifier (dbid).",
|
|
153
345
|
},
|
|
154
346
|
],
|
|
155
347
|
responses: {
|
|
@@ -48,20 +48,15 @@ function generateInterface() {
|
|
|
48
48
|
})
|
|
49
49
|
.map((p) => {
|
|
50
50
|
const param = p as OpenAPIV2.ParameterObject;
|
|
51
|
-
|
|
51
|
+
const type = param.type
|
|
52
52
|
? mapOpenApiTypeToTs(param.type)
|
|
53
53
|
: param.schema
|
|
54
54
|
? mapRefToType(param.schema, modelImports)
|
|
55
55
|
: "any";
|
|
56
|
-
// Special handling for upsertRecords 'generated' parameter
|
|
57
|
-
if (opId === "upsertRecords" && param.name === "generated") {
|
|
58
|
-
type = "{ [key: string]: string }[]";
|
|
59
|
-
}
|
|
60
56
|
return `${param.name}${param.required ? "" : "?"}: ${type}`;
|
|
61
57
|
})
|
|
62
58
|
.join("; ");
|
|
63
59
|
|
|
64
|
-
// Handle responses, ensuring distinct types for 200 and 207
|
|
65
60
|
const successResponses = ["200", "207"]
|
|
66
61
|
.map((code) => ({
|
|
67
62
|
code,
|
|
@@ -73,7 +68,6 @@ function generateInterface() {
|
|
|
73
68
|
const returnTypes = successResponses.map(({ response }) =>
|
|
74
69
|
mapRefToType(response!.schema, modelImports)
|
|
75
70
|
);
|
|
76
|
-
// Deduplicate return types and join with " | ", default to "void" if empty
|
|
77
71
|
const uniqueReturnTypes = [...new Set(returnTypes)];
|
|
78
72
|
const returnType =
|
|
79
73
|
uniqueReturnTypes.length > 0 ? uniqueReturnTypes.join(" | ") : "void";
|
|
@@ -84,7 +78,6 @@ function generateInterface() {
|
|
|
84
78
|
}
|
|
85
79
|
}
|
|
86
80
|
|
|
87
|
-
// Generate import statements for all model types
|
|
88
81
|
const importStatement =
|
|
89
82
|
modelImports.size > 0
|
|
90
83
|
? `import { ${Array.from(modelImports)
|