varlock 0.0.7 → 0.0.9
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/dist/auto-load.js +5 -5
- package/dist/{chunk-7NCUE6IU.js → chunk-2CM4YUFY.js} +41 -18
- package/dist/chunk-2CM4YUFY.js.map +1 -0
- package/dist/{chunk-4D3QUGGJ.js → chunk-4CE75BSX.js} +5 -6
- package/dist/chunk-4CE75BSX.js.map +1 -0
- package/dist/{chunk-DAZNZPLN.js → chunk-4WMY2EW3.js} +559 -75
- package/dist/chunk-4WMY2EW3.js.map +1 -0
- package/dist/{chunk-HQ3K6KKC.js → chunk-CYYLAV42.js} +3 -3
- package/dist/{chunk-HQ3K6KKC.js.map → chunk-CYYLAV42.js.map} +1 -1
- package/dist/{chunk-2AA6IZBK.js → chunk-ELJZUQX3.js} +4 -4
- package/dist/chunk-ELJZUQX3.js.map +1 -0
- package/dist/{chunk-67DF2S4X.js → chunk-FLO6F7B6.js} +5 -5
- package/dist/{chunk-67DF2S4X.js.map → chunk-FLO6F7B6.js.map} +1 -1
- package/dist/{chunk-BDA3K24R.js → chunk-FYLMYWUF.js} +7 -8
- package/dist/chunk-FYLMYWUF.js.map +1 -0
- package/dist/{chunk-XCHNL72R.js → chunk-GWQT5VGW.js} +7 -8
- package/dist/chunk-GWQT5VGW.js.map +1 -0
- package/dist/{chunk-Z52EXRDT.js → chunk-KCX4NC7Q.js} +6 -7
- package/dist/chunk-KCX4NC7Q.js.map +1 -0
- package/dist/{chunk-WRLSFZTQ.js → chunk-LS6F7BSZ.js} +8 -8
- package/dist/{chunk-WRLSFZTQ.js.map → chunk-LS6F7BSZ.js.map} +1 -1
- package/dist/{chunk-ZDGB2ZFV.js → chunk-PB7RWVE6.js} +14 -14
- package/dist/chunk-PB7RWVE6.js.map +1 -0
- package/dist/chunk-WYJDUDC4.js +14 -0
- package/dist/{chunk-ITXNRGOJ.js.map → chunk-WYJDUDC4.js.map} +1 -1
- package/dist/{chunk-WOHPERDH.js → chunk-ZUG7BEY5.js} +4 -4
- package/dist/chunk-ZUG7BEY5.js.map +1 -0
- package/dist/{chunk-LJKKUJMC.js → chunk-ZW2T4C6A.js} +419 -77
- package/dist/chunk-ZW2T4C6A.js.map +1 -0
- package/dist/cli/cli-executable.js +25 -33
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/dotenv-compat.js +5 -5
- package/dist/env-KH4bPru7.d.ts +356 -0
- package/dist/index.d.ts +36 -2
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/dist/init.command-ZRQOE2OK.js +9 -0
- package/dist/{init.command-NWFSUQWW.js.map → init.command-ZRQOE2OK.js.map} +1 -1
- package/dist/load.command-YBN3BW6U.js +9 -0
- package/dist/{load.command-U3ZEZYEV.js.map → load.command-YBN3BW6U.js.map} +1 -1
- package/dist/login.command-F5AWKZKA.js +8 -0
- package/dist/{login.command-SWBJENRF.js.map → login.command-F5AWKZKA.js.map} +1 -1
- package/dist/run.command-WWJ6ZE26.js +9 -0
- package/dist/{run.command-WNANCLWN.js.map → run.command-WWJ6ZE26.js.map} +1 -1
- package/dist/runtime/env.d.ts +3 -1
- package/dist/runtime/env.js +1 -1
- package/dist/runtime/patch-console.js +2 -2
- package/dist/runtime/patch-response.js +2 -2
- package/dist/runtime/patch-server-response.js +2 -2
- package/dist/telemetry.command-IS2JLIZM.js +8 -0
- package/dist/{telemetry.command-QMUHAB3Z.js.map → telemetry.command-IS2JLIZM.js.map} +1 -1
- package/package.json +6 -7
- package/dist/chunk-2AA6IZBK.js.map +0 -1
- package/dist/chunk-2H7TDBLD.js +0 -172
- package/dist/chunk-2H7TDBLD.js.map +0 -1
- package/dist/chunk-4D3QUGGJ.js.map +0 -1
- package/dist/chunk-7NCUE6IU.js.map +0 -1
- package/dist/chunk-BDA3K24R.js.map +0 -1
- package/dist/chunk-DAZNZPLN.js.map +0 -1
- package/dist/chunk-ITXNRGOJ.js +0 -14
- package/dist/chunk-LHTLO65N.js +0 -99
- package/dist/chunk-LHTLO65N.js.map +0 -1
- package/dist/chunk-LJKKUJMC.js.map +0 -1
- package/dist/chunk-PUGFIZE3.js +0 -143
- package/dist/chunk-PUGFIZE3.js.map +0 -1
- package/dist/chunk-QDGAWJPB.js +0 -59
- package/dist/chunk-QDGAWJPB.js.map +0 -1
- package/dist/chunk-WOHPERDH.js.map +0 -1
- package/dist/chunk-X52WCHVG.js +0 -540
- package/dist/chunk-X52WCHVG.js.map +0 -1
- package/dist/chunk-XCHNL72R.js.map +0 -1
- package/dist/chunk-YZ2H2QXX.js +0 -32
- package/dist/chunk-YZ2H2QXX.js.map +0 -1
- package/dist/chunk-Z52EXRDT.js.map +0 -1
- package/dist/chunk-ZDGB2ZFV.js.map +0 -1
- package/dist/doctor.command-TKHDKSUY.js +0 -7
- package/dist/doctor.command-TKHDKSUY.js.map +0 -1
- package/dist/encrypt.command-AGHQ4KTI.js +0 -7
- package/dist/encrypt.command-AGHQ4KTI.js.map +0 -1
- package/dist/env-k8iRuXIH.d.ts +0 -42
- package/dist/init.command-NWFSUQWW.js +0 -13
- package/dist/load.command-U3ZEZYEV.js +0 -12
- package/dist/login.command-SWBJENRF.js +0 -10
- package/dist/run.command-WNANCLWN.js +0 -12
- package/dist/telemetry.command-QMUHAB3Z.js +0 -10
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { ParsedEnvSpecDecorator, ParsedEnvSpecFile, ParsedEnvSpecStaticValue, ParsedEnvSpecFunctionCall } from '@env-spec/parser';
|
|
2
|
+
import { FallbackIfUnknown } from '@env-spec/utils/type-utils';
|
|
3
|
+
|
|
4
|
+
declare class VarlockError extends Error {
|
|
5
|
+
readonly more?: {
|
|
6
|
+
tip?: string | Array<string>;
|
|
7
|
+
err?: Error;
|
|
8
|
+
isWarning?: boolean;
|
|
9
|
+
/** machine-friendly error code if needed for anything else */
|
|
10
|
+
code?: string;
|
|
11
|
+
/** free-form additional metadata */
|
|
12
|
+
extraMetadata?: Record<string, any>;
|
|
13
|
+
} | undefined;
|
|
14
|
+
originalError?: Error;
|
|
15
|
+
get isUnexpected(): boolean;
|
|
16
|
+
get type(): string;
|
|
17
|
+
static defaultIcon: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
_isWarning: boolean;
|
|
20
|
+
constructor(errOrMessage: string | Error, more?: {
|
|
21
|
+
tip?: string | Array<string>;
|
|
22
|
+
err?: Error;
|
|
23
|
+
isWarning?: boolean;
|
|
24
|
+
/** machine-friendly error code if needed for anything else */
|
|
25
|
+
code?: string;
|
|
26
|
+
/** free-form additional metadata */
|
|
27
|
+
extraMetadata?: Record<string, any>;
|
|
28
|
+
} | undefined);
|
|
29
|
+
get tip(): string | undefined;
|
|
30
|
+
get code(): string | undefined;
|
|
31
|
+
get extraMetadata(): Record<string, any> | undefined;
|
|
32
|
+
set isWarning(w: boolean);
|
|
33
|
+
get isWarning(): boolean;
|
|
34
|
+
toJSON(): {
|
|
35
|
+
isWarning?: true | undefined;
|
|
36
|
+
tip?: string | undefined;
|
|
37
|
+
icon: string;
|
|
38
|
+
type: string;
|
|
39
|
+
name: string;
|
|
40
|
+
message: string;
|
|
41
|
+
isUnexpected: boolean;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
declare class ConfigLoadError extends VarlockError {
|
|
45
|
+
readonly cleanedStack: Array<string>;
|
|
46
|
+
constructor(err: Error);
|
|
47
|
+
toJSON(): {
|
|
48
|
+
cleanedStack: string[];
|
|
49
|
+
isWarning?: true | undefined;
|
|
50
|
+
tip?: string | undefined;
|
|
51
|
+
icon: string;
|
|
52
|
+
type: string;
|
|
53
|
+
name: string;
|
|
54
|
+
message: string;
|
|
55
|
+
isUnexpected: boolean;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
declare class SchemaError extends VarlockError {
|
|
59
|
+
static defaultIcon: string;
|
|
60
|
+
}
|
|
61
|
+
declare class ValidationError extends VarlockError {
|
|
62
|
+
static defaultIcon: string;
|
|
63
|
+
}
|
|
64
|
+
declare class CoercionError extends VarlockError {
|
|
65
|
+
static defaultIcon: string;
|
|
66
|
+
}
|
|
67
|
+
declare class ResolutionError extends VarlockError {
|
|
68
|
+
static defaultIcon: string;
|
|
69
|
+
protected _retryable?: boolean;
|
|
70
|
+
set retryable(val: boolean);
|
|
71
|
+
get retryable(): boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type EnvGraphDataTypeDef<CoerceReturnType, ValidateInputType = FallbackIfUnknown<CoerceReturnType, string>> = {
|
|
75
|
+
/** this will be the name of the type, used to reference it when using it in a schema */
|
|
76
|
+
name: string;
|
|
77
|
+
/** optional description of the type itself */
|
|
78
|
+
typeDescription?: string;
|
|
79
|
+
/** icon see https://icones.js.org for available options
|
|
80
|
+
* @example mdi:aws
|
|
81
|
+
* */
|
|
82
|
+
icon?: string;
|
|
83
|
+
/** coerce function - should take in any value and return a value of the correct type if possible */
|
|
84
|
+
coerce?: (value: any) => CoerceReturnType | CoercionError | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* validate function - we can assume that coercion has already succeded, or this will not be called
|
|
87
|
+
* - if validation passes, should return true
|
|
88
|
+
* - if validation fails, should return a ValidationError or array of errors - or throw an error
|
|
89
|
+
* */
|
|
90
|
+
validate: (value: ValidateInputType) => (true | undefined | void | Error | Array<Error>);
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* holds a specific instance of a data type, along with specific settings which affect validation/coercion etc
|
|
94
|
+
*/
|
|
95
|
+
declare class EnvGraphDataType {
|
|
96
|
+
private def;
|
|
97
|
+
/** reference back to the factory function, which we can use like a constructor to check the type of the instance */
|
|
98
|
+
private factory;
|
|
99
|
+
constructor(def: EnvGraphDataTypeDef<any, any>,
|
|
100
|
+
/** reference back to the factory function, which we can use like a constructor to check the type of the instance */
|
|
101
|
+
factory: any);
|
|
102
|
+
get name(): string;
|
|
103
|
+
get icon(): string | undefined;
|
|
104
|
+
/** @internal */
|
|
105
|
+
get _rawDef(): EnvGraphDataTypeDef<any, any>;
|
|
106
|
+
coerce(val: any): any;
|
|
107
|
+
validate(val: any): true | void | Error | Error[];
|
|
108
|
+
}
|
|
109
|
+
declare function createEnvGraphDataType<TsType, InstanceSettingsArgs extends Array<any>>(dataTypeDef: EnvGraphDataTypeDef<TsType> | ((...args: InstanceSettingsArgs) => EnvGraphDataTypeDef<TsType>)): {
|
|
110
|
+
(...usageOpts: InstanceSettingsArgs): EnvGraphDataType;
|
|
111
|
+
_isEnvGraphDataTypeFactory: boolean;
|
|
112
|
+
dataTypeName: string;
|
|
113
|
+
};
|
|
114
|
+
type EnvGraphDataTypeFactory = ReturnType<typeof createEnvGraphDataType>;
|
|
115
|
+
|
|
116
|
+
declare const DATA_SOURCE_TYPES: Readonly<{
|
|
117
|
+
schema: {
|
|
118
|
+
fileSuffixes: string[];
|
|
119
|
+
precedence: number;
|
|
120
|
+
};
|
|
121
|
+
example: {
|
|
122
|
+
fileSuffixes: string[];
|
|
123
|
+
precedence: number;
|
|
124
|
+
};
|
|
125
|
+
defaults: {
|
|
126
|
+
fileSuffixes: string[];
|
|
127
|
+
precedence: number;
|
|
128
|
+
};
|
|
129
|
+
values: {
|
|
130
|
+
fileSuffixes: Array<string>;
|
|
131
|
+
precedence: number;
|
|
132
|
+
};
|
|
133
|
+
overrides: {
|
|
134
|
+
fileSuffixes: string[];
|
|
135
|
+
precedence: number;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
type DataSourceType = keyof typeof DATA_SOURCE_TYPES;
|
|
139
|
+
declare abstract class EnvGraphDataSource {
|
|
140
|
+
static DATA_SOURCE_TYPES: Readonly<{
|
|
141
|
+
schema: {
|
|
142
|
+
fileSuffixes: string[];
|
|
143
|
+
precedence: number;
|
|
144
|
+
};
|
|
145
|
+
example: {
|
|
146
|
+
fileSuffixes: string[];
|
|
147
|
+
precedence: number;
|
|
148
|
+
};
|
|
149
|
+
defaults: {
|
|
150
|
+
fileSuffixes: string[];
|
|
151
|
+
precedence: number;
|
|
152
|
+
};
|
|
153
|
+
values: {
|
|
154
|
+
fileSuffixes: Array<string>;
|
|
155
|
+
precedence: number;
|
|
156
|
+
};
|
|
157
|
+
overrides: {
|
|
158
|
+
fileSuffixes: string[];
|
|
159
|
+
precedence: number;
|
|
160
|
+
};
|
|
161
|
+
}>;
|
|
162
|
+
graph?: EnvGraph;
|
|
163
|
+
abstract typeLabel: string;
|
|
164
|
+
type: DataSourceType;
|
|
165
|
+
applyForEnv?: string;
|
|
166
|
+
disabled?: boolean;
|
|
167
|
+
ignoreNewDefs: boolean;
|
|
168
|
+
abstract get label(): string;
|
|
169
|
+
/** an error encountered while loading/parsing the data source */
|
|
170
|
+
loadingError?: Error;
|
|
171
|
+
get isValid(): boolean;
|
|
172
|
+
configItemDefs: Record<string, ConfigItemDef>;
|
|
173
|
+
decorators: Record<string, ParsedEnvSpecDecorator>;
|
|
174
|
+
getStaticValues(): Record<string, string>;
|
|
175
|
+
}
|
|
176
|
+
declare class ProcessEnvDataSource extends EnvGraphDataSource {
|
|
177
|
+
type: "overrides";
|
|
178
|
+
typeLabel: string;
|
|
179
|
+
label: string;
|
|
180
|
+
ignoreNewDefs: boolean;
|
|
181
|
+
static processEnvValues: Record<string, string | undefined> | undefined;
|
|
182
|
+
constructor();
|
|
183
|
+
}
|
|
184
|
+
declare abstract class FileBasedDataSource extends EnvGraphDataSource {
|
|
185
|
+
isGitIgnored?: boolean;
|
|
186
|
+
fullPath: string;
|
|
187
|
+
fileName: string;
|
|
188
|
+
rawContents?: string;
|
|
189
|
+
get typeLabel(): string;
|
|
190
|
+
get label(): string;
|
|
191
|
+
static format: string;
|
|
192
|
+
static validFileExtensions: Array<string>;
|
|
193
|
+
get validFileExtensions(): string[];
|
|
194
|
+
constructor(fullPath: string, opts?: {
|
|
195
|
+
overrideContents?: string;
|
|
196
|
+
overrideGitIgnored?: boolean;
|
|
197
|
+
});
|
|
198
|
+
finishInit(): Promise<void>;
|
|
199
|
+
abstract _parseContents(): Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
declare class DotEnvFileDataSource extends FileBasedDataSource {
|
|
202
|
+
static format: string;
|
|
203
|
+
static validFileExtensions: never[];
|
|
204
|
+
parsedFile?: ParsedEnvSpecFile;
|
|
205
|
+
private convertParserValueToResolvers;
|
|
206
|
+
_parseContents(): Promise<void>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
type ResolvedValue = undefined | string | number | boolean | RegExp;
|
|
210
|
+
type ResolverFunctionArgs = Array<Resolver | Record<string, Resolver>>;
|
|
211
|
+
declare abstract class Resolver {
|
|
212
|
+
readonly fnArgs: ResolverFunctionArgs;
|
|
213
|
+
static fnName?: string;
|
|
214
|
+
constructor(fnArgs: ResolverFunctionArgs);
|
|
215
|
+
abstract label: string;
|
|
216
|
+
abstract icon: string;
|
|
217
|
+
inferredType?: string;
|
|
218
|
+
_schemaErrors: Array<SchemaError>;
|
|
219
|
+
private _depsObj;
|
|
220
|
+
get childResolvers(): Array<Resolver>;
|
|
221
|
+
get schemaErrors(): Array<SchemaError>;
|
|
222
|
+
get depsObj(): Record<string, boolean>;
|
|
223
|
+
get deps(): string[];
|
|
224
|
+
protected abstract _process(ctx?: any): Promise<void | (() => void)>;
|
|
225
|
+
private configItem?;
|
|
226
|
+
process(configItem: ConfigItem): Promise<void>;
|
|
227
|
+
protected addDep(key: string): void;
|
|
228
|
+
protected abstract _resolve(): Promise<ResolvedValue>;
|
|
229
|
+
resolve(): Promise<ResolvedValue>;
|
|
230
|
+
protected getDepValue(key: string): ResolvedValue;
|
|
231
|
+
}
|
|
232
|
+
type ResolverChildClass<ChildClass extends Resolver = Resolver> = ({
|
|
233
|
+
new (...args: Array<any>): ChildClass;
|
|
234
|
+
} & typeof Resolver);
|
|
235
|
+
|
|
236
|
+
type ConfigItemDef = {
|
|
237
|
+
description?: string;
|
|
238
|
+
resolver?: Resolver;
|
|
239
|
+
decorators?: Record<string, ParsedEnvSpecDecorator>;
|
|
240
|
+
};
|
|
241
|
+
type ConfigItemDefAndSource = {
|
|
242
|
+
itemDef: ConfigItemDef;
|
|
243
|
+
source: EnvGraphDataSource;
|
|
244
|
+
};
|
|
245
|
+
declare class ConfigItem {
|
|
246
|
+
#private;
|
|
247
|
+
constructor(_envGraph: EnvGraph, _key: string);
|
|
248
|
+
get envGraph(): EnvGraph;
|
|
249
|
+
get key(): string;
|
|
250
|
+
defs: Array<ConfigItemDefAndSource>;
|
|
251
|
+
addDef(itemDef: ConfigItemDef, source: EnvGraphDataSource): void;
|
|
252
|
+
get description(): string | undefined;
|
|
253
|
+
get icon(): string | undefined;
|
|
254
|
+
get docsLinks(): {
|
|
255
|
+
url: string;
|
|
256
|
+
description?: string;
|
|
257
|
+
}[];
|
|
258
|
+
get valueResolver(): Resolver | undefined;
|
|
259
|
+
getDecorator(decoratorName: string): ParsedEnvSpecDecorator | undefined;
|
|
260
|
+
getDecoratorValueRaw(decoratorName: string): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
|
|
261
|
+
getDecoratorValueString(decoratorName: string): string | undefined;
|
|
262
|
+
dataType?: EnvGraphDataType;
|
|
263
|
+
schemaErrors: Array<SchemaError>;
|
|
264
|
+
get resolverSchemaErrors(): SchemaError[];
|
|
265
|
+
process(): Promise<void>;
|
|
266
|
+
get isRequired(): any;
|
|
267
|
+
get isSensitive(): any;
|
|
268
|
+
get errors(): (SchemaError | ValidationError | CoercionError | ResolutionError)[];
|
|
269
|
+
get validationState(): 'warn' | 'error' | 'valid';
|
|
270
|
+
/** resolved value _before coercion_ */
|
|
271
|
+
resolvedRawValue?: ResolvedValue;
|
|
272
|
+
isResolved: boolean;
|
|
273
|
+
/** resolved value after coercion */
|
|
274
|
+
resolvedValue?: ResolvedValue;
|
|
275
|
+
isValidated: boolean;
|
|
276
|
+
resolutionError?: ResolutionError;
|
|
277
|
+
coercionError?: CoercionError;
|
|
278
|
+
validationErrors?: Array<ValidationError>;
|
|
279
|
+
get isCoerced(): boolean;
|
|
280
|
+
resolve(): Promise<void>;
|
|
281
|
+
get isValid(): boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
type GraphNodeId = string;
|
|
285
|
+
type GraphAdjacencyList = Record<GraphNodeId, Array<GraphNodeId>>;
|
|
286
|
+
|
|
287
|
+
type SerializedEnvGraph = {
|
|
288
|
+
basePath?: string;
|
|
289
|
+
sources: Array<{
|
|
290
|
+
label: string;
|
|
291
|
+
enabled: boolean;
|
|
292
|
+
path?: string;
|
|
293
|
+
}>;
|
|
294
|
+
settings: {
|
|
295
|
+
redactLogs?: boolean;
|
|
296
|
+
preventLeaks?: boolean;
|
|
297
|
+
};
|
|
298
|
+
config: Record<string, {
|
|
299
|
+
value: any;
|
|
300
|
+
isSensitive: boolean;
|
|
301
|
+
}>;
|
|
302
|
+
};
|
|
303
|
+
/** container of the overall graph and current resolution attempt / values */
|
|
304
|
+
declare class EnvGraph {
|
|
305
|
+
basePath?: string;
|
|
306
|
+
/** array of data sources */
|
|
307
|
+
dataSources: Array<EnvGraphDataSource>;
|
|
308
|
+
finalOverridesDataSource?: EnvGraphDataSource;
|
|
309
|
+
/** config item key of env flag (toggles env-specific data sources enabled) */
|
|
310
|
+
envFlagKey?: string;
|
|
311
|
+
/** current value of the environment flag */
|
|
312
|
+
envFlagValue?: string;
|
|
313
|
+
configSchema: Record<string, ConfigItem>;
|
|
314
|
+
addDataSource(dataSource: EnvGraphDataSource): void;
|
|
315
|
+
get schemaDataSource(): EnvGraphDataSource | undefined;
|
|
316
|
+
get sortedDataSources(): EnvGraphDataSource[];
|
|
317
|
+
registeredResolverFunctions: Record<string, ResolverChildClass>;
|
|
318
|
+
registerResolver(resolverClass: ResolverChildClass): void;
|
|
319
|
+
dataTypesRegistry: Record<string, EnvGraphDataTypeFactory>;
|
|
320
|
+
registerDataType(factory: EnvGraphDataTypeFactory): void;
|
|
321
|
+
constructor();
|
|
322
|
+
finishLoad(): Promise<void>;
|
|
323
|
+
get graphAdjacencyList(): GraphAdjacencyList;
|
|
324
|
+
resolveEnvValues(): Promise<void>;
|
|
325
|
+
getResolvedEnvObject(): Record<string, any>;
|
|
326
|
+
getSerializedGraph(): SerializedEnvGraph;
|
|
327
|
+
get isInvalid(): boolean;
|
|
328
|
+
generateTypes(lang: string, outputPath: string): Promise<void>;
|
|
329
|
+
getRootDecoratorValue(decoratorName: string): any;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare function resetRedactionMap(graph: SerializedEnvGraph): void;
|
|
333
|
+
/**
|
|
334
|
+
* Redacts senstive config values from any string/array/object/etc
|
|
335
|
+
*
|
|
336
|
+
* NOTE - must be used only after varlock has loaded config
|
|
337
|
+
* */
|
|
338
|
+
declare function redactSensitiveConfig(o: any): any;
|
|
339
|
+
/**
|
|
340
|
+
* utility to unmask a secret/sensitive value when logging to the console
|
|
341
|
+
* currently this only works on a single secret, not objects or aggregated strings
|
|
342
|
+
* */
|
|
343
|
+
declare function revealSensitiveConfig(secretStr: string): string;
|
|
344
|
+
declare function scanForLeaks(toScan: string | ReadableStream | null, meta?: {
|
|
345
|
+
method?: string;
|
|
346
|
+
file?: string;
|
|
347
|
+
}): string | ReadableStream<any> | null;
|
|
348
|
+
declare const varlockSettings: Record<string, any>;
|
|
349
|
+
declare function initVarlockEnv(opts?: {
|
|
350
|
+
allowFail?: boolean;
|
|
351
|
+
}): void;
|
|
352
|
+
interface TypedEnvSchema {
|
|
353
|
+
}
|
|
354
|
+
declare const ENV: TypedEnvSchema;
|
|
355
|
+
|
|
356
|
+
export { ConfigLoadError as C, DotEnvFileDataSource as D, EnvGraph as E, ProcessEnvDataSource as P, ResolutionError as R, SchemaError as S, type TypedEnvSchema as T, ValidationError as V, CoercionError as a, type SerializedEnvGraph as b, ENV as c, redactSensitiveConfig as d, revealSensitiveConfig as e, initVarlockEnv as i, resetRedactionMap as r, scanForLeaks as s, varlockSettings as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { E as EnvGraph, D as DotEnvFileDataSource, P as ProcessEnvDataSource, C as ConfigLoadError, S as SchemaError, V as ValidationError, a as CoercionError, R as ResolutionError, i as initVarlockEnv } from './env-KH4bPru7.js';
|
|
2
|
+
export { c as ENV, b as SerializedEnvGraph } from './env-KH4bPru7.js';
|
|
2
3
|
export { patchGlobalConsole } from './runtime/patch-console.js';
|
|
3
4
|
export { patchGlobalServerResponse } from './runtime/patch-server-response.js';
|
|
4
5
|
export { patchGlobalResponse } from './runtime/patch-response.js';
|
|
6
|
+
import '@env-spec/parser';
|
|
7
|
+
import '@env-spec/utils/type-utils';
|
|
8
|
+
|
|
9
|
+
declare function loadEnvGraph(opts?: {
|
|
10
|
+
basePath?: string;
|
|
11
|
+
relativePaths?: Array<string>;
|
|
12
|
+
checkGitIgnored?: boolean;
|
|
13
|
+
excludeDirs?: Array<string>;
|
|
14
|
+
currentEnvFallback?: string;
|
|
15
|
+
afterInit?: (graph: EnvGraph) => Promise<void>;
|
|
16
|
+
}): Promise<EnvGraph>;
|
|
17
|
+
|
|
18
|
+
declare function checkForConfigErrors(envGraph: EnvGraph, opts?: {
|
|
19
|
+
showAll?: boolean;
|
|
20
|
+
}): void;
|
|
21
|
+
|
|
22
|
+
declare function loadVarlockEnvGraph(opts?: {
|
|
23
|
+
currentEnvFallback?: string;
|
|
24
|
+
}): Promise<EnvGraph>;
|
|
5
25
|
|
|
6
26
|
declare function load(): Promise<void>;
|
|
7
27
|
declare function getBuildTimeReplacements(opts?: {
|
|
8
28
|
objectKey?: string;
|
|
9
29
|
includeSensitive?: boolean;
|
|
10
30
|
}): Record<string, string>;
|
|
31
|
+
declare const internal: {
|
|
32
|
+
EnvGraph: typeof EnvGraph;
|
|
33
|
+
DotEnvFileDataSource: typeof DotEnvFileDataSource;
|
|
34
|
+
ProcessEnvDataSource: typeof ProcessEnvDataSource;
|
|
35
|
+
loadEnvGraph: typeof loadEnvGraph;
|
|
36
|
+
ConfigLoadError: typeof ConfigLoadError;
|
|
37
|
+
SchemaError: typeof SchemaError;
|
|
38
|
+
ValidationError: typeof ValidationError;
|
|
39
|
+
CoercionError: typeof CoercionError;
|
|
40
|
+
ResolutionError: typeof ResolutionError;
|
|
41
|
+
loadVarlockEnvGraph: typeof loadVarlockEnvGraph;
|
|
42
|
+
checkForConfigErrors: typeof checkForConfigErrors;
|
|
43
|
+
initVarlockEnv: typeof initVarlockEnv;
|
|
44
|
+
};
|
|
11
45
|
|
|
12
|
-
export { getBuildTimeReplacements, load };
|
|
46
|
+
export { getBuildTimeReplacements, internal, load };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { checkForConfigErrors } from './chunk-
|
|
2
|
-
import { loadVarlockEnvGraph } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export { patchGlobalServerResponse } from './chunk-67DF2S4X.js';
|
|
10
|
-
import { initVarlockEnv } from './chunk-7NCUE6IU.js';
|
|
11
|
-
export { ENV } from './chunk-7NCUE6IU.js';
|
|
1
|
+
import { checkForConfigErrors } from './chunk-PB7RWVE6.js';
|
|
2
|
+
import { loadVarlockEnvGraph } from './chunk-ZUG7BEY5.js';
|
|
3
|
+
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError, loadEnvGraph, ProcessEnvDataSource, DotEnvFileDataSource, EnvGraph } from './chunk-ZW2T4C6A.js';
|
|
4
|
+
export { patchGlobalConsole } from './chunk-CYYLAV42.js';
|
|
5
|
+
export { patchGlobalResponse } from './chunk-ELJZUQX3.js';
|
|
6
|
+
export { patchGlobalServerResponse } from './chunk-FLO6F7B6.js';
|
|
7
|
+
import { initVarlockEnv } from './chunk-2CM4YUFY.js';
|
|
8
|
+
export { ENV } from './chunk-2CM4YUFY.js';
|
|
12
9
|
import './chunk-FGMXIEFA.js';
|
|
13
10
|
import { __name } from './chunk-XN24GZXQ.js';
|
|
14
11
|
|
|
@@ -34,7 +31,25 @@ function getBuildTimeReplacements(opts) {
|
|
|
34
31
|
return replacements;
|
|
35
32
|
}
|
|
36
33
|
__name(getBuildTimeReplacements, "getBuildTimeReplacements");
|
|
34
|
+
var internal = {
|
|
35
|
+
// Core classes
|
|
36
|
+
EnvGraph,
|
|
37
|
+
DotEnvFileDataSource,
|
|
38
|
+
ProcessEnvDataSource,
|
|
39
|
+
// Loader function
|
|
40
|
+
loadEnvGraph,
|
|
41
|
+
// Error classes
|
|
42
|
+
ConfigLoadError,
|
|
43
|
+
SchemaError,
|
|
44
|
+
ValidationError,
|
|
45
|
+
CoercionError,
|
|
46
|
+
ResolutionError,
|
|
47
|
+
// Varlock-specific utilities
|
|
48
|
+
loadVarlockEnvGraph,
|
|
49
|
+
checkForConfigErrors,
|
|
50
|
+
initVarlockEnv
|
|
51
|
+
};
|
|
37
52
|
|
|
38
|
-
export { getBuildTimeReplacements, load };
|
|
53
|
+
export { getBuildTimeReplacements, internal, load };
|
|
39
54
|
//# sourceMappingURL=index.js.map
|
|
40
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,IAAA,GAAO;AAE3B,EAAA,MAAM,QAAA,GAAW,MAAM,mBAAA,EAAoB;AAC3C,EAAA,MAAM,SAAS,gBAAA,EAAiB;AAChC,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAG7B,EAAA,OAAA,CAAQ,IAAI,aAAA,GAAgB,IAAA,CAAK,SAAA,CAAU,QAAA,CAAS,oBAAoB,CAAA;AACxE,EAAA,cAAA,EAAe;AAEjB;AAVsB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAaf,SAAS,yBAAyB,IAAA,EAGtC;AACD,EAAA,IAAI,CAAC,OAAA,CAAQ,GAAA,CAAI,aAAA,SAAsB,EAAC;AACxC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,IAAI,aAAa,CAAA;AACpD,EAAA,MAAM,eAAe,EAAC;AACtB,EAAA,KAAA,MAAW,GAAA,IAAO,QAAQ,MAAA,EAAQ;AAChC,IAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,GAAG,CAAA;AACnC,IAAA,MAAM,WAAA,GAAc,CAAC,QAAA,CAAS,WAAA,IAAe,IAAA,EAAM,gBAAA;AACnD,IAAA,IAAI,CAAC,WAAA,EAAa;AAClB,IAAA,YAAA,CAAa,CAAA,EAAG,IAAA,EAAM,SAAA,IAAa,KAAK,IAAI,GAAG,CAAA,CAAE,CAAA,GAAI,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,MAAA,CAAO,GAAG,EAAE,KAAK,CAAA;AAAA,EAC/F;AACA,EAAA,OAAO,YAAA;AACT;AAdgB,MAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AAiBT,IAAM,QAAA,GAAW;AAAA;AAAA,EAEtB,QAAA;AAAA,EACA,oBAAA;AAAA,EACA,oBAAA;AAAA;AAAA,EAGA,YAAA;AAAA;AAAA,EAGA,eAAA;AAAA,EACA,WAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,eAAA;AAAA;AAAA,EAGA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["import { checkForConfigErrors } from './cli/helpers/error-checks';\nimport { loadVarlockEnvGraph } from './lib/load-graph';\nimport { initVarlockEnv } from './runtime/env';\n\n// Import env-graph components for internal API\nimport {\n EnvGraph,\n loadEnvGraph,\n DotEnvFileDataSource,\n ProcessEnvDataSource,\n ConfigLoadError,\n SchemaError,\n ValidationError,\n CoercionError,\n ResolutionError,\n type SerializedEnvGraph,\n} from '../env-graph';\n\nexport async function load() {\n // TODO: add some options\n const envGraph = await loadVarlockEnvGraph();\n await envGraph.resolveEnvValues();\n checkForConfigErrors(envGraph);\n\n // loadFromSerializedGraph(envGraph.getSerializedGraph());\n process.env.__VARLOCK_ENV = JSON.stringify(envGraph.getSerializedGraph());\n initVarlockEnv();\n // TODO: return resolved env and schema / meta info\n}\n\n\nexport function getBuildTimeReplacements(opts?: {\n objectKey?: string,\n includeSensitive?: boolean,\n}) {\n if (!process.env.__VARLOCK_ENV) return {};\n const envInfo = JSON.parse(process.env.__VARLOCK_ENV) as SerializedEnvGraph;\n const replacements = {} as Record<string, string>;\n for (const key in envInfo.config) {\n const itemInfo = envInfo.config[key];\n const replaceItem = !itemInfo.isSensitive || opts?.includeSensitive;\n if (!replaceItem) continue;\n replacements[`${opts?.objectKey || 'ENV'}.${key}`] = JSON.stringify(envInfo.config[key].value);\n }\n return replacements;\n}\n\n// Internal API for direct env graph manipulation\nexport const internal = {\n // Core classes\n EnvGraph,\n DotEnvFileDataSource,\n ProcessEnvDataSource,\n\n // Loader function\n loadEnvGraph,\n\n // Error classes\n ConfigLoadError,\n SchemaError,\n ValidationError,\n CoercionError,\n ResolutionError,\n\n // Varlock-specific utilities\n loadVarlockEnvGraph,\n checkForConfigErrors,\n initVarlockEnv,\n};\n\nexport { patchGlobalConsole } from './runtime/patch-console';\nexport { patchGlobalServerResponse } from './runtime/patch-server-response';\nexport { patchGlobalResponse } from './runtime/patch-response';\nexport { ENV } from './runtime/env';\nexport type { SerializedEnvGraph };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-4WMY2EW3.js';
|
|
2
|
+
import './chunk-FYLMYWUF.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-ZUG7BEY5.js';
|
|
5
|
+
import './chunk-ZW2T4C6A.js';
|
|
6
|
+
import './chunk-FGMXIEFA.js';
|
|
7
|
+
import './chunk-XN24GZXQ.js';
|
|
8
|
+
//# sourceMappingURL=init.command-ZRQOE2OK.js.map
|
|
9
|
+
//# sourceMappingURL=init.command-ZRQOE2OK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-ZRQOE2OK.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-4CE75BSX.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-PB7RWVE6.js';
|
|
4
|
+
import './chunk-ZUG7BEY5.js';
|
|
5
|
+
import './chunk-ZW2T4C6A.js';
|
|
6
|
+
import './chunk-FGMXIEFA.js';
|
|
7
|
+
import './chunk-XN24GZXQ.js';
|
|
8
|
+
//# sourceMappingURL=load.command-YBN3BW6U.js.map
|
|
9
|
+
//# sourceMappingURL=load.command-YBN3BW6U.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-YBN3BW6U.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-GWQT5VGW.js';
|
|
2
|
+
import './chunk-FYLMYWUF.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-ZW2T4C6A.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=login.command-F5AWKZKA.js.map
|
|
8
|
+
//# sourceMappingURL=login.command-F5AWKZKA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"login.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"login.command-F5AWKZKA.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-KCX4NC7Q.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-PB7RWVE6.js';
|
|
4
|
+
import './chunk-ZUG7BEY5.js';
|
|
5
|
+
import './chunk-ZW2T4C6A.js';
|
|
6
|
+
import './chunk-FGMXIEFA.js';
|
|
7
|
+
import './chunk-XN24GZXQ.js';
|
|
8
|
+
//# sourceMappingURL=run.command-WWJ6ZE26.js.map
|
|
9
|
+
//# sourceMappingURL=run.command-WWJ6ZE26.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-WWJ6ZE26.js"}
|
package/dist/runtime/env.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as ENV, T as TypedEnvSchema, i as initVarlockEnv, d as redactSensitiveConfig, r as resetRedactionMap, e as revealSensitiveConfig, s as scanForLeaks, v as varlockSettings } from '../env-KH4bPru7.js';
|
|
2
|
+
import '@env-spec/parser';
|
|
3
|
+
import '@env-spec/utils/type-utils';
|
package/dist/runtime/env.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ENV, initVarlockEnv, redactSensitiveConfig, resetRedactionMap, revealSensitiveConfig, scanForLeaks, varlockSettings } from '../chunk-
|
|
1
|
+
export { ENV, initVarlockEnv, redactSensitiveConfig, resetRedactionMap, revealSensitiveConfig, scanForLeaks, varlockSettings } from '../chunk-2CM4YUFY.js';
|
|
2
2
|
import '../chunk-FGMXIEFA.js';
|
|
3
3
|
import '../chunk-XN24GZXQ.js';
|
|
4
4
|
//# sourceMappingURL=env.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { patchGlobalConsole, unpatchGlobalConsole } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { patchGlobalConsole, unpatchGlobalConsole } from '../chunk-CYYLAV42.js';
|
|
2
|
+
import '../chunk-2CM4YUFY.js';
|
|
3
3
|
import '../chunk-FGMXIEFA.js';
|
|
4
4
|
import '../chunk-XN24GZXQ.js';
|
|
5
5
|
//# sourceMappingURL=patch-console.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { patchGlobalResponse } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { patchGlobalResponse } from '../chunk-ELJZUQX3.js';
|
|
2
|
+
import '../chunk-2CM4YUFY.js';
|
|
3
3
|
import '../chunk-FGMXIEFA.js';
|
|
4
4
|
import '../chunk-XN24GZXQ.js';
|
|
5
5
|
//# sourceMappingURL=patch-response.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { patchGlobalServerResponse } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { patchGlobalServerResponse } from '../chunk-FLO6F7B6.js';
|
|
2
|
+
import '../chunk-2CM4YUFY.js';
|
|
3
3
|
import '../chunk-FGMXIEFA.js';
|
|
4
4
|
import '../chunk-XN24GZXQ.js';
|
|
5
5
|
//# sourceMappingURL=patch-server-response.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-LS6F7BSZ.js';
|
|
2
|
+
import './chunk-FYLMYWUF.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-ZW2T4C6A.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=telemetry.command-IS2JLIZM.js.map
|
|
8
|
+
//# sourceMappingURL=telemetry.command-IS2JLIZM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-IS2JLIZM.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varlock",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"debug": "^4.
|
|
68
|
+
"debug": "^4.4.1",
|
|
69
69
|
"execa": "^9.6.0",
|
|
70
70
|
"which": "^5.0.0",
|
|
71
|
-
"@env-spec/parser": "^0.0.
|
|
71
|
+
"@env-spec/parser": "^0.0.4"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@clack/core": "^0.5.0",
|
|
75
75
|
"@clack/prompts": "^0.11.0",
|
|
76
|
-
"@sindresorhus/is": "^7.0.
|
|
76
|
+
"@sindresorhus/is": "^7.0.2",
|
|
77
77
|
"@types/debug": "^4.1.12",
|
|
78
|
-
"@types/node": "^
|
|
78
|
+
"@types/node": "^24.2.0",
|
|
79
79
|
"@types/which": "^3.0.4",
|
|
80
80
|
"@yao-pkg/pkg": "^6.6.0",
|
|
81
81
|
"ansis": "^4.1.0",
|
|
@@ -87,9 +87,8 @@
|
|
|
87
87
|
"is-unicode-supported": "^2.1.0",
|
|
88
88
|
"is-wsl": "^3.1.0",
|
|
89
89
|
"outdent": "^0.8.0",
|
|
90
|
-
"tsup": "^8.
|
|
90
|
+
"tsup": "^8.5.0",
|
|
91
91
|
"vitest": "^3.2.4",
|
|
92
|
-
"@env-spec/env-graph": "0.0.0",
|
|
93
92
|
"@env-spec/utils": "0.0.0"
|
|
94
93
|
},
|
|
95
94
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/patch-response.ts"],"names":[],"mappings":";;;;AAGO,SAAS,mBAAA,GAAsB;AACpC,EAAA,KAAA,CAAM,uCAA6B,CAAA;AACnC,EAAA,IAAI,CAAE,UAAA,CAAW,QAAA,CAAiB,iBAAA,EAAmB;AACnD,IAAA,KAAA,CAAM,mBAAmB,CAAA;AACzB,IAAA;AAAA,EACF;AACA,EAAA,IAAI,eAAA,CAAgB,iBAAiB,KAAA,EAAO;AAC1C,IAAA,KAAA,CAAM,wBAAwB,CAAA;AAC9B,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,qBAAqB,UAAA,CAAW,QAAA;AACtC,EAAA,UAAA,CAAW,QAAA,GAAW,MAAM,sBAAA,SAA+B,kBAAA,CAAmB;AAAA,IAfhF;AAegF,MAAA,MAAA,CAAA,IAAA,EAAA,wBAAA,CAAA;AAAA;AAAA,IAC5E,OAAO,iBAAA,GAAoB,IAAA;AAAA,IAC3B,WAAA,CAAY,MAAW,IAAA,EAAW;AAChC,MAAA,KAAA,CAAM,2CAAiC,CAAA;AACvC,MAAA,KAAA,CAAM,aAAa,IAAA,EAAM,EAAE,QAAQ,8BAAA,EAAgC,GAAU,IAAI,CAAA;AAAA,IACnF;AAAA,IACA,OAAO,IAAA,CAAK,IAAA,EAAW,IAAA,EAAW;AAChC,MAAA,KAAA,CAAM,oCAA0B,CAAA;AAChC,MAAA,YAAA,CAAa,KAAK,SAAA,CAAU,IAAI,GAAG,EAAE,MAAA,EAAQ,yBAAyB,CAAA;AACtE,MAAA,MAAM,CAAA,GAAI,kBAAA,CAAmB,IAAA,CAAK,IAAA,EAAM,IAAI,CAAA;AAC5C,MAAA,MAAA,CAAO,cAAA,CAAe,CAAA,EAAG,QAAA,CAAS,SAAS,CAAA;AAC3C,MAAA,OAAO,CAAA;AAAA,IACT;AAAA,GACF;AACF;AA1BgB,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA","file":"chunk-2AA6IZBK.js","sourcesContent":["import { scanForLeaks, varlockSettings } from './env';\nimport { debug } from './lib/debug';\n\nexport function patchGlobalResponse() {\n debug('⚡️ PATCHING global Response');\n if (!(globalThis.Response as any)._patchedByVarlock) {\n debug('> already patched');\n return;\n }\n if (varlockSettings.preventLeaks === false) {\n debug('> disabled by settings');\n return;\n }\n\n const _UnpatchedResponse = globalThis.Response;\n globalThis.Response = class VarlockPatchedResponse extends _UnpatchedResponse {\n static _patchedByVarlock = true;\n constructor(body: any, init: any) {\n debug('⚡️ patched Response constructor');\n super(scanForLeaks(body, { method: 'patched Response constructor' }) as any, init);\n }\n static json(data: any, init: any) {\n debug('⚡️ patched Response.json');\n scanForLeaks(JSON.stringify(data), { method: 'patched Response.json' });\n const r = _UnpatchedResponse.json(data, init);\n Object.setPrototypeOf(r, Response.prototype);\n return r;\n }\n };\n}\n"]}
|