@platformatic/tanstack 3.57.0 → 3.59.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 PlatformaticTanStackConfig {
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 PlatformaticTanStackConfig {
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;
package/lib/capability.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ buildAdditionalServerOptions,
2
3
  cleanBasePath,
3
4
  createServerListener,
4
5
  ensureTrailingSlash,
@@ -7,6 +8,7 @@ import {
7
8
  importFile,
8
9
  resolvePackageViaESM
9
10
  } from '@platformatic/basic'
11
+ import { sanitizeHTTPSOptions } from '@platformatic/foundation'
10
12
  import { ViteCapability } from '@platformatic/vite'
11
13
  import inject from 'light-my-request'
12
14
  import { readFile } from 'node:fs/promises'
@@ -82,10 +84,27 @@ export class TanstackCapability extends ViteCapability {
82
84
  const serverPromise = createServerListener(
83
85
  serverOptions?.port ?? true,
84
86
  serverOptions?.hostname ?? true,
85
- typeof serverOptions?.backlog === 'number' ? { backlog: serverOptions.backlog } : {}
87
+ await buildAdditionalServerOptions(serverOptions)
86
88
  )
87
89
 
88
- await importFile(resolve(outputDirectory, 'server/index.mjs'))
90
+ const httpsOptions = await sanitizeHTTPSOptions(serverOptions?.https)
91
+
92
+ if (!httpsOptions?.cert && !httpsOptions?.key) {
93
+ await this.#importProductionNitro(outputDirectory)
94
+ } else {
95
+ const originalCert = process.env.NITRO_SSL_CERT
96
+ const originalKey = process.env.NITRO_SSL_KEY
97
+
98
+ process.env.NITRO_SSL_CERT = this.#serializeCertificateValue(httpsOptions.cert)
99
+ process.env.NITRO_SSL_KEY = this.#serializeCertificateValue(httpsOptions.key)
100
+
101
+ try {
102
+ await this.#importProductionNitro(outputDirectory)
103
+ } finally {
104
+ this.#restoreEnvironmentVariables('NITRO_SSL_CERT', originalCert)
105
+ this.#restoreEnvironmentVariables('NITRO_SSL_KEY', originalKey)
106
+ }
107
+ }
89
108
 
90
109
  this.#server = await serverPromise
91
110
  this.#dispatcher = this.#server.listeners('request')[0]
@@ -128,4 +147,24 @@ export class TanstackCapability extends ViteCapability {
128
147
  const { statusCode, headers, body, payload, rawPayload } = res
129
148
  return { statusCode, headers, body, payload, rawPayload }
130
149
  }
150
+
151
+ #importProductionNitro (outputDirectory) {
152
+ return importFile(resolve(outputDirectory, 'server/index.mjs'))
153
+ }
154
+
155
+ #serializeCertificateValue (value) {
156
+ if (Array.isArray(value)) {
157
+ return value.map(item => item.toString()).join('\n')
158
+ }
159
+
160
+ return value.toString()
161
+ }
162
+
163
+ #restoreEnvironmentVariables (key, originalValue) {
164
+ if (typeof originalValue === 'undefined') {
165
+ delete process.env[key]
166
+ } else {
167
+ process.env[key] = originalValue
168
+ }
169
+ }
131
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/tanstack",
3
- "version": "3.57.0",
3
+ "version": "3.59.0",
4
4
  "description": "Platformatic TanStack Capability",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,10 +16,10 @@
16
16
  "homepage": "https://github.com/platformatic/platformatic#readme",
17
17
  "dependencies": {
18
18
  "semver": "^7.6.3",
19
- "@platformatic/foundation": "3.57.0",
20
- "@platformatic/basic": "3.57.0",
21
- "@platformatic/globals": "3.57.0",
22
- "@platformatic/vite": "3.57.0"
19
+ "@platformatic/basic": "3.59.0",
20
+ "@platformatic/globals": "3.59.0",
21
+ "@platformatic/vite": "3.59.0",
22
+ "@platformatic/foundation": "3.59.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@tanstack/react-router": "^1.139.7",
@@ -39,8 +39,8 @@
39
39
  "vite-plugin-solid": "^2.11.10",
40
40
  "vite-tsconfig-paths": "^5.1.4",
41
41
  "ws": "^8.18.0",
42
- "@platformatic/gateway": "3.57.0",
43
- "@platformatic/service": "3.57.0"
42
+ "@platformatic/gateway": "3.59.0",
43
+ "@platformatic/service": "3.59.0"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/tanstack/3.57.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/tanstack/3.59.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic TanStack Config",
5
5
  "type": "object",
@@ -444,6 +444,23 @@
444
444
  "id": {
445
445
  "type": "string"
446
446
  },
447
+ "enabled": {
448
+ "anyOf": [
449
+ {
450
+ "type": "boolean"
451
+ },
452
+ {
453
+ "type": "string"
454
+ },
455
+ {
456
+ "type": "object",
457
+ "additionalProperties": {
458
+ "type": "boolean"
459
+ }
460
+ }
461
+ ],
462
+ "default": true
463
+ },
447
464
  "path": {
448
465
  "type": "string",
449
466
  "allowEmptyPaths": true,
@@ -1183,7 +1200,14 @@
1183
1200
  },
1184
1201
  "exitOnUnhandledErrors": {
1185
1202
  "default": true,
1186
- "type": "boolean"
1203
+ "anyOf": [
1204
+ {
1205
+ "type": "boolean"
1206
+ },
1207
+ {
1208
+ "type": "number"
1209
+ }
1210
+ ]
1187
1211
  },
1188
1212
  "gracefulShutdown": {
1189
1213
  "type": "object",
@@ -1365,6 +1389,17 @@
1365
1389
  },
1366
1390
  "additionalProperties": false
1367
1391
  },
1392
+ "healthProbes": {
1393
+ "anyOf": [
1394
+ {
1395
+ "type": "boolean"
1396
+ },
1397
+ {
1398
+ "type": "string"
1399
+ }
1400
+ ],
1401
+ "default": true
1402
+ },
1368
1403
  "undici": {
1369
1404
  "type": "object",
1370
1405
  "properties": {