quickbase-js 1.1.0-beta.6 → 1.2.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 (111) hide show
  1. package/README.md +253 -135
  2. package/dist/esm/quickbase.d.ts +5614 -2861
  3. package/dist/esm/quickbase.js +3207 -2116
  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 +3536 -2325
  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 +49 -32
  12. package/CHANGELOG.md +0 -93
  13. package/build.js +0 -186
  14. package/dist/umd/quickbase.umd.d.ts +0 -5341
  15. package/examples/react.js +0 -48
  16. package/examples/vanillajs.html +0 -47
  17. package/examples/vanillatest.html +0 -49
  18. package/log-gen.yaml +0 -1372
  19. package/open-api/definitions/apps.ts +0 -274
  20. package/open-api/definitions/auth.ts +0 -10
  21. package/open-api/definitions/fields.ts +0 -751
  22. package/open-api/definitions/index.ts +0 -18
  23. package/open-api/definitions/records.ts +0 -269
  24. package/open-api/definitions/relationships.ts +0 -90
  25. package/open-api/definitions/reports.ts +0 -10
  26. package/open-api/definitions/tables.ts +0 -112
  27. package/open-api/fix-spec-main.ts +0 -176
  28. package/open-api/generate-unified-interface.ts +0 -170
  29. package/open-api/output/quickbase-fixed.json +0 -6760
  30. package/open-api/paths/apps.ts +0 -100
  31. package/open-api/paths/auth.ts +0 -25
  32. package/open-api/paths/fields.ts +0 -207
  33. package/open-api/paths/index.ts +0 -17
  34. package/open-api/paths/records.ts +0 -68
  35. package/open-api/paths/relationships.ts +0 -32
  36. package/open-api/paths/reports.ts +0 -34
  37. package/open-api/paths/tables.ts +0 -162
  38. package/open-api/regenerate-client.ts +0 -110
  39. package/playwright-results.txt/.last-run.json +0 -4
  40. package/playwright.config.ts +0 -37
  41. package/rollup.config.mjs +0 -114
  42. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  43. package/src/generated-unified/QuickbaseClient.ts +0 -62
  44. package/src/index.ts +0 -1
  45. package/src/quickbaseClient.ts +0 -313
  46. package/src/tokenCache.ts +0 -51
  47. package/test-artifacts/.last-run.json +0 -6
  48. package/test-esm.js +0 -1
  49. package/test-results.json +0 -2050
  50. package/test-umd.js +0 -1
  51. package/test.ts +0 -1
  52. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -189
  53. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -217
  54. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -151
  55. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -180
  56. package/tests/playwright/qb/auth/tokenPrefetch.test.ts +0 -192
  57. package/tests/playwright/qb/auth/tokenRenewal.test.ts +0 -110
  58. package/tests/playwright/qb/auth/umd.test.ts +0 -10
  59. package/tests/setup.ts +0 -51
  60. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  61. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  62. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  63. package/tests/vitest/qb/apps/getApp.test.ts +0 -40
  64. package/tests/vitest/qb/fields/createField.test.ts +0 -78
  65. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -89
  66. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  67. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -174
  68. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  69. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  70. package/tests/vitest/qb/index.ts +0 -28
  71. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  72. package/tests/vitest/qb/records/runQuery.test.ts +0 -146
  73. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  74. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  75. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  76. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  77. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  78. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  79. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  80. package/tests/vitest/unit/apps/copyApp.test.ts +0 -282
  81. package/tests/vitest/unit/apps/createApp.test.ts +0 -125
  82. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -215
  83. package/tests/vitest/unit/apps/getApp.test.ts +0 -86
  84. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -85
  85. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -95
  86. package/tests/vitest/unit/auth/retryOn401.test.ts +0 -106
  87. package/tests/vitest/unit/auth/two401s.test.ts +0 -77
  88. package/tests/vitest/unit/fields/createField.test.ts +0 -391
  89. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  90. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  91. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -147
  92. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  93. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  94. package/tests/vitest/unit/index.ts +0 -33
  95. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  96. package/tests/vitest/unit/records/runQuery.test.ts +0 -102
  97. package/tests/vitest/unit/records/upsert.test.ts +0 -218
  98. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  99. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  100. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  101. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  102. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  103. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  104. package/tests/vitest/unit/umd.test.ts +0 -8
  105. package/text.txt +0 -104
  106. package/tools/log-gen.ts +0 -175
  107. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  108. package/tsconfig.build.json +0 -17
  109. package/tsconfig.json +0 -29
  110. package/versionrc.json +0 -9
  111. package/vitest.config.ts +0 -27
package/tools/log-gen.ts DELETED
@@ -1,175 +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[] = ["node_modules", ".git", "specs"];
12
-
13
- // prettier-ignore
14
- const includeFolders: string[] = [
15
- // "open-api",
16
- // "open-api/definitions",
17
- // "open-api/paths",
18
- ];
19
-
20
- // prettier-ignore
21
- const includeRecursiveFolders: string[] = [
22
- // "tests",
23
- // "tests/vitest/unit",
24
- // "tests/vitest/qb"
25
- ];
26
-
27
- // prettier-ignore
28
- const includeFiles: string[] = [
29
- "package.json",
30
- "tsconfig.json",
31
- "tsconfig.build.json",
32
- "rollup.config.js",
33
- "vitest.config.ts",
34
- "build.js",
35
- "src/utils.ts",
36
- "src/tokenCache.ts",
37
- "src/generated-unified/QuickbaseClient.ts",
38
- "src/quickbaseClient.ts",
39
- ];
40
-
41
- const projectGoals: string[] = [
42
- "A library for interacting with the QuickBase RESTful API.",
43
- "Use OpenAPI to generate types and methods using a proxy. Validate with tests.",
44
- "Provide robust and intuitive temporary token support for browser environments.",
45
- "User Tokens support both Node.js and browser environments.",
46
- "Use case: JS frameworks like React, Vue, and Angular hosted in QuickBase code pages.",
47
- "Enable a flexible or native fetch in the browser.",
48
- "Enable a flexible fetch framework in Node.js.",
49
- "#",
50
- "No manual updating methods when the QuickBase API changes.",
51
- "The proxy magic dynamically maps generated methods and types.",
52
- "#",
53
- "TokenCache is defined per quickbaseClient call, so each instance has its own isolated TokenCache.",
54
- "Each quickbase client instance has an isolated and individual token cache.",
55
- ];
56
-
57
- const pipelineOverview: string[] = [
58
- "fix-spec-main.ts: Input: Reads the latest QuickBase_RESTful*.json file from the specs/ folder and applies fixes to the parameters and paths.",
59
- "filters out the QB-Realm-Hostname, Authorization, and User-Agent parameters.",
60
- "Converts parameter names to camelCase.",
61
- "Fixes array schemas and applies custom paths.",
62
- "Merges paths from fix-spec-paths.ts and definitions from fix-spec-definitions.ts.",
63
- "Output: writes quickbase-fixed.json to src/code-generation/output/.",
64
- "Key Behavior: The merge (spec.paths = { ...spec.paths, ...paths }) preserves all origional endpoints, only overriding those defined in fix-spec-paths.ts.",
65
- "#",
66
- "regenerate-client.ts: Uses quickbase-fixed.json to generate raw TypeScript-fetch files (src/generated/). including models and APIs.",
67
- "#",
68
- "generate-unified-interface.ts: Uses quickbase-fixed.json to generate a unified QuickbaseClient.ts interface in src/generated-unified/.",
69
- "QuickbaseClient.ts includes all endpoints from src/code-generation/output/quickbase-fixed, and types from src/generated.",
70
- "#",
71
- "/specs/QuickBase_RESTful_API_*.json is over 46k lines of JSON, so it's not included in the snapshot, its too large to give to an AI.",
72
- "which creates difficulties in understanding the structure of the API.",
73
- "It makes it difficult to model the src/code-generation/fix-spec-*.ts files in the snapshot.",
74
- "#",
75
- "vitest unit and integration tests. Integration tests use the real QuickBase API with user token auth.",
76
- "playwright is used to test the real QuickBase API in a browser enviornment with temporary token auth.",
77
- "temp tokens can only be generated in a browser enviornment and can not be fetched with a user token.",
78
- "#",
79
- "getTempTokenDBID() method is wrapped to enhance temporary token generation reuse interacting with a token cache.",
80
- "#",
81
- "npm run fix-spec: Generates quickbase-fixed.json from the latest QuickBase_RESTful*.json file.",
82
- "npm run regenerate:openapi Generates raw TypeScript-fetch files in src/generated/.",
83
- "npm run generate:unified: Generates a unified QuickbaseClient.ts interface in src/generated-unified/.",
84
- ];
85
-
86
- interface TreeNode {
87
- name: string;
88
- type: "directory" | "file";
89
- contents?: string;
90
- children?: TreeNode[];
91
- }
92
-
93
- function buildTree(dir: string): TreeNode {
94
- const node: TreeNode = {
95
- name: path.basename(dir) || "",
96
- type: "directory",
97
- children: [],
98
- };
99
-
100
- const files: fs.Dirent[] = fs.readdirSync(dir, { withFileTypes: true });
101
-
102
- files.forEach((file: fs.Dirent) => {
103
- const filePath: string = path.join(dir, file.name);
104
- const relativePath: string = path
105
- .relative(rootDir, filePath)
106
- .replace(/\\/g, "/");
107
-
108
- if (file.isDirectory() && excludeDirs.includes(file.name)) return;
109
-
110
- const childNode: TreeNode = {
111
- name: file.name,
112
- type: file.isDirectory() ? "directory" : "file",
113
- };
114
-
115
- if (file.isDirectory()) {
116
- childNode.children = buildTree(filePath).children;
117
- } else {
118
- const isInIncludeFolder = includeFolders.some((folder) => {
119
- const folderPath = folder.endsWith("/") ? folder : folder + "/";
120
- return (
121
- relativePath.startsWith(folderPath) &&
122
- relativePath.split("/").length === folderPath.split("/").length
123
- );
124
- });
125
-
126
- const isInIncludeRecursiveFolder = includeRecursiveFolders.some(
127
- (folder) =>
128
- relativePath.startsWith(folder + "/") || relativePath === folder
129
- );
130
-
131
- const shouldInclude =
132
- includeFiles.includes(relativePath) ||
133
- isInIncludeFolder ||
134
- isInIncludeRecursiveFolder;
135
-
136
- if (shouldInclude) {
137
- try {
138
- childNode.contents = fs.readFileSync(filePath, "utf8");
139
- } catch (err: unknown) {
140
- childNode.contents = `[Error reading file: ${
141
- (err as Error).message
142
- }]`;
143
- }
144
- }
145
- }
146
-
147
- node.children!.push(childNode);
148
- });
149
-
150
- return node;
151
- }
152
-
153
- function generateTreeSnapshot(): string {
154
- const snapshot = {
155
- project: "quickbase-js",
156
- date: new Date().toLocaleDateString(),
157
- root: path.resolve(rootDir),
158
- goals: projectGoals,
159
- pipelineOverview: pipelineOverview,
160
- tree: buildTree(rootDir),
161
- };
162
-
163
- return yaml.dump(snapshot, { lineWidth: -1 });
164
- }
165
-
166
- try {
167
- const output: string = generateTreeSnapshot();
168
- fs.writeFileSync("log-gen.yaml", output, "utf8");
169
- const lineCount: number = output.split("\n").length - 1;
170
- console.log("log-gen.yaml");
171
- console.log(`Lines: ${lineCount}`);
172
- } catch (error: unknown) {
173
- console.error("Failed to generate tree snapshot:", (error as Error).message);
174
- process.exit(1);
175
- }
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist/temp",
5
- "noEmit": false,
6
- "allowImportingTsExtensions": false,
7
- "declaration": false,
8
- "sourceMap": true
9
- },
10
- "include": ["dist/temp-src/**/*"],
11
- "exclude": [
12
- "node_modules",
13
- "dist",
14
- "tests/**/*",
15
- "src/**/*" // Exclude original src/ to avoid confusion
16
- ]
17
- }
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "lib": ["ES2015", "ESNext", "DOM"],
8
- "types": ["node", "playwright/test", "undici-types"],
9
- "esModuleInterop": true,
10
- "resolveJsonModule": true,
11
- "allowImportingTsExtensions": true,
12
- "noEmit": true,
13
- "outDir": "dist",
14
- "rootDir": ".",
15
- "declaration": true,
16
- "sourceMap": true,
17
- "baseUrl": ".",
18
- "paths": {
19
- "@/*": ["src/*"],
20
- "@tests/*": ["tests/*"]
21
- }
22
- },
23
- "include": ["src/**/*", "tests/**/*", "open-api/**/*", "tools/**/*"],
24
- "exclude": ["node_modules", "dist", "specs"],
25
- "ts-node": {
26
- "esm": true,
27
- "transpileOnly": true
28
- }
29
- }
package/versionrc.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "types": [
3
- { "type": "feat", "section": "Features" },
4
- { "type": "fix", "section": "Bug Fixes" },
5
- { "type": "docs", "section": "Documentation" },
6
- { "type": "chore", "section": "Maintenance" }
7
- ],
8
- "prerelease": "beta"
9
- }
package/vitest.config.ts DELETED
@@ -1,27 +0,0 @@
1
- // vitest.config.ts
2
- import { defineConfig } from "vitest/config";
3
- import path from "path";
4
- import dotenv from "dotenv"; // Add this import
5
-
6
- // Load .env variables before tests run
7
- dotenv.config({ path: path.resolve(__dirname, ".env") });
8
-
9
- export default defineConfig({
10
- test: {
11
- environment: "jsdom",
12
- include: ["tests/vitest/**/**/*.test.ts"],
13
- setupFiles: ["tests/setup.ts"], // Relative path from root
14
- pool: "forks",
15
- poolOptions: {
16
- forks: {
17
- singleFork: true, // Run tests sequentially
18
- },
19
- },
20
- },
21
- resolve: {
22
- alias: {
23
- "@": path.resolve(__dirname, "./src"), // For src/ imports
24
- "@tests": path.resolve(__dirname, "./tests"), // For tests/ imports
25
- },
26
- },
27
- });