@quadrokit/client 0.2.0 → 0.2.2

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.
@@ -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.js';
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;AAySxF,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBxF"}
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 = `/* 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`;
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 header = `${imports}\nimport type { ${typeImports}, ${pathImports} } from './types.gen.js';\n\n`;
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)},
@@ -2,4 +2,4 @@
2
2
  * Runtime and types for QuadroKit 4D REST clients.
3
3
  * Generated `createClient` lives in `.quadrokit/generated/client.gen.ts` after `generate`.
4
4
  */
5
- export * from './runtime/index.js';
5
+ export * from './runtime/index.mjs';
@@ -1,5 +1,5 @@
1
- import { buildListSearchParams } from './query.js';
2
- import { unwrapEntityList } from './unwrap.js';
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.js';
2
- import { buildEntityParams } from './query.js';
3
- import { unwrapEntity, unwrapEntityList } from './unwrap.js';
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 {
@@ -1,4 +1,4 @@
1
- import { QuadroHttpError } from './errors.js';
1
+ import { QuadroHttpError } from './errors.mjs';
2
2
  export function normalizeBaseURL(baseURL) {
3
3
  return baseURL.replace(/\/$/, '');
4
4
  }
@@ -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.0",
3
+ "version": "0.2.2",
4
4
  "description": "Typed 4D REST client and catalog code generator for QuadroKit",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
6
+ "main": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "quadrokit-client": "./dist/cli.js"
9
+ "quadrokit-client": "./dist/cli.mjs"
10
10
  },
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js"
14
+ "import": "./dist/index.mjs"
15
15
  },
16
16
  "./runtime": {
17
17
  "types": "./dist/runtime/index.d.ts",
18
- "import": "./dist/runtime/index.js"
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": "workspace:*"
31
+ "@quadrokit/shared": "^0.2.2"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "typescript": ">=5.4"
@@ -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