quickbase-js 1.1.0-beta.4 → 1.1.0-beta.5
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/CHANGELOG.md +8 -0
- package/README.md +54 -0
- package/build.js +175 -55
- package/dist/esm/quickbase.js.map +1 -0
- package/dist/esm/quickbase.min.js +2 -0
- package/dist/esm/quickbase.min.js.map +1 -0
- package/dist/umd/quickbase.umd.d.ts +5341 -0
- package/dist/umd/quickbase.umd.js +7696 -0
- package/dist/umd/quickbase.umd.js.map +1 -0
- package/dist/umd/quickbase.umd.min.js +2 -0
- package/dist/umd/quickbase.umd.min.js.map +1 -0
- package/log-gen.yaml +812 -6054
- package/{src/code-generation → open-api}/fix-spec-main.ts +1 -1
- package/{src/code-generation → open-api}/generate-unified-interface.ts +42 -17
- package/{src/code-generation → open-api}/regenerate-client.ts +4 -4
- package/package.json +25 -14
- package/rollup.config.mjs +114 -0
- package/src/generated-unified/QuickbaseClient.ts +1 -1
- package/test-artifacts/.last-run.json +4 -2
- package/test-esm.js +1 -0
- package/test-umd.js +1 -0
- package/test.ts +1 -0
- package/tests/playwright/qb/auth/umd.test.ts +10 -0
- package/tests/vitest/unit/umd.test.ts +8 -0
- package/{src → tools}/log-gen.ts +16 -14
- package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +5 -5
- package/dist/quickbase.js.map +0 -1
- package/rollup.config.js +0 -70
- /package/dist/{quickbase.d.ts → esm/quickbase.d.ts} +0 -0
- /package/dist/{quickbase.js → esm/quickbase.js} +0 -0
- /package/{src/code-generation → open-api}/definitions/apps.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/auth.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/fields.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/index.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/records.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/relationships.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/reports.ts +0 -0
- /package/{src/code-generation → open-api}/definitions/tables.ts +0 -0
- /package/{src/code-generation → open-api}/output/quickbase-fixed.json +0 -0
- /package/{src/code-generation → open-api}/paths/apps.ts +0 -0
- /package/{src/code-generation → open-api}/paths/auth.ts +0 -0
- /package/{src/code-generation → open-api}/paths/fields.ts +0 -0
- /package/{src/code-generation → open-api}/paths/index.ts +0 -0
- /package/{src/code-generation → open-api}/paths/records.ts +0 -0
- /package/{src/code-generation → open-api}/paths/relationships.ts +0 -0
- /package/{src/code-generation → open-api}/paths/reports.ts +0 -0
- /package/{src/code-generation → open-api}/paths/tables.ts +0 -0
- /package/{src/specs → specs}/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.1.0-beta.5](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.4...v1.1.0-beta.5) (2025-03-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* ESM and UMD build prod ([49513e9](https://github.com/DrewBradfordXYZ/quickbase-js/commit/49513e902e7bf4dd35da3c6508242e96507a91bd))
|
|
11
|
+
* ESM and UMD support and src folder reorganization ([dc0170b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/dc0170b547e6e9e57a117fbcccfdbeb86e48a8c7))
|
|
12
|
+
|
|
5
13
|
## [1.1.0-beta.4](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.3...v1.1.0-beta.4) (2025-03-12)
|
|
6
14
|
|
|
7
15
|
|
package/README.md
CHANGED
|
@@ -67,6 +67,60 @@ npm run build
|
|
|
67
67
|
npm run test:all
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Node.js (ESM - Recommended)
|
|
73
|
+
|
|
74
|
+
For modern Node.js applications, use ES modules:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
// ESM (Node.js) - Recommended
|
|
78
|
+
import { quickbase } from "quickbase-js";
|
|
79
|
+
const qb = quickbase({ realm: "example", userToken: "your-token" });
|
|
80
|
+
|
|
81
|
+
// Example: Fetching an app
|
|
82
|
+
const app = await qb.getApp({ appId: "your-app-id" });
|
|
83
|
+
console.log(app);
|
|
84
|
+
|
|
85
|
+
// Example: Creating a record with temporary token
|
|
86
|
+
const qbTemp = quickbase({ realm: "example", useTempTokens: true });
|
|
87
|
+
const record = await qbTemp.upsert({
|
|
88
|
+
body: {
|
|
89
|
+
to: "your-table-id",
|
|
90
|
+
data: [
|
|
91
|
+
{
|
|
92
|
+
/* record data */
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
console.log(record);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// Example: TypeScript ESM (Recommended)
|
|
102
|
+
import { quickbase } from "quickbase-js";
|
|
103
|
+
const qbTyped: QuickbaseClient = quickbase({
|
|
104
|
+
realm: "example",
|
|
105
|
+
userToken: "your-token",
|
|
106
|
+
});
|
|
107
|
+
const typedApp = await qbTyped.getApp({ appId: "your-app-id" });
|
|
108
|
+
console.log(typedApp);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
// Example: UMD via CDN (QuickBase Code Pages)
|
|
113
|
+
// Note: This is HTML, not JavaScript, and should be used in a browser environment
|
|
114
|
+
|
|
115
|
+
<script src="https://cdn.jsdelivr.net/npm/quickbase-js@1.1.0-beta.4/dist/umd/quickbase.umd.js"></script>
|
|
116
|
+
<script>
|
|
117
|
+
const qb = new QuickbaseJS({ realm: 'example', useTempTokens: true });
|
|
118
|
+
// Example: Fetching an app
|
|
119
|
+
qb.getApp({ appId: 'your-app-id' }).then(app => console.log(app));
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
|
|
70
124
|
## In QuickBase Code Pages (Browser Environment)
|
|
71
125
|
|
|
72
126
|
### useTempTokens: true:
|
package/build.js
CHANGED
|
@@ -1,66 +1,186 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { rollup } from 'rollup';
|
|
3
|
+
import terser from '@rollup/plugin-terser';
|
|
4
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
5
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
+
import dts from 'rollup-plugin-dts';
|
|
7
|
+
import { rimrafSync } from 'rimraf';
|
|
8
|
+
import { copyFileSync, readdirSync, readFileSync, writeFileSync, mkdirSync, statSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.log("Compiling TypeScript...");
|
|
11
|
-
execSync("npx tsc -b", { stdio: "inherit" });
|
|
11
|
+
// Clean the dist folder
|
|
12
|
+
rimrafSync('dist');
|
|
13
|
+
rimrafSync('dist/temp-src');
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// Step 1: Copy runtime-relevant files from src/ to dist/temp-src and remove .ts extensions
|
|
16
|
+
const srcDir = join(process.cwd(), 'src');
|
|
17
|
+
const tempSrcDir = join(process.cwd(), 'dist/temp-src');
|
|
18
|
+
const runtimeDirs = ['generated', 'generated-unified'];
|
|
19
|
+
const runtimeFiles = ['index.ts', 'quickbaseClient.ts', 'tokenCache.ts'];
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
function copyAndRewriteTsExtensions(src, dest) {
|
|
22
|
+
console.log(`Copying from ${src} to ${dest}`);
|
|
23
|
+
mkdirSync(dest, { recursive: true });
|
|
24
|
+
const files = readdirSync(src, { withFileTypes: true });
|
|
25
|
+
for (const file of files) {
|
|
26
|
+
const srcPath = join(src, file.name);
|
|
27
|
+
const destPath = join(dest, file.name);
|
|
28
|
+
if (file.isDirectory()) {
|
|
29
|
+
if (runtimeDirs.includes(file.name) || runtimeDirs.some(dir => src.includes(dir))) {
|
|
30
|
+
copyAndRewriteTsExtensions(srcPath, destPath);
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`Skipping non-runtime directory ${srcPath}`);
|
|
33
|
+
}
|
|
34
|
+
} else if (file.name.endsWith('.ts')) {
|
|
35
|
+
if (runtimeFiles.includes(file.name) || src.includes('generated') || src.includes('generated-unified')) {
|
|
36
|
+
console.log(`Processing ${srcPath} -> ${destPath}`);
|
|
37
|
+
let content = readFileSync(srcPath, 'utf8');
|
|
38
|
+
content = content.replace(/(from\s+["']\.[\w\/-]+)\.ts(["'])/g, '$1$2');
|
|
39
|
+
content = content.replace(/(export\s+\*\s+from\s+["']\.[\w\/-]+)\.ts(["'])/g, '$1$2');
|
|
40
|
+
writeFileSync(destPath, content, 'utf8');
|
|
41
|
+
} else {
|
|
42
|
+
console.log(`Skipping non-runtime file ${srcPath}`);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
console.log(`Skipping non-.ts file ${srcPath}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
copyAndRewriteTsExtensions(srcDir, tempSrcDir);
|
|
50
|
+
|
|
51
|
+
// Step 2: Compile TypeScript to JavaScript with tsc
|
|
52
|
+
console.log('Running tsc...');
|
|
53
|
+
const tsFiles = readdirSync(tempSrcDir, { recursive: true })
|
|
54
|
+
.filter(file => file.endsWith('.ts'))
|
|
55
|
+
.map(file => join(tempSrcDir, file));
|
|
56
|
+
const tscCommand = `npx tsc ${tsFiles.join(' ')} --outDir ${join(process.cwd(), 'dist/temp')} --module ESNext --target ESNext --sourceMap --moduleResolution bundler --baseUrl ${process.cwd()}`;
|
|
57
|
+
console.log(`Command: ${tscCommand}`);
|
|
58
|
+
execSync(tscCommand, { stdio: 'inherit' });
|
|
59
|
+
|
|
60
|
+
// Step 3: Rollup configuration
|
|
61
|
+
const isProd = process.env.NODE_ENV === 'production';
|
|
62
|
+
const external = [
|
|
63
|
+
'node:http', 'node:https', 'node:zlib', 'node:stream', 'node:buffer',
|
|
64
|
+
'node:util', 'node:url', 'node:net', 'node:fs', 'node:path', 'node-fetch',
|
|
65
|
+
];
|
|
66
|
+
const globals = { 'node-fetch': 'fetch' };
|
|
67
|
+
|
|
68
|
+
// Function to create Rollup bundle
|
|
69
|
+
async function createBundle(input, plugins, format, outputOptions) {
|
|
70
|
+
const bundle = await rollup({
|
|
71
|
+
input,
|
|
72
|
+
external,
|
|
73
|
+
plugins,
|
|
74
|
+
});
|
|
75
|
+
await bundle.write(outputOptions);
|
|
76
|
+
await bundle.close();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ESM Builds
|
|
80
|
+
console.log('Building ESM bundles...');
|
|
81
|
+
// Unminified ESM build (always generated)
|
|
82
|
+
await createBundle(
|
|
83
|
+
'dist/temp/quickbaseClient.js',
|
|
84
|
+
[
|
|
85
|
+
nodeResolve({ preferBuiltins: true }),
|
|
86
|
+
commonjs(),
|
|
87
|
+
],
|
|
88
|
+
'esm',
|
|
89
|
+
{
|
|
90
|
+
dir: 'dist/esm',
|
|
91
|
+
format: 'esm',
|
|
92
|
+
sourcemap: true,
|
|
93
|
+
entryFileNames: 'quickbase.js',
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Minified ESM build (only in production)
|
|
98
|
+
if (isProd) {
|
|
99
|
+
await createBundle(
|
|
100
|
+
'dist/temp/quickbaseClient.js',
|
|
101
|
+
[
|
|
102
|
+
nodeResolve({ preferBuiltins: true }),
|
|
103
|
+
commonjs(),
|
|
104
|
+
terser(),
|
|
105
|
+
],
|
|
106
|
+
'esm',
|
|
107
|
+
{
|
|
108
|
+
dir: 'dist/esm',
|
|
109
|
+
format: 'esm',
|
|
25
110
|
sourcemap: true,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
111
|
+
entryFileNames: 'quickbase.min.js',
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
29
115
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
116
|
+
// UMD Builds
|
|
117
|
+
console.log('Building UMD bundles...');
|
|
118
|
+
// Unminified UMD build (always generated)
|
|
119
|
+
await createBundle(
|
|
120
|
+
'dist/temp/quickbaseClient.js',
|
|
121
|
+
[
|
|
122
|
+
nodeResolve({ preferBuiltins: true, browser: true }),
|
|
123
|
+
commonjs(),
|
|
124
|
+
],
|
|
125
|
+
'umd',
|
|
126
|
+
{
|
|
127
|
+
file: join(process.cwd(), 'dist/umd', 'quickbase.umd.js'),
|
|
128
|
+
format: 'umd',
|
|
129
|
+
name: 'QuickbaseJS',
|
|
130
|
+
sourcemap: true,
|
|
131
|
+
globals,
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
// Minified UMD build (only in production)
|
|
136
|
+
if (isProd) {
|
|
137
|
+
await createBundle(
|
|
138
|
+
'dist/temp/quickbaseClient.js',
|
|
139
|
+
[
|
|
140
|
+
nodeResolve({ preferBuiltins: true, browser: true }),
|
|
141
|
+
commonjs(),
|
|
142
|
+
terser(),
|
|
143
|
+
],
|
|
144
|
+
'umd',
|
|
145
|
+
{
|
|
146
|
+
file: join(process.cwd(), 'dist/umd', 'quickbase.umd.min.js'),
|
|
147
|
+
format: 'umd',
|
|
148
|
+
name: 'QuickbaseJS',
|
|
149
|
+
sourcemap: true,
|
|
150
|
+
globals,
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
38
154
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
].join("\n");
|
|
155
|
+
// Declarations
|
|
156
|
+
console.log('Generating declarations...');
|
|
157
|
+
const dtsBundle = await rollup({
|
|
158
|
+
input: 'src/quickbaseClient.ts',
|
|
159
|
+
plugins: [dts({ tsconfig: './tsconfig.json', respectExternal: true })],
|
|
160
|
+
});
|
|
161
|
+
await dtsBundle.write({ file: 'dist/esm/quickbase.d.ts', format: 'esm' });
|
|
162
|
+
await dtsBundle.write({ file: 'dist/umd/quickbase.umd.d.ts', format: 'umd' });
|
|
163
|
+
await dtsBundle.close();
|
|
49
164
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"dist/quickbase-client.browser.min.js",
|
|
54
|
-
header + "\n" + browserSource
|
|
55
|
-
),
|
|
56
|
-
writeFile("dist/QuickBaseClient.js", header + "\n" + cjsSource),
|
|
57
|
-
]);
|
|
165
|
+
// Clean up
|
|
166
|
+
rimrafSync('dist/temp');
|
|
167
|
+
rimrafSync('dist/temp-src');
|
|
58
168
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
169
|
+
// List generated files and their sizes
|
|
170
|
+
console.log('\nGenerated files:');
|
|
171
|
+
function listFilesWithSizes(dir, prefix = '') {
|
|
172
|
+
const files = readdirSync(dir, { withFileTypes: true });
|
|
173
|
+
for (const file of files) {
|
|
174
|
+
const filePath = join(dir, file.name);
|
|
175
|
+
if (file.isDirectory()) {
|
|
176
|
+
listFilesWithSizes(filePath, `${prefix}${file.name}/`);
|
|
177
|
+
} else {
|
|
178
|
+
const stats = statSync(filePath);
|
|
179
|
+
const sizeKB = (stats.size / 1024).toFixed(2);
|
|
180
|
+
console.log(`${prefix}${file.name} - ${sizeKB} KB`);
|
|
181
|
+
}
|
|
63
182
|
}
|
|
64
183
|
}
|
|
184
|
+
listFilesWithSizes(join(process.cwd(), 'dist'));
|
|
65
185
|
|
|
66
|
-
|
|
186
|
+
console.log('\nBuild completed successfully');
|