MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / validateOptions

Method validateOptions

packages/orm/src/client/client-impl.ts:145–161  ·  view source on GitHub ↗
(baseClient: ClientImpl | undefined, options: ClientOptions<SchemaDef>)

Source from the content-addressed store, hash-verified

143 }
144
145 private validateOptions(baseClient: ClientImpl | undefined, options: ClientOptions<SchemaDef>) {
146 if (!baseClient && !options.skipValidationForComputedFields) {
147 // validate computed fields configuration once for the root client
148 this.validateComputedFieldsConfig(options);
149 }
150
151 if (options.diagnostics) {
152 const diagnosticsSchema = z.object({
153 slowQueryThresholdMs: z.number().nonnegative().optional(),
154 slowQueryMaxRecords: z.int().nonnegative().or(z.literal(Infinity)).optional(),
155 });
156 const parseResult = diagnosticsSchema.safeParse(options.diagnostics);
157 if (!parseResult.success) {
158 throw createConfigError(`Invalid diagnostics configuration: ${formatError(parseResult.error)}`);
159 }
160 }
161 }
162
163 /**
164 * Validates that all computed fields in the schema have corresponding configurations.

Callers 1

constructorMethod · 0.95

Calls 3

createConfigErrorFunction · 0.90
formatErrorFunction · 0.90

Tested by

no test coverage detected