@quadrokit/client 0.2.0 → 0.2.1
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/dist/{cli.js → cli.mjs} +1 -1
- package/dist/generate/codegen.d.ts.map +1 -1
- package/dist/generate/{codegen.js → codegen.mjs} +7 -2
- package/dist/{index.js → index.mjs} +1 -1
- package/dist/runtime/{collection.js → collection.mjs} +2 -2
- package/dist/runtime/{data-class.js → data-class.mjs} +3 -3
- package/dist/runtime/{http.js → http.mjs} +1 -1
- package/dist/runtime/index.mjs +7 -0
- package/package.json +7 -7
- package/dist/runtime/index.js +0 -7
- /package/dist/runtime/{datastore.js → datastore.mjs} +0 -0
- /package/dist/runtime/{errors.js → errors.mjs} +0 -0
- /package/dist/runtime/{paths.js → paths.mjs} +0 -0
- /package/dist/runtime/{query.js → query.mjs} +0 -0
- /package/dist/runtime/{unwrap.js → unwrap.mjs} +0 -0
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { writeGenerated } from './generate/codegen.
|
|
4
|
+
import { writeGenerated } from './generate/codegen.mjs';
|
|
5
5
|
function parseArgs(argv) {
|
|
6
6
|
let command = '';
|
|
7
7
|
let url;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/generate/codegen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsC,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/generate/codegen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsC,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAgTxF,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBxF"}
|
|
@@ -121,10 +121,15 @@ function emitClient(catalog) {
|
|
|
121
121
|
const dbName = catalog.__NAME ?? 'default';
|
|
122
122
|
const hasAuthentify = catalog.methods?.some((m) => m.name === 'authentify' && m.applyTo === 'dataStore');
|
|
123
123
|
const keyNamesRecord = Object.fromEntries(classes.map((x) => [x.name, keyNames(x)]));
|
|
124
|
-
const imports =
|
|
124
|
+
const imports = classes.length > 0
|
|
125
|
+
? `/* eslint-disable */\n/* Auto-generated by @quadrokit/client — do not edit */\n\nimport {\n QuadroHttp,\n makeDataClassApi,\n attachRelatedApis,\n callDatastorePath,\n type CollectionHandle,\n type CollectionOptions,\n type SelectedEntity,\n} from '@quadrokit/client/runtime';\n`
|
|
126
|
+
: `/* eslint-disable */\n/* Auto-generated by @quadrokit/client — do not edit */\n\nimport { QuadroHttp, callDatastorePath } from '@quadrokit/client/runtime';\n`;
|
|
125
127
|
const typeImports = classes.map((c) => c.name).join(', ');
|
|
126
128
|
const pathImports = classes.map((c) => `${c.name}Path`).join(', ');
|
|
127
|
-
const
|
|
129
|
+
const typeImportLine = typeImports || pathImports
|
|
130
|
+
? `\nimport type { ${[typeImports, pathImports].filter(Boolean).join(', ')} } from './types.gen.mjs';\n\n`
|
|
131
|
+
: '\n';
|
|
132
|
+
const header = `${imports}${typeImportLine}`;
|
|
128
133
|
const metaExport = `
|
|
129
134
|
export const quadrokitCatalogMeta = {
|
|
130
135
|
__NAME: ${JSON.stringify(dbName)},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { buildListSearchParams } from './query.
|
|
2
|
-
import { unwrapEntityList } from './unwrap.
|
|
1
|
+
import { buildListSearchParams } from './query.mjs';
|
|
2
|
+
import { unwrapEntityList } from './unwrap.mjs';
|
|
3
3
|
function primaryKeyFromRow(row, keyNames) {
|
|
4
4
|
if (!row || typeof row !== 'object') {
|
|
5
5
|
return undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createCollection } from './collection.
|
|
2
|
-
import { buildEntityParams } from './query.
|
|
3
|
-
import { unwrapEntity, unwrapEntityList } from './unwrap.
|
|
1
|
+
import { createCollection } from './collection.mjs';
|
|
2
|
+
import { buildEntityParams } from './query.mjs';
|
|
3
|
+
import { unwrapEntity, unwrapEntityList } from './unwrap.mjs';
|
|
4
4
|
export function makeDataClassApi(cfg) {
|
|
5
5
|
const path = `/${cfg.className}`;
|
|
6
6
|
return {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createCollection, } from './collection.mjs';
|
|
2
|
+
export { attachRelatedApis, makeDataClassApi, makeRelatedCollectionApi, } from './data-class.mjs';
|
|
3
|
+
export { callDatastorePath, createDatastoreNamespace } from './datastore.mjs';
|
|
4
|
+
export { QuadroHttpError } from './errors.mjs';
|
|
5
|
+
export { normalizeBaseURL, QuadroHttp, } from './http.mjs';
|
|
6
|
+
export { buildListSearchParams } from './query.mjs';
|
|
7
|
+
export { unwrapEntity, unwrapEntityList } from './unwrap.mjs';
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadrokit/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Typed 4D REST client and catalog code generator for QuadroKit",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"quadrokit-client": "./dist/cli.
|
|
9
|
+
"quadrokit-client": "./dist/cli.mjs"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.
|
|
14
|
+
"import": "./dist/index.mjs"
|
|
15
15
|
},
|
|
16
16
|
"./runtime": {
|
|
17
17
|
"types": "./dist/runtime/index.d.ts",
|
|
18
|
-
"import": "./dist/runtime/index.
|
|
18
|
+
"import": "./dist/runtime/index.mjs"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "tsc -p tsconfig.build.json",
|
|
25
|
+
"build": "tsc -p tsconfig.build.json && bun ../../scripts/rename-dist-js-to-mjs.ts dist",
|
|
26
26
|
"prepublishOnly": "bun run build",
|
|
27
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
28
|
"generate:fixture": "bun run src/cli.ts generate --url file://../../assets/catalog.json --out ../../.quadrokit/generated-demo"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quadrokit/shared": "
|
|
31
|
+
"@quadrokit/shared": "^0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"typescript": ">=5.4"
|
package/dist/runtime/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { createCollection, } from './collection.js';
|
|
2
|
-
export { attachRelatedApis, makeDataClassApi, makeRelatedCollectionApi, } from './data-class.js';
|
|
3
|
-
export { callDatastorePath, createDatastoreNamespace } from './datastore.js';
|
|
4
|
-
export { QuadroHttpError } from './errors.js';
|
|
5
|
-
export { normalizeBaseURL, QuadroHttp, } from './http.js';
|
|
6
|
-
export { buildListSearchParams } from './query.js';
|
|
7
|
-
export { unwrapEntity, unwrapEntityList } from './unwrap.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|