@platformatic/runtime 0.33.0 → 0.33.1

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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://platformatic.dev/schemas/v0.33.0/runtime",
3
+ "entrypoint": "serviceApp",
4
+ "allowCycles": true,
5
+ "hotReload": "{PLT_HOT_RELOAD}",
6
+ "autoload": {
7
+ "path": "../monorepo",
8
+ "exclude": ["docs", "composerApp"],
9
+ "mappings": {
10
+ "serviceAppWithLogger": {
11
+ "id": "with-logger",
12
+ "config": "platformatic.service.json"
13
+ },
14
+ "serviceAppWithMultiplePlugins": {
15
+ "id": "multi-plugin-service",
16
+ "config": "platformatic.service.json"
17
+ }
18
+ }
19
+ }
20
+ }
package/lib/config.js CHANGED
@@ -222,6 +222,12 @@ platformaticRuntime.configType = 'runtime'
222
222
  platformaticRuntime.configManagerConfig = {
223
223
  schema,
224
224
  allowToWatch: ['.env'],
225
+ schemaOptions: {
226
+ useDefaults: true,
227
+ coerceTypes: true,
228
+ allErrors: true,
229
+ strict: false
230
+ },
225
231
  async transformConfig () {
226
232
  await _transformConfig(this)
227
233
  }
@@ -243,7 +249,16 @@ async function wrapConfigInRuntimeConfig ({ configManager, args }) {
243
249
  }
244
250
  ]
245
251
  }
246
- const cm = new ConfigManager({ source: wrapperConfig, schema })
252
+ const cm = new ConfigManager({
253
+ source: wrapperConfig,
254
+ schema,
255
+ schemaOptions: {
256
+ useDefaults: true,
257
+ coerceTypes: true,
258
+ allErrors: true,
259
+ strict: false
260
+ }
261
+ })
247
262
 
248
263
  await _transformConfig(cm)
249
264
  await cm.parseAndValidate()
package/lib/schema.js CHANGED
@@ -47,7 +47,6 @@ const platformaticRuntimeSchema = {
47
47
  services: {
48
48
  type: 'array',
49
49
  default: [],
50
- minItems: 1,
51
50
  items: {
52
51
  type: 'object',
53
52
  required: ['id', 'path', 'config'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -24,8 +24,8 @@
24
24
  "standard": "^17.1.0",
25
25
  "tsd": "^0.28.1",
26
26
  "typescript": "^5.1.6",
27
- "@platformatic/sql-graphql": "0.33.0",
28
- "@platformatic/sql-mapper": "0.33.0"
27
+ "@platformatic/sql-graphql": "0.33.1",
28
+ "@platformatic/sql-mapper": "0.33.1"
29
29
  },
30
30
  "dependencies": {
31
31
  "@hapi/topo": "^6.0.2",
@@ -42,12 +42,12 @@
42
42
  "pino": "^8.14.1",
43
43
  "pino-pretty": "^10.0.0",
44
44
  "undici": "^5.22.1",
45
- "@platformatic/composer": "0.33.0",
46
- "@platformatic/config": "0.33.0",
47
- "@platformatic/db": "0.33.0",
48
- "@platformatic/service": "0.33.0",
49
- "@platformatic/telemetry": "0.33.0",
50
- "@platformatic/utils": "0.33.0"
45
+ "@platformatic/composer": "0.33.1",
46
+ "@platformatic/config": "0.33.1",
47
+ "@platformatic/db": "0.33.1",
48
+ "@platformatic/service": "0.33.1",
49
+ "@platformatic/telemetry": "0.33.1",
50
+ "@platformatic/utils": "0.33.1"
51
51
  },
52
52
  "standard": {
53
53
  "ignore": [
@@ -3,7 +3,7 @@
3
3
  const assert = require('node:assert')
4
4
  const { join } = require('node:path')
5
5
  const { test } = require('node:test')
6
- const { loadConfig } = require('@platformatic/service')
6
+ const { loadConfig, platformaticService } = require('@platformatic/service')
7
7
  const { parseInspectorOptions, platformaticRuntime } = require('../lib/config')
8
8
  const fixturesDir = join(__dirname, '..', 'fixtures')
9
9
 
@@ -209,3 +209,21 @@ test('parseInspectorOptions()', async (t) => {
209
209
  assert.strictEqual(cm.current.inspectorOptions.port, 65535)
210
210
  })
211
211
  })
212
+
213
+ test('same schemaOptions as platformatic service', async () => {
214
+ assert.deepStrictEqual(platformaticRuntime.schemaOptions, platformaticService.schemaOptions)
215
+ })
216
+
217
+ test('correctly loads the hotReload value from a string', async () => {
218
+ const configFile = join(fixturesDir, 'configs', 'monorepo-hotreload-env.json')
219
+ process.env.PLT_HOT_RELOAD = 'true'
220
+ const loaded = await loadConfig({}, ['-c', configFile], platformaticRuntime)
221
+ assert.strictEqual(loaded.configManager.current.hotReload, true)
222
+ })
223
+
224
+ test('correctly loads the hotReload value from a string', async () => {
225
+ const configFile = join(fixturesDir, 'configs', 'monorepo-hotreload-env.json')
226
+ process.env.PLT_HOT_RELOAD = 'false'
227
+ const loaded = await loadConfig({}, ['-c', configFile], platformaticRuntime)
228
+ assert.strictEqual(loaded.configManager.current.hotReload, false)
229
+ })