@platformatic/nest 3.25.0 → 3.27.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
@@ -525,6 +525,62 @@ export interface PlatformaticNestJSConfig {
525
525
  [k: string]: string | [string, ...string[]];
526
526
  };
527
527
  };
528
+ application?: {
529
+ reuseTcpPorts?: boolean;
530
+ workers?:
531
+ | number
532
+ | string
533
+ | {
534
+ static?: number;
535
+ minimum?: number;
536
+ maximum?: number;
537
+ [k: string]: unknown;
538
+ };
539
+ health?: {
540
+ enabled?: boolean | string;
541
+ interval?: number | string;
542
+ gracePeriod?: number | string;
543
+ maxUnhealthyChecks?: number | string;
544
+ maxELU?: number | string;
545
+ maxHeapUsed?: number | string;
546
+ maxHeapTotal?: number | string;
547
+ maxYoungGeneration?: number | string;
548
+ codeRangeSize?: number | string;
549
+ };
550
+ arguments?: string[];
551
+ env?: {
552
+ [k: string]: string;
553
+ };
554
+ envfile?: string;
555
+ sourceMaps?: boolean;
556
+ packageManager?: "npm" | "pnpm" | "yarn";
557
+ preload?: string | string[];
558
+ nodeOptions?: string;
559
+ execArgv?: string[];
560
+ permissions?: {
561
+ fs?: {
562
+ read?: string[];
563
+ write?: string[];
564
+ };
565
+ };
566
+ telemetry?: {
567
+ /**
568
+ * An array of instrumentations loaded if telemetry is enabled
569
+ */
570
+ instrumentations?: (
571
+ | string
572
+ | {
573
+ package: string;
574
+ exportName?: string;
575
+ options?: {
576
+ [k: string]: unknown;
577
+ };
578
+ [k: string]: unknown;
579
+ }
580
+ )[];
581
+ [k: string]: unknown;
582
+ };
583
+ };
528
584
  };
529
585
  nest?: {
530
586
  adapter?: "express" | "fastify";
package/lib/capability.js CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  ensureTrailingSlash,
6
6
  errors,
7
7
  getServerUrl,
8
- importFile,
9
- resolvePackage
8
+ importFile
10
9
  } from '@platformatic/basic'
10
+ import { resolvePackageViaCJS } from '@platformatic/basic/lib/utils.js'
11
11
  import getPort from 'get-port'
12
12
  import inject from 'light-my-request'
13
13
  import { readFile } from 'node:fs/promises'
@@ -37,7 +37,7 @@ export class NestCapability extends BaseCapability {
37
37
  const config = this.config
38
38
 
39
39
  this.#isFastify = config.nest.adapter === 'fastify'
40
- this.#nestjsCore = resolve(resolvePackage(this.root, '@nestjs/core'))
40
+ this.#nestjsCore = resolve(await resolvePackageViaCJS(this.root, '@nestjs/core'))
41
41
  // As @nest/cli is not exporting any file, we assume it's in the same folder of @nestjs/core.
42
42
  this.#nestjsCli = resolve(this.#nestjsCore, '../../cli/bin/nest.js')
43
43
 
@@ -244,7 +244,7 @@ export class NestCapability extends BaseCapability {
244
244
  this.logger.debug(`Using NestJS adapter ${toImport}.`)
245
245
 
246
246
  try {
247
- adapter = await importFile(resolvePackage(this.root, toImport))
247
+ adapter = await importFile(await resolvePackageViaCJS(this.root, toImport))
248
248
  return adapter[this.#isFastify ? 'FastifyAdapter' : 'ExpressAdapter']
249
249
  } catch (e) {
250
250
  throw new Error(`Cannot import the NestJS adapter. Please add ${toImport} to the dependencies and try again.`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/nest",
3
- "version": "3.25.0",
3
+ "version": "3.27.0",
4
4
  "description": "Platformatic Nest.js Capability",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,9 +18,9 @@
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.25.0",
22
- "@platformatic/generators": "3.25.0",
23
- "@platformatic/foundation": "3.25.0"
21
+ "@platformatic/basic": "3.27.0",
22
+ "@platformatic/foundation": "3.27.0",
23
+ "@platformatic/generators": "3.27.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@nestjs/cli": "^11.0.7",
@@ -33,8 +33,8 @@
33
33
  "neostandard": "^0.12.0",
34
34
  "tsx": "^4.19.0",
35
35
  "typescript": "^5.5.4",
36
- "@platformatic/gateway": "3.25.0",
37
- "@platformatic/service": "3.25.0"
36
+ "@platformatic/gateway": "3.27.0",
37
+ "@platformatic/service": "3.27.0"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/nest/3.25.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/nest/3.27.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic NestJS Config",
5
5
  "type": "object",
@@ -619,6 +619,12 @@
619
619
  "nodeOptions": {
620
620
  "type": "string"
621
621
  },
622
+ "execArgv": {
623
+ "type": "array",
624
+ "items": {
625
+ "type": "string"
626
+ }
627
+ },
622
628
  "permissions": {
623
629
  "type": "object",
624
630
  "properties": {
@@ -1926,6 +1932,258 @@
1926
1932
  "deny"
1927
1933
  ],
1928
1934
  "additionalProperties": false
1935
+ },
1936
+ "application": {
1937
+ "type": "object",
1938
+ "properties": {
1939
+ "reuseTcpPorts": {
1940
+ "type": "boolean",
1941
+ "default": true
1942
+ },
1943
+ "workers": {
1944
+ "anyOf": [
1945
+ {
1946
+ "type": "number"
1947
+ },
1948
+ {
1949
+ "type": "string"
1950
+ },
1951
+ {
1952
+ "type": "object",
1953
+ "properties": {
1954
+ "static": {
1955
+ "type": "number",
1956
+ "minimum": 1
1957
+ },
1958
+ "minimum": {
1959
+ "type": "number",
1960
+ "minimum": 1
1961
+ },
1962
+ "maximum": {
1963
+ "type": "number",
1964
+ "minimum": 0
1965
+ }
1966
+ }
1967
+ }
1968
+ ]
1969
+ },
1970
+ "health": {
1971
+ "type": "object",
1972
+ "default": {},
1973
+ "properties": {
1974
+ "enabled": {
1975
+ "anyOf": [
1976
+ {
1977
+ "type": "boolean"
1978
+ },
1979
+ {
1980
+ "type": "string"
1981
+ }
1982
+ ]
1983
+ },
1984
+ "interval": {
1985
+ "anyOf": [
1986
+ {
1987
+ "type": "number",
1988
+ "minimum": 0
1989
+ },
1990
+ {
1991
+ "type": "string"
1992
+ }
1993
+ ]
1994
+ },
1995
+ "gracePeriod": {
1996
+ "anyOf": [
1997
+ {
1998
+ "type": "number",
1999
+ "minimum": 0
2000
+ },
2001
+ {
2002
+ "type": "string"
2003
+ }
2004
+ ]
2005
+ },
2006
+ "maxUnhealthyChecks": {
2007
+ "anyOf": [
2008
+ {
2009
+ "type": "number",
2010
+ "minimum": 1
2011
+ },
2012
+ {
2013
+ "type": "string"
2014
+ }
2015
+ ]
2016
+ },
2017
+ "maxELU": {
2018
+ "anyOf": [
2019
+ {
2020
+ "type": "number",
2021
+ "minimum": 0,
2022
+ "maximum": 1
2023
+ },
2024
+ {
2025
+ "type": "string"
2026
+ }
2027
+ ]
2028
+ },
2029
+ "maxHeapUsed": {
2030
+ "anyOf": [
2031
+ {
2032
+ "type": "number",
2033
+ "minimum": 0,
2034
+ "maximum": 1
2035
+ },
2036
+ {
2037
+ "type": "string"
2038
+ }
2039
+ ]
2040
+ },
2041
+ "maxHeapTotal": {
2042
+ "anyOf": [
2043
+ {
2044
+ "type": "number",
2045
+ "minimum": 0
2046
+ },
2047
+ {
2048
+ "type": "string"
2049
+ }
2050
+ ]
2051
+ },
2052
+ "maxYoungGeneration": {
2053
+ "anyOf": [
2054
+ {
2055
+ "type": "number",
2056
+ "minimum": 0
2057
+ },
2058
+ {
2059
+ "type": "string"
2060
+ }
2061
+ ]
2062
+ },
2063
+ "codeRangeSize": {
2064
+ "anyOf": [
2065
+ {
2066
+ "type": "number",
2067
+ "minimum": 0
2068
+ },
2069
+ {
2070
+ "type": "string"
2071
+ }
2072
+ ]
2073
+ }
2074
+ },
2075
+ "additionalProperties": false
2076
+ },
2077
+ "arguments": {
2078
+ "type": "array",
2079
+ "items": {
2080
+ "type": "string"
2081
+ }
2082
+ },
2083
+ "env": {
2084
+ "type": "object",
2085
+ "additionalProperties": {
2086
+ "type": "string"
2087
+ }
2088
+ },
2089
+ "envfile": {
2090
+ "type": "string"
2091
+ },
2092
+ "sourceMaps": {
2093
+ "type": "boolean"
2094
+ },
2095
+ "packageManager": {
2096
+ "type": "string",
2097
+ "enum": [
2098
+ "npm",
2099
+ "pnpm",
2100
+ "yarn"
2101
+ ]
2102
+ },
2103
+ "preload": {
2104
+ "anyOf": [
2105
+ {
2106
+ "type": "string",
2107
+ "resolvePath": true
2108
+ },
2109
+ {
2110
+ "type": "array",
2111
+ "items": {
2112
+ "type": "string",
2113
+ "resolvePath": true
2114
+ }
2115
+ }
2116
+ ]
2117
+ },
2118
+ "nodeOptions": {
2119
+ "type": "string"
2120
+ },
2121
+ "execArgv": {
2122
+ "type": "array",
2123
+ "items": {
2124
+ "type": "string"
2125
+ }
2126
+ },
2127
+ "permissions": {
2128
+ "type": "object",
2129
+ "properties": {
2130
+ "fs": {
2131
+ "type": "object",
2132
+ "properties": {
2133
+ "read": {
2134
+ "type": "array",
2135
+ "items": {
2136
+ "type": "string"
2137
+ }
2138
+ },
2139
+ "write": {
2140
+ "type": "array",
2141
+ "items": {
2142
+ "type": "string"
2143
+ }
2144
+ }
2145
+ },
2146
+ "additionalProperties": false
2147
+ }
2148
+ },
2149
+ "additionalProperties": false
2150
+ },
2151
+ "telemetry": {
2152
+ "type": "object",
2153
+ "properties": {
2154
+ "instrumentations": {
2155
+ "type": "array",
2156
+ "description": "An array of instrumentations loaded if telemetry is enabled",
2157
+ "items": {
2158
+ "oneOf": [
2159
+ {
2160
+ "type": "string"
2161
+ },
2162
+ {
2163
+ "type": "object",
2164
+ "properties": {
2165
+ "package": {
2166
+ "type": "string"
2167
+ },
2168
+ "exportName": {
2169
+ "type": "string"
2170
+ },
2171
+ "options": {
2172
+ "type": "object",
2173
+ "additionalProperties": true
2174
+ }
2175
+ },
2176
+ "required": [
2177
+ "package"
2178
+ ]
2179
+ }
2180
+ ]
2181
+ }
2182
+ }
2183
+ }
2184
+ }
2185
+ },
2186
+ "additionalProperties": false
1929
2187
  }
1930
2188
  },
1931
2189
  "additionalProperties": false