@wecode-team/cms-supabase-api 0.1.54 → 0.1.55

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.
@@ -1,4 +1,5 @@
1
1
  export type FeishuAlertConfig = {
2
+ environment?: string;
2
3
  crudErrorWebhookUrls: string[];
3
4
  };
4
5
  export declare const feishuAlertConfig: FeishuAlertConfig;
package/dist/index.esm.js CHANGED
@@ -675,6 +675,7 @@ function getSupabaseSetupSQL() {
675
675
  }
676
676
 
677
677
  var feishuAlertConfig = {
678
+ environment: process.env.CMS_ALERT_ENV || process.env.NODE_ENV || "development",
678
679
  crudErrorWebhookUrls: ["https://open.feishu.cn/open-apis/bot/v2/hook/784e9470-c1fd-4e38-97a2-b9a1856c00b1"]
679
680
  };
680
681
 
@@ -4147,6 +4148,10 @@ function getWebhookUrls() {
4147
4148
  return item.trim();
4148
4149
  }).filter(Boolean);
4149
4150
  }
4151
+ function getAlertEnvironmentLabel() {
4152
+ var environment = String(feishuAlertConfig.environment || "").trim();
4153
+ return environment === "production" ? "生产" : "测试";
4154
+ }
4150
4155
  function safeJsonStringify(value) {
4151
4156
  var seen = new WeakSet();
4152
4157
  try {
@@ -4265,7 +4270,7 @@ function _notifyCmsCrudErrorToFeishu() {
4265
4270
  content: {
4266
4271
  post: {
4267
4272
  zh_cn: {
4268
- title: "[cms-supabase-api] ".concat(TARGET_LABELS[options.target]).concat(ACTION_LABELS[options.action], "\u5F02\u5E38"),
4273
+ title: "[".concat(getAlertEnvironmentLabel(), "][cms-supabase-api] ").concat(TARGET_LABELS[options.target]).concat(ACTION_LABELS[options.action], "\u5F02\u5E38"),
4269
4274
  content: [[{
4270
4275
  tag: "text",
4271
4276
  text: buildAlertText(c, options)