@firestartr/cli 2.8.0 → 2.9.0-snapshot-01
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/build/index.js +102 -8
- package/build/packages/cdk8s_renderer/src/utils/claimUtils.d.ts +1 -0
- package/build/packages/features_renderer/index.d.ts +2 -1
- package/build/packages/features_renderer/src/auxiliar.d.ts +4 -1
- package/build/packages/features_renderer/src/render.d.ts +3 -0
- package/build/packages/features_renderer/src/schema.d.ts +9 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -317847,7 +317847,18 @@ function configurePathsForRendering() {
|
|
|
317847
317847
|
const configPath = '/tmp/defaults';
|
|
317848
317848
|
createInitializers(configPath);
|
|
317849
317849
|
createExpanders(configPath);
|
|
317850
|
-
|
|
317850
|
+
try {
|
|
317851
|
+
configureProvider(AllowedProviders.all);
|
|
317852
|
+
}
|
|
317853
|
+
catch (err) {
|
|
317854
|
+
// Only the already-configured case is expected here; any other
|
|
317855
|
+
// configuration error must surface instead of being silently hidden.
|
|
317856
|
+
if (!(err instanceof Error) ||
|
|
317857
|
+
!err.message.includes('Provider already configured')) {
|
|
317858
|
+
throw err;
|
|
317859
|
+
}
|
|
317860
|
+
reconfigureProvider(AllowedProviders.all);
|
|
317861
|
+
}
|
|
317851
317862
|
setPath('initializers', configPath);
|
|
317852
317863
|
setPath('crs', '/tmp/resources_from_main_branch');
|
|
317853
317864
|
setPath('globals', configPath);
|
|
@@ -322024,6 +322035,9 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
|
|
|
322024
322035
|
description: 'a list of references to a different file where files key is filled by an expanded template',
|
|
322025
322036
|
items: {
|
|
322026
322037
|
type: 'string',
|
|
322038
|
+
not: {
|
|
322039
|
+
pattern: '^/|(^|/)\\.\\.(/|$)',
|
|
322040
|
+
},
|
|
322027
322041
|
},
|
|
322028
322042
|
},
|
|
322029
322043
|
},
|
|
@@ -322070,9 +322084,15 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
|
|
|
322070
322084
|
properties: {
|
|
322071
322085
|
src: {
|
|
322072
322086
|
type: 'string',
|
|
322087
|
+
not: {
|
|
322088
|
+
pattern: '^/|(^|/)\\.\\.(/|$)',
|
|
322089
|
+
},
|
|
322073
322090
|
},
|
|
322074
322091
|
dest: {
|
|
322075
322092
|
type: 'string',
|
|
322093
|
+
not: {
|
|
322094
|
+
pattern: '^/|(^|/)\\.\\.(/|$)',
|
|
322095
|
+
},
|
|
322076
322096
|
},
|
|
322077
322097
|
upgradable: {
|
|
322078
322098
|
type: 'boolean',
|
|
@@ -322984,12 +323004,19 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
322984
323004
|
if ('filesTemplates' in context.config) {
|
|
322985
323005
|
expandFiles(featurePath, configData, context);
|
|
322986
323006
|
}
|
|
323007
|
+
for (const file of context.config.files) {
|
|
323008
|
+
const { src, dest } = file;
|
|
323009
|
+
assertSafeRelativePath(src, 'file src');
|
|
323010
|
+
assertSafeRelativePath(dest, 'file dest');
|
|
323011
|
+
resolveInside(featurePath, external_path_default().join('templates', src), 'file src', 'feature directory');
|
|
323012
|
+
resolveInside(featureRenderPath, dest, 'file dest', 'render target directory');
|
|
323013
|
+
}
|
|
322987
323014
|
const output = { files: [] };
|
|
322988
323015
|
context.config.files.forEach((file) => {
|
|
322989
323016
|
const { src, dest } = file;
|
|
322990
|
-
// For now let's keep
|
|
323017
|
+
// For now let's keep upgradable flag for backward compatibility
|
|
322991
323018
|
// by default it's false
|
|
322992
|
-
const userManaged = file.user_managed ?? file.
|
|
323019
|
+
const userManaged = file.user_managed ?? file.upgradable ?? false;
|
|
322993
323020
|
const targetBranch = file.target_branch ?? '';
|
|
322994
323021
|
src_logger.debug(`Rendering ${src} to ${dest}`);
|
|
322995
323022
|
// render the content of the file
|
|
@@ -323009,6 +323036,7 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
323009
323036
|
// Not used anymore
|
|
323010
323037
|
// output.unpatches = context.config.unpatches
|
|
323011
323038
|
});
|
|
323039
|
+
external_fs_default().writeFileSync(external_path_default().join(featureRenderPath, 'config.json'), JSON.stringify(context.config));
|
|
323012
323040
|
// write the output file
|
|
323013
323041
|
const configFile = external_path_default().join(featureRenderPath, 'output.json');
|
|
323014
323042
|
external_fs_default().writeFileSync(configFile, JSON.stringify(output));
|
|
@@ -323033,8 +323061,9 @@ function buildContext(entity, args, firestartrConfig, featureArgs) {
|
|
|
323033
323061
|
context[key] = arg['$lit'];
|
|
323034
323062
|
}
|
|
323035
323063
|
else if ('$arg' in arg) {
|
|
323036
|
-
if (featureArgs
|
|
323064
|
+
if (Object.prototype.hasOwnProperty.call(featureArgs, arg['$arg'])) {
|
|
323037
323065
|
context[key] = featureArgs[arg['$arg']];
|
|
323066
|
+
}
|
|
323038
323067
|
}
|
|
323039
323068
|
});
|
|
323040
323069
|
context.firestartrConfig = firestartrConfig;
|
|
@@ -323066,7 +323095,7 @@ function expandFiles(featurePath, configData, context) {
|
|
|
323066
323095
|
context.config.files = context.config.files.concat(files).flat(Infinity);
|
|
323067
323096
|
}
|
|
323068
323097
|
function expandFilesTemplate(featurePath, tplPath, context) {
|
|
323069
|
-
const templatePath =
|
|
323098
|
+
const templatePath = resolveInside(featurePath, tplPath, 'filesTemplates entry', 'feature directory');
|
|
323070
323099
|
src_logger.debug(`Expanding files section with template located at ${templatePath}`);
|
|
323071
323100
|
let template;
|
|
323072
323101
|
try {
|
|
@@ -323086,6 +323115,55 @@ function expandFilesTemplate(featurePath, tplPath, context) {
|
|
|
323086
323115
|
function renderContent(template, ctx) {
|
|
323087
323116
|
return mustache_mustache.render(template, ctx, {}, ['{{|', '|}}']);
|
|
323088
323117
|
}
|
|
323118
|
+
function assertNonEmptyString(value, what) {
|
|
323119
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
323120
|
+
throw new Error(`Feature path error: ${what} must be a non-empty string, got ${JSON.stringify(value)}`);
|
|
323121
|
+
}
|
|
323122
|
+
}
|
|
323123
|
+
function assertSafeRelativePath(candidate, what) {
|
|
323124
|
+
assertNonEmptyString(candidate, what);
|
|
323125
|
+
if (external_path_default().isAbsolute(candidate)) {
|
|
323126
|
+
throw new Error(`Feature path error: ${what} "${candidate}" must be a relative path`);
|
|
323127
|
+
}
|
|
323128
|
+
if (candidate.split(/[\\/]+/).includes('..')) {
|
|
323129
|
+
throw new Error(`Feature path error: ${what} "${candidate}" must not contain ".." path segments`);
|
|
323130
|
+
}
|
|
323131
|
+
}
|
|
323132
|
+
function hasSymbolicLinkComponent(target) {
|
|
323133
|
+
let current = target;
|
|
323134
|
+
for (;;) {
|
|
323135
|
+
try {
|
|
323136
|
+
return external_fs_default().realpathSync(current) !== current;
|
|
323137
|
+
}
|
|
323138
|
+
catch (err) {
|
|
323139
|
+
if (err && err.code === 'ENOENT') {
|
|
323140
|
+
const parent = external_path_default().dirname(current);
|
|
323141
|
+
if (parent === current) {
|
|
323142
|
+
return false;
|
|
323143
|
+
}
|
|
323144
|
+
current = parent;
|
|
323145
|
+
continue;
|
|
323146
|
+
}
|
|
323147
|
+
throw err;
|
|
323148
|
+
}
|
|
323149
|
+
}
|
|
323150
|
+
}
|
|
323151
|
+
function resolveInside(basePath, candidate, what, baseLabel) {
|
|
323152
|
+
assertSafeRelativePath(candidate, what);
|
|
323153
|
+
const root = external_path_default().resolve(basePath);
|
|
323154
|
+
const target = external_path_default().resolve(root, candidate);
|
|
323155
|
+
const relative = external_path_default().relative(root, target);
|
|
323156
|
+
const escaped = relative === '..' ||
|
|
323157
|
+
relative.startsWith('..' + (external_path_default()).sep) ||
|
|
323158
|
+
external_path_default().isAbsolute(relative);
|
|
323159
|
+
if (escaped) {
|
|
323160
|
+
throw new Error(`Feature path error: ${what} "${candidate}" escapes ${baseLabel} "${root}"`);
|
|
323161
|
+
}
|
|
323162
|
+
if (hasSymbolicLinkComponent(target)) {
|
|
323163
|
+
throw new Error(`Feature path error: ${what} "${candidate}" must not traverse a symbolic link under ${baseLabel}`);
|
|
323164
|
+
}
|
|
323165
|
+
return target;
|
|
323166
|
+
}
|
|
323089
323167
|
|
|
323090
323168
|
// EXTERNAL MODULE: external "node:fs"
|
|
323091
323169
|
var external_node_fs_ = __nccwpck_require__(87561);
|
|
@@ -323230,7 +323308,8 @@ function buildExpectedOutput(config, renderDir) {
|
|
|
323230
323308
|
const files = (config.files || []).map((f) => ({
|
|
323231
323309
|
localPath: external_node_path_.join(renderDir, f.dest),
|
|
323232
323310
|
repoPath: f.dest,
|
|
323233
|
-
userManaged: f.user_managed,
|
|
323311
|
+
userManaged: f.user_managed ?? f.upgradable ?? false,
|
|
323312
|
+
targetBranch: f.target_branch ?? '',
|
|
323234
323313
|
}));
|
|
323235
323314
|
return {
|
|
323236
323315
|
files,
|
|
@@ -323309,6 +323388,7 @@ function updateFileContent(featureRenderPath, filePath, content) {
|
|
|
323309
323388
|
auxiliar: auxiliar,
|
|
323310
323389
|
buildContext: buildContext,
|
|
323311
323390
|
renderContent: renderContent,
|
|
323391
|
+
expandFiles: expandFiles,
|
|
323312
323392
|
});
|
|
323313
323393
|
|
|
323314
323394
|
;// CONCATENATED MODULE: ../features_preparer/src/logger.ts
|
|
@@ -323717,6 +323797,7 @@ const KINDS_CR_MAP = {
|
|
|
323717
323797
|
|
|
323718
323798
|
|
|
323719
323799
|
|
|
323800
|
+
|
|
323720
323801
|
function resolveStringReference(reference) {
|
|
323721
323802
|
const referenceElements = reference.split(':');
|
|
323722
323803
|
const actualKind = KINDS_CR_MAP[referenceElements[0]];
|
|
@@ -323891,7 +323972,17 @@ async function crawlClaimsDir(dir, basePath, claims) {
|
|
|
323891
323972
|
const relativePath = external_path_default().relative(basePath, fullPath)
|
|
323892
323973
|
.split((external_path_default()).sep)
|
|
323893
323974
|
.join((external_path_default()).posix.sep);
|
|
323894
|
-
|
|
323975
|
+
if (claim.kind === 'TFWorkspaceClaim') {
|
|
323976
|
+
const values = claim.providers?.terraform?.values;
|
|
323977
|
+
const [tfRefs] = getTfWorkspacesRefs(values ?? {});
|
|
323978
|
+
const uniqueRefs = [
|
|
323979
|
+
...new Set(tfRefs.map((r) => `TFWorkspaceClaim-${r}`)),
|
|
323980
|
+
];
|
|
323981
|
+
claims[ref] = { filePath: relativePath, refs: uniqueRefs };
|
|
323982
|
+
}
|
|
323983
|
+
else {
|
|
323984
|
+
claims[ref] = { filePath: relativePath };
|
|
323985
|
+
}
|
|
323895
323986
|
}
|
|
323896
323987
|
catch (err) {
|
|
323897
323988
|
throw new Error(`Error processing claim file ${fullPath}: ${err}`);
|
|
@@ -328742,6 +328833,9 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
|
|
|
328742
328833
|
if (!external_fs_.existsSync(MAIN_BRANCH_OUTPUT_DIR)) {
|
|
328743
328834
|
external_fs_.mkdirSync(MAIN_BRANCH_OUTPUT_DIR);
|
|
328744
328835
|
}
|
|
328836
|
+
// Make this function re-callable: clear state left behind by a previous call
|
|
328837
|
+
emptyRenderedClaims();
|
|
328838
|
+
resetLazyLoader();
|
|
328745
328839
|
/**
|
|
328746
328840
|
* Object with the affected wet repositories
|
|
328747
328841
|
* This will be returned in order to trigger
|
|
@@ -521982,7 +522076,7 @@ const crsStatusSubcommand = {
|
|
|
521982
522076
|
};
|
|
521983
522077
|
|
|
521984
522078
|
;// CONCATENATED MODULE: ./package.json
|
|
521985
|
-
const package_namespaceObject = {"i8":"2.
|
|
522079
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.9.0-snapshot-01"}');
|
|
521986
522080
|
;// CONCATENATED MODULE: ../../package.json
|
|
521987
522081
|
const package_namespaceObject_1 = {"i8":"2.8.0"};
|
|
521988
522082
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -7,6 +7,7 @@ export declare function getClaimsEntryAbsolutePath(claimsDir: string, entryPath:
|
|
|
7
7
|
export declare function sanitizeApiEntityName(name: string): string;
|
|
8
8
|
export interface ClaimsMapEntry {
|
|
9
9
|
filePath: string;
|
|
10
|
+
refs?: string[];
|
|
10
11
|
}
|
|
11
12
|
export interface ClaimsMap {
|
|
12
13
|
headers: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import validate from './src/validate';
|
|
2
|
-
import render, { buildContext, renderContent } from './src/render';
|
|
2
|
+
import render, { buildContext, renderContent, expandFiles } from './src/render';
|
|
3
3
|
import updateFileContent from './src/update_file';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
validate: typeof validate;
|
|
@@ -14,5 +14,6 @@ declare const _default: {
|
|
|
14
14
|
};
|
|
15
15
|
buildContext: typeof buildContext;
|
|
16
16
|
renderContent: typeof renderContent;
|
|
17
|
+
expandFiles: typeof expandFiles;
|
|
17
18
|
};
|
|
18
19
|
export default _default;
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
export interface ConfigFile {
|
|
5
5
|
dest: string;
|
|
6
6
|
src: string;
|
|
7
|
-
user_managed
|
|
7
|
+
user_managed?: boolean;
|
|
8
|
+
upgradable?: boolean;
|
|
9
|
+
target_branch?: string;
|
|
8
10
|
}
|
|
9
11
|
export interface FeatureConfig {
|
|
10
12
|
files?: ConfigFile[];
|
|
@@ -13,6 +15,7 @@ export interface FeatureConfig {
|
|
|
13
15
|
export interface ExpectedFile {
|
|
14
16
|
localPath: string;
|
|
15
17
|
repoPath: string;
|
|
18
|
+
targetBranch: string;
|
|
16
19
|
userManaged: boolean;
|
|
17
20
|
}
|
|
18
21
|
export interface ExpectedOutput {
|
|
@@ -2,3 +2,6 @@ export default function render(featurePath: string, featureRenderPath: string, e
|
|
|
2
2
|
export declare function buildContext(entity: any, args: any, firestartrConfig: any, featureArgs: any): any;
|
|
3
3
|
export declare function expandFiles(featurePath: string, configData: any, context: any): void;
|
|
4
4
|
export declare function renderContent(template: string, ctx: any): any;
|
|
5
|
+
export declare function assertNonEmptyString(value: unknown, what: string): asserts value is string;
|
|
6
|
+
export declare function assertSafeRelativePath(candidate: unknown, what: string): void;
|
|
7
|
+
export declare function resolveInside(basePath: string, candidate: string, what: string, baseLabel: string): string;
|
|
@@ -34,6 +34,9 @@ declare const _default: {
|
|
|
34
34
|
description: string;
|
|
35
35
|
items: {
|
|
36
36
|
type: string;
|
|
37
|
+
not: {
|
|
38
|
+
pattern: string;
|
|
39
|
+
};
|
|
37
40
|
};
|
|
38
41
|
};
|
|
39
42
|
};
|
|
@@ -80,9 +83,15 @@ declare const _default: {
|
|
|
80
83
|
properties: {
|
|
81
84
|
src: {
|
|
82
85
|
type: string;
|
|
86
|
+
not: {
|
|
87
|
+
pattern: string;
|
|
88
|
+
};
|
|
83
89
|
};
|
|
84
90
|
dest: {
|
|
85
91
|
type: string;
|
|
92
|
+
not: {
|
|
93
|
+
pattern: string;
|
|
94
|
+
};
|
|
86
95
|
};
|
|
87
96
|
upgradable: {
|
|
88
97
|
type: string;
|