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.
Files changed (132) hide show
  1. package/README.md +252 -126
  2. package/dist/esm/quickbase.d.ts +2725 -2689
  3. package/dist/esm/quickbase.js +1763 -3524
  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 +1762 -3706
  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 +27 -12
  12. package/CHANGELOG.md +0 -155
  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 -256
  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/infer-schema.ts +0 -40
  37. package/open-api/utils/naming.ts +0 -10
  38. package/playwright.config.ts +0 -37
  39. package/rollup.config.js +0 -114
  40. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  41. package/specs/split/apps.json +0 -1315
  42. package/specs/split/auth.json +0 -191
  43. package/specs/split/fields.json +0 -3869
  44. package/specs/split/records.json +0 -754
  45. package/specs/split/reports.json +0 -619
  46. package/specs/split/tables.json +0 -1605
  47. package/src/RateLimitError.ts +0 -12
  48. package/src/ThrottleBucket.ts +0 -36
  49. package/src/generated-unified/QuickbaseClient.ts +0 -359
  50. package/src/generated-unified/missing-types-report.json +0 -3
  51. package/src/index.ts +0 -1
  52. package/src/invokeMethod.ts +0 -357
  53. package/src/quickbaseClient.ts +0 -244
  54. package/src/tokenCache.ts +0 -51
  55. package/src/utils.ts +0 -7
  56. package/test-esm.js +0 -1
  57. package/test-results.json +0 -2050
  58. package/test-umd.js +0 -1
  59. package/test.ts +0 -1
  60. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
  61. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
  62. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
  63. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
  64. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
  65. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
  66. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
  67. package/tests/setup.ts +0 -53
  68. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  69. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  70. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  71. package/tests/vitest/qb/apps/getApp.test.ts +0 -44
  72. package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
  73. package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
  74. package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -56
  75. package/tests/vitest/qb/fields/createField.test.ts +0 -77
  76. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
  77. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  78. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -174
  79. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  80. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  81. package/tests/vitest/qb/fields/updateField.test.ts +0 -93
  82. package/tests/vitest/qb/index.ts +0 -29
  83. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  84. package/tests/vitest/qb/records/runQuery.test.ts +0 -146
  85. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  86. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  87. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  88. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  89. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  90. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  91. package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -277
  92. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  93. package/tests/vitest/unit/apps/copyApp.test.ts +0 -488
  94. package/tests/vitest/unit/apps/createApp.test.ts +0 -186
  95. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
  96. package/tests/vitest/unit/apps/getApp.test.ts +0 -128
  97. package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
  98. package/tests/vitest/unit/apps/updateApp.test.ts +0 -381
  99. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -62
  100. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -95
  101. package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -113
  102. package/tests/vitest/unit/auth/retryTempTokenTwo401.test.ts +0 -81
  103. package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -56
  104. package/tests/vitest/unit/fields/createField.test.ts +0 -387
  105. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  106. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  107. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -166
  108. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  109. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  110. package/tests/vitest/unit/fields/updateField.test.ts +0 -280
  111. package/tests/vitest/unit/index.ts +0 -33
  112. package/tests/vitest/unit/rateLimit.test.ts +0 -189
  113. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  114. package/tests/vitest/unit/records/runQuery.test.ts +0 -102
  115. package/tests/vitest/unit/records/upsert.test.ts +0 -234
  116. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  117. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  118. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  119. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  120. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  121. package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -305
  122. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  123. package/tests/vitest/unit/tokenLifespan.test.ts +0 -138
  124. package/tests/vitest/unit/umd.test.ts +0 -8
  125. package/text.txt +0 -104
  126. package/tools/log-gen.ts +0 -235
  127. package/tools/log-gen.yaml +0 -4982
  128. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  129. package/tsconfig.build.json +0 -17
  130. package/tsconfig.json +0 -32
  131. package/versionrc.json +0 -9
  132. package/vitest.config.ts +0 -27
package/tools/log-gen.ts DELETED
@@ -1,235 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "fs";
3
- import path from "path";
4
- import { fileURLToPath } from "url";
5
- import yaml from "js-yaml";
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = path.dirname(__filename);
9
-
10
- const rootDir: string = "./";
11
- const excludeDirs: string[] = [
12
- "node_modules",
13
- ".git",
14
- "specs",
15
- "open-api/output",
16
- ];
17
-
18
- // prettier-ignore
19
- const includeFolders: string[] = [
20
- // "open-api",
21
- ];
22
-
23
- // prettier-ignore
24
- const includeRecursiveFolders: string[] = [
25
- // "open-api"
26
- // "tests",
27
- // "tests/vitest/unit",
28
- "tests/vitest/qb"
29
- ];
30
-
31
- // prettier-ignore
32
- const includeFiles: string[] = [
33
- // "tests/setup.ts",
34
-
35
- // "package.json",
36
- // "tsconfig.json",
37
- // "tsconfig.build.json",
38
- // "rollup.config.js",
39
- // "vitest.config.ts",
40
- // "build-common.js",
41
- // "build-umd.js",
42
- // "build-esm.js",
43
- // "src/tokenCache.ts",
44
- // "src/generated/runtime.ts",
45
- // "src/quickbaseClient.ts",
46
- // "src/invokeMethod.ts",
47
- // "src/generated-unified/QuickbaseClient.ts",
48
-
49
- // "src/RateLimitError.ts",
50
- // "src/TokenBucket.ts"
51
- ];
52
-
53
- const projectGoals: string[] = [
54
- "A library for interacting with the QuickBase RESTful API.",
55
- "Use OpenAPI to generate types and methods using a proxy. Validate with tests.",
56
- "Provide robust and intuitive temporary token support for browser environments.",
57
- "User Tokens support both Node.js and browser environments.",
58
- "Use case: JS frameworks like React, Vue, and Angular hosted in QuickBase code pages.",
59
- "Enable a flexible or native fetch in the browser.",
60
- "Enable a flexible fetch framework in Node.js.",
61
- "#",
62
- "No manual updating methods when the QuickBase API changes.",
63
- "The proxy magic dynamically maps generated methods and types.",
64
- "#",
65
- "TokenCache is defined per quickbaseClient call, so each instance has its own isolated TokenCache.",
66
- "Each quickbase client instance has an isolated and individual token cache.",
67
- ];
68
-
69
- const pipelineOverview: string[] = [
70
- "What I’m Trying to Do",
71
- "My approach is to ensure AppsApi.ts is generated with getAppById so QuickbaseClient.ts can map it to client.getApp. Steps include:",
72
- "Fix fix-spec.ts:",
73
- 'Add tags: ["Apps"] to /apps/* endpoints to group them into AppsApi.ts.',
74
- "Ensure all endpoints and models are correctly defined and typed.",
75
- "Debug regenerate-client.ts:",
76
- "Enhance logging to catch why AppsApi.ts isn’t generated.",
77
- "Test if getAppById appears in another file (e.g., DefaultApi.ts).",
78
- "Update QuickbaseClient.ts:",
79
- "Adjust imports to use the correct API class once generated.",
80
- "Test and Iterate:",
81
- "Run npm run fix-spec, npm run regenerate, and npm run test to verify AppsApi.ts exists and test.ts works.",
82
- "The latest fix-spec.ts with tags aims to force the generator to create AppsApi.ts, addressing the missing file issue.",
83
- "Relevant Project Files",
84
- "Here’s a list of files that would help understand and resolve this problem, along with their roles:",
85
- "src/code-generation/fix-spec.ts:",
86
- "Role: Modifies the original QuickBase spec (e.g., QuickBase_RESTful_*.json) to create quickbase-fixed.json with required endpoints (e.g., /apps/{appId}).",
87
- "Relevance: Defines the spec fed to the generator; errors here affect generation.",
88
- "src/code-generation/quickbase-fixed.json:",
89
- "Role: The processed OpenAPI spec used by regenerate-client.ts to generate code.",
90
- 'Relevance: Confirms if /apps/{appId} is correctly structured with operationId: "getAppById".',
91
- "src/code-generation/regenerate-client.ts:",
92
- "Role: Runs OpenAPI Generator to produce src/generated/ files (APIs and models) and fixes .ts extensions with ts-morph.",
93
- "Relevance: Controls the generation process; logs reveal why AppsApi.ts is missing.",
94
- "src/generated/apis/AppsApi.ts (if exists):",
95
- "Role: Should contain getAppById method for /apps/{appId} GET.",
96
- "Relevance: Missing file is the core issue; its absence breaks QuickbaseClient.ts.",
97
- "src/generated/apis/DefaultApi.ts:",
98
- "Role: Default API class for untagged operations.",
99
- "Relevance: Might contain getAppById if tags are misconfigured.",
100
- "src/QuickbaseClient.ts:",
101
- "Role: Wraps generated API classes (e.g., AppsApi) in a Proxy for ergonomic calls (e.g., client.getApp).",
102
- "Relevance: Fails to import AppsApi.ts, causing the runtime error.",
103
- "src/test.ts:",
104
- "Role: Test script calling client.getApp({ appId }).",
105
- "Relevance: Final validation point; shows if the fix works.",
106
- ".env.development:",
107
- "Role: Stores QB_REALM, QB_USER_TOKEN, QB_APP_ID for API authentication.",
108
- "Relevance: Ensures the API call has valid credentials (not the current issue, but critical for success).",
109
- "src/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json (or similar):",
110
- "Role: Original QuickBase API spec before fix-spec.ts processing.",
111
- "Relevance: Shows how /apps/{appId} was originally defined, helping identify conflicts.",
112
- "package.json:",
113
- "Role: Defines scripts (fix-spec, regenerate, test) and dependencies (e.g., ts-node, openapi-generator-cli).",
114
- "Relevance: Confirms script commands and versions align with our process.",
115
- "What We Achieved",
116
- "Goal Met: You can now call client.getApp({ appId: \"buwai2zpe\" }) and get the app details { id: 'buwai2zpe', name: 'qb-copy' }.",
117
- "Fixes Applied:",
118
- 'Added tags: ["Apps"] in fix-spec.ts to ensure AppsApi.ts is generated with getAppById.',
119
- "Updated QuickbaseClient.ts to:",
120
- "Use prototype methods via Object.getOwnPropertyNames.",
121
- "Bind methods to preserve context with .bind(api).",
122
- "Handle getAppById’s direct JSON return instead of a Response object.",
123
- "Result: The ergonomic API you wanted (client.getApp) works seamlessly with the generated AppsApi.ts.",
124
- "Why It Works Now",
125
- "fix-spec.ts:",
126
- 'Correctly defined /apps/{appId} with operationId: "getAppById" and tags: ["Apps"], ensuring AppsApi.ts generation.',
127
- "regenerate-client.ts:",
128
- "Successfully ran OpenAPI Generator to produce AppsApi.ts with getAppById.",
129
- "QuickbaseClient.ts:",
130
- "buildMethodMap now captures getAppById and maps it to getApp.",
131
- "invokeMethod passes { appId: 'buwai2zpe' } as requestParameters and handles the JSON response directly.",
132
- "test.ts:",
133
- "Calls client.getApp and logs the result, proving the end-to-end flow.",
134
- ];
135
-
136
- interface TreeNode {
137
- name: string;
138
- type: "directory" | "file";
139
- contents?: string;
140
- children?: TreeNode[];
141
- }
142
-
143
- function buildTree(dir: string): TreeNode {
144
- const node: TreeNode = {
145
- name: path.basename(dir) || "",
146
- type: "directory",
147
- children: [],
148
- };
149
-
150
- const files: fs.Dirent[] = fs.readdirSync(dir, { withFileTypes: true });
151
-
152
- files.forEach((file: fs.Dirent) => {
153
- const filePath: string = path.join(dir, file.name);
154
- const relativePath: string = path
155
- .relative(rootDir, filePath)
156
- .replace(/\\/g, "/");
157
-
158
- if (file.isDirectory() && excludeDirs.includes(relativePath)) return;
159
-
160
- const childNode: TreeNode = {
161
- name: file.name,
162
- type: file.isDirectory() ? "directory" : "file",
163
- };
164
-
165
- if (file.isDirectory()) {
166
- childNode.children = buildTree(filePath).children;
167
- } else {
168
- const isInIncludeFolder = includeFolders.some((folder) => {
169
- const folderPath = folder.endsWith("/") ? folder : folder + "/";
170
- return (
171
- relativePath.startsWith(folderPath) &&
172
- relativePath.split("/").length === folderPath.split("/").length
173
- );
174
- });
175
-
176
- const isInIncludeRecursiveFolder = includeRecursiveFolders.some(
177
- (folder) =>
178
- relativePath.startsWith(folder + "/") || relativePath === folder
179
- );
180
-
181
- const shouldInclude =
182
- includeFiles.includes(relativePath) ||
183
- isInIncludeFolder ||
184
- isInIncludeRecursiveFolder;
185
-
186
- if (shouldInclude) {
187
- // Check if the file is in open-api/output
188
- const isInOutputDir = relativePath.startsWith("open-api/output/");
189
-
190
- if (!isInOutputDir) {
191
- // Only read contents if not in output directory
192
- try {
193
- childNode.contents = fs.readFileSync(filePath, "utf8");
194
- } catch (err: unknown) {
195
- childNode.contents = `[Error reading file: ${
196
- (err as Error).message
197
- }]`;
198
- }
199
- } else {
200
- // For files in output directory, just mark their existence
201
- childNode.contents = "[File contents excluded - output directory]";
202
- }
203
- }
204
- }
205
-
206
- node.children!.push(childNode);
207
- });
208
-
209
- return node;
210
- }
211
-
212
- function generateTreeSnapshot(): string {
213
- const snapshot = {
214
- project: "quickbase-js",
215
- date: new Date().toLocaleDateString(),
216
- root: path.resolve(rootDir),
217
- goals: projectGoals,
218
- pipelineOverview: pipelineOverview,
219
- tree: buildTree(rootDir),
220
- };
221
-
222
- return yaml.dump(snapshot, { lineWidth: -2 });
223
- }
224
-
225
- try {
226
- const output: string = generateTreeSnapshot();
227
- const outputPath: string = path.join(__dirname, "log-gen.yaml");
228
- fs.writeFileSync(outputPath, output, "utf8");
229
- const lineCount: number = output.split("\n").length - 0;
230
- console.log("log-gen.yaml");
231
- console.log(`Lines: ${lineCount}`);
232
- } catch (error: unknown) {
233
- console.error("Failed to generate tree snapshot:", (error as Error).message);
234
- process.exit(0);
235
- }