@platformatic/foundation 3.63.0 → 3.64.0
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/index.d.ts +32 -3
- package/lib/schema.js +12 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -78,7 +78,17 @@ export interface ValidationError {
|
|
|
78
78
|
export type ConfigurationOptions<T = {}> = Partial<{
|
|
79
79
|
validate: boolean
|
|
80
80
|
validationOptions: object
|
|
81
|
-
|
|
81
|
+
// Read directly off the context by every capability package (astro, basic,
|
|
82
|
+
// next, node, service, ...) to pick a development/production code path.
|
|
83
|
+
isProduction: boolean
|
|
84
|
+
// loadConfiguration() always invokes the caller-supplied transform hook
|
|
85
|
+
// with all three arguments (config, schema, options), mirroring the
|
|
86
|
+
// exported transform() function's own parameter list.
|
|
87
|
+
transform: (
|
|
88
|
+
config: Configuration<T>,
|
|
89
|
+
schema: object,
|
|
90
|
+
options: ConfigurationOptions<T>
|
|
91
|
+
) => Promise<Configuration<T>> | Configuration<T>
|
|
82
92
|
upgrade: (logger: Logger, config: RawConfiguration, version: string) => Promise<RawConfiguration> | RawConfiguration
|
|
83
93
|
env: Record<string, string>
|
|
84
94
|
ignoreProcessEnv: boolean
|
|
@@ -155,9 +165,13 @@ export declare function replaceEnv (
|
|
|
155
165
|
onMissingEnv?: (key: string) => string | undefined,
|
|
156
166
|
ignore?: string[]
|
|
157
167
|
): RawConfiguration
|
|
168
|
+
// `config` also accepts an array: the exported `applications` schema is a
|
|
169
|
+
// JSONSchemaType<object[]> (an ARRAY schema), and validate() is called with
|
|
170
|
+
// a matching array of application configs before they are handed to
|
|
171
|
+
// prepareApplication()/addApplications().
|
|
158
172
|
export declare function validate (
|
|
159
173
|
schema: JSONSchemaType<any>,
|
|
160
|
-
config: RawConfiguration,
|
|
174
|
+
config: RawConfiguration | RawConfiguration[],
|
|
161
175
|
validationOptions?: object,
|
|
162
176
|
fixPaths?: boolean,
|
|
163
177
|
root?: string
|
|
@@ -167,7 +181,22 @@ export declare function loadConfiguration (
|
|
|
167
181
|
schema?: any,
|
|
168
182
|
options?: ConfigurationOptions
|
|
169
183
|
): Promise<Configuration>
|
|
170
|
-
|
|
184
|
+
|
|
185
|
+
// The capability module object returned by loadConfigurationModule(): the
|
|
186
|
+
// object a capability exports (its shape is otherwise capability-defined,
|
|
187
|
+
// hence the index signature).
|
|
188
|
+
export interface ConfigurationModule {
|
|
189
|
+
loadConfiguration?: (configPath: string) => Promise<unknown>
|
|
190
|
+
skipTelemetryHooks?: boolean
|
|
191
|
+
createCommands?: (applicationId: string) => unknown
|
|
192
|
+
modulesToLoad?: string[]
|
|
193
|
+
[key: string]: unknown
|
|
194
|
+
}
|
|
195
|
+
export declare function loadConfigurationModule (
|
|
196
|
+
root: string,
|
|
197
|
+
config: RawConfiguration | ModuleWithVersion,
|
|
198
|
+
pkg?: string
|
|
199
|
+
): Promise<ConfigurationModule>
|
|
171
200
|
|
|
172
201
|
// Error types
|
|
173
202
|
export declare const ERROR_PREFIX: string
|
package/lib/schema.js
CHANGED
|
@@ -596,6 +596,18 @@ export const fastifyServer = {
|
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
|
+
ajv: {
|
|
600
|
+
type: 'object',
|
|
601
|
+
description:
|
|
602
|
+
'Options for the Fastify request-validation Ajv instance (the Fastify `ajv` server option). Only `customOptions` is configurable from the config file; for example set `customOptions.coerceTypes` to `false` to reject empty strings on fields that allow the `null` type instead of coercing them to `null`.',
|
|
603
|
+
properties: {
|
|
604
|
+
customOptions: {
|
|
605
|
+
type: 'object',
|
|
606
|
+
additionalProperties: true
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
additionalProperties: false
|
|
610
|
+
},
|
|
599
611
|
caseSensitive: {
|
|
600
612
|
type: 'boolean'
|
|
601
613
|
},
|