Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/cli/src/actions/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export async function run(options: Options) {

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

const jiti = createJiti(import.meta.url);
const fileUrl = typeof __filename !== 'undefined' ? __filename : import.meta.url;

const jiti = createJiti(fileUrl);

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

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

// check whether the database is reachable
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ export default defineConfig({
clean: true,
dts: true,
format: ['esm', 'cjs'],
esbuildOptions: (options) => {
options.logOverride = {
'empty-import-meta': 'silent',
};
},
});
2 changes: 1 addition & 1 deletion packages/orm/src/client/client-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ClientImpl {
...this.$options.functions,
};

if (!baseClient) {
if (!baseClient && !options.skipValidationForComputedFields) {
// validate computed fields configuration once for the root client
this.validateComputedFieldsConfig();
}
Expand Down
5 changes: 5 additions & 0 deletions packages/orm/src/client/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ export type ClientOptions<Schema extends SchemaDef> = QueryOptions<Schema> & {
* Defaults to `true`.
*/
useCompactAliasNames?: boolean;

/**
* Whether to skip validation for computed fields.
*/
skipValidationForComputedFields?: boolean;
} & (HasComputedFields<Schema> extends true
? {
/**
Expand Down
Loading