@geek-fun/serverlessinsight 0.9.7 → 0.9.8

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 (86) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +68 -6
  3. package/README.md +51 -10
  4. package/README.zh-CN.md +44 -10
  5. package/dist/package.json +2 -1
  6. package/dist/src/commands/deploy.js +3 -1
  7. package/dist/src/commands/destroy.js +3 -1
  8. package/dist/src/commands/forceUnlock.js +2 -2
  9. package/dist/src/commands/index.js +28 -8
  10. package/dist/src/commands/local.js +3 -2
  11. package/dist/src/commands/login.js +120 -37
  12. package/dist/src/commands/logout.js +3 -5
  13. package/dist/src/commands/migrate.js +17 -10
  14. package/dist/src/commands/plan.js +5 -1
  15. package/dist/src/commands/show.js +3 -1
  16. package/dist/src/commands/whoami.js +24 -6
  17. package/dist/src/common/aliyunClient/cdnOperations.js +64 -29
  18. package/dist/src/common/aliyunClient/dnsOperations.js +10 -0
  19. package/dist/src/common/aliyunClient/fc3Operations.js +36 -7
  20. package/dist/src/common/apiClient.js +1 -0
  21. package/dist/src/common/bindingReconcile.js +182 -0
  22. package/dist/src/common/cdnCapabilities.js +80 -0
  23. package/dist/src/common/certUtils.js +44 -5
  24. package/dist/src/common/consoleLines.js +126 -0
  25. package/dist/src/common/constants.js +4 -2
  26. package/dist/src/common/credentialStore.js +136 -39
  27. package/dist/src/common/domainUtils.js +23 -4
  28. package/dist/src/common/functionDefinition.js +4 -1
  29. package/dist/src/common/functionDomainCapabilities.js +28 -0
  30. package/dist/src/common/functionDomainReconcile.js +197 -0
  31. package/dist/src/common/lineContext.js +164 -0
  32. package/dist/src/common/planCapabilities.js +14 -27
  33. package/dist/src/common/planCompare.js +8 -7
  34. package/dist/src/common/planFormatter.js +71 -37
  35. package/dist/src/common/stateBackend/index.js +24 -16
  36. package/dist/src/common/stateBackend/saasStateBackend.js +46 -53
  37. package/dist/src/common/stateBackend/tosStateBackend.js +100 -0
  38. package/dist/src/common/tencentClient/cdnOperations.js +165 -0
  39. package/dist/src/common/tencentClient/cosOperations.js +18 -2
  40. package/dist/src/common/tencentClient/dnspodOperations.js +12 -0
  41. package/dist/src/common/tencentClient/index.js +16 -0
  42. package/dist/src/common/tencentClient/scfOperations.js +23 -1
  43. package/dist/src/common/tencentClient/sslOperations.js +147 -77
  44. package/dist/src/common/volcengineClient/cdnOperations.js +221 -0
  45. package/dist/src/common/volcengineClient/dnsOperations.js +132 -0
  46. package/dist/src/common/volcengineClient/index.js +28 -0
  47. package/dist/src/common/volcengineClient/tosOperations.js +131 -1
  48. package/dist/src/lang/en.js +89 -10
  49. package/dist/src/lang/zh-CN.js +90 -9
  50. package/dist/src/parser/bucketParser.js +22 -79
  51. package/dist/src/parser/functionParser.js +13 -9
  52. package/dist/src/stack/aliyunStack/apigwResource.js +2 -1
  53. package/dist/src/stack/aliyunStack/fc3Planner.js +32 -12
  54. package/dist/src/stack/aliyunStack/fc3Resource.js +169 -121
  55. package/dist/src/stack/aliyunStack/ossPlanner.js +12 -4
  56. package/dist/src/stack/aliyunStack/ossResource.js +484 -501
  57. package/dist/src/stack/aliyunStack/ossTypes.js +21 -67
  58. package/dist/src/stack/localStack/aliyunFc.js +59 -9
  59. package/dist/src/stack/localStack/bucket.js +75 -28
  60. package/dist/src/stack/localStack/event.js +33 -24
  61. package/dist/src/stack/localStack/httpAdapter.js +1 -13
  62. package/dist/src/stack/localStack/index.js +2 -2
  63. package/dist/src/stack/localStack/localServer.js +85 -7
  64. package/dist/src/stack/scfStack/cosPlanner.js +11 -3
  65. package/dist/src/stack/scfStack/cosResource.js +339 -161
  66. package/dist/src/stack/scfStack/cosTypes.js +25 -34
  67. package/dist/src/stack/scfStack/scfPlanner.js +26 -8
  68. package/dist/src/stack/scfStack/scfResource.js +191 -124
  69. package/dist/src/stack/volcengineStack/tosPlanner.js +13 -1
  70. package/dist/src/stack/volcengineStack/tosResource.js +398 -7
  71. package/dist/src/stack/volcengineStack/tosTypes.js +27 -0
  72. package/dist/src/stack/volcengineStack/vefaasTypes.js +1 -1
  73. package/dist/src/types/domains/state.js +6 -0
  74. package/dist/src/validator/bucketSchema.js +35 -113
  75. package/dist/src/validator/cdnSchema.js +30 -0
  76. package/dist/src/validator/eventSchema.js +2 -20
  77. package/dist/src/validator/functionSchema.js +55 -8
  78. package/dist/src/validator/rootSchema.js +3 -3
  79. package/dist/src/validator/semanticValidation.js +504 -1
  80. package/dist/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +2 -1
  82. package/release-notes.md +82 -6
  83. package/samples/aliyun-poc-api-cdn.yml +1 -1
  84. package/samples/aliyun-poc-bucket-cdn.yml +28 -26
  85. package/samples/aliyun-poc-domain.yml +2 -1
  86. package/samples/volcengine-poc-tos-state.yml +36 -0
@@ -2,123 +2,42 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bucketSchema = void 0;
4
4
  const templateRefSchema_1 = require("./templateRefSchema");
5
- const cdnSchema = {
5
+ const cdnSchema_1 = require("./cdnSchema");
6
+ // v1 (issue #279): bucket custom domains are declared as a `domains` list.
7
+ // The legacy top-level `domain`, `website.domain` and `www_bind_apex` fields
8
+ // were removed — legacy usage is rejected at schema validation and semantic
9
+ // validation reports a migration error (see validateSemantics). The
10
+ // never-consumed `protocol` field was removed with issue #283.
11
+ const bucketDomainBindingSchema = {
12
+ type: 'object',
13
+ properties: {
14
+ domain_name: (0, templateRefSchema_1.resolvableConstrained)({ pattern: templateRefSchema_1.HOST_NAME_PATTERN }),
15
+ certificate_id: { type: 'string' },
16
+ certificate_body: { type: 'string' },
17
+ certificate_private_key: { type: 'string' },
18
+ cdn: cdnSchema_1.cdnSchema,
19
+ },
20
+ required: ['domain_name'],
21
+ additionalProperties: false,
6
22
  oneOf: [
7
- { type: 'boolean' },
8
23
  {
9
- type: 'object',
10
- properties: {
11
- enabled: templateRefSchema_1.resolvableBoolean,
12
- cdn_type: { type: 'string', enum: ['web', 'download', 'video'] },
13
- scope: { type: 'string', enum: ['domestic', 'overseas', 'global'] },
14
- cache_ttl: { type: 'number' },
15
- ignore_query_string: templateRefSchema_1.resolvableBoolean,
16
- origin_protocol: { type: 'string', enum: ['http', 'https', 'follow'] },
17
- compression: templateRefSchema_1.resolvableBoolean,
18
- force_redirect_https: templateRefSchema_1.resolvableBoolean,
24
+ not: {
25
+ anyOf: [
26
+ { required: ['certificate_id'] },
27
+ { required: ['certificate_body'] },
28
+ { required: ['certificate_private_key'] },
29
+ ],
19
30
  },
20
- additionalProperties: false,
21
31
  },
22
- ],
23
- };
24
- const bucketDomainSchema = {
25
- oneOf: [
26
- { type: 'string' },
27
32
  {
28
- type: 'object',
29
- properties: {
30
- domain_name: (0, templateRefSchema_1.resolvableConstrained)({ pattern: templateRefSchema_1.HOST_NAME_PATTERN }),
31
- certificate_id: { type: 'string' },
32
- certificate_body: { type: 'string' },
33
- certificate_private_key: { type: 'string' },
34
- protocol: {
35
- oneOf: [
36
- { type: 'string', enum: ['HTTP', 'HTTPS'] },
37
- {
38
- type: 'array',
39
- items: { type: 'string', enum: ['HTTP', 'HTTPS'] },
40
- minItems: 1,
41
- uniqueItems: true,
42
- },
43
- ],
44
- },
45
- www_bind_apex: templateRefSchema_1.resolvableBoolean,
46
- cdn: cdnSchema,
47
- accelerate: templateRefSchema_1.resolvableBoolean,
48
- },
49
- required: ['domain_name'],
50
- additionalProperties: false,
51
- oneOf: [
52
- {
53
- not: {
54
- anyOf: [
55
- { required: ['certificate_id'] },
56
- { required: ['certificate_body'] },
57
- { required: ['certificate_private_key'] },
58
- ],
59
- },
60
- },
61
- {
62
- required: ['certificate_body', 'certificate_private_key'],
63
- not: { required: ['certificate_id'] },
64
- },
65
- {
66
- required: ['certificate_id'],
67
- not: {
68
- anyOf: [{ required: ['certificate_body'] }, { required: ['certificate_private_key'] }],
69
- },
70
- },
71
- ],
33
+ required: ['certificate_body', 'certificate_private_key'],
34
+ not: { required: ['certificate_id'] },
72
35
  },
73
- ],
74
- };
75
- const bucketWebsiteDomainSchema = {
76
- oneOf: [
77
- { type: 'string' },
78
36
  {
79
- type: 'object',
80
- properties: {
81
- domain_name: (0, templateRefSchema_1.resolvableConstrained)({ pattern: templateRefSchema_1.HOST_NAME_PATTERN }),
82
- certificate_id: { type: 'string' },
83
- certificate_body: { type: 'string' },
84
- certificate_private_key: { type: 'string' },
85
- protocol: {
86
- oneOf: [
87
- { type: 'string', enum: ['HTTP', 'HTTPS'] },
88
- {
89
- type: 'array',
90
- items: { type: 'string', enum: ['HTTP', 'HTTPS'] },
91
- minItems: 1,
92
- uniqueItems: true,
93
- },
94
- ],
95
- },
96
- www_bind_apex: templateRefSchema_1.resolvableBoolean,
97
- cdn: cdnSchema,
37
+ required: ['certificate_id'],
38
+ not: {
39
+ anyOf: [{ required: ['certificate_body'] }, { required: ['certificate_private_key'] }],
98
40
  },
99
- required: ['domain_name'],
100
- additionalProperties: false,
101
- oneOf: [
102
- {
103
- not: {
104
- anyOf: [
105
- { required: ['certificate_id'] },
106
- { required: ['certificate_body'] },
107
- { required: ['certificate_private_key'] },
108
- ],
109
- },
110
- },
111
- {
112
- required: ['certificate_body', 'certificate_private_key'],
113
- not: { required: ['certificate_id'] },
114
- },
115
- {
116
- required: ['certificate_id'],
117
- not: {
118
- anyOf: [{ required: ['certificate_body'] }, { required: ['certificate_private_key'] }],
119
- },
120
- },
121
- ],
122
41
  },
123
42
  ],
124
43
  };
@@ -208,16 +127,19 @@ exports.bucketSchema = {
208
127
  },
209
128
  additionalProperties: false,
210
129
  },
211
- // Canonical domain config (top-level)
212
- domain: bucketDomainSchema,
130
+ // Bucket-level transfer acceleration (all providers model it per bucket).
131
+ accelerate: templateRefSchema_1.resolvableBoolean,
132
+ // The only accepted custom-domain form since v1 (issue #279).
133
+ domains: {
134
+ type: 'array',
135
+ items: bucketDomainBindingSchema,
136
+ },
213
137
  website: {
214
138
  type: 'object',
215
139
  properties: {
216
140
  code: {
217
141
  type: 'string',
218
142
  },
219
- // Deprecated: Use top-level `domain` instead
220
- domain: bucketWebsiteDomainSchema,
221
143
  index: {
222
144
  type: 'string',
223
145
  },
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cdnSchema = exports.CDN_SCOPE_VALUES = exports.CDN_TYPE_VALUES = void 0;
4
+ const templateRefSchema_1 = require("./templateRefSchema");
5
+ // Shared per-binding CDN schema for bucket and event domains (issue #283).
6
+ // The schema validates shape only: cdn_type is the union across implemented
7
+ // providers and scope is the provider-neutral Chinese-mainland-anchored
8
+ // vocabulary; per-provider legality is enforced by semantic validation through
9
+ // the capability registry (src/common/cdnCapabilities.ts).
10
+ exports.CDN_TYPE_VALUES = ['web', 'download', 'video', 'media', 'hybrid', 'dynamic'];
11
+ exports.CDN_SCOPE_VALUES = ['chinese_mainland', 'overseas', 'global'];
12
+ exports.cdnSchema = {
13
+ oneOf: [
14
+ { type: 'boolean' },
15
+ {
16
+ type: 'object',
17
+ properties: {
18
+ enabled: templateRefSchema_1.resolvableBoolean,
19
+ cdn_type: { type: 'string', enum: [...exports.CDN_TYPE_VALUES] },
20
+ scope: { type: 'string', enum: [...exports.CDN_SCOPE_VALUES] },
21
+ cache_ttl: { type: 'number' },
22
+ ignore_query_string: templateRefSchema_1.resolvableBoolean,
23
+ origin_protocol: { type: 'string', enum: ['http', 'https', 'follow'] },
24
+ compression: templateRefSchema_1.resolvableBoolean,
25
+ force_redirect_https: templateRefSchema_1.resolvableBoolean,
26
+ },
27
+ additionalProperties: false,
28
+ },
29
+ ],
30
+ };
@@ -2,25 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eventSchema = void 0;
4
4
  const templateRefSchema_1 = require("./templateRefSchema");
5
- const cdnSchema = {
6
- oneOf: [
7
- { type: 'boolean' },
8
- {
9
- type: 'object',
10
- properties: {
11
- enabled: { type: 'boolean' },
12
- cdn_type: { type: 'string', enum: ['web', 'download', 'video'] },
13
- scope: { type: 'string', enum: ['domestic', 'overseas', 'global'] },
14
- cache_ttl: { type: 'number' },
15
- ignore_query_string: { type: 'boolean' },
16
- origin_protocol: { type: 'string', enum: ['http', 'https', 'follow'] },
17
- compression: { type: 'boolean' },
18
- force_redirect_https: { type: 'boolean' },
19
- },
20
- additionalProperties: false,
21
- },
22
- ],
23
- };
5
+ const cdnSchema_1 = require("./cdnSchema");
24
6
  exports.eventSchema = {
25
7
  $id: 'https://serverlessinsight.geekfun.club/schemas/eventschema.json',
26
8
  type: 'object',
@@ -73,7 +55,7 @@ exports.eventSchema = {
73
55
  ],
74
56
  },
75
57
  www_bind_apex: { type: 'boolean' },
76
- cdn: cdnSchema,
58
+ cdn: cdnSchema_1.cdnSchema,
77
59
  },
78
60
  oneOf: [
79
61
  {
@@ -198,14 +198,61 @@ exports.functionSchema = {
198
198
  },
199
199
  },
200
200
  },
201
- domain: {
202
- type: 'object',
203
- required: ['domain_name'],
204
- additionalProperties: false,
205
- properties: {
206
- domain_name: (0, templateRefSchema_1.resolvableConstrained)({ pattern: templateRefSchema_1.HOST_NAME_PATTERN }),
207
- certificate_id: { type: 'string' },
208
- protocol: (0, templateRefSchema_1.resolvableEnum)(['HTTP', 'HTTPS']),
201
+ // v1 (issue #286): function custom domains are declared as a
202
+ // per-function `domains` binding list. The legacy single-object
203
+ // `domain` field was removed — legacy usage is rejected at schema
204
+ // validation and semantic validation reports a migration error.
205
+ domains: {
206
+ type: 'array',
207
+ items: {
208
+ type: 'object',
209
+ required: ['domain_name'],
210
+ additionalProperties: false,
211
+ properties: {
212
+ domain_name: (0, templateRefSchema_1.resolvableConstrained)({ pattern: templateRefSchema_1.HOST_NAME_PATTERN }),
213
+ path: (0, templateRefSchema_1.resolvableConstrained)({ pattern: '^/\\S*$' }),
214
+ certificate_id: { type: 'string' },
215
+ certificate_body: { type: 'string' },
216
+ certificate_private_key: { type: 'string' },
217
+ protocol: {
218
+ oneOf: [
219
+ (0, templateRefSchema_1.resolvableEnum)(['HTTP', 'HTTPS']),
220
+ {
221
+ type: 'array',
222
+ items: (0, templateRefSchema_1.resolvableEnum)(['HTTP', 'HTTPS']),
223
+ minItems: 1,
224
+ maxItems: 2,
225
+ uniqueItems: true,
226
+ },
227
+ ],
228
+ },
229
+ },
230
+ // Certificate forms mirror the bucket bindings (#279): no
231
+ // certificate, a certificate_id reference, or an inline PEM pair.
232
+ oneOf: [
233
+ {
234
+ not: {
235
+ anyOf: [
236
+ { required: ['certificate_id'] },
237
+ { required: ['certificate_body'] },
238
+ { required: ['certificate_private_key'] },
239
+ ],
240
+ },
241
+ },
242
+ {
243
+ required: ['certificate_body', 'certificate_private_key'],
244
+ not: { required: ['certificate_id'] },
245
+ },
246
+ {
247
+ required: ['certificate_id'],
248
+ not: {
249
+ anyOf: [
250
+ { required: ['certificate_body'] },
251
+ { required: ['certificate_private_key'] },
252
+ ],
253
+ },
254
+ },
255
+ ],
209
256
  },
210
257
  },
211
258
  storage: {
@@ -162,18 +162,18 @@ exports.rootSchema = {
162
162
  properties: {
163
163
  state_manager: {
164
164
  type: 'object',
165
- description: 'State storage: LOCAL directory, BUCKET_STORE, or the SaaS Console.',
165
+ description: 'State storage: LOCAL directory, BUCKET_STORE (OSS, COS or TOS object storage), or the SaaS Console.',
166
166
  properties: {
167
167
  type: { type: 'string', enum: ['LOCAL', 'BUCKET_STORE', 'SAAS'] },
168
168
  bucket: { type: 'string', description: 'State bucket name (BUCKET_STORE only).' },
169
169
  key: { type: 'string', description: 'State object key (BUCKET_STORE only).' },
170
170
  storageRegion: {
171
171
  type: 'string',
172
- description: 'Pin where state is stored (BUCKET_STORE only); explicit settings never change when the workload -r changes.',
172
+ description: 'Pin the storage region (BUCKET_STORE only); explicit settings never change when workload CLI overrides change the deployment region.',
173
173
  },
174
174
  storageProvider: {
175
175
  type: 'string',
176
- description: 'Provider SDK used for state storage (BUCKET_STORE only); defaults to the workload provider.',
176
+ description: 'Provider SDK used for state storage (BUCKET_STORE only): aliyun (OSS), tencent (COS) or volcengine (TOS). Defaults to the original YAML workload provider; unsupported providers are rejected.',
177
177
  },
178
178
  },
179
179
  required: ['type'],