zitejs 0.9.5 → 0.9.6
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/check/index.js
CHANGED
|
@@ -36,7 +36,8 @@ async function runCheck() {
|
|
|
36
36
|
for (const app of appDirs) {
|
|
37
37
|
const appPath = (0, path_1.join)('apps', app);
|
|
38
38
|
console.log(`\n── ${app} ──`);
|
|
39
|
-
const
|
|
39
|
+
const tsconfigAppPath = (0, path_1.join)(appPath, 'tsconfig.app.json');
|
|
40
|
+
const tsconfigPath = (0, fs_1.existsSync)(tsconfigAppPath) ? tsconfigAppPath : (0, path_1.join)(appPath, 'tsconfig.json');
|
|
40
41
|
if ((0, fs_1.existsSync)(tsconfigPath)) {
|
|
41
42
|
process.stdout.write(' tsc --noEmit ... ');
|
|
42
43
|
const tsc = run(`npx tsc --noEmit -p ${tsconfigPath}`, '.');
|
|
@@ -53,7 +53,7 @@ function createTableClient(integrationId, className) {
|
|
|
53
53
|
...data,
|
|
54
54
|
}),
|
|
55
55
|
delete: (recordId) => wrapSdkCall(integrationId, className, 'delete', {
|
|
56
|
-
id: recordId,
|
|
56
|
+
id: typeof recordId === 'string' ? recordId : recordId.id,
|
|
57
57
|
}),
|
|
58
58
|
bulkCreate: (records) => wrapSdkCall(integrationId, className, 'bulkCreate', {
|
|
59
59
|
records,
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -38,7 +38,13 @@ function toCamelCase(name) {
|
|
|
38
38
|
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
39
39
|
}
|
|
40
40
|
function tsTypeForField(field) {
|
|
41
|
-
|
|
41
|
+
if (FIELD_TYPE_MAP[field.type])
|
|
42
|
+
return FIELD_TYPE_MAP[field.type];
|
|
43
|
+
const lowerName = field.name?.toLowerCase() ?? '';
|
|
44
|
+
if (lowerName === 'createdat' || lowerName === 'created_at' || lowerName === 'updatedat' || lowerName === 'updated_at') {
|
|
45
|
+
return 'string';
|
|
46
|
+
}
|
|
47
|
+
return 'string';
|
|
42
48
|
}
|
|
43
49
|
function generateSchema(base) {
|
|
44
50
|
const schema = { tables: {} };
|
|
@@ -142,6 +148,13 @@ function generateApiTs(endpointFiles, flowId) {
|
|
|
142
148
|
lines.push(`export const ${name} = createCaller(${name}Endpoint, '${name}'${flowIdArg});`);
|
|
143
149
|
}
|
|
144
150
|
lines.push('');
|
|
151
|
+
// Inferred input/output types per endpoint (e.g. GetDashboardInputType, GetDashboardOutputType)
|
|
152
|
+
for (const name of endpointNames) {
|
|
153
|
+
const pascal = toPascalCase(name);
|
|
154
|
+
lines.push(`export type ${pascal}InputType = typeof ${name}Endpoint extends { inputSchema: { _output: infer T } } ? T : unknown;`);
|
|
155
|
+
lines.push(`export type ${pascal}OutputType = typeof ${name}Endpoint extends { outputSchema: { _output: infer T } } ? T : unknown;`);
|
|
156
|
+
}
|
|
157
|
+
lines.push('');
|
|
145
158
|
// Also export as a single api object
|
|
146
159
|
lines.push('export const api = {');
|
|
147
160
|
for (const name of endpointNames) {
|
package/dist/esm/check/index.js
CHANGED
|
@@ -33,7 +33,8 @@ export async function runCheck() {
|
|
|
33
33
|
for (const app of appDirs) {
|
|
34
34
|
const appPath = join('apps', app);
|
|
35
35
|
console.log(`\n── ${app} ──`);
|
|
36
|
-
const
|
|
36
|
+
const tsconfigAppPath = join(appPath, 'tsconfig.app.json');
|
|
37
|
+
const tsconfigPath = existsSync(tsconfigAppPath) ? tsconfigAppPath : join(appPath, 'tsconfig.json');
|
|
37
38
|
if (existsSync(tsconfigPath)) {
|
|
38
39
|
process.stdout.write(' tsc --noEmit ... ');
|
|
39
40
|
const tsc = run(`npx tsc --noEmit -p ${tsconfigPath}`, '.');
|
|
@@ -5,6 +5,7 @@ export interface TableClient<T> {
|
|
|
5
5
|
offset?: number;
|
|
6
6
|
sort?: unknown[];
|
|
7
7
|
filter?: unknown;
|
|
8
|
+
filters?: unknown;
|
|
8
9
|
}): Promise<{
|
|
9
10
|
records: T[];
|
|
10
11
|
total: number;
|
|
@@ -13,7 +14,9 @@ export interface TableClient<T> {
|
|
|
13
14
|
findOne(recordId: string): Promise<T>;
|
|
14
15
|
create(data: Partial<T>): Promise<T>;
|
|
15
16
|
update(recordId: string, data: Partial<T>): Promise<T>;
|
|
16
|
-
delete(recordId: string
|
|
17
|
+
delete(recordId: string | {
|
|
18
|
+
id: string;
|
|
19
|
+
}): Promise<{
|
|
17
20
|
deleted: true;
|
|
18
21
|
}>;
|
|
19
22
|
bulkCreate(records: Partial<T>[]): Promise<T[]>;
|
|
@@ -48,7 +48,7 @@ export function createTableClient(integrationId, className) {
|
|
|
48
48
|
...data,
|
|
49
49
|
}),
|
|
50
50
|
delete: (recordId) => wrapSdkCall(integrationId, className, 'delete', {
|
|
51
|
-
id: recordId,
|
|
51
|
+
id: typeof recordId === 'string' ? recordId : recordId.id,
|
|
52
52
|
}),
|
|
53
53
|
bulkCreate: (records) => wrapSdkCall(integrationId, className, 'bulkCreate', {
|
|
54
54
|
records,
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -30,7 +30,13 @@ export function toCamelCase(name) {
|
|
|
30
30
|
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
31
31
|
}
|
|
32
32
|
function tsTypeForField(field) {
|
|
33
|
-
|
|
33
|
+
if (FIELD_TYPE_MAP[field.type])
|
|
34
|
+
return FIELD_TYPE_MAP[field.type];
|
|
35
|
+
const lowerName = field.name?.toLowerCase() ?? '';
|
|
36
|
+
if (lowerName === 'createdat' || lowerName === 'created_at' || lowerName === 'updatedat' || lowerName === 'updated_at') {
|
|
37
|
+
return 'string';
|
|
38
|
+
}
|
|
39
|
+
return 'string';
|
|
34
40
|
}
|
|
35
41
|
export function generateSchema(base) {
|
|
36
42
|
const schema = { tables: {} };
|
|
@@ -134,6 +140,13 @@ export function generateApiTs(endpointFiles, flowId) {
|
|
|
134
140
|
lines.push(`export const ${name} = createCaller(${name}Endpoint, '${name}'${flowIdArg});`);
|
|
135
141
|
}
|
|
136
142
|
lines.push('');
|
|
143
|
+
// Inferred input/output types per endpoint (e.g. GetDashboardInputType, GetDashboardOutputType)
|
|
144
|
+
for (const name of endpointNames) {
|
|
145
|
+
const pascal = toPascalCase(name);
|
|
146
|
+
lines.push(`export type ${pascal}InputType = typeof ${name}Endpoint extends { inputSchema: { _output: infer T } } ? T : unknown;`);
|
|
147
|
+
lines.push(`export type ${pascal}OutputType = typeof ${name}Endpoint extends { outputSchema: { _output: infer T } } ? T : unknown;`);
|
|
148
|
+
}
|
|
149
|
+
lines.push('');
|
|
137
150
|
// Also export as a single api object
|
|
138
151
|
lines.push('export const api = {');
|
|
139
152
|
for (const name of endpointNames) {
|