varlock 0.0.15 → 0.1.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/README.md +1 -1
- package/dist/auto-load.js +3 -3
- package/dist/{chunk-XTPPJ3UK.js → chunk-7L3IF2MK.js} +15 -22
- package/dist/chunk-7L3IF2MK.js.map +1 -0
- package/dist/{chunk-LYSRVOTA.js → chunk-DTNPJJH4.js} +3 -3
- package/dist/{chunk-LYSRVOTA.js.map → chunk-DTNPJJH4.js.map} +1 -1
- package/dist/{chunk-WTAZCEL6.js → chunk-GY623P3W.js} +4 -4
- package/dist/{chunk-WTAZCEL6.js.map → chunk-GY623P3W.js.map} +1 -1
- package/dist/{chunk-OLZUI45U.js → chunk-LIIRL4NK.js} +4 -4
- package/dist/{chunk-OLZUI45U.js.map → chunk-LIIRL4NK.js.map} +1 -1
- package/dist/{chunk-WMCJKFEN.js → chunk-MITVWKKH.js} +4 -4
- package/dist/{chunk-WMCJKFEN.js.map → chunk-MITVWKKH.js.map} +1 -1
- package/dist/{chunk-IWQ4BDSW.js → chunk-MLIGQWID.js} +1497 -573
- package/dist/chunk-MLIGQWID.js.map +1 -0
- package/dist/{chunk-UPLR6H2O.js → chunk-NGDIT6C3.js} +33 -14
- package/dist/chunk-NGDIT6C3.js.map +1 -0
- package/dist/{chunk-IH74UIYN.js → chunk-NMJ5YL5I.js} +4 -4
- package/dist/{chunk-IH74UIYN.js.map → chunk-NMJ5YL5I.js.map} +1 -1
- package/dist/{chunk-LBV2UW3I.js → chunk-QT5E2RY6.js} +3 -3
- package/dist/chunk-QT5E2RY6.js.map +1 -0
- package/dist/cli/cli-executable.js +77 -48
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/dotenv-compat.js +3 -3
- package/dist/{env-DLUhFCnC.d.ts → env-graph-eF0B8G0j.d.ts} +210 -55
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -3
- package/dist/init.command-ASK74XBV.js +8 -0
- package/dist/{init.command-YZ23U7SF.js.map → init.command-ASK74XBV.js.map} +1 -1
- package/dist/lib/exec-sync-varlock.js +1 -1
- package/dist/load.command-VUKBSBEV.js +8 -0
- package/dist/{load.command-NVMWXLOK.js.map → load.command-VUKBSBEV.js.map} +1 -1
- package/dist/plugin-lib.d.ts +9 -0
- package/dist/plugin-lib.js +3 -0
- package/dist/plugin-lib.js.map +1 -0
- package/dist/run.command-XQ64Z2TN.js +8 -0
- package/dist/{run.command-CXMAPHO7.js.map → run.command-XQ64Z2TN.js.map} +1 -1
- package/dist/runtime/env.d.ts +28 -1
- package/dist/telemetry.command-HHZVBFC7.js +8 -0
- package/dist/{telemetry.command-3DVW7H2K.js.map → telemetry.command-HHZVBFC7.js.map} +1 -1
- package/package.json +17 -10
- package/dist/chunk-EPKIAPPA.js +0 -146
- package/dist/chunk-EPKIAPPA.js.map +0 -1
- package/dist/chunk-IWQ4BDSW.js.map +0 -1
- package/dist/chunk-LBV2UW3I.js.map +0 -1
- package/dist/chunk-UPLR6H2O.js.map +0 -1
- package/dist/chunk-XTPPJ3UK.js.map +0 -1
- package/dist/init.command-YZ23U7SF.js +0 -8
- package/dist/load.command-NVMWXLOK.js +0 -8
- package/dist/login.command-W4DP7RUO.js +0 -8
- package/dist/login.command-W4DP7RUO.js.map +0 -1
- package/dist/run.command-CXMAPHO7.js +0 -8
- package/dist/telemetry.command-3DVW7H2K.js +0 -8
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ParsedEnvSpecDecorator, ParsedEnvSpecFile, ParsedEnvSpecStaticValue, ParsedEnvSpecFunctionCall } from '@env-spec/parser';
|
|
2
2
|
import { FallbackIfUnknown } from '@env-spec/utils/type-utils';
|
|
3
|
+
import { Debugger } from 'debug';
|
|
3
4
|
|
|
5
|
+
type VarlockErrorLocationDetails = {
|
|
6
|
+
/** file path or url */
|
|
7
|
+
id: string;
|
|
8
|
+
/** 1-based line number */
|
|
9
|
+
lineNumber: number;
|
|
10
|
+
/** 1-based column number */
|
|
11
|
+
colNumber: number;
|
|
12
|
+
/** full line string */
|
|
13
|
+
lineStr: string;
|
|
14
|
+
};
|
|
4
15
|
declare class VarlockError extends Error {
|
|
5
16
|
readonly more?: {
|
|
6
17
|
tip?: string | Array<string>;
|
|
@@ -8,6 +19,7 @@ declare class VarlockError extends Error {
|
|
|
8
19
|
isWarning?: boolean;
|
|
9
20
|
/** machine-friendly error code if needed for anything else */
|
|
10
21
|
code?: string;
|
|
22
|
+
location?: VarlockErrorLocationDetails;
|
|
11
23
|
/** free-form additional metadata */
|
|
12
24
|
extraMetadata?: Record<string, any>;
|
|
13
25
|
} | undefined;
|
|
@@ -23,10 +35,12 @@ declare class VarlockError extends Error {
|
|
|
23
35
|
isWarning?: boolean;
|
|
24
36
|
/** machine-friendly error code if needed for anything else */
|
|
25
37
|
code?: string;
|
|
38
|
+
location?: VarlockErrorLocationDetails;
|
|
26
39
|
/** free-form additional metadata */
|
|
27
40
|
extraMetadata?: Record<string, any>;
|
|
28
41
|
} | undefined);
|
|
29
42
|
get tip(): string | undefined;
|
|
43
|
+
get location(): VarlockErrorLocationDetails | undefined;
|
|
30
44
|
get code(): string | undefined;
|
|
31
45
|
get extraMetadata(): Record<string, any> | undefined;
|
|
32
46
|
set isWarning(w: boolean);
|
|
@@ -71,6 +85,7 @@ declare class ResolutionError extends VarlockError {
|
|
|
71
85
|
get retryable(): boolean;
|
|
72
86
|
}
|
|
73
87
|
|
|
88
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
74
89
|
type EnvGraphDataTypeDef<CoerceReturnType, ValidateInputType = FallbackIfUnknown<CoerceReturnType, string>> = {
|
|
75
90
|
/** this will be the name of the type, used to reference it when using it in a schema */
|
|
76
91
|
name: string;
|
|
@@ -87,7 +102,14 @@ type EnvGraphDataTypeDef<CoerceReturnType, ValidateInputType = FallbackIfUnknown
|
|
|
87
102
|
* - if validation passes, should return true
|
|
88
103
|
* - if validation fails, should return a ValidationError or array of errors - or throw an error
|
|
89
104
|
* */
|
|
90
|
-
validate: (value: ValidateInputType) => (true | undefined | void | Error | Array<Error>)
|
|
105
|
+
validate: (value: ValidateInputType) => MaybePromise<(true | undefined | void | Error | Array<Error>)>;
|
|
106
|
+
/** will make items of this type sensitive, unless overridden specifically on that item */
|
|
107
|
+
sensitive?: boolean;
|
|
108
|
+
/** adds docs info for these */
|
|
109
|
+
docs?: Array<string | {
|
|
110
|
+
url: string;
|
|
111
|
+
description: string;
|
|
112
|
+
}>;
|
|
91
113
|
};
|
|
92
114
|
/**
|
|
93
115
|
* holds a specific instance of a data type, along with specific settings which affect validation/coercion etc
|
|
@@ -101,10 +123,15 @@ declare class EnvGraphDataType {
|
|
|
101
123
|
factory: any);
|
|
102
124
|
get name(): string;
|
|
103
125
|
get icon(): string | undefined;
|
|
126
|
+
get isSensitive(): boolean | undefined;
|
|
127
|
+
get docsEntries(): (string | {
|
|
128
|
+
url: string;
|
|
129
|
+
description: string;
|
|
130
|
+
})[] | undefined;
|
|
104
131
|
/** @internal */
|
|
105
132
|
get _rawDef(): EnvGraphDataTypeDef<any, any>;
|
|
106
133
|
coerce(val: any): any;
|
|
107
|
-
validate(val: any): true | void | Error | Error[]
|
|
134
|
+
validate(val: any): MaybePromise<true | void | Error | Error[] | undefined>;
|
|
108
135
|
}
|
|
109
136
|
declare function createEnvGraphDataType<TsType, InstanceSettingsArgs extends Array<any>>(dataTypeDef: EnvGraphDataTypeDef<TsType> | ((...args: InstanceSettingsArgs) => EnvGraphDataTypeDef<TsType>)): {
|
|
110
137
|
(...usageOpts: InstanceSettingsArgs): EnvGraphDataType;
|
|
@@ -113,29 +140,112 @@ declare function createEnvGraphDataType<TsType, InstanceSettingsArgs extends Arr
|
|
|
113
140
|
};
|
|
114
141
|
type EnvGraphDataTypeFactory = ReturnType<typeof createEnvGraphDataType>;
|
|
115
142
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
abstract
|
|
123
|
-
abstract
|
|
143
|
+
declare abstract class DecoratorInstance {
|
|
144
|
+
get name(): string;
|
|
145
|
+
get isFunctionCall(): boolean;
|
|
146
|
+
_decValueResolver?: Resolver;
|
|
147
|
+
get decValueResolver(): Resolver | undefined;
|
|
148
|
+
abstract readonly isRootDecorator: boolean;
|
|
149
|
+
abstract readonly dataSource: EnvGraphDataSource;
|
|
150
|
+
abstract readonly parsedDecorator: ParsedEnvSpecDecorator;
|
|
151
|
+
abstract graph: EnvGraph;
|
|
152
|
+
_schemaErrors: Array<SchemaError>;
|
|
153
|
+
get schemaErrors(): SchemaError[];
|
|
154
|
+
_executionError?: Error;
|
|
155
|
+
private decoratorDef?;
|
|
156
|
+
get incompatibleWith(): string[] | undefined;
|
|
157
|
+
private processed;
|
|
158
|
+
private processedData;
|
|
159
|
+
process(): Promise<void>;
|
|
160
|
+
execute(): Promise<void>;
|
|
161
|
+
resolvedValue?: any;
|
|
162
|
+
isResolved: boolean;
|
|
163
|
+
resolve(): Promise<any>;
|
|
164
|
+
}
|
|
165
|
+
declare class ItemDecoratorInstance extends DecoratorInstance {
|
|
166
|
+
readonly configItem: ConfigItem;
|
|
167
|
+
readonly dataSource: EnvGraphDataSource;
|
|
168
|
+
readonly parsedDecorator: ParsedEnvSpecDecorator;
|
|
169
|
+
isRootDecorator: boolean;
|
|
170
|
+
constructor(configItem: ConfigItem, dataSource: EnvGraphDataSource, parsedDecorator: ParsedEnvSpecDecorator);
|
|
171
|
+
get graph(): EnvGraph;
|
|
172
|
+
}
|
|
173
|
+
declare class RootDecoratorInstance extends DecoratorInstance {
|
|
174
|
+
readonly dataSource: EnvGraphDataSource;
|
|
175
|
+
readonly parsedDecorator: ParsedEnvSpecDecorator;
|
|
176
|
+
isRootDecorator: boolean;
|
|
177
|
+
constructor(dataSource: EnvGraphDataSource, parsedDecorator: ParsedEnvSpecDecorator);
|
|
178
|
+
get graph(): EnvGraph;
|
|
179
|
+
}
|
|
180
|
+
type RootDecoratorDef<Processed = any> = {
|
|
181
|
+
name: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
isFunction?: boolean;
|
|
184
|
+
deprecated?: boolean | string;
|
|
185
|
+
incompatibleWith?: Array<string>;
|
|
186
|
+
process?: (decoratorValue: Resolver) => (Processed | Promise<Processed>);
|
|
187
|
+
execute?: (executeInput: Processed) => void | Promise<void>;
|
|
188
|
+
useFnArgsResolver?: boolean;
|
|
189
|
+
};
|
|
190
|
+
type ItemDecoratorDef<T = any> = {
|
|
191
|
+
name: string;
|
|
192
|
+
incompatibleWith?: Array<string>;
|
|
193
|
+
isFunction?: boolean;
|
|
194
|
+
deprecated?: boolean | string;
|
|
195
|
+
process?: (decoratorValue: Resolver) => T | Promise<T>;
|
|
196
|
+
execute?: (executeInput: T) => void | Promise<void>;
|
|
197
|
+
useFnArgsResolver?: boolean;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
type ResolvedValue = undefined | string | number | boolean | RegExp | {
|
|
201
|
+
[key: string]: ResolvedValue;
|
|
202
|
+
} | Array<ResolvedValue>;
|
|
203
|
+
declare class Resolver {
|
|
204
|
+
readonly arrArgs?: Array<Resolver> | undefined;
|
|
205
|
+
readonly objArgs?: Record<string, Resolver> | undefined;
|
|
206
|
+
readonly dataSource?: EnvGraphDataSource | undefined;
|
|
207
|
+
static def: ResolverDef;
|
|
208
|
+
constructor(arrArgs?: Array<Resolver> | undefined, objArgs?: Record<string, Resolver> | undefined, dataSource?: EnvGraphDataSource | undefined);
|
|
209
|
+
static get fnName(): string;
|
|
210
|
+
get def(): ResolverDef<any>;
|
|
211
|
+
get fnName(): string;
|
|
212
|
+
get label(): string | undefined;
|
|
213
|
+
get icon(): string | undefined;
|
|
214
|
+
get isStatic(): boolean;
|
|
215
|
+
get staticValue(): ResolvedValue;
|
|
124
216
|
inferredType?: string;
|
|
125
217
|
_schemaErrors: Array<SchemaError>;
|
|
126
218
|
private _depsObj;
|
|
127
219
|
get childResolvers(): Array<Resolver>;
|
|
128
220
|
get schemaErrors(): Array<SchemaError>;
|
|
221
|
+
set schemaErrors(v: Array<SchemaError>);
|
|
129
222
|
get depsObj(): Record<string, boolean>;
|
|
130
223
|
get deps(): string[];
|
|
131
|
-
|
|
132
|
-
private
|
|
133
|
-
process(
|
|
224
|
+
private parent?;
|
|
225
|
+
private meta;
|
|
226
|
+
process(parent?: ConfigItem | DecoratorInstance): void;
|
|
134
227
|
protected addDep(key: string): void;
|
|
135
|
-
protected
|
|
228
|
+
protected getCurrentEnv(): Promise<string | undefined>;
|
|
136
229
|
resolve(): Promise<ResolvedValue>;
|
|
230
|
+
get envGraph(): EnvGraph | undefined;
|
|
137
231
|
protected getDepValue(key: string): ResolvedValue;
|
|
138
232
|
}
|
|
233
|
+
type ResolverDef<T = any> = {
|
|
234
|
+
name: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
icon?: string;
|
|
238
|
+
inferredType?: string;
|
|
239
|
+
argsSchema?: {
|
|
240
|
+
type: 'array' | 'object' | 'mixed';
|
|
241
|
+
arrayExactLength?: number;
|
|
242
|
+
arrayMinLength?: number;
|
|
243
|
+
arrayMaxLength?: number;
|
|
244
|
+
objKeyMinLength?: number;
|
|
245
|
+
};
|
|
246
|
+
process?: (this: Resolver) => T;
|
|
247
|
+
resolve: (this: Resolver, state: T) => ResolvedValue | Promise<ResolvedValue>;
|
|
248
|
+
};
|
|
139
249
|
type ResolverChildClass<ChildClass extends Resolver = Resolver> = ({
|
|
140
250
|
new (...args: Array<any>): ChildClass;
|
|
141
251
|
} & typeof Resolver);
|
|
@@ -207,7 +317,9 @@ declare abstract class EnvGraphDataSource {
|
|
|
207
317
|
/** environment flag value getter (follows up the parent chain), and checks the graph-level fallback */
|
|
208
318
|
get envFlagValue(): ResolvedValue;
|
|
209
319
|
/** helper to resolve the envFlag value */
|
|
210
|
-
resolveCurrentEnv(): Promise<
|
|
320
|
+
resolveCurrentEnv(): Promise<string | number | boolean | RegExp | {
|
|
321
|
+
[key: string]: ResolvedValue;
|
|
322
|
+
} | ResolvedValue[] | undefined>;
|
|
211
323
|
/** finish init process for this data source */
|
|
212
324
|
finishInit(): Promise<void>;
|
|
213
325
|
/**
|
|
@@ -225,11 +337,17 @@ declare abstract class EnvGraphDataSource {
|
|
|
225
337
|
/** an error encountered while loading/parsing the data source */
|
|
226
338
|
_loadingError?: Error;
|
|
227
339
|
get loadingError(): Error | undefined;
|
|
340
|
+
_schemaErrors: Array<SchemaError>;
|
|
341
|
+
get schemaErrors(): SchemaError[];
|
|
342
|
+
get resolutionErrors(): Error[];
|
|
228
343
|
get isValid(): boolean;
|
|
229
344
|
configItemDefs: Record<string, ConfigItemDef>;
|
|
230
345
|
decorators: Array<ParsedEnvSpecDecorator>;
|
|
231
346
|
getRootDecorators(decName: string): ParsedEnvSpecDecorator[];
|
|
232
347
|
getRootDecoratorSimpleValue(decName: string): any;
|
|
348
|
+
rootDecorators: Array<RootDecoratorInstance>;
|
|
349
|
+
getRootDec(decName: string): RootDecoratorInstance | undefined;
|
|
350
|
+
getRootDecFns(decName: string): RootDecoratorInstance[];
|
|
233
351
|
}
|
|
234
352
|
declare abstract class FileBasedDataSource extends EnvGraphDataSource {
|
|
235
353
|
isGitIgnored?: boolean;
|
|
@@ -237,6 +355,7 @@ declare abstract class FileBasedDataSource extends EnvGraphDataSource {
|
|
|
237
355
|
fileName: string;
|
|
238
356
|
rawContents?: string;
|
|
239
357
|
get typeLabel(): string;
|
|
358
|
+
private relativePath;
|
|
240
359
|
get label(): string;
|
|
241
360
|
static format: string;
|
|
242
361
|
static validFileExtensions: Array<string>;
|
|
@@ -252,42 +371,48 @@ declare class DotEnvFileDataSource extends FileBasedDataSource {
|
|
|
252
371
|
static format: string;
|
|
253
372
|
static validFileExtensions: never[];
|
|
254
373
|
parsedFile?: ParsedEnvSpecFile;
|
|
255
|
-
private convertParserValueToResolvers;
|
|
256
374
|
_parseContents(): Promise<void>;
|
|
257
375
|
}
|
|
258
376
|
|
|
259
377
|
type ConfigItemDef = {
|
|
260
378
|
description?: string;
|
|
379
|
+
parsedDecorators?: Array<ParsedEnvSpecDecorator>;
|
|
380
|
+
parsedValue: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
|
|
261
381
|
resolver?: Resolver;
|
|
262
|
-
decorators?:
|
|
382
|
+
decorators?: Array<ItemDecoratorInstance>;
|
|
263
383
|
};
|
|
264
384
|
type ConfigItemDefAndSource = {
|
|
265
385
|
itemDef: ConfigItemDef;
|
|
266
386
|
source: EnvGraphDataSource;
|
|
267
387
|
};
|
|
268
388
|
declare class ConfigItem {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
get key(): string;
|
|
389
|
+
readonly envGraph: EnvGraph;
|
|
390
|
+
readonly key: string;
|
|
391
|
+
constructor(envGraph: EnvGraph, key: string);
|
|
273
392
|
/**
|
|
274
393
|
* fetch ordered list of definitions for this item, by following up sorted data sources list
|
|
275
394
|
*/
|
|
276
395
|
get defs(): ConfigItemDefAndSource[];
|
|
277
396
|
get description(): string | undefined;
|
|
278
|
-
get icon():
|
|
397
|
+
get icon(): any;
|
|
279
398
|
get docsLinks(): {
|
|
280
399
|
url: string;
|
|
281
400
|
description?: string;
|
|
282
401
|
}[];
|
|
283
402
|
get valueResolver(): Resolver | undefined;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
403
|
+
allDecorators: Array<ItemDecoratorInstance>;
|
|
404
|
+
effectiveDecorators: Record<string, ItemDecoratorInstance>;
|
|
405
|
+
effectiveDecoratorFns: Record<string, Array<ItemDecoratorInstance>>;
|
|
406
|
+
getDec(decoratorName: string): ItemDecoratorInstance;
|
|
407
|
+
getDecFns(decoratorName: string): ItemDecoratorInstance[];
|
|
408
|
+
resolveDecorators(): Promise<void>;
|
|
287
409
|
dataType?: EnvGraphDataType;
|
|
288
|
-
|
|
410
|
+
_schemaErrors: Array<SchemaError>;
|
|
289
411
|
get resolverSchemaErrors(): SchemaError[];
|
|
412
|
+
get decoratorSchemaErrors(): SchemaError[];
|
|
413
|
+
private isProcessed;
|
|
290
414
|
process(): Promise<void>;
|
|
415
|
+
get dependencyKeys(): string[];
|
|
291
416
|
/**
|
|
292
417
|
* special early resolution helper
|
|
293
418
|
* currently used to resolve the envFlag before everything else has been loaded
|
|
@@ -302,7 +427,9 @@ declare class ConfigItem {
|
|
|
302
427
|
private processRequired;
|
|
303
428
|
get isRequired(): boolean;
|
|
304
429
|
get isRequiredDynamic(): boolean;
|
|
305
|
-
|
|
430
|
+
_isSensitive: boolean;
|
|
431
|
+
get isSensitive(): boolean;
|
|
432
|
+
private processSensitive;
|
|
306
433
|
get errors(): (SchemaError | ValidationError | CoercionError | ResolutionError)[];
|
|
307
434
|
get validationState(): 'warn' | 'error' | 'valid';
|
|
308
435
|
/** resolved value _before coercion_ */
|
|
@@ -322,6 +449,52 @@ declare class ConfigItem {
|
|
|
322
449
|
type GraphNodeId = string;
|
|
323
450
|
type GraphAdjacencyList = Record<GraphNodeId, Array<GraphNodeId>>;
|
|
324
451
|
|
|
452
|
+
declare class VarlockPlugin {
|
|
453
|
+
readonly ERRORS: {
|
|
454
|
+
ValidationError: typeof ValidationError;
|
|
455
|
+
CoercionError: typeof CoercionError;
|
|
456
|
+
SchemaError: typeof SchemaError;
|
|
457
|
+
ResolutionError: typeof ResolutionError;
|
|
458
|
+
};
|
|
459
|
+
private _packageJson?;
|
|
460
|
+
private _name?;
|
|
461
|
+
get name(): string;
|
|
462
|
+
set name(val: string);
|
|
463
|
+
private _version?;
|
|
464
|
+
get version(): string;
|
|
465
|
+
set version(val: string);
|
|
466
|
+
private _icon?;
|
|
467
|
+
get icon(): string;
|
|
468
|
+
set icon(val: string);
|
|
469
|
+
loadingError?: Error;
|
|
470
|
+
readonly localPath?: string;
|
|
471
|
+
/** reference to the `@plugin()` decorator instance(s) that installed the plugin */
|
|
472
|
+
installDecoratorInstances: Array<DecoratorInstance>;
|
|
473
|
+
type: 'single-file' | 'package';
|
|
474
|
+
constructor(opts: {
|
|
475
|
+
type: 'single-file' | 'package';
|
|
476
|
+
localPath: string;
|
|
477
|
+
loadingError?: Error;
|
|
478
|
+
packageJson?: {
|
|
479
|
+
name: string;
|
|
480
|
+
version?: string;
|
|
481
|
+
description?: string;
|
|
482
|
+
};
|
|
483
|
+
});
|
|
484
|
+
private debugger;
|
|
485
|
+
get debug(): (...args: Parameters<Debugger>) => void;
|
|
486
|
+
readonly dataTypes?: Array<Parameters<typeof createEnvGraphDataType>[0]>;
|
|
487
|
+
registerDataType(dataTypeDef: Parameters<typeof createEnvGraphDataType>[0]): void;
|
|
488
|
+
readonly rootDecorators?: Array<RootDecoratorDef<any>>;
|
|
489
|
+
registerRootDecorator<T>(decoratorDef: RootDecoratorDef<T>): void;
|
|
490
|
+
readonly itemDecorators?: Array<ItemDecoratorDef<any>>;
|
|
491
|
+
registerItemDecorator<T>(decoratorDef: ItemDecoratorDef<T>): void;
|
|
492
|
+
readonly resolverFunctions?: Array<ResolverDef<any>>;
|
|
493
|
+
registerResolverFunction<T>(resolverDef: ResolverDef<T>): void;
|
|
494
|
+
get pluginFilePath(): string;
|
|
495
|
+
executePluginModule(): Promise<void>;
|
|
496
|
+
}
|
|
497
|
+
|
|
325
498
|
type SerializedEnvGraph = {
|
|
326
499
|
basePath?: string;
|
|
327
500
|
sources: Array<{
|
|
@@ -358,41 +531,23 @@ declare class EnvGraph {
|
|
|
358
531
|
registerResolver(resolverClass: ResolverChildClass): void;
|
|
359
532
|
dataTypesRegistry: Record<string, EnvGraphDataTypeFactory>;
|
|
360
533
|
registerDataType(factory: EnvGraphDataTypeFactory): void;
|
|
534
|
+
itemDecoratorsRegistry: Record<string, ItemDecoratorDef>;
|
|
535
|
+
registerItemDecorator(decoratorDef: ItemDecoratorDef): void;
|
|
536
|
+
rootDecoratorsRegistry: Record<string, RootDecoratorDef>;
|
|
537
|
+
registerRootDecorator(decoratorDef: RootDecoratorDef): void;
|
|
361
538
|
constructor();
|
|
362
539
|
setRootDataSource(source: EnvGraphDataSource): Promise<void>;
|
|
363
540
|
finishLoad(): Promise<void>;
|
|
364
541
|
get graphAdjacencyList(): GraphAdjacencyList;
|
|
365
|
-
resolveEnvValues(): Promise<void>;
|
|
542
|
+
resolveEnvValues(keys?: Array<string>): Promise<void>;
|
|
366
543
|
getResolvedEnvObject(): Record<string, any>;
|
|
367
544
|
getSerializedGraph(): SerializedEnvGraph;
|
|
368
545
|
get isInvalid(): boolean;
|
|
369
546
|
generateTypes(lang: string, outputPath: string): Promise<void>;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
declare function resetRedactionMap(graph: SerializedEnvGraph): void;
|
|
375
|
-
/**
|
|
376
|
-
* Redacts senstive config values from any string/array/object/etc
|
|
377
|
-
*
|
|
378
|
-
* NOTE - must be used only after varlock has loaded config
|
|
379
|
-
* */
|
|
380
|
-
declare function redactSensitiveConfig(o: any): any;
|
|
381
|
-
/**
|
|
382
|
-
* utility to unmask a secret/sensitive value when logging to the console
|
|
383
|
-
* currently this only works on a single secret, not objects or aggregated strings
|
|
384
|
-
* */
|
|
385
|
-
declare function revealSensitiveConfig(secretStr: string): string;
|
|
386
|
-
declare function scanForLeaks(toScan: string | ReadableStream | null, meta?: {
|
|
387
|
-
method?: string;
|
|
388
|
-
file?: string;
|
|
389
|
-
}): string | ReadableStream<any> | null;
|
|
390
|
-
declare const varlockSettings: Record<string, any>;
|
|
391
|
-
declare function initVarlockEnv(opts?: {
|
|
392
|
-
allowFail?: boolean;
|
|
393
|
-
}): void;
|
|
394
|
-
interface TypedEnvSchema {
|
|
547
|
+
getRootDec(decoratorName: string): RootDecoratorInstance | undefined;
|
|
548
|
+
getRootDecFns(decoratorName: string): RootDecoratorInstance[];
|
|
549
|
+
/** plugins installed globally in the graph */
|
|
550
|
+
plugins: Array<VarlockPlugin>;
|
|
395
551
|
}
|
|
396
|
-
declare const ENV: TypedEnvSchema;
|
|
397
552
|
|
|
398
|
-
export { ConfigLoadError as C, DotEnvFileDataSource as D, EnvGraph as E,
|
|
553
|
+
export { ConfigLoadError as C, DotEnvFileDataSource as D, EnvGraph as E, Resolver as R, type SerializedEnvGraph as S, VarlockPlugin as V, SchemaError as a, ValidationError as b, CoercionError as c, ResolutionError as d };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { E as EnvGraph, D as DotEnvFileDataSource, C as ConfigLoadError,
|
|
2
|
-
export {
|
|
1
|
+
import { E as EnvGraph, D as DotEnvFileDataSource, C as ConfigLoadError, a as SchemaError, b as ValidationError, c as CoercionError, d as ResolutionError } from './env-graph-eF0B8G0j.js';
|
|
2
|
+
export { S as SerializedEnvGraph } from './env-graph-eF0B8G0j.js';
|
|
3
|
+
import { initVarlockEnv } from './runtime/env.js';
|
|
4
|
+
export { ENV } from './runtime/env.js';
|
|
3
5
|
export { patchGlobalConsole } from './runtime/patch-console.js';
|
|
4
6
|
export { patchGlobalServerResponse } from './runtime/patch-server-response.js';
|
|
5
7
|
export { patchGlobalResponse } from './runtime/patch-response.js';
|
|
6
8
|
import '@env-spec/parser';
|
|
7
9
|
import '@env-spec/utils/type-utils';
|
|
10
|
+
import 'debug';
|
|
8
11
|
|
|
9
12
|
declare function loadEnvGraph(opts?: {
|
|
10
13
|
basePath?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export { patchGlobalResponse } from './chunk-OM3JCP4E.js';
|
|
1
2
|
export { patchGlobalServerResponse } from './chunk-7JMYT62X.js';
|
|
2
|
-
import { loadVarlockEnvGraph, checkForConfigErrors } from './chunk-
|
|
3
|
-
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError, loadEnvGraph, DotEnvFileDataSource, EnvGraph } from './chunk-
|
|
3
|
+
import { loadVarlockEnvGraph, checkForConfigErrors } from './chunk-NGDIT6C3.js';
|
|
4
|
+
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError, loadEnvGraph, DotEnvFileDataSource, EnvGraph } from './chunk-MLIGQWID.js';
|
|
4
5
|
export { patchGlobalConsole } from './chunk-C5BEZMSO.js';
|
|
5
|
-
export { patchGlobalResponse } from './chunk-OM3JCP4E.js';
|
|
6
6
|
import { initVarlockEnv } from './chunk-2SPIWTVE.js';
|
|
7
7
|
export { ENV } from './chunk-2SPIWTVE.js';
|
|
8
8
|
import './chunk-FGMXIEFA.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-GY623P3W.js';
|
|
2
|
+
import './chunk-DTNPJJH4.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-MLIGQWID.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=init.command-ASK74XBV.js.map
|
|
8
|
+
//# sourceMappingURL=init.command-ASK74XBV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-ASK74XBV.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-7L3IF2MK.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-NGDIT6C3.js';
|
|
4
|
+
import './chunk-MLIGQWID.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=load.command-VUKBSBEV.js.map
|
|
8
|
+
//# sourceMappingURL=load.command-VUKBSBEV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-VUKBSBEV.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"plugin-lib.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-MITVWKKH.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-NGDIT6C3.js';
|
|
4
|
+
import './chunk-MLIGQWID.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=run.command-XQ64Z2TN.js.map
|
|
8
|
+
//# sourceMappingURL=run.command-XQ64Z2TN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-XQ64Z2TN.js"}
|
package/dist/runtime/env.d.ts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import { S as SerializedEnvGraph } from '../env-graph-eF0B8G0j.js';
|
|
2
2
|
import '@env-spec/parser';
|
|
3
3
|
import '@env-spec/utils/type-utils';
|
|
4
|
+
import 'debug';
|
|
5
|
+
|
|
6
|
+
declare function resetRedactionMap(graph: SerializedEnvGraph): void;
|
|
7
|
+
/**
|
|
8
|
+
* Redacts senstive config values from any string/array/object/etc
|
|
9
|
+
*
|
|
10
|
+
* NOTE - must be used only after varlock has loaded config
|
|
11
|
+
* */
|
|
12
|
+
declare function redactSensitiveConfig(o: any): any;
|
|
13
|
+
/**
|
|
14
|
+
* utility to unmask a secret/sensitive value when logging to the console
|
|
15
|
+
* currently this only works on a single secret, not objects or aggregated strings
|
|
16
|
+
* */
|
|
17
|
+
declare function revealSensitiveConfig(secretStr: string): string;
|
|
18
|
+
declare function scanForLeaks(toScan: string | ReadableStream | null, meta?: {
|
|
19
|
+
method?: string;
|
|
20
|
+
file?: string;
|
|
21
|
+
}): string | ReadableStream<any> | null;
|
|
22
|
+
declare const varlockSettings: Record<string, any>;
|
|
23
|
+
declare function initVarlockEnv(opts?: {
|
|
24
|
+
allowFail?: boolean;
|
|
25
|
+
}): void;
|
|
26
|
+
interface TypedEnvSchema {
|
|
27
|
+
}
|
|
28
|
+
declare const ENV: TypedEnvSchema;
|
|
29
|
+
|
|
30
|
+
export { ENV, type TypedEnvSchema, initVarlockEnv, redactSensitiveConfig, resetRedactionMap, revealSensitiveConfig, scanForLeaks, varlockSettings };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-LIIRL4NK.js';
|
|
2
|
+
import './chunk-DTNPJJH4.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-MLIGQWID.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=telemetry.command-HHZVBFC7.js.map
|
|
8
|
+
//# sourceMappingURL=telemetry.command-HHZVBFC7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-HHZVBFC7.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varlock",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -67,33 +67,40 @@
|
|
|
67
67
|
"ts-src": "./src/config.ts",
|
|
68
68
|
"types": "./dist/dotenv-compat.d.ts",
|
|
69
69
|
"default": "./dist/dotenv-compat.js"
|
|
70
|
+
},
|
|
71
|
+
"./plugin-lib": {
|
|
72
|
+
"ts-src": "./src/plugin-lib.ts",
|
|
73
|
+
"types": "./dist/plugin-lib.d.ts",
|
|
74
|
+
"default": "./dist/plugin-lib.js"
|
|
70
75
|
}
|
|
71
76
|
},
|
|
72
77
|
"dependencies": {
|
|
73
|
-
"debug": "^4.4.
|
|
78
|
+
"debug": "^4.4.3",
|
|
74
79
|
"execa": "^9.6.0",
|
|
80
|
+
"semver": "^7.7.3",
|
|
75
81
|
"which": "^5.0.0",
|
|
76
|
-
"@env-spec/parser": "^0.0.
|
|
82
|
+
"@env-spec/parser": "^0.0.7"
|
|
77
83
|
},
|
|
78
84
|
"devDependencies": {
|
|
79
85
|
"@clack/core": "^0.5.0",
|
|
80
86
|
"@clack/prompts": "^0.11.0",
|
|
81
|
-
"@sindresorhus/is": "^7.
|
|
87
|
+
"@sindresorhus/is": "^7.1.1",
|
|
82
88
|
"@types/debug": "^4.1.12",
|
|
83
|
-
"@types/node": "
|
|
89
|
+
"@types/node": "24.9.2",
|
|
90
|
+
"@types/semver": "^7.7.1",
|
|
84
91
|
"@types/which": "^3.0.4",
|
|
85
|
-
"@yao-pkg/pkg": "^6.
|
|
86
|
-
"ansis": "^4.
|
|
92
|
+
"@yao-pkg/pkg": "^6.10.0",
|
|
93
|
+
"ansis": "^4.2.0",
|
|
87
94
|
"browser-or-node": "^3.0.0",
|
|
88
|
-
"ci-info": "^4.3.
|
|
95
|
+
"ci-info": "^4.3.1",
|
|
89
96
|
"exit-hook": "^4.0.0",
|
|
90
97
|
"gunshi": "^0.26.3",
|
|
91
|
-
"is-docker": "^
|
|
98
|
+
"is-docker": "^4.0.0",
|
|
92
99
|
"is-unicode-supported": "^2.1.0",
|
|
93
100
|
"is-wsl": "^3.1.0",
|
|
94
101
|
"outdent": "^0.8.0",
|
|
95
102
|
"tsup": "^8.5.0",
|
|
96
|
-
"vitest": "^
|
|
103
|
+
"vitest": "^4.0.6",
|
|
97
104
|
"@env-spec/utils": "0.0.0"
|
|
98
105
|
},
|
|
99
106
|
"scripts": {
|