@platformatic/nest 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/config.d.ts CHANGED
@@ -240,7 +240,7 @@ export interface PlatformaticNestJSConfig {
240
240
  reuseTcpPorts?: boolean;
241
241
  startTimeout?: number;
242
242
  restartOnError?: boolean | number;
243
- exitOnUnhandledErrors?: boolean;
243
+ exitOnUnhandledErrors?: boolean | number;
244
244
  gracefulShutdown?: {
245
245
  runtime: number | string;
246
246
  application: number | string;
@@ -262,6 +262,7 @@ export interface PlatformaticNestJSConfig {
262
262
  bufferPoolSize?: number | string;
263
263
  defaultHighWaterMark?: number | string;
264
264
  };
265
+ healthProbes?: boolean | string;
265
266
  undici?: {
266
267
  agentOptions?: {
267
268
  [k: string]: unknown;
@@ -352,6 +353,33 @@ export interface PlatformaticNestJSConfig {
352
353
  enabled?: boolean | string;
353
354
  hostname?: string;
354
355
  endpoint?: string;
356
+ https?: {
357
+ allowHTTP1?: boolean;
358
+ key:
359
+ | string
360
+ | {
361
+ path?: string;
362
+ }
363
+ | (
364
+ | string
365
+ | {
366
+ path?: string;
367
+ }
368
+ )[];
369
+ cert:
370
+ | string
371
+ | {
372
+ path?: string;
373
+ }
374
+ | (
375
+ | string
376
+ | {
377
+ path?: string;
378
+ }
379
+ )[];
380
+ requestCert?: boolean;
381
+ rejectUnauthorized?: boolean;
382
+ };
355
383
  auth?: {
356
384
  username: string;
357
385
  password: string;
@@ -490,6 +518,14 @@ export interface PlatformaticNestJSConfig {
490
518
  * The path to write the traces to. Only for file exporter.
491
519
  */
492
520
  path?: string;
521
+ /**
522
+ * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
523
+ */
524
+ protocol?: "http" | "grpc";
525
+ /**
526
+ * Alias for protocol. Only for the otlp exporter. Defaults to http.
527
+ */
528
+ transport?: "http" | "grpc";
493
529
  [k: string]: unknown;
494
530
  };
495
531
  additionalProperties?: never;
@@ -515,6 +551,14 @@ export interface PlatformaticNestJSConfig {
515
551
  * The path to write the traces to. Only for file exporter.
516
552
  */
517
553
  path?: string;
554
+ /**
555
+ * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
556
+ */
557
+ protocol?: "http" | "grpc";
558
+ /**
559
+ * Alias for protocol. Only for the otlp exporter. Defaults to http.
560
+ */
561
+ transport?: "http" | "grpc";
518
562
  [k: string]: unknown;
519
563
  };
520
564
  additionalProperties?: never;
package/lib/capability.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  BaseCapability,
3
+ buildFastifyOptions,
3
4
  buildListenOptions,
4
5
  cleanBasePath,
5
6
  createServerListener,
@@ -9,6 +10,7 @@ import {
9
10
  importFile,
10
11
  resolvePackageViaCJS
11
12
  } from '@platformatic/basic'
13
+ import { sanitizeHTTPSOptions } from '@platformatic/foundation'
12
14
  import { getEvents } from '@platformatic/globals'
13
15
  import getPort from 'get-port'
14
16
  import inject from 'light-my-request'
@@ -215,14 +217,18 @@ export class NestCapability extends BaseCapability {
215
217
 
216
218
  // Create the server
217
219
  if (this.#isFastify) {
218
- this.#app = await NestFactory.create(appModule, new Adapter({ loggerInstance: this.logger }))
220
+ this.#app = await NestFactory.create(appModule, new Adapter({
221
+ loggerInstance: this.logger,
222
+ ...(await buildFastifyOptions(this.serverConfig))
223
+ }))
219
224
 
220
225
  setup?.(this.#app)
221
226
  await this.#app.init()
222
227
 
223
228
  this.#server = this.#app.getInstance()
224
229
  } else {
225
- this.#app = await NestFactory.create(appModule, new Adapter())
230
+ const httpsOptions = await sanitizeHTTPSOptions(this.serverConfig?.https)
231
+ this.#app = await NestFactory.create(appModule, new Adapter(), httpsOptions ? { httpsOptions } : undefined)
226
232
 
227
233
  const instance = this.#app.getInstance()
228
234
  instance.disable('x-powered-by')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/nest",
3
- "version": "3.56.0",
3
+ "version": "3.58.0",
4
4
  "description": "Platformatic Nest.js Capability",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,10 +18,10 @@
18
18
  "get-port": "^7.1.0",
19
19
  "light-my-request": "^6.0.0",
20
20
  "pino-http": "^10.2.0",
21
- "@platformatic/basic": "3.56.0",
22
- "@platformatic/generators": "3.56.0",
23
- "@platformatic/globals": "3.56.0",
24
- "@platformatic/foundation": "3.56.0"
21
+ "@platformatic/basic": "3.58.0",
22
+ "@platformatic/foundation": "3.58.0",
23
+ "@platformatic/generators": "3.58.0",
24
+ "@platformatic/globals": "3.58.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@nestjs/cli": "^11.0.7",
@@ -35,8 +35,8 @@
35
35
  "tstyche": "^6.2.0",
36
36
  "tsx": "^4.19.0",
37
37
  "typescript": "^5.5.4",
38
- "@platformatic/gateway": "3.56.0",
39
- "@platformatic/service": "3.56.0"
38
+ "@platformatic/gateway": "3.58.0",
39
+ "@platformatic/service": "3.58.0"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/nest/3.56.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/nest/3.58.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic NestJS Config",
5
5
  "type": "object",
@@ -1183,7 +1183,14 @@
1183
1183
  },
1184
1184
  "exitOnUnhandledErrors": {
1185
1185
  "default": true,
1186
- "type": "boolean"
1186
+ "anyOf": [
1187
+ {
1188
+ "type": "boolean"
1189
+ },
1190
+ {
1191
+ "type": "number"
1192
+ }
1193
+ ]
1187
1194
  },
1188
1195
  "gracefulShutdown": {
1189
1196
  "type": "object",
@@ -1365,6 +1372,17 @@
1365
1372
  },
1366
1373
  "additionalProperties": false
1367
1374
  },
1375
+ "healthProbes": {
1376
+ "anyOf": [
1377
+ {
1378
+ "type": "boolean"
1379
+ },
1380
+ {
1381
+ "type": "string"
1382
+ }
1383
+ ],
1384
+ "default": true
1385
+ },
1368
1386
  "undici": {
1369
1387
  "type": "object",
1370
1388
  "properties": {
@@ -1616,6 +1634,99 @@
1616
1634
  "endpoint": {
1617
1635
  "type": "string"
1618
1636
  },
1637
+ "https": {
1638
+ "type": "object",
1639
+ "properties": {
1640
+ "allowHTTP1": {
1641
+ "type": "boolean"
1642
+ },
1643
+ "key": {
1644
+ "anyOf": [
1645
+ {
1646
+ "type": "string"
1647
+ },
1648
+ {
1649
+ "type": "object",
1650
+ "properties": {
1651
+ "path": {
1652
+ "type": "string",
1653
+ "resolvePath": true
1654
+ }
1655
+ },
1656
+ "additionalProperties": false
1657
+ },
1658
+ {
1659
+ "type": "array",
1660
+ "items": {
1661
+ "anyOf": [
1662
+ {
1663
+ "type": "string"
1664
+ },
1665
+ {
1666
+ "type": "object",
1667
+ "properties": {
1668
+ "path": {
1669
+ "type": "string",
1670
+ "resolvePath": true
1671
+ }
1672
+ },
1673
+ "additionalProperties": false
1674
+ }
1675
+ ]
1676
+ }
1677
+ }
1678
+ ]
1679
+ },
1680
+ "cert": {
1681
+ "anyOf": [
1682
+ {
1683
+ "type": "string"
1684
+ },
1685
+ {
1686
+ "type": "object",
1687
+ "properties": {
1688
+ "path": {
1689
+ "type": "string",
1690
+ "resolvePath": true
1691
+ }
1692
+ },
1693
+ "additionalProperties": false
1694
+ },
1695
+ {
1696
+ "type": "array",
1697
+ "items": {
1698
+ "anyOf": [
1699
+ {
1700
+ "type": "string"
1701
+ },
1702
+ {
1703
+ "type": "object",
1704
+ "properties": {
1705
+ "path": {
1706
+ "type": "string",
1707
+ "resolvePath": true
1708
+ }
1709
+ },
1710
+ "additionalProperties": false
1711
+ }
1712
+ ]
1713
+ }
1714
+ }
1715
+ ]
1716
+ },
1717
+ "requestCert": {
1718
+ "type": "boolean"
1719
+ },
1720
+ "rejectUnauthorized": {
1721
+ "type": "boolean"
1722
+ }
1723
+ },
1724
+ "additionalProperties": false,
1725
+ "required": [
1726
+ "key",
1727
+ "cert"
1728
+ ]
1729
+ },
1619
1730
  "auth": {
1620
1731
  "type": "object",
1621
1732
  "properties": {
@@ -1931,6 +2042,22 @@
1931
2042
  "path": {
1932
2043
  "type": "string",
1933
2044
  "description": "The path to write the traces to. Only for file exporter."
2045
+ },
2046
+ "protocol": {
2047
+ "type": "string",
2048
+ "enum": [
2049
+ "http",
2050
+ "grpc"
2051
+ ],
2052
+ "description": "The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http."
2053
+ },
2054
+ "transport": {
2055
+ "type": "string",
2056
+ "enum": [
2057
+ "http",
2058
+ "grpc"
2059
+ ],
2060
+ "description": "Alias for protocol. Only for the otlp exporter. Defaults to http."
1934
2061
  }
1935
2062
  }
1936
2063
  },
@@ -1967,6 +2094,22 @@
1967
2094
  "path": {
1968
2095
  "type": "string",
1969
2096
  "description": "The path to write the traces to. Only for file exporter."
2097
+ },
2098
+ "protocol": {
2099
+ "type": "string",
2100
+ "enum": [
2101
+ "http",
2102
+ "grpc"
2103
+ ],
2104
+ "description": "The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http."
2105
+ },
2106
+ "transport": {
2107
+ "type": "string",
2108
+ "enum": [
2109
+ "http",
2110
+ "grpc"
2111
+ ],
2112
+ "description": "Alias for protocol. Only for the otlp exporter. Defaults to http."
1970
2113
  }
1971
2114
  }
1972
2115
  },