@platformatic/composer 3.4.1 → 3.5.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.
Files changed (46) hide show
  1. package/LICENSE +1 -1
  2. package/config.d.ts +482 -131
  3. package/eslint.config.js +4 -2
  4. package/index.d.ts +1 -17
  5. package/index.js +9 -210
  6. package/package.json +18 -59
  7. package/schema.json +2121 -843
  8. package/scripts/schema.js +12 -0
  9. package/.c8rc +0 -6
  10. package/composer.mjs +0 -54
  11. package/help/create.txt +0 -11
  12. package/help/help.txt +0 -7
  13. package/help/openapi schemas fetch.txt +0 -9
  14. package/help/start.txt +0 -54
  15. package/index.test-d.ts +0 -23
  16. package/lib/composer-hook.js +0 -60
  17. package/lib/create.mjs +0 -84
  18. package/lib/errors.js +0 -13
  19. package/lib/generator/README.md +0 -30
  20. package/lib/generator/composer-generator.d.ts +0 -11
  21. package/lib/generator/composer-generator.js +0 -128
  22. package/lib/graphql-fetch.js +0 -85
  23. package/lib/graphql-generator.js +0 -31
  24. package/lib/graphql.js +0 -20
  25. package/lib/openapi-composer.js +0 -81
  26. package/lib/openapi-config-schema.js +0 -93
  27. package/lib/openapi-fetch-schemas.mjs +0 -61
  28. package/lib/openapi-generator.js +0 -167
  29. package/lib/openapi-load-config.js +0 -31
  30. package/lib/openapi-modifier.js +0 -137
  31. package/lib/openapi.js +0 -49
  32. package/lib/proxy.js +0 -161
  33. package/lib/root-endpoint/index.js +0 -28
  34. package/lib/root-endpoint/public/images/dark_mode.svg +0 -3
  35. package/lib/root-endpoint/public/images/favicon.ico +0 -0
  36. package/lib/root-endpoint/public/images/light_mode.svg +0 -11
  37. package/lib/root-endpoint/public/images/platformatic-logo-dark.svg +0 -30
  38. package/lib/root-endpoint/public/images/platformatic-logo-light.svg +0 -30
  39. package/lib/root-endpoint/public/images/triangle_dark.svg +0 -3
  40. package/lib/root-endpoint/public/images/triangle_light.svg +0 -3
  41. package/lib/root-endpoint/public/index.html +0 -237
  42. package/lib/schema.js +0 -210
  43. package/lib/stackable.js +0 -59
  44. package/lib/upgrade.js +0 -22
  45. package/lib/utils.js +0 -27
  46. package/lib/versions/2.0.0.js +0 -11
package/LICENSE CHANGED
@@ -136,7 +136,7 @@
136
136
  with Licensor regarding such Contributions.
137
137
 
138
138
  6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
139
+ names, trademarks, application marks, or product names of the Licensor,
140
140
  except as required for reasonable and customary use in describing the
141
141
  origin of the Work and reproducing the content of the NOTICE file.
142
142
 
package/config.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export interface PlatformaticComposer {
8
+ export interface PlatformaticComposerConfig {
9
9
  basePath?: string;
10
10
  server?: {
11
11
  hostname?: string;
@@ -53,8 +53,6 @@ export interface PlatformaticComposer {
53
53
  [k: string]: unknown;
54
54
  };
55
55
  level?: string;
56
- additionalProperties?: never;
57
- [k: string]: unknown;
58
56
  }[];
59
57
  options?: {
60
58
  [k: string]: unknown;
@@ -66,6 +64,21 @@ export interface PlatformaticComposer {
66
64
  [k: string]: unknown;
67
65
  };
68
66
  };
67
+ formatters?: {
68
+ path: string;
69
+ };
70
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
71
+ redact?: {
72
+ paths: string[];
73
+ censor?: string;
74
+ };
75
+ base?: {
76
+ [k: string]: unknown;
77
+ } | null;
78
+ messageKey?: string;
79
+ customLevels?: {
80
+ [k: string]: unknown;
81
+ };
69
82
  [k: string]: unknown;
70
83
  };
71
84
  loggerInstance?: {
@@ -148,8 +161,428 @@ export interface PlatformaticComposer {
148
161
  hideOptionsRoute?: boolean;
149
162
  };
150
163
  };
151
- composer: {
164
+ types?: {
165
+ autogenerate?: boolean;
166
+ /**
167
+ * The path to the directory the types should be generated in.
168
+ */
169
+ dir?: string;
170
+ };
171
+ plugins?: {
172
+ [k: string]: unknown;
173
+ };
174
+ application?: {};
175
+ runtime?: {
176
+ preload?: string | string[];
177
+ basePath?: string;
152
178
  services?: {
179
+ [k: string]: unknown;
180
+ }[];
181
+ workers?: number | string;
182
+ logger?: {
183
+ level: (
184
+ | ("fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent")
185
+ | {
186
+ [k: string]: unknown;
187
+ }
188
+ ) &
189
+ string;
190
+ transport?:
191
+ | {
192
+ target?: string;
193
+ options?: {
194
+ [k: string]: unknown;
195
+ };
196
+ }
197
+ | {
198
+ targets?: {
199
+ target?: string;
200
+ options?: {
201
+ [k: string]: unknown;
202
+ };
203
+ level?: string;
204
+ }[];
205
+ options?: {
206
+ [k: string]: unknown;
207
+ };
208
+ };
209
+ pipeline?: {
210
+ target?: string;
211
+ options?: {
212
+ [k: string]: unknown;
213
+ };
214
+ };
215
+ formatters?: {
216
+ path: string;
217
+ };
218
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
219
+ redact?: {
220
+ paths: string[];
221
+ censor?: string;
222
+ };
223
+ base?: {
224
+ [k: string]: unknown;
225
+ } | null;
226
+ messageKey?: string;
227
+ customLevels?: {
228
+ [k: string]: unknown;
229
+ };
230
+ [k: string]: unknown;
231
+ };
232
+ server?: {
233
+ hostname?: string;
234
+ port?: number | string;
235
+ http2?: boolean;
236
+ https?: {
237
+ allowHTTP1?: boolean;
238
+ key:
239
+ | string
240
+ | {
241
+ path?: string;
242
+ }
243
+ | (
244
+ | string
245
+ | {
246
+ path?: string;
247
+ }
248
+ )[];
249
+ cert:
250
+ | string
251
+ | {
252
+ path?: string;
253
+ }
254
+ | (
255
+ | string
256
+ | {
257
+ path?: string;
258
+ }
259
+ )[];
260
+ requestCert?: boolean;
261
+ rejectUnauthorized?: boolean;
262
+ };
263
+ };
264
+ startTimeout?: number;
265
+ restartOnError?: boolean | number;
266
+ exitOnUnhandledErrors?: boolean;
267
+ gracefulShutdown?: {
268
+ runtime: number | string;
269
+ application: number | string;
270
+ };
271
+ health?: {
272
+ enabled?: boolean | string;
273
+ interval?: number | string;
274
+ gracePeriod?: number | string;
275
+ maxUnhealthyChecks?: number | string;
276
+ maxELU?: number | string;
277
+ maxHeapUsed?: number | string;
278
+ maxHeapTotal?: number | string;
279
+ maxYoungGeneration?: number | string;
280
+ };
281
+ undici?: {
282
+ agentOptions?: {
283
+ [k: string]: unknown;
284
+ };
285
+ interceptors?:
286
+ | {
287
+ module: string;
288
+ options: {
289
+ [k: string]: unknown;
290
+ };
291
+ [k: string]: unknown;
292
+ }[]
293
+ | {
294
+ Client?: {
295
+ module: string;
296
+ options: {
297
+ [k: string]: unknown;
298
+ };
299
+ [k: string]: unknown;
300
+ }[];
301
+ Pool?: {
302
+ module: string;
303
+ options: {
304
+ [k: string]: unknown;
305
+ };
306
+ [k: string]: unknown;
307
+ }[];
308
+ Agent?: {
309
+ module: string;
310
+ options: {
311
+ [k: string]: unknown;
312
+ };
313
+ [k: string]: unknown;
314
+ }[];
315
+ [k: string]: unknown;
316
+ };
317
+ [k: string]: unknown;
318
+ };
319
+ httpCache?:
320
+ | boolean
321
+ | {
322
+ store?: string;
323
+ /**
324
+ * @minItems 1
325
+ */
326
+ methods?: [string, ...string[]];
327
+ cacheTagsHeader?: string;
328
+ maxSize?: number;
329
+ maxEntrySize?: number;
330
+ maxCount?: number;
331
+ [k: string]: unknown;
332
+ };
333
+ watch?: boolean | string;
334
+ managementApi?:
335
+ | boolean
336
+ | string
337
+ | {
338
+ logs?: {
339
+ maxSize?: number;
340
+ };
341
+ };
342
+ metrics?:
343
+ | boolean
344
+ | {
345
+ port?: number | string;
346
+ enabled?: boolean | string;
347
+ hostname?: string;
348
+ endpoint?: string;
349
+ auth?: {
350
+ username: string;
351
+ password: string;
352
+ };
353
+ labels?: {
354
+ [k: string]: string;
355
+ };
356
+ /**
357
+ * The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)
358
+ */
359
+ applicationLabel?: string;
360
+ readiness?:
361
+ | boolean
362
+ | {
363
+ endpoint?: string;
364
+ success?: {
365
+ statusCode?: number;
366
+ body?: string;
367
+ };
368
+ fail?: {
369
+ statusCode?: number;
370
+ body?: string;
371
+ };
372
+ };
373
+ liveness?:
374
+ | boolean
375
+ | {
376
+ endpoint?: string;
377
+ success?: {
378
+ statusCode?: number;
379
+ body?: string;
380
+ };
381
+ fail?: {
382
+ statusCode?: number;
383
+ body?: string;
384
+ };
385
+ };
386
+ plugins?: string[];
387
+ };
388
+ telemetry?: {
389
+ enabled?: boolean | string;
390
+ /**
391
+ * The name of the application. Defaults to the folder name if not specified.
392
+ */
393
+ applicationName: string;
394
+ /**
395
+ * The version of the application (optional)
396
+ */
397
+ version?: string;
398
+ /**
399
+ * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
400
+ */
401
+ skip?: {
402
+ /**
403
+ * The path to skip. Can be a string or a regex.
404
+ */
405
+ path?: string;
406
+ /**
407
+ * HTTP method to skip
408
+ */
409
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
410
+ [k: string]: unknown;
411
+ }[];
412
+ exporter?:
413
+ | {
414
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
415
+ /**
416
+ * Options for the exporter. These are passed directly to the exporter.
417
+ */
418
+ options?: {
419
+ /**
420
+ * The URL to send the traces to. Not used for console or memory exporters.
421
+ */
422
+ url?: string;
423
+ /**
424
+ * Headers to send to the exporter. Not used for console or memory exporters.
425
+ */
426
+ headers?: {
427
+ [k: string]: unknown;
428
+ };
429
+ /**
430
+ * The path to write the traces to. Only for file exporter.
431
+ */
432
+ path?: string;
433
+ [k: string]: unknown;
434
+ };
435
+ additionalProperties?: never;
436
+ [k: string]: unknown;
437
+ }[]
438
+ | {
439
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
440
+ /**
441
+ * Options for the exporter. These are passed directly to the exporter.
442
+ */
443
+ options?: {
444
+ /**
445
+ * The URL to send the traces to. Not used for console or memory exporters.
446
+ */
447
+ url?: string;
448
+ /**
449
+ * Headers to send to the exporter. Not used for console or memory exporters.
450
+ */
451
+ headers?: {
452
+ [k: string]: unknown;
453
+ };
454
+ /**
455
+ * The path to write the traces to. Only for file exporter.
456
+ */
457
+ path?: string;
458
+ [k: string]: unknown;
459
+ };
460
+ additionalProperties?: never;
461
+ [k: string]: unknown;
462
+ };
463
+ };
464
+ inspectorOptions?: {
465
+ host?: string;
466
+ port?: number;
467
+ breakFirstLine?: boolean;
468
+ watchDisabled?: boolean;
469
+ [k: string]: unknown;
470
+ };
471
+ applicationTimeout?: number | string;
472
+ messagingTimeout?: number | string;
473
+ env?: {
474
+ [k: string]: string;
475
+ };
476
+ sourceMaps?: boolean;
477
+ scheduler?: {
478
+ enabled?: boolean | string;
479
+ name: string;
480
+ cron: string;
481
+ callbackUrl: string;
482
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
483
+ headers?: {
484
+ [k: string]: string;
485
+ };
486
+ body?:
487
+ | string
488
+ | {
489
+ [k: string]: unknown;
490
+ };
491
+ maxRetries?: number;
492
+ [k: string]: unknown;
493
+ }[];
494
+ };
495
+ telemetry?: {
496
+ enabled?: boolean | string;
497
+ /**
498
+ * The name of the application. Defaults to the folder name if not specified.
499
+ */
500
+ applicationName: string;
501
+ /**
502
+ * The version of the application (optional)
503
+ */
504
+ version?: string;
505
+ /**
506
+ * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
507
+ */
508
+ skip?: {
509
+ /**
510
+ * The path to skip. Can be a string or a regex.
511
+ */
512
+ path?: string;
513
+ /**
514
+ * HTTP method to skip
515
+ */
516
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
517
+ [k: string]: unknown;
518
+ }[];
519
+ exporter?:
520
+ | {
521
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
522
+ /**
523
+ * Options for the exporter. These are passed directly to the exporter.
524
+ */
525
+ options?: {
526
+ /**
527
+ * The URL to send the traces to. Not used for console or memory exporters.
528
+ */
529
+ url?: string;
530
+ /**
531
+ * Headers to send to the exporter. Not used for console or memory exporters.
532
+ */
533
+ headers?: {
534
+ [k: string]: unknown;
535
+ };
536
+ /**
537
+ * The path to write the traces to. Only for file exporter.
538
+ */
539
+ path?: string;
540
+ [k: string]: unknown;
541
+ };
542
+ additionalProperties?: never;
543
+ [k: string]: unknown;
544
+ }[]
545
+ | {
546
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
547
+ /**
548
+ * Options for the exporter. These are passed directly to the exporter.
549
+ */
550
+ options?: {
551
+ /**
552
+ * The URL to send the traces to. Not used for console or memory exporters.
553
+ */
554
+ url?: string;
555
+ /**
556
+ * Headers to send to the exporter. Not used for console or memory exporters.
557
+ */
558
+ headers?: {
559
+ [k: string]: unknown;
560
+ };
561
+ /**
562
+ * The path to write the traces to. Only for file exporter.
563
+ */
564
+ path?: string;
565
+ [k: string]: unknown;
566
+ };
567
+ additionalProperties?: never;
568
+ [k: string]: unknown;
569
+ };
570
+ };
571
+ watch?:
572
+ | {
573
+ enabled?: boolean | string;
574
+ /**
575
+ * @minItems 1
576
+ */
577
+ allow?: [string, ...string[]];
578
+ ignore?: string[];
579
+ }
580
+ | boolean
581
+ | string;
582
+ $schema?: string;
583
+ module?: string;
584
+ composer?: {
585
+ applications?: {
153
586
  id: string;
154
587
  origin?: string;
155
588
  openapi?: {
@@ -231,7 +664,25 @@ export interface PlatformaticComposer {
231
664
  proxy?:
232
665
  | false
233
666
  | {
667
+ upstream?: string;
234
668
  prefix?: string;
669
+ hostname?: string;
670
+ ws?: {
671
+ upstream?: string;
672
+ reconnect?: {
673
+ pingInterval?: number;
674
+ maxReconnectionRetries?: number;
675
+ reconnectInterval?: number;
676
+ reconnectDecay?: number;
677
+ connectionTimeout?: number;
678
+ reconnectOnClose?: boolean;
679
+ logs?: boolean;
680
+ [k: string]: unknown;
681
+ };
682
+ hooks?: {
683
+ path: string;
684
+ };
685
+ };
235
686
  };
236
687
  }[];
237
688
  openapi?: {
@@ -336,59 +787,6 @@ export interface PlatformaticComposer {
336
787
  addEmptySchema?: boolean;
337
788
  refreshTimeout?: number;
338
789
  };
339
- metrics?:
340
- | boolean
341
- | {
342
- port?: number | string;
343
- hostname?: string;
344
- endpoint?: string;
345
- server?: "own" | "parent" | "hide";
346
- defaultMetrics?: {
347
- enabled: boolean;
348
- };
349
- auth?: {
350
- username: string;
351
- password: string;
352
- };
353
- labels?: {
354
- [k: string]: string;
355
- };
356
- };
357
- types?: {
358
- autogenerate?: boolean;
359
- /**
360
- * The path to the directory the types should be generated in.
361
- */
362
- dir?: string;
363
- };
364
- plugins?: {
365
- [k: string]: unknown;
366
- };
367
- clients?: {
368
- serviceId?: string;
369
- name?: string;
370
- type?: "openapi" | "graphql";
371
- path?: string;
372
- schema?: string;
373
- url?: string;
374
- fullResponse?: boolean;
375
- fullRequest?: boolean;
376
- validateResponse?: boolean;
377
- }[];
378
- telemetry?: OpenTelemetry;
379
- watch?:
380
- | {
381
- enabled?: boolean | string;
382
- /**
383
- * @minItems 1
384
- */
385
- allow?: [string, ...string[]];
386
- ignore?: string[];
387
- }
388
- | boolean
389
- | string;
390
- $schema?: string;
391
- module?: string;
392
790
  }
393
791
  export interface Info {
394
792
  title: string;
@@ -462,13 +860,13 @@ export interface PathItem {
462
860
  servers?: Server[];
463
861
  parameters?: ParameterOrReference[];
464
862
  get?: Operation;
465
- put?: Operation;
466
- post?: Operation;
467
- delete?: Operation;
468
- options?: Operation;
469
- head?: Operation;
470
- patch?: Operation;
471
- trace?: Operation;
863
+ put?: Operation1;
864
+ post?: Operation1;
865
+ delete?: Operation1;
866
+ options?: Operation1;
867
+ head?: Operation1;
868
+ patch?: Operation1;
869
+ trace?: Operation1;
472
870
  /**
473
871
  * This interface was referenced by `PathItem`'s JSON-Schema definition
474
872
  * via the `patternProperty` "^x-".
@@ -522,6 +920,26 @@ export interface CallbacksOrReference {
522
920
  export interface SecurityRequirement {
523
921
  [k: string]: string[];
524
922
  }
923
+ export interface Operation1 {
924
+ tags?: string[];
925
+ summary?: string;
926
+ description?: string;
927
+ externalDocs?: ExternalDocumentation;
928
+ operationId?: string;
929
+ parameters?: ParameterOrReference[];
930
+ requestBody?: RequestBodyOrReference;
931
+ responses?: Responses;
932
+ callbacks?: {
933
+ [k: string]: CallbacksOrReference;
934
+ };
935
+ security?: SecurityRequirement[];
936
+ servers?: Server[];
937
+ /**
938
+ * This interface was referenced by `Operation1`'s JSON-Schema definition
939
+ * via the `patternProperty` "^x-".
940
+ */
941
+ [k: string]: unknown;
942
+ }
525
943
  export interface PathItemOrReference {
526
944
  [k: string]: unknown;
527
945
  }
@@ -584,70 +1002,3 @@ export interface Tag {
584
1002
  */
585
1003
  [k: string]: unknown;
586
1004
  }
587
- export interface OpenTelemetry {
588
- /**
589
- * The name of the service. Defaults to the folder name if not specified.
590
- */
591
- serviceName: string;
592
- /**
593
- * The version of the service (optional)
594
- */
595
- version?: string;
596
- /**
597
- * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
598
- */
599
- skip?: {
600
- /**
601
- * The path to skip. Can be a string or a regex.
602
- */
603
- path?: string;
604
- /**
605
- * HTTP method to skip
606
- */
607
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
608
- [k: string]: unknown;
609
- }[];
610
- exporter?:
611
- | {
612
- type?: "console" | "otlp" | "zipkin" | "memory";
613
- /**
614
- * Options for the exporter. These are passed directly to the exporter.
615
- */
616
- options?: {
617
- /**
618
- * The URL to send the traces to. Not used for console or memory exporters.
619
- */
620
- url?: string;
621
- /**
622
- * Headers to send to the exporter. Not used for console or memory exporters.
623
- */
624
- headers?: {
625
- [k: string]: unknown;
626
- };
627
- [k: string]: unknown;
628
- };
629
- additionalProperties?: never;
630
- [k: string]: unknown;
631
- }[]
632
- | {
633
- type?: "console" | "otlp" | "zipkin" | "memory";
634
- /**
635
- * Options for the exporter. These are passed directly to the exporter.
636
- */
637
- options?: {
638
- /**
639
- * The URL to send the traces to. Not used for console or memory exporters.
640
- */
641
- url?: string;
642
- /**
643
- * Headers to send to the exporter. Not used for console or memory exporters.
644
- */
645
- headers?: {
646
- [k: string]: unknown;
647
- };
648
- [k: string]: unknown;
649
- };
650
- additionalProperties?: never;
651
- [k: string]: unknown;
652
- };
653
- }
package/eslint.config.js CHANGED
@@ -1,3 +1,5 @@
1
- 'use strict'
1
+ import neostandard from 'neostandard'
2
2
 
3
- module.exports = require('neostandard')({})
3
+ export default neostandard({
4
+ ts: true
5
+ })
package/index.d.ts CHANGED
@@ -1,17 +1 @@
1
- import { FastifyInstance } from 'fastify'
2
- import ConfigManager from '@platformatic/config'
3
- import type { ConfigManagerConfig, StackableInterface } from '@platformatic/config'
4
- import { PlatformaticComposer } from './config'
5
-
6
- export { PlatformaticApp } from '@platformatic/service'
7
- export type PlatformaticComposerConfig = PlatformaticComposer
8
-
9
- export function buildServer (opts: object, app?: object, ConfigManagerContructor?: object): Promise<FastifyInstance>
10
-
11
- export function buildStackable (opts: object, app?: object): Promise<{
12
- configType: string,
13
- configManager?: ConfigManager<PlatformaticComposerConfig>,
14
- configManagerConfig?: ConfigManagerConfig<PlatformaticComposerConfig>,
15
- schema?: object,
16
- stackable?: StackableInterface
17
- }>
1
+ export * from '@platformatic/gateway'