@geek-fun/serverlessinsight 0.6.2 → 0.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.6.2",
3
+ "version": "0.6.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",
@@ -58,9 +58,13 @@ const createCasOperations = (casClient) => {
58
58
  };
59
59
  },
60
60
  getCertificate: async (certificateId) => {
61
- const numericId = Number(certificateId);
61
+ const certIdStr = String(certificateId);
62
+ if (certIdStr.startsWith('cas_') || certIdStr.startsWith('cas-')) {
63
+ throw new Error(lang_1.lang.__('CERT_USING_SUBSCRIPTION_ID', { provided: certIdStr }));
64
+ }
65
+ const numericId = Number(certIdStr);
62
66
  if (Number.isNaN(numericId)) {
63
- throw new Error(lang_1.lang.__('CERT_INVALID_CONFIGURATION', { name: certificateId }));
67
+ throw new Error(lang_1.lang.__('CERT_INVALID_CONFIGURATION', { name: certIdStr }));
64
68
  }
65
69
  try {
66
70
  const request = new cas.GetUserCertificateDetailRequest({
@@ -476,6 +476,7 @@ exports.en = {
476
476
  CERT_PARSING_CERTIFICATES: 'Parsing certificates configuration',
477
477
  CERT_RESOLVING_REFERENCE: 'Resolving certificate reference "{{reference}}" for domain "{{domain}}"',
478
478
  CERT_REFERENCE_NOT_FOUND: 'Certificate reference "{{reference}}" could not be resolved.',
479
+ CERT_USING_SUBSCRIPTION_ID: 'Certificate "{{provided}}" appears to be a Subscription Instance ID (订阅实例ID). Use the numeric Certificate ID (证书ID) instead, e.g., "24019487". Find it in Aliyun CAS console → Certificate Details.',
479
480
  CERT_RESOLVED_UPLOAD: 'Certificate "{{name}}" resolved as upload mode (PEM files provided)',
480
481
  CERT_RESOLVED_REFERENCE: 'Certificate "{{name}}" resolved as reference mode (certificate_id: {{certId}})',
481
482
  CERT_READING_PEM_FILES: 'Reading PEM files for certificate "{{name}}"',
@@ -505,7 +506,6 @@ exports.en = {
505
506
  SSL_CERT_DEPLOY_FAILED: 'Failed to deploy certificate to {{resourceType}} (certificateId: {{certificateId}}): {{error}}',
506
507
  COS_BUCKET_CERT_DEPLOYING: 'Deploying SSL certificate to COS bucket domain: {{domain}} (bucket: {{bucketName}})',
507
508
  COS_BUCKET_CERT_DEPLOYED: 'SSL certificate deployed to COS bucket domain: {{domain}}',
508
- TENCENT_CERT_REFERENCE_NOT_SUPPORTED: 'Certificate "{{name}}" uses certificate_id reference mode which is not yet supported for Tencent Cloud. Use certificate_body and certificate_private_key instead.',
509
509
  BUCKET_DOMAIN_REQUIRED_FOR_CERT: 'Bucket "{{name}}" has certificate configuration but no domain is set. A domain is required when providing certificate information.',
510
510
  // Protocol messages
511
511
  PROTOCOL_INFERRED_REDIRECT: 'Protocol "{{protocol}}" inferred HTTP-to-HTTPS redirect: {{redirect}}',
@@ -472,6 +472,7 @@ exports.zhCN = {
472
472
  CERT_PARSING_CERTIFICATES: '正在解析证书配置',
473
473
  CERT_RESOLVING_REFERENCE: '正在解析域名 "{{domain}}" 的证书引用 "{{reference}}"',
474
474
  CERT_REFERENCE_NOT_FOUND: '无法解析证书引用 "{{reference}}"。',
475
+ CERT_USING_SUBSCRIPTION_ID: '证书 "{{provided}}" 看起来是订阅实例ID。请使用数字格式的证书ID(如 "24019487")。可在阿里云 CAS 控制台 → 证书详情 中找到。',
475
476
  CERT_RESOLVED_UPLOAD: '证书 "{{name}}" 解析为上传模式(提供了 PEM 文件)',
476
477
  CERT_RESOLVED_REFERENCE: '证书 "{{name}}" 解析为引用模式(certificate_id: {{certId}})',
477
478
  CERT_READING_PEM_FILES: '正在读取证书 "{{name}}" 的 PEM 文件',
@@ -500,7 +501,6 @@ exports.zhCN = {
500
501
  SSL_CERT_DEPLOY_FAILED: '部署证书到 {{resourceType}} 失败(证书ID: {{certificateId}}):{{error}}',
501
502
  COS_BUCKET_CERT_DEPLOYING: '正在为 COS 存储桶域名部署 SSL 证书: {{domain}}(存储桶: {{bucketName}})',
502
503
  COS_BUCKET_CERT_DEPLOYED: 'SSL 证书已部署到 COS 存储桶域名: {{domain}}',
503
- TENCENT_CERT_REFERENCE_NOT_SUPPORTED: '证书 "{{name}}" 使用了 certificate_id 引用模式,腾讯云暂不支持该模式。请改用 certificate_body 和 certificate_private_key。',
504
504
  BUCKET_DOMAIN_REQUIRED_FOR_CERT: '存储桶 "{{name}}" 已配置证书信息,但未设置域名。提供证书信息时必须设置域名。',
505
505
  // 协议消息
506
506
  PROTOCOL_INFERRED_REDIRECT: '协议 "{{protocol}}" 推断 HTTP 到 HTTPS 重定向:{{redirect}}',
@@ -13,7 +13,14 @@ const resolveBucketDomainCertificate = (bucket) => {
13
13
  if (!website)
14
14
  return undefined;
15
15
  if (website.domain_certificate_id) {
16
- throw new Error(lang_1.lang.__('TENCENT_CERT_REFERENCE_NOT_SUPPORTED', { name: bucket.key }));
16
+ logger_1.logger.info(lang_1.lang.__('CERT_RESOLVING_REFERENCE', {
17
+ reference: website.domain_certificate_id,
18
+ domain: website.domain ?? bucket.key,
19
+ }));
20
+ return {
21
+ mode: 'reference',
22
+ certificateId: website.domain_certificate_id,
23
+ };
17
24
  }
18
25
  if (website.domain_certificate_body && website.domain_certificate_private_key) {
19
26
  if (!website.domain) {
@@ -23,6 +30,7 @@ const resolveBucketDomainCertificate = (bucket) => {
23
30
  const key = (0, certUtils_1.readPemContent)(website.domain_certificate_private_key);
24
31
  (0, certUtils_1.warnInlinePem)(website.domain_certificate_private_key);
25
32
  return {
33
+ mode: 'upload',
26
34
  certificateName: website.domain.replace(/\./g, '_'),
27
35
  certificateBody: body,
28
36
  certificatePrivateKey: key,
@@ -32,9 +40,23 @@ const resolveBucketDomainCertificate = (bucket) => {
32
40
  };
33
41
  const deployCertificateToCosDomain = async (client, resolved, bucketName, domain, region) => {
34
42
  logger_1.logger.info(lang_1.lang.__('COS_BUCKET_CERT_DEPLOYING', { domain, bucketName }));
35
- const certInfo = await client.ssl.uploadCertificate(resolved.certificateName, resolved.certificateBody, resolved.certificatePrivateKey);
43
+ let certificateId;
44
+ if (resolved.mode === 'reference') {
45
+ logger_1.logger.info(lang_1.lang.__('CERT_RESOLVED_REFERENCE', {
46
+ name: domain,
47
+ certId: resolved.certificateId,
48
+ }));
49
+ certificateId = resolved.certificateId;
50
+ }
51
+ else {
52
+ logger_1.logger.info(lang_1.lang.__('CERT_RESOLVED_UPLOAD', {
53
+ name: resolved.certificateName,
54
+ }));
55
+ const certInfo = await client.ssl.uploadCertificate(resolved.certificateName, resolved.certificateBody, resolved.certificatePrivateKey);
56
+ certificateId = certInfo.certificateId;
57
+ }
36
58
  const instanceId = `${region}|${bucketName}|${domain}`;
37
- await client.ssl.deployCertificateInstance(certInfo.certificateId, 'cos', [instanceId]);
59
+ await client.ssl.deployCertificateInstance(certificateId, 'cos', [instanceId]);
38
60
  };
39
61
  const buildCosInstanceFromProvider = (info, sid) => {
40
62
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.6.2",
3
+ "version": "0.6.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",