@platformatic/basic 2.65.1 → 2.66.1

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/config.d.ts CHANGED
@@ -7,5 +7,317 @@
7
7
 
8
8
  export interface PlatformaticStackable {
9
9
  $schema?: string;
10
+ runtime?: {
11
+ preload?: string | string[];
12
+ basePath?: string;
13
+ workers?: number | string;
14
+ logger?: {
15
+ level: (
16
+ | ("fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent")
17
+ | {
18
+ [k: string]: unknown;
19
+ }
20
+ ) &
21
+ string;
22
+ transport?:
23
+ | {
24
+ target?: string;
25
+ options?: {
26
+ [k: string]: unknown;
27
+ };
28
+ }
29
+ | {
30
+ targets?: {
31
+ target?: string;
32
+ options?: {
33
+ [k: string]: unknown;
34
+ };
35
+ level?: string;
36
+ }[];
37
+ options?: {
38
+ [k: string]: unknown;
39
+ };
40
+ };
41
+ pipeline?: {
42
+ target?: string;
43
+ options?: {
44
+ [k: string]: unknown;
45
+ };
46
+ };
47
+ formatters?: {
48
+ path: string;
49
+ };
50
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
51
+ redact?: {
52
+ paths: string[];
53
+ censor?: string;
54
+ };
55
+ base?: {
56
+ [k: string]: unknown;
57
+ } | null;
58
+ messageKey?: string;
59
+ customLevels?: {
60
+ [k: string]: unknown;
61
+ };
62
+ [k: string]: unknown;
63
+ };
64
+ server?: {
65
+ hostname?: string;
66
+ port?: number | string;
67
+ http2?: boolean;
68
+ https?: {
69
+ allowHTTP1?: boolean;
70
+ key:
71
+ | string
72
+ | {
73
+ path?: string;
74
+ }
75
+ | (
76
+ | string
77
+ | {
78
+ path?: string;
79
+ }
80
+ )[];
81
+ cert:
82
+ | string
83
+ | {
84
+ path?: string;
85
+ }
86
+ | (
87
+ | string
88
+ | {
89
+ path?: string;
90
+ }
91
+ )[];
92
+ requestCert?: boolean;
93
+ rejectUnauthorized?: boolean;
94
+ };
95
+ };
96
+ startTimeout?: number;
97
+ restartOnError?: boolean | number;
98
+ gracefulShutdown?: {
99
+ runtime: number | string;
100
+ service: number | string;
101
+ };
102
+ health?: {
103
+ enabled?: boolean | string;
104
+ interval?: number | string;
105
+ gracePeriod?: number | string;
106
+ maxUnhealthyChecks?: number | string;
107
+ maxELU?: number | string;
108
+ maxHeapUsed?: number | string;
109
+ maxHeapTotal?: number | string;
110
+ maxYoungGeneration?: number;
111
+ };
112
+ undici?: {
113
+ agentOptions?: {
114
+ [k: string]: unknown;
115
+ };
116
+ interceptors?:
117
+ | {
118
+ module: string;
119
+ options: {
120
+ [k: string]: unknown;
121
+ };
122
+ [k: string]: unknown;
123
+ }[]
124
+ | {
125
+ Client?: {
126
+ module: string;
127
+ options: {
128
+ [k: string]: unknown;
129
+ };
130
+ [k: string]: unknown;
131
+ }[];
132
+ Pool?: {
133
+ module: string;
134
+ options: {
135
+ [k: string]: unknown;
136
+ };
137
+ [k: string]: unknown;
138
+ }[];
139
+ Agent?: {
140
+ module: string;
141
+ options: {
142
+ [k: string]: unknown;
143
+ };
144
+ [k: string]: unknown;
145
+ }[];
146
+ [k: string]: unknown;
147
+ };
148
+ [k: string]: unknown;
149
+ };
150
+ httpCache?:
151
+ | boolean
152
+ | {
153
+ store?: string;
154
+ /**
155
+ * @minItems 1
156
+ */
157
+ methods?: [string, ...string[]];
158
+ cacheTagsHeader?: string;
159
+ maxSize?: number;
160
+ maxEntrySize?: number;
161
+ maxCount?: number;
162
+ [k: string]: unknown;
163
+ };
164
+ watch?: boolean | string;
165
+ managementApi?:
166
+ | boolean
167
+ | string
168
+ | {
169
+ logs?: {
170
+ maxSize?: number;
171
+ };
172
+ };
173
+ metrics?:
174
+ | boolean
175
+ | {
176
+ port?: number | string;
177
+ enabled?: boolean | string;
178
+ hostname?: string;
179
+ endpoint?: string;
180
+ auth?: {
181
+ username: string;
182
+ password: string;
183
+ };
184
+ labels?: {
185
+ [k: string]: string;
186
+ };
187
+ readiness?:
188
+ | boolean
189
+ | {
190
+ endpoint?: string;
191
+ success?: {
192
+ statusCode?: number;
193
+ body?: string;
194
+ };
195
+ fail?: {
196
+ statusCode?: number;
197
+ body?: string;
198
+ };
199
+ };
200
+ liveness?:
201
+ | boolean
202
+ | {
203
+ endpoint?: string;
204
+ success?: {
205
+ statusCode?: number;
206
+ body?: string;
207
+ };
208
+ fail?: {
209
+ statusCode?: number;
210
+ body?: string;
211
+ };
212
+ };
213
+ additionalProperties?: never;
214
+ [k: string]: unknown;
215
+ };
216
+ telemetry?: {
217
+ enabled?: boolean | string;
218
+ /**
219
+ * The name of the service. Defaults to the folder name if not specified.
220
+ */
221
+ serviceName: string;
222
+ /**
223
+ * The version of the service (optional)
224
+ */
225
+ version?: string;
226
+ /**
227
+ * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
228
+ */
229
+ skip?: {
230
+ /**
231
+ * The path to skip. Can be a string or a regex.
232
+ */
233
+ path?: string;
234
+ /**
235
+ * HTTP method to skip
236
+ */
237
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
238
+ [k: string]: unknown;
239
+ }[];
240
+ exporter?:
241
+ | {
242
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
243
+ /**
244
+ * Options for the exporter. These are passed directly to the exporter.
245
+ */
246
+ options?: {
247
+ /**
248
+ * The URL to send the traces to. Not used for console or memory exporters.
249
+ */
250
+ url?: string;
251
+ /**
252
+ * Headers to send to the exporter. Not used for console or memory exporters.
253
+ */
254
+ headers?: {
255
+ [k: string]: unknown;
256
+ };
257
+ /**
258
+ * The path to write the traces to. Only for file exporter.
259
+ */
260
+ path?: string;
261
+ [k: string]: unknown;
262
+ };
263
+ additionalProperties?: never;
264
+ [k: string]: unknown;
265
+ }[]
266
+ | {
267
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
268
+ /**
269
+ * Options for the exporter. These are passed directly to the exporter.
270
+ */
271
+ options?: {
272
+ /**
273
+ * The URL to send the traces to. Not used for console or memory exporters.
274
+ */
275
+ url?: string;
276
+ /**
277
+ * Headers to send to the exporter. Not used for console or memory exporters.
278
+ */
279
+ headers?: {
280
+ [k: string]: unknown;
281
+ };
282
+ /**
283
+ * The path to write the traces to. Only for file exporter.
284
+ */
285
+ path?: string;
286
+ [k: string]: unknown;
287
+ };
288
+ additionalProperties?: never;
289
+ [k: string]: unknown;
290
+ };
291
+ };
292
+ inspectorOptions?: {
293
+ host?: string;
294
+ port?: number;
295
+ breakFirstLine?: boolean;
296
+ watchDisabled?: boolean;
297
+ [k: string]: unknown;
298
+ };
299
+ serviceTimeout?: number | string;
300
+ env?: {
301
+ [k: string]: string;
302
+ };
303
+ sourceMaps?: boolean;
304
+ scheduler?: {
305
+ enabled?: boolean | string;
306
+ name: string;
307
+ cron: string;
308
+ callbackUrl: string;
309
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
310
+ headers?: {
311
+ [k: string]: string;
312
+ };
313
+ body?:
314
+ | string
315
+ | {
316
+ [k: string]: unknown;
317
+ };
318
+ maxRetries?: number;
319
+ [k: string]: unknown;
320
+ }[];
321
+ };
10
322
  [k: string]: unknown;
11
323
  }
package/index.js CHANGED
@@ -95,12 +95,12 @@ export async function importStackableAndConfig (root, config) {
95
95
  } else if (dependencies?.['@remix-run/dev'] || devDependencies?.['@remix-run/dev']) {
96
96
  autodetectDescription = 'is using Remix'
97
97
  moduleName = '@platformatic/remix'
98
- } else if (dependencies?.vite || devDependencies?.vite) {
99
- autodetectDescription = 'is using Vite'
100
- moduleName = '@platformatic/vite'
101
98
  } else if (dependencies?.astro || devDependencies?.astro) {
102
99
  autodetectDescription = 'is using Astro'
103
100
  moduleName = '@platformatic/astro'
101
+ } else if (dependencies?.vite || devDependencies?.vite) {
102
+ autodetectDescription = 'is using Vite'
103
+ moduleName = '@platformatic/vite'
104
104
  }
105
105
 
106
106
  const stackable = await importStackablePackage(root, moduleName)
package/lib/schema.js CHANGED
@@ -69,7 +69,8 @@ export const schema = {
69
69
  properties: {
70
70
  $schema: {
71
71
  type: 'string'
72
- }
72
+ },
73
+ runtime: utilsSchemaComponents.wrappedRuntime
73
74
  },
74
75
  additionalProperties: true
75
76
  }
@@ -212,12 +212,15 @@ export class ChildProcess extends ITC {
212
212
  pinoOptions.timestamp = buildPinoTimestamp(loggerOptions.timestamp)
213
213
  }
214
214
 
215
- if (typeof globalThis.platformatic.workerId !== 'undefined') {
215
+ if (loggerOptions.base !== null && typeof globalThis.platformatic.workerId !== 'undefined') {
216
216
  pinoOptions.base = {
217
+ ...(pinoOptions.base ?? {}),
217
218
  pid: process.pid,
218
219
  hostname: hostname(),
219
220
  worker: parseInt(globalThis.platformatic.workerId)
220
221
  }
222
+ } else if (loggerOptions.base === null) {
223
+ pinoOptions.base = undefined
221
224
  }
222
225
 
223
226
  this.#logger = pino(pinoOptions)
@@ -226,7 +229,7 @@ export class ChildProcess extends ITC {
226
229
  #setupServer () {
227
230
  const subscribers = {
228
231
  asyncStart ({ options }) {
229
- // Unix socket, do nothing
232
+ // Unix socket, do nothing
230
233
  if (options.path) {
231
234
  return
232
235
  }
@@ -284,9 +287,9 @@ export class ChildProcess extends ITC {
284
287
 
285
288
  #setupHandlers () {
286
289
  const errorLabel =
287
- typeof globalThis.platformatic.workerId !== 'undefined'
288
- ? `worker ${globalThis.platformatic.workerId} of the service "${globalThis.platformatic.serviceId}"`
289
- : `service "${globalThis.platformatic.serviceId}"`
290
+ typeof globalThis.platformatic.workerId !== 'undefined'
291
+ ? `worker ${globalThis.platformatic.workerId} of the service "${globalThis.platformatic.serviceId}"`
292
+ : `service "${globalThis.platformatic.serviceId}"`
290
293
 
291
294
  function handleUnhandled (type, err) {
292
295
  this.#logger.error({ err: ensureLoggableError(err) }, `Child process for the ${errorLabel} threw an ${type}.`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "2.65.1",
3
+ "version": "2.66.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,11 +24,11 @@
24
24
  "split2": "^4.2.0",
25
25
  "undici": "^7.0.0",
26
26
  "ws": "^8.18.0",
27
- "@platformatic/config": "2.65.1",
28
- "@platformatic/itc": "2.65.1",
29
- "@platformatic/utils": "2.65.1",
30
- "@platformatic/telemetry": "2.65.1",
31
- "@platformatic/metrics": "2.65.1"
27
+ "@platformatic/config": "2.66.1",
28
+ "@platformatic/itc": "2.66.1",
29
+ "@platformatic/telemetry": "2.66.1",
30
+ "@platformatic/utils": "2.66.1",
31
+ "@platformatic/metrics": "2.66.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "borp": "^0.20.0",