@geek-fun/serverlessinsight 0.8.3 → 0.8.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.
Files changed (39) hide show
  1. package/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +3 -2
  2. package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +21 -2
  3. package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +44 -33
  4. package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +3 -2
  5. package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +63 -23
  6. package/dist/package.json +3 -2
  7. package/dist/src/common/aliyunClient/apigwOperations.js +36 -0
  8. package/dist/src/common/aliyunClient/slsOperations.js +34 -2
  9. package/dist/src/common/constants.js +5 -1
  10. package/dist/src/common/stateBackend/remoteStateBackend.js +4 -1
  11. package/dist/src/common/stateManager.js +52 -2
  12. package/dist/src/common/tencentClient/clsOperations.js +137 -0
  13. package/dist/src/common/tencentClient/index.js +21 -1
  14. package/dist/src/common/tencentClient/scfOperations.js +11 -0
  15. package/dist/src/common/volcengineClient/iamOperations.js +33 -0
  16. package/dist/src/common/volcengineClient/tlsOperations.js +84 -1
  17. package/dist/src/lang/en.js +23 -1
  18. package/dist/src/lang/zh-CN.js +23 -1
  19. package/dist/src/stack/aliyunStack/apigwPlanner.js +2 -0
  20. package/dist/src/stack/aliyunStack/apigwResource.js +118 -1
  21. package/dist/src/stack/aliyunStack/apigwTypes.js +19 -1
  22. package/dist/src/stack/aliyunStack/destroyer.js +25 -0
  23. package/dist/src/stack/aliyunStack/fc3Resource.js +91 -32
  24. package/dist/src/stack/aliyunStack/sharedLogProject.js +137 -0
  25. package/dist/src/stack/ownershipTag.js +19 -1
  26. package/dist/src/stack/scfStack/destroyer.js +13 -0
  27. package/dist/src/stack/scfStack/scfPlanner.js +9 -1
  28. package/dist/src/stack/scfStack/scfResource.js +205 -13
  29. package/dist/src/stack/scfStack/scfTypes.js +6 -0
  30. package/dist/src/stack/scfStack/sharedLogset.js +126 -0
  31. package/dist/src/stack/volcengineStack/apigwResource.js +64 -48
  32. package/dist/src/stack/volcengineStack/apigwTypes.js +9 -0
  33. package/dist/src/stack/volcengineStack/destroyer.js +12 -0
  34. package/dist/src/stack/volcengineStack/sharedLogProject.js +190 -0
  35. package/dist/src/stack/volcengineStack/vefaasPlanner.js +20 -13
  36. package/dist/src/stack/volcengineStack/vefaasResource.js +76 -76
  37. package/dist/src/types/domains/state.js +3 -0
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +3 -2
@@ -5,10 +5,11 @@
5
5
  "service": "cdn-flow-service",
6
6
  "stages": {
7
7
  "dev": {
8
- "resources": {}
8
+ "resources": {},
9
+ "shared": {}
9
10
  }
10
11
  },
11
12
  "resources": {},
12
- "lineage": "4c74973e-ab73-4db8-854b-503f98ad8c62",
13
+ "lineage": "4beff987-b7a0-44d6-a02a-eee189eccd05",
13
14
  "serial": 5
14
15
  }
@@ -5,10 +5,29 @@
5
5
  "service": "iam-test-service",
6
6
  "stages": {
7
7
  "dev": {
8
- "resources": {}
8
+ "resources": {},
9
+ "shared": {
10
+ "logs.project": {
11
+ "mode": "managed",
12
+ "region": "cn-hangzhou",
13
+ "definition": {
14
+ "projectName": "iam-test-app-dev-sls",
15
+ "region": "cn-hangzhou",
16
+ "stage": "dev"
17
+ },
18
+ "instances": [
19
+ {
20
+ "sid": "si:aliyun:sls_project:dev:iam-test-app-dev-sls",
21
+ "type": "ALIYUN_SLS_PROJECT",
22
+ "id": "iam-test-app-dev-sls"
23
+ }
24
+ ],
25
+ "lastUpdated": "2026-08-27T03:52:07.150Z"
26
+ }
27
+ }
9
28
  }
10
29
  },
11
30
  "resources": {},
12
- "lineage": "d0400fb2-7715-4a08-b13e-f8caa3a934ce",
31
+ "lineage": "f59147b2-cb79-4655-af4d-b74afc5d85aa",
13
32
  "serial": 3
14
33
  }
@@ -26,8 +26,8 @@
26
26
  "customContainerConfig": null,
27
27
  "nasConfig": null,
28
28
  "logConfig": {
29
- "project": "insight-poc-deploy-app-insight-poc-deploy-dev-sls",
30
- "logstore": "insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
29
+ "project": "insight-poc-deploy-app-dev-sls",
30
+ "logstore": "insight-poc-deploy-dev-fn-logs",
31
31
  "enableRequestMetrics": true,
32
32
  "enableInstanceMetrics": true
33
33
  },
@@ -68,21 +68,17 @@
68
68
  "lastUpdateStatusReasonCode": null
69
69
  },
70
70
  {
71
- "sid": "si:aliyun:sls_project:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls",
72
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls",
73
- "type": "ALIYUN_SLS_PROJECT",
74
- "projectName": "test-project"
75
- },
76
- {
77
- "sid": "si:aliyun:sls_logstore:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
78
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
71
+ "sid": "si:aliyun:sls_logstore:dev:insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs",
72
+ "id": "insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs",
79
73
  "type": "ALIYUN_SLS_LOGSTORE",
80
- "logstoreName": "test-logstore"
74
+ "logstoreName": "insight-poc-deploy-dev-fn-logs"
81
75
  },
82
76
  {
83
- "sid": "si:aliyun:sls_index:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore/index",
84
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore/index",
85
- "type": "ALIYUN_SLS_INDEX"
77
+ "sid": "si:aliyun:sls_index:dev:insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs/index",
78
+ "id": "insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs/index",
79
+ "type": "ALIYUN_SLS_INDEX",
80
+ "projectName": "insight-poc-deploy-app-dev-sls",
81
+ "logstoreName": "insight-poc-deploy-dev-fn-logs"
86
82
  },
87
83
  {
88
84
  "sid": "si:aliyun:ram_role:dev:insight-poc-deploy-app-insight-poc-deploy-dev-fc-role",
@@ -95,7 +91,7 @@
95
91
  }
96
92
  }
97
93
  ],
98
- "lastUpdated": "2026-08-26T03:31:16.209Z",
94
+ "lastUpdated": "2026-08-27T03:52:42.221Z",
99
95
  "status": "ready"
100
96
  },
101
97
  "events.gateway_event": {
@@ -170,7 +166,26 @@
170
166
  "stageName": "RELEASE"
171
167
  }
172
168
  ],
173
- "lastUpdated": "2026-08-26T03:31:16.211Z"
169
+ "lastUpdated": "2026-08-27T03:52:42.274Z"
170
+ }
171
+ },
172
+ "shared": {
173
+ "logs.project": {
174
+ "mode": "managed",
175
+ "region": "cn-hangzhou",
176
+ "definition": {
177
+ "projectName": "insight-poc-deploy-app-dev-sls",
178
+ "region": "cn-hangzhou",
179
+ "stage": "dev"
180
+ },
181
+ "instances": [
182
+ {
183
+ "sid": "si:aliyun:sls_project:dev:insight-poc-deploy-app-dev-sls",
184
+ "type": "ALIYUN_SLS_PROJECT",
185
+ "id": "insight-poc-deploy-app-dev-sls"
186
+ }
187
+ ],
188
+ "lastUpdated": "2026-08-27T03:52:37.219Z"
174
189
  }
175
190
  }
176
191
  }
@@ -196,8 +211,8 @@
196
211
  "customContainerConfig": null,
197
212
  "nasConfig": null,
198
213
  "logConfig": {
199
- "project": "insight-poc-deploy-app-insight-poc-deploy-dev-sls",
200
- "logstore": "insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
214
+ "project": "insight-poc-deploy-app-dev-sls",
215
+ "logstore": "insight-poc-deploy-dev-fn-logs",
201
216
  "enableRequestMetrics": true,
202
217
  "enableInstanceMetrics": true
203
218
  },
@@ -238,21 +253,17 @@
238
253
  "lastUpdateStatusReasonCode": null
239
254
  },
240
255
  {
241
- "sid": "si:aliyun:sls_project:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls",
242
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls",
243
- "type": "ALIYUN_SLS_PROJECT",
244
- "projectName": "test-project"
245
- },
246
- {
247
- "sid": "si:aliyun:sls_logstore:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
248
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore",
256
+ "sid": "si:aliyun:sls_logstore:dev:insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs",
257
+ "id": "insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs",
249
258
  "type": "ALIYUN_SLS_LOGSTORE",
250
- "logstoreName": "test-logstore"
259
+ "logstoreName": "insight-poc-deploy-dev-fn-logs"
251
260
  },
252
261
  {
253
- "sid": "si:aliyun:sls_index:dev:insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore/index",
254
- "id": "insight-poc-deploy-app-insight-poc-deploy-dev-sls/insight-poc-deploy-app-insight-poc-deploy-dev-sls-logstore/index",
255
- "type": "ALIYUN_SLS_INDEX"
262
+ "sid": "si:aliyun:sls_index:dev:insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs/index",
263
+ "id": "insight-poc-deploy-app-dev-sls/insight-poc-deploy-dev-fn-logs/index",
264
+ "type": "ALIYUN_SLS_INDEX",
265
+ "projectName": "insight-poc-deploy-app-dev-sls",
266
+ "logstoreName": "insight-poc-deploy-dev-fn-logs"
256
267
  },
257
268
  {
258
269
  "sid": "si:aliyun:ram_role:dev:insight-poc-deploy-app-insight-poc-deploy-dev-fc-role",
@@ -265,7 +276,7 @@
265
276
  }
266
277
  }
267
278
  ],
268
- "lastUpdated": "2026-08-26T03:31:16.209Z",
279
+ "lastUpdated": "2026-08-27T03:52:42.221Z",
269
280
  "status": "ready"
270
281
  },
271
282
  "events.gateway_event": {
@@ -340,9 +351,9 @@
340
351
  "stageName": "RELEASE"
341
352
  }
342
353
  ],
343
- "lastUpdated": "2026-08-26T03:31:16.211Z"
354
+ "lastUpdated": "2026-08-27T03:52:42.274Z"
344
355
  }
345
356
  },
346
- "lineage": "1b805eed-b101-473c-9698-9ff65fcd8482",
357
+ "lineage": "62d671af-1c11-4edd-947b-191e37fa17c4",
347
358
  "serial": 2
348
359
  }
@@ -5,10 +5,11 @@
5
5
  "service": "insight-poc-destroy",
6
6
  "stages": {
7
7
  "dev": {
8
- "resources": {}
8
+ "resources": {},
9
+ "shared": {}
9
10
  }
10
11
  },
11
12
  "resources": {},
12
- "lineage": "c6b9260f-9c70-430d-b2f9-bea4dfd8248d",
13
+ "lineage": "cbf27939-33fe-46ed-8e84-31391e505fc7",
13
14
  "serial": 1
14
15
  }
@@ -19,14 +19,18 @@
19
19
  "NODE_ENV": "production"
20
20
  },
21
21
  "codeHash": "c96b718fa999add5e047823c3d7abfa1397fa8d0075bc6a4f3592785fcd4b76f",
22
- "role": "trn:iam::123456789012:role/test-role"
22
+ "role": "trn:iam::123456789012:role/test-role",
23
+ "logConfig": {
24
+ "project": "insight-volc-app-dev-tls",
25
+ "topic": "insight-volc-dev-fn-logs"
26
+ }
23
27
  },
24
28
  "instances": [
25
29
  {
26
30
  "type": "VOLCENGINE_VEFAAS_FUNCTION",
27
31
  "sid": "si:volcengine:insight-volc:dev:insight-poc-fn",
28
- "id": "insight-poc-fn",
29
- "functionName": "insight-poc-fn",
32
+ "id": "test-function",
33
+ "functionName": "test-function",
30
34
  "functionId": "func-123",
31
35
  "runtime": "node20/v1",
32
36
  "handler": "index.handler",
@@ -35,13 +39,19 @@
35
39
  "environment": {},
36
40
  "status": "Active",
37
41
  "createdTime": null,
38
- "lastUpdateTime": null,
39
- "Tags": [
40
- {
41
- "Key": "si-owned-by",
42
- "Value": "insight-volc-app-insight-volc:functions.insight_poc_fn"
43
- }
44
- ]
42
+ "lastUpdateTime": null
43
+ },
44
+ {
45
+ "sid": "si:volcengine:tls_topic:dev:insight-volc-app-dev-tls/insight-volc-dev-fn-logs",
46
+ "id": "insight-volc-app-dev-tls/insight-volc-dev-fn-logs",
47
+ "type": "VOLCENGINE_TLS_TOPIC",
48
+ "topicName": "insight-volc-dev-fn-logs",
49
+ "topicId": "topic-123"
50
+ },
51
+ {
52
+ "sid": "si:volcengine:tls_index:dev:insight-volc-app-dev-tls/insight-volc-dev-fn-logs/index",
53
+ "id": "insight-volc-app-dev-tls/insight-volc-dev-fn-logs/index",
54
+ "type": "VOLCENGINE_TLS_INDEX"
45
55
  },
46
56
  {
47
57
  "sid": "si:volcengine:iam_role:dev:insight-volc-app-insight-volc-dev-role",
@@ -53,7 +63,27 @@
53
63
  }
54
64
  ],
55
65
  "status": "ready",
56
- "lastUpdated": "2026-08-26T03:31:09.017Z"
66
+ "lastUpdated": "2026-08-27T03:52:21.091Z"
67
+ }
68
+ },
69
+ "shared": {
70
+ "logs.project": {
71
+ "mode": "managed",
72
+ "region": "cn-beijing",
73
+ "definition": {
74
+ "projectName": "insight-volc-app-dev-tls",
75
+ "region": "cn-beijing",
76
+ "stage": "dev"
77
+ },
78
+ "instances": [
79
+ {
80
+ "sid": "si:volcengine:tls:dev:insight-volc-app-dev-tls",
81
+ "type": "VOLCENGINE_TLS_PROJECT",
82
+ "id": "insight-volc-app-dev-tls",
83
+ "projectId": "proj-123"
84
+ }
85
+ ],
86
+ "lastUpdated": "2026-08-27T03:52:18.089Z"
57
87
  }
58
88
  }
59
89
  }
@@ -72,14 +102,18 @@
72
102
  "NODE_ENV": "production"
73
103
  },
74
104
  "codeHash": "c96b718fa999add5e047823c3d7abfa1397fa8d0075bc6a4f3592785fcd4b76f",
75
- "role": "trn:iam::123456789012:role/test-role"
105
+ "role": "trn:iam::123456789012:role/test-role",
106
+ "logConfig": {
107
+ "project": "insight-volc-app-dev-tls",
108
+ "topic": "insight-volc-dev-fn-logs"
109
+ }
76
110
  },
77
111
  "instances": [
78
112
  {
79
113
  "type": "VOLCENGINE_VEFAAS_FUNCTION",
80
114
  "sid": "si:volcengine:insight-volc:dev:insight-poc-fn",
81
- "id": "insight-poc-fn",
82
- "functionName": "insight-poc-fn",
115
+ "id": "test-function",
116
+ "functionName": "test-function",
83
117
  "functionId": "func-123",
84
118
  "runtime": "node20/v1",
85
119
  "handler": "index.handler",
@@ -88,13 +122,19 @@
88
122
  "environment": {},
89
123
  "status": "Active",
90
124
  "createdTime": null,
91
- "lastUpdateTime": null,
92
- "Tags": [
93
- {
94
- "Key": "si-owned-by",
95
- "Value": "insight-volc-app-insight-volc:functions.insight_poc_fn"
96
- }
97
- ]
125
+ "lastUpdateTime": null
126
+ },
127
+ {
128
+ "sid": "si:volcengine:tls_topic:dev:insight-volc-app-dev-tls/insight-volc-dev-fn-logs",
129
+ "id": "insight-volc-app-dev-tls/insight-volc-dev-fn-logs",
130
+ "type": "VOLCENGINE_TLS_TOPIC",
131
+ "topicName": "insight-volc-dev-fn-logs",
132
+ "topicId": "topic-123"
133
+ },
134
+ {
135
+ "sid": "si:volcengine:tls_index:dev:insight-volc-app-dev-tls/insight-volc-dev-fn-logs/index",
136
+ "id": "insight-volc-app-dev-tls/insight-volc-dev-fn-logs/index",
137
+ "type": "VOLCENGINE_TLS_INDEX"
98
138
  },
99
139
  {
100
140
  "sid": "si:volcengine:iam_role:dev:insight-volc-app-insight-volc-dev-role",
@@ -106,9 +146,9 @@
106
146
  }
107
147
  ],
108
148
  "status": "ready",
109
- "lastUpdated": "2026-08-26T03:31:09.017Z"
149
+ "lastUpdated": "2026-08-27T03:52:21.091Z"
110
150
  }
111
151
  },
112
- "lineage": "8a806e94-68b6-4524-a28f-e2511c2e8a74",
152
+ "lineage": "34d922b2-a366-4262-a127-4b7addf54d12",
113
153
  "serial": 1
114
154
  }
package/dist/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
- "homepage": "https://serverlessinsight.geekfun.club",
5
+ "homepage": "https://serverlessinsight.com",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
8
8
  "bin": {
@@ -81,6 +81,7 @@
81
81
  "pino-pretty": "^13.1.3",
82
82
  "tablestore": "^5.6.5",
83
83
  "tencentcloud-sdk-nodejs-cam": "^4.1.265",
84
+ "tencentcloud-sdk-nodejs-cls": "^4.1.302",
84
85
  "tencentcloud-sdk-nodejs-cynosdb": "^4.1.265",
85
86
  "tencentcloud-sdk-nodejs-dnspod": "^4.1.265",
86
87
  "tencentcloud-sdk-nodejs-es": "^4.1.263",
@@ -1112,6 +1112,42 @@ const createApigwOperations = (apigwClient, dnsClient, _context) => {
1112
1112
  throw error;
1113
1113
  }
1114
1114
  },
1115
+ /**
1116
+ * Describe the region-wide PROVIDER gateway log configuration (createLogConfig
1117
+ * is a regional singleton: one PROVIDER config per region, not per group).
1118
+ * Returns null when no PROVIDER config exists.
1119
+ */
1120
+ describeGatewayLogConfig: async () => {
1121
+ const request = new cloudapi.DescribeLogConfigRequest({
1122
+ logType: 'PROVIDER',
1123
+ });
1124
+ const response = await apigwClient.describeLogConfig(request);
1125
+ const logInfos = response.body?.logInfos?.logInfo ?? [];
1126
+ const provider = logInfos.find((info) => info.logType === 'PROVIDER');
1127
+ if (!provider) {
1128
+ return null;
1129
+ }
1130
+ return {
1131
+ logType: provider.logType,
1132
+ regionId: provider.regionId,
1133
+ slsProject: provider.slsProject,
1134
+ slsLogStore: provider.slsLogStore,
1135
+ };
1136
+ },
1137
+ /**
1138
+ * Create the region-wide PROVIDER gateway log configuration. Intentionally no
1139
+ * modify/delete wrappers: a foreign PROVIDER config must never be mutated or
1140
+ * removed by ServerlessInsight — higher-level code decides via describe.
1141
+ */
1142
+ createGatewayLogConfig: async (config) => {
1143
+ const request = new cloudapi.CreateLogConfigRequest({
1144
+ logType: 'PROVIDER',
1145
+ slsProject: config.slsProject,
1146
+ slsLogStore: config.slsLogStore,
1147
+ createSlr: true,
1148
+ });
1149
+ await apigwClient.createLogConfig(request);
1150
+ },
1115
1151
  };
1116
1152
  return operations;
1117
1153
  };
@@ -138,7 +138,18 @@ const createSlsOperations = (slsClient) => {
138
138
  const request = new sls.DeleteProjectRequest({});
139
139
  await slsClient.deleteProject(projectName, request);
140
140
  },
141
- createLogstore: async (projectName, logstoreName, ttl = 7) => {
141
+ getProjectTags: async (projectName) => {
142
+ const request = new sls.ListTagResourcesRequest({
143
+ resourceId: [projectName],
144
+ resourceType: 'project',
145
+ });
146
+ const response = await slsClient.listTagResources(request);
147
+ return (response.body?.tagResources ?? []).map((tagResource) => ({
148
+ key: tagResource.tagKey ?? '',
149
+ value: tagResource.tagValue ?? '',
150
+ }));
151
+ },
152
+ createLogstore: async (projectName, logstoreName, ttl = 30) => {
142
153
  const request = new sls.CreateLogStoreRequest({
143
154
  logstoreName,
144
155
  ttl,
@@ -176,6 +187,11 @@ const createSlsOperations = (slsClient) => {
176
187
  deleteLogstore: async (projectName, logstoreName) => {
177
188
  await slsClient.deleteLogStore(projectName, logstoreName);
178
189
  },
190
+ listLogStores: async (projectName) => {
191
+ const request = new sls.ListLogStoresRequest({ size: 500 });
192
+ const response = await slsClient.listLogStores(projectName, request);
193
+ return response.body?.logstores ?? [];
194
+ },
179
195
  createIndex: async (projectName, logstoreName) => {
180
196
  const request = new sls.CreateIndexRequest({
181
197
  body: new sls.Index({
@@ -239,9 +255,25 @@ const createSlsOperations = (slsClient) => {
239
255
  waitForProject: async (projectName) => {
240
256
  return waitForSlsProject(operations.getProject, projectName);
241
257
  },
242
- waitForLogstore: async (projectName, logstoreName, ttl = 7) => {
258
+ waitForLogstore: async (projectName, logstoreName, ttl = 30) => {
243
259
  return waitForSlsLogstore(operations.getLogstore, projectName, logstoreName, ttl);
244
260
  },
261
+ addTags: async (config) => {
262
+ const request = new sls.TagResourcesRequest({
263
+ resourceId: [config.resourceId],
264
+ resourceType: config.resourceType,
265
+ tags: config.tags,
266
+ });
267
+ await slsClient.tagResources(request);
268
+ },
269
+ removeTags: async (config) => {
270
+ const request = new sls.UntagResourcesRequest({
271
+ resourceId: [config.resourceId],
272
+ resourceType: config.resourceType,
273
+ tags: config.tagKeys,
274
+ });
275
+ await slsClient.untagResources(request);
276
+ },
245
277
  };
246
278
  return operations;
247
279
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = 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;
3
+ exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = exports.CLS_TOPIC_POLL_INTERVAL_MS = exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = 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';
@@ -35,3 +35,7 @@ exports.RAM_ROLE_PROPAGATION_DELAY_MS = 5000; // 5 seconds
35
35
  // fail with "Status is Creating, unsupport operate" if issued too early)
36
36
  exports.SCF_STATUS_POLL_INTERVAL_MS = 3000; // 3 seconds
37
37
  exports.SCF_STATUS_POLL_MAX_ATTEMPTS = 20; // up to 60 seconds
38
+ // CLS topic visibility polling (CreateTopic is async — the topic is not
39
+ // queryable via DescribeTopics until the platform finishes provisioning)
40
+ exports.CLS_TOPIC_POLL_INTERVAL_MS = 3000; // 3 seconds
41
+ exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = 20; // up to 60 seconds
@@ -102,7 +102,10 @@ const createRemoteStateBackend = (adapter, config) => {
102
102
  provider: state.provider,
103
103
  stages: {
104
104
  ...existing.stages,
105
- [stage]: { resources: state.resources },
105
+ [stage]: {
106
+ resources: state.resources,
107
+ shared: state.stages?.[stage]?.shared ?? existing.stages?.[stage]?.shared ?? {},
108
+ },
106
109
  },
107
110
  resources: state.resources,
108
111
  };
@@ -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.getRoleArnFromState = exports.getAllResources = exports.removeResource = exports.setResource = exports.getResource = exports.saveStateWithLock = exports.saveState = exports.loadState = exports.migrateState = exports.clearStateMigrations = exports.registerStateMigration = exports.ensureStateDir = exports.getStatePath = void 0;
6
+ exports.getRoleArnFromState = exports.removeSharedResource = exports.setSharedResource = exports.getSharedResource = exports.getAllSharedResources = exports.getAllResources = exports.removeResource = exports.setResource = exports.getResource = exports.saveStateWithLock = exports.saveState = exports.loadState = exports.migrateState = exports.clearStateMigrations = exports.registerStateMigration = exports.ensureStateDir = exports.getStatePath = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_crypto_1 = __importDefault(require("node:crypto"));
@@ -172,7 +172,10 @@ const saveState = (state, app, service, stage, baseDir = process.cwd()) => {
172
172
  provider: state.provider,
173
173
  stages: {
174
174
  ...existing.stages,
175
- [stage]: { resources: state.resources },
175
+ [stage]: {
176
+ resources: state.resources,
177
+ shared: state.stages?.[stage]?.shared ?? existing.stages?.[stage]?.shared ?? {},
178
+ },
176
179
  },
177
180
  resources: state.resources,
178
181
  };
@@ -246,6 +249,53 @@ const getAllResources = (state) => {
246
249
  return state.resources;
247
250
  };
248
251
  exports.getAllResources = getAllResources;
252
+ /* istanbul ignore next */
253
+ const getAllSharedResources = (state, stage) => {
254
+ return state.stages?.[stage]?.shared ?? {};
255
+ };
256
+ exports.getAllSharedResources = getAllSharedResources;
257
+ /* istanbul ignore next */
258
+ const getSharedResource = (state, stage, key) => {
259
+ return state.stages?.[stage]?.shared?.[key];
260
+ };
261
+ exports.getSharedResource = getSharedResource;
262
+ /* istanbul ignore next */
263
+ const setSharedResource = (state, stage, key, resourceState) => {
264
+ return {
265
+ ...state,
266
+ stages: {
267
+ ...state.stages,
268
+ [stage]: {
269
+ ...state.stages?.[stage],
270
+ resources: state.stages?.[stage]?.resources ?? {},
271
+ shared: {
272
+ ...state.stages?.[stage]?.shared,
273
+ [key]: resourceState,
274
+ },
275
+ },
276
+ },
277
+ };
278
+ };
279
+ exports.setSharedResource = setSharedResource;
280
+ /* istanbul ignore next */
281
+ const removeSharedResource = (state, stage, key) => {
282
+ const existingShared = state.stages?.[stage]?.shared;
283
+ if (!existingShared) {
284
+ return state;
285
+ }
286
+ const { [key]: _removed, ...remainingShared } = existingShared;
287
+ return {
288
+ ...state,
289
+ stages: {
290
+ ...state.stages,
291
+ [stage]: {
292
+ ...state.stages[stage],
293
+ shared: remainingShared,
294
+ },
295
+ },
296
+ };
297
+ };
298
+ exports.removeSharedResource = removeSharedResource;
249
299
  /**
250
300
  * Extract role ARN from function state for event resources.
251
301
  * Looks through all function resources to find a RAM role instance and returns its ARN.