@platformatic/runtime 2.0.0-alpha.1 → 2.0.0-alpha.3

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.
Files changed (170) hide show
  1. package/config.d.ts +285 -0
  2. package/eslint.config.js +8 -0
  3. package/fixtures/botched-start/platformatic.runtime.json +1 -1
  4. package/fixtures/botched-start/services/a/platformatic.service.json +1 -1
  5. package/fixtures/composerApp/platformatic.composer.json +1 -1
  6. package/fixtures/configs/invalid-autoload-with-services.json +1 -1
  7. package/fixtures/configs/invalid-entrypoint.json +1 -1
  8. package/fixtures/configs/invalid-schema-type.config.json +1 -1
  9. package/fixtures/configs/missing-property.config.json +1 -1
  10. package/fixtures/configs/missing-service-config.json +1 -1
  11. package/fixtures/configs/monorepo-composer-no-autoload.json +2 -2
  12. package/fixtures/configs/monorepo-composer.json +2 -2
  13. package/fixtures/configs/monorepo-create-cycle.json +2 -2
  14. package/fixtures/configs/monorepo-missing-dependencies.json +2 -2
  15. package/fixtures/configs/monorepo-no-cycles.json +2 -2
  16. package/fixtures/configs/monorepo-openapi.json +2 -2
  17. package/fixtures/configs/{monorepo-hotreload-env.json → monorepo-watch-env.json} +2 -2
  18. package/fixtures/configs/monorepo-watch-single.json +12 -0
  19. package/fixtures/configs/monorepo-watch.json +26 -9
  20. package/fixtures/configs/monorepo-with-dependencies.json +2 -2
  21. package/fixtures/configs/monorepo-with-management-api-without-metrics.json +21 -0
  22. package/fixtures/configs/monorepo-with-management-api.json +2 -2
  23. package/fixtures/configs/{monorepo-hotreload.json → monorepo-with-metrics.json} +5 -4
  24. package/fixtures/configs/monorepo.json +2 -2
  25. package/fixtures/configs/no-services.config.json +1 -1
  26. package/fixtures/configs/no-sources.config.json +1 -1
  27. package/fixtures/configs/service-throws-on-start.json +1 -1
  28. package/fixtures/configs/service-with-env-port.json +2 -2
  29. package/fixtures/configs/service-with-stdio.json +12 -0
  30. package/fixtures/configs/{hotreload.json → watch.json} +2 -2
  31. package/fixtures/dbApp/platformatic.db.json +1 -1
  32. package/fixtures/dbAppNoName/platformatic.db.json +1 -1
  33. package/fixtures/dbAppNoPackageJson/platformatic.db.json +1 -1
  34. package/fixtures/dbAppWithMigrationError/platformatic.db.json +1 -1
  35. package/fixtures/do-not-reload-dependencies/platformatic.service.json +1 -1
  36. package/fixtures/do-not-restart-on-crash/platformatic.runtime.json +3 -2
  37. package/fixtures/do-not-restart-on-crash/services/a/platformatic.service.json +1 -1
  38. package/fixtures/express/platformatic.runtime.json +1 -1
  39. package/fixtures/express/services/a/platformatic.service.json +1 -1
  40. package/fixtures/express/services/b/platformatic.service.json +1 -1
  41. package/fixtures/external-client/platformatic.service.json +1 -1
  42. package/fixtures/interceptors/idp.js +2 -2
  43. package/fixtures/interceptors/platformatic.runtime.json +1 -1
  44. package/fixtures/interceptors/services/a/platformatic.service.json +1 -1
  45. package/fixtures/interceptors-2/platformatic.runtime.json +1 -1
  46. package/fixtures/interceptors-2/services/a/platformatic.service.json +1 -1
  47. package/fixtures/leven/platformatic.runtime.json +2 -2
  48. package/fixtures/leven/services/deeply-spittle/platformatic.service.json +1 -1
  49. package/fixtures/leven/services/rainy-empire/platformatic.composer.json +1 -1
  50. package/fixtures/management-api/platformatic.json +3 -3
  51. package/fixtures/management-api/services/service-1/platformatic.json +1 -1
  52. package/fixtures/management-api/services/service-1/plugin.js +4 -3
  53. package/fixtures/management-api/services/service-2/platformatic.json +1 -1
  54. package/fixtures/management-api/services/service-db/platformatic.db.json +1 -1
  55. package/fixtures/management-api-custom-labels/platformatic.json +2 -2
  56. package/fixtures/management-api-custom-labels/services/service-1/platformatic.json +1 -1
  57. package/fixtures/management-api-custom-labels/services/service-1/plugin.js +4 -3
  58. package/fixtures/management-api-custom-labels/services/service-2/platformatic.json +1 -1
  59. package/fixtures/management-api-custom-labels/services/service-db/platformatic.db.json +1 -1
  60. package/fixtures/management-api-without-metrics/platformatic.json +3 -2
  61. package/fixtures/management-api-without-metrics/services/service-1/platformatic.json +1 -1
  62. package/fixtures/monorepo/composerApp/platformatic.composer.json +1 -1
  63. package/fixtures/monorepo/dbApp/platformatic.db.json +1 -1
  64. package/fixtures/monorepo/serviceApp/platformatic.service.json +3 -2
  65. package/fixtures/monorepo/serviceApp/with-logger/with-logger.cjs +2 -2
  66. package/fixtures/monorepo/serviceApp/with-logger/with-logger.d.ts +7 -7
  67. package/fixtures/monorepo/serviceAppWithLogger/platformatic.service.json +1 -1
  68. package/fixtures/monorepo/serviceAppWithLogger/plugin.js +12 -0
  69. package/fixtures/monorepo/serviceAppWithMultiplePlugins/platformatic.service.json +3 -2
  70. package/fixtures/monorepo-missing-dependencies/composer/platformatic.json +1 -1
  71. package/fixtures/monorepo-openapi/serviceAppWithoutOpenapi/platformatic.service.json +1 -1
  72. package/fixtures/monorepo-watch/service1/platformatic.service.json +1 -1
  73. package/fixtures/monorepo-with-dependencies/main/platformatic.json +1 -1
  74. package/fixtures/monorepo-with-dependencies/service-1/platformatic.json +1 -1
  75. package/fixtures/monorepo-with-dependencies/service-2/platformatic.json +1 -1
  76. package/fixtures/no-env.service.json +1 -1
  77. package/fixtures/preload/platformatic.runtime.json +1 -1
  78. package/fixtures/preload/services/a/platformatic.service.json +1 -1
  79. package/fixtures/prom-server/platformatic.json +2 -2
  80. package/fixtures/prom-server/services/service-1/platformatic.json +1 -1
  81. package/fixtures/prom-server/services/service-2/platformatic.json +1 -1
  82. package/fixtures/restart-on-crash/platformatic.runtime.json +1 -1
  83. package/fixtures/restart-on-crash/services/a/platformatic.service.json +1 -1
  84. package/fixtures/sample-runtime/package.json +1 -1
  85. package/fixtures/sample-runtime/platformatic.json +2 -2
  86. package/fixtures/sample-runtime/services/rival/package.json +1 -1
  87. package/fixtures/sample-runtime/services/rival/platformatic.json +1 -1
  88. package/fixtures/sample-runtime-with-2-services/package.json +1 -1
  89. package/fixtures/sample-runtime-with-2-services/platformatic.json +2 -2
  90. package/fixtures/sample-runtime-with-2-services/services/foobar/package.json +1 -1
  91. package/fixtures/sample-runtime-with-2-services/services/foobar/platformatic.json +1 -1
  92. package/fixtures/sample-runtime-with-2-services/services/rival/package.json +1 -1
  93. package/fixtures/sample-runtime-with-2-services/services/rival/platformatic.json +1 -1
  94. package/fixtures/server/logger-transport/platformatic.runtime.json +2 -2
  95. package/fixtures/server/logger-transport/services/echo/platformatic.service.json +1 -1
  96. package/fixtures/server/overrides-service/platformatic.runtime.json +2 -2
  97. package/fixtures/server/overrides-service/services/echo/platformatic.service.json +1 -1
  98. package/fixtures/server/runtime-server/platformatic.runtime.json +2 -2
  99. package/fixtures/server/runtime-server/services/echo/platformatic.service.json +1 -1
  100. package/fixtures/serviceAppThrowsOnStart/platformatic.service.json +1 -1
  101. package/fixtures/stackables/node_modules/foo/foo.js +2 -1
  102. package/fixtures/start-command-in-runtime.js +1 -1
  103. package/fixtures/stdio/platformatic.service.json +6 -0
  104. package/fixtures/stdio/plugin.js +24 -0
  105. package/fixtures/telemetry/platformatic.runtime.json +2 -2
  106. package/fixtures/telemetry/services/echo/platformatic.service.json +1 -1
  107. package/fixtures/typescript/platformatic.runtime.json +2 -2
  108. package/fixtures/typescript/services/composer/platformatic.composer.json +1 -1
  109. package/fixtures/typescript/services/movies/global.d.ts +2 -3
  110. package/fixtures/typescript/services/movies/platformatic.db.json +1 -1
  111. package/fixtures/typescript/services/movies/types/Movie.d.ts +3 -3
  112. package/fixtures/typescript/services/movies/types/index.d.ts +6 -6
  113. package/fixtures/typescript/services/titles/client/client.d.ts +35 -35
  114. package/fixtures/typescript/services/titles/platformatic.service.json +1 -1
  115. package/fixtures/typescript-custom-flags/platformatic.runtime.json +2 -2
  116. package/fixtures/typescript-custom-flags/services/composer/platformatic.composer.json +1 -1
  117. package/fixtures/typescript-custom-flags/services/movies/global.d.ts +2 -3
  118. package/fixtures/typescript-custom-flags/services/movies/platformatic.db.json +1 -1
  119. package/fixtures/typescript-custom-flags/services/movies/types/Movie.d.ts +3 -3
  120. package/fixtures/typescript-custom-flags/services/movies/types/index.d.ts +6 -6
  121. package/fixtures/typescript-custom-flags/services/titles/client/client.d.ts +35 -35
  122. package/fixtures/typescript-custom-flags/services/titles/platformatic.service.json +1 -1
  123. package/fixtures/typescript-no-env/platformatic.runtime.json +2 -2
  124. package/fixtures/typescript-no-env/services/composer/platformatic.composer.json +1 -1
  125. package/fixtures/typescript-no-env/services/movies/global.d.ts +2 -3
  126. package/fixtures/typescript-no-env/services/movies/platformatic.db.json +1 -1
  127. package/fixtures/typescript-no-env/services/movies/types/Movie.d.ts +3 -3
  128. package/fixtures/typescript-no-env/services/movies/types/index.d.ts +6 -6
  129. package/fixtures/typescript-no-env/services/titles/client/client.d.ts +35 -35
  130. package/fixtures/typescript-no-env/services/titles/platformatic.service.json +1 -1
  131. package/index.d.ts +7 -8
  132. package/index.js +14 -10
  133. package/index.test-d.ts +10 -12
  134. package/lib/build-server.js +5 -11
  135. package/lib/compile.js +11 -10
  136. package/lib/config.js +21 -14
  137. package/lib/dependencies.js +2 -1
  138. package/lib/errors.js +3 -2
  139. package/lib/generator/errors.js +1 -1
  140. package/lib/generator/runtime-generator.d.ts +15 -15
  141. package/lib/generator/runtime-generator.js +92 -63
  142. package/lib/logger.js +55 -0
  143. package/lib/management-api.js +29 -44
  144. package/lib/prom-server.js +5 -9
  145. package/lib/runtime.js +885 -0
  146. package/lib/schema.js +79 -76
  147. package/lib/start.js +35 -113
  148. package/lib/streams/message-port-writable.js +44 -0
  149. package/lib/streams/pino-writable.js +30 -0
  150. package/lib/upgrade.js +4 -3
  151. package/lib/utils.js +49 -1
  152. package/lib/versions/v1.36.0.js +1 -1
  153. package/lib/versions/v1.5.0.js +1 -1
  154. package/lib/versions/v2.0.0.js +17 -0
  155. package/lib/worker/app.js +224 -0
  156. package/lib/worker/default-stackable.js +27 -0
  157. package/lib/worker/itc.js +128 -0
  158. package/lib/worker/main.js +120 -0
  159. package/lib/worker/symbols.js +7 -0
  160. package/package.json +23 -25
  161. package/runtime.mjs +4 -4
  162. package/schema.json +824 -0
  163. package/lib/api-client.js +0 -500
  164. package/lib/api.js +0 -420
  165. package/lib/app.js +0 -397
  166. package/lib/load-config.js +0 -12
  167. package/lib/loader.mjs +0 -103
  168. package/lib/message-port-writable.js +0 -50
  169. package/lib/worker.js +0 -182
  170. /package/lib/{interceptors.js → worker/interceptors.js} +0 -0
package/schema.json ADDED
@@ -0,0 +1,824 @@
1
+ {
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.0.0-alpha.2.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "type": "object",
5
+ "properties": {
6
+ "$schema": {
7
+ "type": "string"
8
+ },
9
+ "preload": {
10
+ "type": "string",
11
+ "resolvePath": true
12
+ },
13
+ "autoload": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": [
17
+ "path"
18
+ ],
19
+ "properties": {
20
+ "path": {
21
+ "type": "string",
22
+ "resolvePath": true
23
+ },
24
+ "exclude": {
25
+ "type": "array",
26
+ "default": [],
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "mappings": {
32
+ "type": "object",
33
+ "additionalProperties": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": [
37
+ "id"
38
+ ],
39
+ "properties": {
40
+ "id": {
41
+ "type": "string"
42
+ },
43
+ "config": {
44
+ "type": "string"
45
+ },
46
+ "useHttp": {
47
+ "type": "boolean"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "telemetry": {
55
+ "$id": "/OpenTelemetry",
56
+ "type": "object",
57
+ "properties": {
58
+ "serviceName": {
59
+ "type": "string",
60
+ "description": "The name of the service. Defaults to the folder name if not specified."
61
+ },
62
+ "version": {
63
+ "type": "string",
64
+ "description": "The version of the service (optional)"
65
+ },
66
+ "skip": {
67
+ "type": "array",
68
+ "description": "An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.",
69
+ "items": {
70
+ "type": "object",
71
+ "properties": {
72
+ "path": {
73
+ "type": "string",
74
+ "description": "The path to skip. Can be a string or a regex."
75
+ },
76
+ "method": {
77
+ "description": "HTTP method to skip",
78
+ "type": "string",
79
+ "enum": [
80
+ "GET",
81
+ "POST",
82
+ "PUT",
83
+ "DELETE",
84
+ "PATCH",
85
+ "HEAD",
86
+ "OPTIONS"
87
+ ]
88
+ }
89
+ }
90
+ }
91
+ },
92
+ "exporter": {
93
+ "anyOf": [
94
+ {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "object",
98
+ "properties": {
99
+ "type": {
100
+ "type": "string",
101
+ "enum": [
102
+ "console",
103
+ "otlp",
104
+ "zipkin",
105
+ "memory"
106
+ ],
107
+ "default": "console"
108
+ },
109
+ "options": {
110
+ "type": "object",
111
+ "description": "Options for the exporter. These are passed directly to the exporter.",
112
+ "properties": {
113
+ "url": {
114
+ "type": "string",
115
+ "description": "The URL to send the traces to. Not used for console or memory exporters."
116
+ },
117
+ "headers": {
118
+ "type": "object",
119
+ "description": "Headers to send to the exporter. Not used for console or memory exporters."
120
+ }
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "type": "object",
129
+ "properties": {
130
+ "type": {
131
+ "type": "string",
132
+ "enum": [
133
+ "console",
134
+ "otlp",
135
+ "zipkin",
136
+ "memory"
137
+ ],
138
+ "default": "console"
139
+ },
140
+ "options": {
141
+ "type": "object",
142
+ "description": "Options for the exporter. These are passed directly to the exporter.",
143
+ "properties": {
144
+ "url": {
145
+ "type": "string",
146
+ "description": "The URL to send the traces to. Not used for console or memory exporters."
147
+ },
148
+ "headers": {
149
+ "type": "object",
150
+ "description": "Headers to send to the exporter. Not used for console or memory exporters."
151
+ }
152
+ }
153
+ },
154
+ "additionalProperties": false
155
+ }
156
+ }
157
+ ]
158
+ }
159
+ },
160
+ "required": [
161
+ "serviceName"
162
+ ],
163
+ "additionalProperties": false
164
+ },
165
+ "server": {
166
+ "type": "object",
167
+ "properties": {
168
+ "hostname": {
169
+ "type": "string"
170
+ },
171
+ "port": {
172
+ "anyOf": [
173
+ {
174
+ "type": "integer"
175
+ },
176
+ {
177
+ "type": "string"
178
+ }
179
+ ]
180
+ },
181
+ "pluginTimeout": {
182
+ "type": "integer"
183
+ },
184
+ "healthCheck": {
185
+ "anyOf": [
186
+ {
187
+ "type": "boolean"
188
+ },
189
+ {
190
+ "type": "object",
191
+ "properties": {
192
+ "enabled": {
193
+ "type": "boolean"
194
+ },
195
+ "interval": {
196
+ "type": "integer"
197
+ }
198
+ },
199
+ "additionalProperties": true
200
+ }
201
+ ]
202
+ },
203
+ "ignoreTrailingSlash": {
204
+ "type": "boolean"
205
+ },
206
+ "ignoreDuplicateSlashes": {
207
+ "type": "boolean"
208
+ },
209
+ "connectionTimeout": {
210
+ "type": "integer"
211
+ },
212
+ "keepAliveTimeout": {
213
+ "type": "integer",
214
+ "default": 5000
215
+ },
216
+ "maxRequestsPerSocket": {
217
+ "type": "integer"
218
+ },
219
+ "forceCloseConnections": {
220
+ "anyOf": [
221
+ {
222
+ "type": "boolean"
223
+ },
224
+ {
225
+ "type": "string",
226
+ "pattern": "^idle$"
227
+ }
228
+ ]
229
+ },
230
+ "requestTimeout": {
231
+ "type": "integer"
232
+ },
233
+ "bodyLimit": {
234
+ "type": "integer"
235
+ },
236
+ "maxParamLength": {
237
+ "type": "integer"
238
+ },
239
+ "disableRequestLogging": {
240
+ "type": "boolean"
241
+ },
242
+ "exposeHeadRoutes": {
243
+ "type": "boolean"
244
+ },
245
+ "logger": {
246
+ "anyOf": [
247
+ {
248
+ "type": "boolean"
249
+ },
250
+ {
251
+ "type": "object",
252
+ "properties": {
253
+ "level": {
254
+ "type": "string"
255
+ },
256
+ "transport": {
257
+ "anyOf": [
258
+ {
259
+ "type": "object",
260
+ "properties": {
261
+ "target": {
262
+ "type": "string",
263
+ "resolveModule": true
264
+ },
265
+ "options": {
266
+ "type": "object"
267
+ }
268
+ },
269
+ "additionalProperties": false
270
+ },
271
+ {
272
+ "type": "object",
273
+ "properties": {
274
+ "targets": {
275
+ "type": "array",
276
+ "items": {
277
+ "type": "object",
278
+ "properties": {
279
+ "target": {
280
+ "type": "string",
281
+ "resolveModule": true
282
+ },
283
+ "options": {
284
+ "type": "object"
285
+ },
286
+ "level": {
287
+ "type": "string"
288
+ },
289
+ "additionalProperties": false
290
+ }
291
+ }
292
+ },
293
+ "options": {
294
+ "type": "object"
295
+ }
296
+ },
297
+ "additionalProperties": false
298
+ }
299
+ ]
300
+ },
301
+ "pipeline": {
302
+ "type": "object",
303
+ "properties": {
304
+ "target": {
305
+ "type": "string",
306
+ "resolveModule": true
307
+ },
308
+ "options": {
309
+ "type": "object"
310
+ }
311
+ },
312
+ "additionalProperties": false
313
+ }
314
+ },
315
+ "additionalProperties": true
316
+ }
317
+ ]
318
+ },
319
+ "serializerOpts": {
320
+ "type": "object",
321
+ "properties": {
322
+ "schema": {
323
+ "type": "object"
324
+ },
325
+ "ajv": {
326
+ "type": "object"
327
+ },
328
+ "rounding": {
329
+ "type": "string",
330
+ "enum": [
331
+ "floor",
332
+ "ceil",
333
+ "round",
334
+ "trunc"
335
+ ],
336
+ "default": "trunc"
337
+ },
338
+ "debugMode": {
339
+ "type": "boolean"
340
+ },
341
+ "mode": {
342
+ "type": "string",
343
+ "enum": [
344
+ "debug",
345
+ "standalone"
346
+ ]
347
+ },
348
+ "largeArraySize": {
349
+ "anyOf": [
350
+ {
351
+ "type": "integer"
352
+ },
353
+ {
354
+ "type": "string"
355
+ }
356
+ ],
357
+ "default": 20000
358
+ },
359
+ "largeArrayMechanism": {
360
+ "type": "string",
361
+ "enum": [
362
+ "default",
363
+ "json-stringify"
364
+ ],
365
+ "default": "default"
366
+ }
367
+ }
368
+ },
369
+ "caseSensitive": {
370
+ "type": "boolean"
371
+ },
372
+ "requestIdHeader": {
373
+ "anyOf": [
374
+ {
375
+ "type": "string"
376
+ },
377
+ {
378
+ "type": "boolean",
379
+ "const": false
380
+ }
381
+ ]
382
+ },
383
+ "requestIdLogLabel": {
384
+ "type": "string"
385
+ },
386
+ "jsonShorthand": {
387
+ "type": "boolean"
388
+ },
389
+ "trustProxy": {
390
+ "anyOf": [
391
+ {
392
+ "type": "boolean"
393
+ },
394
+ {
395
+ "type": "string"
396
+ },
397
+ {
398
+ "type": "array",
399
+ "items": {
400
+ "type": "string"
401
+ }
402
+ },
403
+ {
404
+ "type": "integer"
405
+ }
406
+ ]
407
+ },
408
+ "http2": {
409
+ "type": "boolean"
410
+ },
411
+ "https": {
412
+ "type": "object",
413
+ "properties": {
414
+ "allowHTTP1": {
415
+ "type": "boolean"
416
+ },
417
+ "key": {
418
+ "anyOf": [
419
+ {
420
+ "type": "string"
421
+ },
422
+ {
423
+ "type": "object",
424
+ "properties": {
425
+ "path": {
426
+ "type": "string",
427
+ "resolvePath": true
428
+ }
429
+ },
430
+ "additionalProperties": false
431
+ },
432
+ {
433
+ "type": "array",
434
+ "items": {
435
+ "anyOf": [
436
+ {
437
+ "type": "string"
438
+ },
439
+ {
440
+ "type": "object",
441
+ "properties": {
442
+ "path": {
443
+ "type": "string",
444
+ "resolvePath": true
445
+ }
446
+ },
447
+ "additionalProperties": false
448
+ }
449
+ ]
450
+ }
451
+ }
452
+ ]
453
+ },
454
+ "cert": {
455
+ "anyOf": [
456
+ {
457
+ "type": "string"
458
+ },
459
+ {
460
+ "type": "object",
461
+ "properties": {
462
+ "path": {
463
+ "type": "string",
464
+ "resolvePath": true
465
+ }
466
+ },
467
+ "additionalProperties": false
468
+ },
469
+ {
470
+ "type": "array",
471
+ "items": {
472
+ "anyOf": [
473
+ {
474
+ "type": "string"
475
+ },
476
+ {
477
+ "type": "object",
478
+ "properties": {
479
+ "path": {
480
+ "type": "string",
481
+ "resolvePath": true
482
+ }
483
+ },
484
+ "additionalProperties": false
485
+ }
486
+ ]
487
+ }
488
+ }
489
+ ]
490
+ },
491
+ "requestCert": {
492
+ "type": "boolean"
493
+ },
494
+ "rejectUnauthorized": {
495
+ "type": "boolean"
496
+ }
497
+ },
498
+ "additionalProperties": false,
499
+ "required": [
500
+ "key",
501
+ "cert"
502
+ ]
503
+ },
504
+ "cors": {
505
+ "type": "object",
506
+ "$comment": "See https://github.com/fastify/fastify-cors",
507
+ "properties": {
508
+ "origin": {
509
+ "anyOf": [
510
+ {
511
+ "type": "boolean"
512
+ },
513
+ {
514
+ "type": "string"
515
+ },
516
+ {
517
+ "type": "array",
518
+ "items": {
519
+ "anyOf": [
520
+ {
521
+ "type": "string"
522
+ },
523
+ {
524
+ "type": "object",
525
+ "properties": {
526
+ "regexp": {
527
+ "type": "string"
528
+ }
529
+ },
530
+ "required": [
531
+ "regexp"
532
+ ]
533
+ }
534
+ ]
535
+ }
536
+ },
537
+ {
538
+ "type": "object",
539
+ "properties": {
540
+ "regexp": {
541
+ "type": "string"
542
+ }
543
+ },
544
+ "required": [
545
+ "regexp"
546
+ ]
547
+ }
548
+ ]
549
+ },
550
+ "methods": {
551
+ "type": "array",
552
+ "items": {
553
+ "type": "string"
554
+ }
555
+ },
556
+ "allowedHeaders": {
557
+ "type": "string",
558
+ "description": "Comma separated string of allowed headers."
559
+ },
560
+ "exposedHeaders": {
561
+ "anyOf": [
562
+ {
563
+ "type": "array",
564
+ "items": {
565
+ "type": "string"
566
+ }
567
+ },
568
+ {
569
+ "type": "string",
570
+ "description": "Comma separated string of exposed headers."
571
+ }
572
+ ]
573
+ },
574
+ "credentials": {
575
+ "type": "boolean"
576
+ },
577
+ "maxAge": {
578
+ "type": "integer"
579
+ },
580
+ "preflightContinue": {
581
+ "type": "boolean",
582
+ "default": false
583
+ },
584
+ "optionsSuccessStatus": {
585
+ "type": "integer",
586
+ "default": 204
587
+ },
588
+ "preflight": {
589
+ "type": "boolean",
590
+ "default": true
591
+ },
592
+ "strictPreflight": {
593
+ "type": "boolean",
594
+ "default": true
595
+ },
596
+ "hideOptionsRoute": {
597
+ "type": "boolean",
598
+ "default": true
599
+ }
600
+ },
601
+ "additionalProperties": false
602
+ }
603
+ },
604
+ "additionalProperties": false
605
+ },
606
+ "entrypoint": {
607
+ "type": "string"
608
+ },
609
+ "watch": {
610
+ "anyOf": [
611
+ {
612
+ "type": "boolean"
613
+ },
614
+ {
615
+ "type": "string"
616
+ }
617
+ ]
618
+ },
619
+ "inspectorOptions": {
620
+ "type": "object",
621
+ "properties": {
622
+ "host": {
623
+ "type": "string"
624
+ },
625
+ "port": {
626
+ "type": "number"
627
+ },
628
+ "breakFirstLine": {
629
+ "type": "boolean"
630
+ },
631
+ "watchDisabled": {
632
+ "type": "boolean"
633
+ }
634
+ }
635
+ },
636
+ "undici": {
637
+ "type": "object",
638
+ "properties": {
639
+ "agentOptions": {
640
+ "type": "object",
641
+ "additionalProperties": true
642
+ },
643
+ "interceptors": {
644
+ "anyOf": [
645
+ {
646
+ "type": "array",
647
+ "items": {
648
+ "$ref": "#/$defs/undiciInterceptor"
649
+ }
650
+ },
651
+ {
652
+ "type": "object",
653
+ "properties": {
654
+ "Client": {
655
+ "type": "array",
656
+ "items": {
657
+ "$ref": "#/$defs/undiciInterceptor"
658
+ }
659
+ },
660
+ "Pool": {
661
+ "type": "array",
662
+ "items": {
663
+ "$ref": "#/$defs/undiciInterceptor"
664
+ }
665
+ },
666
+ "Agent": {
667
+ "type": "array",
668
+ "items": {
669
+ "$ref": "#/$defs/undiciInterceptor"
670
+ }
671
+ }
672
+ }
673
+ }
674
+ ]
675
+ }
676
+ }
677
+ },
678
+ "managementApi": {
679
+ "anyOf": [
680
+ {
681
+ "type": "boolean"
682
+ },
683
+ {
684
+ "type": "string"
685
+ },
686
+ {
687
+ "type": "object",
688
+ "properties": {
689
+ "logs": {
690
+ "maxSize": {
691
+ "type": "number",
692
+ "minimum": 5,
693
+ "default": 200
694
+ }
695
+ }
696
+ },
697
+ "additionalProperties": false
698
+ }
699
+ ],
700
+ "default": true
701
+ },
702
+ "metrics": {
703
+ "anyOf": [
704
+ {
705
+ "type": "boolean"
706
+ },
707
+ {
708
+ "type": "object",
709
+ "properties": {
710
+ "port": {
711
+ "anyOf": [
712
+ {
713
+ "type": "integer"
714
+ },
715
+ {
716
+ "type": "string"
717
+ }
718
+ ]
719
+ },
720
+ "hostname": {
721
+ "type": "string"
722
+ },
723
+ "endpoint": {
724
+ "type": "string"
725
+ },
726
+ "auth": {
727
+ "type": "object",
728
+ "properties": {
729
+ "username": {
730
+ "type": "string"
731
+ },
732
+ "password": {
733
+ "type": "string"
734
+ }
735
+ },
736
+ "additionalProperties": false,
737
+ "required": [
738
+ "username",
739
+ "password"
740
+ ]
741
+ },
742
+ "labels": {
743
+ "type": "object",
744
+ "additionalProperties": {
745
+ "type": "string"
746
+ }
747
+ }
748
+ },
749
+ "additionalProperties": false
750
+ }
751
+ ]
752
+ },
753
+ "restartOnError": {
754
+ "default": true,
755
+ "anyOf": [
756
+ {
757
+ "type": "boolean"
758
+ },
759
+ {
760
+ "type": "number",
761
+ "minimum": 100
762
+ }
763
+ ]
764
+ },
765
+ "services": {
766
+ "type": "array",
767
+ "items": {
768
+ "type": "object",
769
+ "required": [
770
+ "id",
771
+ "path"
772
+ ],
773
+ "properties": {
774
+ "id": {
775
+ "type": "string"
776
+ },
777
+ "path": {
778
+ "type": "string",
779
+ "resolvePath": true
780
+ },
781
+ "config": {
782
+ "type": "string"
783
+ },
784
+ "useHttp": {
785
+ "type": "boolean"
786
+ }
787
+ }
788
+ }
789
+ }
790
+ },
791
+ "anyOf": [
792
+ {
793
+ "required": [
794
+ "autoload",
795
+ "entrypoint"
796
+ ]
797
+ },
798
+ {
799
+ "required": [
800
+ "services",
801
+ "entrypoint"
802
+ ]
803
+ }
804
+ ],
805
+ "additionalProperties": false,
806
+ "$defs": {
807
+ "undiciInterceptor": {
808
+ "type": "object",
809
+ "properties": {
810
+ "module": {
811
+ "type": "string"
812
+ },
813
+ "options": {
814
+ "type": "object",
815
+ "additionalProperties": true
816
+ }
817
+ },
818
+ "required": [
819
+ "module",
820
+ "options"
821
+ ]
822
+ }
823
+ }
824
+ }