@geek-fun/serverlessinsight 0.5.2 → 0.5.4
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/package.json +1 -1
- package/dist/src/common/aliyunClient/apigwOperations.js +3 -2
- package/dist/src/common/index.js +1 -0
- package/dist/src/common/sidUtils.js +24 -0
- package/dist/src/common/stateBackend/index.js +4 -4
- package/dist/src/common/stateManager.js +2 -2
- package/dist/src/parser/index.js +7 -8
- package/dist/src/stack/aliyunStack/apigwResource.js +13 -12
- package/dist/src/stack/aliyunStack/databaseResource.js +37 -21
- package/dist/src/stack/aliyunStack/fc3Executor.js +15 -5
- package/dist/src/stack/aliyunStack/fc3Planner.js +1 -1
- package/dist/src/stack/aliyunStack/fc3Resource.js +175 -129
- package/dist/src/stack/aliyunStack/ossResource.js +19 -8
- package/dist/src/stack/aliyunStack/tablestoreResource.js +19 -7
- package/dist/src/stack/scfStack/cosResource.js +21 -7
- package/dist/src/stack/scfStack/esServerlessResource.js +20 -7
- package/dist/src/stack/scfStack/scfResource.js +20 -7
- package/dist/src/stack/scfStack/tdsqlcResource.js +24 -7
- package/dist/src/types/domains/state.js +11 -2
- package/dist/src/validator/rootSchema.js +16 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.geekfun.club",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -39,6 +39,7 @@ const dnsOperations_1 = require("./dnsOperations");
|
|
|
39
39
|
const logger_1 = require("../logger");
|
|
40
40
|
const lang_1 = require("../../lang");
|
|
41
41
|
const stateManager_1 = require("../stateManager");
|
|
42
|
+
const sidUtils_1 = require("../sidUtils");
|
|
42
43
|
const removeUndefined = (obj) => {
|
|
43
44
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
44
45
|
};
|
|
@@ -187,7 +188,7 @@ const createApigwOperations = (apigwClient, dnsClient, _context) => {
|
|
|
187
188
|
},
|
|
188
189
|
instances: [
|
|
189
190
|
{
|
|
190
|
-
|
|
191
|
+
sid: (0, sidUtils_1.buildSid)('aliyun', 'alidns', _context.stage, recordId),
|
|
191
192
|
id: recordId,
|
|
192
193
|
type: 'CNAME',
|
|
193
194
|
status: 'PENDING',
|
|
@@ -213,7 +214,7 @@ const createApigwOperations = (apigwClient, dnsClient, _context) => {
|
|
|
213
214
|
},
|
|
214
215
|
instances: [
|
|
215
216
|
{
|
|
216
|
-
|
|
217
|
+
sid: (0, sidUtils_1.buildSid)('aliyun', 'alidns', _context.stage, 'existing'),
|
|
217
218
|
id: 'existing',
|
|
218
219
|
type: 'CNAME',
|
|
219
220
|
status: 'EXISTING',
|
package/dist/src/common/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ServerlessInsight ID (SID) — logical resource identifier.
|
|
4
|
+
*
|
|
5
|
+
* Format: si:<provider>:<service>:<stage>:<id>
|
|
6
|
+
* Example: si:aliyun:rds:default:rm-abc123
|
|
7
|
+
*
|
|
8
|
+
* SID is a tool-generated identifier that uniquely locates a resource
|
|
9
|
+
* within a ServerlessInsight deployment. It is NOT a cloud-provider
|
|
10
|
+
* identifier — the provider-returned physical ID is stored separately
|
|
11
|
+
* in the `id` field of ResourceInstance.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.buildSid = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Build a ServerlessInsight ID (SID).
|
|
17
|
+
*
|
|
18
|
+
* @param provider - Cloud provider name (e.g. 'aliyun', 'tencent')
|
|
19
|
+
* @param service - Cloud service name (e.g. 'fc3', 'oss', 'rds', 'scf')
|
|
20
|
+
* @param stage - Deployment stage (e.g. 'default', 'dev', 'prod')
|
|
21
|
+
* @param id - Provider-returned physical resource identifier
|
|
22
|
+
*/
|
|
23
|
+
const buildSid = (provider, service, stage, id) => `si:${provider}:${service}:${stage}:${id}`;
|
|
24
|
+
exports.buildSid = buildSid;
|
|
@@ -29,10 +29,10 @@ const createStateBackend = (backendConfig, context) => {
|
|
|
29
29
|
return (0, localStateBackend_1.createLocalStateBackend)(context.app, context.service, context.baseDir);
|
|
30
30
|
}
|
|
31
31
|
const bucketConfig = backendConfig;
|
|
32
|
-
const region =
|
|
33
|
-
const accessKeyId =
|
|
34
|
-
const accessKeySecret =
|
|
35
|
-
const securityToken =
|
|
32
|
+
const region = context.region;
|
|
33
|
+
const accessKeyId = context.accessKeyId;
|
|
34
|
+
const accessKeySecret = context.accessKeySecret;
|
|
35
|
+
const securityToken = context.securityToken;
|
|
36
36
|
if (context.provider === providerEnum_1.ProviderEnum.TENCENT) {
|
|
37
37
|
return (0, cosStateBackend_1.createCosStateBackend)({
|
|
38
38
|
bucket: bucketConfig.bucket,
|
|
@@ -124,8 +124,8 @@ const getRoleArnFromState = (state) => {
|
|
|
124
124
|
for (const [logicalId, resourceState] of Object.entries(allResources)) {
|
|
125
125
|
if (logicalId.startsWith('functions.')) {
|
|
126
126
|
const ramRoleInstance = resourceState.instances?.find((i) => i.type === 'ALIYUN_RAM_ROLE');
|
|
127
|
-
if (ramRoleInstance?.
|
|
128
|
-
return ramRoleInstance.
|
|
127
|
+
if (ramRoleInstance?.roleArn) {
|
|
128
|
+
return ramRoleInstance.roleArn;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
package/dist/src/parser/index.js
CHANGED
|
@@ -20,19 +20,18 @@ const validateExistence = (path) => {
|
|
|
20
20
|
const parseBackend = (raw) => {
|
|
21
21
|
if (!raw)
|
|
22
22
|
return undefined;
|
|
23
|
-
const
|
|
23
|
+
const stateManager = raw.state_manager;
|
|
24
|
+
if (!stateManager)
|
|
25
|
+
return undefined;
|
|
26
|
+
const type = stateManager.type?.toUpperCase();
|
|
24
27
|
if (type === types_1.StateBackendType.BUCKET_STORE) {
|
|
25
|
-
if (!
|
|
28
|
+
if (!stateManager.bucket || !stateManager.key) {
|
|
26
29
|
throw new Error('Backend type BUCKET_STORE requires both "bucket" and "key" fields');
|
|
27
30
|
}
|
|
28
31
|
return {
|
|
29
32
|
type: types_1.StateBackendType.BUCKET_STORE,
|
|
30
|
-
bucket:
|
|
31
|
-
key:
|
|
32
|
-
region: raw.region,
|
|
33
|
-
accessKeyId: raw.accessKeyId,
|
|
34
|
-
accessKeySecret: raw.accessKeySecret,
|
|
35
|
-
securityToken: raw.securityToken,
|
|
33
|
+
bucket: stateManager.bucket,
|
|
34
|
+
key: stateManager.key,
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
return { type: types_1.StateBackendType.LOCAL };
|
|
@@ -4,12 +4,13 @@ exports.deleteApigwResource = exports.updateApigwResource = exports.readApigwRes
|
|
|
4
4
|
const aliyunClient_1 = require("../../common/aliyunClient");
|
|
5
5
|
const apigwTypes_1 = require("./apigwTypes");
|
|
6
6
|
const stateManager_1 = require("../../common/stateManager");
|
|
7
|
+
const common_1 = require("../../common");
|
|
7
8
|
const logger_1 = require("../../common/logger");
|
|
8
9
|
const lang_1 = require("../../lang");
|
|
9
|
-
const buildApigwGroupInstanceFromProvider = (info,
|
|
10
|
+
const buildApigwGroupInstanceFromProvider = (info, stage) => {
|
|
10
11
|
return {
|
|
11
12
|
type: 'ALIYUN_APIGW_GROUP',
|
|
12
|
-
|
|
13
|
+
sid: (0, common_1.buildSid)('aliyun', 'apigateway', stage, info.groupId ?? ''),
|
|
13
14
|
id: info.groupId ?? '',
|
|
14
15
|
groupId: info.groupId ?? null,
|
|
15
16
|
groupName: info.groupName ?? null,
|
|
@@ -26,10 +27,10 @@ const buildApigwGroupInstanceFromProvider = (info, region) => {
|
|
|
26
27
|
trafficLimit: info.trafficLimit ?? null,
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
|
-
const buildApigwApiInstanceFromProvider = (info,
|
|
30
|
+
const buildApigwApiInstanceFromProvider = (info, stage, groupId) => {
|
|
30
31
|
return {
|
|
31
32
|
type: 'ALIYUN_APIGW_API',
|
|
32
|
-
|
|
33
|
+
sid: (0, common_1.buildSid)('aliyun', 'apigateway', stage, `${groupId}/${info.apiId}`),
|
|
33
34
|
id: info.apiId ?? '',
|
|
34
35
|
apiId: info.apiId ?? null,
|
|
35
36
|
apiName: info.apiName ?? null,
|
|
@@ -45,10 +46,10 @@ const buildApigwApiInstanceFromProvider = (info, region, groupId) => {
|
|
|
45
46
|
modifiedTime: info.modifiedTime ?? null,
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
|
-
const buildApigwDeploymentInstance = (groupId, apiId, stageName,
|
|
49
|
+
const buildApigwDeploymentInstance = (groupId, apiId, stageName, stage) => {
|
|
49
50
|
return {
|
|
50
51
|
type: 'ALIYUN_APIGW_DEPLOYMENT',
|
|
51
|
-
|
|
52
|
+
sid: (0, common_1.buildSid)('aliyun', 'apigateway', stage, `${groupId}/${apiId}/${stageName}`),
|
|
52
53
|
id: `${groupId}/${apiId}/${stageName}`,
|
|
53
54
|
groupId,
|
|
54
55
|
apiId,
|
|
@@ -80,7 +81,7 @@ const createApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
80
81
|
throw new Error(`Failed to get API group info after creation: ${groupId}`);
|
|
81
82
|
}
|
|
82
83
|
const instances = [
|
|
83
|
-
buildApigwGroupInstanceFromProvider(groupInfo, context.
|
|
84
|
+
buildApigwGroupInstanceFromProvider(groupInfo, context.stage),
|
|
84
85
|
];
|
|
85
86
|
const groupDefinition = (0, apigwTypes_1.extractApigwGroupDefinition)(groupConfig);
|
|
86
87
|
const partialResourceState = {
|
|
@@ -111,7 +112,7 @@ const createApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
111
112
|
// Get API info for state
|
|
112
113
|
const apiInfo = await client.apigw.getApi(groupId, apiId);
|
|
113
114
|
if (apiInfo) {
|
|
114
|
-
instances.push(buildApigwApiInstanceFromProvider(apiInfo, context.
|
|
115
|
+
instances.push(buildApigwApiInstanceFromProvider(apiInfo, context.stage, groupId));
|
|
115
116
|
}
|
|
116
117
|
// Deploy API to RELEASE stage
|
|
117
118
|
const deploymentConfig = {
|
|
@@ -121,7 +122,7 @@ const createApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
121
122
|
description: `${serviceName} API deployment for ${trigger.method} ${trigger.path}`,
|
|
122
123
|
};
|
|
123
124
|
await client.apigw.deployApi(deploymentConfig);
|
|
124
|
-
instances.push(buildApigwDeploymentInstance(groupId, apiId, 'RELEASE', context.
|
|
125
|
+
instances.push(buildApigwDeploymentInstance(groupId, apiId, 'RELEASE', context.stage));
|
|
125
126
|
const updatedResourceState = {
|
|
126
127
|
mode: 'managed',
|
|
127
128
|
region: context.region,
|
|
@@ -215,7 +216,7 @@ const updateApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
215
216
|
throw new Error(`Failed to get API group info after update: ${groupId}`);
|
|
216
217
|
}
|
|
217
218
|
const instances = [
|
|
218
|
-
buildApigwGroupInstanceFromProvider(groupInfo, context.
|
|
219
|
+
buildApigwGroupInstanceFromProvider(groupInfo, context.stage),
|
|
219
220
|
];
|
|
220
221
|
const existingApis = existingInstances.filter((i) => i.type === 'ALIYUN_APIGW_API');
|
|
221
222
|
const neededApiKeys = new Set();
|
|
@@ -236,7 +237,7 @@ const updateApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
236
237
|
}
|
|
237
238
|
const apiInfo = await client.apigw.getApi(groupId, apiId);
|
|
238
239
|
if (apiInfo) {
|
|
239
|
-
instances.push(buildApigwApiInstanceFromProvider(apiInfo, context.
|
|
240
|
+
instances.push(buildApigwApiInstanceFromProvider(apiInfo, context.stage, groupId));
|
|
240
241
|
}
|
|
241
242
|
const deploymentConfig = {
|
|
242
243
|
groupId,
|
|
@@ -245,7 +246,7 @@ const updateApigwResource = async (context, event, serviceName, roleArn, state)
|
|
|
245
246
|
description: `${serviceName} API deployment for ${trigger.method} ${trigger.path}`,
|
|
246
247
|
};
|
|
247
248
|
await client.apigw.deployApi(deploymentConfig);
|
|
248
|
-
instances.push(buildApigwDeploymentInstance(groupId, apiId, 'RELEASE', context.
|
|
249
|
+
instances.push(buildApigwDeploymentInstance(groupId, apiId, 'RELEASE', context.stage));
|
|
249
250
|
}
|
|
250
251
|
for (const existingApi of existingApis) {
|
|
251
252
|
const apiInfo = await client.apigw.getApi(groupId, existingApi.id);
|
|
@@ -5,9 +5,11 @@ const aliyunClient_1 = require("../../common/aliyunClient");
|
|
|
5
5
|
const rdsTypes_1 = require("./rdsTypes");
|
|
6
6
|
const esServerlessTypes_1 = require("./esServerlessTypes");
|
|
7
7
|
const stateManager_1 = require("../../common/stateManager");
|
|
8
|
-
const
|
|
8
|
+
const common_1 = require("../../common");
|
|
9
|
+
const logger_1 = require("../../common/logger");
|
|
10
|
+
const buildRdsInstanceFromProvider = (info, sid) => {
|
|
9
11
|
return {
|
|
10
|
-
|
|
12
|
+
sid,
|
|
11
13
|
id: info.dbInstanceId ?? '',
|
|
12
14
|
dbInstanceId: info.dbInstanceId ?? null,
|
|
13
15
|
dbInstanceDescription: info.dbInstanceDescription ?? null,
|
|
@@ -38,9 +40,9 @@ const buildRdsInstanceFromProvider = (info, arn) => {
|
|
|
38
40
|
multiAZ: info.multiAZ ?? null,
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
|
-
const buildEsInstanceFromProvider = (info,
|
|
43
|
+
const buildEsInstanceFromProvider = (info, sid) => {
|
|
42
44
|
return {
|
|
43
|
-
|
|
45
|
+
sid,
|
|
44
46
|
id: info.appId ?? '',
|
|
45
47
|
appId: info.appId ?? null,
|
|
46
48
|
appName: info.appName ?? null,
|
|
@@ -98,7 +100,6 @@ const createDatabaseResource = async (context, database, state) => {
|
|
|
98
100
|
let instanceId;
|
|
99
101
|
let definition;
|
|
100
102
|
let instance;
|
|
101
|
-
let arn;
|
|
102
103
|
let resourceType;
|
|
103
104
|
if (database.type === "ELASTICSEARCH_SERVERLESS" /* DatabaseEnum.ELASTICSEARCH_SERVERLESS */) {
|
|
104
105
|
// Create Elasticsearch Serverless app
|
|
@@ -110,8 +111,8 @@ const createDatabaseResource = async (context, database, state) => {
|
|
|
110
111
|
throw new Error(`Failed to refresh state for ES app: ${instanceId}`);
|
|
111
112
|
}
|
|
112
113
|
definition = (0, esServerlessTypes_1.extractEsDefinition)(config);
|
|
113
|
-
|
|
114
|
-
instance = buildEsInstanceFromProvider(appInfo,
|
|
114
|
+
const sid = (0, common_1.buildSid)('aliyun', 'es', context.stage, instanceId);
|
|
115
|
+
instance = buildEsInstanceFromProvider(appInfo, sid);
|
|
115
116
|
resourceType = 'ALIYUN_ES_SERVERLESS';
|
|
116
117
|
}
|
|
117
118
|
else if ([
|
|
@@ -128,8 +129,8 @@ const createDatabaseResource = async (context, database, state) => {
|
|
|
128
129
|
throw new Error(`Failed to refresh state for RDS instance: ${instanceId}`);
|
|
129
130
|
}
|
|
130
131
|
definition = (0, rdsTypes_1.extractRdsDefinition)(config);
|
|
131
|
-
|
|
132
|
-
instance = buildRdsInstanceFromProvider(rdsInfo,
|
|
132
|
+
const sid = (0, common_1.buildSid)('aliyun', 'rds', context.stage, instanceId);
|
|
133
|
+
instance = buildRdsInstanceFromProvider(rdsInfo, sid);
|
|
133
134
|
resourceType = 'ALIYUN_RDS_SERVERLESS';
|
|
134
135
|
}
|
|
135
136
|
else {
|
|
@@ -167,7 +168,6 @@ const updateDatabaseResource = async (context, database, instanceId, resourceTyp
|
|
|
167
168
|
const client = (0, aliyunClient_1.createAliyunClient)(context);
|
|
168
169
|
let definition;
|
|
169
170
|
let instance;
|
|
170
|
-
let arn;
|
|
171
171
|
if (resourceType === 'ALIYUN_ES_SERVERLESS') {
|
|
172
172
|
const config = (0, esServerlessTypes_1.databaseToEsConfig)(database);
|
|
173
173
|
await client.es.updateApp(instanceId, config);
|
|
@@ -177,8 +177,8 @@ const updateDatabaseResource = async (context, database, instanceId, resourceTyp
|
|
|
177
177
|
throw new Error(`Failed to refresh state for ES app: ${instanceId}`);
|
|
178
178
|
}
|
|
179
179
|
definition = (0, esServerlessTypes_1.extractEsDefinition)(config);
|
|
180
|
-
|
|
181
|
-
instance = buildEsInstanceFromProvider(appInfo,
|
|
180
|
+
const sid = (0, common_1.buildSid)('aliyun', 'es', context.stage, instanceId);
|
|
181
|
+
instance = buildEsInstanceFromProvider(appInfo, sid);
|
|
182
182
|
}
|
|
183
183
|
else if (resourceType === 'ALIYUN_RDS_SERVERLESS') {
|
|
184
184
|
const config = (0, rdsTypes_1.databaseToRdsConfig)(database);
|
|
@@ -189,8 +189,8 @@ const updateDatabaseResource = async (context, database, instanceId, resourceTyp
|
|
|
189
189
|
throw new Error(`Failed to refresh state for RDS instance: ${instanceId}`);
|
|
190
190
|
}
|
|
191
191
|
definition = (0, rdsTypes_1.extractRdsDefinition)(config);
|
|
192
|
-
|
|
193
|
-
instance = buildRdsInstanceFromProvider(rdsInfo,
|
|
192
|
+
const sid = (0, common_1.buildSid)('aliyun', 'rds', context.stage, instanceId);
|
|
193
|
+
instance = buildRdsInstanceFromProvider(rdsInfo, sid);
|
|
194
194
|
}
|
|
195
195
|
else {
|
|
196
196
|
throw new Error(`Unsupported resource type: ${resourceType}`);
|
|
@@ -214,14 +214,30 @@ const updateDatabaseResource = async (context, database, instanceId, resourceTyp
|
|
|
214
214
|
exports.updateDatabaseResource = updateDatabaseResource;
|
|
215
215
|
const deleteDatabaseResource = async (context, instanceId, resourceType, logicalId, state) => {
|
|
216
216
|
const client = (0, aliyunClient_1.createAliyunClient)(context);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
try {
|
|
218
|
+
if (resourceType === 'ALIYUN_ES_SERVERLESS') {
|
|
219
|
+
await client.es.deleteApp(instanceId);
|
|
220
|
+
}
|
|
221
|
+
else if (resourceType === 'ALIYUN_RDS_SERVERLESS') {
|
|
222
|
+
await client.rds.deleteInstance(instanceId);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
throw new Error(`Unsupported resource type: ${resourceType}`);
|
|
226
|
+
}
|
|
222
227
|
}
|
|
223
|
-
|
|
224
|
-
|
|
228
|
+
catch (err) {
|
|
229
|
+
const errorCode = err?.code;
|
|
230
|
+
const errorMessage = err?.message ?? '';
|
|
231
|
+
if (errorCode === 'InvalidDBInstanceId.NotFound' ||
|
|
232
|
+
errorCode === 'AppNotFound' ||
|
|
233
|
+
errorCode === 'NotFound' ||
|
|
234
|
+
errorMessage.includes('not found') ||
|
|
235
|
+
errorMessage.includes('NotFound')) {
|
|
236
|
+
logger_1.logger.warn(`Database resource ${instanceId} not found in provider, skipping deletion`);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
throw err;
|
|
240
|
+
}
|
|
225
241
|
}
|
|
226
242
|
return (0, stateManager_1.removeResource)(state, logicalId);
|
|
227
243
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeFunctionPlan = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
4
5
|
const fc3Resource_1 = require("./fc3Resource");
|
|
5
6
|
const common_1 = require("../../common");
|
|
6
7
|
const stateManager_1 = require("../../common/stateManager");
|
|
7
|
-
const lang_1 = require("../../lang");
|
|
8
8
|
const executeCreateAction = async (context, fn, currentState) => {
|
|
9
9
|
common_1.logger.info(`Creating function: ${fn.name}`);
|
|
10
10
|
const newState = await (0, fc3Resource_1.createResource)(context, fn, currentState);
|
|
@@ -68,14 +68,24 @@ const executeFunctionPlan = async (context, plan, functions, initialState, onSta
|
|
|
68
68
|
successfulItems.push(item);
|
|
69
69
|
if (onStateChange) {
|
|
70
70
|
onStateChange(currentState);
|
|
71
|
-
common_1.logger.debug(lang_1.lang.__('STATE_PERSISTED_AFTER_OPERATION', {
|
|
72
|
-
action: item.action,
|
|
73
|
-
resourceId: item.logicalId,
|
|
74
|
-
}));
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
74
|
catch (error) {
|
|
75
|
+
if (error instanceof types_1.PartialResourceError) {
|
|
76
|
+
const updatedState = error.updatedState;
|
|
77
|
+
if (onStateChange) {
|
|
78
|
+
onStateChange(updatedState);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
state: updatedState,
|
|
82
|
+
partialFailure: {
|
|
83
|
+
failedItem: item,
|
|
84
|
+
error: error.cause,
|
|
85
|
+
successfulItems,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
79
89
|
return {
|
|
80
90
|
state: currentState,
|
|
81
91
|
partialFailure: {
|
|
@@ -26,7 +26,7 @@ const generateFunctionPlan = async (context, state, functions) => {
|
|
|
26
26
|
const codePath = fn.code.path;
|
|
27
27
|
const desiredCodeHash = (0, common_1.computeFileHash)(codePath);
|
|
28
28
|
const desiredDefinition = (0, fc3Types_1.extractFc3Definition)(config, desiredCodeHash);
|
|
29
|
-
if (!currentState) {
|
|
29
|
+
if (!currentState || currentState.status === 'tainted') {
|
|
30
30
|
return {
|
|
31
31
|
logicalId,
|
|
32
32
|
action: 'create',
|