zitejs 0.9.25 → 0.9.26

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.
@@ -64,6 +64,11 @@ 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('// createTableClient<T> returns a typed client with:');
68
+ lines.push('// .findAll(options?) → { records: T[], total: number, hasMore: boolean }');
69
+ lines.push('// .findOne(id | filters) → T');
70
+ lines.push('// .create(data) → T | .update(id, data) → T | .delete(id) → { deleted: true }');
71
+ lines.push('// .bulkCreate(records) → T[]');
67
72
  lines.push("import { createTableClient, wrapSdkCall } from 'zitejs/runtime';");
68
73
  lines.push('');
69
74
  for (const table of base.tables ?? []) {
@@ -99,7 +104,14 @@ function generateDbDts(base, schema) {
99
104
  '// This file contains only type declarations for LLM context.',
100
105
  '// See db.ts for the full runtime.',
101
106
  '',
102
- "import type { TableClient } from 'zitejs/runtime';",
107
+ 'interface TableClient<T> {',
108
+ ' findAll(options?: { limit?: number; offset?: number; sort?: unknown[]; filter?: unknown; filters?: unknown }): Promise<{ records: T[]; total: number; hasMore: boolean }>;',
109
+ ' findOne(recordId: string | { filters?: unknown; filter?: unknown }): Promise<T>;',
110
+ ' create(data: Partial<T> | { record: Partial<T> }): Promise<T>;',
111
+ ' update(recordId: string | { id: string; record?: Partial<T> }, data?: Partial<T> | { record: Partial<T> }): Promise<T>;',
112
+ ' delete(recordId: string | { id: string }): Promise<{ deleted: true }>;',
113
+ ' bulkCreate(records: Partial<T>[]): Promise<T[]>;',
114
+ '}',
103
115
  '',
104
116
  ];
105
117
  for (const table of base.tables ?? []) {
@@ -53,6 +53,11 @@ 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('// createTableClient<T> returns a typed client with:');
57
+ lines.push('// .findAll(options?) → { records: T[], total: number, hasMore: boolean }');
58
+ lines.push('// .findOne(id | filters) → T');
59
+ lines.push('// .create(data) → T | .update(id, data) → T | .delete(id) → { deleted: true }');
60
+ lines.push('// .bulkCreate(records) → T[]');
56
61
  lines.push("import { createTableClient, wrapSdkCall } from 'zitejs/runtime';");
57
62
  lines.push('');
58
63
  for (const table of base.tables ?? []) {
@@ -88,7 +93,14 @@ export function generateDbDts(base, schema) {
88
93
  '// This file contains only type declarations for LLM context.',
89
94
  '// See db.ts for the full runtime.',
90
95
  '',
91
- "import type { TableClient } from 'zitejs/runtime';",
96
+ 'interface TableClient<T> {',
97
+ ' findAll(options?: { limit?: number; offset?: number; sort?: unknown[]; filter?: unknown; filters?: unknown }): Promise<{ records: T[]; total: number; hasMore: boolean }>;',
98
+ ' findOne(recordId: string | { filters?: unknown; filter?: unknown }): Promise<T>;',
99
+ ' create(data: Partial<T> | { record: Partial<T> }): Promise<T>;',
100
+ ' update(recordId: string | { id: string; record?: Partial<T> }, data?: Partial<T> | { record: Partial<T> }): Promise<T>;',
101
+ ' delete(recordId: string | { id: string }): Promise<{ deleted: true }>;',
102
+ ' bulkCreate(records: Partial<T>[]): Promise<T[]>;',
103
+ '}',
92
104
  '',
93
105
  ];
94
106
  for (const table of base.tables ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.25",
3
+ "version": "0.9.26",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/runtime/index.js",