quickbase-js 0.1.0-beta.9 → 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.
Files changed (146) hide show
  1. package/README.md +270 -60
  2. package/dist/esm/quickbase.d.ts +2553 -3220
  3. package/dist/esm/quickbase.js +1545 -3443
  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 +1544 -3625
  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 +25 -12
  12. package/CHANGELOG.md +0 -184
  13. package/build-common.js +0 -131
  14. package/build-esm.js +0 -71
  15. package/build-umd.js +0 -69
  16. package/examples/quicbase-jsCDN.html +0 -36
  17. package/examples/react.js +0 -48
  18. package/examples/vanillajs.html +0 -47
  19. package/open-api/fix-spec-main.ts +0 -97
  20. package/open-api/generate-override-report.ts +0 -214
  21. package/open-api/generate-unified-interface.ts +0 -336
  22. package/open-api/output/override-report.html +0 -11
  23. package/open-api/output/override-report.json +0 -14395
  24. package/open-api/output/quickbase-fixed.json +0 -11191
  25. package/open-api/regenerate-client.ts +0 -116
  26. package/open-api/schema/enhance-general.ts +0 -100
  27. package/open-api/schema/fix-arrays.ts +0 -69
  28. package/open-api/schema/tags/apps.ts +0 -90
  29. package/open-api/schema/tags/fields.ts +0 -471
  30. package/open-api/schema/tags/groups.ts +0 -51
  31. package/open-api/schema/tags/index.ts +0 -66
  32. package/open-api/schema/tags/records.ts +0 -115
  33. package/open-api/schema/tags/tables.ts +0 -211
  34. package/open-api/schema/tags/users.ts +0 -47
  35. package/open-api/types/spec.ts +0 -42
  36. package/open-api/utils/generateJsDoc.ts +0 -96
  37. package/open-api/utils/infer-schema.ts +0 -40
  38. package/open-api/utils/naming.ts +0 -10
  39. package/playwright.config.ts +0 -37
  40. package/rollup.config.js +0 -114
  41. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  42. package/specs/split/apps.json +0 -1315
  43. package/specs/split/auth.json +0 -191
  44. package/specs/split/fields.json +0 -3869
  45. package/specs/split/records.json +0 -754
  46. package/specs/split/reports.json +0 -619
  47. package/specs/split/tables.json +0 -1605
  48. package/src/RateLimitError.ts +0 -12
  49. package/src/ThrottleBucket.ts +0 -41
  50. package/src/authorizationStrategy.ts +0 -246
  51. package/src/generated-unified/QuickbaseClient.ts +0 -1049
  52. package/src/generated-unified/missing-types-report.json +0 -3
  53. package/src/index.ts +0 -1
  54. package/src/invokeMethod.ts +0 -242
  55. package/src/quickbaseClient.ts +0 -271
  56. package/src/rateLimiter.ts +0 -25
  57. package/src/tokenCache.ts +0 -35
  58. package/src/utils.ts +0 -7
  59. package/test-esm.js +0 -1
  60. package/test-results.json +0 -2050
  61. package/test-umd.js +0 -1
  62. package/test.ts +0 -1
  63. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
  64. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
  65. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
  66. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
  67. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
  68. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
  69. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
  70. package/tests/setup.ts +0 -53
  71. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  72. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  73. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  74. package/tests/vitest/qb/apps/getApp.test.ts +0 -44
  75. package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
  76. package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
  77. package/tests/vitest/qb/auth/mockQuickbaseServer.ts +0 -60
  78. package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -73
  79. package/tests/vitest/qb/auth/ssoTokenIntegrationWithServer.test.ts +0 -65
  80. package/tests/vitest/qb/fields/createField.test.ts +0 -77
  81. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
  82. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  83. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -82
  84. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  85. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  86. package/tests/vitest/qb/fields/updateField.test.ts +0 -93
  87. package/tests/vitest/qb/formulas/runFormula.test.ts +0 -96
  88. package/tests/vitest/qb/index.ts +0 -29
  89. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  90. package/tests/vitest/qb/records/runQuery.test.ts +0 -146
  91. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  92. package/tests/vitest/qb/tables/createRelationship.test.ts +0 -102
  93. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  94. package/tests/vitest/qb/tables/deleteRelationship.test.ts +0 -143
  95. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  96. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  97. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  98. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  99. package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -250
  100. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  101. package/tests/vitest/unit/ThrottleBucket.test.ts +0 -95
  102. package/tests/vitest/unit/apps/copyApp.test.ts +0 -581
  103. package/tests/vitest/unit/apps/createApp.test.ts +0 -186
  104. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
  105. package/tests/vitest/unit/apps/getApp.test.ts +0 -128
  106. package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
  107. package/tests/vitest/unit/apps/updateApp.test.ts +0 -412
  108. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -63
  109. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -119
  110. package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -95
  111. package/tests/vitest/unit/auth/retryTempTokenMaxRetries.test.ts +0 -235
  112. package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -69
  113. package/tests/vitest/unit/auth/ssoTokenRefresh.test.ts +0 -325
  114. package/tests/vitest/unit/fields/createField.test.ts +0 -451
  115. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  116. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  117. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -180
  118. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  119. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  120. package/tests/vitest/unit/fields/updateField.test.ts +0 -285
  121. package/tests/vitest/unit/formulas/runFormula.test.ts +0 -205
  122. package/tests/vitest/unit/index.ts +0 -34
  123. package/tests/vitest/unit/inferHttpMethod.test.ts +0 -131
  124. package/tests/vitest/unit/rateLimit.test.ts +0 -191
  125. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  126. package/tests/vitest/unit/records/runQuery.test.ts +0 -102
  127. package/tests/vitest/unit/records/upsert.test.ts +0 -234
  128. package/tests/vitest/unit/tables/createRelationship.test.ts +0 -212
  129. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  130. package/tests/vitest/unit/tables/deleteRelationship.test.ts +0 -97
  131. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  132. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  133. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  134. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  135. package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -307
  136. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  137. package/tests/vitest/unit/tokenLifespan.test.ts +0 -204
  138. package/tests/vitest/unit/umd.test.ts +0 -8
  139. package/text.txt +0 -104
  140. package/tools/log-gen.ts +0 -244
  141. package/tools/log-gen.yaml +0 -5424
  142. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  143. package/tsconfig.build.json +0 -17
  144. package/tsconfig.json +0 -32
  145. package/versionrc.json +0 -9
  146. package/vitest.config.ts +0 -27
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execSync } from "child_process";
3
- import { existsSync } from "fs";
4
- import { join } from "path";
5
- import { fileURLToPath } from "url";
6
- import fetch from "node-fetch";
7
- import readline from "readline";
8
-
9
- const CURRENT_JAR_VERSION = "7.12.0";
10
- const MAVEN_METADATA_URL =
11
- "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/maven-metadata.xml";
12
- const CODEGEN_DIR = join(fileURLToPath(import.meta.url), ".."); // open-api/
13
- const JARS_DIR = join(CODEGEN_DIR, "..", "tools", "openapi-jars"); // Updated to tools/openapi-jars/
14
- const SPEC_INPUT = join(CODEGEN_DIR, "output", "quickbase-fixed.json"); // Relative to open-api/
15
- const OUTPUT_DIR = join(CODEGEN_DIR, "..", "src", "generated"); // Up to root, then into src/generated/
16
-
17
- async function getLatestVersion(): Promise<string> {
18
- const response = await fetch(MAVEN_METADATA_URL);
19
- if (!response.ok)
20
- throw new Error(`Failed to fetch Maven metadata: ${response.statusText}`);
21
- const text = await response.text();
22
- const match = text.match(/<latest>(.*?)<\/latest>/);
23
- if (!match)
24
- throw new Error("Couldn’t parse latest version from Maven metadata");
25
- return match[1];
26
- }
27
-
28
- async function checkAndPromptForUpdate(messages: string[]): Promise<string> {
29
- const latestVersion = await getLatestVersion();
30
- if (latestVersion === CURRENT_JAR_VERSION) {
31
- messages.push(`Current version (${CURRENT_JAR_VERSION}) is the latest.`);
32
- return CURRENT_JAR_VERSION;
33
- }
34
-
35
- messages.push(
36
- `Newer version available: ${latestVersion} (current: ${CURRENT_JAR_VERSION})`
37
- );
38
- const rl = readline.createInterface({
39
- input: process.stdin,
40
- output: process.stdout,
41
- });
42
-
43
- return new Promise((resolve) => {
44
- const prompt = "Do you want to update to the latest version? (y/n): ";
45
- messages.push(prompt);
46
- rl.question(prompt, (answer) => {
47
- rl.close();
48
- if (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes") {
49
- messages.push(`Switching to version ${latestVersion}...`);
50
- resolve(latestVersion);
51
- } else {
52
- messages.push(`Sticking with version ${CURRENT_JAR_VERSION}.`);
53
- resolve(CURRENT_JAR_VERSION);
54
- }
55
- });
56
- });
57
- }
58
-
59
- async function ensureJarExists(
60
- version: string,
61
- messages: string[]
62
- ): Promise<string> {
63
- const jarPath = join(JARS_DIR, `openapi-generator-cli-${version}.jar`);
64
- const jarUrl = `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${version}/openapi-generator-cli-${version}.jar`;
65
-
66
- if (!existsSync(jarPath)) {
67
- messages.push(`Downloading OpenAPI Generator CLI v${version}...`);
68
- try {
69
- execSync(`curl -L -o ${jarPath} ${jarUrl}`, { stdio: "inherit" });
70
- messages.push(`Downloaded ${jarPath}`);
71
- } catch (error) {
72
- messages.push("Failed to download JAR.");
73
- throw error;
74
- }
75
- } else {
76
- messages.push(`Using existing ${jarPath}`);
77
- }
78
- return jarPath;
79
- }
80
-
81
- function regenerateClient(jarPath: string, messages: string[]) {
82
- messages.push("Regenerating client from spec...");
83
- const command = `java -jar ${jarPath} generate -i ${SPEC_INPUT} -g typescript-fetch -o ${OUTPUT_DIR} --additional-properties=generateAliasAsModel=true`;
84
- try {
85
- execSync(command, { stdio: "inherit" });
86
- messages.push("Client regeneration complete.");
87
- } catch (error) {
88
- messages.push("Regeneration failed.");
89
- throw error;
90
- }
91
- }
92
-
93
- async function main() {
94
- const messages: string[] = [];
95
- try {
96
- if (!existsSync(SPEC_INPUT)) {
97
- console.error(
98
- `Spec file ${SPEC_INPUT} does not exist. Run 'npm run fix-spec' first.`
99
- );
100
- process.exit(1);
101
- }
102
- const versionToUse = await checkAndPromptForUpdate(messages);
103
- const jarPath = await ensureJarExists(versionToUse, messages);
104
- regenerateClient(jarPath, messages);
105
- } catch (error) {
106
- console.error("Error occurred during process:", error);
107
- } finally {
108
- console.log("\n--- Key Messages ---");
109
- messages.forEach((msg) => console.log(msg));
110
- }
111
- }
112
-
113
- main().catch((error) => {
114
- console.error("Error in regeneration process:", error);
115
- process.exit(1);
116
- });
@@ -1,100 +0,0 @@
1
- // schema/enhance-general.ts
2
- import { Operation, Parameter, Spec } from "../types/spec.ts";
3
- import { inferSchema } from "../utils/infer-schema.ts";
4
-
5
- export function enhanceGeneral(spec: Spec): void {
6
- spec.definitions = spec.definitions || {};
7
-
8
- if (!spec.definitions["Record"]) {
9
- spec.definitions["Record"] = {
10
- type: "object",
11
- additionalProperties: {
12
- type: "object",
13
- properties: { value: { type: "string" } },
14
- required: ["value"],
15
- },
16
- description: "A generic QuickBase record with field ID-value pairs",
17
- };
18
- console.log("Added Record to definitions");
19
- }
20
-
21
- if (!spec.definitions["Permission"]) {
22
- spec.definitions["Permission"] = {
23
- type: "object",
24
- properties: {
25
- role: { type: "string", description: "The role name" },
26
- permissionType: {
27
- type: "string",
28
- description: "Permission type (e.g., View, Modify)",
29
- },
30
- roleId: { type: "integer", description: "The role identifier" },
31
- },
32
- required: ["role", "permissionType", "roleId"],
33
- description: "A single permission entry for a field",
34
- };
35
- console.log("Added Permission to definitions");
36
- }
37
-
38
- for (const pathKey in spec.paths) {
39
- for (const method in spec.paths[pathKey]) {
40
- const operation: Operation = spec.paths[pathKey][method];
41
- const opId =
42
- operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
43
-
44
- if (operation.parameters) {
45
- operation.parameters.forEach((param: Parameter) => {
46
- if (param.in !== "body" && !param.type && !param.schema) {
47
- param.type = param.name.includes("Id") ? "string" : "string";
48
- console.log(
49
- `Set default type 'string' for ${pathKey}(${method}).${param.name}`
50
- );
51
- }
52
- });
53
- }
54
-
55
- if (operation.responses) {
56
- for (const status in operation.responses) {
57
- const response = operation.responses[status];
58
- if (response.schema) {
59
- const cleanStatus = status.replace("/", "_");
60
- const responseName = `${opId}${cleanStatus}Response`;
61
- if (!spec.definitions[responseName]) {
62
- console.log(
63
- `Adding ${responseName} to definitions for ${pathKey}(${method})`
64
- );
65
- if (!response.schema.type && response["x-amf-mediaType"]) {
66
- const mediaType = response["x-amf-mediaType"];
67
- if (mediaType === "application/octet-stream") {
68
- response.schema = {
69
- type: "object",
70
- properties: { data: { type: "string", format: "binary" } },
71
- description:
72
- response.schema?.description || "Binary file content",
73
- };
74
- } else if (mediaType === "application/x-yaml") {
75
- response.schema = {
76
- type: "object",
77
- properties: { content: { type: "string", format: "yaml" } },
78
- description: "YAML-formatted data",
79
- };
80
- } else if (
81
- mediaType === "application/json" &&
82
- response.schema.example
83
- ) {
84
- response.schema = inferSchema(
85
- response.schema.example,
86
- responseName
87
- );
88
- response.schema.description =
89
- response.description || `Response for ${opId}`;
90
- }
91
- }
92
- spec.definitions[responseName] = response.schema;
93
- }
94
- response.schema = { $ref: `#/definitions/${responseName}` };
95
- }
96
- }
97
- }
98
- }
99
- }
100
- }
@@ -1,69 +0,0 @@
1
- // schema/fix-arrays.ts
2
- import { Parameter, Spec } from "../types/spec.ts";
3
-
4
- export function fixArrays(spec: Spec): void {
5
- for (const pathKey in spec.paths) {
6
- for (const method in spec.paths[pathKey]) {
7
- const operation = spec.paths[pathKey][method];
8
- if (operation.parameters) {
9
- operation.parameters.forEach((param: Parameter) => {
10
- if (param.schema?.type === "array" && !param.schema.items) {
11
- console.log(
12
- `Fixing array schema for ${pathKey}(${method}).${param.name}`
13
- );
14
- param.schema.items = { type: "string" };
15
- }
16
- if (param.schema?.properties) {
17
- for (const propKey in param.schema.properties) {
18
- const prop = param.schema.properties[propKey];
19
- if (prop.type === "array" && !prop.items) {
20
- console.log(
21
- `Fixing nested array for ${pathKey}(${method}).${param.name}.${propKey}`
22
- );
23
- prop.items = { type: "string" };
24
- }
25
- }
26
- }
27
- });
28
- }
29
- if (operation.responses) {
30
- for (const status in operation.responses) {
31
- const response = operation.responses[status];
32
- if (response.schema?.type === "array" && !response.schema.items) {
33
- console.log(
34
- `Fixing array schema for ${pathKey}(${method}).responses.${status}`
35
- );
36
- response.schema.items = { type: "string" };
37
- }
38
- if (response.schema?.properties) {
39
- for (const propKey in response.schema.properties) {
40
- // Fixed: Changed param to response
41
- const prop = response.schema.properties[propKey];
42
- if (prop.type === "array" && !prop.items) {
43
- console.log(
44
- `Fixing nested array for ${pathKey}(${method}).responses.${status}.${propKey}`
45
- );
46
- prop.items = { type: "string" };
47
- }
48
- }
49
- }
50
- }
51
- }
52
- }
53
- }
54
-
55
- console.log("Fixing array schemas in definitions...");
56
- const definitions = spec.definitions || {};
57
- for (const defKey in definitions) {
58
- const def = definitions[defKey];
59
- if (def.properties) {
60
- for (const propKey in def.properties) {
61
- const prop = def.properties[propKey];
62
- if (prop.type === "array" && !prop.items) {
63
- console.log(`Fixing missing items in ${defKey}.${propKey}`);
64
- prop.items = { type: "string" };
65
- }
66
- }
67
- }
68
- }
69
- }
@@ -1,90 +0,0 @@
1
- // schema/tags/apps.ts
2
- import { Operation, Parameter, Spec } from "../../types/spec.ts";
3
- import { normalizeDefinitionName } from "../../utils/naming.ts";
4
-
5
- export function enhanceApps(
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("Apps")) {
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
- if (pathKey.includes("/copy") && method === "post") {
32
- properties = {
33
- name: { type: "string", description: "The name of the new app." },
34
- description: {
35
- type: "string",
36
- description: "A description for the new app.",
37
- },
38
- properties: {
39
- type: "object",
40
- properties: {
41
- keepData: {
42
- type: "boolean",
43
- description: "Whether to copy data.",
44
- },
45
- excludeFiles: {
46
- type: "boolean",
47
- description: "Whether to exclude files.",
48
- },
49
- usersAndRoles: {
50
- type: "boolean",
51
- description: "Whether to copy users and roles.",
52
- },
53
- assignUserToken: {
54
- type: "boolean",
55
- description: "Whether to assign the user token.",
56
- },
57
- },
58
- description: "Options for customizing the app copy process.",
59
- },
60
- };
61
- } else {
62
- properties = {
63
- name: { type: "string", description: "The name of the app." },
64
- description: {
65
- type: "string",
66
- description: "A description for the app.",
67
- },
68
- assignToken: {
69
- type: "boolean",
70
- description: "Whether to assign the user token.",
71
- },
72
- };
73
- }
74
- spec.definitions[requestName] = {
75
- type: "object",
76
- properties,
77
- required: Object.keys(properties).filter(
78
- (key) => key !== "description" && key !== "properties"
79
- ),
80
- description: operation.summary || `Request body for ${opId}`,
81
- };
82
- }
83
- param.schema = { $ref: `#/definitions/${requestName}` };
84
- console.log(
85
- `Ensured ${requestName} in definitions for ${pathKey}(${method})`
86
- );
87
- }
88
- });
89
- }
90
- }