@platformatic/foundation 3.57.0 → 3.58.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 CHANGED
@@ -230,6 +230,23 @@ export declare class FileWatcher extends EventEmitter {
230
230
  isFileIgnored (fileName: string): boolean
231
231
  }
232
232
 
233
+ // HTTPS types
234
+ export type HTTPSConfigArgument = string | { path: string } | Array<string | { path: string }>
235
+ export type SanitizedHTTPSConfigArgument = string | Buffer | Array<string | Buffer>
236
+ export interface HTTPSConfig {
237
+ key: HTTPSConfigArgument
238
+ cert: HTTPSConfigArgument
239
+ allowHTTP1?: boolean
240
+ requestCert?: boolean
241
+ rejectUnauthorized?: boolean
242
+ }
243
+ export interface SanitizedHTTPSConfig extends Omit<HTTPSConfig, 'key' | 'cert'> {
244
+ key: SanitizedHTTPSConfigArgument
245
+ cert: SanitizedHTTPSConfigArgument
246
+ }
247
+ export declare function sanitizeHTTPSArgument (arg: HTTPSConfigArgument): Promise<SanitizedHTTPSConfigArgument>
248
+ export declare function sanitizeHTTPSOptions (https?: HTTPSConfig): Promise<SanitizedHTTPSConfig | undefined>
249
+
233
250
  // Logger types
234
251
  export declare function setPinoFormatters (options: any): void
235
252
  export declare function buildPinoFormatters (formatters: { path: string }): object
package/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './lib/errors.js'
5
5
  export * as errors from './lib/errors.js'
6
6
  export * from './lib/execution.js'
7
7
  export * from './lib/file-system.js'
8
+ export * from './lib/https.js'
8
9
  export * from './lib/logger.js'
9
10
  export * from './lib/module.js'
10
11
  export * from './lib/node.js'
package/lib/https.js ADDED
@@ -0,0 +1,28 @@
1
+ import { readFile } from 'node:fs/promises'
2
+
3
+ export async function sanitizeHTTPSArgument (arg, returnPath = false) {
4
+ if (typeof arg === 'string') {
5
+ return arg
6
+ } else if (!Array.isArray(arg)) {
7
+ return returnPath ? arg.path : readFile(arg.path)
8
+ }
9
+
10
+ const sanitized = []
11
+ for (const item of arg) {
12
+ sanitized.push(await sanitizeHTTPSArgument(item, returnPath))
13
+ }
14
+
15
+ return sanitized
16
+ }
17
+
18
+ export async function sanitizeHTTPSOptions (https) {
19
+ if (!https) {
20
+ return
21
+ }
22
+
23
+ return {
24
+ ...https,
25
+ key: await sanitizeHTTPSArgument(https.key),
26
+ cert: await sanitizeHTTPSArgument(https.cert),
27
+ }
28
+ }
package/lib/schema.js CHANGED
@@ -1022,7 +1022,7 @@ export const runtimeProperties = {
1022
1022
  },
1023
1023
  exitOnUnhandledErrors: {
1024
1024
  default: true,
1025
- type: 'boolean'
1025
+ anyOf: [{ type: 'boolean' }, { type: 'number' }]
1026
1026
  },
1027
1027
  gracefulShutdown: {
1028
1028
  type: 'object',
@@ -1058,6 +1058,10 @@ export const runtimeProperties = {
1058
1058
  additionalProperties: false
1059
1059
  },
1060
1060
  health,
1061
+ healthProbes: {
1062
+ anyOf: [{ type: 'boolean' }, { type: 'string' }],
1063
+ default: true
1064
+ },
1061
1065
  undici: {
1062
1066
  type: 'object',
1063
1067
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.57.0",
3
+ "version": "3.58.0",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "pino": "^9.9.0",
31
31
  "pino-pretty": "^13.0.0",
32
32
  "semver": "^7.6.3",
33
- "undici": "7.27.2",
33
+ "undici": "7.28.0",
34
34
  "yaml": "^2.4.1"
35
35
  },
36
36
  "devDependencies": {