@travetto/config
Advanced tools
Comparing version 3.4.4 to 4.0.0-rc.0
@@ -0,1 +1,2 @@ | ||
/// <reference path="./src/trv.d.ts" /> | ||
export * from './src/decorator'; | ||
@@ -2,0 +3,0 @@ export * from './src/service'; |
{ | ||
"name": "@travetto/config", | ||
"version": "3.4.4", | ||
"version": "4.0.0-rc.0", | ||
"description": "Configuration support", | ||
@@ -29,5 +29,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/di": "^3.4.2", | ||
"@travetto/schema": "^3.4.4", | ||
"@travetto/yaml": "^3.4.2" | ||
"@travetto/di": "^4.0.0-rc.0", | ||
"@travetto/schema": "^4.0.0-rc.0", | ||
"@travetto/yaml": "^4.0.0-rc.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "travetto": { |
@@ -120,4 +120,2 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
```typescript | ||
import { Env } from '@travetto/base'; | ||
import { ConfigSource, ConfigSpec } from './types'; | ||
@@ -139,6 +137,6 @@ | ||
try { | ||
const data = JSON.parse(Env.get(this.#envKey, '{}')); | ||
const data = JSON.parse(process.env[this.#envKey] || '{}'); | ||
return { data, priority: this.#priority, source: `env://${this.#envKey}` }; | ||
} catch (e) { | ||
console.error(`env.${this.#envKey} is an invalid format`, { text: Env.get(this.#envKey) }); | ||
console.error(`env.${this.#envKey} is an invalid format`, { text: process.env[this.#envKey] }); | ||
} | ||
@@ -145,0 +143,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import fs from 'fs/promises'; | ||
import fs from 'node:fs/promises'; | ||
@@ -3,0 +3,0 @@ import { DependencyRegistry, Injectable } from '@travetto/di'; |
export type ConfigData = Record<string, unknown>; | ||
/** | ||
* @concrete ../internal/types:ConfigParserTarget | ||
* @concrete ../internal/types#ConfigParserTarget | ||
*/ | ||
@@ -6,0 +6,0 @@ export interface ConfigParser { |
@@ -1,6 +0,6 @@ | ||
import util from 'util'; | ||
import util from 'node:util'; | ||
import { AppError, Class, ClassInstance, GlobalEnv, DataUtil } from '@travetto/base'; | ||
import { AppError, Class, ClassInstance, DataUtil, Env, RuntimeResources } from '@travetto/base'; | ||
import { DependencyRegistry, Injectable } from '@travetto/di'; | ||
import { RootIndex } from '@travetto/manifest'; | ||
import { RuntimeIndex, RuntimeContext } from '@travetto/manifest'; | ||
import { BindUtil, SchemaRegistry, SchemaValidator, ValidationResultError } from '@travetto/schema'; | ||
@@ -130,3 +130,3 @@ | ||
err.stack = err.stack?.replace(ogMessage, err.message); | ||
const file = RootIndex.getFunctionMetadata(cls)!.source; | ||
const file = RuntimeIndex.getFunctionMetadata(cls)!.source; | ||
err.payload = { class: cls.Ⲑid, file, ...(err.payload ?? {}) }; | ||
@@ -146,9 +146,21 @@ } | ||
util.inspect.defaultOptions.depth = 100; | ||
console.log('Initialized', { | ||
manifest: RootIndex.manifestDigest(), | ||
env: GlobalEnv.toJSON(), | ||
manifest: { | ||
main: RuntimeContext.main, | ||
workspace: RuntimeContext.workspace | ||
}, | ||
env: { | ||
name: Env.name, | ||
debug: Env.debug, | ||
production: Env.production, | ||
dynamic: Env.dynamic, | ||
resourcePaths: RuntimeResources.searchPaths, | ||
profiles: Env.TRV_PROFILES.list ?? [] | ||
}, | ||
config: await this.exportActive() | ||
}); | ||
util.inspect.defaultOptions.depth = og; | ||
} | ||
} |
@@ -1,3 +0,1 @@ | ||
import { Env } from '@travetto/base'; | ||
import { ConfigSource, ConfigSpec } from './types'; | ||
@@ -19,8 +17,8 @@ | ||
try { | ||
const data = JSON.parse(Env.get(this.#envKey, '{}')); | ||
const data = JSON.parse(process.env[this.#envKey] || '{}'); | ||
return { data, priority: this.#priority, source: `env://${this.#envKey}` }; | ||
} catch (e) { | ||
console.error(`env.${this.#envKey} is an invalid format`, { text: Env.get(this.#envKey) }); | ||
console.error(`env.${this.#envKey} is an invalid format`, { text: process.env[this.#envKey] }); | ||
} | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import fs from 'fs/promises'; | ||
import fs from 'node:fs/promises'; | ||
import { Env, GlobalEnv, ResourceLoader } from '@travetto/base'; | ||
import { RootIndex, path } from '@travetto/manifest'; | ||
import { Env, RuntimeResources } from '@travetto/base'; | ||
import { RuntimeContext, path } from '@travetto/manifest'; | ||
@@ -12,3 +12,3 @@ import { ConfigSource, ConfigSpec } from './types'; | ||
/** | ||
* File-base config source, builds on common file resource provider | ||
* File-based config source, relies on resource search paths for finding files | ||
*/ | ||
@@ -21,12 +21,11 @@ export class FileConfigSource implements ConfigSource { | ||
constructor(parser: ParserManager, paths?: string[], profiles?: Profile[]) { | ||
constructor(parser: ParserManager) { | ||
this.#parser = parser; | ||
this.#searchPaths = ResourceLoader.getSearchPaths(paths).reverse(); | ||
this.#profiles = profiles ?? [ | ||
this.#searchPaths = RuntimeResources.searchPaths.slice().reverse(); | ||
this.#profiles = ([ | ||
['application', 100], | ||
[GlobalEnv.envName, 200], | ||
...(Env.getList('TRV_PROFILES') ?? []) | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
.map((p, i) => [p, 300 + i * 10] as [string, number]) | ||
]; | ||
[Env.name!, 200], | ||
...(Env.TRV_PROFILES.list ?? []) | ||
.map((p, i) => [p, 300 + i * 10] as const) | ||
] as const).filter(x => !!x[0]); | ||
} | ||
@@ -48,3 +47,3 @@ | ||
source: `file://${profile}`, | ||
detail: full.replace(`${RootIndex.manifest.workspacePath}/`, '') | ||
detail: full.replace(`${RuntimeContext.workspace.path}/`, '') | ||
}))); | ||
@@ -51,0 +50,0 @@ } |
@@ -9,3 +9,3 @@ import { ConfigData } from '../parser/types'; | ||
/** | ||
* @concrete ../internal/types:ConfigSourceTarget | ||
* @concrete ../internal/types#ConfigSourceTarget | ||
*/ | ||
@@ -12,0 +12,0 @@ export interface ConfigSource { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28644
18
413
1
246
+ Added@travetto/base@4.1.2(transitive)
+ Added@travetto/di@4.1.1(transitive)
+ Added@travetto/manifest@4.1.0(transitive)
+ Added@travetto/registry@4.1.2(transitive)
+ Added@travetto/schema@4.1.1(transitive)
+ Added@travetto/yaml@4.1.1(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/ms@0.7.34(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)
- Removed@travetto/base@3.4.2(transitive)
- Removed@travetto/di@3.4.2(transitive)
- Removed@travetto/manifest@3.4.0(transitive)
- Removed@travetto/registry@3.4.2(transitive)
- Removed@travetto/schema@3.4.5(transitive)
- Removed@travetto/yaml@3.4.2(transitive)
- Removed@types/source-map-support@0.5.10(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
Updated@travetto/di@^4.0.0-rc.0
Updated@travetto/schema@^4.0.0-rc.0
Updated@travetto/yaml@^4.0.0-rc.0