@travetto/config 4.1.1 → 5.0.0-rc.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 ArcSine Technologies
3
+ Copyright (c) 2023 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install @travetto/config
13
13
  yarn add @travetto/config
14
14
  ```
15
15
 
16
- The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [YAML](https://github.com/travetto/travetto/tree/main/module/yaml#readme "Simple YAML support, provides only clean subset of yaml"). Additionally, the configuration is built upon the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") module, to enforce type correctness, and allow for validation of configuration as an entrypoint into the application. Given that all [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) classes are [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14)-based classes, all the standard [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14) and [@Field](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L31) functionality applies.
16
+ The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [yaml](https://github.com/eemeli/yaml). Additionally, the configuration is built upon the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") module, to enforce type correctness, and allow for validation of configuration as an entrypoint into the application. Given that all [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) classes are [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14)-based classes, all the standard [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14) and [@Field](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L31) functionality applies.
17
17
 
18
18
  ## Resolution
19
19
  The configuration information is comprised of:
@@ -76,6 +76,11 @@ Config {
76
76
  {
77
77
  priority: 100,
78
78
  source: 'file://application',
79
+ detail: 'resources/application.yaml'
80
+ },
81
+ {
82
+ priority: 101,
83
+ source: 'file://application',
79
84
  detail: 'module/config/doc/resources/application.yml'
80
85
  },
81
86
  {
@@ -229,6 +234,11 @@ Config {
229
234
  {
230
235
  priority: 100,
231
236
  source: 'file://application',
237
+ detail: 'resources/application.yaml'
238
+ },
239
+ {
240
+ priority: 101,
241
+ source: 'file://application',
232
242
  detail: 'module/config/doc/resources/application.yml'
233
243
  },
234
244
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/config",
3
- "version": "4.1.1",
3
+ "version": "5.0.0-rc.0",
4
4
  "description": "Configuration support",
5
5
  "keywords": [
6
6
  "yaml",
@@ -26,9 +26,9 @@
26
26
  "directory": "module/config"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/di": "^4.1.1",
30
- "@travetto/schema": "^4.1.1",
31
- "@travetto/yaml": "^4.1.1"
29
+ "@travetto/di": "^5.0.0-rc.0",
30
+ "@travetto/schema": "^5.0.0-rc.0",
31
+ "yaml": "^2.4.5"
32
32
  },
33
33
  "travetto": {
34
34
  "displayName": "Configuration"
@@ -1,8 +1,8 @@
1
1
  import fs from 'node:fs/promises';
2
+ import path from 'node:path';
2
3
 
3
4
  import { DependencyRegistry, Injectable } from '@travetto/di';
4
5
  import { AppError } from '@travetto/base';
5
- import { path } from '@travetto/manifest';
6
6
 
7
7
  import { ConfigParserTarget } from '../internal/types';
8
8
  import { ConfigData, ConfigParser } from './types';
@@ -1,10 +1,10 @@
1
1
  import { Injectable } from '@travetto/di';
2
- import { YamlUtil } from '@travetto/yaml';
2
+ import { parse as parseYaml } from 'yaml';
3
3
 
4
4
  import { ConfigParser } from './types';
5
5
 
6
6
  @Injectable()
7
7
  export class YAMLConfigParser implements ConfigParser {
8
8
  ext = ['.yaml', '.yml'];
9
- parse = YamlUtil.parse;
9
+ parse = parseYaml;
10
10
  }
package/src/service.ts CHANGED
@@ -64,7 +64,7 @@ export class ConfigurationService {
64
64
 
65
65
  const specs = possible
66
66
  .flat()
67
- .filter((x): x is Exclude<typeof x, undefined> => !!x)
67
+ .filter(x => !!x)
68
68
  .sort((a, b) => a.priority - b.priority);
69
69
 
70
70
  for (const spec of specs) {
@@ -1,7 +1,8 @@
1
1
  import fs from 'node:fs/promises';
2
+ import path from 'node:path';
2
3
 
3
4
  import { Env, RuntimeResources } from '@travetto/base';
4
- import { RuntimeContext, path } from '@travetto/manifest';
5
+ import { RuntimeContext } from '@travetto/manifest';
5
6
 
6
7
  import { ConfigSource, ConfigSpec } from './types';
7
8
  import { ParserManager } from '../parser/parser';