Skip to content

Commit c99c47b

Browse files
authored
fix(studio): add option to skip validation for computed fields when start proxy (#2429)
1 parent 7de2af2 commit c99c47b

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

packages/cli/src/actions/proxy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export async function run(options: Options) {
6969

7070
const dialect = await createDialect(provider, databaseUrl!, outputPath);
7171

72-
const jiti = createJiti(import.meta.url);
72+
const fileUrl = typeof __filename !== 'undefined' ? __filename : import.meta.url;
73+
74+
const jiti = createJiti(fileUrl);
7375

7476
const schemaModule = (await jiti.import(path.join(outputPath, 'schema'))) as any;
7577

@@ -92,6 +94,7 @@ export async function run(options: Options) {
9294
dialect: dialect,
9395
log: log && log.length > 0 ? log : undefined,
9496
omit: Object.keys(omit).length > 0 ? omit : undefined,
97+
skipValidationForComputedFields: true,
9598
});
9699

97100
// check whether the database is reachable

packages/cli/tsup.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ export default defineConfig({
1010
clean: true,
1111
dts: true,
1212
format: ['esm', 'cjs'],
13+
esbuildOptions: (options) => {
14+
options.logOverride = {
15+
'empty-import-meta': 'silent',
16+
};
17+
},
1318
});

packages/orm/src/client/client-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class ClientImpl {
7575
...this.$options.functions,
7676
};
7777

78-
if (!baseClient) {
78+
if (!baseClient && !options.skipValidationForComputedFields) {
7979
// validate computed fields configuration once for the root client
8080
this.validateComputedFieldsConfig();
8181
}

packages/orm/src/client/options.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ export type ClientOptions<Schema extends SchemaDef> = QueryOptions<Schema> & {
203203
* Defaults to `true`.
204204
*/
205205
useCompactAliasNames?: boolean;
206+
207+
/**
208+
* Whether to skip validation for computed fields.
209+
*/
210+
skipValidationForComputedFields?: boolean;
206211
} & (HasComputedFields<Schema> extends true
207212
? {
208213
/**

0 commit comments

Comments
 (0)