@geek-fun/serverlessinsight 0.6.13 → 0.6.15
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
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",
|
|
@@ -60,7 +60,7 @@ const planFunctionDeletion = (logicalId, definition) => ({
|
|
|
60
60
|
logicalId,
|
|
61
61
|
action: 'delete',
|
|
62
62
|
resourceType: 'ALIYUN_FC3',
|
|
63
|
-
changes: { before: definition },
|
|
63
|
+
changes: { before: normalizeDefinitionForComparison(definition) },
|
|
64
64
|
});
|
|
65
65
|
const generateFunctionPlan = async (context, state, functions) => {
|
|
66
66
|
if (!functions || functions.length === 0) {
|
|
@@ -95,18 +95,23 @@ const generateFunctionPlan = async (context, state, functions) => {
|
|
|
95
95
|
logicalId,
|
|
96
96
|
action: 'create',
|
|
97
97
|
resourceType: 'ALIYUN_FC3',
|
|
98
|
-
changes: {
|
|
98
|
+
changes: {
|
|
99
|
+
before: normalizeDefinitionForComparison(currentState.definition),
|
|
100
|
+
after: normalizeDefinitionForComparison(desiredDefinition),
|
|
101
|
+
},
|
|
99
102
|
drifted: true,
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
105
|
const currentDefinition = currentState.definition || {};
|
|
103
|
-
const
|
|
106
|
+
const normalizedCurrent = normalizeDefinitionForComparison(currentDefinition);
|
|
107
|
+
const normalizedDesired = normalizeDefinitionForComparison(desiredDefinition);
|
|
108
|
+
const definitionChanged = !(0, common_1.attributesEqual)(normalizedCurrent, normalizedDesired);
|
|
104
109
|
if (definitionChanged) {
|
|
105
110
|
return {
|
|
106
111
|
logicalId,
|
|
107
112
|
action: 'update',
|
|
108
113
|
resourceType: 'ALIYUN_FC3',
|
|
109
|
-
changes: { before:
|
|
114
|
+
changes: { before: normalizedCurrent, after: normalizedDesired },
|
|
110
115
|
drifted: true,
|
|
111
116
|
};
|
|
112
117
|
}
|
|
@@ -117,7 +122,10 @@ const generateFunctionPlan = async (context, state, functions) => {
|
|
|
117
122
|
logicalId,
|
|
118
123
|
action: 'create',
|
|
119
124
|
resourceType: 'ALIYUN_FC3',
|
|
120
|
-
changes: {
|
|
125
|
+
changes: {
|
|
126
|
+
before: normalizeDefinitionForComparison(currentState.definition),
|
|
127
|
+
after: normalizeDefinitionForComparison(desiredDefinition),
|
|
128
|
+
},
|
|
121
129
|
};
|
|
122
130
|
}
|
|
123
131
|
}));
|
|
@@ -579,9 +579,24 @@ const updateResource = async (context, fn, state) => {
|
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
581
|
const codePath = fn.code.path;
|
|
582
|
-
|
|
583
|
-
const
|
|
584
|
-
|
|
582
|
+
const currentCodeHash = existingState?.definition?.codeHash;
|
|
583
|
+
const desiredCodeHash = (0, common_1.computeFileHash)(codePath);
|
|
584
|
+
const codeChanged = currentCodeHash !== desiredCodeHash;
|
|
585
|
+
const existingConfig = existingState?.definition;
|
|
586
|
+
const desiredDefinition = (0, fc3Types_1.extractFc3Definition)(config, desiredCodeHash);
|
|
587
|
+
const { codeHash: _existingCodeHash, ...existingConfigOnly } = existingConfig || {};
|
|
588
|
+
const { codeHash: _desiredCodeHash, ...desiredConfigOnly } = desiredDefinition;
|
|
589
|
+
const configChanged = !(0, common_1.attributesEqual)(existingConfigOnly, desiredConfigOnly);
|
|
590
|
+
if (configChanged) {
|
|
591
|
+
await client.fc3.updateFunctionConfiguration(config);
|
|
592
|
+
}
|
|
593
|
+
if (codeChanged) {
|
|
594
|
+
const ossCode = await ensureOssCodeUpload(client, codePath, context.region, fn.name);
|
|
595
|
+
await client.fc3.updateFunctionCode(fn.name, codePath, ossCode);
|
|
596
|
+
}
|
|
597
|
+
if (!configChanged && !codeChanged) {
|
|
598
|
+
logger_1.logger.warn(lang_1.lang.__('UPDATING_RESOURCE_WITH_NO_CHANGES', { resourceType: 'function', name: fn.name }));
|
|
599
|
+
}
|
|
585
600
|
const functionInfo = await client.fc3.getFunction(fn.name);
|
|
586
601
|
if (!functionInfo) {
|
|
587
602
|
throw new Error(`Failed to refresh state for function: ${fn.name}`);
|
|
@@ -13,8 +13,12 @@ const planBucketDeletion = (logicalId, definition) => ({
|
|
|
13
13
|
logicalId,
|
|
14
14
|
action: 'delete',
|
|
15
15
|
resourceType: 'ALIYUN_OSS_BUCKET',
|
|
16
|
-
changes: { before: definition },
|
|
16
|
+
changes: { before: normalizeDefinitionForDisplay(definition) },
|
|
17
17
|
});
|
|
18
|
+
const normalizeDefinitionForDisplay = (definition) => {
|
|
19
|
+
const { domainBound: _domainBound, ...rest } = definition;
|
|
20
|
+
return rest;
|
|
21
|
+
};
|
|
18
22
|
const generateBucketPlan = async (context, state, buckets) => {
|
|
19
23
|
if (!buckets || buckets.length === 0) {
|
|
20
24
|
const allStates = (0, stateManager_1.getAllResources)(state);
|
|
@@ -55,20 +59,25 @@ const generateBucketPlan = async (context, state, buckets) => {
|
|
|
55
59
|
logicalId,
|
|
56
60
|
action: 'create',
|
|
57
61
|
resourceType: 'ALIYUN_OSS_BUCKET',
|
|
58
|
-
changes: {
|
|
62
|
+
changes: {
|
|
63
|
+
before: normalizeDefinitionForDisplay(currentState.definition),
|
|
64
|
+
after: desiredDefinition,
|
|
65
|
+
},
|
|
59
66
|
drifted: true,
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
69
|
const currentDefinition = currentState.definition || {};
|
|
63
|
-
const
|
|
64
|
-
const
|
|
70
|
+
const normalizedCurrent = normalizeDefinitionForDisplay(currentDefinition);
|
|
71
|
+
const normalizedDesired = normalizeDefinitionForDisplay(desiredDefinition);
|
|
72
|
+
const { domainBound } = currentDefinition;
|
|
73
|
+
const definitionChanged = !(0, hashUtils_1.attributesEqual)(normalizedCurrent, normalizedDesired);
|
|
65
74
|
const domainBindingPending = domainBound === false;
|
|
66
75
|
if (definitionChanged || domainBindingPending) {
|
|
67
76
|
return {
|
|
68
77
|
logicalId,
|
|
69
78
|
action: 'update',
|
|
70
79
|
resourceType: 'ALIYUN_OSS_BUCKET',
|
|
71
|
-
changes: { before:
|
|
80
|
+
changes: { before: normalizedCurrent, after: normalizedDesired },
|
|
72
81
|
...(definitionChanged ? { drifted: true } : {}),
|
|
73
82
|
};
|
|
74
83
|
}
|
|
@@ -79,7 +88,10 @@ const generateBucketPlan = async (context, state, buckets) => {
|
|
|
79
88
|
logicalId,
|
|
80
89
|
action: 'create',
|
|
81
90
|
resourceType: 'ALIYUN_OSS_BUCKET',
|
|
82
|
-
changes: {
|
|
91
|
+
changes: {
|
|
92
|
+
before: normalizeDefinitionForDisplay(currentState.definition),
|
|
93
|
+
after: desiredDefinition,
|
|
94
|
+
},
|
|
83
95
|
};
|
|
84
96
|
}
|
|
85
97
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
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",
|