zitejs 0.9.48 → 0.9.50
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/cjs/client/index.d.ts +6 -6
- package/dist/cjs/dev/index.js +25 -15
- package/dist/cjs/sync/lib.js +14 -10
- package/dist/cjs/types/fields.d.ts +4 -4
- package/dist/cjs/types/fields.js +1 -3
- package/dist/cjs/types/tables.d.ts +8 -8
- package/dist/esm/client/index.d.ts +6 -6
- package/dist/esm/dev/index.js +26 -16
- package/dist/esm/sync/lib.js +14 -10
- package/dist/esm/types/fields.d.ts +4 -4
- package/dist/esm/types/fields.js +1 -3
- package/dist/esm/types/tables.d.ts +8 -8
- package/package.json +1 -1
|
@@ -260,7 +260,7 @@ export declare class Zite {
|
|
|
260
260
|
type: "formula";
|
|
261
261
|
template: {
|
|
262
262
|
expression: string;
|
|
263
|
-
resultType
|
|
263
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
264
264
|
formatting?: {
|
|
265
265
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
266
266
|
currencyCode?: string | undefined;
|
|
@@ -439,7 +439,7 @@ export declare class Zite {
|
|
|
439
439
|
type: "formula";
|
|
440
440
|
template: {
|
|
441
441
|
expression: string;
|
|
442
|
-
resultType
|
|
442
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
443
443
|
formatting?: {
|
|
444
444
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
445
445
|
currencyCode?: string | undefined;
|
|
@@ -628,7 +628,7 @@ export declare class Zite {
|
|
|
628
628
|
type: "formula";
|
|
629
629
|
template: {
|
|
630
630
|
expression: string;
|
|
631
|
-
resultType
|
|
631
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
632
632
|
formatting?: {
|
|
633
633
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
634
634
|
currencyCode?: string | undefined;
|
|
@@ -820,7 +820,7 @@ export declare class Zite {
|
|
|
820
820
|
type: "formula";
|
|
821
821
|
template: {
|
|
822
822
|
expression: string;
|
|
823
|
-
resultType
|
|
823
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
824
824
|
formatting?: {
|
|
825
825
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
826
826
|
currencyCode?: string | undefined;
|
|
@@ -1020,7 +1020,7 @@ export declare class Zite {
|
|
|
1020
1020
|
type: "formula";
|
|
1021
1021
|
template: {
|
|
1022
1022
|
expression: string;
|
|
1023
|
-
resultType
|
|
1023
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
1024
1024
|
formatting?: {
|
|
1025
1025
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
1026
1026
|
currencyCode?: string | undefined;
|
|
@@ -1221,7 +1221,7 @@ export declare class Zite {
|
|
|
1221
1221
|
type: "formula";
|
|
1222
1222
|
template: {
|
|
1223
1223
|
expression: string;
|
|
1224
|
-
resultType
|
|
1224
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
1225
1225
|
formatting?: {
|
|
1226
1226
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
1227
1227
|
currencyCode?: string | undefined;
|
package/dist/cjs/dev/index.js
CHANGED
|
@@ -55,26 +55,23 @@ function regenerateAppApiTs(appDir) {
|
|
|
55
55
|
}
|
|
56
56
|
function regenerateAppAirtableSdk(appDir) {
|
|
57
57
|
const lockPath = (0, path_1.join)('apps', appDir, 'zite.lock');
|
|
58
|
+
console.log(`[airtable-sdk] Checking ${lockPath} exists: ${(0, fs_2.existsSync)(lockPath)}`);
|
|
58
59
|
if (!(0, fs_2.existsSync)(lockPath))
|
|
59
60
|
return;
|
|
60
61
|
try {
|
|
61
62
|
const lockContent = JSON.parse((0, fs_2.readFileSync)(lockPath, 'utf-8'));
|
|
62
63
|
const integrations = lockContent.integrations ?? {};
|
|
64
|
+
console.log(`[airtable-sdk] Found ${Object.keys(integrations).length} integrations in lock:`, Object.keys(integrations));
|
|
63
65
|
for (const [integrationId, integration] of Object.entries(integrations)) {
|
|
64
66
|
const int = integration;
|
|
65
|
-
if (!int.idMappings?.tables)
|
|
67
|
+
if (!int.idMappings?.tables || !Array.isArray(int.idMappings.tables)) {
|
|
68
|
+
console.log(`[airtable-sdk] Integration ${integrationId}: skipping (no tables array)`);
|
|
66
69
|
continue;
|
|
70
|
+
}
|
|
71
|
+
console.log(`[airtable-sdk] Integration ${integrationId}: ${int.idMappings.tables.length} tables`);
|
|
67
72
|
const airtableLock = {
|
|
68
73
|
integrationId,
|
|
69
|
-
tables:
|
|
70
|
-
id: tableId,
|
|
71
|
-
sdkName,
|
|
72
|
-
fields: Object.entries(int.idMappings?.fields?.[sdkName] ?? {}).map(([fieldSdkName, fieldId]) => ({
|
|
73
|
-
id: fieldId,
|
|
74
|
-
sdkName: fieldSdkName,
|
|
75
|
-
type: 'singleLineText',
|
|
76
|
-
})),
|
|
77
|
-
})),
|
|
74
|
+
tables: int.idMappings.tables,
|
|
78
75
|
};
|
|
79
76
|
const content = (0, lib_js_1.generateAirtableTs)(airtableLock);
|
|
80
77
|
if (content) {
|
|
@@ -85,17 +82,30 @@ function regenerateAppAirtableSdk(appDir) {
|
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
|
-
catch {
|
|
89
|
-
|
|
85
|
+
catch (err) {
|
|
86
|
+
console.error(`[airtable-sdk] Error processing lock for ${appDir}:`, err);
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
89
|
async function runGenerate() {
|
|
93
|
-
//
|
|
90
|
+
// Pure codegen from local files — no network calls.
|
|
91
|
+
// Reads zite.schema.json, zite.lock, zite.config.json, src/api/*.ts
|
|
92
|
+
// and generates all .zite/ files.
|
|
93
|
+
//
|
|
94
|
+
// The backend writes the schema/lock files to the sandbox before
|
|
95
|
+
// calling this. Use `zitejs sync` separately for local dev (fetches
|
|
96
|
+
// metadata from the backend API).
|
|
97
|
+
// 1. Generate root .zite/db.ts from zite.schema.json
|
|
94
98
|
try {
|
|
95
|
-
|
|
99
|
+
if ((0, fs_2.existsSync)('zite.schema.json')) {
|
|
100
|
+
const schema = JSON.parse((0, fs_2.readFileSync)('zite.schema.json', 'utf-8'));
|
|
101
|
+
const dbTs = (0, lib_js_1.generateDbTs)(schema);
|
|
102
|
+
(0, fs_2.mkdirSync)('.zite', { recursive: true });
|
|
103
|
+
(0, fs_2.writeFileSync)((0, path_1.join)('.zite', 'db.ts'), dbTs);
|
|
104
|
+
console.log('Wrote .zite/db.ts');
|
|
105
|
+
}
|
|
96
106
|
}
|
|
97
107
|
catch (err) {
|
|
98
|
-
console.warn('
|
|
108
|
+
console.warn('DB SDK generation failed:', err instanceof Error ? err.message : err);
|
|
99
109
|
}
|
|
100
110
|
// 2. Find all apps and regenerate their .zite/ files
|
|
101
111
|
const appDirs = findAppDirs();
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -359,35 +359,39 @@ function generateAuthWrapperTs() {
|
|
|
359
359
|
].join("\n");
|
|
360
360
|
}
|
|
361
361
|
const AIRTABLE_FIELD_TYPE_MAP = {
|
|
362
|
+
// Writable fields
|
|
362
363
|
singleLineText: "string",
|
|
363
364
|
multilineText: "string",
|
|
364
365
|
richText: "string",
|
|
365
366
|
email: "string",
|
|
366
367
|
url: "string",
|
|
367
368
|
phoneNumber: "string",
|
|
369
|
+
barcode: "string",
|
|
368
370
|
number: "number",
|
|
369
371
|
currency: "number",
|
|
370
372
|
percent: "number",
|
|
371
373
|
rating: "number",
|
|
372
374
|
duration: "number",
|
|
373
|
-
singleSelect: "string",
|
|
374
|
-
multipleSelects: "string[]",
|
|
375
375
|
checkbox: "boolean",
|
|
376
376
|
date: "string",
|
|
377
377
|
dateTime: "string",
|
|
378
|
-
|
|
378
|
+
singleSelect: "string",
|
|
379
|
+
multipleSelects: "string[]",
|
|
380
|
+
multipleAttachments: "Array<{ url: string; filename?: string }>",
|
|
379
381
|
multipleRecordLinks: "string | string[]",
|
|
382
|
+
singleCollaborator: "{ id: string; email: string; name?: string }",
|
|
383
|
+
multipleCollaborators: "Array<{ id: string; email: string; name?: string }>",
|
|
384
|
+
// Read-only fields
|
|
385
|
+
autoNumber: "number",
|
|
386
|
+
count: "number",
|
|
380
387
|
formula: "unknown",
|
|
381
388
|
rollup: "unknown",
|
|
382
|
-
|
|
383
|
-
count: "number",
|
|
384
|
-
autoNumber: "number",
|
|
385
|
-
barcode: "string",
|
|
386
|
-
button: "unknown",
|
|
389
|
+
multipleLookupValues: "unknown",
|
|
387
390
|
createdTime: "string",
|
|
388
391
|
lastModifiedTime: "string",
|
|
389
|
-
createdBy: "
|
|
390
|
-
lastModifiedBy: "
|
|
392
|
+
createdBy: "{ id: string; email: string; name?: string }",
|
|
393
|
+
lastModifiedBy: "{ id: string; email: string; name?: string }",
|
|
394
|
+
button: "unknown",
|
|
391
395
|
externalSyncSource: "unknown",
|
|
392
396
|
aiText: "string",
|
|
393
397
|
};
|
|
@@ -192,13 +192,13 @@ export declare const lookupTemplateSchema: z.ZodObject<{
|
|
|
192
192
|
export declare const sourceTemplateSchema: z.ZodObject<{}, z.core.$strip>;
|
|
193
193
|
export declare const formulaTemplateSchema: z.ZodObject<{
|
|
194
194
|
expression: z.ZodString;
|
|
195
|
-
resultType: z.
|
|
195
|
+
resultType: z.ZodEnum<{
|
|
196
196
|
number: "number";
|
|
197
197
|
boolean: "boolean";
|
|
198
198
|
date: "date";
|
|
199
199
|
array: "array";
|
|
200
200
|
text: "text";
|
|
201
|
-
}
|
|
201
|
+
}>;
|
|
202
202
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
203
203
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
204
204
|
number: "number";
|
|
@@ -457,13 +457,13 @@ export declare const publicFieldDefinitionSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
457
457
|
type: z.ZodLiteral<"formula">;
|
|
458
458
|
template: z.ZodObject<{
|
|
459
459
|
expression: z.ZodString;
|
|
460
|
-
resultType: z.
|
|
460
|
+
resultType: z.ZodEnum<{
|
|
461
461
|
number: "number";
|
|
462
462
|
boolean: "boolean";
|
|
463
463
|
date: "date";
|
|
464
464
|
array: "array";
|
|
465
465
|
text: "text";
|
|
466
|
-
}
|
|
466
|
+
}>;
|
|
467
467
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
468
468
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
469
469
|
number: "number";
|
package/dist/cjs/types/fields.js
CHANGED
|
@@ -167,9 +167,7 @@ const formulaFormattingSchema = zod_1.z
|
|
|
167
167
|
.optional();
|
|
168
168
|
exports.formulaTemplateSchema = zod_1.z.object({
|
|
169
169
|
expression: zod_1.z.string().min(1),
|
|
170
|
-
resultType: zod_1.z
|
|
171
|
-
.enum(["text", "number", "date", "boolean", "array"])
|
|
172
|
-
.optional(),
|
|
170
|
+
resultType: zod_1.z.enum(["text", "number", "date", "boolean", "array"]),
|
|
173
171
|
formatting: formulaFormattingSchema,
|
|
174
172
|
});
|
|
175
173
|
exports.autonumberTemplateSchema = zod_1.z.object({});
|
|
@@ -211,13 +211,13 @@ export declare const fieldSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
211
211
|
type: z.ZodLiteral<"formula">;
|
|
212
212
|
template: z.ZodObject<{
|
|
213
213
|
expression: z.ZodString;
|
|
214
|
-
resultType: z.
|
|
214
|
+
resultType: z.ZodEnum<{
|
|
215
215
|
number: "number";
|
|
216
216
|
boolean: "boolean";
|
|
217
217
|
date: "date";
|
|
218
218
|
array: "array";
|
|
219
219
|
text: "text";
|
|
220
|
-
}
|
|
220
|
+
}>;
|
|
221
221
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
222
222
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
223
223
|
number: "number";
|
|
@@ -502,13 +502,13 @@ export declare const tableSchema: z.ZodObject<{
|
|
|
502
502
|
type: z.ZodLiteral<"formula">;
|
|
503
503
|
template: z.ZodObject<{
|
|
504
504
|
expression: z.ZodString;
|
|
505
|
-
resultType: z.
|
|
505
|
+
resultType: z.ZodEnum<{
|
|
506
506
|
number: "number";
|
|
507
507
|
boolean: "boolean";
|
|
508
508
|
date: "date";
|
|
509
509
|
array: "array";
|
|
510
510
|
text: "text";
|
|
511
|
-
}
|
|
511
|
+
}>;
|
|
512
512
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
513
513
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
514
514
|
number: "number";
|
|
@@ -788,13 +788,13 @@ export declare const publicTableDefinitionSchema: z.ZodObject<{
|
|
|
788
788
|
type: z.ZodLiteral<"formula">;
|
|
789
789
|
template: z.ZodObject<{
|
|
790
790
|
expression: z.ZodString;
|
|
791
|
-
resultType: z.
|
|
791
|
+
resultType: z.ZodEnum<{
|
|
792
792
|
number: "number";
|
|
793
793
|
boolean: "boolean";
|
|
794
794
|
date: "date";
|
|
795
795
|
array: "array";
|
|
796
796
|
text: "text";
|
|
797
|
-
}
|
|
797
|
+
}>;
|
|
798
798
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
799
799
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
800
800
|
number: "number";
|
|
@@ -1076,13 +1076,13 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
1076
1076
|
type: z.ZodLiteral<"formula">;
|
|
1077
1077
|
template: z.ZodObject<{
|
|
1078
1078
|
expression: z.ZodString;
|
|
1079
|
-
resultType: z.
|
|
1079
|
+
resultType: z.ZodEnum<{
|
|
1080
1080
|
number: "number";
|
|
1081
1081
|
boolean: "boolean";
|
|
1082
1082
|
date: "date";
|
|
1083
1083
|
array: "array";
|
|
1084
1084
|
text: "text";
|
|
1085
|
-
}
|
|
1085
|
+
}>;
|
|
1086
1086
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
1087
1087
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
1088
1088
|
number: "number";
|
|
@@ -260,7 +260,7 @@ export declare class Zite {
|
|
|
260
260
|
type: "formula";
|
|
261
261
|
template: {
|
|
262
262
|
expression: string;
|
|
263
|
-
resultType
|
|
263
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
264
264
|
formatting?: {
|
|
265
265
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
266
266
|
currencyCode?: string | undefined;
|
|
@@ -439,7 +439,7 @@ export declare class Zite {
|
|
|
439
439
|
type: "formula";
|
|
440
440
|
template: {
|
|
441
441
|
expression: string;
|
|
442
|
-
resultType
|
|
442
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
443
443
|
formatting?: {
|
|
444
444
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
445
445
|
currencyCode?: string | undefined;
|
|
@@ -628,7 +628,7 @@ export declare class Zite {
|
|
|
628
628
|
type: "formula";
|
|
629
629
|
template: {
|
|
630
630
|
expression: string;
|
|
631
|
-
resultType
|
|
631
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
632
632
|
formatting?: {
|
|
633
633
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
634
634
|
currencyCode?: string | undefined;
|
|
@@ -820,7 +820,7 @@ export declare class Zite {
|
|
|
820
820
|
type: "formula";
|
|
821
821
|
template: {
|
|
822
822
|
expression: string;
|
|
823
|
-
resultType
|
|
823
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
824
824
|
formatting?: {
|
|
825
825
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
826
826
|
currencyCode?: string | undefined;
|
|
@@ -1020,7 +1020,7 @@ export declare class Zite {
|
|
|
1020
1020
|
type: "formula";
|
|
1021
1021
|
template: {
|
|
1022
1022
|
expression: string;
|
|
1023
|
-
resultType
|
|
1023
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
1024
1024
|
formatting?: {
|
|
1025
1025
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
1026
1026
|
currencyCode?: string | undefined;
|
|
@@ -1221,7 +1221,7 @@ export declare class Zite {
|
|
|
1221
1221
|
type: "formula";
|
|
1222
1222
|
template: {
|
|
1223
1223
|
expression: string;
|
|
1224
|
-
resultType
|
|
1224
|
+
resultType: "number" | "boolean" | "date" | "array" | "text";
|
|
1225
1225
|
formatting?: {
|
|
1226
1226
|
numberDisplayType?: "number" | "currency" | "duration" | "percent" | undefined;
|
|
1227
1227
|
currencyCode?: string | undefined;
|
package/dist/esm/dev/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { watch } from 'fs';
|
|
|
2
2
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { runSync } from '../sync/index.js';
|
|
5
|
-
import { generateApiTs, generateUserTs, generateAuthWrapperTs, generateBackendWrapperTs, generateAirtableTs, } from '../sync/lib.js';
|
|
5
|
+
import { generateDbTs, generateApiTs, generateUserTs, generateAuthWrapperTs, generateBackendWrapperTs, generateAirtableTs, } from '../sync/lib.js';
|
|
6
6
|
const debounceTimers = new Map();
|
|
7
7
|
function debounce(key, fn, ms) {
|
|
8
8
|
const existing = debounceTimers.get(key);
|
|
@@ -51,26 +51,23 @@ function regenerateAppApiTs(appDir) {
|
|
|
51
51
|
}
|
|
52
52
|
function regenerateAppAirtableSdk(appDir) {
|
|
53
53
|
const lockPath = join('apps', appDir, 'zite.lock');
|
|
54
|
+
console.log(`[airtable-sdk] Checking ${lockPath} exists: ${existsSync(lockPath)}`);
|
|
54
55
|
if (!existsSync(lockPath))
|
|
55
56
|
return;
|
|
56
57
|
try {
|
|
57
58
|
const lockContent = JSON.parse(readFileSync(lockPath, 'utf-8'));
|
|
58
59
|
const integrations = lockContent.integrations ?? {};
|
|
60
|
+
console.log(`[airtable-sdk] Found ${Object.keys(integrations).length} integrations in lock:`, Object.keys(integrations));
|
|
59
61
|
for (const [integrationId, integration] of Object.entries(integrations)) {
|
|
60
62
|
const int = integration;
|
|
61
|
-
if (!int.idMappings?.tables)
|
|
63
|
+
if (!int.idMappings?.tables || !Array.isArray(int.idMappings.tables)) {
|
|
64
|
+
console.log(`[airtable-sdk] Integration ${integrationId}: skipping (no tables array)`);
|
|
62
65
|
continue;
|
|
66
|
+
}
|
|
67
|
+
console.log(`[airtable-sdk] Integration ${integrationId}: ${int.idMappings.tables.length} tables`);
|
|
63
68
|
const airtableLock = {
|
|
64
69
|
integrationId,
|
|
65
|
-
tables:
|
|
66
|
-
id: tableId,
|
|
67
|
-
sdkName,
|
|
68
|
-
fields: Object.entries(int.idMappings?.fields?.[sdkName] ?? {}).map(([fieldSdkName, fieldId]) => ({
|
|
69
|
-
id: fieldId,
|
|
70
|
-
sdkName: fieldSdkName,
|
|
71
|
-
type: 'singleLineText',
|
|
72
|
-
})),
|
|
73
|
-
})),
|
|
70
|
+
tables: int.idMappings.tables,
|
|
74
71
|
};
|
|
75
72
|
const content = generateAirtableTs(airtableLock);
|
|
76
73
|
if (content) {
|
|
@@ -81,17 +78,30 @@ function regenerateAppAirtableSdk(appDir) {
|
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
|
-
catch {
|
|
85
|
-
|
|
81
|
+
catch (err) {
|
|
82
|
+
console.error(`[airtable-sdk] Error processing lock for ${appDir}:`, err);
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
export async function runGenerate() {
|
|
89
|
-
//
|
|
86
|
+
// Pure codegen from local files — no network calls.
|
|
87
|
+
// Reads zite.schema.json, zite.lock, zite.config.json, src/api/*.ts
|
|
88
|
+
// and generates all .zite/ files.
|
|
89
|
+
//
|
|
90
|
+
// The backend writes the schema/lock files to the sandbox before
|
|
91
|
+
// calling this. Use `zitejs sync` separately for local dev (fetches
|
|
92
|
+
// metadata from the backend API).
|
|
93
|
+
// 1. Generate root .zite/db.ts from zite.schema.json
|
|
90
94
|
try {
|
|
91
|
-
|
|
95
|
+
if (existsSync('zite.schema.json')) {
|
|
96
|
+
const schema = JSON.parse(readFileSync('zite.schema.json', 'utf-8'));
|
|
97
|
+
const dbTs = generateDbTs(schema);
|
|
98
|
+
mkdirSync('.zite', { recursive: true });
|
|
99
|
+
writeFileSync(join('.zite', 'db.ts'), dbTs);
|
|
100
|
+
console.log('Wrote .zite/db.ts');
|
|
101
|
+
}
|
|
92
102
|
}
|
|
93
103
|
catch (err) {
|
|
94
|
-
console.warn('
|
|
104
|
+
console.warn('DB SDK generation failed:', err instanceof Error ? err.message : err);
|
|
95
105
|
}
|
|
96
106
|
// 2. Find all apps and regenerate their .zite/ files
|
|
97
107
|
const appDirs = findAppDirs();
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -348,35 +348,39 @@ export function generateAuthWrapperTs() {
|
|
|
348
348
|
].join("\n");
|
|
349
349
|
}
|
|
350
350
|
const AIRTABLE_FIELD_TYPE_MAP = {
|
|
351
|
+
// Writable fields
|
|
351
352
|
singleLineText: "string",
|
|
352
353
|
multilineText: "string",
|
|
353
354
|
richText: "string",
|
|
354
355
|
email: "string",
|
|
355
356
|
url: "string",
|
|
356
357
|
phoneNumber: "string",
|
|
358
|
+
barcode: "string",
|
|
357
359
|
number: "number",
|
|
358
360
|
currency: "number",
|
|
359
361
|
percent: "number",
|
|
360
362
|
rating: "number",
|
|
361
363
|
duration: "number",
|
|
362
|
-
singleSelect: "string",
|
|
363
|
-
multipleSelects: "string[]",
|
|
364
364
|
checkbox: "boolean",
|
|
365
365
|
date: "string",
|
|
366
366
|
dateTime: "string",
|
|
367
|
-
|
|
367
|
+
singleSelect: "string",
|
|
368
|
+
multipleSelects: "string[]",
|
|
369
|
+
multipleAttachments: "Array<{ url: string; filename?: string }>",
|
|
368
370
|
multipleRecordLinks: "string | string[]",
|
|
371
|
+
singleCollaborator: "{ id: string; email: string; name?: string }",
|
|
372
|
+
multipleCollaborators: "Array<{ id: string; email: string; name?: string }>",
|
|
373
|
+
// Read-only fields
|
|
374
|
+
autoNumber: "number",
|
|
375
|
+
count: "number",
|
|
369
376
|
formula: "unknown",
|
|
370
377
|
rollup: "unknown",
|
|
371
|
-
|
|
372
|
-
count: "number",
|
|
373
|
-
autoNumber: "number",
|
|
374
|
-
barcode: "string",
|
|
375
|
-
button: "unknown",
|
|
378
|
+
multipleLookupValues: "unknown",
|
|
376
379
|
createdTime: "string",
|
|
377
380
|
lastModifiedTime: "string",
|
|
378
|
-
createdBy: "
|
|
379
|
-
lastModifiedBy: "
|
|
381
|
+
createdBy: "{ id: string; email: string; name?: string }",
|
|
382
|
+
lastModifiedBy: "{ id: string; email: string; name?: string }",
|
|
383
|
+
button: "unknown",
|
|
380
384
|
externalSyncSource: "unknown",
|
|
381
385
|
aiText: "string",
|
|
382
386
|
};
|
|
@@ -192,13 +192,13 @@ export declare const lookupTemplateSchema: z.ZodObject<{
|
|
|
192
192
|
export declare const sourceTemplateSchema: z.ZodObject<{}, z.core.$strip>;
|
|
193
193
|
export declare const formulaTemplateSchema: z.ZodObject<{
|
|
194
194
|
expression: z.ZodString;
|
|
195
|
-
resultType: z.
|
|
195
|
+
resultType: z.ZodEnum<{
|
|
196
196
|
number: "number";
|
|
197
197
|
boolean: "boolean";
|
|
198
198
|
date: "date";
|
|
199
199
|
array: "array";
|
|
200
200
|
text: "text";
|
|
201
|
-
}
|
|
201
|
+
}>;
|
|
202
202
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
203
203
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
204
204
|
number: "number";
|
|
@@ -457,13 +457,13 @@ export declare const publicFieldDefinitionSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
457
457
|
type: z.ZodLiteral<"formula">;
|
|
458
458
|
template: z.ZodObject<{
|
|
459
459
|
expression: z.ZodString;
|
|
460
|
-
resultType: z.
|
|
460
|
+
resultType: z.ZodEnum<{
|
|
461
461
|
number: "number";
|
|
462
462
|
boolean: "boolean";
|
|
463
463
|
date: "date";
|
|
464
464
|
array: "array";
|
|
465
465
|
text: "text";
|
|
466
|
-
}
|
|
466
|
+
}>;
|
|
467
467
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
468
468
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
469
469
|
number: "number";
|
package/dist/esm/types/fields.js
CHANGED
|
@@ -164,9 +164,7 @@ const formulaFormattingSchema = z
|
|
|
164
164
|
.optional();
|
|
165
165
|
export const formulaTemplateSchema = z.object({
|
|
166
166
|
expression: z.string().min(1),
|
|
167
|
-
resultType: z
|
|
168
|
-
.enum(["text", "number", "date", "boolean", "array"])
|
|
169
|
-
.optional(),
|
|
167
|
+
resultType: z.enum(["text", "number", "date", "boolean", "array"]),
|
|
170
168
|
formatting: formulaFormattingSchema,
|
|
171
169
|
});
|
|
172
170
|
export const autonumberTemplateSchema = z.object({});
|
|
@@ -211,13 +211,13 @@ export declare const fieldSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
211
211
|
type: z.ZodLiteral<"formula">;
|
|
212
212
|
template: z.ZodObject<{
|
|
213
213
|
expression: z.ZodString;
|
|
214
|
-
resultType: z.
|
|
214
|
+
resultType: z.ZodEnum<{
|
|
215
215
|
number: "number";
|
|
216
216
|
boolean: "boolean";
|
|
217
217
|
date: "date";
|
|
218
218
|
array: "array";
|
|
219
219
|
text: "text";
|
|
220
|
-
}
|
|
220
|
+
}>;
|
|
221
221
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
222
222
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
223
223
|
number: "number";
|
|
@@ -502,13 +502,13 @@ export declare const tableSchema: z.ZodObject<{
|
|
|
502
502
|
type: z.ZodLiteral<"formula">;
|
|
503
503
|
template: z.ZodObject<{
|
|
504
504
|
expression: z.ZodString;
|
|
505
|
-
resultType: z.
|
|
505
|
+
resultType: z.ZodEnum<{
|
|
506
506
|
number: "number";
|
|
507
507
|
boolean: "boolean";
|
|
508
508
|
date: "date";
|
|
509
509
|
array: "array";
|
|
510
510
|
text: "text";
|
|
511
|
-
}
|
|
511
|
+
}>;
|
|
512
512
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
513
513
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
514
514
|
number: "number";
|
|
@@ -788,13 +788,13 @@ export declare const publicTableDefinitionSchema: z.ZodObject<{
|
|
|
788
788
|
type: z.ZodLiteral<"formula">;
|
|
789
789
|
template: z.ZodObject<{
|
|
790
790
|
expression: z.ZodString;
|
|
791
|
-
resultType: z.
|
|
791
|
+
resultType: z.ZodEnum<{
|
|
792
792
|
number: "number";
|
|
793
793
|
boolean: "boolean";
|
|
794
794
|
date: "date";
|
|
795
795
|
array: "array";
|
|
796
796
|
text: "text";
|
|
797
|
-
}
|
|
797
|
+
}>;
|
|
798
798
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
799
799
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
800
800
|
number: "number";
|
|
@@ -1076,13 +1076,13 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
1076
1076
|
type: z.ZodLiteral<"formula">;
|
|
1077
1077
|
template: z.ZodObject<{
|
|
1078
1078
|
expression: z.ZodString;
|
|
1079
|
-
resultType: z.
|
|
1079
|
+
resultType: z.ZodEnum<{
|
|
1080
1080
|
number: "number";
|
|
1081
1081
|
boolean: "boolean";
|
|
1082
1082
|
date: "date";
|
|
1083
1083
|
array: "array";
|
|
1084
1084
|
text: "text";
|
|
1085
|
-
}
|
|
1085
|
+
}>;
|
|
1086
1086
|
formatting: z.ZodOptional<z.ZodObject<{
|
|
1087
1087
|
numberDisplayType: z.ZodOptional<z.ZodEnum<{
|
|
1088
1088
|
number: "number";
|