@geek-fun/serverlessinsight 0.6.0 → 0.6.2
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 +94 -1
- package/README.zh-CN.md +94 -1
- package/dist/package.json +1 -1
- package/dist/src/common/aliyunClient/apigwOperations.js +5 -5
- package/dist/src/common/aliyunClient/ossOperations.js +231 -16
- package/dist/src/common/certUtils.js +33 -0
- package/dist/src/common/constants.js +10 -4
- package/dist/src/common/iacHelper.js +5 -9
- package/dist/src/common/index.js +2 -1
- package/dist/src/common/planFormatter.js +269 -0
- package/dist/src/common/retryUtils.js +5 -0
- package/dist/src/lang/en.js +49 -3
- package/dist/src/lang/zh-CN.js +47 -2
- package/dist/src/parser/bucketParser.js +17 -3
- package/dist/src/parser/index.js +0 -2
- package/dist/src/stack/aliyunStack/apigwPlanner.js +1 -1
- package/dist/src/stack/aliyunStack/apigwResource.js +29 -30
- package/dist/src/stack/aliyunStack/ossResource.js +25 -25
- package/dist/src/stack/scfStack/cosResource.js +22 -17
- package/dist/src/stack/scfStack/planner.js +1 -57
- package/dist/src/types/index.js +0 -1
- package/dist/src/validator/bucketSchema.js +27 -1
- package/dist/src/validator/eventSchema.js +25 -2
- package/dist/src/validator/iacSchema.js +0 -2
- package/dist/src/validator/rootSchema.js +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/common/certificateResolver.js +0 -63
- package/dist/src/parser/certificateParser.js +0 -23
- package/dist/src/types/domains/certificate.js +0 -2
- package/dist/src/validator/certificateSchema.js +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
3
|
+
exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DNS_PROPAGATION_DELAY_MS = exports.DNS_PROPAGATION_MAX_ATTEMPTS = exports.DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
4
4
|
exports.CODE_ZIP_SIZE_LIMIT = 300 * 1000; // 300 KB - code package size limit for inline deployment
|
|
5
5
|
exports.OSS_DEPLOYMENT_TIMEOUT = 3000; // in seconds
|
|
6
6
|
exports.SI_BOOTSTRAP_FC_PREFIX = 'si-bootstrap-api';
|
|
@@ -17,9 +17,15 @@ exports.LOCK_FILE_SUFFIX = '.si-lock';
|
|
|
17
17
|
exports.DEFAULT_LOCK_TIMEOUT = 10 * 60 * 1000; // 10 minutes
|
|
18
18
|
exports.DEFAULT_LOCK_RETRY_DELAY = 2000; // 2 seconds
|
|
19
19
|
exports.STALE_LOCK_THRESHOLD = 60 * 60 * 1000; // 1 hour
|
|
20
|
-
// API Gateway
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
20
|
+
// Shared domain binding retry configuration (used by API Gateway, OSS, and future resources)
|
|
21
|
+
exports.DOMAIN_BIND_MAX_RETRIES = 5;
|
|
22
|
+
exports.DOMAIN_BIND_RETRY_DELAY_MS = 30000; // 30 seconds
|
|
23
|
+
// Shared DNS propagation polling configuration (used by API Gateway, OSS, and future resources)
|
|
24
|
+
exports.DNS_PROPAGATION_MAX_ATTEMPTS = 10;
|
|
25
|
+
exports.DNS_PROPAGATION_DELAY_MS = 60000; // 1 minute
|
|
26
|
+
// API Gateway domain binding (aliases for shared constants)
|
|
27
|
+
exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DOMAIN_BIND_MAX_RETRIES;
|
|
28
|
+
exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_RETRY_DELAY_MS;
|
|
23
29
|
exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = 10;
|
|
24
30
|
exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = 30000; // 30 seconds
|
|
25
31
|
// RAM role propagation
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isFunctionDomain = exports.getIacDefinition = exports.calcValue = exports.readCodeSize = exports.resolveCode = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
@@ -83,19 +83,15 @@ const calcValue = (rawValue, ctx, iacVars) => {
|
|
|
83
83
|
return inferType(value, isExactTemplateRef);
|
|
84
84
|
};
|
|
85
85
|
exports.calcValue = calcValue;
|
|
86
|
-
const isFunctionDomain = (def) => 'name' in def;
|
|
87
|
-
exports.isFunctionDomain = isFunctionDomain;
|
|
88
|
-
const isCertificateDomain = (def) => !('name' in def);
|
|
89
|
-
exports.isCertificateDomain = isCertificateDomain;
|
|
90
86
|
const getIacDefinition = (iac, rawValue) => {
|
|
91
87
|
const matchFn = rawValue.match(/^\$\{functions\.(\w+(\.\w+)?)}$/);
|
|
92
88
|
if (matchFn?.length) {
|
|
93
89
|
return iac.functions?.find((fc) => fc.key === matchFn[1]);
|
|
94
90
|
}
|
|
95
|
-
const matchCert = rawValue.match(/^\$\{certificates\.(\w+)}$/);
|
|
96
|
-
if (matchCert?.length) {
|
|
97
|
-
return iac.certificates?.find((cert) => cert.key === matchCert[1]);
|
|
98
|
-
}
|
|
99
91
|
return iac.functions?.find((fc) => fc.key === rawValue);
|
|
100
92
|
};
|
|
101
93
|
exports.getIacDefinition = getIacDefinition;
|
|
94
|
+
const isFunctionDomain = (def) => {
|
|
95
|
+
return def != null && typeof def.key === 'string';
|
|
96
|
+
};
|
|
97
|
+
exports.isFunctionDomain = isFunctionDomain;
|
package/dist/src/common/index.js
CHANGED
|
@@ -31,4 +31,5 @@ __exportStar(require("./runtimeMapper"), exports);
|
|
|
31
31
|
__exportStar(require("./hashUtils"), exports);
|
|
32
32
|
__exportStar(require("./dependencyGraph"), exports);
|
|
33
33
|
__exportStar(require("./sidUtils"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
34
|
+
__exportStar(require("./certUtils"), exports);
|
|
35
|
+
__exportStar(require("./planFormatter"), exports);
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayPlan = exports.formatPlan = exports.formatPlanItem = exports.computeAttributeDiffs = void 0;
|
|
4
|
+
const hashUtils_1 = require("./hashUtils");
|
|
5
|
+
const lang_1 = require("../lang");
|
|
6
|
+
const logger_1 = require("./logger");
|
|
7
|
+
const COLOR = {
|
|
8
|
+
RESET: '\x1b[0m',
|
|
9
|
+
GREEN: '\x1b[32m',
|
|
10
|
+
YELLOW: '\x1b[33m',
|
|
11
|
+
RED: '\x1b[31m',
|
|
12
|
+
CYAN: '\x1b[36m',
|
|
13
|
+
DIM: '\x1b[2m',
|
|
14
|
+
};
|
|
15
|
+
const COMPUTED_ATTRIBUTES = new Set([
|
|
16
|
+
'codeHash',
|
|
17
|
+
'functionId',
|
|
18
|
+
'functionArn',
|
|
19
|
+
'createdTime',
|
|
20
|
+
'lastModifiedTime',
|
|
21
|
+
'status',
|
|
22
|
+
'invokeUrl',
|
|
23
|
+
'invokeArn',
|
|
24
|
+
'arn',
|
|
25
|
+
'id',
|
|
26
|
+
]);
|
|
27
|
+
const DEFAULT_CONFIG = {
|
|
28
|
+
colorize: true,
|
|
29
|
+
indentSize: 4,
|
|
30
|
+
keyAlignWidth: 12,
|
|
31
|
+
showUnchangedAttributes: false,
|
|
32
|
+
maxUnchangedHidden: 5,
|
|
33
|
+
};
|
|
34
|
+
const isObject = (val) => typeof val === 'object' && val !== null && !Array.isArray(val);
|
|
35
|
+
const isSimpleObject = (val) => {
|
|
36
|
+
if (!isObject(val))
|
|
37
|
+
return false;
|
|
38
|
+
const obj = val;
|
|
39
|
+
return Object.values(obj).every((v) => typeof v !== 'object' || v === null);
|
|
40
|
+
};
|
|
41
|
+
const computeAttributeDiffs = (before, after) => {
|
|
42
|
+
if (!before && !after)
|
|
43
|
+
return { diffs: [], unchangedCount: 0 };
|
|
44
|
+
if (!before && after) {
|
|
45
|
+
return {
|
|
46
|
+
diffs: Object.entries(after)
|
|
47
|
+
.map(([key, value]) => ({
|
|
48
|
+
key,
|
|
49
|
+
after: value,
|
|
50
|
+
action: 'add',
|
|
51
|
+
isComputed: COMPUTED_ATTRIBUTES.has(key),
|
|
52
|
+
children: isObject(value) && !isSimpleObject(value)
|
|
53
|
+
? (0, exports.computeAttributeDiffs)(undefined, value).diffs
|
|
54
|
+
: undefined,
|
|
55
|
+
}))
|
|
56
|
+
.sort((a, b) => a.key.localeCompare(b.key)),
|
|
57
|
+
unchangedCount: 0,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (before && !after) {
|
|
61
|
+
return {
|
|
62
|
+
diffs: Object.entries(before)
|
|
63
|
+
.map(([key, value]) => ({
|
|
64
|
+
key,
|
|
65
|
+
before: value,
|
|
66
|
+
action: 'remove',
|
|
67
|
+
isComputed: COMPUTED_ATTRIBUTES.has(key),
|
|
68
|
+
children: isObject(value) && !isSimpleObject(value)
|
|
69
|
+
? (0, exports.computeAttributeDiffs)(value, undefined).diffs
|
|
70
|
+
: undefined,
|
|
71
|
+
}))
|
|
72
|
+
.sort((a, b) => a.key.localeCompare(b.key)),
|
|
73
|
+
unchangedCount: 0,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const { changed, added, removed } = (0, hashUtils_1.diffAttributes)(before, after);
|
|
77
|
+
const allKeys = new Set([...Object.keys(before), ...Object.keys(after)]);
|
|
78
|
+
const unchangedCount = allKeys.size -
|
|
79
|
+
Object.keys(changed).length -
|
|
80
|
+
Object.keys(added).length -
|
|
81
|
+
Object.keys(removed).length;
|
|
82
|
+
const addDiffs = Object.entries(added).map(([key, value]) => ({
|
|
83
|
+
key,
|
|
84
|
+
after: value,
|
|
85
|
+
action: 'add',
|
|
86
|
+
isComputed: COMPUTED_ATTRIBUTES.has(key),
|
|
87
|
+
children: isObject(value) && !isSimpleObject(value)
|
|
88
|
+
? (0, exports.computeAttributeDiffs)(undefined, value).diffs
|
|
89
|
+
: undefined,
|
|
90
|
+
}));
|
|
91
|
+
const removeDiffs = Object.entries(removed).map(([key, value]) => ({
|
|
92
|
+
key,
|
|
93
|
+
before: value,
|
|
94
|
+
action: 'remove',
|
|
95
|
+
isComputed: COMPUTED_ATTRIBUTES.has(key),
|
|
96
|
+
children: isObject(value) && !isSimpleObject(value)
|
|
97
|
+
? (0, exports.computeAttributeDiffs)(value, undefined).diffs
|
|
98
|
+
: undefined,
|
|
99
|
+
}));
|
|
100
|
+
const changeDiffs = Object.entries(changed).map(([key, { before: oldVal, after: newVal }]) => {
|
|
101
|
+
const bothObjects = isObject(oldVal) && isObject(newVal);
|
|
102
|
+
return {
|
|
103
|
+
key,
|
|
104
|
+
before: oldVal,
|
|
105
|
+
after: newVal,
|
|
106
|
+
action: 'change',
|
|
107
|
+
children: bothObjects
|
|
108
|
+
? (0, exports.computeAttributeDiffs)(oldVal, newVal).diffs
|
|
109
|
+
: undefined,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
const diffs = [...addDiffs, ...removeDiffs, ...changeDiffs].sort((a, b) => a.key.localeCompare(b.key));
|
|
113
|
+
return { diffs, unchangedCount };
|
|
114
|
+
};
|
|
115
|
+
exports.computeAttributeDiffs = computeAttributeDiffs;
|
|
116
|
+
const colorize = (text, color, enabled) => enabled ? `${COLOR[color]}${text}${COLOR.RESET}` : text;
|
|
117
|
+
const formatValue = (value) => {
|
|
118
|
+
if (typeof value === 'string')
|
|
119
|
+
return `"${value}"`;
|
|
120
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
121
|
+
return String(value);
|
|
122
|
+
if (value === null || value === undefined)
|
|
123
|
+
return 'null';
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
if (value.length === 0)
|
|
126
|
+
return '[]';
|
|
127
|
+
return `[${value.map((v) => formatValue(v)).join(', ')}]`;
|
|
128
|
+
}
|
|
129
|
+
if (isSimpleObject(value)) {
|
|
130
|
+
const entries = Object.entries(value)
|
|
131
|
+
.map(([k, v]) => `${k}: ${formatValue(v)}`)
|
|
132
|
+
.join(', ');
|
|
133
|
+
return `{ ${entries} }`;
|
|
134
|
+
}
|
|
135
|
+
return JSON.stringify(value);
|
|
136
|
+
};
|
|
137
|
+
const computeMaxKeyWidth = (diffs, baseIndent) => diffs.reduce((maxWidth, diff) => {
|
|
138
|
+
const keyWidth = diff.key.length + 1;
|
|
139
|
+
const childWidth = diff.children && diff.children.length > 0
|
|
140
|
+
? computeMaxKeyWidth(diff.children, baseIndent + 4)
|
|
141
|
+
: 0;
|
|
142
|
+
return Math.max(maxWidth, keyWidth, childWidth);
|
|
143
|
+
}, 0);
|
|
144
|
+
const formatAttributeLines = (diff, indent, config, keyWidth) => {
|
|
145
|
+
const spaces = ' '.repeat(indent);
|
|
146
|
+
const alignedKey = (diff.key + ':').padEnd(keyWidth);
|
|
147
|
+
switch (diff.action) {
|
|
148
|
+
case 'add': {
|
|
149
|
+
if (diff.children && diff.children.length > 0) {
|
|
150
|
+
const childKeyWidth = computeMaxKeyWidth(diff.children, indent);
|
|
151
|
+
return [
|
|
152
|
+
colorize(`${spaces}${alignedKey}`, 'GREEN', config.colorize),
|
|
153
|
+
...diff.children.flatMap((child) => formatAttributeLines(child, indent + config.indentSize, config, childKeyWidth)),
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
const value = diff.isComputed
|
|
157
|
+
? colorize(lang_1.lang.__('PLAN_COMPUTED_VALUE'), 'CYAN', config.colorize)
|
|
158
|
+
: formatValue(diff.after);
|
|
159
|
+
return [colorize(`${spaces}${alignedKey} ${value}`, 'GREEN', config.colorize)];
|
|
160
|
+
}
|
|
161
|
+
case 'remove': {
|
|
162
|
+
if (diff.children && diff.children.length > 0) {
|
|
163
|
+
const childKeyWidth = computeMaxKeyWidth(diff.children, indent);
|
|
164
|
+
return [
|
|
165
|
+
colorize(`${spaces}${alignedKey}`, 'RED', config.colorize),
|
|
166
|
+
...diff.children.flatMap((child) => formatAttributeLines(child, indent + config.indentSize, config, childKeyWidth)),
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
return [
|
|
170
|
+
colorize(`${spaces}${alignedKey} ${formatValue(diff.before)}`, 'RED', config.colorize),
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
case 'change': {
|
|
174
|
+
if (diff.children && diff.children.length > 0) {
|
|
175
|
+
const childKeyWidth = computeMaxKeyWidth(diff.children, indent);
|
|
176
|
+
return [
|
|
177
|
+
colorize(`${spaces}${alignedKey}`, 'YELLOW', config.colorize),
|
|
178
|
+
...diff.children.flatMap((child) => formatAttributeLines(child, indent + config.indentSize, config, childKeyWidth)),
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
const beforeStr = formatValue(diff.before);
|
|
182
|
+
const afterStr = formatValue(diff.after);
|
|
183
|
+
return [
|
|
184
|
+
colorize(`${spaces}${alignedKey} ${beforeStr} -> ${afterStr}`, 'YELLOW', config.colorize),
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const ACTION_DESC = {
|
|
190
|
+
create: 'PLAN_WILL_CREATE',
|
|
191
|
+
update: 'PLAN_WILL_UPDATE',
|
|
192
|
+
delete: 'PLAN_WILL_DESTROY',
|
|
193
|
+
noop: 'PLAN_NO_CHANGES',
|
|
194
|
+
refresh: 'PLAN_WILL_REFRESH',
|
|
195
|
+
};
|
|
196
|
+
const ACTION_SYMBOL = {
|
|
197
|
+
create: '+',
|
|
198
|
+
update: '~',
|
|
199
|
+
delete: '-',
|
|
200
|
+
refresh: '↻',
|
|
201
|
+
};
|
|
202
|
+
const ACTION_COLOR = {
|
|
203
|
+
create: 'GREEN',
|
|
204
|
+
update: 'YELLOW',
|
|
205
|
+
delete: 'RED',
|
|
206
|
+
refresh: 'CYAN',
|
|
207
|
+
};
|
|
208
|
+
const formatPlanItem = (item, config = DEFAULT_CONFIG) => {
|
|
209
|
+
const descKey = ACTION_DESC[item.action] ?? 'PLAN_NO_CHANGES';
|
|
210
|
+
const headerLine = ` # ${item.logicalId} ${lang_1.lang.__(descKey)}`;
|
|
211
|
+
if (item.action === 'noop') {
|
|
212
|
+
return headerLine;
|
|
213
|
+
}
|
|
214
|
+
const symbol = ACTION_SYMBOL[item.action] ?? ' ';
|
|
215
|
+
const symbolColor = ACTION_COLOR[item.action] ?? 'RESET';
|
|
216
|
+
const resourceLine = colorize(` ${symbol} ${item.logicalId}:`, symbolColor, config.colorize);
|
|
217
|
+
if (!item.changes) {
|
|
218
|
+
return [headerLine, resourceLine].join('\n');
|
|
219
|
+
}
|
|
220
|
+
const { diffs, unchangedCount } = (0, exports.computeAttributeDiffs)(item.changes.before, item.changes.after);
|
|
221
|
+
const keyWidth = Math.max(config.keyAlignWidth, computeMaxKeyWidth(diffs, config.indentSize));
|
|
222
|
+
const attrLines = diffs.length > 0
|
|
223
|
+
? diffs.flatMap((diff) => formatAttributeLines(diff, config.indentSize, config, keyWidth))
|
|
224
|
+
: [];
|
|
225
|
+
const hiddenLine = unchangedCount > 0 && !config.showUnchangedAttributes
|
|
226
|
+
? [
|
|
227
|
+
colorize(` # ${lang_1.lang.__('PLAN_UNCHANGED_ATTRS', { count: String(unchangedCount) })}`, 'DIM', config.colorize),
|
|
228
|
+
]
|
|
229
|
+
: [];
|
|
230
|
+
return [headerLine, resourceLine, ...attrLines, ...hiddenLine].join('\n');
|
|
231
|
+
};
|
|
232
|
+
exports.formatPlanItem = formatPlanItem;
|
|
233
|
+
const formatPlan = (items, config = DEFAULT_CONFIG) => {
|
|
234
|
+
if (items.length === 0) {
|
|
235
|
+
return lang_1.lang.__('NO_CHANGES_INFRASTRUCTURE_UP_TO_DATE');
|
|
236
|
+
}
|
|
237
|
+
const createItems = items.filter((i) => i.action === 'create');
|
|
238
|
+
const updateItems = items.filter((i) => i.action === 'update');
|
|
239
|
+
const deleteItems = items.filter((i) => i.action === 'delete');
|
|
240
|
+
const refreshItems = items.filter((i) => i.action === 'refresh');
|
|
241
|
+
const noopItems = items.filter((i) => i.action === 'noop');
|
|
242
|
+
const actionItems = [
|
|
243
|
+
...createItems,
|
|
244
|
+
...updateItems,
|
|
245
|
+
...deleteItems,
|
|
246
|
+
...refreshItems,
|
|
247
|
+
...noopItems,
|
|
248
|
+
];
|
|
249
|
+
const header = [
|
|
250
|
+
`${lang_1.lang.__('PLAN_HEADER')}\n`,
|
|
251
|
+
colorize(lang_1.lang.__('PLAN_LEGEND_CREATE'), 'GREEN', config.colorize),
|
|
252
|
+
colorize(lang_1.lang.__('PLAN_LEGEND_UPDATE'), 'YELLOW', config.colorize),
|
|
253
|
+
colorize(lang_1.lang.__('PLAN_LEGEND_DESTROY'), 'RED', config.colorize),
|
|
254
|
+
'',
|
|
255
|
+
];
|
|
256
|
+
const itemLines = actionItems.flatMap((item) => [(0, exports.formatPlanItem)(item, config), '']);
|
|
257
|
+
const summary = lang_1.lang.__('PLAN_SUMMARY', {
|
|
258
|
+
createCount: String(createItems.length),
|
|
259
|
+
updateCount: String(updateItems.length),
|
|
260
|
+
deleteCount: String(deleteItems.length),
|
|
261
|
+
});
|
|
262
|
+
return [...header, ...itemLines, summary].join('\n');
|
|
263
|
+
};
|
|
264
|
+
exports.formatPlan = formatPlan;
|
|
265
|
+
const displayPlan = (planResult) => {
|
|
266
|
+
const output = (0, exports.formatPlan)(planResult.items);
|
|
267
|
+
logger_1.logger.info(output);
|
|
268
|
+
};
|
|
269
|
+
exports.displayPlan = displayPlan;
|
package/dist/src/lang/en.js
CHANGED
|
@@ -80,7 +80,7 @@ exports.en = {
|
|
|
80
80
|
PLAN_COMMAND_TENCENT_ONLY: 'Plan command is currently only supported for Tencent provider',
|
|
81
81
|
GENERATING_PLAN_FOR_SCF: 'Generating plan for Tencent SCF resources...',
|
|
82
82
|
DEPLOYMENT_PLAN: 'DEPLOYMENT PLAN',
|
|
83
|
-
NO_CHANGES_INFRASTRUCTURE_UP_TO_DATE: 'No changes. Infrastructure is up
|
|
83
|
+
NO_CHANGES_INFRASTRUCTURE_UP_TO_DATE: 'No changes. Infrastructure is up to date.',
|
|
84
84
|
CREATE: 'CREATE',
|
|
85
85
|
UPDATE: 'UPDATE',
|
|
86
86
|
DELETE: 'DELETE',
|
|
@@ -103,6 +103,18 @@ exports.en = {
|
|
|
103
103
|
EXECUTING_PLAN: 'Executing deployment plan...',
|
|
104
104
|
DEPLOY_CONFIRMATION: 'Do you want to perform these actions? (yes/no): ',
|
|
105
105
|
DEPLOY_CANCELLED: 'Deployment cancelled.',
|
|
106
|
+
PLAN_WILL_CREATE: 'will be created',
|
|
107
|
+
PLAN_WILL_UPDATE: 'will be updated in-place',
|
|
108
|
+
PLAN_WILL_DESTROY: 'will be destroyed',
|
|
109
|
+
PLAN_WILL_REFRESH: 'will be refreshed',
|
|
110
|
+
PLAN_NO_CHANGES: 'no changes',
|
|
111
|
+
PLAN_HEADER: 'ServerlessInsight will perform the following actions:',
|
|
112
|
+
PLAN_LEGEND_CREATE: ' + create',
|
|
113
|
+
PLAN_LEGEND_UPDATE: ' ~ update in-place',
|
|
114
|
+
PLAN_LEGEND_DESTROY: ' - destroy',
|
|
115
|
+
PLAN_SUMMARY: 'Plan: {{createCount}} to add, {{updateCount}} to change, {{deleteCount}} to destroy.',
|
|
116
|
+
PLAN_UNCHANGED_ATTRS: '({{count}} unchanged attributes hidden)',
|
|
117
|
+
PLAN_COMPUTED_VALUE: '(known after deploy)',
|
|
106
118
|
// TDSQL-C database messages
|
|
107
119
|
TDSQL_CLUSTER_CREATION_INITIATED: 'TDSQL-C cluster creation initiated',
|
|
108
120
|
TDSQL_CLUSTER_CREATION_FAILED: 'Failed to create TDSQL-C cluster',
|
|
@@ -276,6 +288,32 @@ exports.en = {
|
|
|
276
288
|
OSS_BUCKET_CNAME_BIND_FAILED: 'Failed to bind bucket CNAME: {{error}}',
|
|
277
289
|
OSS_BUCKET_CNAME_UNBIND_FAILED: 'Failed to unbind bucket CNAME: {{error}}',
|
|
278
290
|
OSS_BUCKET_CNAME_NEED_VERIFY: 'Domain ownership verification required. Please add TXT record in DNS console, then retry.',
|
|
291
|
+
OSS_CNAME_TOKEN_CREATE_FAILED: 'Failed to create CnameToken for domain ownership verification: {{domain}}',
|
|
292
|
+
OSS_CNAME_CREATING_VERIFICATION_TOKEN: 'Creating verification token for domain: {{domain}}',
|
|
293
|
+
OSS_CNAME_VERIFICATION_TOKEN_CREATED: 'Verification token created for domain {{domain}}. TXT record: {{txtRecord}}, Token: {{token}}',
|
|
294
|
+
OSS_CNAME_TXT_RECORD_CREATED: 'Created TXT record for domain ownership verification: {{txtRecord}}',
|
|
295
|
+
OSS_CNAME_TXT_RECORD_ALREADY_EXISTS: 'TXT verification record already exists: {{txtRecord}}',
|
|
296
|
+
OSS_CNAME_TXT_RECORD_CREATE_FAILED: 'Failed to create TXT record {{txtRecord}}: {{error}}. Please add manually.',
|
|
297
|
+
OSS_CNAME_WAITING_FOR_VERIFICATION: 'Waiting for domain ownership verification to propagate for: {{domain}}',
|
|
298
|
+
OSS_CNAME_DNS_PROPAGATION_WAITING: 'Waiting for TXT record DNS propagation for domain: {{domain}}',
|
|
299
|
+
OSS_CNAME_DNS_PROPAGATION_CHECK: 'Checking TXT record DNS propagation (attempt {{attempt}}/{{max}}, waiting 1 minute)...',
|
|
300
|
+
OSS_CNAME_DNS_PROPAGATION_VERIFIED: 'TXT record DNS propagation verified for domain: {{domain}} after {{minutes}} minute(s)',
|
|
301
|
+
OSS_CNAME_DNS_PROPAGATION_TIMEOUT: 'TXT record DNS propagation could not be verified after {{max}} attempts. Proceeding with binding retry anyway...',
|
|
302
|
+
OSS_CNAME_DNS_CHECK_FAILED: 'TXT record DNS propagation check failed: {{error}}',
|
|
303
|
+
OSS_CNAME_VERIFICATION_RETRY_FAILED: 'Domain ownership verification pending. Please add TXT record: {{txtRecord}} and retry deployment.',
|
|
304
|
+
OSS_CNAME_MANUAL_VERIFICATION_REQUIRED: 'Manual domain ownership verification required for {{domain}}. ' +
|
|
305
|
+
'Please add TXT record: {{txtRecord}} with value: {{token}}, then retry deployment.',
|
|
306
|
+
OSS_VERIFICATION_HEADER: 'OSS Domain Ownership Verification Required',
|
|
307
|
+
OSS_VERIFICATION_DOMAIN: 'Domain: {{domain}}',
|
|
308
|
+
OSS_VERIFICATION_INSTRUCTIONS: 'To verify domain ownership, add the following TXT DNS record:',
|
|
309
|
+
OSS_VERIFICATION_RECORD_NAME: ' Record Name: {{name}}',
|
|
310
|
+
OSS_VERIFICATION_RECORD_TYPE: ' Record Type: TXT',
|
|
311
|
+
OSS_VERIFICATION_RECORD_VALUE: ' Record Value: {{value}}',
|
|
312
|
+
OSS_VERIFICATION_NEXT_STEPS: 'After adding the TXT record:',
|
|
313
|
+
OSS_VERIFICATION_STEP1: '1. Wait 5-10 minutes for DNS propagation',
|
|
314
|
+
OSS_VERIFICATION_STEP2: '2. Run the deploy command again',
|
|
315
|
+
OSS_DNS_TXT_RECORD_DELETED: 'Deleted DNS TXT verification record for domain: {{domain}}',
|
|
316
|
+
OSS_DNS_TXT_RECORD_DELETE_FAILED: 'Failed to delete DNS TXT record for {{domain}}: {{error}}',
|
|
279
317
|
OSS_BUCKET_CERT_BINDING: 'Binding SSL certificate to custom domain {{domain}} on bucket {{bucketName}}',
|
|
280
318
|
OSS_BUCKET_CERT_BOUND: 'SSL certificate bound to custom domain: {{domain}}',
|
|
281
319
|
OSS_CORS_RULE_ADDED: 'Added CORS rule for custom domain: {{domain}}',
|
|
@@ -437,10 +475,12 @@ exports.en = {
|
|
|
437
475
|
CERT_READING_FILE: 'Reading certificate file: {{filePath}}',
|
|
438
476
|
CERT_PARSING_CERTIFICATES: 'Parsing certificates configuration',
|
|
439
477
|
CERT_RESOLVING_REFERENCE: 'Resolving certificate reference "{{reference}}" for domain "{{domain}}"',
|
|
440
|
-
CERT_REFERENCE_NOT_FOUND: 'Certificate reference "{{reference}}" could not be resolved.
|
|
478
|
+
CERT_REFERENCE_NOT_FOUND: 'Certificate reference "{{reference}}" could not be resolved.',
|
|
441
479
|
CERT_RESOLVED_UPLOAD: 'Certificate "{{name}}" resolved as upload mode (PEM files provided)',
|
|
442
480
|
CERT_RESOLVED_REFERENCE: 'Certificate "{{name}}" resolved as reference mode (certificate_id: {{certId}})',
|
|
443
481
|
CERT_READING_PEM_FILES: 'Reading PEM files for certificate "{{name}}"',
|
|
482
|
+
// Certificate inline PEM warning
|
|
483
|
+
CERT_INLINE_PEM_WARNING: 'Security warning: certificate_private_key appears to contain inline PEM content. Consider using a file path (e.g., ./certs/server.key) instead for better security.',
|
|
444
484
|
// CAS (Certificate Authority Service) messages
|
|
445
485
|
CAS_UPLOADING_CERT: 'Uploading certificate "{{name}}" to CAS',
|
|
446
486
|
CAS_CERT_UPLOADED: 'Certificate "{{name}}" uploaded to CAS (certId: {{certId}})',
|
|
@@ -465,7 +505,13 @@ exports.en = {
|
|
|
465
505
|
SSL_CERT_DEPLOY_FAILED: 'Failed to deploy certificate to {{resourceType}} (certificateId: {{certificateId}}): {{error}}',
|
|
466
506
|
COS_BUCKET_CERT_DEPLOYING: 'Deploying SSL certificate to COS bucket domain: {{domain}} (bucket: {{bucketName}})',
|
|
467
507
|
COS_BUCKET_CERT_DEPLOYED: 'SSL certificate deployed to COS bucket domain: {{domain}}',
|
|
468
|
-
TENCENT_CERT_REFERENCE_NOT_SUPPORTED: 'Certificate "{{name}}" uses certificate_id reference mode which is not yet supported for Tencent Cloud. Use certificate_body and
|
|
508
|
+
TENCENT_CERT_REFERENCE_NOT_SUPPORTED: 'Certificate "{{name}}" uses certificate_id reference mode which is not yet supported for Tencent Cloud. Use certificate_body and certificate_private_key instead.',
|
|
509
|
+
BUCKET_DOMAIN_REQUIRED_FOR_CERT: 'Bucket "{{name}}" has certificate configuration but no domain is set. A domain is required when providing certificate information.',
|
|
469
510
|
// Protocol messages
|
|
470
511
|
PROTOCOL_INFERRED_REDIRECT: 'Protocol "{{protocol}}" inferred HTTP-to-HTTPS redirect: {{redirect}}',
|
|
512
|
+
// Retry utility messages
|
|
513
|
+
RETRY_ATTEMPT: 'Retrying {{operation}} (attempt {{attempt}}/{{max}})...',
|
|
514
|
+
RETRY_ATTEMPT_FAILED: '{{operation}} attempt {{attempt}}/{{max}} failed: {{error}}. Retrying...',
|
|
515
|
+
RETRY_ALL_ATTEMPTS_FAILED: '{{operation}} failed after {{max}} attempts: {{error}}',
|
|
516
|
+
RETRY_UNEXPECTED_FAILURE: '{{operation}} failed unexpectedly',
|
|
471
517
|
};
|
package/dist/src/lang/zh-CN.js
CHANGED
|
@@ -103,6 +103,18 @@ exports.zhCN = {
|
|
|
103
103
|
EXECUTING_PLAN: '正在执行部署计划...',
|
|
104
104
|
DEPLOY_CONFIRMATION: '是否执行这些操作?(yes/no): ',
|
|
105
105
|
DEPLOY_CANCELLED: '部署已取消。',
|
|
106
|
+
PLAN_WILL_CREATE: '将被创建',
|
|
107
|
+
PLAN_WILL_UPDATE: '将就地更新',
|
|
108
|
+
PLAN_WILL_DESTROY: '将被销毁',
|
|
109
|
+
PLAN_WILL_REFRESH: '将被刷新',
|
|
110
|
+
PLAN_NO_CHANGES: '无变更',
|
|
111
|
+
PLAN_HEADER: 'ServerlessInsight 将执行以下操作:',
|
|
112
|
+
PLAN_LEGEND_CREATE: ' + 创建',
|
|
113
|
+
PLAN_LEGEND_UPDATE: ' ~ 就地更新',
|
|
114
|
+
PLAN_LEGEND_DESTROY: ' - 销毁',
|
|
115
|
+
PLAN_SUMMARY: '计划: 新增 {{createCount}} 个,变更 {{updateCount}} 个,销毁 {{deleteCount}} 个。',
|
|
116
|
+
PLAN_UNCHANGED_ATTRS: '({{count}} 个未变更属性已隐藏)',
|
|
117
|
+
PLAN_COMPUTED_VALUE: '(部署后可知)',
|
|
106
118
|
// TDSQL-C 数据库消息
|
|
107
119
|
TDSQL_CLUSTER_CREATION_INITIATED: 'TDSQL-C 集群创建已启动',
|
|
108
120
|
TDSQL_CLUSTER_CREATION_FAILED: '创建 TDSQL-C 集群失败',
|
|
@@ -275,6 +287,32 @@ exports.zhCN = {
|
|
|
275
287
|
OSS_BUCKET_CNAME_BIND_FAILED: '绑定存储桶 CNAME 失败: {{error}}',
|
|
276
288
|
OSS_BUCKET_CNAME_UNBIND_FAILED: '解绑存储桶 CNAME 失败: {{error}}',
|
|
277
289
|
OSS_BUCKET_CNAME_NEED_VERIFY: '需要验证域名所有权。请在 DNS 控制台添加 TXT 记录后重试。',
|
|
290
|
+
OSS_CNAME_TOKEN_CREATE_FAILED: '创建域名所有权验证 CnameToken 失败: {{domain}}',
|
|
291
|
+
OSS_CNAME_CREATING_VERIFICATION_TOKEN: '正在为域名创建验证令牌: {{domain}}',
|
|
292
|
+
OSS_CNAME_VERIFICATION_TOKEN_CREATED: '已为域名 {{domain}} 创建验证令牌。TXT 记录: {{txtRecord}}, 令牌: {{token}}',
|
|
293
|
+
OSS_CNAME_TXT_RECORD_CREATED: '已创建域名所有权验证 TXT 记录: {{txtRecord}}',
|
|
294
|
+
OSS_CNAME_TXT_RECORD_ALREADY_EXISTS: 'TXT 验证记录已存在: {{txtRecord}}',
|
|
295
|
+
OSS_CNAME_TXT_RECORD_CREATE_FAILED: '创建 TXT 记录 {{txtRecord}} 失败: {{error}}。请手动添加。',
|
|
296
|
+
OSS_CNAME_WAITING_FOR_VERIFICATION: '等待域名所有权验证生效: {{domain}}',
|
|
297
|
+
OSS_CNAME_DNS_PROPAGATION_WAITING: '等待域名 TXT 记录 DNS 生效: {{domain}}',
|
|
298
|
+
OSS_CNAME_DNS_PROPAGATION_CHECK: '正在检查 TXT 记录 DNS 生效状态(第 {{attempt}}/{{max}} 次,等待 1 分钟)...',
|
|
299
|
+
OSS_CNAME_DNS_PROPAGATION_VERIFIED: '域名 TXT 记录 DNS 已生效: {{domain}},耗时 {{minutes}} 分钟',
|
|
300
|
+
OSS_CNAME_DNS_PROPAGATION_TIMEOUT: 'TXT 记录 DNS 在 {{max}} 次尝试后仍未验证生效。继续尝试绑定...',
|
|
301
|
+
OSS_CNAME_DNS_CHECK_FAILED: 'TXT 记录 DNS 生效检查失败: {{error}}',
|
|
302
|
+
OSS_CNAME_VERIFICATION_RETRY_FAILED: '域名所有权验证中。请添加 TXT 记录: {{txtRecord}} 后重新部署。',
|
|
303
|
+
OSS_CNAME_MANUAL_VERIFICATION_REQUIRED: '域名 {{domain}} 需要手动验证所有权。' +
|
|
304
|
+
'请添加 TXT 记录: {{txtRecord}},值为: {{token}},然后重新部署。',
|
|
305
|
+
OSS_VERIFICATION_HEADER: 'OSS 域名所有权验证',
|
|
306
|
+
OSS_VERIFICATION_DOMAIN: '域名: {{domain}}',
|
|
307
|
+
OSS_VERIFICATION_INSTRUCTIONS: '请添加以下 TXT DNS 记录以验证域名所有权:',
|
|
308
|
+
OSS_VERIFICATION_RECORD_NAME: ' 记录名称: {{name}}',
|
|
309
|
+
OSS_VERIFICATION_RECORD_TYPE: ' 记录类型: TXT',
|
|
310
|
+
OSS_VERIFICATION_RECORD_VALUE: ' 记录值: {{value}}',
|
|
311
|
+
OSS_VERIFICATION_NEXT_STEPS: '添加 TXT 记录后:',
|
|
312
|
+
OSS_VERIFICATION_STEP1: '1. 等待 5-10 分钟 DNS 生效',
|
|
313
|
+
OSS_VERIFICATION_STEP2: '2. 重新运行部署命令',
|
|
314
|
+
OSS_DNS_TXT_RECORD_DELETED: '已删除域名所有权验证 TXT 记录: {{domain}}',
|
|
315
|
+
OSS_DNS_TXT_RECORD_DELETE_FAILED: '删除域名 TXT 记录失败: {{domain}}: {{error}}',
|
|
278
316
|
OSS_BUCKET_CERT_BINDING: '正在为存储桶 {{bucketName}} 的自定义域名 {{domain}} 绑定 SSL 证书',
|
|
279
317
|
OSS_BUCKET_CERT_BOUND: '已为自定义域名绑定 SSL 证书: {{domain}}',
|
|
280
318
|
OSS_CORS_RULE_ADDED: '已为自定义域名添加 CORS 规则: {{domain}}',
|
|
@@ -433,10 +471,11 @@ exports.zhCN = {
|
|
|
433
471
|
CERT_READING_FILE: '正在读取证书文件: {{filePath}}',
|
|
434
472
|
CERT_PARSING_CERTIFICATES: '正在解析证书配置',
|
|
435
473
|
CERT_RESOLVING_REFERENCE: '正在解析域名 "{{domain}}" 的证书引用 "{{reference}}"',
|
|
436
|
-
CERT_REFERENCE_NOT_FOUND: '无法解析证书引用 "{{reference}}"
|
|
474
|
+
CERT_REFERENCE_NOT_FOUND: '无法解析证书引用 "{{reference}}"。',
|
|
437
475
|
CERT_RESOLVED_UPLOAD: '证书 "{{name}}" 解析为上传模式(提供了 PEM 文件)',
|
|
438
476
|
CERT_RESOLVED_REFERENCE: '证书 "{{name}}" 解析为引用模式(certificate_id: {{certId}})',
|
|
439
477
|
CERT_READING_PEM_FILES: '正在读取证书 "{{name}}" 的 PEM 文件',
|
|
478
|
+
CERT_INLINE_PEM_WARNING: '安全警告:certificate_private_key 似乎包含内联 PEM 内容。建议使用文件路径(例如 ./certs/server.key)以提高安全性。',
|
|
440
479
|
// CAS(证书授权服务)消息
|
|
441
480
|
CAS_UPLOADING_CERT: '正在上传证书 "{{name}}" 到 CAS',
|
|
442
481
|
CAS_CERT_UPLOADED: '证书 "{{name}}" 已上传到 CAS(certId: {{certId}})',
|
|
@@ -461,7 +500,13 @@ exports.zhCN = {
|
|
|
461
500
|
SSL_CERT_DEPLOY_FAILED: '部署证书到 {{resourceType}} 失败(证书ID: {{certificateId}}):{{error}}',
|
|
462
501
|
COS_BUCKET_CERT_DEPLOYING: '正在为 COS 存储桶域名部署 SSL 证书: {{domain}}(存储桶: {{bucketName}})',
|
|
463
502
|
COS_BUCKET_CERT_DEPLOYED: 'SSL 证书已部署到 COS 存储桶域名: {{domain}}',
|
|
464
|
-
TENCENT_CERT_REFERENCE_NOT_SUPPORTED: '证书 "{{name}}" 使用了 certificate_id 引用模式,腾讯云暂不支持该模式。请改用 certificate_body 和
|
|
503
|
+
TENCENT_CERT_REFERENCE_NOT_SUPPORTED: '证书 "{{name}}" 使用了 certificate_id 引用模式,腾讯云暂不支持该模式。请改用 certificate_body 和 certificate_private_key。',
|
|
504
|
+
BUCKET_DOMAIN_REQUIRED_FOR_CERT: '存储桶 "{{name}}" 已配置证书信息,但未设置域名。提供证书信息时必须设置域名。',
|
|
465
505
|
// 协议消息
|
|
466
506
|
PROTOCOL_INFERRED_REDIRECT: '协议 "{{protocol}}" 推断 HTTP 到 HTTPS 重定向:{{redirect}}',
|
|
507
|
+
// 重试工具消息
|
|
508
|
+
RETRY_ATTEMPT: '正在重试 {{operation}}(第 {{attempt}}/{{max}} 次)...',
|
|
509
|
+
RETRY_ATTEMPT_FAILED: '{{operation}} 第 {{attempt}}/{{max}} 次尝试失败:{{error}}。正在重试...',
|
|
510
|
+
RETRY_ALL_ATTEMPTS_FAILED: '{{operation}} 在 {{max}} 次尝试后失败:{{error}}',
|
|
511
|
+
RETRY_UNEXPECTED_FAILURE: '{{operation}} 意外失败',
|
|
467
512
|
};
|
|
@@ -6,14 +6,28 @@ const parseUtils_1 = require("./parseUtils");
|
|
|
6
6
|
const isStructuredDomain = (domain) => typeof domain === 'object' && domain !== null && 'domain_name' in domain;
|
|
7
7
|
const parseWebsiteDomain = (domain) => {
|
|
8
8
|
if (domain == null) {
|
|
9
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
domain: undefined,
|
|
11
|
+
domain_certificate_id: undefined,
|
|
12
|
+
domain_certificate_body: undefined,
|
|
13
|
+
domain_certificate_private_key: undefined,
|
|
14
|
+
domain_protocol: undefined,
|
|
15
|
+
};
|
|
10
16
|
}
|
|
11
17
|
if (!isStructuredDomain(domain)) {
|
|
12
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
domain: String(domain),
|
|
20
|
+
domain_certificate_id: undefined,
|
|
21
|
+
domain_certificate_body: undefined,
|
|
22
|
+
domain_certificate_private_key: undefined,
|
|
23
|
+
domain_protocol: undefined,
|
|
24
|
+
};
|
|
13
25
|
}
|
|
14
26
|
return {
|
|
15
27
|
domain: String(domain.domain_name),
|
|
16
|
-
|
|
28
|
+
domain_certificate_id: domain.certificate_id != null ? String(domain.certificate_id) : undefined,
|
|
29
|
+
domain_certificate_body: domain.certificate_body != null ? String(domain.certificate_body) : undefined,
|
|
30
|
+
domain_certificate_private_key: domain.certificate_private_key != null ? String(domain.certificate_private_key) : undefined,
|
|
17
31
|
domain_protocol: domain.protocol != null
|
|
18
32
|
? Array.isArray(domain.protocol)
|
|
19
33
|
? domain.protocol.map(String)
|
package/dist/src/parser/index.js
CHANGED
|
@@ -11,7 +11,6 @@ const yaml_1 = require("yaml");
|
|
|
11
11
|
const validator_1 = require("../validator");
|
|
12
12
|
const bucketParser_1 = require("./bucketParser");
|
|
13
13
|
const tableParser_1 = require("./tableParser");
|
|
14
|
-
const certificateParser_1 = require("./certificateParser");
|
|
15
14
|
const common_1 = require("../common");
|
|
16
15
|
const validateExistence = (path) => {
|
|
17
16
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
@@ -52,7 +51,6 @@ const transformYaml = (iacJson, stage) => {
|
|
|
52
51
|
tables: (0, tableParser_1.parseTable)(iacJson.tables),
|
|
53
52
|
tags: (0, tagParser_1.parseTag)(iacJson.tags, iacJson.app, iacJson.service, stage),
|
|
54
53
|
buckets: (0, bucketParser_1.parseBucket)(iacJson.buckets),
|
|
55
|
-
certificates: iacJson.certificates ? (0, certificateParser_1.parseCertificate)(iacJson.certificates) : undefined,
|
|
56
54
|
};
|
|
57
55
|
};
|
|
58
56
|
const parseYaml = (iacLocation) => {
|
|
@@ -43,7 +43,7 @@ const generateApigwPlan = async (context, state, events, serviceName) => {
|
|
|
43
43
|
domain: event.domain
|
|
44
44
|
? {
|
|
45
45
|
domainName: event.domain.domain_name,
|
|
46
|
-
|
|
46
|
+
hasCertificate: !!(event.domain.certificate_body || event.domain.certificate_id),
|
|
47
47
|
}
|
|
48
48
|
: null,
|
|
49
49
|
};
|