@supacloud/admin 0.3.2 → 0.4.0

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/README.md CHANGED
@@ -59,6 +59,9 @@ Gateway / Caddy commands (config is injected via the Caddy JSON Admin API; requi
59
59
  supacloud-admin gateway routes --ref abc123
60
60
  supacloud-admin gateway upsert_route --ref abc123 --route_id webhook \
61
61
  --hosts "api.example.com" --paths "/webhook/*" --upstream 10.0.0.5:8080
62
+ supacloud-admin gateway upsert_route --ref abc123 --route_id canonical-https \
63
+ --hosts "www.example.com" --paths "/*" --protocol http \
64
+ --redirect_to 'https://www.example.com{http.request.uri}' --redirect_status 308
62
65
  supacloud-admin gateway config --ref abc123 --rate_limit_tier pro
63
66
  supacloud-admin gateway rebuild --ref abc123 --clean
64
67
  ```
package/dist/index.js CHANGED
@@ -34712,6 +34712,12 @@ var headersRecord = exports_external.preprocess((value) => {
34712
34712
  }
34713
34713
  return Object.keys(out).length > 0 ? out : undefined;
34714
34714
  }, exports_external.record(exports_external.string(), exports_external.string()).optional());
34715
+ var redirectStatus = exports_external.union([
34716
+ exports_external.literal(301),
34717
+ exports_external.literal(302),
34718
+ exports_external.literal(307),
34719
+ exports_external.literal(308)
34720
+ ]).optional();
34715
34721
  var ok2 = (res) => res.ok ? JSON.stringify(res.data, null, 2) : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
34716
34722
  var simple2 = (res, msg) => res.ok ? `✅ ${msg}` : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
34717
34723
  function registerGatewayTools(server, http, options = {}) {
@@ -34740,7 +34746,10 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
34740
34746
  paths: stringArray.describe("[upsert_route/update_route] 路径列表,逗号分隔或 JSON 数组(1-20)"),
34741
34747
  upstream: exports_external.string().optional().describe("[upsert_route/update_route] 反代上游 host:port 或 http(s)://host[:port]"),
34742
34748
  upstream_tls_insecure_skip_verify: exports_external.boolean().optional().describe("[upsert_route/update_route] 上游 TLS 跳过校验"),
34743
- static_root: exports_external.string().optional().describe("[upsert_route/update_route] 静态站点根目录(与 upstream 二选一)"),
34749
+ static_root: exports_external.string().optional().describe("[upsert_route/update_route] 静态站点根目录"),
34750
+ protocol: exports_external.enum(["http", "https"]).optional().describe("[upsert_route/update_route] 可选请求协议匹配"),
34751
+ redirect_to: exports_external.string().optional().describe("[upsert_route/update_route] 带固定 host 的绝对 http(s) 目标,可在末尾使用 {http.request.uri}"),
34752
+ redirect_status: redirectStatus.describe("[upsert_route/update_route] 重定向状态码,默认 308"),
34744
34753
  rewrite_uri: exports_external.string().optional().describe("[upsert_route/update_route] 重写 URI(以 / 开头)"),
34745
34754
  strip_prefix: exports_external.string().optional().describe("[upsert_route/update_route] 去除前缀"),
34746
34755
  headers: headersRecord.describe("[upsert_route/update_route] 自定义请求头,JSON 或 K:V,K2:V2"),
@@ -34783,6 +34792,9 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
34783
34792
  upstream,
34784
34793
  upstream_tls_insecure_skip_verify,
34785
34794
  static_root,
34795
+ protocol,
34796
+ redirect_to,
34797
+ redirect_status,
34786
34798
  rewrite_uri,
34787
34799
  strip_prefix,
34788
34800
  headers,
@@ -34827,6 +34839,12 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
34827
34839
  body.upstream_tls_insecure_skip_verify = upstream_tls_insecure_skip_verify;
34828
34840
  if (static_root !== undefined)
34829
34841
  body.static_root = static_root;
34842
+ if (protocol !== undefined)
34843
+ body.protocol = protocol;
34844
+ if (redirect_to !== undefined)
34845
+ body.redirect_to = redirect_to;
34846
+ if (redirect_status !== undefined)
34847
+ body.redirect_status = redirect_status;
34830
34848
  if (rewrite_uri !== undefined)
34831
34849
  body.rewrite_uri = rewrite_uri;
34832
34850
  if (strip_prefix !== undefined)
@@ -34856,6 +34874,12 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
34856
34874
  body.upstream_tls_insecure_skip_verify = upstream_tls_insecure_skip_verify;
34857
34875
  if (static_root !== undefined)
34858
34876
  body.static_root = static_root;
34877
+ if (protocol !== undefined)
34878
+ body.protocol = protocol;
34879
+ if (redirect_to !== undefined)
34880
+ body.redirect_to = redirect_to;
34881
+ if (redirect_status !== undefined)
34882
+ body.redirect_status = redirect_status;
34859
34883
  if (rewrite_uri !== undefined)
34860
34884
  body.rewrite_uri = rewrite_uri;
34861
34885
  if (strip_prefix !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/admin",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Platform administration CLI for SupaCloud operators",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",