zitejs 0.9.28 → 0.9.30

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.
@@ -50,12 +50,10 @@ async function runSync() {
50
50
  (0, fs_1.writeFileSync)('zite.schema.json', JSON.stringify(schema, null, 2));
51
51
  console.log('Wrote zite.schema.json');
52
52
  const dbTs = (0, lib_js_1.generateDbTs)(base, schema);
53
- const dbDts = (0, lib_js_1.generateDbDts)(base, schema);
54
53
  const dotZite = '.zite';
55
54
  (0, fs_1.mkdirSync)(dotZite, { recursive: true });
56
55
  (0, fs_1.writeFileSync)((0, path_1.join)(dotZite, 'db.ts'), dbTs);
57
- (0, fs_1.writeFileSync)((0, path_1.join)(dotZite, 'db.d.ts'), dbDts);
58
- console.log('Wrote .zite/db.ts + .zite/db.d.ts');
56
+ console.log('Wrote .zite/db.ts');
59
57
  regenerateApiTs();
60
58
  console.log('Done!');
61
59
  }
@@ -64,10 +64,23 @@ function generateSchema(base) {
64
64
  function generateDbTs(base, schema, integrationId = 'databases') {
65
65
  const lines = [];
66
66
  lines.push('// Auto-generated by zitejs sync. Do not edit manually.');
67
- lines.push('// Table methods: .findAll(opts?) → { records: T[], total, hasMore }');
68
- lines.push('// .findOne(id) → T | .create(data) → T | .update(id, data) → T');
69
- lines.push('// .delete(id) → { deleted: true } | .bulkCreate(records) → T[]');
70
- lines.push('// Raw SQL: zite.sql({ query: "SELECT..." }) → { rows: Record<string, unknown>[] }');
67
+ lines.push('//');
68
+ lines.push('// Usage in endpoint files (src/api/*.ts):');
69
+ lines.push('// import { zite } from "zitejs/db";');
70
+ lines.push('//');
71
+ lines.push('// Always use "zitejs/db" — never use relative paths like "../../.zite/db".');
72
+ lines.push('// The tsconfig aliases resolve zitejs/* imports to the correct .zite/ files.');
73
+ lines.push('//');
74
+ lines.push('// Table client methods:');
75
+ lines.push('// .findAll(opts?) → { records: T[], total: number, hasMore: boolean }');
76
+ lines.push('// .findOne(id) → T');
77
+ lines.push('// .create(data) → T');
78
+ lines.push('// .update(id, data) → T');
79
+ lines.push('// .delete(id) → { deleted: true }');
80
+ lines.push('// .bulkCreate(records) → T[]');
81
+ lines.push('//');
82
+ lines.push('// Raw SQL:');
83
+ lines.push('// zite.sql({ query: "SELECT..." }) → { rows: Record<string, unknown>[] }');
71
84
  lines.push("import { createTableClient, createSqlClient } from 'zitejs/runtime';");
72
85
  lines.push('');
73
86
  for (const table of base.tables ?? []) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, } from 'fs';
3
3
  import { join } from 'path';
4
- import { generateSchema, generateDbTs, generateDbDts, generateApiTs, } from './lib.js';
4
+ import { generateSchema, generateDbTs, generateApiTs, } from './lib.js';
5
5
  const DB_ENVIRONMENTS = {
6
6
  production: 'https://tables.fillout.com/api/v1',
7
7
  staging: 'https://tables.filloutstaging.com/api/v1',
@@ -46,12 +46,10 @@ export async function runSync() {
46
46
  writeFileSync('zite.schema.json', JSON.stringify(schema, null, 2));
47
47
  console.log('Wrote zite.schema.json');
48
48
  const dbTs = generateDbTs(base, schema);
49
- const dbDts = generateDbDts(base, schema);
50
49
  const dotZite = '.zite';
51
50
  mkdirSync(dotZite, { recursive: true });
52
51
  writeFileSync(join(dotZite, 'db.ts'), dbTs);
53
- writeFileSync(join(dotZite, 'db.d.ts'), dbDts);
54
- console.log('Wrote .zite/db.ts + .zite/db.d.ts');
52
+ console.log('Wrote .zite/db.ts');
55
53
  regenerateApiTs();
56
54
  console.log('Done!');
57
55
  }
@@ -53,10 +53,23 @@ export function generateSchema(base) {
53
53
  export function generateDbTs(base, schema, integrationId = 'databases') {
54
54
  const lines = [];
55
55
  lines.push('// Auto-generated by zitejs sync. Do not edit manually.');
56
- lines.push('// Table methods: .findAll(opts?) → { records: T[], total, hasMore }');
57
- lines.push('// .findOne(id) → T | .create(data) → T | .update(id, data) → T');
58
- lines.push('// .delete(id) → { deleted: true } | .bulkCreate(records) → T[]');
59
- lines.push('// Raw SQL: zite.sql({ query: "SELECT..." }) → { rows: Record<string, unknown>[] }');
56
+ lines.push('//');
57
+ lines.push('// Usage in endpoint files (src/api/*.ts):');
58
+ lines.push('// import { zite } from "zitejs/db";');
59
+ lines.push('//');
60
+ lines.push('// Always use "zitejs/db" — never use relative paths like "../../.zite/db".');
61
+ lines.push('// The tsconfig aliases resolve zitejs/* imports to the correct .zite/ files.');
62
+ lines.push('//');
63
+ lines.push('// Table client methods:');
64
+ lines.push('// .findAll(opts?) → { records: T[], total: number, hasMore: boolean }');
65
+ lines.push('// .findOne(id) → T');
66
+ lines.push('// .create(data) → T');
67
+ lines.push('// .update(id, data) → T');
68
+ lines.push('// .delete(id) → { deleted: true }');
69
+ lines.push('// .bulkCreate(records) → T[]');
70
+ lines.push('//');
71
+ lines.push('// Raw SQL:');
72
+ lines.push('// zite.sql({ query: "SELECT..." }) → { rows: Record<string, unknown>[] }');
60
73
  lines.push("import { createTableClient, createSqlClient } from 'zitejs/runtime';");
61
74
  lines.push('');
62
75
  for (const table of base.tables ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.28",
3
+ "version": "0.9.30",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/runtime/index.js",