quickbase-js 0.1.0-beta.8 → 1.0.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 +252 -126
- package/dist/esm/quickbase.d.ts +2725 -2689
- package/dist/esm/quickbase.js +1763 -3524
- package/dist/esm/quickbase.js.map +1 -1
- package/dist/esm/quickbase.min.js +1 -1
- package/dist/esm/quickbase.min.js.map +1 -1
- package/dist/umd/quickbase.umd.js +1762 -3706
- package/dist/umd/quickbase.umd.js.map +1 -1
- package/dist/umd/quickbase.umd.min.js +1 -1
- package/dist/umd/quickbase.umd.min.js.map +1 -1
- package/package.json +27 -12
- package/CHANGELOG.md +0 -155
- package/build-common.js +0 -131
- package/build-esm.js +0 -71
- package/build-umd.js +0 -69
- package/examples/quicbase-jsCDN.html +0 -36
- package/examples/react.js +0 -48
- package/examples/vanillajs.html +0 -47
- package/open-api/fix-spec-main.ts +0 -97
- package/open-api/generate-override-report.ts +0 -214
- package/open-api/generate-unified-interface.ts +0 -256
- package/open-api/output/override-report.html +0 -11
- package/open-api/output/override-report.json +0 -14395
- package/open-api/output/quickbase-fixed.json +0 -11191
- package/open-api/regenerate-client.ts +0 -116
- package/open-api/schema/enhance-general.ts +0 -100
- package/open-api/schema/fix-arrays.ts +0 -69
- package/open-api/schema/tags/apps.ts +0 -90
- package/open-api/schema/tags/fields.ts +0 -471
- package/open-api/schema/tags/groups.ts +0 -51
- package/open-api/schema/tags/index.ts +0 -66
- package/open-api/schema/tags/records.ts +0 -115
- package/open-api/schema/tags/tables.ts +0 -211
- package/open-api/schema/tags/users.ts +0 -47
- package/open-api/types/spec.ts +0 -42
- package/open-api/utils/infer-schema.ts +0 -40
- package/open-api/utils/naming.ts +0 -10
- package/playwright.config.ts +0 -37
- package/rollup.config.js +0 -114
- package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
- package/specs/split/apps.json +0 -1315
- package/specs/split/auth.json +0 -191
- package/specs/split/fields.json +0 -3869
- package/specs/split/records.json +0 -754
- package/specs/split/reports.json +0 -619
- package/specs/split/tables.json +0 -1605
- package/src/RateLimitError.ts +0 -12
- package/src/ThrottleBucket.ts +0 -36
- package/src/generated-unified/QuickbaseClient.ts +0 -359
- package/src/generated-unified/missing-types-report.json +0 -3
- package/src/index.ts +0 -1
- package/src/invokeMethod.ts +0 -357
- package/src/quickbaseClient.ts +0 -244
- package/src/tokenCache.ts +0 -51
- package/src/utils.ts +0 -7
- package/test-esm.js +0 -1
- package/test-results.json +0 -2050
- package/test-umd.js +0 -1
- package/test.ts +0 -1
- package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
- package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
- package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
- package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
- package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
- package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
- package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
- package/tests/setup.ts +0 -53
- package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
- package/tests/vitest/qb/apps/createApp.test.ts +0 -64
- package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
- package/tests/vitest/qb/apps/getApp.test.ts +0 -44
- package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
- package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
- package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -56
- package/tests/vitest/qb/fields/createField.test.ts +0 -77
- package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
- package/tests/vitest/qb/fields/getField.test.ts +0 -85
- package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -174
- package/tests/vitest/qb/fields/getFields.test.ts +0 -232
- package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
- package/tests/vitest/qb/fields/updateField.test.ts +0 -93
- package/tests/vitest/qb/index.ts +0 -29
- package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
- package/tests/vitest/qb/records/runQuery.test.ts +0 -146
- package/tests/vitest/qb/records/upsert.test.ts +0 -102
- package/tests/vitest/qb/tables/createTable.test.ts +0 -55
- package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
- package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
- package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
- package/tests/vitest/qb/tables/getTable.test.ts +0 -26
- package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -277
- package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
- package/tests/vitest/unit/apps/copyApp.test.ts +0 -488
- package/tests/vitest/unit/apps/createApp.test.ts +0 -186
- package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
- package/tests/vitest/unit/apps/getApp.test.ts +0 -128
- package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
- package/tests/vitest/unit/apps/updateApp.test.ts +0 -381
- package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -62
- package/tests/vitest/unit/auth/getTempToken.test.ts +0 -95
- package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -113
- package/tests/vitest/unit/auth/retryTempTokenTwo401.test.ts +0 -81
- package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -56
- package/tests/vitest/unit/fields/createField.test.ts +0 -387
- package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
- package/tests/vitest/unit/fields/getField.test.ts +0 -189
- package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -166
- package/tests/vitest/unit/fields/getFields.test.ts +0 -122
- package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
- package/tests/vitest/unit/fields/updateField.test.ts +0 -280
- package/tests/vitest/unit/index.ts +0 -33
- package/tests/vitest/unit/rateLimit.test.ts +0 -189
- package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
- package/tests/vitest/unit/records/runQuery.test.ts +0 -102
- package/tests/vitest/unit/records/upsert.test.ts +0 -234
- package/tests/vitest/unit/tables/createTable.test.ts +0 -70
- package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
- package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
- package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
- package/tests/vitest/unit/tables/getTable.test.ts +0 -233
- package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -305
- package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
- package/tests/vitest/unit/tokenLifespan.test.ts +0 -138
- package/tests/vitest/unit/umd.test.ts +0 -8
- package/text.txt +0 -104
- package/tools/log-gen.ts +0 -235
- package/tools/log-gen.yaml +0 -4982
- package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
- package/tsconfig.build.json +0 -17
- package/tsconfig.json +0 -32
- package/versionrc.json +0 -9
- package/vitest.config.ts +0 -27
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// open-api/schema/tags/records.ts
|
|
2
|
-
import { Operation, Parameter, Spec } from "../../types/spec.ts";
|
|
3
|
-
import { normalizeDefinitionName } from "../../utils/naming.ts"; // Ensure this import is present
|
|
4
|
-
|
|
5
|
-
export function enhanceRecords(
|
|
6
|
-
spec: Spec,
|
|
7
|
-
pathKey: string,
|
|
8
|
-
method: string,
|
|
9
|
-
operation: Operation
|
|
10
|
-
): void {
|
|
11
|
-
const opId =
|
|
12
|
-
operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
|
|
13
|
-
if (operation.parameters && operation.tags?.includes("Records")) {
|
|
14
|
-
operation.parameters.forEach((param: Parameter) => {
|
|
15
|
-
if (param.in === "body") {
|
|
16
|
-
if (!param.schema) param.schema = {};
|
|
17
|
-
let requestName =
|
|
18
|
-
param.schema.$ref?.split("/").pop() || `${opId}Request`;
|
|
19
|
-
requestName = normalizeDefinitionName(requestName);
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
!spec.definitions[requestName] ||
|
|
23
|
-
!spec.definitions[requestName].type ||
|
|
24
|
-
Object.keys(spec.definitions[requestName]?.properties || {})
|
|
25
|
-
.length === 0
|
|
26
|
-
) {
|
|
27
|
-
console.log(
|
|
28
|
-
`Defining schema for ${requestName} in ${pathKey}(${method})`
|
|
29
|
-
);
|
|
30
|
-
let properties;
|
|
31
|
-
// Upsert endpoint (/records)
|
|
32
|
-
if (pathKey === "/records" && method === "post") {
|
|
33
|
-
properties = {
|
|
34
|
-
data: { type: "array", items: { $ref: "#/definitions/Record" } },
|
|
35
|
-
to: { type: "string" },
|
|
36
|
-
fieldsToReturn: { type: "array", items: { type: "integer" } },
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Query endpoint (/records/query)
|
|
40
|
-
else if (pathKey === "/records/query" && method === "post") {
|
|
41
|
-
properties = {
|
|
42
|
-
from: { type: "string", description: "The table identifier." },
|
|
43
|
-
select: {
|
|
44
|
-
type: "array",
|
|
45
|
-
items: { type: "integer" },
|
|
46
|
-
description: "An array of field ids...",
|
|
47
|
-
},
|
|
48
|
-
where: {
|
|
49
|
-
type: "string",
|
|
50
|
-
description:
|
|
51
|
-
"The filter, using the Quickbase query language...",
|
|
52
|
-
},
|
|
53
|
-
sortBy: {
|
|
54
|
-
type: "array",
|
|
55
|
-
items: {
|
|
56
|
-
type: "object",
|
|
57
|
-
properties: {
|
|
58
|
-
fieldId: { type: "integer" },
|
|
59
|
-
order: {
|
|
60
|
-
type: "string",
|
|
61
|
-
enum: ["ASC", "DESC", "equal-values"],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
required: ["fieldId", "order"],
|
|
65
|
-
},
|
|
66
|
-
description: "An array of field IDs and sort directions...",
|
|
67
|
-
},
|
|
68
|
-
groupBy: {
|
|
69
|
-
type: "array",
|
|
70
|
-
items: {
|
|
71
|
-
type: "object",
|
|
72
|
-
properties: {
|
|
73
|
-
fieldId: { type: "integer" },
|
|
74
|
-
grouping: { type: "string", enum: ["equal-values"] },
|
|
75
|
-
},
|
|
76
|
-
required: ["fieldId", "grouping"],
|
|
77
|
-
},
|
|
78
|
-
description:
|
|
79
|
-
"An array that contains the fields to group the records by.",
|
|
80
|
-
},
|
|
81
|
-
options: {
|
|
82
|
-
type: "object",
|
|
83
|
-
properties: {
|
|
84
|
-
skip: { type: "integer" },
|
|
85
|
-
top: { type: "integer" },
|
|
86
|
-
compareWithAppLocalTime: { type: "boolean" },
|
|
87
|
-
},
|
|
88
|
-
description: "Additional query options.",
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
// Delete endpoint (/records)
|
|
93
|
-
else if (method === "delete") {
|
|
94
|
-
properties = {
|
|
95
|
-
from: { type: "string" },
|
|
96
|
-
where: { type: "string" },
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (properties) {
|
|
100
|
-
spec.definitions[requestName] = {
|
|
101
|
-
type: "object",
|
|
102
|
-
properties,
|
|
103
|
-
required: ["from"], // Only 'from' is required per the spec
|
|
104
|
-
description: operation.summary || `Request body for ${opId}`,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
param.schema = { $ref: `#/definitions/${requestName}` };
|
|
109
|
-
console.log(
|
|
110
|
-
`Ensured ${requestName} in definitions for ${pathKey}(${method})`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// schema/tags/tables.ts
|
|
2
|
-
import { Operation, Parameter, Spec } from "../../types/spec.ts";
|
|
3
|
-
import { normalizeDefinitionName } from "../../utils/naming.ts";
|
|
4
|
-
|
|
5
|
-
export function enhanceTables(
|
|
6
|
-
spec: Spec,
|
|
7
|
-
pathKey: string,
|
|
8
|
-
method: string,
|
|
9
|
-
operation: Operation
|
|
10
|
-
): void {
|
|
11
|
-
const opId =
|
|
12
|
-
operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
|
|
13
|
-
if (operation.parameters && operation.tags?.includes("Tables")) {
|
|
14
|
-
operation.parameters.forEach((param: Parameter) => {
|
|
15
|
-
if (param.in === "body") {
|
|
16
|
-
if (!param.schema) param.schema = {};
|
|
17
|
-
let requestName =
|
|
18
|
-
param.schema.$ref?.split("/").pop() || `${opId}Request`;
|
|
19
|
-
requestName = normalizeDefinitionName(requestName);
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
!spec.definitions[requestName] ||
|
|
23
|
-
!spec.definitions[requestName].type ||
|
|
24
|
-
Object.keys(spec.definitions[requestName]?.properties || {})
|
|
25
|
-
.length === 0
|
|
26
|
-
) {
|
|
27
|
-
console.log(
|
|
28
|
-
`Defining schema for ${requestName} in ${pathKey}(${method})`
|
|
29
|
-
);
|
|
30
|
-
let properties;
|
|
31
|
-
|
|
32
|
-
// Existing logic for other endpoints remains unchanged
|
|
33
|
-
if (pathKey === "/tables" && method === "post") {
|
|
34
|
-
properties = {
|
|
35
|
-
name: {
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "The name for the table.",
|
|
38
|
-
minLength: 1,
|
|
39
|
-
},
|
|
40
|
-
description: {
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "The description for the table...",
|
|
43
|
-
},
|
|
44
|
-
singleRecordName: {
|
|
45
|
-
type: "string",
|
|
46
|
-
description: "The singular noun for records...",
|
|
47
|
-
},
|
|
48
|
-
pluralRecordName: {
|
|
49
|
-
type: "string",
|
|
50
|
-
description: "The plural noun for records...",
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
} else if (pathKey === "/tables/{tableId}" && method === "post") {
|
|
54
|
-
properties = {
|
|
55
|
-
name: {
|
|
56
|
-
type: "string",
|
|
57
|
-
description: "The updated name of the table.",
|
|
58
|
-
},
|
|
59
|
-
description: {
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "The updated description for the table.",
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// Add minimal fix for relationship endpoints
|
|
66
|
-
else if (
|
|
67
|
-
pathKey === "/tables/{tableId}/relationship" &&
|
|
68
|
-
method === "post"
|
|
69
|
-
) {
|
|
70
|
-
requestName = "CreateRelationshipRequest"; // Force correct name
|
|
71
|
-
if (!spec.definitions[requestName]) {
|
|
72
|
-
properties = {
|
|
73
|
-
parentTableId: {
|
|
74
|
-
type: "string",
|
|
75
|
-
description: "The parent table id for the relationship.",
|
|
76
|
-
},
|
|
77
|
-
foreignKeyField: {
|
|
78
|
-
type: "object",
|
|
79
|
-
properties: {
|
|
80
|
-
label: {
|
|
81
|
-
type: "string",
|
|
82
|
-
description: "The label for the foreign key field.",
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
additionalProperties: true,
|
|
86
|
-
},
|
|
87
|
-
lookupFieldIds: {
|
|
88
|
-
type: "array",
|
|
89
|
-
items: { type: "integer" },
|
|
90
|
-
description: "Array of field ids...",
|
|
91
|
-
},
|
|
92
|
-
summaryFields: {
|
|
93
|
-
type: "array",
|
|
94
|
-
items: {
|
|
95
|
-
type: "object",
|
|
96
|
-
properties: {
|
|
97
|
-
summaryFid: {
|
|
98
|
-
type: "number",
|
|
99
|
-
description: "The field id to summarize.",
|
|
100
|
-
},
|
|
101
|
-
label: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "The label for the summary field.",
|
|
104
|
-
},
|
|
105
|
-
accumulationType: {
|
|
106
|
-
type: "string",
|
|
107
|
-
enum: [
|
|
108
|
-
"AVG",
|
|
109
|
-
"SUM",
|
|
110
|
-
"MAX",
|
|
111
|
-
"MIN",
|
|
112
|
-
"STD-DEV",
|
|
113
|
-
"COUNT",
|
|
114
|
-
"COMBINED-TEXT",
|
|
115
|
-
"COMBINED-USER",
|
|
116
|
-
"DISTINCT-COUNT",
|
|
117
|
-
],
|
|
118
|
-
description: "The accumulation type...",
|
|
119
|
-
},
|
|
120
|
-
where: { type: "string", description: "The filter..." },
|
|
121
|
-
},
|
|
122
|
-
required: ["accumulationType"],
|
|
123
|
-
additionalProperties: true,
|
|
124
|
-
},
|
|
125
|
-
description: "Array of summary field objects...",
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
} else if (
|
|
130
|
-
pathKey === "/tables/{tableId}/relationship/{relationshipId}" &&
|
|
131
|
-
method === "post"
|
|
132
|
-
) {
|
|
133
|
-
requestName = "UpdateRelationshipRequest"; // Force correct name
|
|
134
|
-
if (!spec.definitions[requestName]) {
|
|
135
|
-
properties = {
|
|
136
|
-
parentTableId: {
|
|
137
|
-
type: "string",
|
|
138
|
-
description: "The updated parent table id...",
|
|
139
|
-
},
|
|
140
|
-
foreignKeyField: {
|
|
141
|
-
type: "object",
|
|
142
|
-
properties: {
|
|
143
|
-
label: {
|
|
144
|
-
type: "string",
|
|
145
|
-
description: "The updated label...",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
additionalProperties: true,
|
|
149
|
-
},
|
|
150
|
-
lookupFieldIds: {
|
|
151
|
-
type: "array",
|
|
152
|
-
items: { type: "integer" },
|
|
153
|
-
description: "Updated array of field ids...",
|
|
154
|
-
},
|
|
155
|
-
summaryFields: {
|
|
156
|
-
type: "array",
|
|
157
|
-
items: {
|
|
158
|
-
type: "object",
|
|
159
|
-
properties: {
|
|
160
|
-
summaryFid: { type: "number" },
|
|
161
|
-
label: { type: "string" },
|
|
162
|
-
accumulationType: {
|
|
163
|
-
type: "string",
|
|
164
|
-
enum: [
|
|
165
|
-
"AVG",
|
|
166
|
-
"SUM",
|
|
167
|
-
"MAX",
|
|
168
|
-
"MIN",
|
|
169
|
-
"STD-DEV",
|
|
170
|
-
"COUNT",
|
|
171
|
-
"COMBINED-TEXT",
|
|
172
|
-
"COMBINED-USER",
|
|
173
|
-
"DISTINCT-COUNT",
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
where: { type: "string" },
|
|
177
|
-
},
|
|
178
|
-
required: ["accumulationType"],
|
|
179
|
-
additionalProperties: true,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (properties) {
|
|
187
|
-
spec.definitions[requestName] = {
|
|
188
|
-
type: "object",
|
|
189
|
-
properties,
|
|
190
|
-
required:
|
|
191
|
-
pathKey.includes("relationship") &&
|
|
192
|
-
pathKey.endsWith("/relationship")
|
|
193
|
-
? ["parentTableId"]
|
|
194
|
-
: pathKey === "/tables"
|
|
195
|
-
? ["name"]
|
|
196
|
-
: [],
|
|
197
|
-
additionalProperties: pathKey.includes("relationship")
|
|
198
|
-
? false
|
|
199
|
-
: true, // Match raw spec
|
|
200
|
-
description: operation.summary || `Request body for ${opId}`,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
param.schema = { $ref: `#/definitions/${requestName}` };
|
|
205
|
-
console.log(
|
|
206
|
-
`Ensured ${requestName} in definitions for ${pathKey}(${method})`
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// schema/tags/users.ts
|
|
2
|
-
import { Operation, Parameter, Spec } from "../../types/spec.ts";
|
|
3
|
-
import { normalizeDefinitionName } from "../../utils/naming.ts";
|
|
4
|
-
|
|
5
|
-
export function enhanceUsers(
|
|
6
|
-
spec: Spec,
|
|
7
|
-
pathKey: string,
|
|
8
|
-
method: string,
|
|
9
|
-
operation: Operation
|
|
10
|
-
): void {
|
|
11
|
-
const opId =
|
|
12
|
-
operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
|
|
13
|
-
if (operation.parameters && operation.tags?.includes("Users")) {
|
|
14
|
-
operation.parameters.forEach((param: Parameter) => {
|
|
15
|
-
if (param.in === "body") {
|
|
16
|
-
if (!param.schema) param.schema = {};
|
|
17
|
-
let requestName =
|
|
18
|
-
param.schema.$ref?.split("/").pop() || `${opId}Request`;
|
|
19
|
-
requestName = normalizeDefinitionName(requestName);
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
!spec.definitions[requestName] ||
|
|
23
|
-
!spec.definitions[requestName].type ||
|
|
24
|
-
Object.keys(spec.definitions[requestName]?.properties || {})
|
|
25
|
-
.length === 0
|
|
26
|
-
) {
|
|
27
|
-
console.log(
|
|
28
|
-
`Defining schema for ${requestName} in ${pathKey}(${method})`
|
|
29
|
-
);
|
|
30
|
-
const properties = {
|
|
31
|
-
userIds: { type: "array", items: { type: "string" } },
|
|
32
|
-
};
|
|
33
|
-
spec.definitions[requestName] = {
|
|
34
|
-
type: "object",
|
|
35
|
-
properties,
|
|
36
|
-
required: Object.keys(properties),
|
|
37
|
-
description: operation.summary || `Request body for ${opId}`,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
param.schema = { $ref: `#/definitions/${requestName}` };
|
|
41
|
-
console.log(
|
|
42
|
-
`Ensured ${requestName} in definitions for ${pathKey}(${method})`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
package/open-api/types/spec.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// open-api/types/spec.ts
|
|
2
|
-
export interface Parameter {
|
|
3
|
-
name: string;
|
|
4
|
-
in: string;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
type?: string;
|
|
7
|
-
schema?: {
|
|
8
|
-
type?: string;
|
|
9
|
-
items?: any;
|
|
10
|
-
$ref?: string;
|
|
11
|
-
properties?: any;
|
|
12
|
-
example?: any;
|
|
13
|
-
};
|
|
14
|
-
example?: any;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface Operation {
|
|
18
|
-
parameters?: Parameter[];
|
|
19
|
-
responses?: Record<
|
|
20
|
-
string,
|
|
21
|
-
{ description: string; schema?: any; "x-amf-mediaType"?: string }
|
|
22
|
-
>;
|
|
23
|
-
operationId?: string;
|
|
24
|
-
summary?: string;
|
|
25
|
-
tags?: string[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface Spec {
|
|
29
|
-
paths: Record<string, Record<string, Operation>>;
|
|
30
|
-
definitions: Record<string, any>; // Required, no longer optional
|
|
31
|
-
swagger: string;
|
|
32
|
-
info: any;
|
|
33
|
-
operations?: any;
|
|
34
|
-
groups?: any;
|
|
35
|
-
components?: any;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface FixSpecConfig {
|
|
39
|
-
applyOverrides?: boolean;
|
|
40
|
-
overridePaths?: string[];
|
|
41
|
-
overrideDefinitions?: string[];
|
|
42
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// utils/infer-schema.ts
|
|
2
|
-
export function inferSchema(example: any, operationId?: string): any {
|
|
3
|
-
if (!example || typeof example !== "object") {
|
|
4
|
-
return { type: "string" };
|
|
5
|
-
}
|
|
6
|
-
if (Array.isArray(example)) {
|
|
7
|
-
return {
|
|
8
|
-
type: "array",
|
|
9
|
-
items:
|
|
10
|
-
example.length > 0
|
|
11
|
-
? inferSchema(example[0], operationId)
|
|
12
|
-
: { type: "string" },
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const properties: Record<string, any> = {};
|
|
16
|
-
for (const [key, value] of Object.entries(example)) {
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
properties[key] = {
|
|
19
|
-
type: "array",
|
|
20
|
-
items:
|
|
21
|
-
value.length > 0
|
|
22
|
-
? inferSchema(value[0], operationId)
|
|
23
|
-
: { type: "string" },
|
|
24
|
-
};
|
|
25
|
-
} else if (typeof value === "object" && value !== null) {
|
|
26
|
-
properties[key] = inferSchema(value, operationId);
|
|
27
|
-
} else {
|
|
28
|
-
properties[key] = {
|
|
29
|
-
type:
|
|
30
|
-
typeof value === "object" && value === null
|
|
31
|
-
? "object"
|
|
32
|
-
: typeof value || "string",
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (operationId && operationId.endsWith("200Response")) {
|
|
37
|
-
return { type: "array", items: { type: "object", properties } };
|
|
38
|
-
}
|
|
39
|
-
return { type: "object", properties };
|
|
40
|
-
}
|
package/open-api/utils/naming.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// utils/naming.ts
|
|
2
|
-
export function toCamelCase(str: string): string {
|
|
3
|
-
return str
|
|
4
|
-
.replace(/[-_](.)/g, (_, char) => char.toUpperCase())
|
|
5
|
-
.replace(/^./, (str) => str.toLowerCase());
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function normalizeDefinitionName(name: string): string {
|
|
9
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
10
|
-
}
|
package/playwright.config.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// playwright.config.ts
|
|
2
|
-
import { defineConfig, devices } from "@playwright/test";
|
|
3
|
-
|
|
4
|
-
const config = defineConfig({
|
|
5
|
-
fullyParallel: true,
|
|
6
|
-
workers: undefined, // Default: half of CPU cores (e.g., 2 on a 4-core machine)
|
|
7
|
-
// workers: 2, // Or explicitly set to 2 for controlled testing
|
|
8
|
-
testDir: "./tests/playwright",
|
|
9
|
-
timeout: 600000, // 10 minutes
|
|
10
|
-
retries: 2,
|
|
11
|
-
reporter: [
|
|
12
|
-
["list"],
|
|
13
|
-
["json", { outputFile: "test-artifacts/test-results.json" }],
|
|
14
|
-
],
|
|
15
|
-
use: {
|
|
16
|
-
baseURL: "https://api.quickbase.com",
|
|
17
|
-
headless: true,
|
|
18
|
-
viewport: { width: 1280, height: 720 },
|
|
19
|
-
actionTimeout: 10000,
|
|
20
|
-
screenshot: "off",
|
|
21
|
-
},
|
|
22
|
-
outputDir: "test-artifacts",
|
|
23
|
-
projects: [
|
|
24
|
-
{
|
|
25
|
-
name: "chromium",
|
|
26
|
-
use: { ...devices["Desktop Chrome"] },
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
console.log(
|
|
32
|
-
`Loading Playwright: Testing temp token authorization in browser. Be patient, this could take at least 5min. Workers: ${
|
|
33
|
-
config.workers || "default (half CPU cores)"
|
|
34
|
-
}`
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export default config;
|
package/rollup.config.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import terser from "@rollup/plugin-terser";
|
|
2
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
3
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
-
import dts from "rollup-plugin-dts";
|
|
5
|
-
import typescript from "@rollup/plugin-typescript";
|
|
6
|
-
|
|
7
|
-
const isProd = process.env.NODE_ENV === "production";
|
|
8
|
-
|
|
9
|
-
// External dependencies for both ESM and UMD builds
|
|
10
|
-
const external = [
|
|
11
|
-
"node:http",
|
|
12
|
-
"node:https",
|
|
13
|
-
"node:zlib",
|
|
14
|
-
"node:stream",
|
|
15
|
-
"node:buffer",
|
|
16
|
-
"node:util",
|
|
17
|
-
"node:url",
|
|
18
|
-
"node:net",
|
|
19
|
-
"node:fs",
|
|
20
|
-
"node:path",
|
|
21
|
-
"node-fetch",
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
// Global mappings for UMD (browser) build
|
|
25
|
-
const globals = {
|
|
26
|
-
"node-fetch": "fetch", // Map node-fetch to window.fetch in browsers
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default [
|
|
30
|
-
// ESM Build
|
|
31
|
-
{
|
|
32
|
-
input: "src/quickbaseClient.ts",
|
|
33
|
-
output: {
|
|
34
|
-
dir: "dist/esm",
|
|
35
|
-
format: "esm",
|
|
36
|
-
sourcemap: true,
|
|
37
|
-
entryFileNames: "quickbase.js",
|
|
38
|
-
},
|
|
39
|
-
external,
|
|
40
|
-
plugins: [
|
|
41
|
-
nodeResolve({ preferBuiltins: true }), // Node.js resolution
|
|
42
|
-
commonjs(), // Convert CommonJS to ESM
|
|
43
|
-
typescript({
|
|
44
|
-
tsconfig: "./tsconfig.json",
|
|
45
|
-
noEmitOnError: true, // Fail on TypeScript errors
|
|
46
|
-
// Use Rollup to emit JavaScript, overriding noEmit for this build
|
|
47
|
-
}),
|
|
48
|
-
isProd && terser(), // Minification for production
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
// UMD Build
|
|
52
|
-
{
|
|
53
|
-
input: "src/quickbaseClient.ts",
|
|
54
|
-
output: {
|
|
55
|
-
file: "dist/umd/quickbase.umd.js",
|
|
56
|
-
format: "umd",
|
|
57
|
-
name: "QuickbaseJS", // Global name for browser
|
|
58
|
-
sourcemap: true,
|
|
59
|
-
globals,
|
|
60
|
-
},
|
|
61
|
-
external,
|
|
62
|
-
plugins: [
|
|
63
|
-
nodeResolve({ preferBuiltins: true, browser: true }), // Browser-first resolution
|
|
64
|
-
commonjs(), // Convert CommonJS to UMD
|
|
65
|
-
typescript({
|
|
66
|
-
tsconfig: "./tsconfig.json",
|
|
67
|
-
noEmitOnError: true, // Fail on TypeScript errors
|
|
68
|
-
// Use Rollup to emit JavaScript, overriding noEmit for this build
|
|
69
|
-
}),
|
|
70
|
-
isProd && terser(), // Minification for production
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
// ESM Declarations
|
|
74
|
-
{
|
|
75
|
-
input: "src/quickbaseClient.ts",
|
|
76
|
-
output: {
|
|
77
|
-
file: "dist/esm/quickbase.d.ts",
|
|
78
|
-
format: "esm",
|
|
79
|
-
},
|
|
80
|
-
plugins: [
|
|
81
|
-
dts({
|
|
82
|
-
tsconfig: "./tsconfig.json",
|
|
83
|
-
respectExternal: true, // Include external dependencies in declarations
|
|
84
|
-
}),
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
// UMD Declarations
|
|
88
|
-
{
|
|
89
|
-
input: "src/quickbaseClient.ts",
|
|
90
|
-
output: {
|
|
91
|
-
file: "dist/umd/quickbase.umd.d.ts",
|
|
92
|
-
format: "umd",
|
|
93
|
-
},
|
|
94
|
-
plugins: [
|
|
95
|
-
dts({
|
|
96
|
-
tsconfig: "./tsconfig.json",
|
|
97
|
-
respectExternal: true, // Include external dependencies in declarations
|
|
98
|
-
}),
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
].map((config) => ({
|
|
102
|
-
...config,
|
|
103
|
-
onwarn(warning, warn) {
|
|
104
|
-
// Suppress TypeScript plugin warnings
|
|
105
|
-
if (
|
|
106
|
-
warning.code === "PLUGIN_WARNING" &&
|
|
107
|
-
warning.plugin === "typescript" &&
|
|
108
|
-
warning.message.includes("TS5096")
|
|
109
|
-
) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
warn(warning);
|
|
113
|
-
},
|
|
114
|
-
}));
|