@platformatic/runtime 2.0.0-alpha.1 → 2.0.0-alpha.3

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 (170) hide show
  1. package/config.d.ts +285 -0
  2. package/eslint.config.js +8 -0
  3. package/fixtures/botched-start/platformatic.runtime.json +1 -1
  4. package/fixtures/botched-start/services/a/platformatic.service.json +1 -1
  5. package/fixtures/composerApp/platformatic.composer.json +1 -1
  6. package/fixtures/configs/invalid-autoload-with-services.json +1 -1
  7. package/fixtures/configs/invalid-entrypoint.json +1 -1
  8. package/fixtures/configs/invalid-schema-type.config.json +1 -1
  9. package/fixtures/configs/missing-property.config.json +1 -1
  10. package/fixtures/configs/missing-service-config.json +1 -1
  11. package/fixtures/configs/monorepo-composer-no-autoload.json +2 -2
  12. package/fixtures/configs/monorepo-composer.json +2 -2
  13. package/fixtures/configs/monorepo-create-cycle.json +2 -2
  14. package/fixtures/configs/monorepo-missing-dependencies.json +2 -2
  15. package/fixtures/configs/monorepo-no-cycles.json +2 -2
  16. package/fixtures/configs/monorepo-openapi.json +2 -2
  17. package/fixtures/configs/{monorepo-hotreload-env.json → monorepo-watch-env.json} +2 -2
  18. package/fixtures/configs/monorepo-watch-single.json +12 -0
  19. package/fixtures/configs/monorepo-watch.json +26 -9
  20. package/fixtures/configs/monorepo-with-dependencies.json +2 -2
  21. package/fixtures/configs/monorepo-with-management-api-without-metrics.json +21 -0
  22. package/fixtures/configs/monorepo-with-management-api.json +2 -2
  23. package/fixtures/configs/{monorepo-hotreload.json → monorepo-with-metrics.json} +5 -4
  24. package/fixtures/configs/monorepo.json +2 -2
  25. package/fixtures/configs/no-services.config.json +1 -1
  26. package/fixtures/configs/no-sources.config.json +1 -1
  27. package/fixtures/configs/service-throws-on-start.json +1 -1
  28. package/fixtures/configs/service-with-env-port.json +2 -2
  29. package/fixtures/configs/service-with-stdio.json +12 -0
  30. package/fixtures/configs/{hotreload.json → watch.json} +2 -2
  31. package/fixtures/dbApp/platformatic.db.json +1 -1
  32. package/fixtures/dbAppNoName/platformatic.db.json +1 -1
  33. package/fixtures/dbAppNoPackageJson/platformatic.db.json +1 -1
  34. package/fixtures/dbAppWithMigrationError/platformatic.db.json +1 -1
  35. package/fixtures/do-not-reload-dependencies/platformatic.service.json +1 -1
  36. package/fixtures/do-not-restart-on-crash/platformatic.runtime.json +3 -2
  37. package/fixtures/do-not-restart-on-crash/services/a/platformatic.service.json +1 -1
  38. package/fixtures/express/platformatic.runtime.json +1 -1
  39. package/fixtures/express/services/a/platformatic.service.json +1 -1
  40. package/fixtures/express/services/b/platformatic.service.json +1 -1
  41. package/fixtures/external-client/platformatic.service.json +1 -1
  42. package/fixtures/interceptors/idp.js +2 -2
  43. package/fixtures/interceptors/platformatic.runtime.json +1 -1
  44. package/fixtures/interceptors/services/a/platformatic.service.json +1 -1
  45. package/fixtures/interceptors-2/platformatic.runtime.json +1 -1
  46. package/fixtures/interceptors-2/services/a/platformatic.service.json +1 -1
  47. package/fixtures/leven/platformatic.runtime.json +2 -2
  48. package/fixtures/leven/services/deeply-spittle/platformatic.service.json +1 -1
  49. package/fixtures/leven/services/rainy-empire/platformatic.composer.json +1 -1
  50. package/fixtures/management-api/platformatic.json +3 -3
  51. package/fixtures/management-api/services/service-1/platformatic.json +1 -1
  52. package/fixtures/management-api/services/service-1/plugin.js +4 -3
  53. package/fixtures/management-api/services/service-2/platformatic.json +1 -1
  54. package/fixtures/management-api/services/service-db/platformatic.db.json +1 -1
  55. package/fixtures/management-api-custom-labels/platformatic.json +2 -2
  56. package/fixtures/management-api-custom-labels/services/service-1/platformatic.json +1 -1
  57. package/fixtures/management-api-custom-labels/services/service-1/plugin.js +4 -3
  58. package/fixtures/management-api-custom-labels/services/service-2/platformatic.json +1 -1
  59. package/fixtures/management-api-custom-labels/services/service-db/platformatic.db.json +1 -1
  60. package/fixtures/management-api-without-metrics/platformatic.json +3 -2
  61. package/fixtures/management-api-without-metrics/services/service-1/platformatic.json +1 -1
  62. package/fixtures/monorepo/composerApp/platformatic.composer.json +1 -1
  63. package/fixtures/monorepo/dbApp/platformatic.db.json +1 -1
  64. package/fixtures/monorepo/serviceApp/platformatic.service.json +3 -2
  65. package/fixtures/monorepo/serviceApp/with-logger/with-logger.cjs +2 -2
  66. package/fixtures/monorepo/serviceApp/with-logger/with-logger.d.ts +7 -7
  67. package/fixtures/monorepo/serviceAppWithLogger/platformatic.service.json +1 -1
  68. package/fixtures/monorepo/serviceAppWithLogger/plugin.js +12 -0
  69. package/fixtures/monorepo/serviceAppWithMultiplePlugins/platformatic.service.json +3 -2
  70. package/fixtures/monorepo-missing-dependencies/composer/platformatic.json +1 -1
  71. package/fixtures/monorepo-openapi/serviceAppWithoutOpenapi/platformatic.service.json +1 -1
  72. package/fixtures/monorepo-watch/service1/platformatic.service.json +1 -1
  73. package/fixtures/monorepo-with-dependencies/main/platformatic.json +1 -1
  74. package/fixtures/monorepo-with-dependencies/service-1/platformatic.json +1 -1
  75. package/fixtures/monorepo-with-dependencies/service-2/platformatic.json +1 -1
  76. package/fixtures/no-env.service.json +1 -1
  77. package/fixtures/preload/platformatic.runtime.json +1 -1
  78. package/fixtures/preload/services/a/platformatic.service.json +1 -1
  79. package/fixtures/prom-server/platformatic.json +2 -2
  80. package/fixtures/prom-server/services/service-1/platformatic.json +1 -1
  81. package/fixtures/prom-server/services/service-2/platformatic.json +1 -1
  82. package/fixtures/restart-on-crash/platformatic.runtime.json +1 -1
  83. package/fixtures/restart-on-crash/services/a/platformatic.service.json +1 -1
  84. package/fixtures/sample-runtime/package.json +1 -1
  85. package/fixtures/sample-runtime/platformatic.json +2 -2
  86. package/fixtures/sample-runtime/services/rival/package.json +1 -1
  87. package/fixtures/sample-runtime/services/rival/platformatic.json +1 -1
  88. package/fixtures/sample-runtime-with-2-services/package.json +1 -1
  89. package/fixtures/sample-runtime-with-2-services/platformatic.json +2 -2
  90. package/fixtures/sample-runtime-with-2-services/services/foobar/package.json +1 -1
  91. package/fixtures/sample-runtime-with-2-services/services/foobar/platformatic.json +1 -1
  92. package/fixtures/sample-runtime-with-2-services/services/rival/package.json +1 -1
  93. package/fixtures/sample-runtime-with-2-services/services/rival/platformatic.json +1 -1
  94. package/fixtures/server/logger-transport/platformatic.runtime.json +2 -2
  95. package/fixtures/server/logger-transport/services/echo/platformatic.service.json +1 -1
  96. package/fixtures/server/overrides-service/platformatic.runtime.json +2 -2
  97. package/fixtures/server/overrides-service/services/echo/platformatic.service.json +1 -1
  98. package/fixtures/server/runtime-server/platformatic.runtime.json +2 -2
  99. package/fixtures/server/runtime-server/services/echo/platformatic.service.json +1 -1
  100. package/fixtures/serviceAppThrowsOnStart/platformatic.service.json +1 -1
  101. package/fixtures/stackables/node_modules/foo/foo.js +2 -1
  102. package/fixtures/start-command-in-runtime.js +1 -1
  103. package/fixtures/stdio/platformatic.service.json +6 -0
  104. package/fixtures/stdio/plugin.js +24 -0
  105. package/fixtures/telemetry/platformatic.runtime.json +2 -2
  106. package/fixtures/telemetry/services/echo/platformatic.service.json +1 -1
  107. package/fixtures/typescript/platformatic.runtime.json +2 -2
  108. package/fixtures/typescript/services/composer/platformatic.composer.json +1 -1
  109. package/fixtures/typescript/services/movies/global.d.ts +2 -3
  110. package/fixtures/typescript/services/movies/platformatic.db.json +1 -1
  111. package/fixtures/typescript/services/movies/types/Movie.d.ts +3 -3
  112. package/fixtures/typescript/services/movies/types/index.d.ts +6 -6
  113. package/fixtures/typescript/services/titles/client/client.d.ts +35 -35
  114. package/fixtures/typescript/services/titles/platformatic.service.json +1 -1
  115. package/fixtures/typescript-custom-flags/platformatic.runtime.json +2 -2
  116. package/fixtures/typescript-custom-flags/services/composer/platformatic.composer.json +1 -1
  117. package/fixtures/typescript-custom-flags/services/movies/global.d.ts +2 -3
  118. package/fixtures/typescript-custom-flags/services/movies/platformatic.db.json +1 -1
  119. package/fixtures/typescript-custom-flags/services/movies/types/Movie.d.ts +3 -3
  120. package/fixtures/typescript-custom-flags/services/movies/types/index.d.ts +6 -6
  121. package/fixtures/typescript-custom-flags/services/titles/client/client.d.ts +35 -35
  122. package/fixtures/typescript-custom-flags/services/titles/platformatic.service.json +1 -1
  123. package/fixtures/typescript-no-env/platformatic.runtime.json +2 -2
  124. package/fixtures/typescript-no-env/services/composer/platformatic.composer.json +1 -1
  125. package/fixtures/typescript-no-env/services/movies/global.d.ts +2 -3
  126. package/fixtures/typescript-no-env/services/movies/platformatic.db.json +1 -1
  127. package/fixtures/typescript-no-env/services/movies/types/Movie.d.ts +3 -3
  128. package/fixtures/typescript-no-env/services/movies/types/index.d.ts +6 -6
  129. package/fixtures/typescript-no-env/services/titles/client/client.d.ts +35 -35
  130. package/fixtures/typescript-no-env/services/titles/platformatic.service.json +1 -1
  131. package/index.d.ts +7 -8
  132. package/index.js +14 -10
  133. package/index.test-d.ts +10 -12
  134. package/lib/build-server.js +5 -11
  135. package/lib/compile.js +11 -10
  136. package/lib/config.js +21 -14
  137. package/lib/dependencies.js +2 -1
  138. package/lib/errors.js +3 -2
  139. package/lib/generator/errors.js +1 -1
  140. package/lib/generator/runtime-generator.d.ts +15 -15
  141. package/lib/generator/runtime-generator.js +92 -63
  142. package/lib/logger.js +55 -0
  143. package/lib/management-api.js +29 -44
  144. package/lib/prom-server.js +5 -9
  145. package/lib/runtime.js +885 -0
  146. package/lib/schema.js +79 -76
  147. package/lib/start.js +35 -113
  148. package/lib/streams/message-port-writable.js +44 -0
  149. package/lib/streams/pino-writable.js +30 -0
  150. package/lib/upgrade.js +4 -3
  151. package/lib/utils.js +49 -1
  152. package/lib/versions/v1.36.0.js +1 -1
  153. package/lib/versions/v1.5.0.js +1 -1
  154. package/lib/versions/v2.0.0.js +17 -0
  155. package/lib/worker/app.js +224 -0
  156. package/lib/worker/default-stackable.js +27 -0
  157. package/lib/worker/itc.js +128 -0
  158. package/lib/worker/main.js +120 -0
  159. package/lib/worker/symbols.js +7 -0
  160. package/package.json +23 -25
  161. package/runtime.mjs +4 -4
  162. package/schema.json +824 -0
  163. package/lib/api-client.js +0 -500
  164. package/lib/api.js +0 -420
  165. package/lib/app.js +0 -397
  166. package/lib/load-config.js +0 -12
  167. package/lib/loader.mjs +0 -103
  168. package/lib/message-port-writable.js +0 -50
  169. package/lib/worker.js +0 -182
  170. /package/lib/{interceptors.js → worker/interceptors.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.30.0/db",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/db/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 3042
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.27.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": "{PORT}",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.20.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.22.0.json",
3
3
  "entrypoint": "a",
4
4
  "autoload": {
5
5
  "path": "./services"
@@ -10,5 +10,6 @@
10
10
  "logger": {
11
11
  "level": "info"
12
12
  }
13
- }
13
+ },
14
+ "restartOnError": false
14
15
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "b",
4
4
  "autoload": {
5
5
  "path": "./services",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.35.1/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": "0",
@@ -10,7 +10,7 @@ async function start (opts) {
10
10
 
11
11
  const signSync = createSigner({
12
12
  key: 'secret',
13
- expiresIn: '1h'
13
+ expiresIn: '1h',
14
14
  })
15
15
 
16
16
  app.decorate('refreshToken', '')
@@ -28,7 +28,7 @@ async function start (opts) {
28
28
  port = app.server.address().port
29
29
 
30
30
  const refreshToken = signSync({
31
- iss: `http://localhost:${port}`
31
+ iss: `http://localhost:${port}`,
32
32
  })
33
33
 
34
34
  app.refreshToken = refreshToken
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.20.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "a",
4
4
  "autoload": {
5
5
  "path": "./services"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.20.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "a",
4
4
  "autoload": {
5
5
  "path": "./services"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.31.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "rainy-empire",
4
- "hotReload": true,
4
+ "watch": true,
5
5
  "autoload": {
6
6
  "path": "services",
7
7
  "exclude": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.31.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "{PLT_SERVER_HOSTNAME}",
5
5
  "port": "{PORT}",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.31.0/composer",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "{PLT_SERVER_HOSTNAME}",
5
5
  "port": "{PORT}",
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "service-1",
4
- "hotReload": false,
4
+ "watch": false,
5
5
  "autoload": {
6
6
  "path": "./services"
7
7
  },
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "managementApi": {
13
13
  "logs": {
14
- "maxSize": 15
14
+ "maxSize": 6
15
15
  }
16
16
  }
17
17
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -6,9 +6,10 @@ module.exports = async function (app) {
6
6
  return { service: 'service-2' }
7
7
  })
8
8
 
9
- app.get('/large-logs', async (req) => {
10
- const largeLog = 'a'.repeat(100)
11
- for (let i = 0; i < 500000; i++) {
9
+ // 10 MB total
10
+ app.get('/large-logs', async req => {
11
+ const largeLog = 'a'.repeat(1000)
12
+ for (let i = 0; i < 10000; i++) {
12
13
  app.log.trace(largeLog)
13
14
  }
14
15
  })
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.22.0/db",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/db/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "service-1",
4
- "hotReload": false,
4
+ "watch": false,
5
5
  "autoload": {
6
6
  "path": "./services"
7
7
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -6,9 +6,10 @@ module.exports = async function (app) {
6
6
  return { service: 'service-2' }
7
7
  })
8
8
 
9
- app.get('/large-logs', async (req) => {
10
- const largeLog = 'a'.repeat(100)
11
- for (let i = 0; i < 500000; i++) {
9
+ // Total: 10 MB
10
+ app.get('/large-logs', async req => {
11
+ const largeLog = 'a'.repeat(1000)
12
+ for (let i = 0; i < 10000; i++) {
12
13
  app.log.trace(largeLog)
13
14
  }
14
15
  })
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.22.0/db",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/db/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "service-1",
4
- "hotReload": false,
4
+ "watch": false,
5
5
  "autoload": {
6
6
  "path": "./services"
7
7
  },
@@ -9,5 +9,6 @@
9
9
  "hostname": "127.0.0.1",
10
10
  "port": 0
11
11
  },
12
+ "metrics": false,
12
13
  "managementApi": true
13
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.23.2/composer",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.22.0/db",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/db/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.20.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -18,5 +18,6 @@
18
18
  "path": "./with-logger",
19
19
  "url": "{PLT_WITH_LOGGER_URL}"
20
20
  }
21
- ]
21
+ ],
22
+ "watch": { "enabled": true }
22
23
  }
@@ -12,12 +12,12 @@ async function generateWithLoggerClientPlugin (app, opts) {
12
12
  type: 'openapi',
13
13
  name: 'withLogger',
14
14
  path: join(__dirname, 'with-logger.openapi.json'),
15
- url: opts.url
15
+ url: opts.url,
16
16
  })
17
17
  }
18
18
 
19
19
  generateWithLoggerClientPlugin[Symbol.for('plugin-meta')] = {
20
- name: 'withLogger OpenAPI Client'
20
+ name: 'withLogger OpenAPI Client',
21
21
  }
22
22
  generateWithLoggerClientPlugin[Symbol.for('skip-override')] = true
23
23
 
@@ -14,15 +14,15 @@ type WithLoggerPlugin = FastifyPluginAsync<NonNullable<withLogger.WithLoggerOpti
14
14
 
15
15
  declare module 'fastify' {
16
16
  interface ConfigureWithLogger {
17
- async getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string,string>>;
17
+ getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string, string>>;
18
18
  }
19
19
  interface FastifyInstance {
20
- 'withLogger': WithLogger;
20
+ withLogger: WithLogger;
21
21
  configureWithLogger(opts: ConfigureWithLogger): unknown
22
22
  }
23
23
 
24
24
  interface FastifyRequest {
25
- 'withLogger': WithLogger;
25
+ withLogger: WithLogger;
26
26
  }
27
27
  }
28
28
 
@@ -30,9 +30,9 @@ declare namespace withLogger {
30
30
  export interface WithLoggerOptions {
31
31
  url: string
32
32
  }
33
- export const withLogger: WithLoggerPlugin;
34
- export { withLogger as default };
33
+ export const withLogger: WithLoggerPlugin
34
+ export { withLogger as default }
35
35
  }
36
36
 
37
- declare function withLogger(...params: Parameters<WithLoggerPlugin>): ReturnType<WithLoggerPlugin>;
38
- export = withLogger;
37
+ declare function withLogger (...params: Parameters<WithLoggerPlugin>): ReturnType<WithLoggerPlugin>
38
+ export = withLogger
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.20.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -5,4 +5,16 @@ module.exports = async function (app) {
5
5
  app.get('/', async () => {
6
6
  return { hello: 'world' }
7
7
  })
8
+
9
+ let crashOnClose = false
10
+ app.get('/crash-on-close', { schema: { hide: true } }, async () => {
11
+ crashOnClose = true
12
+ })
13
+
14
+ app.addHook('onClose', async () => {
15
+ if (crashOnClose) {
16
+ app.log.info('Crashing process on purpose')
17
+ throw new Error('Crashing process on purpose')
18
+ }
19
+ })
8
20
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.20.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -23,5 +23,6 @@
23
23
  }
24
24
  ]
25
25
  },
26
- "metrics": false
26
+ "metrics": false,
27
+ "watch": true
27
28
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.23.2/composer",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.20.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.20.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.44.0/composer",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.44.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.44.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "127.0.0.1",
5
5
  "port": 0,
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v0.31.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "hostname": "{PLT_SERVER_HOSTNAME}",
5
5
  "port": "{PORT}",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.20.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "a",
4
4
  "preload": "preload.js",
5
5
  "autoload": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "service-1",
4
- "hotReload": false,
4
+ "watch": false,
5
5
  "autoload": {
6
6
  "path": "./services"
7
7
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.22.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.36.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "a",
4
4
  "autoload": {
5
5
  "path": "./services"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.3.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "warn"
@@ -11,6 +11,6 @@
11
11
  "@fastify/oauth2": "7.9.0"
12
12
  },
13
13
  "engines": {
14
- "node": "^18.8.0 || >=20.6.0"
14
+ "node": ">=20.16.0"
15
15
  }
16
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.25.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "rival",
4
- "hotReload": true,
4
+ "watch": true,
5
5
  "autoload": {
6
6
  "path": "services",
7
7
  "exclude": [
@@ -11,6 +11,6 @@
11
11
  "@platformatic/service": "^1.25.0"
12
12
  },
13
13
  "engines": {
14
- "node": "^18.8.0 || >=20.6.0"
14
+ "node": ">=20.16.0"
15
15
  }
16
16
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.25.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },
@@ -11,6 +11,6 @@
11
11
  "@fastify/oauth2": "7.9.0"
12
12
  },
13
13
  "engines": {
14
- "node": "^18.8.0 || >=20.6.0"
14
+ "node": ">=20.16.0"
15
15
  }
16
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.25.0/runtime",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
3
  "entrypoint": "rival",
4
- "hotReload": true,
4
+ "watch": true,
5
5
  "autoload": {
6
6
  "path": "services",
7
7
  "exclude": [
@@ -11,6 +11,6 @@
11
11
  "@platformatic/service": "^1.25.0"
12
12
  },
13
13
  "engines": {
14
- "node": "^18.8.0 || >=20.6.0"
14
+ "node": ">=20.16.0"
15
15
  }
16
16
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://platformatic.dev/schemas/v1.25.0/service",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
3
  "service": {
4
4
  "openapi": true
5
5
  },