@geek-fun/serverlessinsight 0.6.6 → 0.6.7

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.6",
3
+ "version": "0.6.7",
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",
@@ -46,14 +46,16 @@ const generateBucketPlan = async (context, state, buckets) => {
46
46
  };
47
47
  }
48
48
  const currentDefinition = currentState.definition || {};
49
- const definitionChanged = !(0, hashUtils_1.attributesEqual)(currentDefinition, desiredDefinition);
50
- if (definitionChanged) {
49
+ const { domainBound, ...comparableDefinition } = currentDefinition;
50
+ const definitionChanged = !(0, hashUtils_1.attributesEqual)(comparableDefinition, desiredDefinition);
51
+ const domainBindingPending = domainBound === false;
52
+ if (definitionChanged || domainBindingPending) {
51
53
  return {
52
54
  logicalId,
53
55
  action: 'update',
54
56
  resourceType: 'ALIYUN_OSS_BUCKET',
55
57
  changes: { before: currentDefinition, after: desiredDefinition },
56
- drifted: true,
58
+ ...(definitionChanged ? { drifted: true } : {}),
57
59
  };
58
60
  }
59
61
  return { logicalId, action: 'noop', resourceType: 'ALIYUN_OSS_BUCKET' };
@@ -132,14 +132,16 @@ const createBucketResource = async (context, bucket, state) => {
132
132
  if (!bucketInfo) {
133
133
  throw new Error(`Failed to refresh state for bucket: ${config.bucketName}`);
134
134
  }
135
- const definition = (0, ossTypes_1.extractOssBucketDefinition)(config);
136
135
  const sid = (0, common_1.buildSid)('aliyun', 'oss', context.stage, config.bucketName);
137
136
  const logicalId = `buckets.${bucket.key}`;
138
137
  const instances = [buildOssInstanceFromProvider(bucketInfo, sid)];
139
138
  const partialResourceState = {
140
139
  mode: 'managed',
141
140
  region: context.region,
142
- definition,
141
+ definition: {
142
+ ...(0, ossTypes_1.extractOssBucketDefinition)(config),
143
+ ...(bucket.website?.domain != null ? { domainBound: null } : {}),
144
+ },
143
145
  instances,
144
146
  lastUpdated: new Date().toISOString(),
145
147
  };
@@ -196,7 +198,12 @@ const createBucketResource = async (context, bucket, state) => {
196
198
  const finalResourceState = {
197
199
  mode: 'managed',
198
200
  region: context.region,
199
- definition,
201
+ definition: {
202
+ ...(0, ossTypes_1.extractOssBucketDefinition)(config),
203
+ ...(bucket.website?.domain != null
204
+ ? { domainBound: cnameInfo?.bucketCnameBound ?? null }
205
+ : {}),
206
+ },
200
207
  instances,
201
208
  lastUpdated: new Date().toISOString(),
202
209
  };
@@ -225,12 +232,12 @@ const updateBucketResource = async (context, bucket, state) => {
225
232
  if (!bucketInfo) {
226
233
  throw new Error(`Failed to refresh state for bucket: ${config.bucketName}`);
227
234
  }
228
- const definition = (0, ossTypes_1.extractOssBucketDefinition)(config);
229
235
  const sid = (0, common_1.buildSid)('aliyun', 'oss', context.stage, config.bucketName);
230
236
  const logicalId = `buckets.${bucket.key}`;
231
237
  const instances = [buildOssInstanceFromProvider(bucketInfo, sid)];
232
238
  const existingState = state.resources[logicalId];
233
239
  const existingDnsInstance = existingState?.instances?.find((i) => i.type === types_1.ResourceTypeEnum.ALIYUN_OSS_DNS_CNAME);
240
+ let cnameInfo;
234
241
  if (bucket.website?.domain) {
235
242
  const domainChanged = existingDnsInstance?.domain !== bucket.website.domain;
236
243
  if (domainChanged && existingDnsInstance) {
@@ -247,7 +254,7 @@ const updateBucketResource = async (context, bucket, state) => {
247
254
  bucketName: config.bucketName,
248
255
  }));
249
256
  }
250
- const cnameInfo = await client.oss.bindCustomDomain(config.bucketName, bucket.website.domain, certificate);
257
+ cnameInfo = await client.oss.bindCustomDomain(config.bucketName, bucket.website.domain, certificate);
251
258
  if (cnameInfo) {
252
259
  const instanceId = cnameInfo.dnsRecordId ?? bucket.website.domain;
253
260
  const dnsInstance = {
@@ -273,7 +280,12 @@ const updateBucketResource = async (context, bucket, state) => {
273
280
  const resourceState = {
274
281
  mode: 'managed',
275
282
  region: context.region,
276
- definition,
283
+ definition: {
284
+ ...(0, ossTypes_1.extractOssBucketDefinition)(config),
285
+ ...(bucket.website?.domain != null
286
+ ? { domainBound: cnameInfo?.bucketCnameBound ?? null }
287
+ : {}),
288
+ },
277
289
  instances,
278
290
  lastUpdated: new Date().toISOString(),
279
291
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
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",