configorama 0.11.0 → 1.0.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 +429 -123
- package/cli.js +282 -49
- package/index.d.ts +43 -1
- package/package.json +5 -1
- package/src/capabilities.js +59 -0
- package/src/capabilities.test.js +44 -0
- package/src/display.js +70 -7
- package/src/display.test.js +82 -0
- package/src/errors.js +73 -0
- package/src/index.js +91 -1
- package/src/main.js +159 -19
- package/src/parsers/esm.js +1 -16
- package/src/parsers/typescript.js +1 -48
- package/src/resolvers/valueFromCron.js +4 -25
- package/src/resolvers/valueFromEval.js +11 -1
- package/src/resolvers/valueFromFile.js +8 -1
- package/src/resolvers/valueFromGit.js +43 -17
- package/src/resolvers/valueFromOptions.js +5 -4
- package/src/utils/filters/filterArgs.js +57 -0
- package/src/utils/filters/oneOf.js +77 -0
- package/src/utils/introspection/audit.js +78 -0
- package/src/utils/introspection/graph.js +43 -0
- package/src/utils/introspection/model.js +150 -0
- package/src/utils/introspection/model.test.js +93 -0
- package/src/utils/parsing/commentAnnotations.js +107 -0
- package/src/utils/parsing/commentAnnotations.test.js +123 -0
- package/src/utils/parsing/enrichMetadata.js +64 -1
- package/src/utils/parsing/enrichMetadata.test.js +84 -0
- package/src/utils/parsing/extractComment.js +145 -0
- package/src/utils/parsing/extractComment.test.js +182 -0
- package/src/utils/parsing/preProcess.js +2 -1
- package/src/utils/paths/findLineForKey.js +2 -2
- package/src/utils/paths/ignorePaths.js +22 -9
- package/src/utils/redaction/redact.js +78 -0
- package/src/utils/redaction/redact.test.js +38 -0
- package/src/utils/redaction/setupRedaction.js +47 -0
- package/src/utils/redaction/setupRedaction.test.js +68 -0
- package/src/utils/requirements/configRequirements.js +351 -0
- package/src/utils/requirements/configRequirements.test.js +380 -0
- package/src/utils/requirements/serializeRequirements.js +120 -0
- package/src/utils/requirements/serializeRequirements.test.js +211 -0
- package/src/utils/security/evalSafety.js +86 -0
- package/src/utils/security/evalSafety.test.js +61 -0
- package/src/utils/security/safetyPolicy.js +110 -0
- package/src/utils/security/safetyPolicy.test.js +29 -0
- package/src/utils/strings/didYouMean.js +70 -0
- package/src/utils/strings/didYouMean.test.js +52 -0
- package/src/utils/strings/formatFunctionArgs.js +6 -1
- package/src/utils/strings/splitByComma.js +5 -0
- package/src/utils/ui/configWizard.js +208 -34
- package/src/utils/ui/createEditorLink.js +17 -1
- package/src/utils/ui/promptDescriptors.js +196 -0
- package/src/utils/ui/promptDescriptors.test.js +162 -0
- package/src/utils/variables/cleanVariable.js +22 -0
- package/src/utils/variables/getVariableType.js +1 -0
- package/types/src/index.d.ts +0 -24
- package/types/src/index.d.ts.map +1 -1
- package/types/src/main.d.ts +16 -8
- package/types/src/main.d.ts.map +1 -1
- package/types/src/resolvers/valueFromFile.d.ts +0 -2
- package/types/src/resolvers/valueFromFile.d.ts.map +1 -1
- package/types/src/resolvers/valueFromGit.d.ts.map +1 -1
- package/types/src/resolvers/valueFromSelf.d.ts +1 -0
- package/types/src/resolvers/valueFromSelf.d.ts.map +1 -0
- package/types/src/utils/parsing/parse.d.ts.map +1 -1
- package/types/src/utils/parsing/preProcess.d.ts.map +1 -1
- package/types/src/utils/paths/findLineForKey.d.ts +0 -9
- package/types/src/utils/paths/findLineForKey.d.ts.map +1 -1
- package/types/src/utils/strings/replaceAll.d.ts.map +1 -1
- package/types/src/utils/variables/variableUtils.d.ts +1 -1
- package/types/src/display.d.ts +0 -62
- package/types/src/display.d.ts.map +0 -1
- package/types/src/metadata.d.ts +0 -28
- package/types/src/metadata.d.ts.map +0 -1
- package/types/src/utils/BoundedMap.d.ts +0 -10
- package/types/src/utils/BoundedMap.d.ts.map +0 -1
- package/types/src/utils/paths/ignorePaths.d.ts +0 -5
- package/types/src/utils/paths/ignorePaths.d.ts.map +0 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const { test } = require('uvu')
|
|
2
|
+
const assert = require('uvu/assert')
|
|
3
|
+
const {
|
|
4
|
+
createPromptDescriptor,
|
|
5
|
+
createPromptDescriptors,
|
|
6
|
+
groupRequirementsForWizard,
|
|
7
|
+
normalizePromptValue,
|
|
8
|
+
selectPromptType,
|
|
9
|
+
stripPromptQuotes,
|
|
10
|
+
validatePromptValue,
|
|
11
|
+
} = require('./promptDescriptors')
|
|
12
|
+
|
|
13
|
+
function req(overrides) {
|
|
14
|
+
return {
|
|
15
|
+
name: 'stage',
|
|
16
|
+
variable: 'option:stage',
|
|
17
|
+
variableType: 'option',
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true,
|
|
20
|
+
sensitive: false,
|
|
21
|
+
description: null,
|
|
22
|
+
default: null,
|
|
23
|
+
allowedValues: null,
|
|
24
|
+
paths: ['stage'],
|
|
25
|
+
conflicts: [],
|
|
26
|
+
...overrides,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
test('groupRequirementsForWizard maps requirements to wizard groups', () => {
|
|
31
|
+
const grouped = groupRequirementsForWizard([
|
|
32
|
+
req({ variableType: 'option' }),
|
|
33
|
+
req({ variableType: 'env' }),
|
|
34
|
+
req({ variableType: 'self' }),
|
|
35
|
+
req({ variableType: 'dotProp' }),
|
|
36
|
+
req({ variableType: 'file' }),
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
assert.is(grouped.options.length, 1)
|
|
40
|
+
assert.is(grouped.env.length, 1)
|
|
41
|
+
assert.is(grouped.self.length, 1)
|
|
42
|
+
assert.is(grouped.dotProp.length, 1)
|
|
43
|
+
assert.is(grouped.files.length, 1)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('groupRequirementsForWizard supports annotation display groups', () => {
|
|
47
|
+
const grouped = groupRequirementsForWizard([
|
|
48
|
+
req({ variableType: 'env', group: 'Payments' }),
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
assert.is(grouped.Payments.length, 1)
|
|
52
|
+
assert.is(grouped.env.length, 0)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('selectPromptType covers sensitivity, enum, boolean, array, and text modes', () => {
|
|
56
|
+
assert.is(selectPromptType(req({ sensitive: true })), 'password')
|
|
57
|
+
assert.is(selectPromptType(req({ allowedValues: ['dev', 'prod'] })), 'select')
|
|
58
|
+
assert.is(selectPromptType(req({ type: 'array', allowedValues: ['a', 'b'] })), 'multiselect')
|
|
59
|
+
assert.is(selectPromptType(req({ type: 'boolean' })), 'confirm')
|
|
60
|
+
assert.is(selectPromptType(req({ type: 'object' })), 'text')
|
|
61
|
+
assert.is(selectPromptType(req({ type: 'json' })), 'text')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('createPromptDescriptor strips quoted defaults and reads current env values', () => {
|
|
65
|
+
const envName = 'CONFIGORAMA_DESCRIPTOR_ENV'
|
|
66
|
+
const previous = process.env[envName]
|
|
67
|
+
process.env[envName] = 'from-env'
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const optionDescriptor = createPromptDescriptor(req({
|
|
71
|
+
default: '"dev"',
|
|
72
|
+
}))
|
|
73
|
+
assert.is(optionDescriptor.defaultValue, 'dev')
|
|
74
|
+
assert.is(optionDescriptor.placeholder, 'dev')
|
|
75
|
+
|
|
76
|
+
const envDescriptor = createPromptDescriptor(req({
|
|
77
|
+
name: envName,
|
|
78
|
+
variable: `env:${envName}`,
|
|
79
|
+
variableType: 'env',
|
|
80
|
+
default: null,
|
|
81
|
+
}))
|
|
82
|
+
assert.is(envDescriptor.defaultValue, 'from-env')
|
|
83
|
+
assert.is(envDescriptor.placeholder, 'from-env')
|
|
84
|
+
} finally {
|
|
85
|
+
if (previous === undefined) delete process.env[envName]
|
|
86
|
+
else process.env[envName] = previous
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('createPromptDescriptor includes conflict warning metadata without throwing', () => {
|
|
91
|
+
const descriptor = createPromptDescriptor(req({
|
|
92
|
+
conflicts: [
|
|
93
|
+
{ field: 'type', paths: ['stage', 'provider.stage'], values: [] }
|
|
94
|
+
]
|
|
95
|
+
}))
|
|
96
|
+
|
|
97
|
+
assert.equal(descriptor.conflicts, [
|
|
98
|
+
{ field: 'type', paths: ['stage', 'provider.stage'], values: [] }
|
|
99
|
+
])
|
|
100
|
+
assert.is(descriptor.conflictWarning, 'type conflict at stage, provider.stage')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('createPromptDescriptor carries annotation metadata without changing runtime defaults', () => {
|
|
104
|
+
const descriptor = createPromptDescriptor(req({
|
|
105
|
+
name: 'API_KEY',
|
|
106
|
+
variable: 'env:API_KEY',
|
|
107
|
+
variableType: 'env',
|
|
108
|
+
group: 'Payments',
|
|
109
|
+
sensitive: false,
|
|
110
|
+
obtainHint: 'Stripe dashboard > Developers > API keys',
|
|
111
|
+
examples: ['sk_live_...'],
|
|
112
|
+
defaultHint: 'Set in CI',
|
|
113
|
+
deprecationMessage: 'Use STRIPE_RESTRICTED_KEY instead',
|
|
114
|
+
default: null,
|
|
115
|
+
}))
|
|
116
|
+
|
|
117
|
+
assert.is(descriptor.group, 'Payments')
|
|
118
|
+
assert.is(descriptor.sensitive, false)
|
|
119
|
+
assert.is(descriptor.promptType, 'text')
|
|
120
|
+
assert.is(descriptor.obtainHint, 'Stripe dashboard > Developers > API keys')
|
|
121
|
+
assert.equal(descriptor.examples, ['sk_live_...'])
|
|
122
|
+
assert.is(descriptor.defaultHint, 'Set in CI')
|
|
123
|
+
assert.is(descriptor.deprecationMessage, 'Use STRIPE_RESTRICTED_KEY instead')
|
|
124
|
+
assert.is(descriptor.defaultValue, null)
|
|
125
|
+
assert.is(descriptor.placeholder, 'Enter environment variable for API_KEY')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
test('createPromptDescriptor uses sensitive override for prompt type', () => {
|
|
129
|
+
assert.is(createPromptDescriptor(req({ name: 'PUBLIC_VALUE', sensitive: true })).promptType, 'password')
|
|
130
|
+
assert.is(createPromptDescriptor(req({ name: 'API_KEY', sensitive: false })).promptType, 'text')
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
test('normalizePromptValue coerces descriptor values', () => {
|
|
134
|
+
assert.is(stripPromptQuotes("'dev'"), 'dev')
|
|
135
|
+
assert.is(normalizePromptValue('4', { type: 'number' }), 4)
|
|
136
|
+
assert.is(normalizePromptValue('yes', { type: 'boolean' }), true)
|
|
137
|
+
assert.equal(normalizePromptValue('a, b,c', { type: 'array' }), ['a', 'b', 'c'])
|
|
138
|
+
assert.equal(normalizePromptValue('{"a":1}', { type: 'object' }), { a: 1 })
|
|
139
|
+
assert.is(normalizePromptValue('', { type: 'string', defaultValue: 'fallback' }), 'fallback')
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
test('validatePromptValue validates required, allowed, number, boolean, and JSON values', () => {
|
|
143
|
+
assert.is(validatePromptValue('', { required: true, type: 'string' }), 'This value is required')
|
|
144
|
+
assert.match(validatePromptValue('qa', { type: 'string', allowedValues: ['dev', 'prod'] }), /Must be one of/)
|
|
145
|
+
assert.match(validatePromptValue('abc', { type: 'number' }), /valid number/)
|
|
146
|
+
assert.match(validatePromptValue('maybe', { type: 'boolean' }), /boolean/)
|
|
147
|
+
assert.match(validatePromptValue('{bad', { type: 'json' }), /valid JSON/)
|
|
148
|
+
assert.is(validatePromptValue('{"ok":true}', { type: 'json' }), undefined)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('createPromptDescriptors returns serializable prompt decisions plus pure helpers', () => {
|
|
152
|
+
const descriptors = createPromptDescriptors([
|
|
153
|
+
req({ allowedValues: ['dev', 'prod'] }),
|
|
154
|
+
])
|
|
155
|
+
|
|
156
|
+
assert.is(descriptors.length, 1)
|
|
157
|
+
assert.is(descriptors[0].promptType, 'select')
|
|
158
|
+
assert.is(descriptors[0].validate('dev'), undefined)
|
|
159
|
+
assert.is(descriptors[0].normalize('prod'), 'prod')
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
test.run()
|
|
@@ -2,6 +2,9 @@ const { findNestedVariables } = require('./findNestedVariables')
|
|
|
2
2
|
const { functionRegex, fileRefSyntax } = require('../regex')
|
|
3
3
|
|
|
4
4
|
const DEBUG = false
|
|
5
|
+
// cleanVariable is a pure function of (match, variableSyntax); the same variable
|
|
6
|
+
// strings recur many times per run, so cache results per syntax regex.
|
|
7
|
+
const cleanCache = new WeakMap()
|
|
5
8
|
/**
|
|
6
9
|
* Convert variable into string
|
|
7
10
|
* ${opt:foo} => 'opt:foo'
|
|
@@ -47,10 +50,29 @@ module.exports = function cleanVariable(
|
|
|
47
50
|
// process.exit(1)
|
|
48
51
|
/** */
|
|
49
52
|
|
|
53
|
+
const cacheable = variableSyntax && typeof variableSyntax === 'object'
|
|
54
|
+
let inner = cacheable ? cleanCache.get(variableSyntax) : undefined
|
|
55
|
+
if (inner) {
|
|
56
|
+
const hit = inner.get(varToClean)
|
|
57
|
+
if (hit !== undefined) {
|
|
58
|
+
// Mirror String.replace's reset of the global regex's lastIndex.
|
|
59
|
+
variableSyntax.lastIndex = 0
|
|
60
|
+
return hit
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
const clean = varToClean.replace(variableSyntax, (context, contents) => {
|
|
51
65
|
return contents.trim()
|
|
52
66
|
})
|
|
53
67
|
|
|
68
|
+
if (cacheable) {
|
|
69
|
+
if (!inner) {
|
|
70
|
+
inner = new Map()
|
|
71
|
+
cleanCache.set(variableSyntax, inner)
|
|
72
|
+
}
|
|
73
|
+
inner.set(varToClean, clean)
|
|
74
|
+
}
|
|
75
|
+
|
|
54
76
|
// if (recursive && clean.match(variableSyntax)) {
|
|
55
77
|
// return cleanVariable(clean, variableSyntax, simple, caller, true)
|
|
56
78
|
// }
|
package/types/src/index.d.ts
CHANGED
|
@@ -49,18 +49,6 @@ type ConfigoramaSettings = {
|
|
|
49
49
|
* - allow undefined values to pass through without throwing errors
|
|
50
50
|
*/
|
|
51
51
|
allowUndefinedValues?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* - glob-like config paths whose values should be left verbatim
|
|
54
|
-
*/
|
|
55
|
-
ignorePaths?: string[];
|
|
56
|
-
/**
|
|
57
|
-
* - alias for ignorePaths
|
|
58
|
-
*/
|
|
59
|
-
skipResolutionPaths?: string[];
|
|
60
|
-
/**
|
|
61
|
-
* - disable built-in CloudFormation and embedded-code ignore paths
|
|
62
|
-
*/
|
|
63
|
-
disableDefaultIgnorePaths?: boolean;
|
|
64
52
|
/**
|
|
65
53
|
* - values passed into .js config files if user using javascript config
|
|
66
54
|
*/
|
|
@@ -69,14 +57,6 @@ type ConfigoramaSettings = {
|
|
|
69
57
|
* - return both config and metadata about variables found
|
|
70
58
|
*/
|
|
71
59
|
returnMetadata?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* - suppress env-stage-loader logs when useDotenv/useDotEnv is enabled
|
|
74
|
-
*/
|
|
75
|
-
dotEnvSilent?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* - enable env-stage-loader debug logs when useDotenv/useDotEnv is enabled
|
|
78
|
-
*/
|
|
79
|
-
dotEnvDebug?: boolean;
|
|
80
60
|
/**
|
|
81
61
|
* - keys to merge in arrays of objects
|
|
82
62
|
*/
|
|
@@ -87,10 +67,6 @@ type ConfigoramaSettings = {
|
|
|
87
67
|
filePathOverrides?: {
|
|
88
68
|
[x: string]: string;
|
|
89
69
|
};
|
|
90
|
-
/**
|
|
91
|
-
* - install Configorama CLI signal handlers. Defaults to false for library calls.
|
|
92
|
-
*/
|
|
93
|
-
handleSignalEvents?: boolean;
|
|
94
70
|
};
|
|
95
71
|
type ConfigoramaResult<T = any> = {
|
|
96
72
|
/**
|
package/types/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;AAuCiB,0BALH,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,OAAO,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAiD7C;;IASqB,qBALR,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,CAAC,CAgBb;IAQwB,4CAJb,MAAM,GAAC,MAAM,aACd,MAAM,gBAUhB;;;;;;;;;;;;;;;;aApHa,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;;;;;uBAIN,OAAO;;;;2BACP,OAAO;;;;kBACP,cAAe;;;;qBACf,OAAO;;;;gBACP,MAAM,EAAE;;;;;;;;uBAKR,CAAC;;;;oBAED,MAAM;;;;;;;;;;YAEN,CAAC"}
|
package/types/src/main.d.ts
CHANGED
|
@@ -4,21 +4,15 @@ declare class Configorama {
|
|
|
4
4
|
settings: any;
|
|
5
5
|
filterCache: {};
|
|
6
6
|
_originalValueCache: Map<any, any>;
|
|
7
|
-
_resolvedPaths: Set<any>;
|
|
8
|
-
_fileContentCache: Map<any, any>;
|
|
9
|
-
_needsRawClone: boolean;
|
|
10
7
|
foundVariables: any[];
|
|
11
8
|
fileRefsFound: any[];
|
|
12
9
|
resolutionTracking: {};
|
|
13
|
-
_trackCalls: boolean;
|
|
14
10
|
variableSyntax: RegExp;
|
|
15
|
-
variableSyntaxTest: RegExp;
|
|
16
11
|
varPrefix: string;
|
|
17
12
|
varSuffix: string;
|
|
18
13
|
varPrefixPattern: RegExp;
|
|
19
14
|
varSuffixPattern: RegExp;
|
|
20
15
|
varSuffixWithSpacePattern: RegExp;
|
|
21
|
-
ignorePathPatterns: string[][];
|
|
22
16
|
rawOriginalConfig: any;
|
|
23
17
|
config: any;
|
|
24
18
|
originalConfig: any;
|
|
@@ -70,7 +64,22 @@ declare class Configorama {
|
|
|
70
64
|
* @returns {object} Metadata object containing variables, fileRefs, and summary
|
|
71
65
|
*/
|
|
72
66
|
collectVariableMetadata(): object;
|
|
73
|
-
_cachedMetadata:
|
|
67
|
+
_cachedMetadata: {
|
|
68
|
+
variables: {};
|
|
69
|
+
uniqueVariables: {};
|
|
70
|
+
fileDependencies: {
|
|
71
|
+
globPatterns: any[];
|
|
72
|
+
dynamicPaths: any[];
|
|
73
|
+
resolvedPaths: any[];
|
|
74
|
+
byConfigPath: any[];
|
|
75
|
+
references: any[];
|
|
76
|
+
};
|
|
77
|
+
summary: {
|
|
78
|
+
totalVariables: number;
|
|
79
|
+
requiredVariables: number;
|
|
80
|
+
variablesWithDefaults: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
74
83
|
/**
|
|
75
84
|
* Populate the variables in the given object.
|
|
76
85
|
* @param objectToPopulate The object to populate variables within.
|
|
@@ -78,7 +87,6 @@ declare class Configorama {
|
|
|
78
87
|
*/
|
|
79
88
|
populateObject(objectToPopulate: any): Promise<any>;
|
|
80
89
|
populateObjectImpl(objectToPopulate: any): any;
|
|
81
|
-
shouldSkipResolution(pathValue: any): any;
|
|
82
90
|
/**
|
|
83
91
|
* The declaration of a terminal property. This declaration includes the path and value of the
|
|
84
92
|
* property.
|
package/types/src/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";AA0GA;IACE,0CA2dC;IAndC,cAcW;IAuBX,gBAAqB;IAErB,mCAAoC;IAEpC,sBAAwB;IACxB,qBAAuB;IAGvB,uBAA4B;IAsB5B,uBAAoC;IAIpC,kBAAqC;IACrC,kBAAqC;IAErC,yBAA+F;IAC/F,yBAAuD;IACvD,kCAAyE;IAKvE,uBAAgD;IAKhD,YAAuB;IAEvB,oBAA0C;IAE1C,gBAAoD;IAOpD,uBAAkC;IAElC,uBAA8B;IAE9B,uBAAkC;IASpC,wBAAmC;IAGnC,mBAqHC;IAwED,4BAA8C;IAG9C,iCAAkC;IAalC,aA2EC;IAUD,oBAEC;IAGD,eAiDC;IAOD,YAAc;IACd,cAAgB;IAChB,kBAAkB;IAGpB;;;;OAIG;IACH,0BAHW,MAAM,GACJ,OAAO,CAQnB;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAOvB;IAED;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CA2BnB;IAKD;;;;;OAKG;IACH,oBAFa,OAAO,CAAC,GAAG,CAAC,CA6vBxB;IA1vBC,aAA4B;IAc1B,2BAA4B;IAmB1B,sBAA0C;IAC1C,4BAAkC;IA0tBxC;;;OAGG;IACH,2BAFa,MAAM,CA6alB;IAvBC;;;;;;;;;;;;;;;MAoBC;IAIH;;;;OAIG;IACH,uCAFa,OAAO,CAAC,GAAG,CAAC,CAIxB;IACD,+CAsBC;IAKD;;;;;;;;;;;;;;;;;;;OAmBG;IACH;;;;;;;;;;;OAWG;IACH,mFAHa;;;;cAZC,QAAQ;;;;eACR,IAAI,GAAC,MAAM,SAAO;OAWD,CA6E9B;IACD;;;OAGG;IACH;;;;;OAKG;IACH,oCAHa,OAAO,CAAC;;;;cAjGP,QAAQ;;;;eACR,IAAI,GAAC,MAAM,SAAO;OAgGgB,CAAC,EAAE,CA6BlD;IACD;;;;;OAKG;IACH,iDAFa,OAAO,CAAC,IAAI,CAAC,CAWzB;IAID;;;;;OAKG;IACH;;;;OAIG;IACH,2BAFa,eAAc;;;;;;;;;;OAAa,CAavC;IACD;;;;;OAKG;IACH,yBAHW;;;;;;;;;;OAAa,gCACX,cAAS,CAOrB;IACD;;;;;;OAMG;IACH,6DAFa,GAAC,CAiLb;IAKD;;;;;;;OAOG;IACH,yDAHa,OAAO,CAAC,GAAG,CAAC,CAiCxB;IACD;;;;OAIG;IAOH;;;;;;OAMG;IACH,wFA2BC;IACD;;;;;;;;;;;OAWG;IACH,8BARG;QAAyB,KAAK,EAAtB,GAAG;QACoB,IAAI,GAA3B,MAAM,EAAE;QACa,cAAc,GAAnC,MAAM;QACc,iBAAiB;KAC7C,6CAEU;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,QAAQ;QAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAsa9J;IAID;;;;;;;;OAQG;IACH,qEAHa,OAAO,CAAC,GAAG,CAAC,CAoExB;IAKD;;;;;;;OAOG;IACH,0FAFa,OAAO,CAAC,GAAG,CAAC,CAiiBxB;IACD,+EA+BC;IACD,yDAiBC;IACD,oEA6BC;IAKD,8CAQC;IACD,kDAyBC;IACD;;;;;;;;;;;;;OAaG;IACH,wEAoDC;IAKD,4BAOC;IACD,sCAqEC;CACF"}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* @param {RegExp} ctx.textRefSyntax - Regex for text() syntax
|
|
15
15
|
* @param {string} ctx.varPrefix - Variable prefix (e.g., '${')
|
|
16
16
|
* @param {string} ctx.varSuffix - Variable suffix (e.g., '}')
|
|
17
|
-
* @param {Map<string, string>} [ctx.fileContentCache] - Optional per-instance read cache keyed by absolute file path
|
|
18
17
|
* @param {string} variableString - The variable string to resolve
|
|
19
18
|
* @param {object} options - Resolution options
|
|
20
19
|
* @returns {Promise<any>}
|
|
@@ -33,7 +32,6 @@ export function getValueFromFile(ctx: {
|
|
|
33
32
|
textRefSyntax: RegExp;
|
|
34
33
|
varPrefix: string;
|
|
35
34
|
varSuffix: string;
|
|
36
|
-
fileContentCache?: Map<string, string>;
|
|
37
35
|
}, variableString: string, options: object): Promise<any>;
|
|
38
36
|
/**
|
|
39
37
|
* Parse file contents based on file extension
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFromFile.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromFile.js"],"names":[],"mappings":"AA8FA
|
|
1
|
+
{"version":3,"file":"valueFromFile.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromFile.js"],"names":[],"mappings":"AA8FA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sCAjBG;IAAoB,UAAU,EAAtB,MAAM;IACK,aAAa;IACZ,cAAc,EAA1B,MAAM;IACM,mBAAmB,EAA/B,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,IAAI,EAAhB,MAAM;IACM,cAAc,EAA1B,MAAM;IACM,MAAM,EAAlB,MAAM;IACQ,cAAc;IAChB,aAAa,EAAzB,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,SAAS,EAArB,MAAM;IACM,SAAS,EAArB,MAAM;CACd,kBAAQ,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CAwVxB;AApYD;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,GAAC,CAoBb;AA8WD;;;;;;GAMG;AACH,qDAJW,MAAM,qBACN,MAAM,GACJ;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,IAAI,CAAA;CAAE,CAkBhE;AAED;;;;;;GAMG;AACH,sDALW,MAAM,qBACN,MAAM,yBACN,OAAO,GACL,MAAM,EAAE,CAcpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFromGit.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromGit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"valueFromGit.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromGit.js"],"names":[],"mappings":"AA2XiB;;;;;;;;EAUhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=valueFromSelf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueFromSelf.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromSelf.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;cAgBc,MAAM;;;;cACN,MAAM;;;;eACN,MAAM;;;;kBACN,cAAe;;;;;;eAmIf,MAAM;;;;kBACN,cAAe;;AAzI7B;;;;;;GAMG;AAEH;;;;GAIG;AACH,iFAHW,YAAY,OA0HtB;AAED;;;;GAIG;AAEH;;;;;GAKG;AACH,oCAJW,MAAM,SACN,gBAAgB,OAW1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preProcess.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/preProcess.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,+DANW,MAAM,mCAGd;IAA0B,eAAe,GAAjC,OAAO;CACf,
|
|
1
|
+
{"version":3,"file":"preProcess.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/preProcess.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,+DANW,MAAM,mCAGd;IAA0B,eAAe,GAAjC,OAAO;CACf,OAgYF"}
|
|
@@ -9,13 +9,4 @@
|
|
|
9
9
|
* @returns {number} Line number (1-indexed) or 0 if not found
|
|
10
10
|
*/
|
|
11
11
|
export function findLineForKey(keyToFind: string, lines: string[], fileType: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* Walk a dot-separated config path through raw file lines to find the exact line.
|
|
14
|
-
* YAML uses indentation-based nesting, JSON uses brace-based nesting.
|
|
15
|
-
* @param {string} configPath - Dot-separated path (e.g. 'resources.Parameters.Description')
|
|
16
|
-
* @param {string[]} lines - Array of file lines
|
|
17
|
-
* @param {string} fileType - File extension (e.g., '.yml', '.json')
|
|
18
|
-
* @returns {number} Line number (1-indexed) or 0 if not found
|
|
19
|
-
*/
|
|
20
|
-
export function findLineByPath(configPath: string, lines: string[], fileType: string): number;
|
|
21
12
|
//# sourceMappingURL=findLineForKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findLineForKey.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/findLineForKey.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,0CALW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GACJ,MAAM,CAiClB
|
|
1
|
+
{"version":3,"file":"findLineForKey.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/findLineForKey.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,0CALW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GACJ,MAAM,CAiClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceAll.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/replaceAll.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replaceAll.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/replaceAll.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wCALW,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAelB"}
|
|
@@ -23,7 +23,7 @@ export function verifyVariable(variableString: any, valueObject: any, variableTy
|
|
|
23
23
|
* Excludes suffix characters from the allowed set to prevent parsing issues
|
|
24
24
|
* @param {string} [prefix='${'] - Variable prefix
|
|
25
25
|
* @param {string} [suffix='}'] - Variable suffix
|
|
26
|
-
* @param {string[]} [excludePatterns=['AWS', '
|
|
26
|
+
* @param {string[]} [excludePatterns=['AWS', 'stageVariables']] - Patterns to exclude via negative lookahead
|
|
27
27
|
* @returns {string} Regex source string
|
|
28
28
|
*/
|
|
29
29
|
export function buildVariableSyntax(prefix?: string, suffix?: string, excludePatterns?: string[]): string;
|
package/types/src/display.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Display "No Variables Found" message
|
|
3
|
-
* @param {string} configFilePath
|
|
4
|
-
* @param {RegExp} variableSyntax
|
|
5
|
-
* @param {Object} variableTypes
|
|
6
|
-
*/
|
|
7
|
-
export function displayNoVariablesFound(configFilePath: string, variableSyntax: RegExp, variableTypes: any): void;
|
|
8
|
-
/**
|
|
9
|
-
* Display variable details in stacked box format
|
|
10
|
-
* @param {Object} params
|
|
11
|
-
* @param {string[]} params.varKeys
|
|
12
|
-
* @param {Object} params.variableData
|
|
13
|
-
* @param {Object} params.uniqueVariables
|
|
14
|
-
* @param {RegExp} params.varPrefixPattern
|
|
15
|
-
* @param {RegExp} params.varSuffixPattern
|
|
16
|
-
* @param {string[]} params.lines
|
|
17
|
-
* @param {string} params.fileType
|
|
18
|
-
* @param {string} params.configFilePath
|
|
19
|
-
*/
|
|
20
|
-
export function displayVariableDetails({ varKeys, variableData, uniqueVariables, varPrefixPattern, varSuffixPattern, lines, fileType, configFilePath }: {
|
|
21
|
-
varKeys: string[];
|
|
22
|
-
variableData: any;
|
|
23
|
-
uniqueVariables: any;
|
|
24
|
-
varPrefixPattern: RegExp;
|
|
25
|
-
varSuffixPattern: RegExp;
|
|
26
|
-
lines: string[];
|
|
27
|
-
fileType: string;
|
|
28
|
-
configFilePath: string;
|
|
29
|
-
}): void;
|
|
30
|
-
/**
|
|
31
|
-
* Display unique variables in stacked box format
|
|
32
|
-
* @param {Object} params
|
|
33
|
-
* @param {string[]} params.uniqueVarKeys
|
|
34
|
-
* @param {Object} params.uniqueVariables
|
|
35
|
-
* @param {string[]} params.lines
|
|
36
|
-
* @param {string} params.fileType
|
|
37
|
-
* @param {string} params.configFilePath
|
|
38
|
-
*/
|
|
39
|
-
export function displayUniqueVariables({ uniqueVarKeys, uniqueVariables, lines, fileType, configFilePath }: {
|
|
40
|
-
uniqueVarKeys: string[];
|
|
41
|
-
uniqueVariables: any;
|
|
42
|
-
lines: string[];
|
|
43
|
-
fileType: string;
|
|
44
|
-
configFilePath: string;
|
|
45
|
-
}): void;
|
|
46
|
-
/**
|
|
47
|
-
* Display configurable variables grouped by source type
|
|
48
|
-
* @param {Object} params
|
|
49
|
-
* @param {string[]} params.uniqueVarKeys
|
|
50
|
-
* @param {Object} params.uniqueVariables
|
|
51
|
-
* @param {string[]} params.lines
|
|
52
|
-
* @param {string} params.fileType
|
|
53
|
-
* @param {string} params.configFilePath
|
|
54
|
-
*/
|
|
55
|
-
export function displayConfigurableVariables({ uniqueVarKeys, uniqueVariables, lines, fileType, configFilePath }: {
|
|
56
|
-
uniqueVarKeys: string[];
|
|
57
|
-
uniqueVariables: any;
|
|
58
|
-
lines: string[];
|
|
59
|
-
fileType: string;
|
|
60
|
-
configFilePath: string;
|
|
61
|
-
}): void;
|
|
62
|
-
//# sourceMappingURL=display.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/display.js"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,wDAJW,MAAM,kBACN,MAAM,4BAwBhB;AAED;;;;;;;;;;;GAWG;AACH,wJATG;IAAyB,OAAO,EAAxB,MAAM,EAAE;IACO,YAAY;IACZ,eAAe;IACf,gBAAgB,EAA/B,MAAM;IACS,gBAAgB,EAA/B,MAAM;IACW,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAyJA;AAED;;;;;;;;GAQG;AACH,4GANG;IAAyB,aAAa,EAA9B,MAAM,EAAE;IACO,eAAe;IACb,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAiHA;AAED;;;;;;;;GAQG;AACH,kHANG;IAAyB,aAAa,EAA9B,MAAM,EAAE;IACO,eAAe;IACb,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAyIA"}
|
package/types/src/metadata.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collect metadata about all variables found in the configuration
|
|
3
|
-
* @param {Object} params
|
|
4
|
-
* @param {RegExp} params.variableSyntax
|
|
5
|
-
* @param {Object} params.variablesKnownTypes
|
|
6
|
-
* @param {Object} params.variableTypes
|
|
7
|
-
* @param {RegExp|null} params.filterMatch
|
|
8
|
-
* @param {string} params.configFilePath
|
|
9
|
-
* @param {Object} params.displayConfig - rawOriginalConfig || originalConfig, used for traversal
|
|
10
|
-
* @param {Object} params.originalConfig - this.originalConfig, used for dotProp.get checks
|
|
11
|
-
* @param {string} params.varSuffix
|
|
12
|
-
* @param {RegExp} params.varSuffixWithSpacePattern
|
|
13
|
-
* @param {string[][]} [params.ignorePathPatterns]
|
|
14
|
-
* @returns {Object} Metadata object containing variables, fileDependencies, and summary
|
|
15
|
-
*/
|
|
16
|
-
export function collectVariableMetadata({ variableSyntax, variablesKnownTypes, variableTypes, filterMatch, configFilePath, displayConfig, originalConfig, varSuffix, varSuffixWithSpacePattern, ignorePathPatterns, }: {
|
|
17
|
-
variableSyntax: RegExp;
|
|
18
|
-
variablesKnownTypes: any;
|
|
19
|
-
variableTypes: any;
|
|
20
|
-
filterMatch: RegExp | null;
|
|
21
|
-
configFilePath: string;
|
|
22
|
-
displayConfig: any;
|
|
23
|
-
originalConfig: any;
|
|
24
|
-
varSuffix: string;
|
|
25
|
-
varSuffixWithSpacePattern: RegExp;
|
|
26
|
-
ignorePathPatterns?: string[][];
|
|
27
|
-
}): any;
|
|
28
|
-
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;GAcG;AACH,uNAZG;IAAuB,cAAc,EAA7B,MAAM;IACS,mBAAmB;IACnB,aAAa;IACR,WAAW,EAA/B,MAAM,GAAC,IAAI;IACI,cAAc,EAA7B,MAAM;IACS,aAAa;IACb,cAAc;IACd,SAAS,EAAxB,MAAM;IACS,yBAAyB,EAAxC,MAAM;IACc,kBAAkB,GAAtC,MAAM,EAAE,EAAE;CAClB,OA0aF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoundedMap.d.ts","sourceRoot":"","sources":["../../../src/utils/BoundedMap.js"],"names":[],"mappings":";AAGA;IACE,8BAGC;IAFC,oBAAqB;IACrB,iBAAuB;IAEzB,mBAEC;IACD,uBAEC;IACD,gCAOC;CACF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_IGNORE_PATHS: string[];
|
|
2
|
-
export function normalizeIgnorePaths(options?: {}): any[];
|
|
3
|
-
export function compileIgnorePaths(patterns: any): string[][];
|
|
4
|
-
export function shouldIgnorePath(pathValue: any, compiledPatterns: any): any;
|
|
5
|
-
//# sourceMappingURL=ignorePaths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignorePaths.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/ignorePaths.js"],"names":[],"mappings":"AAAA,4CAcC;AA8BD,0DAOC;AAED,8DAEC;AAED,6EAIC"}
|