quickbase-js 0.1.0-beta.13 → 0.1.0-beta.14

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 (167) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/quickbase.d.ts +2 -1
  3. package/package.json +9 -4
  4. package/CHANGELOG.md +0 -239
  5. package/build-common.js +0 -131
  6. package/build-esm.js +0 -71
  7. package/build-umd.js +0 -69
  8. package/docs/.vitepress/cache/deps/@theme_index.js +0 -275
  9. package/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
  10. package/docs/.vitepress/cache/deps/_metadata.json +0 -40
  11. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js +0 -12542
  12. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js.map +0 -7
  13. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js +0 -9719
  14. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js.map +0 -7
  15. package/docs/.vitepress/cache/deps/package.json +0 -3
  16. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4504
  17. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  18. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -583
  19. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  20. package/docs/.vitepress/cache/deps/vue.js +0 -343
  21. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  22. package/docs/.vitepress/config.mts +0 -26
  23. package/docs/api-examples.md +0 -49
  24. package/docs/index.md +0 -59
  25. package/docs/markdown-examples.md +0 -85
  26. package/docs-data/api-docs.json +0 -4143
  27. package/examples/quicbase-jsCDN.html +0 -36
  28. package/examples/react.js +0 -48
  29. package/examples/vanillajs.html +0 -47
  30. package/index.md +0 -25
  31. package/open-api/fix-spec-main.ts +0 -133
  32. package/open-api/generate-unified-interface.ts +0 -104
  33. package/open-api/generateDocsJson.ts +0 -24
  34. package/open-api/output/quickbase-fixed.json +0 -11191
  35. package/open-api/post-process-generated.ts +0 -226
  36. package/open-api/regenerate-client.ts +0 -117
  37. package/open-api/schema/enhance-general.ts +0 -111
  38. package/open-api/schema/fix-arrays.ts +0 -68
  39. package/open-api/schema/tags/apps.ts +0 -90
  40. package/open-api/schema/tags/fields.ts +0 -471
  41. package/open-api/schema/tags/groups.ts +0 -51
  42. package/open-api/schema/tags/index.ts +0 -66
  43. package/open-api/schema/tags/records.ts +0 -115
  44. package/open-api/schema/tags/tables.ts +0 -211
  45. package/open-api/schema/tags/users.ts +0 -47
  46. package/open-api/types/spec.ts +0 -42
  47. package/open-api/utils/common.ts +0 -29
  48. package/open-api/utils/generateJsDoc.ts +0 -74
  49. package/open-api/utils/infer-schema.ts +0 -40
  50. package/open-api/utils/naming.ts +0 -10
  51. package/open-api/utils/sharedUtils.ts +0 -352
  52. package/playwright.config.ts +0 -37
  53. package/rollup.config.js +0 -114
  54. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  55. package/specs/split/apps.json +0 -1315
  56. package/specs/split/auth.json +0 -191
  57. package/specs/split/fields.json +0 -3869
  58. package/specs/split/records.json +0 -754
  59. package/specs/split/reports.json +0 -619
  60. package/specs/split/tables.json +0 -1605
  61. package/src/BurstAwareThrottleBucket.ts +0 -57
  62. package/src/FlowThrottleBucket.ts +0 -47
  63. package/src/RateLimitError.ts +0 -12
  64. package/src/RateThrottleBucket.ts +0 -5
  65. package/src/Semaphore.ts +0 -33
  66. package/src/authorizationStrategy.ts +0 -321
  67. package/src/generated-unified/QuickbaseClient.ts +0 -1135
  68. package/src/generated-unified/missing-types-report.json +0 -3
  69. package/src/index.ts +0 -1
  70. package/src/invokeMethod.ts +0 -290
  71. package/src/pagination.ts +0 -429
  72. package/src/quickbaseClient.ts +0 -227
  73. package/src/rateLimiter.ts +0 -30
  74. package/src/tokenCache.ts +0 -39
  75. package/src/utils.ts +0 -50
  76. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
  77. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
  78. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
  79. package/tests/playwright/qb/auth/getAppWithTempTokenConcurrency.test.ts +0 -208
  80. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
  81. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
  82. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
  83. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
  84. package/tests/setup.ts +0 -53
  85. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  86. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  87. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  88. package/tests/vitest/qb/apps/getApp.test.ts +0 -44
  89. package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
  90. package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
  91. package/tests/vitest/qb/auth/mockQuickbaseServer.ts +0 -60
  92. package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -73
  93. package/tests/vitest/qb/auth/ssoTokenConcurrency.test.ts +0 -68
  94. package/tests/vitest/qb/auth/ssoTokenIntegrationWithServer.test.ts +0 -65
  95. package/tests/vitest/qb/auth/userTokenConcurrency.test.ts +0 -63
  96. package/tests/vitest/qb/fields/createField.test.ts +0 -77
  97. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
  98. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  99. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -82
  100. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  101. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  102. package/tests/vitest/qb/fields/updateField.test.ts +0 -93
  103. package/tests/vitest/qb/formulas/runFormula.test.ts +0 -96
  104. package/tests/vitest/qb/index.ts +0 -29
  105. package/tests/vitest/qb/quickbase-js/BurstAwareThrottleBucket.test.ts +0 -125
  106. package/tests/vitest/qb/quickbase-js/FlowBucket.test.ts +0 -77
  107. package/tests/vitest/qb/quickbase-js/paginationSkip.test.ts +0 -111
  108. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  109. package/tests/vitest/qb/records/runQuery.test.ts +0 -145
  110. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  111. package/tests/vitest/qb/tables/createRelationship.test.ts +0 -102
  112. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  113. package/tests/vitest/qb/tables/deleteRelationship.test.ts +0 -143
  114. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  115. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  116. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  117. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  118. package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -250
  119. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  120. package/tests/vitest/unit/apps/copyApp.test.ts +0 -581
  121. package/tests/vitest/unit/apps/createApp.test.ts +0 -186
  122. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
  123. package/tests/vitest/unit/apps/getApp.test.ts +0 -128
  124. package/tests/vitest/unit/apps/getAppConcurrency.test.ts +0 -151
  125. package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
  126. package/tests/vitest/unit/apps/updateApp.test.ts +0 -412
  127. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -81
  128. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -119
  129. package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -95
  130. package/tests/vitest/unit/auth/retryTempTokenMaxRetries.test.ts +0 -206
  131. package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -66
  132. package/tests/vitest/unit/auth/ssoTokenRefresh.test.ts +0 -325
  133. package/tests/vitest/unit/auth/userTokenConcurrency.test.ts +0 -62
  134. package/tests/vitest/unit/fields/createField.test.ts +0 -451
  135. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  136. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  137. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -180
  138. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  139. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  140. package/tests/vitest/unit/fields/updateField.test.ts +0 -285
  141. package/tests/vitest/unit/formulas/runFormula.test.ts +0 -205
  142. package/tests/vitest/unit/index.ts +0 -34
  143. package/tests/vitest/unit/quickbase-js/BurstAwareThrottleBucket.test.ts +0 -108
  144. package/tests/vitest/unit/quickbase-js/FlowBucket.test.ts +0 -101
  145. package/tests/vitest/unit/quickbase-js/pagination.test.ts +0 -251
  146. package/tests/vitest/unit/quickbase-js/quickbaseClientHttpMethods.test.ts +0 -141
  147. package/tests/vitest/unit/quickbase-js/rateLimit.test.ts +0 -191
  148. package/tests/vitest/unit/quickbase-js/tokenLifespan.test.ts +0 -204
  149. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  150. package/tests/vitest/unit/records/runQuery.test.ts +0 -101
  151. package/tests/vitest/unit/records/upsert.test.ts +0 -234
  152. package/tests/vitest/unit/tables/createRelationship.test.ts +0 -212
  153. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  154. package/tests/vitest/unit/tables/deleteRelationship.test.ts +0 -97
  155. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  156. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  157. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  158. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  159. package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -307
  160. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  161. package/tools/log-gen.ts +0 -251
  162. package/tools/log-gen.yaml +0 -4829
  163. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  164. package/tsconfig.build.json +0 -17
  165. package/tsconfig.json +0 -32
  166. package/versionrc.json +0 -9
  167. package/vitest.config.ts +0 -27
@@ -1,36 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Quickbase</title>
6
- <script src="https://cdn.jsdelivr.net/npm/quickbase-js@1.1.0-beta.6/dist/umd/quickbase.umd.min.js"></script>
7
- </head>
8
-
9
- <body>
10
- <div>
11
- <h1>Quickbase-js CDN Example</h1>
12
- <p id="result">Loading...</p>
13
- </div>
14
- <script>
15
- var realm = "xxxxxxxxxxxxxxxxxxxx"; // replace with your realm
16
- var appId = "xxxxxxxxxxxxxxxxxxxx"; // replace with your app ID
17
- if (typeof QuickbaseJS === "undefined") {
18
- document.getElementById("result").textContent = "Error: Failed to load QuickbaseJS library.";
19
- } else {
20
- var qb = QuickbaseJS.quickbase({
21
- realm,
22
- useTempTokens: true
23
- });
24
-
25
- qb.getApp({ appId })
26
- .then(function (app) {
27
- document.getElementById("result").textContent = "App Name: " + app.name;
28
- })
29
- .catch(function (err) {
30
- document.getElementById("result").textContent = "Error: " + (err.message || "Failed to load app");
31
- });
32
- }
33
- </script>
34
- </body>
35
-
36
- </html>
package/examples/react.js DELETED
@@ -1,48 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { quickbase } from "quickbase-js";
3
-
4
- const App = () => {
5
- const [appName, setAppName] = useState < string > "Loading...";
6
- const [error, setError] = (useState < string) | (null > null);
7
-
8
- useEffect(() => {
9
- // Initialize the QuickBase client
10
- const qb = quickbase({
11
- realm: "your-realm", // Replace with actual QuickBase realm
12
- // ## ------------------------------
13
- // ## Authentication Options
14
- // ## ------------------------------
15
- // ## OPTION 1: User Token Authentication
16
- // ## - Use this if you have a QuickBase user token (get it from "My Profile" > "Manage User Tokens")
17
- // ## - Works in Node.js or browsers, ideal for standalone apps or testing outside QuickBase
18
- // ## - Use the line below and replace with your token; comment out 'useTempTokens'
19
- // userToken: "your-user-token",
20
-
21
- // ## ------------------------------
22
- // ## OPTION 2: Temporary Token Authentication
23
- // ## - Use this for QuickBase code pages, leveraging the browser’s authenticated session
24
- // ## - No user token needed; requires running in a QuickBase browser context
25
- // ## - Uncomment the line below and comment out 'userToken' if using this option
26
- // useTempTokens: true,
27
- });
28
-
29
- // Fetch the app
30
- qb.getApp({ appId: "your-app-id" }) // Replace with actual app ID
31
- .then((app) => {
32
- setAppName(app.name);
33
- })
34
- .catch((err) => {
35
- console.error("Error fetching app:", err);
36
- setError("Failed to load app");
37
- });
38
- }, []); // Empty dependency array to run once on mount
39
-
40
- return (
41
- <div>
42
- <h1>Quickbase Test</h1>
43
- {error ? <p>{error}</p> : <p>App Name: {appName}</p>}
44
- </div>
45
- );
46
- };
47
-
48
- export default App;
@@ -1,47 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Quickbase Test</title>
6
- </head>
7
-
8
- <body>
9
- <div>
10
- <h1>Quickbase Test</h1>
11
- <p id="result">Loading...</p>
12
- </div>
13
- <script type="module">
14
- import { quickbase } from 'quickbase-js';
15
- // Initalize the QuickBase client
16
- const qb = quickbase({
17
- realm: 'your-realm', // Replace with actual QuickBase realm
18
- // ## ------------------------------
19
- // ## Authentication Options
20
- // ## ----------------------------
21
- // ## OPTION 1: User Token Authentication
22
- // ## - Use this if you have a QuickBase user token (get it from "My Profile" > "Manage User Tokens")
23
- // ## - Works in Node.js or browsers, ideal for standalone apps or testing outside QuickBase
24
- // ## - Uncomment the line below and replace with your token; comment out 'useTempTokens'
25
- // userToken: "your-user-token",
26
-
27
- // ## ----------------------------
28
- // ## OPTION 2: Temporary Token Authentication
29
- // ## - Use this for QuickBase code pages, leveraging the browser’s authenticated session
30
- // ## - No user token needed; requires running in a QuickBase browser context
31
- // ## - Uncomment the line below and comment out 'userToken' if using this option
32
- // useTempTokens: true,
33
- });
34
-
35
- // Fetch the app
36
- qb.getApp({ appId: 'your-app-id' }) // Replace with actual app ID
37
- .then((app) => {
38
- document.getElementById('result').textContent = `App Name: ${app.name}`;
39
- })
40
- .catch((err) => {
41
- console.error('Error fetching app:', err);
42
- document.getElementById('result').textContent = err.message || 'Failed to load app';
43
- });
44
- </script>
45
- </body>
46
-
47
- </html>
package/index.md DELETED
@@ -1,25 +0,0 @@
1
- ---
2
- # https://vitepress.dev/reference/default-theme-home-page
3
- layout: home
4
-
5
- hero:
6
- name: "Quickbase JS API Docs"
7
- text: "Documentation for quickbase-js library"
8
- tagline: My great project tagline
9
- actions:
10
- - theme: brand
11
- text: Markdown Examples
12
- link: /markdown-examples
13
- - theme: alt
14
- text: API Examples
15
- link: /api-examples
16
-
17
- features:
18
- - title: Feature A
19
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
20
- - title: Feature B
21
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
22
- - title: Feature C
23
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
24
- ---
25
-
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { promises as fs } from "fs";
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- import * as glob from "glob";
7
- import { Spec } from "./types/spec.ts";
8
- import { toCamelCase } from "./utils/naming.ts";
9
-
10
- async function fixQuickBaseSpec(): Promise<void> {
11
- const CODEGEN_DIR = path.dirname(fileURLToPath(import.meta.url));
12
- const SPECS_DIR = path.join(CODEGEN_DIR, "..", "specs");
13
- const OUTPUT_DIR = path.join(CODEGEN_DIR, "output");
14
- console.log("Finding latest QuickBase RESTful API spec...");
15
- const specFiles = glob.sync(path.join(SPECS_DIR, "QuickBase_RESTful_*.json"));
16
- console.log("Spec files:", specFiles);
17
-
18
- if (specFiles.length === 0) {
19
- throw new Error(
20
- "No QuickBase_RESTful_*.json files found in specs/ folder."
21
- );
22
- }
23
-
24
- const inputFile = specFiles.sort().pop() as string;
25
- const outputFile = path.join(OUTPUT_DIR, "quickbase-fixed.json");
26
-
27
- console.log(`Reading ${path.basename(inputFile)} from specs/...`);
28
- const specContent = await fs.readFile(inputFile, "utf8");
29
- console.log("File read successfully");
30
- const spec: Spec = JSON.parse(specContent);
31
- console.log("JSON parsed successfully");
32
-
33
- if (!spec.definitions || typeof spec.definitions !== "object") {
34
- spec.definitions = {};
35
- }
36
- console.log("Spec definitions after initialization:", spec.definitions);
37
-
38
- console.log(
39
- "Original /apps/{appId}/events 200 schema:",
40
- JSON.stringify(
41
- spec.paths["/apps/{appId}/events"]?.get?.responses?.["200"]?.schema,
42
- null,
43
- 2
44
- )
45
- );
46
-
47
- console.log("Fixing parameters...");
48
- for (const pathKey in spec.paths) {
49
- for (const method in spec.paths[pathKey]) {
50
- const operation = spec.paths[pathKey][method];
51
- if (operation.parameters) {
52
- operation.parameters = operation.parameters
53
- .filter(
54
- (param) =>
55
- !["QB-Realm-Hostname", "Authorization", "User-Agent"].includes(
56
- param.name
57
- )
58
- )
59
- .map((param) => {
60
- param.name = toCamelCase(param.name);
61
- if ("example" in param) delete param.example;
62
- if ("schema" in param && param.in !== "body") delete param.schema;
63
- if (!param.type && param.in !== "body") {
64
- param.type = param.name.includes("Id") ? "string" : "string";
65
- console.log(
66
- `Set default type 'string' for ${pathKey}(${method}).${param.name}`
67
- );
68
- }
69
- return param;
70
- });
71
- }
72
- }
73
- }
74
-
75
- console.log("Spec definitions before enhanceTags:", spec.definitions);
76
- console.log("Enhancing raw spec with tags...");
77
- const { enhanceTags } = await import("./schema/tags/index.ts");
78
- enhanceTags(spec);
79
- console.log(
80
- "After enhanceTags:",
81
- JSON.stringify(
82
- spec.paths["/apps/{appId}/events"]?.get?.responses?.["200"]?.schema,
83
- null,
84
- 2
85
- )
86
- );
87
-
88
- console.log("Enhancing raw spec with general enhancements...");
89
- const { enhanceGeneral } = await import("./schema/enhance-general.ts");
90
- enhanceGeneral(spec);
91
- console.log(
92
- "After enhanceGeneral:",
93
- JSON.stringify(
94
- spec.paths["/apps/{appId}/events"]?.get?.responses?.["200"]?.schema,
95
- null,
96
- 2
97
- )
98
- );
99
-
100
- console.log("Fixing array schemas...");
101
- const { fixArrays } = await import("./schema/fix-arrays.ts");
102
- fixArrays(spec);
103
- console.log(
104
- "After fixArrays:",
105
- JSON.stringify(
106
- spec.paths["/apps/{appId}/events"]?.get?.responses?.["200"]?.schema,
107
- null,
108
- 2
109
- )
110
- );
111
-
112
- console.log("Removing unexpected top-level attributes...");
113
- delete spec.operations;
114
- delete spec.groups;
115
- delete spec.components;
116
-
117
- console.log(`Writing fixed spec to ${path.basename(outputFile)}...`);
118
- await fs.mkdir(OUTPUT_DIR, { recursive: true });
119
- await fs.writeFile(outputFile, JSON.stringify(spec, null, 2), "utf8");
120
- console.log("Spec fixed successfully! Output written to:", outputFile);
121
- }
122
-
123
- async function main() {
124
- try {
125
- console.log("Starting...");
126
- await fixQuickBaseSpec();
127
- } catch (error) {
128
- console.error("Error:", error);
129
- process.exit(1);
130
- }
131
- }
132
-
133
- main();
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- console.log("Script started");
4
-
5
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
6
- console.log("FS modules imported");
7
-
8
- import { join, dirname } from "path";
9
- console.log("Path modules imported");
10
-
11
- import { fileURLToPath } from "url";
12
- console.log("URL module imported");
13
-
14
- import { generateJsDoc } from "./utils/generateJsDoc.ts";
15
- import {
16
- PropertyDetail,
17
- ParamDetail,
18
- JsDocOptions,
19
- mapOpenApiTypeToTs,
20
- mapRefToType,
21
- parseInterfaceProperties,
22
- parseOpenApiOperations,
23
- } from "./utils/sharedUtils.ts";
24
- import { writeFileSafe, runTask } from "./utils/common.ts";
25
-
26
- const __dirname = dirname(fileURLToPath(import.meta.url));
27
- console.log("__dirname set:", __dirname);
28
-
29
- const SPEC_FILE = join(__dirname, "output", "quickbase-fixed.json");
30
- const OUTPUT_DIR = join(__dirname, "..", "src", "generated-unified");
31
- const OUTPUT_FILE = join(OUTPUT_DIR, "QuickbaseClient.ts");
32
- const MODELS_DIR = join(__dirname, "..", "src", "generated", "models");
33
-
34
- function generateInterface(includeResponseProperties: boolean = false): void {
35
- console.log(
36
- "Generating interface with includeResponseProperties:",
37
- includeResponseProperties
38
- );
39
-
40
- console.log("Checking spec file:", SPEC_FILE);
41
- if (!existsSync(SPEC_FILE)) {
42
- console.error(
43
- `Spec file ${SPEC_FILE} not found. Run 'npm run fix-spec' first.`
44
- );
45
- process.exit(1);
46
- }
47
-
48
- console.log("Checking models directory:", MODELS_DIR);
49
- if (!existsSync(MODELS_DIR)) {
50
- console.error(
51
- `Models directory ${MODELS_DIR} not found. Run 'npm run gen:openapi' first.`
52
- );
53
- process.exit(1);
54
- }
55
-
56
- const { operations, modelImports, missingTypes } = parseOpenApiOperations(
57
- SPEC_FILE,
58
- MODELS_DIR
59
- );
60
- console.log("Operations parsed:", operations.length);
61
-
62
- const methods: string[] = operations.map((op) => {
63
- const params = op.parameters
64
- .map((p) => `${p.name}${p.required ? "" : "?"}: ${p.type}`)
65
- .join("; ");
66
- const jsDocOptions: JsDocOptions = {
67
- summary: op.summary,
68
- opId: op.name,
69
- paramDetails: op.parameters,
70
- returnType: op.returns,
71
- returnTypeDetails: includeResponseProperties
72
- ? op.returnTypeDetails || []
73
- : [],
74
- docLink: op.docLink,
75
- };
76
- const jsDoc = generateJsDoc(jsDocOptions);
77
- return `${jsDoc}\n ${op.name}: (params: { ${params} }) => Promise<${op.returns}>;`;
78
- });
79
-
80
- console.log("Writing missing types report...");
81
- writeFileSafe(
82
- join(OUTPUT_DIR, "missing-types-report.json"),
83
- JSON.stringify({ missingTypes: Array.from(missingTypes) }, null, 2)
84
- );
85
-
86
- const importStatement =
87
- modelImports.size > 0
88
- ? `import { ${Array.from(modelImports)
89
- .sort()
90
- .join(", ")} } from "../generated/models";`
91
- : "";
92
- const interfaceContent = `// Generated on ${new Date().toISOString()}\n${importStatement}\n\nexport interface QuickbaseClient {\n${methods.join(
93
- "\n"
94
- )}\n}\n`;
95
-
96
- console.log("Ensuring output directory exists and writing interface...");
97
- writeFileSafe(OUTPUT_FILE, interfaceContent);
98
- console.log("Generated:", OUTPUT_FILE);
99
- }
100
-
101
- console.log("Entering runTask block");
102
- runTask("generateInterface", () => generateInterface(true));
103
-
104
- console.log("Script completed");
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { writeFileSync, existsSync, mkdirSync } from "fs";
4
- import { join, dirname } from "path";
5
- import { fileURLToPath } from "url";
6
- import { parseOpenApiOperations } from "./utils/sharedUtils.ts";
7
- import { writeFileSafe, runTask } from "./utils/common.ts";
8
-
9
- const __dirname = dirname(fileURLToPath(import.meta.url));
10
- const SPEC_FILE = join(__dirname, "output", "quickbase-fixed.json");
11
- const MODELS_DIR = join(__dirname, "..", "src", "generated", "models");
12
- const DOCS_DATA_DIR = join(__dirname, "..", "docs-data");
13
- const DOCS_JSON_FILE = join(DOCS_DATA_DIR, "api-docs.json");
14
-
15
- function generateDocsJson(): void {
16
- console.log("Generating docs JSON...");
17
- const { operations } = parseOpenApiOperations(SPEC_FILE, MODELS_DIR);
18
- writeFileSafe(DOCS_JSON_FILE, JSON.stringify(operations, null, 2), "utf8");
19
- console.log("Generated docs JSON:", DOCS_JSON_FILE);
20
- }
21
-
22
- runTask("generateDocsJson", generateDocsJson);
23
-
24
- console.log("Script completed");