@platformatic/foundation 3.56.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
@@ -649,6 +649,16 @@ export const openTelemetryExporter = {
649
649
  path: {
650
650
  type: 'string',
651
651
  description: 'The path to write the traces to. Only for file exporter.'
652
+ },
653
+ protocol: {
654
+ type: 'string',
655
+ enum: ['http', 'grpc'],
656
+ description: 'The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.'
657
+ },
658
+ transport: {
659
+ type: 'string',
660
+ enum: ['http', 'grpc'],
661
+ description: 'Alias for protocol. Only for the otlp exporter. Defaults to http.'
652
662
  }
653
663
  }
654
664
  },
@@ -1012,7 +1022,7 @@ export const runtimeProperties = {
1012
1022
  },
1013
1023
  exitOnUnhandledErrors: {
1014
1024
  default: true,
1015
- type: 'boolean'
1025
+ anyOf: [{ type: 'boolean' }, { type: 'number' }]
1016
1026
  },
1017
1027
  gracefulShutdown: {
1018
1028
  type: 'object',
@@ -1048,6 +1058,10 @@ export const runtimeProperties = {
1048
1058
  additionalProperties: false
1049
1059
  },
1050
1060
  health,
1061
+ healthProbes: {
1062
+ anyOf: [{ type: 'boolean' }, { type: 'string' }],
1063
+ default: true
1064
+ },
1051
1065
  undici: {
1052
1066
  type: 'object',
1053
1067
  properties: {
@@ -1211,6 +1225,7 @@ export const runtimeProperties = {
1211
1225
  },
1212
1226
  hostname: { type: 'string' },
1213
1227
  endpoint: { type: 'string' },
1228
+ https: server.properties.https,
1214
1229
  auth: {
1215
1230
  type: 'object',
1216
1231
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.56.0",
3
+ "version": "3.58.0",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "homepage": "https://github.com/platformatic/platformatic#readme",
18
18
  "dependencies": {
19
- "@fastify/deepmerge": "^2.0.0",
19
+ "@fastify/deepmerge": "^3.0.0",
20
20
  "@fastify/error": "^4.0.0",
21
21
  "@iarna/toml": "^2.2.5",
22
22
  "@watchable/unpromise": "^1.0.2",
@@ -30,11 +30,11 @@
30
30
  "pino": "^9.9.0",
31
31
  "pino-pretty": "^13.0.0",
32
32
  "semver": "^7.6.3",
33
- "undici": "7.24.0",
33
+ "undici": "7.28.0",
34
34
  "yaml": "^2.4.1"
35
35
  },
36
36
  "devDependencies": {
37
- "c8": "^10.0.0",
37
+ "c8": "^11.0.0",
38
38
  "cleaner-spec-reporter": "^0.5.0",
39
39
  "eslint": "9",
40
40
  "fastify": "^5.7.0",