wattpm 3.59.0 → 3.60.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.
Files changed (3) hide show
  1. package/index.js +28 -2
  2. package/package.json +6 -6
  3. package/schema.json +157 -2
package/index.js CHANGED
@@ -20,6 +20,28 @@ import { version } from './lib/schema.js'
20
20
 
21
21
  export * from './lib/schema.js'
22
22
 
23
+ // Extract the -c/--config option from application command arguments, leaving
24
+ // all the other arguments for the application command itself
25
+ function extractConfigOption (args) {
26
+ const remaining = []
27
+ let config = null
28
+
29
+ for (let i = 0; i < args.length; i++) {
30
+ const arg = args[i]
31
+
32
+ if (arg === '-c' || arg === '--config') {
33
+ config = args[i + 1]
34
+ i++
35
+ } else if (arg.startsWith('--config=')) {
36
+ config = arg.slice('--config='.length)
37
+ } else {
38
+ remaining.push(arg)
39
+ }
40
+ }
41
+
42
+ return { config, remaining }
43
+ }
44
+
23
45
  export async function main () {
24
46
  updateGlobals({ executable: this.executableId })
25
47
 
@@ -75,6 +97,7 @@ export async function main () {
75
97
  let command
76
98
  const requestedCommand = unparsed[0] || 'help'
77
99
  let applicationCommandContext
100
+ let applicationCommandArgs
78
101
  switch (requestedCommand) {
79
102
  case 'build':
80
103
  command = buildCommand
@@ -144,11 +167,14 @@ export async function main () {
144
167
  break
145
168
  default:
146
169
  if (requestedCommand) {
147
- const applicationsCommands = await loadApplicationsCommands(this.executableName)
170
+ // Extract the -c/--config option, which selects the runtime configuration file
171
+ const { config: runtimeConfigFile, remaining } = extractConfigOption(unparsed.slice(1))
172
+ const applicationsCommands = await loadApplicationsCommands(this.executableName, runtimeConfigFile)
148
173
  const applicationCommand = applicationsCommands.commands[requestedCommand]
149
174
 
150
175
  if (applicationCommand) {
151
176
  applicationCommandContext = applicationsCommands.applications[requestedCommand]
177
+ applicationCommandArgs = remaining
152
178
  command = applicationCommand
153
179
  }
154
180
  }
@@ -168,7 +194,7 @@ export async function main () {
168
194
  if (applicationCommandContext) {
169
195
  const invocationCwd = process.cwd()
170
196
  process.chdir(applicationCommandContext.path)
171
- return command.call(this, logger, applicationCommandContext.config, unparsed.slice(1), {
197
+ return command.call(this, logger, applicationCommandContext.config, applicationCommandArgs, {
172
198
  application: applicationCommandContext,
173
199
  cwd: invocationCwd,
174
200
  colorette,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wattpm",
3
- "version": "3.59.0",
3
+ "version": "3.60.0",
4
4
  "description": "The Node.js Application Server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -30,10 +30,10 @@
30
30
  "pino-pretty": "^13.0.0",
31
31
  "split2": "^4.2.0",
32
32
  "table": "^6.8.2",
33
- "@platformatic/control": "3.59.0",
34
- "@platformatic/globals": "3.59.0",
35
- "@platformatic/runtime": "3.59.0",
36
- "@platformatic/foundation": "3.59.0"
33
+ "@platformatic/control": "3.60.0",
34
+ "@platformatic/globals": "3.60.0",
35
+ "@platformatic/foundation": "3.60.0",
36
+ "@platformatic/runtime": "3.60.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "cleaner-spec-reporter": "^0.5.0",
@@ -45,7 +45,7 @@
45
45
  "neostandard": "^0.12.0",
46
46
  "typescript": "^5.5.4",
47
47
  "undici": "^7.27.2",
48
- "@platformatic/node": "3.59.0"
48
+ "@platformatic/node": "3.60.0"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/wattpm/3.59.0.json",
2
+ "$id": "https://schemas.platformatic.dev/wattpm/3.60.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",
@@ -2211,6 +2211,115 @@
2211
2211
  },
2212
2212
  {
2213
2213
  "type": "string"
2214
+ },
2215
+ {
2216
+ "type": "object",
2217
+ "properties": {
2218
+ "enabled": {
2219
+ "anyOf": [
2220
+ {
2221
+ "type": "boolean"
2222
+ },
2223
+ {
2224
+ "type": "string"
2225
+ }
2226
+ ]
2227
+ },
2228
+ "hostname": {
2229
+ "type": "string"
2230
+ },
2231
+ "port": {
2232
+ "anyOf": [
2233
+ {
2234
+ "type": "integer"
2235
+ },
2236
+ {
2237
+ "type": "string"
2238
+ }
2239
+ ]
2240
+ },
2241
+ "readiness": {
2242
+ "anyOf": [
2243
+ {
2244
+ "type": "boolean"
2245
+ },
2246
+ {
2247
+ "type": "object",
2248
+ "properties": {
2249
+ "endpoint": {
2250
+ "type": "string"
2251
+ },
2252
+ "success": {
2253
+ "type": "object",
2254
+ "properties": {
2255
+ "statusCode": {
2256
+ "type": "number"
2257
+ },
2258
+ "body": {
2259
+ "type": "string"
2260
+ }
2261
+ },
2262
+ "additionalProperties": false
2263
+ },
2264
+ "fail": {
2265
+ "type": "object",
2266
+ "properties": {
2267
+ "statusCode": {
2268
+ "type": "number"
2269
+ },
2270
+ "body": {
2271
+ "type": "string"
2272
+ }
2273
+ },
2274
+ "additionalProperties": false
2275
+ }
2276
+ },
2277
+ "additionalProperties": false
2278
+ }
2279
+ ]
2280
+ },
2281
+ "liveness": {
2282
+ "anyOf": [
2283
+ {
2284
+ "type": "boolean"
2285
+ },
2286
+ {
2287
+ "type": "object",
2288
+ "properties": {
2289
+ "endpoint": {
2290
+ "type": "string"
2291
+ },
2292
+ "success": {
2293
+ "type": "object",
2294
+ "properties": {
2295
+ "statusCode": {
2296
+ "type": "number"
2297
+ },
2298
+ "body": {
2299
+ "type": "string"
2300
+ }
2301
+ },
2302
+ "additionalProperties": false
2303
+ },
2304
+ "fail": {
2305
+ "type": "object",
2306
+ "properties": {
2307
+ "statusCode": {
2308
+ "type": "number"
2309
+ },
2310
+ "body": {
2311
+ "type": "string"
2312
+ }
2313
+ },
2314
+ "additionalProperties": false
2315
+ }
2316
+ },
2317
+ "additionalProperties": false
2318
+ }
2319
+ ]
2320
+ }
2321
+ },
2322
+ "additionalProperties": false
2214
2323
  }
2215
2324
  ],
2216
2325
  "default": true
@@ -2687,7 +2796,9 @@
2687
2796
  "type": "string"
2688
2797
  }
2689
2798
  ],
2690
- "default": 5000
2799
+ "default": 5000,
2800
+ "deprecated": true,
2801
+ "description": "Deprecated. Health probe timeout configuration is no longer used."
2691
2802
  },
2692
2803
  "plugins": {
2693
2804
  "type": "array",
@@ -2763,6 +2874,50 @@
2763
2874
  ],
2764
2875
  "additionalProperties": false
2765
2876
  },
2877
+ "opentelemetry": {
2878
+ "type": "object",
2879
+ "description": "Configuration for forwarding user OpenTelemetry metrics to an OTLP endpoint",
2880
+ "properties": {
2881
+ "enabled": {
2882
+ "anyOf": [
2883
+ {
2884
+ "type": "boolean"
2885
+ },
2886
+ {
2887
+ "type": "string"
2888
+ }
2889
+ ],
2890
+ "description": "Enable or disable OpenTelemetry metrics forwarding"
2891
+ },
2892
+ "endpoint": {
2893
+ "type": "string",
2894
+ "description": "OTLP metrics endpoint URL (e.g., http://collector:4318/v1/metrics)"
2895
+ },
2896
+ "interval": {
2897
+ "anyOf": [
2898
+ {
2899
+ "type": "integer"
2900
+ },
2901
+ {
2902
+ "type": "string"
2903
+ }
2904
+ ],
2905
+ "default": 60000,
2906
+ "description": "Interval in milliseconds between metric forwards"
2907
+ },
2908
+ "headers": {
2909
+ "type": "object",
2910
+ "additionalProperties": {
2911
+ "type": "string"
2912
+ },
2913
+ "description": "Additional HTTP headers for authentication"
2914
+ }
2915
+ },
2916
+ "required": [
2917
+ "endpoint"
2918
+ ],
2919
+ "additionalProperties": false
2920
+ },
2766
2921
  "httpCustomLabels": {
2767
2922
  "type": "array",
2768
2923
  "description": "Custom labels to add to HTTP metrics (http_request_all_duration_seconds). Each label extracts its value from an HTTP request header.",