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