(baseClient: ClientImpl | undefined, options: ClientOptions<SchemaDef>)
| 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. |
no test coverage detected