@h-ai/deploy 1.0.0-beta.14 → 1.0.0-beta.15

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/index.js CHANGED
@@ -3779,6 +3779,54 @@ var deploy_config_shapes_default = {
3779
3779
  endpoint: {
3780
3780
  default: "dysmsapi.aliyuncs.com",
3781
3781
  type: "string"
3782
+ },
3783
+ gateway: {
3784
+ type: "object",
3785
+ properties: {
3786
+ url: {
3787
+ type: "string",
3788
+ format: "uri"
3789
+ },
3790
+ allowInsecureHttp: {
3791
+ default: false,
3792
+ type: "boolean"
3793
+ },
3794
+ headers: {
3795
+ type: "object",
3796
+ propertyNames: {
3797
+ type: "string"
3798
+ },
3799
+ additionalProperties: {
3800
+ type: "string"
3801
+ }
3802
+ },
3803
+ body: {
3804
+ anyOf: [
3805
+ {
3806
+ type: "string"
3807
+ },
3808
+ {
3809
+ type: "array",
3810
+ items: {
3811
+ $ref: "#/$defs/__schema0"
3812
+ }
3813
+ },
3814
+ {
3815
+ type: "object",
3816
+ propertyNames: {
3817
+ type: "string"
3818
+ },
3819
+ additionalProperties: {
3820
+ $ref: "#/$defs/__schema0"
3821
+ }
3822
+ }
3823
+ ]
3824
+ }
3825
+ },
3826
+ required: [
3827
+ "url"
3828
+ ],
3829
+ additionalProperties: false
3782
3830
  }
3783
3831
  },
3784
3832
  required: [
@@ -3934,7 +3982,40 @@ var deploy_config_shapes_default = {
3934
3982
  },
3935
3983
  required: [
3936
3984
  "providers"
3937
- ]
3985
+ ],
3986
+ $defs: {
3987
+ __schema0: {
3988
+ anyOf: [
3989
+ {
3990
+ type: "string"
3991
+ },
3992
+ {
3993
+ type: "number"
3994
+ },
3995
+ {
3996
+ type: "boolean"
3997
+ },
3998
+ {
3999
+ type: "null"
4000
+ },
4001
+ {
4002
+ type: "array",
4003
+ items: {
4004
+ $ref: "#/$defs/__schema0"
4005
+ }
4006
+ },
4007
+ {
4008
+ type: "object",
4009
+ propertyNames: {
4010
+ type: "string"
4011
+ },
4012
+ additionalProperties: {
4013
+ $ref: "#/$defs/__schema0"
4014
+ }
4015
+ }
4016
+ ]
4017
+ }
4018
+ }
3938
4019
  },
3939
4020
  feedback: {
3940
4021
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -5553,6 +5634,20 @@ var deploy_config_shapes_default = {
5553
5634
  }
5554
5635
  ]
5555
5636
  },
5637
+ maxFutureSkewSeconds: {
5638
+ description: "\u5141\u8BB8\u5BA2\u6237\u7AEF\u8BF7\u6C42\u65F6\u95F4\u9886\u5148\u670D\u52A1\u5668\u7684\u79D2\u6570",
5639
+ default: 30,
5640
+ type: "integer",
5641
+ minimum: 0,
5642
+ maximum: 300
5643
+ },
5644
+ maxRequestAgeSeconds: {
5645
+ description: "\u8BF7\u6C42\u4ECE\u7B7E\u53D1\u8D77\u7684\u6709\u6548\u79D2\u6570",
5646
+ default: 300,
5647
+ type: "integer",
5648
+ minimum: 1,
5649
+ maximum: 600
5650
+ },
5556
5651
  routePlaintextBytes: {
5557
5652
  description: "\u5B8C\u6574\u8DEF\u5F84\u6BB5\u5230\u53CC\u5411\u660E\u6587\u5B57\u8282\u4E0A\u9650\u7684\u6620\u5C04\uFF1B\u661F\u53F7\u5339\u914D\u5355\u6BB5\uFF0C\u4F9B\u9644\u4EF6\u548C\u5F52\u6863\u72EC\u7ACB\u5BB9\u91CF",
5558
5653
  type: "object",
@@ -5620,6 +5715,20 @@ var deploy_config_shapes_default = {
5620
5715
  }
5621
5716
  ]
5622
5717
  },
5718
+ maxFutureSkewSeconds: {
5719
+ description: "\u5141\u8BB8\u5BA2\u6237\u7AEF\u8BF7\u6C42\u65F6\u95F4\u9886\u5148\u670D\u52A1\u5668\u7684\u79D2\u6570",
5720
+ default: 30,
5721
+ type: "integer",
5722
+ minimum: 0,
5723
+ maximum: 300
5724
+ },
5725
+ maxRequestAgeSeconds: {
5726
+ description: "\u8BF7\u6C42\u4ECE\u7B7E\u53D1\u8D77\u7684\u6709\u6548\u79D2\u6570",
5727
+ default: 300,
5728
+ type: "integer",
5729
+ minimum: 1,
5730
+ maximum: 600
5731
+ },
5623
5732
  routePlaintextBytes: {
5624
5733
  description: "\u5B8C\u6574\u8DEF\u5F84\u6BB5\u5230\u53CC\u5411\u660E\u6587\u5B57\u8282\u4E0A\u9650\u7684\u6620\u5C04\uFF1B\u661F\u53F7\u5339\u914D\u5355\u6BB5\uFF0C\u4F9B\u9644\u4EF6\u548C\u5F52\u6863\u72EC\u7ACB\u5BB9\u91CF",
5625
5734
  type: "object",
@@ -6080,7 +6189,10 @@ function loadDeploymentEnvironment(options) {
6080
6189
  return err(HaiDeployError.CONFIG_ERROR, deployM("deploy_environmentReadFailed"));
6081
6190
  }
6082
6191
  }
6192
+ var reachGatewayEnvironment = /^HAI_REACH_PROVIDERS_\d+_GATEWAY$/i;
6083
6193
  function isSecret(name, value) {
6194
+ if (/^HAI_REACH_PROVIDERS_\d+_GATEWAY_(?:HEADERS|BODY)(?:_|$)/i.test(name))
6195
+ return true;
6084
6196
  if (/PASSWORD|SECRET|TOKEN|APIKEY|PRIVATEKEY|ACCESSKEY|AUTHORIZATION/i.test(name.replace(/[^a-z0-9]/gi, "")) || /(?:^|_)PASS$/i.test(name) || value.includes("PRIVATE KEY"))
6085
6197
  return true;
6086
6198
  try {
@@ -6091,8 +6203,11 @@ function isSecret(name, value) {
6091
6203
  }
6092
6204
  try {
6093
6205
  const parsed = JSON.parse(value);
6094
- if (parsed && typeof parsed === "object")
6206
+ if (parsed && typeof parsed === "object") {
6207
+ if ((name === "gateway" || reachGatewayEnvironment.test(name)) && (Object.hasOwn(parsed, "headers") || Object.hasOwn(parsed, "body")))
6208
+ return true;
6095
6209
  return Object.entries(parsed).some(([key, nested]) => isSecret(key, typeof nested === "string" ? nested : JSON.stringify(nested)));
6210
+ }
6096
6211
  } catch {
6097
6212
  }
6098
6213
  return false;
@@ -6148,8 +6263,11 @@ function generatedVariables(values) {
6148
6263
  }
6149
6264
  }
6150
6265
  for (const name of structuredNames.filter((name2) => /_\d+$/.test(name2))) {
6266
+ const value = JSON.parse(group[name]);
6267
+ if (module === "reach" && /^HAI_REACH_PROVIDERS_\d+$/.test(name) && value && typeof value === "object" && "gateway" in value)
6268
+ continue;
6151
6269
  delete generated[name];
6152
- const flattened = core.config.toEnv({ prefix: name, value: JSON.parse(group[name]) });
6270
+ const flattened = core.config.toEnv({ prefix: name, value });
6153
6271
  Object.assign(generated, flattened);
6154
6272
  if (Object.keys(flattened).some((key) => key.startsWith(`${name}_`)))
6155
6273
  generated[name] = "{}";
@@ -6202,7 +6320,7 @@ function saveDeploymentEnvironment(environment, values, options = {}) {
6202
6320
  return value;
6203
6321
  if (Array.isArray(value))
6204
6322
  return value.map((item, index) => splitArrayValue2(`${name}_${index}`, item) ?? null);
6205
- if (value && typeof value === "object" && !isSecret(name, "") && Object.keys(value).every((key) => /^[a-z][a-zA-Z0-9]*$/.test(key)))
6323
+ if (value && typeof value === "object" && !reachGatewayEnvironment.test(name) && !isSecret(name, "") && Object.keys(value).every((key) => /^[a-z][a-zA-Z0-9]*$/.test(key)))
6206
6324
  return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, splitArrayValue2(`${name}_${key.toUpperCase()}`, item)]).filter(([, item]) => item !== void 0));
6207
6325
  privateValues[name] = literal;
6208
6326
  return void 0;