Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/config

Package Overview
Dependencies
Maintainers
1
Versions
297
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/config - npm Package Compare versions

Comparing version 3.4.4 to 4.0.0-rc.0

src/trv.d.ts

1

__index__.ts

@@ -0,1 +1,2 @@

/// <reference path="./src/trv.d.ts" />
export * from './src/decorator';

@@ -2,0 +3,0 @@ export * from './src/service';

8

package.json
{
"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 {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc