quickbase-js 1.1.0-beta.6 → 1.1.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.
- package/README.md +253 -135
- package/dist/esm/quickbase.d.ts +5614 -2861
- package/dist/esm/quickbase.js +3204 -2116
- package/dist/esm/quickbase.js.map +1 -1
- package/dist/esm/quickbase.min.js +1 -1
- package/dist/esm/quickbase.min.js.map +1 -1
- package/dist/umd/quickbase.umd.js +3533 -2325
- package/dist/umd/quickbase.umd.js.map +1 -1
- package/dist/umd/quickbase.umd.min.js +1 -1
- package/dist/umd/quickbase.umd.min.js.map +1 -1
- package/package.json +49 -32
- package/CHANGELOG.md +0 -93
- package/build.js +0 -186
- package/dist/umd/quickbase.umd.d.ts +0 -5341
- package/examples/react.js +0 -48
- package/examples/vanillajs.html +0 -47
- package/examples/vanillatest.html +0 -49
- package/log-gen.yaml +0 -1372
- package/open-api/definitions/apps.ts +0 -274
- package/open-api/definitions/auth.ts +0 -10
- package/open-api/definitions/fields.ts +0 -751
- package/open-api/definitions/index.ts +0 -18
- package/open-api/definitions/records.ts +0 -269
- package/open-api/definitions/relationships.ts +0 -90
- package/open-api/definitions/reports.ts +0 -10
- package/open-api/definitions/tables.ts +0 -112
- package/open-api/fix-spec-main.ts +0 -176
- package/open-api/generate-unified-interface.ts +0 -170
- package/open-api/output/quickbase-fixed.json +0 -6760
- package/open-api/paths/apps.ts +0 -100
- package/open-api/paths/auth.ts +0 -25
- package/open-api/paths/fields.ts +0 -207
- package/open-api/paths/index.ts +0 -17
- package/open-api/paths/records.ts +0 -68
- package/open-api/paths/relationships.ts +0 -32
- package/open-api/paths/reports.ts +0 -34
- package/open-api/paths/tables.ts +0 -162
- package/open-api/regenerate-client.ts +0 -110
- package/playwright-results.txt/.last-run.json +0 -4
- package/playwright.config.ts +0 -37
- package/rollup.config.mjs +0 -114
- package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
- package/src/generated-unified/QuickbaseClient.ts +0 -62
- package/src/index.ts +0 -1
- package/src/quickbaseClient.ts +0 -313
- package/src/tokenCache.ts +0 -51
- package/test-artifacts/.last-run.json +0 -6
- package/test-esm.js +0 -1
- package/test-results.json +0 -2050
- package/test-umd.js +0 -1
- package/test.ts +0 -1
- package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -189
- package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -217
- package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -151
- package/tests/playwright/qb/auth/getTempToken.test.ts +0 -180
- package/tests/playwright/qb/auth/tokenPrefetch.test.ts +0 -192
- package/tests/playwright/qb/auth/tokenRenewal.test.ts +0 -110
- package/tests/playwright/qb/auth/umd.test.ts +0 -10
- package/tests/setup.ts +0 -51
- package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
- package/tests/vitest/qb/apps/createApp.test.ts +0 -64
- package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
- package/tests/vitest/qb/apps/getApp.test.ts +0 -40
- package/tests/vitest/qb/fields/createField.test.ts +0 -78
- package/tests/vitest/qb/fields/deleteFields.test.ts +0 -89
- package/tests/vitest/qb/fields/getField.test.ts +0 -85
- package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -174
- package/tests/vitest/qb/fields/getFields.test.ts +0 -232
- package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
- package/tests/vitest/qb/index.ts +0 -28
- package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
- package/tests/vitest/qb/records/runQuery.test.ts +0 -146
- package/tests/vitest/qb/records/upsert.test.ts +0 -102
- package/tests/vitest/qb/tables/createTable.test.ts +0 -55
- package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
- package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
- package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
- package/tests/vitest/qb/tables/getTable.test.ts +0 -26
- package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
- package/tests/vitest/unit/apps/copyApp.test.ts +0 -282
- package/tests/vitest/unit/apps/createApp.test.ts +0 -125
- package/tests/vitest/unit/apps/deleteApp.test.ts +0 -215
- package/tests/vitest/unit/apps/getApp.test.ts +0 -86
- package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -85
- package/tests/vitest/unit/auth/getTempToken.test.ts +0 -95
- package/tests/vitest/unit/auth/retryOn401.test.ts +0 -106
- package/tests/vitest/unit/auth/two401s.test.ts +0 -77
- package/tests/vitest/unit/fields/createField.test.ts +0 -391
- package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
- package/tests/vitest/unit/fields/getField.test.ts +0 -189
- package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -147
- package/tests/vitest/unit/fields/getFields.test.ts +0 -122
- package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
- package/tests/vitest/unit/index.ts +0 -33
- package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
- package/tests/vitest/unit/records/runQuery.test.ts +0 -102
- package/tests/vitest/unit/records/upsert.test.ts +0 -218
- package/tests/vitest/unit/tables/createTable.test.ts +0 -70
- package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
- package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
- package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
- package/tests/vitest/unit/tables/getTable.test.ts +0 -233
- package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
- package/tests/vitest/unit/umd.test.ts +0 -8
- package/text.txt +0 -104
- package/tools/log-gen.ts +0 -175
- package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
- package/tsconfig.build.json +0 -17
- package/tsconfig.json +0 -29
- package/versionrc.json +0 -9
- 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
|
-
}
|
|
Binary file
|
package/tsconfig.build.json
DELETED
|
@@ -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
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
|
-
});
|