@freelog/cli 0.10.0 → 0.10.2

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 (30) hide show
  1. package/README.md +9 -9
  2. package/dist/bin/index.js +1394 -969
  3. package/dist/bin/index.js.map +1 -1
  4. package/package.json +3 -2
  5. package/dist/docs/00-/347/211/210/346/234/254/351/200/211/346/213/251/344/270/216AI/344/273/243/345/212/236.md +0 -84
  6. package/dist/docs/01-/345/277/253/351/200/237/344/270/212/346/211/213.md +0 -124
  7. package/dist/docs/02-/347/216/257/345/242/203/344/270/216/345/207/255/346/215/256.md +0 -109
  8. package/dist/docs/03-/346/214/211/345/234/272/346/231/257/346/223/215/344/275/234.md +0 -46
  9. package/dist/docs/04-/346/227/245/345/270/270/350/267/257/345/276/204.md +0 -126
  10. package/dist/docs/05-/344/270/273/351/242/230/344/270/216/346/217/222/344/273/266.md +0 -156
  11. package/dist/docs/06-/347/211/210/346/234/254/345/267/245/344/275/234/347/250/277.md +0 -310
  12. package/dist/docs/07-/345/215/225/350/265/204/346/272/220/346/216/210/346/235/203/347/255/226/347/225/245.md +0 -123
  13. package/dist/docs/08-/350/265/204/346/272/220/347/256/241/347/220/206.md +0 -148
  14. package/dist/docs/09-/345/270/270/350/247/201/346/203/205/345/206/265/344/270/216/346/212/245/351/224/231.md +0 -212
  15. package/dist/docs/10-/346/234/254/345/234/260/346/226/207/344/273/266/345/217/202/350/200/203.md +0 -95
  16. package/dist/docs/11-/345/221/275/344/273/244/345/217/202/350/200/203.md +0 -367
  17. package/dist/docs/12-/350/207/252/345/212/250/345/214/226/344/270/216/347/273/223/346/236/234/345/244/204/347/220/206.md +0 -62
  18. package/dist/docs/README.md +0 -64
  19. package/dist/docs//345/220/210/351/233/206/01-/351/246/226/346/254/241/345/217/221/350/241/214/344/270/216/345/217/221/345/270/203.md +0 -193
  20. package/dist/docs//345/220/210/351/233/206/02-/345/217/221/350/241/214/345/220/216/347/256/241/347/220/206/344/270/216/350/276/271/347/225/214.md +0 -461
  21. package/dist/docs//345/220/210/351/233/206/03-/345/220/210/351/233/206/346/216/210/346/235/203/347/255/226/347/225/245.md +0 -145
  22. package/dist/docs//345/220/210/351/233/206/README.md +0 -65
  23. package/dist/docs//345/255/230/345/202/250/347/251/272/351/227/264/README.md +0 -176
  24. package/dist/docs//346/216/210/346/235/203/344/270/216/346/224/257/344/273/230/README.md +0 -29
  25. package/dist/docs//346/216/210/346/235/203/344/270/216/346/224/257/344/273/230//344/276/235/350/265/226/346/216/210/346/235/203.md +0 -15
  26. package/dist/docs//346/216/210/346/235/203/344/270/216/346/224/257/344/273/230//345/261/225/345/223/201/350/265/204/346/272/220/346/216/210/346/235/203.md +0 -13
  27. package/dist/docs//346/216/210/346/235/203/344/270/216/346/224/257/344/273/230//346/224/257/344/273/230/344/270/216/346/201/242/345/244/215.md +0 -39
  28. package/dist/docs//346/216/210/346/235/203/344/270/216/346/224/257/344/273/230//347/255/276/345/210/260/350/212/202/347/202/271.md +0 -15
  29. package/dist/docs//350/212/202/347/202/271/344/270/216/345/261/225/345/223/201/README.md +0 -367
  30. package/dist/docs//350/212/202/347/202/271/344/270/216/345/261/225/345/223/201//345/261/225/345/223/201/345/220/210/351/233/206.md +0 -197
package/dist/bin/index.js CHANGED
@@ -40,287 +40,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  mod
41
41
  ));
42
42
 
43
- // ../../node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js
44
- var require_dayjs_min = __commonJS({
45
- "../../node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js"(exports, module) {
46
- "use strict";
47
- !(function(t2, e) {
48
- "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t2 = "undefined" != typeof globalThis ? globalThis : t2 || self).dayjs = e();
49
- })(exports, (function() {
50
- "use strict";
51
- var t2 = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
52
- var e2 = ["th", "st", "nd", "rd"], n2 = t3 % 100;
53
- return "[" + t3 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
54
- } }, m = function(t3, e2, n2) {
55
- var r2 = String(t3);
56
- return !r2 || r2.length >= e2 ? t3 : "" + Array(e2 + 1 - r2.length).join(n2) + t3;
57
- }, v = { s: m, z: function(t3) {
58
- var e2 = -t3.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
59
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
60
- }, m: function t3(e2, n2) {
61
- if (e2.date() < n2.date()) return -t3(n2, e2);
62
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
63
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
64
- }, a: function(t3) {
65
- return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
66
- }, p: function(t3) {
67
- return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
68
- }, u: function(t3) {
69
- return void 0 === t3;
70
- } }, g = "en", D = {};
71
- D[g] = M;
72
- var p = "$isDayjsObject", S = function(t3) {
73
- return t3 instanceof _23 || !(!t3 || !t3[p]);
74
- }, w = function t3(e2, n2, r2) {
75
- var i2;
76
- if (!e2) return g;
77
- if ("string" == typeof e2) {
78
- var s2 = e2.toLowerCase();
79
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
80
- var u2 = e2.split("-");
81
- if (!i2 && u2.length > 1) return t3(u2[0]);
82
- } else {
83
- var a2 = e2.name;
84
- D[a2] = e2, i2 = a2;
85
- }
86
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
87
- }, O = function(t3, e2) {
88
- if (S(t3)) return t3.clone();
89
- var n2 = "object" == typeof e2 ? e2 : {};
90
- return n2.date = t3, n2.args = arguments, new _23(n2);
91
- }, b = v;
92
- b.l = w, b.i = S, b.w = function(t3, e2) {
93
- return O(t3, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
94
- };
95
- var _23 = (function() {
96
- function M2(t3) {
97
- this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
98
- }
99
- var m2 = M2.prototype;
100
- return m2.parse = function(t3) {
101
- this.$d = (function(t4) {
102
- var e2 = t4.date, n2 = t4.utc;
103
- if (null === e2) return /* @__PURE__ */ new Date(NaN);
104
- if (b.u(e2)) return /* @__PURE__ */ new Date();
105
- if (e2 instanceof Date) return new Date(e2);
106
- if ("string" == typeof e2 && !/Z$/i.test(e2)) {
107
- var r2 = e2.match($);
108
- if (r2) {
109
- var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
110
- return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
111
- }
112
- }
113
- return new Date(e2);
114
- })(t3), this.init();
115
- }, m2.init = function() {
116
- var t3 = this.$d;
117
- this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
118
- }, m2.$utils = function() {
119
- return b;
120
- }, m2.isValid = function() {
121
- return !(this.$d.toString() === l);
122
- }, m2.isSame = function(t3, e2) {
123
- var n2 = O(t3);
124
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
125
- }, m2.isAfter = function(t3, e2) {
126
- return O(t3) < this.startOf(e2);
127
- }, m2.isBefore = function(t3, e2) {
128
- return this.endOf(e2) < O(t3);
129
- }, m2.$g = function(t3, e2, n2) {
130
- return b.u(t3) ? this[e2] : this.set(n2, t3);
131
- }, m2.unix = function() {
132
- return Math.floor(this.valueOf() / 1e3);
133
- }, m2.valueOf = function() {
134
- return this.$d.getTime();
135
- }, m2.startOf = function(t3, e2) {
136
- var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t3), l2 = function(t4, e3) {
137
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t4) : new Date(n2.$y, e3, t4), n2);
138
- return r2 ? i2 : i2.endOf(a);
139
- }, $2 = function(t4, e3) {
140
- return b.w(n2.toDate()[t4].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
141
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
142
- switch (f2) {
143
- case h:
144
- return r2 ? l2(1, 0) : l2(31, 11);
145
- case c:
146
- return r2 ? l2(1, M3) : l2(0, M3 + 1);
147
- case o:
148
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
149
- return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
150
- case a:
151
- case d:
152
- return $2(v2 + "Hours", 0);
153
- case u:
154
- return $2(v2 + "Minutes", 1);
155
- case s:
156
- return $2(v2 + "Seconds", 2);
157
- case i:
158
- return $2(v2 + "Milliseconds", 3);
159
- default:
160
- return this.clone();
161
- }
162
- }, m2.endOf = function(t3) {
163
- return this.startOf(t3, false);
164
- }, m2.$set = function(t3, e2) {
165
- var n2, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
166
- if (o2 === c || o2 === h) {
167
- var y2 = this.clone().set(d, 1);
168
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
169
- } else l2 && this.$d[l2]($2);
170
- return this.init(), this;
171
- }, m2.set = function(t3, e2) {
172
- return this.clone().$set(t3, e2);
173
- }, m2.get = function(t3) {
174
- return this[b.p(t3)]();
175
- }, m2.add = function(r2, f2) {
176
- var d2, l2 = this;
177
- r2 = Number(r2);
178
- var $2 = b.p(f2), y2 = function(t3) {
179
- var e2 = O(l2);
180
- return b.w(e2.date(e2.date() + Math.round(t3 * r2)), l2);
181
- };
182
- if ($2 === c) return this.set(c, this.$M + r2);
183
- if ($2 === h) return this.set(h, this.$y + r2);
184
- if ($2 === a) return y2(1);
185
- if ($2 === o) return y2(7);
186
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
187
- return b.w(m3, this);
188
- }, m2.subtract = function(t3, e2) {
189
- return this.add(-1 * t3, e2);
190
- }, m2.format = function(t3) {
191
- var e2 = this, n2 = this.$locale();
192
- if (!this.isValid()) return n2.invalidDate || l;
193
- var r2 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t4, n3, i3, s3) {
194
- return t4 && (t4[n3] || t4(e2, r2)) || i3[n3].slice(0, s3);
195
- }, d2 = function(t4) {
196
- return b.s(s2 % 12 || 12, t4, "0");
197
- }, $2 = f2 || function(t4, e3, n3) {
198
- var r3 = t4 < 12 ? "AM" : "PM";
199
- return n3 ? r3.toLowerCase() : r3;
200
- };
201
- return r2.replace(y, (function(t4, r3) {
202
- return r3 || (function(t5) {
203
- switch (t5) {
204
- case "YY":
205
- return String(e2.$y).slice(-2);
206
- case "YYYY":
207
- return b.s(e2.$y, 4, "0");
208
- case "M":
209
- return a2 + 1;
210
- case "MM":
211
- return b.s(a2 + 1, 2, "0");
212
- case "MMM":
213
- return h2(n2.monthsShort, a2, c2, 3);
214
- case "MMMM":
215
- return h2(c2, a2);
216
- case "D":
217
- return e2.$D;
218
- case "DD":
219
- return b.s(e2.$D, 2, "0");
220
- case "d":
221
- return String(e2.$W);
222
- case "dd":
223
- return h2(n2.weekdaysMin, e2.$W, o2, 2);
224
- case "ddd":
225
- return h2(n2.weekdaysShort, e2.$W, o2, 3);
226
- case "dddd":
227
- return o2[e2.$W];
228
- case "H":
229
- return String(s2);
230
- case "HH":
231
- return b.s(s2, 2, "0");
232
- case "h":
233
- return d2(1);
234
- case "hh":
235
- return d2(2);
236
- case "a":
237
- return $2(s2, u2, true);
238
- case "A":
239
- return $2(s2, u2, false);
240
- case "m":
241
- return String(u2);
242
- case "mm":
243
- return b.s(u2, 2, "0");
244
- case "s":
245
- return String(e2.$s);
246
- case "ss":
247
- return b.s(e2.$s, 2, "0");
248
- case "SSS":
249
- return b.s(e2.$ms, 3, "0");
250
- case "Z":
251
- return i2;
252
- }
253
- return null;
254
- })(t4) || i2.replace(":", "");
255
- }));
256
- }, m2.utcOffset = function() {
257
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
258
- }, m2.diff = function(r2, d2, l2) {
259
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
260
- return b.m(y2, m3);
261
- };
262
- switch (M3) {
263
- case h:
264
- $2 = D2() / 12;
265
- break;
266
- case c:
267
- $2 = D2();
268
- break;
269
- case f:
270
- $2 = D2() / 3;
271
- break;
272
- case o:
273
- $2 = (g2 - v2) / 6048e5;
274
- break;
275
- case a:
276
- $2 = (g2 - v2) / 864e5;
277
- break;
278
- case u:
279
- $2 = g2 / n;
280
- break;
281
- case s:
282
- $2 = g2 / e;
283
- break;
284
- case i:
285
- $2 = g2 / t2;
286
- break;
287
- default:
288
- $2 = g2;
289
- }
290
- return l2 ? $2 : b.a($2);
291
- }, m2.daysInMonth = function() {
292
- return this.endOf(c).$D;
293
- }, m2.$locale = function() {
294
- return D[this.$L];
295
- }, m2.locale = function(t3, e2) {
296
- if (!t3) return this.$L;
297
- var n2 = this.clone(), r2 = w(t3, e2, true);
298
- return r2 && (n2.$L = r2), n2;
299
- }, m2.clone = function() {
300
- return b.w(this.$d, this);
301
- }, m2.toDate = function() {
302
- return new Date(this.valueOf());
303
- }, m2.toJSON = function() {
304
- return this.isValid() ? this.toISOString() : null;
305
- }, m2.toISOString = function() {
306
- return this.$d.toISOString();
307
- }, m2.toString = function() {
308
- return this.$d.toUTCString();
309
- }, M2;
310
- })(), Y = _23.prototype;
311
- return O.prototype = Y, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t3) {
312
- Y[t3[1]] = function(e2) {
313
- return this.$g(e2, t3[0], t3[1]);
314
- };
315
- })), O.extend = function(t3, e2) {
316
- return t3.$i || (t3(e2, _23, O), t3.$i = true), O;
317
- }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
318
- return O(1e3 * t3);
319
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
320
- }));
321
- }
322
- });
323
-
324
43
  // ../../node_modules/.pnpm/axios@1.19.0/node_modules/axios/lib/helpers/bind.js
325
44
  function bind(fn, thisArg) {
326
45
  return function wrap() {
@@ -10287,11 +10006,11 @@ var require_mime_types = __commonJS({
10287
10006
  }
10288
10007
  return exts[0];
10289
10008
  }
10290
- function lookup3(path34) {
10291
- if (!path34 || typeof path34 !== "string") {
10009
+ function lookup3(path33) {
10010
+ if (!path33 || typeof path33 !== "string") {
10292
10011
  return false;
10293
10012
  }
10294
- var extension2 = extname("x." + path34).toLowerCase().substr(1);
10013
+ var extension2 = extname("x." + path33).toLowerCase().substr(1);
10295
10014
  if (!extension2) {
10296
10015
  return false;
10297
10016
  }
@@ -11406,7 +11125,7 @@ var require_form_data = __commonJS({
11406
11125
  "use strict";
11407
11126
  var CombinedStream = require_combined_stream();
11408
11127
  var util4 = __require("util");
11409
- var path34 = __require("path");
11128
+ var path33 = __require("path");
11410
11129
  var http3 = __require("http");
11411
11130
  var https2 = __require("https");
11412
11131
  var parseUrl2 = __require("url").parse;
@@ -11537,11 +11256,11 @@ var require_form_data = __commonJS({
11537
11256
  FormData3.prototype._getContentDisposition = function(value, options2) {
11538
11257
  var filename;
11539
11258
  if (typeof options2.filepath === "string") {
11540
- filename = path34.normalize(options2.filepath).replace(/\\/g, "/");
11259
+ filename = path33.normalize(options2.filepath).replace(/\\/g, "/");
11541
11260
  } else if (options2.filename || value && (value.name || value.path)) {
11542
- filename = path34.basename(options2.filename || value && (value.name || value.path));
11261
+ filename = path33.basename(options2.filename || value && (value.name || value.path));
11543
11262
  } else if (value && value.readable && hasOwn(value, "httpVersion")) {
11544
- filename = path34.basename(value.client._httpMessage.path || "");
11263
+ filename = path33.basename(value.client._httpMessage.path || "");
11545
11264
  }
11546
11265
  if (filename) {
11547
11266
  return 'filename="' + escapeHeaderParam(filename) + '"';
@@ -11755,9 +11474,9 @@ function isVisitable(thing) {
11755
11474
  function removeBrackets(key2) {
11756
11475
  return utils_default.endsWith(key2, "[]") ? key2.slice(0, -2) : key2;
11757
11476
  }
11758
- function renderKey(path34, key2, dots) {
11759
- if (!path34) return key2;
11760
- return path34.concat(key2).map(function each(token2, i) {
11477
+ function renderKey(path33, key2, dots) {
11478
+ if (!path33) return key2;
11479
+ return path33.concat(key2).map(function each(token2, i) {
11761
11480
  token2 = removeBrackets(token2);
11762
11481
  return !dots && i ? "[" + token2 + "]" : token2;
11763
11482
  }).join(dots ? "." : "");
@@ -11840,13 +11559,13 @@ function toFormData(obj, formData, options2) {
11840
11559
  return currentValue;
11841
11560
  });
11842
11561
  }
11843
- function defaultVisitor(value, key2, path34) {
11562
+ function defaultVisitor(value, key2, path33) {
11844
11563
  let arr = value;
11845
11564
  if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
11846
- formData.append(renderKey(path34, key2, dots), convertValue(value));
11565
+ formData.append(renderKey(path33, key2, dots), convertValue(value));
11847
11566
  return false;
11848
11567
  }
11849
- if (value && !path34 && typeof value === "object") {
11568
+ if (value && !path33 && typeof value === "object") {
11850
11569
  if (utils_default.endsWith(key2, "{}")) {
11851
11570
  key2 = metaTokens ? key2 : key2.slice(0, -2);
11852
11571
  value = stringifyWithDepthLimit(value, 1);
@@ -11865,7 +11584,7 @@ function toFormData(obj, formData, options2) {
11865
11584
  if (isVisitable(value)) {
11866
11585
  return true;
11867
11586
  }
11868
- formData.append(renderKey(path34, key2, dots), convertValue(value));
11587
+ formData.append(renderKey(path33, key2, dots), convertValue(value));
11869
11588
  return false;
11870
11589
  }
11871
11590
  const exposedHelpers = Object.assign(predicates, {
@@ -11873,17 +11592,17 @@ function toFormData(obj, formData, options2) {
11873
11592
  convertValue,
11874
11593
  isVisitable
11875
11594
  });
11876
- function build(value, path34, depth = 0) {
11595
+ function build(value, path33, depth = 0) {
11877
11596
  if (utils_default.isUndefined(value)) return;
11878
11597
  throwIfMaxDepthExceeded(depth);
11879
11598
  if (stack.indexOf(value) !== -1) {
11880
- throw new Error("Circular reference detected in " + path34.join("."));
11599
+ throw new Error("Circular reference detected in " + path33.join("."));
11881
11600
  }
11882
11601
  stack.push(value);
11883
11602
  utils_default.forEach(value, function each(el, key2) {
11884
- const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key2) ? key2.trim() : key2, path34, exposedHelpers);
11603
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key2) ? key2.trim() : key2, path33, exposedHelpers);
11885
11604
  if (result === true) {
11886
- build(el, path34 ? path34.concat(key2) : [key2], depth + 1);
11605
+ build(el, path33 ? path33.concat(key2) : [key2], depth + 1);
11887
11606
  }
11888
11607
  });
11889
11608
  stack.pop();
@@ -12162,7 +11881,7 @@ var init_platform = __esm({
12162
11881
  // ../../node_modules/.pnpm/axios@1.19.0/node_modules/axios/lib/helpers/toURLEncodedForm.js
12163
11882
  function toURLEncodedForm(data3, options2) {
12164
11883
  return toFormData_default(data3, new platform_default.classes.URLSearchParams(), {
12165
- visitor: function(value, key2, path34, helpers) {
11884
+ visitor: function(value, key2, path33, helpers) {
12166
11885
  if (platform_default.isNode && utils_default.isBuffer(value)) {
12167
11886
  this.append(key2, value.toString("base64"));
12168
11887
  return false;
@@ -12191,14 +11910,14 @@ function throwIfDepthExceeded(index) {
12191
11910
  }
12192
11911
  }
12193
11912
  function parsePropPath(name) {
12194
- const path34 = [];
11913
+ const path33 = [];
12195
11914
  const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
12196
11915
  let match;
12197
11916
  while ((match = pattern.exec(name)) !== null) {
12198
- throwIfDepthExceeded(path34.length);
12199
- path34.push(match[0] === "[]" ? "" : match[1] || match[0]);
11917
+ throwIfDepthExceeded(path33.length);
11918
+ path33.push(match[0] === "[]" ? "" : match[1] || match[0]);
12200
11919
  }
12201
- return path34;
11920
+ return path33;
12202
11921
  }
12203
11922
  function arrayToObject(arr) {
12204
11923
  const obj = {};
@@ -12213,12 +11932,12 @@ function arrayToObject(arr) {
12213
11932
  return obj;
12214
11933
  }
12215
11934
  function formDataToJSON(formData) {
12216
- function buildPath(path34, value, target, index) {
11935
+ function buildPath(path33, value, target, index) {
12217
11936
  throwIfDepthExceeded(index);
12218
- let name = path34[index++];
11937
+ let name = path33[index++];
12219
11938
  if (name === "__proto__") return true;
12220
11939
  const isNumericKey = Number.isFinite(+name);
12221
- const isLast = index >= path34.length;
11940
+ const isLast = index >= path33.length;
12222
11941
  name = !name && utils_default.isArray(target) ? target.length : name;
12223
11942
  if (isLast) {
12224
11943
  if (utils_default.hasOwnProp(target, name)) {
@@ -12231,7 +11950,7 @@ function formDataToJSON(formData) {
12231
11950
  if (!utils_default.hasOwnProp(target, name) || !utils_default.isObject(target[name])) {
12232
11951
  target[name] = [];
12233
11952
  }
12234
- const result = buildPath(path34, value, target[name], index);
11953
+ const result = buildPath(path33, value, target[name], index);
12235
11954
  if (result && utils_default.isArray(target[name])) {
12236
11955
  target[name] = arrayToObject(target[name]);
12237
11956
  }
@@ -13334,7 +13053,7 @@ var require_src2 = __commonJS({
13334
13053
  return new createAgent.Agent(callback, opts);
13335
13054
  }
13336
13055
  (function(createAgent2) {
13337
- class Agent extends events_1.EventEmitter {
13056
+ class Agent2 extends events_1.EventEmitter {
13338
13057
  constructor(callback, _opts) {
13339
13058
  super();
13340
13059
  let opts = _opts;
@@ -13486,7 +13205,7 @@ var require_src2 = __commonJS({
13486
13205
  debug("Destroying agent %o", this.constructor.name);
13487
13206
  }
13488
13207
  }
13489
- createAgent2.Agent = Agent;
13208
+ createAgent2.Agent = Agent2;
13490
13209
  createAgent2.prototype = createAgent2.Agent.prototype;
13491
13210
  })(createAgent || (createAgent = {}));
13492
13211
  module.exports = createAgent;
@@ -15778,9 +15497,9 @@ var init_http = __esm({
15778
15497
  auth = urlUsername + ":" + urlPassword;
15779
15498
  }
15780
15499
  auth && headers.delete("authorization");
15781
- let path34;
15500
+ let path33;
15782
15501
  try {
15783
- path34 = buildURL(
15502
+ path33 = buildURL(
15784
15503
  parsed.pathname + parsed.search,
15785
15504
  own3("params"),
15786
15505
  own3("paramsSerializer")
@@ -15799,7 +15518,7 @@ var init_http = __esm({
15799
15518
  false
15800
15519
  );
15801
15520
  const options2 = Object.assign(/* @__PURE__ */ Object.create(null), {
15802
- path: path34,
15521
+ path: path33,
15803
15522
  method,
15804
15523
  headers: toByteStringHeaderObject(headers),
15805
15524
  agents: { http: httpAgent, https: httpsAgent },
@@ -16216,14 +15935,14 @@ var init_cookies = __esm({
16216
15935
  cookies_default = platform_default.hasStandardBrowserEnv ? (
16217
15936
  // Standard browser envs support document.cookie
16218
15937
  {
16219
- write(name, value, expires, path34, domain, secure, sameSite) {
15938
+ write(name, value, expires, path33, domain, secure, sameSite) {
16220
15939
  if (typeof document === "undefined") return;
16221
15940
  const cookie = [`${name}=${encodeURIComponent(value)}`];
16222
15941
  if (utils_default.isNumber(expires)) {
16223
15942
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
16224
15943
  }
16225
- if (utils_default.isString(path34)) {
16226
- cookie.push(`path=${path34}`);
15944
+ if (utils_default.isString(path33)) {
15945
+ cookie.push(`path=${path33}`);
16227
15946
  }
16228
15947
  if (utils_default.isString(domain)) {
16229
15948
  cookie.push(`domain=${domain}`);
@@ -17967,6 +17686,287 @@ var init_axios2 = __esm({
17967
17686
  }
17968
17687
  });
17969
17688
 
17689
+ // ../../node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js
17690
+ var require_dayjs_min = __commonJS({
17691
+ "../../node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js"(exports, module) {
17692
+ "use strict";
17693
+ !(function(t2, e) {
17694
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t2 = "undefined" != typeof globalThis ? globalThis : t2 || self).dayjs = e();
17695
+ })(exports, (function() {
17696
+ "use strict";
17697
+ var t2 = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
17698
+ var e2 = ["th", "st", "nd", "rd"], n2 = t3 % 100;
17699
+ return "[" + t3 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
17700
+ } }, m = function(t3, e2, n2) {
17701
+ var r2 = String(t3);
17702
+ return !r2 || r2.length >= e2 ? t3 : "" + Array(e2 + 1 - r2.length).join(n2) + t3;
17703
+ }, v = { s: m, z: function(t3) {
17704
+ var e2 = -t3.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
17705
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
17706
+ }, m: function t3(e2, n2) {
17707
+ if (e2.date() < n2.date()) return -t3(n2, e2);
17708
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
17709
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
17710
+ }, a: function(t3) {
17711
+ return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
17712
+ }, p: function(t3) {
17713
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
17714
+ }, u: function(t3) {
17715
+ return void 0 === t3;
17716
+ } }, g = "en", D = {};
17717
+ D[g] = M;
17718
+ var p = "$isDayjsObject", S = function(t3) {
17719
+ return t3 instanceof _23 || !(!t3 || !t3[p]);
17720
+ }, w = function t3(e2, n2, r2) {
17721
+ var i2;
17722
+ if (!e2) return g;
17723
+ if ("string" == typeof e2) {
17724
+ var s2 = e2.toLowerCase();
17725
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
17726
+ var u2 = e2.split("-");
17727
+ if (!i2 && u2.length > 1) return t3(u2[0]);
17728
+ } else {
17729
+ var a2 = e2.name;
17730
+ D[a2] = e2, i2 = a2;
17731
+ }
17732
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
17733
+ }, O = function(t3, e2) {
17734
+ if (S(t3)) return t3.clone();
17735
+ var n2 = "object" == typeof e2 ? e2 : {};
17736
+ return n2.date = t3, n2.args = arguments, new _23(n2);
17737
+ }, b = v;
17738
+ b.l = w, b.i = S, b.w = function(t3, e2) {
17739
+ return O(t3, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
17740
+ };
17741
+ var _23 = (function() {
17742
+ function M2(t3) {
17743
+ this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
17744
+ }
17745
+ var m2 = M2.prototype;
17746
+ return m2.parse = function(t3) {
17747
+ this.$d = (function(t4) {
17748
+ var e2 = t4.date, n2 = t4.utc;
17749
+ if (null === e2) return /* @__PURE__ */ new Date(NaN);
17750
+ if (b.u(e2)) return /* @__PURE__ */ new Date();
17751
+ if (e2 instanceof Date) return new Date(e2);
17752
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
17753
+ var r2 = e2.match($);
17754
+ if (r2) {
17755
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
17756
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
17757
+ }
17758
+ }
17759
+ return new Date(e2);
17760
+ })(t3), this.init();
17761
+ }, m2.init = function() {
17762
+ var t3 = this.$d;
17763
+ this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
17764
+ }, m2.$utils = function() {
17765
+ return b;
17766
+ }, m2.isValid = function() {
17767
+ return !(this.$d.toString() === l);
17768
+ }, m2.isSame = function(t3, e2) {
17769
+ var n2 = O(t3);
17770
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
17771
+ }, m2.isAfter = function(t3, e2) {
17772
+ return O(t3) < this.startOf(e2);
17773
+ }, m2.isBefore = function(t3, e2) {
17774
+ return this.endOf(e2) < O(t3);
17775
+ }, m2.$g = function(t3, e2, n2) {
17776
+ return b.u(t3) ? this[e2] : this.set(n2, t3);
17777
+ }, m2.unix = function() {
17778
+ return Math.floor(this.valueOf() / 1e3);
17779
+ }, m2.valueOf = function() {
17780
+ return this.$d.getTime();
17781
+ }, m2.startOf = function(t3, e2) {
17782
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t3), l2 = function(t4, e3) {
17783
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t4) : new Date(n2.$y, e3, t4), n2);
17784
+ return r2 ? i2 : i2.endOf(a);
17785
+ }, $2 = function(t4, e3) {
17786
+ return b.w(n2.toDate()[t4].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
17787
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
17788
+ switch (f2) {
17789
+ case h:
17790
+ return r2 ? l2(1, 0) : l2(31, 11);
17791
+ case c:
17792
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
17793
+ case o:
17794
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
17795
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
17796
+ case a:
17797
+ case d:
17798
+ return $2(v2 + "Hours", 0);
17799
+ case u:
17800
+ return $2(v2 + "Minutes", 1);
17801
+ case s:
17802
+ return $2(v2 + "Seconds", 2);
17803
+ case i:
17804
+ return $2(v2 + "Milliseconds", 3);
17805
+ default:
17806
+ return this.clone();
17807
+ }
17808
+ }, m2.endOf = function(t3) {
17809
+ return this.startOf(t3, false);
17810
+ }, m2.$set = function(t3, e2) {
17811
+ var n2, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
17812
+ if (o2 === c || o2 === h) {
17813
+ var y2 = this.clone().set(d, 1);
17814
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
17815
+ } else l2 && this.$d[l2]($2);
17816
+ return this.init(), this;
17817
+ }, m2.set = function(t3, e2) {
17818
+ return this.clone().$set(t3, e2);
17819
+ }, m2.get = function(t3) {
17820
+ return this[b.p(t3)]();
17821
+ }, m2.add = function(r2, f2) {
17822
+ var d2, l2 = this;
17823
+ r2 = Number(r2);
17824
+ var $2 = b.p(f2), y2 = function(t3) {
17825
+ var e2 = O(l2);
17826
+ return b.w(e2.date(e2.date() + Math.round(t3 * r2)), l2);
17827
+ };
17828
+ if ($2 === c) return this.set(c, this.$M + r2);
17829
+ if ($2 === h) return this.set(h, this.$y + r2);
17830
+ if ($2 === a) return y2(1);
17831
+ if ($2 === o) return y2(7);
17832
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
17833
+ return b.w(m3, this);
17834
+ }, m2.subtract = function(t3, e2) {
17835
+ return this.add(-1 * t3, e2);
17836
+ }, m2.format = function(t3) {
17837
+ var e2 = this, n2 = this.$locale();
17838
+ if (!this.isValid()) return n2.invalidDate || l;
17839
+ var r2 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t4, n3, i3, s3) {
17840
+ return t4 && (t4[n3] || t4(e2, r2)) || i3[n3].slice(0, s3);
17841
+ }, d2 = function(t4) {
17842
+ return b.s(s2 % 12 || 12, t4, "0");
17843
+ }, $2 = f2 || function(t4, e3, n3) {
17844
+ var r3 = t4 < 12 ? "AM" : "PM";
17845
+ return n3 ? r3.toLowerCase() : r3;
17846
+ };
17847
+ return r2.replace(y, (function(t4, r3) {
17848
+ return r3 || (function(t5) {
17849
+ switch (t5) {
17850
+ case "YY":
17851
+ return String(e2.$y).slice(-2);
17852
+ case "YYYY":
17853
+ return b.s(e2.$y, 4, "0");
17854
+ case "M":
17855
+ return a2 + 1;
17856
+ case "MM":
17857
+ return b.s(a2 + 1, 2, "0");
17858
+ case "MMM":
17859
+ return h2(n2.monthsShort, a2, c2, 3);
17860
+ case "MMMM":
17861
+ return h2(c2, a2);
17862
+ case "D":
17863
+ return e2.$D;
17864
+ case "DD":
17865
+ return b.s(e2.$D, 2, "0");
17866
+ case "d":
17867
+ return String(e2.$W);
17868
+ case "dd":
17869
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
17870
+ case "ddd":
17871
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
17872
+ case "dddd":
17873
+ return o2[e2.$W];
17874
+ case "H":
17875
+ return String(s2);
17876
+ case "HH":
17877
+ return b.s(s2, 2, "0");
17878
+ case "h":
17879
+ return d2(1);
17880
+ case "hh":
17881
+ return d2(2);
17882
+ case "a":
17883
+ return $2(s2, u2, true);
17884
+ case "A":
17885
+ return $2(s2, u2, false);
17886
+ case "m":
17887
+ return String(u2);
17888
+ case "mm":
17889
+ return b.s(u2, 2, "0");
17890
+ case "s":
17891
+ return String(e2.$s);
17892
+ case "ss":
17893
+ return b.s(e2.$s, 2, "0");
17894
+ case "SSS":
17895
+ return b.s(e2.$ms, 3, "0");
17896
+ case "Z":
17897
+ return i2;
17898
+ }
17899
+ return null;
17900
+ })(t4) || i2.replace(":", "");
17901
+ }));
17902
+ }, m2.utcOffset = function() {
17903
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
17904
+ }, m2.diff = function(r2, d2, l2) {
17905
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
17906
+ return b.m(y2, m3);
17907
+ };
17908
+ switch (M3) {
17909
+ case h:
17910
+ $2 = D2() / 12;
17911
+ break;
17912
+ case c:
17913
+ $2 = D2();
17914
+ break;
17915
+ case f:
17916
+ $2 = D2() / 3;
17917
+ break;
17918
+ case o:
17919
+ $2 = (g2 - v2) / 6048e5;
17920
+ break;
17921
+ case a:
17922
+ $2 = (g2 - v2) / 864e5;
17923
+ break;
17924
+ case u:
17925
+ $2 = g2 / n;
17926
+ break;
17927
+ case s:
17928
+ $2 = g2 / e;
17929
+ break;
17930
+ case i:
17931
+ $2 = g2 / t2;
17932
+ break;
17933
+ default:
17934
+ $2 = g2;
17935
+ }
17936
+ return l2 ? $2 : b.a($2);
17937
+ }, m2.daysInMonth = function() {
17938
+ return this.endOf(c).$D;
17939
+ }, m2.$locale = function() {
17940
+ return D[this.$L];
17941
+ }, m2.locale = function(t3, e2) {
17942
+ if (!t3) return this.$L;
17943
+ var n2 = this.clone(), r2 = w(t3, e2, true);
17944
+ return r2 && (n2.$L = r2), n2;
17945
+ }, m2.clone = function() {
17946
+ return b.w(this.$d, this);
17947
+ }, m2.toDate = function() {
17948
+ return new Date(this.valueOf());
17949
+ }, m2.toJSON = function() {
17950
+ return this.isValid() ? this.toISOString() : null;
17951
+ }, m2.toISOString = function() {
17952
+ return this.$d.toISOString();
17953
+ }, m2.toString = function() {
17954
+ return this.$d.toUTCString();
17955
+ }, M2;
17956
+ })(), Y = _23.prototype;
17957
+ return O.prototype = Y, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t3) {
17958
+ Y[t3[1]] = function(e2) {
17959
+ return this.$g(e2, t3[0], t3[1]);
17960
+ };
17961
+ })), O.extend = function(t3, e2) {
17962
+ return t3.$i || (t3(e2, _23, O), t3.$i = true), O;
17963
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
17964
+ return O(1e3 * t3);
17965
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
17966
+ }));
17967
+ }
17968
+ });
17969
+
17970
17970
  // ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/typeof.js
17971
17971
  function _typeof(o) {
17972
17972
  "@babel/helpers - typeof";
@@ -18249,14 +18249,14 @@ function copy(a, s, t2) {
18249
18249
  if (s[m]) t2[m] = s[m];
18250
18250
  });
18251
18251
  }
18252
- function getLastOfPath(object4, path34, Empty) {
18252
+ function getLastOfPath(object4, path33, Empty) {
18253
18253
  function cleanKey(key3) {
18254
18254
  return key3 && key3.indexOf("###") > -1 ? key3.replace(/###/g, ".") : key3;
18255
18255
  }
18256
18256
  function canNotTraverseDeeper() {
18257
18257
  return !object4 || typeof object4 === "string";
18258
18258
  }
18259
- var stack = typeof path34 !== "string" ? [].concat(path34) : path34.split(".");
18259
+ var stack = typeof path33 !== "string" ? [].concat(path33) : path33.split(".");
18260
18260
  while (stack.length > 1) {
18261
18261
  if (canNotTraverseDeeper()) return {};
18262
18262
  var key2 = cleanKey(stack.shift());
@@ -18273,18 +18273,18 @@ function getLastOfPath(object4, path34, Empty) {
18273
18273
  k: cleanKey(stack.shift())
18274
18274
  };
18275
18275
  }
18276
- function setPath(object4, path34, newValue) {
18277
- var _getLastOfPath = getLastOfPath(object4, path34, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
18276
+ function setPath(object4, path33, newValue) {
18277
+ var _getLastOfPath = getLastOfPath(object4, path33, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
18278
18278
  obj[k] = newValue;
18279
18279
  }
18280
- function pushPath(object4, path34, newValue, concat) {
18281
- var _getLastOfPath2 = getLastOfPath(object4, path34, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
18280
+ function pushPath(object4, path33, newValue, concat) {
18281
+ var _getLastOfPath2 = getLastOfPath(object4, path33, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
18282
18282
  obj[k] = obj[k] || [];
18283
18283
  if (concat) obj[k] = obj[k].concat(newValue);
18284
18284
  if (!concat) obj[k].push(newValue);
18285
18285
  }
18286
- function getPath(object4, path34) {
18287
- var _getLastOfPath3 = getLastOfPath(object4, path34), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
18286
+ function getPath(object4, path33) {
18287
+ var _getLastOfPath3 = getLastOfPath(object4, path33), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
18288
18288
  if (!obj) return void 0;
18289
18289
  return obj[k];
18290
18290
  }
@@ -18396,11 +18396,11 @@ function _isNativeReflectConstruct() {
18396
18396
  return false;
18397
18397
  }
18398
18398
  }
18399
- function deepFind(obj, path34) {
18399
+ function deepFind(obj, path33) {
18400
18400
  var keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
18401
18401
  if (!obj) return void 0;
18402
- if (obj[path34]) return obj[path34];
18403
- var paths = path34.split(keySeparator);
18402
+ if (obj[path33]) return obj[path33];
18403
+ var paths = path33.split(keySeparator);
18404
18404
  var current2 = obj;
18405
18405
  for (var i = 0; i < paths.length; ++i) {
18406
18406
  if (!current2) return void 0;
@@ -18418,7 +18418,7 @@ function deepFind(obj, path34) {
18418
18418
  }
18419
18419
  if (mix === void 0) return void 0;
18420
18420
  if (mix === null) return null;
18421
- if (path34.endsWith(p)) {
18421
+ if (path33.endsWith(p)) {
18422
18422
  if (typeof mix === "string") return mix;
18423
18423
  if (p && typeof mix[p] === "string") return mix[p];
18424
18424
  }
@@ -19009,13 +19009,13 @@ var init_i18next = __esm({
19009
19009
  var options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
19010
19010
  var keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
19011
19011
  var ignoreJSONStructure = options2.ignoreJSONStructure !== void 0 ? options2.ignoreJSONStructure : this.options.ignoreJSONStructure;
19012
- var path34 = [lng, ns];
19013
- if (key2 && typeof key2 !== "string") path34 = path34.concat(key2);
19014
- if (key2 && typeof key2 === "string") path34 = path34.concat(keySeparator ? key2.split(keySeparator) : key2);
19012
+ var path33 = [lng, ns];
19013
+ if (key2 && typeof key2 !== "string") path33 = path33.concat(key2);
19014
+ if (key2 && typeof key2 === "string") path33 = path33.concat(keySeparator ? key2.split(keySeparator) : key2);
19015
19015
  if (lng.indexOf(".") > -1) {
19016
- path34 = lng.split(".");
19016
+ path33 = lng.split(".");
19017
19017
  }
19018
- var result = getPath(this.data, path34);
19018
+ var result = getPath(this.data, path33);
19019
19019
  if (result || !ignoreJSONStructure || typeof key2 !== "string") return result;
19020
19020
  return deepFind(this.data && this.data[lng] && this.data[lng][ns], key2, keySeparator);
19021
19021
  }
@@ -19027,15 +19027,15 @@ var init_i18next = __esm({
19027
19027
  };
19028
19028
  var keySeparator = this.options.keySeparator;
19029
19029
  if (keySeparator === void 0) keySeparator = ".";
19030
- var path34 = [lng, ns];
19031
- if (key2) path34 = path34.concat(keySeparator ? key2.split(keySeparator) : key2);
19030
+ var path33 = [lng, ns];
19031
+ if (key2) path33 = path33.concat(keySeparator ? key2.split(keySeparator) : key2);
19032
19032
  if (lng.indexOf(".") > -1) {
19033
- path34 = lng.split(".");
19033
+ path33 = lng.split(".");
19034
19034
  value = ns;
19035
- ns = path34[1];
19035
+ ns = path33[1];
19036
19036
  }
19037
19037
  this.addNamespaces(ns);
19038
- setPath(this.data, path34, value);
19038
+ setPath(this.data, path33, value);
19039
19039
  if (!options2.silent) this.emit("added", lng, ns, key2, value);
19040
19040
  }
19041
19041
  }, {
@@ -19057,21 +19057,21 @@ var init_i18next = __esm({
19057
19057
  var options2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
19058
19058
  silent: false
19059
19059
  };
19060
- var path34 = [lng, ns];
19060
+ var path33 = [lng, ns];
19061
19061
  if (lng.indexOf(".") > -1) {
19062
- path34 = lng.split(".");
19062
+ path33 = lng.split(".");
19063
19063
  deep = resources;
19064
19064
  resources = ns;
19065
- ns = path34[1];
19065
+ ns = path33[1];
19066
19066
  }
19067
19067
  this.addNamespaces(ns);
19068
- var pack = getPath(this.data, path34) || {};
19068
+ var pack = getPath(this.data, path33) || {};
19069
19069
  if (deep) {
19070
19070
  deepExtend(pack, resources, overwrite);
19071
19071
  } else {
19072
19072
  pack = _objectSpread$1(_objectSpread$1({}, pack), resources);
19073
19073
  }
19074
- setPath(this.data, path34, pack);
19074
+ setPath(this.data, path33, pack);
19075
19075
  if (!options2.silent) this.emit("added", lng, ns, resources);
19076
19076
  }
19077
19077
  }, {
@@ -19965,10 +19965,10 @@ var init_i18next = __esm({
19965
19965
  }
19966
19966
  var handleFormat = function handleFormat2(key2) {
19967
19967
  if (key2.indexOf(_this.formatSeparator) < 0) {
19968
- var path34 = getPathWithDefaults(data3, defaultData, key2);
19969
- return _this.alwaysFormat ? _this.format(path34, void 0, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options2), data3), {}, {
19968
+ var path33 = getPathWithDefaults(data3, defaultData, key2);
19969
+ return _this.alwaysFormat ? _this.format(path33, void 0, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options2), data3), {}, {
19970
19970
  interpolationkey: key2
19971
- })) : path34;
19971
+ })) : path33;
19972
19972
  }
19973
19973
  var p = key2.split(_this.formatSeparator);
19974
19974
  var k = p.shift().trim();
@@ -20905,6 +20905,9 @@ var init_i18next = __esm({
20905
20905
 
20906
20906
  // ../tools-lib/dist/node.mjs
20907
20907
  import { createHash } from "crypto";
20908
+ import { AsyncLocalStorage } from "async_hooks";
20909
+ import { Agent, globalAgent } from "https";
20910
+ import { Readable as Readable2 } from "stream";
20908
20911
  import * as querystring from "querystring";
20909
20912
  function setPlatform(adapter2) {
20910
20913
  currentPlatform = adapter2;
@@ -20928,6 +20931,77 @@ function getPlatform() {
20928
20931
  }
20929
20932
  return currentPlatform;
20930
20933
  }
20934
+ function createRequestAgent(signal) {
20935
+ const options2 = { ...globalAgent.options, keepAlive: false, timeout: 0, signal };
20936
+ return new Agent(options2);
20937
+ }
20938
+ function withNodeRequestProtection(request22) {
20939
+ return requestProtection.run(true, request22);
20940
+ }
20941
+ async function dispatchNodeRequest(config, dispatch) {
20942
+ if (!requestProtection.getStore() || config.responseType === "stream" || config.data instanceof FormData)
20943
+ return dispatch(config);
20944
+ const caller = config.signal;
20945
+ if (caller?.aborted) throw new CanceledError2();
20946
+ const timeout = config.timeout && config.timeout > 0 ? Math.min(config.timeout, DEFAULT_TIMEOUT_MS) : DEFAULT_TIMEOUT_MS;
20947
+ const controller = new AbortController();
20948
+ const agent = config.httpsAgent === void 0 && config.adapter === void 0 ? createRequestAgent(controller.signal) : void 0;
20949
+ let timer;
20950
+ let cancel;
20951
+ try {
20952
+ const stop = new Promise((_resolve, reject) => {
20953
+ const fail = (error3) => {
20954
+ reject(error3);
20955
+ controller.abort();
20956
+ };
20957
+ cancel = () => fail(new CanceledError2());
20958
+ caller?.addEventListener?.("abort", cancel);
20959
+ timer = setTimeout(() => fail(new AxiosError2("Platform request timed out", AxiosError2.ETIMEDOUT)), timeout);
20960
+ });
20961
+ return await Promise.race([
20962
+ stop,
20963
+ dispatch({ ...config, timeout, signal: controller.signal, ...agent ? { httpsAgent: agent } : {} })
20964
+ ]);
20965
+ } finally {
20966
+ clearTimeout(timer);
20967
+ if (cancel) caller?.removeEventListener?.("abort", cancel);
20968
+ agent?.destroy();
20969
+ }
20970
+ }
20971
+ function closeResponseStream(stream4) {
20972
+ if (stream4 instanceof Readable2 && !stream4.destroyed) stream4.destroy();
20973
+ }
20974
+ async function withNodeStreamRequest(open2, consume) {
20975
+ const controller = new AbortController();
20976
+ const agent = createRequestAgent(controller.signal);
20977
+ let stream4;
20978
+ let timer;
20979
+ try {
20980
+ const deadline = new Promise((_resolve, reject) => {
20981
+ timer = setTimeout(() => {
20982
+ reject(new AxiosError2("Platform stream connection timed out", AxiosError2.ETIMEDOUT));
20983
+ controller.abort();
20984
+ }, DEFAULT_TIMEOUT_MS);
20985
+ });
20986
+ const opening = open2({ signal: controller.signal, httpsAgent: agent }).then(
20987
+ (response) => {
20988
+ if (controller.signal.aborted) closeResponseStream(response);
20989
+ return response;
20990
+ },
20991
+ (error3) => {
20992
+ if (isAxiosError2(error3)) closeResponseStream(error3.response?.data);
20993
+ throw error3;
20994
+ }
20995
+ );
20996
+ stream4 = await Promise.race([opening, deadline]).finally(() => clearTimeout(timer));
20997
+ return await consume(stream4);
20998
+ } finally {
20999
+ clearTimeout(timer);
21000
+ closeResponseStream(stream4);
21001
+ controller.abort();
21002
+ agent.destroy();
21003
+ }
21004
+ }
20931
21005
  function responseField(value, key2) {
20932
21006
  if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
20933
21007
  return Object.getOwnPropertyDescriptor(value, key2)?.value;
@@ -20988,6 +21062,7 @@ function toArrayBuffer(view) {
20988
21062
  function createNodePlatform() {
20989
21063
  return {
20990
21064
  withCredentials: false,
21065
+ dispatchRequest: dispatchNodeRequest,
20991
21066
  getEnv: () => normalizeEnv(process.env.FREELOG_ENV),
20992
21067
  getAuthorization: () => process.env.FREELOG_TOKEN,
20993
21068
  getUserId: () => Number(process.env.FREELOG_UID || -1),
@@ -21354,7 +21429,8 @@ function handleQuery(query) {
21354
21429
  return result ? "?" + result : "";
21355
21430
  }
21356
21431
  async function request(config, { noRedirect = false, noErrorAlert: _noErrorAlert = false } = {}) {
21357
- const result = await axiosInstance.request(config);
21432
+ const dispatch = getPlatform().dispatchRequest;
21433
+ const result = await (dispatch ? dispatch(config, (requestConfig) => axiosInstance.request(requestConfig)) : axiosInstance.request(config));
21358
21434
  const platform = getPlatform();
21359
21435
  if (result.errCode === 30 && !noRedirect) {
21360
21436
  await platform.onAuthError?.({ kind: "unauthorized", result });
@@ -21933,14 +22009,16 @@ function filesListInfo({ ...params }) {
21933
22009
  params
21934
22010
  });
21935
22011
  }
21936
- function filesListInfoSse({ ...params }) {
22012
+ function filesListInfoSse({ ...params }, controls) {
21937
22013
  return utils_default2.Axios.request({
21938
22014
  method: "GET",
21939
22015
  url: `/v2/storages/files/listSSE/info`,
21940
22016
  params,
21941
22017
  responseType: "stream",
21942
22018
  headers: { Accept: "text/event-stream" },
21943
- timeout: 12e4
22019
+ timeout: 12e4,
22020
+ signal: controls?.signal,
22021
+ httpsAgent: controls?.httpsAgent
21944
22022
  });
21945
22023
  }
21946
22024
  function filesInfo({ ...params }) {
@@ -22021,6 +22099,8 @@ function list(params) {
22021
22099
  });
22022
22100
  }
22023
22101
  function info({ resourceIdOrName, ...params }, controls) {
22102
+ if (typeof resourceIdOrName !== "string" || !resourceIdOrName.trim() || ["undefined", "null"].includes(resourceIdOrName.trim()))
22103
+ throw new TypeError("Resource.info requires a valid resource ID or full name");
22024
22104
  return utils_default2.Request({
22025
22105
  method: "GET",
22026
22106
  url: `/v2/resources/${encodeURIComponent(resourceIdOrName)}`,
@@ -23571,7 +23651,7 @@ function createCodeLoginSession(options2 = {}) {
23571
23651
  for (const controller of active) controller.abort();
23572
23652
  active.clear();
23573
23653
  };
23574
- const request22 = async (config) => {
23654
+ async function request22(config, responseCookies = cookies) {
23575
23655
  if (closed) throw new CodeLoginSessionError("LOGIN_SESSION_CLOSED");
23576
23656
  const url2 = new URL(config.url ?? "", base);
23577
23657
  if (url2.origin !== base.origin || !["GET", "POST"].includes(config.method ?? ""))
@@ -23603,8 +23683,11 @@ function createCodeLoginSession(options2 = {}) {
23603
23683
  const separator = pair?.indexOf("=") ?? -1;
23604
23684
  if (!pair || separator < 1) continue;
23605
23685
  const name = pair.slice(0, separator);
23606
- if (/;\s*max-age\s*=\s*0\s*(?:;|$)/i.test(item) || pair.slice(separator + 1) === "") cookies.delete(name);
23607
- else cookies.set(name, pair);
23686
+ if (/;\s*max-age\s*=\s*0\s*(?:;|$)/i.test(item) || pair.slice(separator + 1) === "") {
23687
+ responseCookies.delete(name);
23688
+ } else {
23689
+ responseCookies.set(name, pair);
23690
+ }
23608
23691
  }
23609
23692
  return result;
23610
23693
  };
@@ -23632,8 +23715,8 @@ function createCodeLoginSession(options2 = {}) {
23632
23715
  if (timer !== void 0) clearTimeout(timer);
23633
23716
  active.delete(controller);
23634
23717
  }
23635
- };
23636
- const transport = { request: request22 };
23718
+ }
23719
+ const transport = { request: (config) => request22(config) };
23637
23720
  return {
23638
23721
  lookupUser: (params) => userDetails(params, transport),
23639
23722
  getImageCaptcha: async () => {
@@ -23645,17 +23728,24 @@ function createCodeLoginSession(options2 = {}) {
23645
23728
  verifyImageCaptcha: (captchaInput) => verifyImageCaptcha({ captchaKey: "login", captchaInput }, transport),
23646
23729
  sendCode: (loginName, captchaInput) => sendCodeWithImageCaptcha({ loginName, captchaInput, authCodeType: "login" }, transport),
23647
23730
  login: async (loginName, loginCode) => {
23648
- const envelope = await loginByCode({ loginName, loginCode, isRemember: 1 }, transport);
23649
- const cookie = [...cookies.entries()].filter(([name]) => name.toLowerCase() !== "captcha-login").map(([, pair]) => pair).join("; ");
23731
+ const responseCookies = /* @__PURE__ */ new Map();
23732
+ const envelope = await loginByCode(
23733
+ { loginName, loginCode, isRemember: 1 },
23734
+ {
23735
+ request: (config) => request22(config, responseCookies)
23736
+ }
23737
+ );
23738
+ const cookie = [...responseCookies.entries()].filter(([name]) => name.toLowerCase() !== "captcha-login").map(([, pair]) => pair).join("; ");
23650
23739
  return { envelope, ...cookie ? { cookie } : {} };
23651
23740
  },
23652
23741
  close
23653
23742
  };
23654
23743
  }
23655
- var import_dayjs, __defProp2, __export2, currentPlatform, ApiResponseError, i18nCache, locale, format_exports, domain_exports, ENV_SUFFIX, STATIC_ORIGIN, IMAGE_ORIGIN, regexp_exports, EXHIBIT_NAME, RESOURCE_NAME, RESOURCE_TYPE, CUSTOM_KEY, NODE_NAME, NODE_DOMAIN, PAY_PASSWORD, MOBILE_PHONE_NUMBER, EMAIL_ADDRESS, USERNAME, PASSWORD, NATURAL_NUMBER, POSITIVE_INTEGER, MAX_2_DECIMAL_POSITIVE_NUMBER, BUCKET_NAME, JS_VARIABLE_NAME, DATE, DATE_TIME, linkTo_exports, predefined_exports, resourceTypes, pageSize, momentDateFormat, momentDateTimeFormat, EnumContractPartyIdentityType, EnumSubjectType, EnumContractStatus, axiosInstance, axios_default2, tools_exports, getUserId, FUtil, utils_default2, nodes_exports, presentables_exports, storages_exports, collections_exports, resources_exports, user_exports, informalNodes_exports, contracts_exports, transactions_exports, captcha_exports, events_exports, activities_exports, ADS_LIST_PATH, testQualifications_exports, statistics_exports, i18n_exports, policies_exports, recombinations_exports, operation_exports, resourceType_exports, payment_exports, rss_exports, FServiceAPI, service_API_default, ossJsonUrl, ossJsonUrl_Test, allLanguage, resourceClient, I18nNextCore, console_catalog_default, NodeI18nNext, CodeLoginSessionError, i18nNext, FI18n;
23744
+ var import_dayjs, __defProp2, __export2, currentPlatform, requestProtection, DEFAULT_TIMEOUT_MS, ApiResponseError, i18nCache, locale, format_exports, domain_exports, ENV_SUFFIX, STATIC_ORIGIN, IMAGE_ORIGIN, regexp_exports, EXHIBIT_NAME, RESOURCE_NAME, RESOURCE_TYPE, CUSTOM_KEY, NODE_NAME, NODE_DOMAIN, PAY_PASSWORD, MOBILE_PHONE_NUMBER, EMAIL_ADDRESS, USERNAME, PASSWORD, NATURAL_NUMBER, POSITIVE_INTEGER, MAX_2_DECIMAL_POSITIVE_NUMBER, BUCKET_NAME, JS_VARIABLE_NAME, DATE, DATE_TIME, linkTo_exports, predefined_exports, resourceTypes, pageSize, momentDateFormat, momentDateTimeFormat, EnumContractPartyIdentityType, EnumSubjectType, EnumContractStatus, axiosInstance, axios_default2, tools_exports, getUserId, FUtil, utils_default2, nodes_exports, presentables_exports, storages_exports, collections_exports, resources_exports, user_exports, informalNodes_exports, contracts_exports, transactions_exports, captcha_exports, events_exports, activities_exports, ADS_LIST_PATH, testQualifications_exports, statistics_exports, i18n_exports, policies_exports, recombinations_exports, operation_exports, resourceType_exports, payment_exports, rss_exports, FServiceAPI, service_API_default, ossJsonUrl, ossJsonUrl_Test, allLanguage, resourceClient, I18nNextCore, console_catalog_default, NodeI18nNext, CodeLoginSessionError, i18nNext, FI18n;
23656
23745
  var init_node2 = __esm({
23657
23746
  "../tools-lib/dist/node.mjs"() {
23658
23747
  "use strict";
23748
+ init_axios2();
23659
23749
  import_dayjs = __toESM(require_dayjs_min(), 1);
23660
23750
  init_axios2();
23661
23751
  init_i18next();
@@ -23667,6 +23757,8 @@ var init_node2 = __esm({
23667
23757
  __defProp2(target, name, { get: all3[name], enumerable: true });
23668
23758
  };
23669
23759
  currentPlatform = null;
23760
+ requestProtection = new AsyncLocalStorage();
23761
+ DEFAULT_TIMEOUT_MS = 3e4;
23670
23762
  ApiResponseError = class extends Error {
23671
23763
  constructor(message, result, errCode) {
23672
23764
  super(message);
@@ -24455,7 +24547,7 @@ var init_node2 = __esm({
24455
24547
  };
24456
24548
  console_catalog_default = {
24457
24549
  source: "https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs-test/i18n.json",
24458
- fetchedAt: "2026-11-17T10:02:56.484Z",
24550
+ fetchedAt: "2026-11-23T02:29:32.696Z",
24459
24551
  entryCount: 2999,
24460
24552
  sha256: "6aed2fb956f1eeeb4a4693ecc50332e376370d0e4c8a2197dcf888ca3fd2f301",
24461
24553
  translations: {
@@ -36649,6 +36741,8 @@ function getNode({ nodeId: nodeId22 }, controls) {
36649
36741
  return platformRequest({ method: "GET", url: `/v2/nodes/${nodeId22}`, ...controls });
36650
36742
  }
36651
36743
  function getResource({ resourceIdOrName, ...params }, controls) {
36744
+ if (typeof resourceIdOrName !== "string" || !resourceIdOrName.trim() || ["undefined", "null"].includes(resourceIdOrName.trim()))
36745
+ throw new AuthCliError("\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u8D44\u6E90ID\u6216\u5B8C\u6574\u540D\u79F0", "INVALID_SCENE_PARAMS");
36652
36746
  return platformRequest({
36653
36747
  method: "GET",
36654
36748
  url: `/v2/resources/${encodeURIComponent(String(resourceIdOrName))}`,
@@ -36705,12 +36799,16 @@ async function loadNode(input22) {
36705
36799
  };
36706
36800
  }
36707
36801
  async function showResource(input22) {
36708
- const source = input22.source.replace(/^(id:|name:)/u, "");
36802
+ const source = typeof input22.source === "string" ? input22.source.replace(/^(id:|name:)/u, "") : "";
36803
+ if (!source.trim() || ["undefined", "null"].includes(source.trim()))
36804
+ throw new AuthCommandError("\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u8D44\u6E90ID\u6216\u5B8C\u6574\u540D\u79F0", "RESOURCE_ID_INVALID", { category: "input" });
36709
36805
  const raw = await request2(
36710
36806
  input22.apis?.resourceInfo ?? getResource,
36711
36807
  { resourceIdOrName: source, isLoadLatestVersionInfo: 1, isLoadPolicyInfo: 1 },
36712
36808
  "MARKET_RESOURCE_INVALID"
36713
36809
  );
36810
+ if (raw === null)
36811
+ throw new AuthCommandError("\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID\u6216\u540D\u79F0", "RESOURCE_NOT_FOUND", { category: "not_found" });
36714
36812
  if (!object(raw) || typeof raw.resourceId !== "string" || !raw.resourceId || raw.subjectType !== 1 && raw.subjectType !== 4 || typeof raw.resourceTypeCode !== "string" || !raw.resourceTypeCode || !Array.isArray(raw.policies))
36715
36813
  throw new AuthCommandError("\u8D44\u6E90\u4E0D\u5B58\u5728\u6216\u7F3A\u5C11\u521B\u5EFA\u6240\u9700\u4FE1\u606F", "MARKET_RESOURCE_INVALID", { category: "other" });
36716
36814
  return {
@@ -36832,7 +36930,9 @@ async function collectNonInteractiveForm(input22) {
36832
36930
  defaults3.exhibitTitle,
36833
36931
  input22.presentableTitle ?? defaults3.exhibitTitle
36834
36932
  );
36835
- const nameRaw = input22.presentableName?.trim() ? input22.presentableName : defaults3.exhibitName;
36933
+ if (input22.presentableName !== void 0 && !input22.presentableName.trim())
36934
+ throw new AuthCliError("\u5C55\u54C1\u6388\u6743\u6807\u8BC6\u987B 1 \u81F3 60 \u5B57", "EXHIBIT_NAME_INVALID");
36935
+ const nameRaw = input22.presentableName === void 0 ? defaults3.exhibitName : input22.presentableName;
36836
36936
  const presentableName = validateExhibitFields("ok", nameRaw).presentableName;
36837
36937
  await resolveAvailablePresentableName({
36838
36938
  http: input22.http,
@@ -36870,6 +36970,8 @@ async function collectResourceToNodeForm(input22) {
36870
36970
  }
36871
36971
  const defaults3 = buildFormDefaults(input22.ctx.resource);
36872
36972
  const presentableTitle = await promptTitle(input22.prompts, defaults3.exhibitTitle, input22.presentableTitle);
36973
+ if (input22.presentableName !== void 0 && !input22.presentableName.trim())
36974
+ throw new AuthCliError("\u5C55\u54C1\u6388\u6743\u6807\u8BC6\u987B 1 \u81F3 60 \u5B57", "EXHIBIT_NAME_INVALID");
36873
36975
  const nameDefault = input22.presentableName ?? defaults3.exhibitName;
36874
36976
  const initialName = input22.presentableName === void 0 ? await promptNameOnce(input22.prompts, nameDefault) : validateExhibitFields(presentableTitle, input22.presentableName).presentableName;
36875
36977
  const presentableName = await resolveAvailablePresentableName({
@@ -37067,6 +37169,8 @@ async function submitSigning(input22, context5, form) {
37067
37169
  }
37068
37170
  async function runResourceToNode(input22) {
37069
37171
  try {
37172
+ if (input22.name !== void 0 && !input22.name.trim())
37173
+ throw new AuthCliError("\u5C55\u54C1\u6388\u6743\u6807\u8BC6\u987B 1 \u81F3 60 \u5B57", "EXHIBIT_NAME_INVALID");
37070
37174
  const node2 = await loadNode({ ...input22, node: await chooseNode(input22, input22.node) });
37071
37175
  const loaded = await loadSigningContext(input22, node2);
37072
37176
  if ("reused" in loaded) return loaded;
@@ -37204,6 +37308,7 @@ var init_dist = __esm({
37204
37308
  });
37205
37309
 
37206
37310
  // src/platform/api.ts
37311
+ var FServiceAPI2;
37207
37312
  var init_api = __esm({
37208
37313
  "src/platform/api.ts"() {
37209
37314
  "use strict";
@@ -37212,6 +37317,18 @@ var init_api = __esm({
37212
37317
  init_node2();
37213
37318
  init_node2();
37214
37319
  init_node2();
37320
+ init_node2();
37321
+ FServiceAPI2 = Object.fromEntries(
37322
+ Object.entries(service_API_default).map(([name, service]) => [
37323
+ name,
37324
+ Object.fromEntries(
37325
+ Object.entries(service).map(([key2, member]) => [
37326
+ key2,
37327
+ typeof member === "function" ? (...args) => withNodeRequestProtection(() => Reflect.apply(Reflect.get(service, key2), service, args)) : member
37328
+ ])
37329
+ )
37330
+ ])
37331
+ );
37215
37332
  }
37216
37333
  });
37217
37334
 
@@ -37265,6 +37382,7 @@ function platformFailureMessage(error3, fallback, options2) {
37265
37382
  function platformRejectionDescription(error3) {
37266
37383
  const failure = apiFailureDetails(error3);
37267
37384
  if (failure?.kind !== "rejected") return void 0;
37385
+ if (failure.errCode === 30) return { code: "PLATFORM_UNAUTHORIZED", message: "\u767B\u5F55\u72B6\u6001\u65E0\u6548\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55" };
37268
37386
  return {
37269
37387
  code: "PLATFORM_REQUEST_REJECTED",
37270
37388
  message: safePlatformMessage(failure.message) ?? "\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u672C\u6B21\u8BF7\u6C42\uFF0C\u8BF7\u68C0\u67E5\u64CD\u4F5C\u6761\u4EF6"
@@ -37348,6 +37466,7 @@ var init_errorOutcome = __esm({
37348
37466
  "LOGIN_PHONE_INVALID",
37349
37467
  "LOGIN_EMAIL_INVALID",
37350
37468
  "NODE_RESOURCE_SELECTOR_UNSUPPORTED",
37469
+ "NODE_PAGE_INVALID",
37351
37470
  "EXHIBIT_RESOURCE_SELECTOR_UNSUPPORTED",
37352
37471
  "RESOURCE_INFO_TARGET_CONFLICT",
37353
37472
  "RESOURCE_INFO_TARGET_REQUIRED",
@@ -37403,6 +37522,7 @@ var init_errorOutcome = __esm({
37403
37522
  ],
37404
37523
  rejected: [
37405
37524
  "PLATFORM_REQUEST_REJECTED",
37525
+ "CREATE_REJECTED",
37406
37526
  "SUBMIT_FAILED",
37407
37527
  "UPDATE_FAILED",
37408
37528
  "DESCRIPTION_FAILED",
@@ -37424,6 +37544,7 @@ var init_errorOutcome = __esm({
37424
37544
  "EXHIBIT_AUTHORIZATION_REJECTED"
37425
37545
  ],
37426
37546
  result_unknown: [
37547
+ "CREATE_RESULT_UNKNOWN",
37427
37548
  "SUBMIT_RESULT_UNKNOWN",
37428
37549
  "SUBMIT_VERIFY_FAILED",
37429
37550
  "UPDATE_RESULT_UNKNOWN",
@@ -37544,6 +37665,42 @@ var init_errors = __esm({
37544
37665
  }
37545
37666
  });
37546
37667
 
37668
+ // src/platform/os/interactive-terminal.mjs
37669
+ import { PassThrough } from "stream";
37670
+ function prepareInteractiveTerminal({
37671
+ platform = process.platform,
37672
+ input: input3 = process.stdin,
37673
+ output: output5 = process.stdout,
37674
+ env = process.env
37675
+ } = {}) {
37676
+ if (platform === "win32" && input3.isTTY && output5.isTTY && env.TERM === "dumb") {
37677
+ delete env.TERM;
37678
+ }
37679
+ }
37680
+ async function withTerminalInput(question, { platform = process.platform, input: input3 = process.stdin } = {}) {
37681
+ if (platform !== "win32" || !input3.isTTY) return question(void 0);
37682
+ const bridge = new PassThrough();
37683
+ const raw = input3.isRaw;
37684
+ const flowing = input3.readableFlowing === true;
37685
+ try {
37686
+ input3.setRawMode(true);
37687
+ input3.pipe(bridge);
37688
+ return await question(bridge);
37689
+ } finally {
37690
+ input3.unpipe(bridge);
37691
+ if (flowing) input3.resume();
37692
+ else input3.pause();
37693
+ bridge.destroy();
37694
+ await new Promise((resolve) => setImmediate(resolve));
37695
+ input3.setRawMode(raw);
37696
+ }
37697
+ }
37698
+ var init_interactive_terminal = __esm({
37699
+ "src/platform/os/interactive-terminal.mjs"() {
37700
+ "use strict";
37701
+ }
37702
+ });
37703
+
37547
37704
  // src/domain/env.ts
37548
37705
  function normalizeEnvToken(raw) {
37549
37706
  const value = raw.trim().toLowerCase();
@@ -37567,7 +37724,7 @@ function resolveEnv(input3 = {}) {
37567
37724
  if (fromProcess !== void 0 && fromProcess !== "") {
37568
37725
  return normalizeEnvToken(fromProcess);
37569
37726
  }
37570
- return "prod";
37727
+ return DEFAULT_ENV;
37571
37728
  }
37572
37729
  function applyCliEnv(input3 = {}) {
37573
37730
  activeEnv = resolveEnv(input3);
@@ -37582,12 +37739,13 @@ function assertPlatformAllowed(env = activeEnv) {
37582
37739
  }
37583
37740
  return env;
37584
37741
  }
37585
- var activeEnv;
37742
+ var DEFAULT_ENV, activeEnv;
37586
37743
  var init_env = __esm({
37587
37744
  "src/domain/env.ts"() {
37588
37745
  "use strict";
37589
37746
  init_errors();
37590
- activeEnv = "prod";
37747
+ DEFAULT_ENV = "dev";
37748
+ activeEnv = DEFAULT_ENV;
37591
37749
  }
37592
37750
  });
37593
37751
 
@@ -37989,7 +38147,7 @@ function addSharedOptions(command) {
37989
38147
  command,
37990
38148
  "--env <env>",
37991
38149
  // i18n: cli.flag.env
37992
- "\u73AF\u5883"
38150
+ "\u73AF\u5883\uFF08\u672A\u6307\u5B9A\u65F6\u8BFB\u53D6 FREELOG_ENV\uFF0C\u65E0\u914D\u7F6E\u65F6\u9ED8\u8BA4 dev\uFF09"
37993
38151
  );
37994
38152
  command.option(
37995
38153
  "--yes",
@@ -38043,6 +38201,9 @@ import {
38043
38201
  input as inquirerInput,
38044
38202
  select as inquirerSelect
38045
38203
  } from "@inquirer/prompts";
38204
+ function promptContext(input3, output5) {
38205
+ return input3 || output5 ? { ...input3 ? { input: input3 } : {}, ...output5 ? { output: output5 } : {} } : void 0;
38206
+ }
38046
38207
  function isInteractive() {
38047
38208
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
38048
38209
  }
@@ -38050,23 +38211,23 @@ async function confirmQuestion(message, defaultYes = true, output5) {
38050
38211
  if (!isInteractive()) {
38051
38212
  return defaultYes;
38052
38213
  }
38053
- return inquirerConfirm({ message, default: defaultYes }, output5 ? { output: output5 } : void 0);
38214
+ return withTerminalInput((input3) => inquirerConfirm({ message, default: defaultYes }, promptContext(input3, output5)));
38054
38215
  }
38055
38216
  async function askInput(message, output5) {
38056
38217
  if (!isInteractive()) {
38057
38218
  throw new CliError("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u663E\u5F0F\u63D0\u4F9B\u5FC5\u9700\u53C2\u6570", "TTY_REQUIRED");
38058
38219
  }
38059
- return inquirerInput({ message }, output5 ? { output: output5 } : void 0);
38220
+ return withTerminalInput((input3) => inquirerInput({ message }, promptContext(input3, output5)));
38060
38221
  }
38061
38222
  async function selectQuestion(message, choices, output5) {
38062
38223
  if (!isInteractive()) {
38063
38224
  throw new CliError("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u663E\u5F0F\u63D0\u4F9B\u9009\u62E9\u9879", "TTY_REQUIRED");
38064
38225
  }
38065
- return inquirerSelect({ message, choices }, output5 ? { output: output5 } : void 0);
38226
+ return withTerminalInput((input3) => inquirerSelect({ message, choices }, promptContext(input3, output5)));
38066
38227
  }
38067
38228
  async function selectMany(message, choices, output5) {
38068
38229
  if (!isInteractive()) throw new CliError("\u975E\u4EA4\u4E92\u6A21\u5F0F\u9700\u663E\u5F0F\u63D0\u4F9B\u9009\u9879\u53C2\u6570", "TTY_REQUIRED");
38069
- return inquirerCheckbox({ message, choices }, output5 ? { output: output5 } : void 0);
38230
+ return withTerminalInput((input3) => inquirerCheckbox({ message, choices }, promptContext(input3, output5)));
38070
38231
  }
38071
38232
  async function confirmWrite(preview2, yes, output5) {
38072
38233
  if (yes) {
@@ -38096,6 +38257,7 @@ var init_tty = __esm({
38096
38257
  "src/core/tty.ts"() {
38097
38258
  "use strict";
38098
38259
  init_errors();
38260
+ init_interactive_terminal();
38099
38261
  }
38100
38262
  });
38101
38263
 
@@ -38114,6 +38276,40 @@ var init_passwordInput = __esm({
38114
38276
  }
38115
38277
  });
38116
38278
 
38279
+ // src/domain/account/loginRejection.ts
38280
+ function exactEnvelope(value, errCode, data3) {
38281
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
38282
+ const envelope = value;
38283
+ return envelope.ret === 0 && envelope.errCode === errCode && (envelope.errcode === void 0 || envelope.errcode === errCode) && envelope.data === data3 ? envelope : void 0;
38284
+ }
38285
+ function isRejectedImageCaptcha(value) {
38286
+ return exactEnvelope(value, 0, false) !== void 0;
38287
+ }
38288
+ function isRejectedLoginCode(value) {
38289
+ const reason = exactEnvelope(value, 2, null)?.msg;
38290
+ return reason === "auth-code-error-or-expired" || reason === "\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F";
38291
+ }
38292
+ function passwordRejection(value) {
38293
+ const reason = exactEnvelope(value, 30, null)?.msg;
38294
+ if (reason === "\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF") return new PasswordLoginRejected(reason);
38295
+ if (reason === "Msg_101") return new PasswordLoginRejected(FI18n.i18nNext.t("flw_login_error_incorrectunopw"));
38296
+ return void 0;
38297
+ }
38298
+ var MAX_LOGIN_ATTEMPTS, PasswordLoginRejected;
38299
+ var init_loginRejection = __esm({
38300
+ "src/domain/account/loginRejection.ts"() {
38301
+ "use strict";
38302
+ init_errors();
38303
+ init_api();
38304
+ MAX_LOGIN_ATTEMPTS = 3;
38305
+ PasswordLoginRejected = class extends CliError {
38306
+ constructor(message) {
38307
+ super(message, "LOGIN_FAILED");
38308
+ }
38309
+ };
38310
+ }
38311
+ });
38312
+
38117
38313
  // src/domain/account/loginCredentials.ts
38118
38314
  import os2 from "os";
38119
38315
  import { existsSync as existsSync2 } from "fs";
@@ -38188,6 +38384,8 @@ function loginFailed() {
38188
38384
  }
38189
38385
  async function loginWithInjectedApi(loginApi, loginName, password2) {
38190
38386
  const result = await loginApi({ loginName, password: password2 });
38387
+ const rejection = passwordRejection(result);
38388
+ if (rejection) throw rejection;
38191
38389
  return parseLoginCredentials(result, { secrets: [password2], redact: [loginName] });
38192
38390
  }
38193
38391
  async function loginWithPlatformApi(loginName, password2, timeoutMs) {
@@ -38211,6 +38409,8 @@ async function loginWithPlatformApi(loginName, password2, timeoutMs) {
38211
38409
  if (reason) throw new CliError(reason, "LOGIN_FAILED");
38212
38410
  throw loginFailed();
38213
38411
  }
38412
+ const rejection = response.status === 200 ? passwordRejection(envelope) : void 0;
38413
+ if (rejection) throw rejection;
38214
38414
  const credentials = parseLoginCredentials(envelope, messageOptions);
38215
38415
  return {
38216
38416
  ...credentials,
@@ -38300,6 +38500,7 @@ var init_login = __esm({
38300
38500
  init_platformError();
38301
38501
  init_passwordInput();
38302
38502
  init_env();
38503
+ init_loginRejection();
38303
38504
  init_loginCredentials();
38304
38505
  LOGIN_TIMEOUT_MS = 15e3;
38305
38506
  }
@@ -38400,33 +38601,83 @@ async function request3(operation, messageOptions) {
38400
38601
  function normalizeCaptcha(value) {
38401
38602
  return value.replace(/[\uff01-\uff5e]/gu, (character) => String.fromCharCode(character.charCodeAt(0) - 65248)).replace(/\u3000/gu, " ").trim();
38402
38603
  }
38604
+ async function confirmLoginName(session, initialName, input3, env) {
38605
+ const assertContext2 = () => {
38606
+ if (getEnv2() !== env) throw new CliError("\u767B\u5F55\u671F\u95F4\u73AF\u5883\u5DF2\u6539\u53D8\uFF0C\u672A\u4FDD\u5B58\u51ED\u636E\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C\u767B\u5F55", "LOGIN_ENV_CHANGED");
38607
+ assertLoginTargetAvailable(input3);
38608
+ };
38609
+ let loginName = initialName;
38610
+ for (let attempt = 1; ; attempt++) {
38611
+ assertContext2();
38612
+ if (!loginName) throw new CliError("\u8BF7\u8F93\u5165\u767B\u5F55\u540D", "LOGIN_NAME_REQUIRED");
38613
+ try {
38614
+ await verifyCodeLoginName(loginName, (params) => session.lookupUser(params));
38615
+ } catch (error3) {
38616
+ if (!input3.readLoginNameAgain || attempt >= MAX_LOGIN_ATTEMPTS || !(error3 instanceof CliError) || !CORRECTABLE_LOGIN_NAMES.has(error3.code ?? ""))
38617
+ throw error3;
38618
+ input3.interaction.reportRetry?.(
38619
+ `${error3.message}\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u767B\u5F55\u540D\uFF08\u8FD8\u53EF\u5C1D\u8BD5 ${MAX_LOGIN_ATTEMPTS - attempt} \u6B21\uFF09\u3002`
38620
+ );
38621
+ loginName = (await input3.readLoginNameAgain()).trim();
38622
+ continue;
38623
+ }
38624
+ assertContext2();
38625
+ return loginName;
38626
+ }
38627
+ }
38628
+ async function verifyCaptcha(session, loginName, interaction) {
38629
+ for (let attempt = 1; ; attempt++) {
38630
+ await interaction.showCaptcha(await request3(() => session.getImageCaptcha()));
38631
+ const captcha = normalizeCaptcha(await interaction.readCaptcha());
38632
+ if (!captcha) throw new CliError("\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801", "LOGIN_CAPTCHA_REQUIRED");
38633
+ const result = await request3(() => session.verifyImageCaptcha(captcha), {
38634
+ secrets: [captcha],
38635
+ redact: [loginName]
38636
+ });
38637
+ if (successfulEnvelope(result)?.data === true) return captcha;
38638
+ if (isRejectedImageCaptcha(result) && attempt < MAX_LOGIN_ATTEMPTS && interaction.reportRetry) {
38639
+ interaction.reportRetry("\u56FE\u5F62\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u67E5\u770B\u65B0\u56FE\u540E\u91CD\u65B0\u8F93\u5165\u3002");
38640
+ continue;
38641
+ }
38642
+ const reason = codeLoginRejectionMessage(result, loginName, [captcha]);
38643
+ throw new CliError(`${reason ?? "\u56FE\u5F62\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F"}\uFF0C\u672A\u53D1\u9001\u9A8C\u8BC1\u7801\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C\u767B\u5F55`, "LOGIN_CAPTCHA_INVALID");
38644
+ }
38645
+ }
38646
+ async function authenticateCode(session, input3, loginName, captcha, address, env) {
38647
+ for (let attempt = 1; ; attempt++) {
38648
+ let loginCode = await input3.interaction.readCode(address);
38649
+ try {
38650
+ if (!/^\d{6}$/u.test(loginCode)) throw new CliError("\u8BF7\u8F93\u5165\u516D\u4F4D\u6570\u5B57\u9A8C\u8BC1\u7801", "LOGIN_CODE_INVALID");
38651
+ const messageOptions = { secrets: [captcha, loginCode], redact: [loginName] };
38652
+ const result = await request3(() => session.login(loginName, loginCode), messageOptions);
38653
+ if (isRejectedLoginCode(result.envelope)) {
38654
+ if (attempt < MAX_LOGIN_ATTEMPTS && input3.interaction.reportRetry) {
38655
+ input3.interaction.reportRetry(
38656
+ `\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\uFF08\u8FD8\u53EF\u5C1D\u8BD5 ${MAX_LOGIN_ATTEMPTS - attempt} \u6B21\uFF09\u3002\u82E5\u5DF2\u8FC7\u671F\uFF0C\u6309 Ctrl+C \u540E\u91CD\u65B0\u767B\u5F55\u3002`
38657
+ );
38658
+ continue;
38659
+ }
38660
+ throw new CliError("\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C\u767B\u5F55\u83B7\u53D6\u65B0\u9A8C\u8BC1\u7801", "LOGIN_FAILED");
38661
+ }
38662
+ const credentials = parseLoginCredentials(result.envelope, messageOptions);
38663
+ return saveLoginCredentials(input3, { ...credentials, ...result.cookie ? { cookie: result.cookie } : {} }, env);
38664
+ } finally {
38665
+ loginCode = "";
38666
+ }
38667
+ }
38668
+ }
38403
38669
  async function loginByCodeAccount(input3) {
38404
38670
  const env = assertPlatformAllowed(getEnv2());
38405
38671
  assertLoginTargetAvailable(input3);
38406
- const loginName = input3.loginName.trim();
38407
- if (!loginName) throw new CliError("\u8BF7\u63D0\u4F9B --login-name", "LOGIN_NAME_REQUIRED");
38672
+ const initialName = input3.loginName.trim();
38673
+ if (!initialName) throw new CliError("\u8BF7\u63D0\u4F9B --login-name", "LOGIN_NAME_REQUIRED");
38408
38674
  let session;
38409
38675
  try {
38410
38676
  session = await request3(async () => (input3.sessionFactory ?? createCodeLoginSession)());
38411
38677
  const currentSession = session;
38412
- await verifyCodeLoginName(loginName, (params) => currentSession.lookupUser(params));
38413
- const svg = await request3(() => currentSession.getImageCaptcha());
38414
- await input3.interaction.showCaptcha(svg);
38415
- let captchaInput = normalizeCaptcha(await input3.interaction.readCaptcha());
38416
- if (!captchaInput) throw new CliError("\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801", "LOGIN_CAPTCHA_REQUIRED");
38678
+ const loginName = await confirmLoginName(currentSession, initialName, input3, env);
38679
+ let captchaInput = await verifyCaptcha(currentSession, loginName, input3.interaction);
38417
38680
  try {
38418
- const verification = await request3(() => currentSession.verifyImageCaptcha(captchaInput), {
38419
- secrets: [captchaInput],
38420
- redact: [loginName]
38421
- });
38422
- const verified = successfulEnvelope(verification);
38423
- if (verified?.data !== true) {
38424
- const reason = codeLoginRejectionMessage(verification, loginName, [captchaInput]);
38425
- throw new CliError(
38426
- `${reason ?? "\u56FE\u5F62\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F"}\uFF0C\u672A\u53D1\u9001\u9A8C\u8BC1\u7801\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C\u767B\u5F55`,
38427
- "LOGIN_CAPTCHA_INVALID"
38428
- );
38429
- }
38430
38681
  const sending = await request3(() => currentSession.sendCode(loginName, captchaInput), {
38431
38682
  secrets: [captchaInput],
38432
38683
  redact: [loginName]
@@ -38439,27 +38690,7 @@ async function loginByCodeAccount(input3) {
38439
38690
  throw new CliError(reason ?? fallback, "LOGIN_CODE_SEND_FAILED");
38440
38691
  }
38441
38692
  const address = typeof data3?.address === "string" ? data3.address.trim() || void 0 : void 0;
38442
- let loginCode = await input3.interaction.readCode(address);
38443
- try {
38444
- if (!/^\d{6}$/u.test(loginCode)) throw new CliError("\u8BF7\u8F93\u5165\u516D\u4F4D\u6570\u5B57\u9A8C\u8BC1\u7801", "LOGIN_CODE_INVALID");
38445
- const result = await request3(() => currentSession.login(loginName, loginCode), {
38446
- secrets: [captchaInput, loginCode],
38447
- redact: [loginName]
38448
- });
38449
- const reason = codeLoginRejectionMessage(result.envelope, loginName, [captchaInput, loginCode]);
38450
- if (reason) throw new CliError(reason, "LOGIN_FAILED");
38451
- const credentials = parseLoginCredentials(result.envelope, {
38452
- secrets: [captchaInput, loginCode],
38453
- redact: [loginName]
38454
- });
38455
- return saveLoginCredentials(
38456
- input3,
38457
- { ...credentials, ...result.cookie ? { cookie: result.cookie } : {} },
38458
- env
38459
- );
38460
- } finally {
38461
- loginCode = "";
38462
- }
38693
+ return await authenticateCode(currentSession, input3, loginName, captchaInput, address, env);
38463
38694
  } finally {
38464
38695
  captchaInput = "";
38465
38696
  }
@@ -38467,6 +38698,7 @@ async function loginByCodeAccount(input3) {
38467
38698
  session?.close();
38468
38699
  }
38469
38700
  }
38701
+ var CORRECTABLE_LOGIN_NAMES;
38470
38702
  var init_loginByCode = __esm({
38471
38703
  "src/domain/account/loginByCode.ts"() {
38472
38704
  "use strict";
@@ -38475,8 +38707,10 @@ var init_loginByCode = __esm({
38475
38707
  init_platformError();
38476
38708
  init_codeLoginMessages();
38477
38709
  init_codeLoginName();
38710
+ init_loginRejection();
38478
38711
  init_env();
38479
38712
  init_loginCredentials();
38713
+ CORRECTABLE_LOGIN_NAMES = /* @__PURE__ */ new Set(["LOGIN_PHONE_INVALID", "LOGIN_EMAIL_INVALID", "LOGIN_ACCOUNT_NOT_FOUND"]);
38480
38714
  }
38481
38715
  });
38482
38716
 
@@ -38618,6 +38852,53 @@ var init_captchaImage = __esm({
38618
38852
  }
38619
38853
  });
38620
38854
 
38855
+ // src/adapters/terminalInteraction.ts
38856
+ async function terminalQuestion(question) {
38857
+ try {
38858
+ return await question();
38859
+ } catch (error3) {
38860
+ if (error3 instanceof Error && ["ExitPromptError", "AbortPromptError"].includes(error3.name))
38861
+ throw new CliError("\u5DF2\u53D6\u6D88\u64CD\u4F5C", "CANCELLED");
38862
+ throw error3;
38863
+ }
38864
+ }
38865
+ function terminalInputQuestion(prompt2, config) {
38866
+ return terminalQuestion(() => withTerminalInput((input3) => input3 ? prompt2(config, { input: input3 }) : prompt2(config)));
38867
+ }
38868
+ var terminalPrompts, terminalReporter;
38869
+ var init_terminalInteraction = __esm({
38870
+ "src/adapters/terminalInteraction.ts"() {
38871
+ "use strict";
38872
+ init_tty();
38873
+ init_errors();
38874
+ init_interactive_terminal();
38875
+ terminalPrompts = Object.freeze({
38876
+ isInteractive: () => isInteractive(),
38877
+ askInput: (message, channel) => terminalQuestion(
38878
+ () => channel ? askInput(message, channel === "stderr" ? process.stderr : process.stdout) : askInput(message)
38879
+ ),
38880
+ selectQuestion: (message, choices, channel) => terminalQuestion(
38881
+ () => channel ? selectQuestion(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectQuestion(message, [...choices])
38882
+ ),
38883
+ selectMany: (message, choices, channel) => terminalQuestion(
38884
+ () => channel ? selectMany(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectMany(message, [...choices])
38885
+ ),
38886
+ confirmQuestion: (message, defaultYes, channel) => terminalQuestion(
38887
+ () => channel ? confirmQuestion(message, defaultYes, channel === "stderr" ? process.stderr : process.stdout) : confirmQuestion(message, defaultYes)
38888
+ ),
38889
+ confirmWrite: (preview2, yes, channel) => terminalQuestion(
38890
+ () => channel ? confirmWrite(preview2, yes, channel === "stderr" ? process.stderr : process.stdout) : confirmWrite(preview2, yes)
38891
+ ),
38892
+ confirmDestructive: (...args) => terminalQuestion(() => confirmDestructive(...args))
38893
+ });
38894
+ terminalReporter = Object.freeze({
38895
+ log: (message) => console.log(message),
38896
+ warn: (message) => console.warn(message),
38897
+ error: (message) => console.error(message)
38898
+ });
38899
+ }
38900
+ });
38901
+
38621
38902
  // src/adapters/accountLogin.ts
38622
38903
  import { input as input2, password } from "@inquirer/prompts";
38623
38904
  import { mkdtemp, open as openFile, unlink, rmdir } from "fs/promises";
@@ -38628,8 +38909,49 @@ function createCodeLoginInteraction(options2 = {}) {
38628
38909
  let directory2;
38629
38910
  let file3;
38630
38911
  let pngFile;
38912
+ let codeDeliveryAnnounced = false;
38913
+ async function dispose() {
38914
+ let failed = false;
38915
+ for (const [target, remove, release] of [
38916
+ [
38917
+ pngFile,
38918
+ unlink,
38919
+ () => {
38920
+ pngFile = void 0;
38921
+ }
38922
+ ],
38923
+ [
38924
+ file3,
38925
+ unlink,
38926
+ () => {
38927
+ file3 = void 0;
38928
+ }
38929
+ ],
38930
+ [
38931
+ directory2,
38932
+ rmdir,
38933
+ () => {
38934
+ directory2 = void 0;
38935
+ }
38936
+ ]
38937
+ ]) {
38938
+ if (!target) continue;
38939
+ try {
38940
+ await remove(target);
38941
+ release();
38942
+ } catch (error3) {
38943
+ if (error3?.code === "ENOENT") release();
38944
+ else failed = true;
38945
+ }
38946
+ }
38947
+ if (failed) console.error("\u4E34\u65F6\u9A8C\u8BC1\u7801\u5C55\u793A\u9875\u672A\u80FD\u5B8C\u5168\u6E05\u7406\uFF1B\u5176\u4E2D\u4E0D\u5305\u542B\u767B\u5F55\u51ED\u636E\uFF0C\u8BF7\u7A0D\u540E\u5220\u9664\u3002");
38948
+ }
38631
38949
  const interaction = {
38632
38950
  async showCaptcha(svg) {
38951
+ if (directory2 || file3 || pngFile) await dispose();
38952
+ if (directory2 || file3 || pngFile) {
38953
+ throw new CliError("\u672A\u80FD\u6E05\u7406\u4E0A\u4E00\u6B21\u56FE\u5F62\u9A8C\u8BC1\u7801\u56FE\u7247\uFF0C\u8BF7\u5173\u95ED\u56FE\u7247\u540E\u91CD\u8BD5", "LOGIN_CAPTCHA_DISPLAY_FAILED");
38954
+ }
38633
38955
  try {
38634
38956
  const png = await renderCaptchaImage(svg);
38635
38957
  directory2 = await mkdtemp(path3.join(tmpdir(), "freelog-login-captcha-"));
@@ -38666,65 +38988,35 @@ function createCodeLoginInteraction(options2 = {}) {
38666
38988
  }
38667
38989
  },
38668
38990
  async readCaptcha() {
38669
- return input2({
38670
- message: options2.openCaptcha ? "\u56FE\u5F62\u9A8C\u8BC1\u7801\uFF08\u8BF7\u67E5\u770B\u5DF2\u6253\u5F00\u7684\u56FE\u7247\uFF0C\u6216\u624B\u52A8\u6253\u5F00PNG\uFF09" : "\u56FE\u5F62\u9A8C\u8BC1\u7801\uFF08\u8BF7\u67E5\u770B\u5BF9\u8BDD\u4E2D\u7684\u56FE\u7247\uFF0C\u6216\u624B\u52A8\u6253\u5F00PNG\uFF09"
38991
+ return terminalInputQuestion(input2, {
38992
+ message: options2.openCaptcha ? "\u56FE\u5F62\u9A8C\u8BC1\u7801\uFF08\u8BF7\u67E5\u770B\u5DF2\u6253\u5F00\u7684\u56FE\u7247\uFF0C\u6216\u624B\u52A8\u6253\u5F00PNG\uFF09" : "\u56FE\u5F62\u9A8C\u8BC1\u7801\uFF08\u8BF7\u67E5\u770B\u5BF9\u8BDD\u4E2D\u7684\u56FE\u7247\uFF0C\u6216\u624B\u52A8\u6253\u5F00PNG\uFF09",
38993
+ validate: (value) => value.trim().length > 0 || "\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801"
38671
38994
  });
38672
38995
  },
38673
38996
  async readCode(address) {
38674
- const masked = address && address.length <= 128 && /\*/u.test(address) && ![...address].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) ? address : void 0;
38675
- console.error(masked ? `\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ${masked}` : "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\uFF0C\u8BF7\u67E5\u770B\u624B\u673A\u77ED\u4FE1\u6216\u8D26\u53F7\u7ED1\u5B9A\u90AE\u7BB1\u3002");
38676
- return password({
38997
+ if (!codeDeliveryAnnounced) {
38998
+ const masked = address && address.length <= 128 && /\*/u.test(address) && ![...address].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) ? address : void 0;
38999
+ console.error(masked ? `\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ${masked}` : "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\uFF0C\u8BF7\u67E5\u770B\u624B\u673A\u77ED\u4FE1\u6216\u8D26\u53F7\u7ED1\u5B9A\u90AE\u7BB1\u3002");
39000
+ codeDeliveryAnnounced = true;
39001
+ }
39002
+ return terminalInputQuestion(password, {
38677
39003
  message: "\u516D\u4F4D\u9A8C\u8BC1\u7801\uFF08\u8F93\u5165\u663E\u793A\u661F\u53F7\uFF0C\u6309 Enter \u63D0\u4EA4\uFF1BCtrl+C \u53D6\u6D88\uFF09",
38678
39004
  mask: "*",
38679
39005
  validate: (value) => /^\d{6}$/u.test(value) || "\u8BF7\u8F93\u5165\u516D\u4F4D\u6570\u5B57\u9A8C\u8BC1\u7801"
38680
39006
  });
39007
+ },
39008
+ reportRetry(message) {
39009
+ console.error(message);
38681
39010
  }
38682
39011
  };
38683
- return {
38684
- interaction,
38685
- async dispose() {
38686
- let failed = false;
38687
- for (const [target, remove, release] of [
38688
- [
38689
- pngFile,
38690
- unlink,
38691
- () => {
38692
- pngFile = void 0;
38693
- }
38694
- ],
38695
- [
38696
- file3,
38697
- unlink,
38698
- () => {
38699
- file3 = void 0;
38700
- }
38701
- ],
38702
- [
38703
- directory2,
38704
- rmdir,
38705
- () => {
38706
- directory2 = void 0;
38707
- }
38708
- ]
38709
- ]) {
38710
- if (!target) continue;
38711
- try {
38712
- await remove(target);
38713
- release();
38714
- } catch (error3) {
38715
- if (error3?.code === "ENOENT") release();
38716
- else failed = true;
38717
- }
38718
- }
38719
- if (failed) console.error("\u4E34\u65F6\u9A8C\u8BC1\u7801\u5C55\u793A\u9875\u672A\u80FD\u5B8C\u5168\u6E05\u7406\uFF1B\u5176\u4E2D\u4E0D\u5305\u542B\u767B\u5F55\u51ED\u636E\uFF0C\u8BF7\u7A0D\u540E\u5220\u9664\u3002");
38720
- }
38721
- };
39012
+ return { interaction, dispose };
38722
39013
  }
38723
39014
  var init_accountLogin = __esm({
38724
39015
  "src/adapters/accountLogin.ts"() {
38725
39016
  "use strict";
38726
39017
  init_errors();
38727
39018
  init_captchaImage();
39019
+ init_terminalInteraction();
38728
39020
  }
38729
39021
  });
38730
39022
 
@@ -38762,11 +39054,20 @@ function createLoginCommand() {
38762
39054
  );
38763
39055
  }
38764
39056
  assertLoginTargetAvailable(target);
38765
- const loginName2 = options2.loginName ?? await askInput2({ message: "\u767B\u5F55\u540D\uFF08\u624B\u673A\u53F7\u3001\u8D26\u53F7\u6216\u90AE\u7BB1\uFF09" });
39057
+ const readLoginName2 = () => terminalInputQuestion(askInput2, {
39058
+ message: "\u767B\u5F55\u540D\uFF08\u624B\u673A\u53F7\u3001\u8D26\u53F7\u6216\u90AE\u7BB1\uFF09",
39059
+ validate: (value) => !!value.trim() || "\u8BF7\u8F93\u5165\u767B\u5F55\u540D"
39060
+ });
39061
+ const loginName2 = options2.loginName ?? await readLoginName2();
38766
39062
  const { interaction, dispose } = createCodeLoginInteraction({ openCaptcha: options2.openCaptcha === true });
38767
39063
  try {
38768
- const auth2 = await loginByCodeAccount({ ...target, loginName: loginName2, interaction });
38769
- console.log(`\u767B\u5F55\u6210\u529F\uFF1A${auth2.loginName}`);
39064
+ const auth = await loginByCodeAccount({
39065
+ ...target,
39066
+ loginName: loginName2,
39067
+ interaction,
39068
+ ...options2.loginName === void 0 ? { readLoginNameAgain: readLoginName2 } : {}
39069
+ });
39070
+ console.log(`\u767B\u5F55\u6210\u529F\uFF1A${auth.loginName}`);
38770
39071
  } finally {
38771
39072
  await dispose();
38772
39073
  }
@@ -38780,19 +39081,39 @@ function createLoginCommand() {
38780
39081
  throw new CliError("\u975E\u4EA4\u4E92\u767B\u5F55\u8BF7\u4F7F\u7528 --login-name --password-stdin --yes", "LOGIN_NON_TTY_FLAGS");
38781
39082
  }
38782
39083
  assertLoginTargetAvailable(target);
38783
- const loginName = options2.loginName ?? await askInput2({ message: "\u767B\u5F55\u540D" });
38784
- const password2 = options2.passwordStdin ? void 0 : await askPassword({ message: "Freelog \u5E73\u53F0\u5BC6\u7801\uFF08\u8F93\u5165\u663E\u793A\u661F\u53F7\uFF0C\u6309 Enter \u63D0\u4EA4\uFF09", mask: "*" });
38785
- if (process.stdin.isTTY && !options2.passwordStdin && !shared.json) {
38786
- console.error(`\u6B63\u5728\u767B\u5F55 ${getEnv2()}\uFF0C\u8BF7\u7A0D\u5019\u2026\u2026`);
38787
- }
38788
- const auth = await loginAccount({
38789
- ...target,
38790
- loginName,
38791
- password: password2,
38792
- passwordStdin: options2.passwordStdin,
38793
- yes: shared.yes
38794
- });
38795
- console.log(`\u767B\u5F55\u6210\u529F\uFF1A${auth.loginName}`);
39084
+ const env = getEnv2();
39085
+ const loginName = options2.loginName ?? await terminalInputQuestion(askInput2, { message: "\u767B\u5F55\u540D" });
39086
+ const interactiveRetry = isInteractive() && !ci && !shared.json && !options2.passwordStdin;
39087
+ for (let attempt = 1; ; attempt++) {
39088
+ if (attempt > 1) assertLoginTargetAvailable(target);
39089
+ const password2 = options2.passwordStdin ? void 0 : await terminalInputQuestion(askPassword, {
39090
+ message: "Freelog \u5E73\u53F0\u5BC6\u7801\uFF08\u8F93\u5165\u663E\u793A\u661F\u53F7\uFF0C\u6309 Enter \u63D0\u4EA4\uFF09",
39091
+ mask: "*",
39092
+ validate: (value) => value.length > 0 || "\u8BF7\u63D0\u4F9B\u5BC6\u7801"
39093
+ });
39094
+ if (getEnv2() !== env) {
39095
+ throw new CliError("\u767B\u5F55\u671F\u95F4\u73AF\u5883\u5DF2\u6539\u53D8\uFF0C\u672A\u4FDD\u5B58\u51ED\u636E\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C\u767B\u5F55", "LOGIN_ENV_CHANGED");
39096
+ }
39097
+ if (process.stdin.isTTY && !options2.passwordStdin && !shared.json) {
39098
+ console.error(`\u6B63\u5728\u767B\u5F55 ${env}\uFF0C\u8BF7\u7A0D\u5019\u2026\u2026`);
39099
+ }
39100
+ try {
39101
+ const auth = await loginAccount({
39102
+ ...target,
39103
+ loginName,
39104
+ password: password2,
39105
+ passwordStdin: options2.passwordStdin,
39106
+ yes: shared.yes
39107
+ });
39108
+ console.log(`\u767B\u5F55\u6210\u529F\uFF1A${auth.loginName}`);
39109
+ return;
39110
+ } catch (error3) {
39111
+ if (!interactiveRetry || attempt >= MAX_LOGIN_ATTEMPTS || !(error3 instanceof PasswordLoginRejected)) {
39112
+ throw error3;
39113
+ }
39114
+ console.error(`${error3.message}\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u5BC6\u7801\u3002`);
39115
+ }
39116
+ }
38796
39117
  });
38797
39118
  return withCommandExecution(command, { ...WORKSPACE_EXECUTION, pending: "allow" }, {});
38798
39119
  }
@@ -38806,7 +39127,9 @@ var init_login2 = __esm({
38806
39127
  init_login();
38807
39128
  init_loginByCode();
38808
39129
  init_loginCredentials();
39130
+ init_loginRejection();
38809
39131
  init_accountLogin();
39132
+ init_terminalInteraction();
38810
39133
  init_context();
38811
39134
  init_env();
38812
39135
  }
@@ -38873,29 +39196,6 @@ var init_logout2 = __esm({
38873
39196
  }
38874
39197
  });
38875
39198
 
38876
- // src/adapters/terminalInteraction.ts
38877
- var terminalPrompts, terminalReporter;
38878
- var init_terminalInteraction = __esm({
38879
- "src/adapters/terminalInteraction.ts"() {
38880
- "use strict";
38881
- init_tty();
38882
- terminalPrompts = Object.freeze({
38883
- isInteractive: () => isInteractive(),
38884
- askInput: (message, channel) => channel ? askInput(message, channel === "stderr" ? process.stderr : process.stdout) : askInput(message),
38885
- selectQuestion: (message, choices, channel) => channel ? selectQuestion(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectQuestion(message, [...choices]),
38886
- selectMany: (message, choices, channel) => channel ? selectMany(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectMany(message, [...choices]),
38887
- confirmQuestion: (message, defaultYes, channel) => channel ? confirmQuestion(message, defaultYes, channel === "stderr" ? process.stderr : process.stdout) : confirmQuestion(message, defaultYes),
38888
- confirmWrite: (preview2, yes, channel) => channel ? confirmWrite(preview2, yes, channel === "stderr" ? process.stderr : process.stdout) : confirmWrite(preview2, yes),
38889
- confirmDestructive: (...args) => confirmDestructive(...args)
38890
- });
38891
- terminalReporter = Object.freeze({
38892
- log: (message) => console.log(message),
38893
- warn: (message) => console.warn(message),
38894
- error: (message) => console.error(message)
38895
- });
38896
- }
38897
- });
38898
-
38899
39199
  // src/platform/readRequest.ts
38900
39200
  function throwPlatformReadError(error3, fallback, notFound) {
38901
39201
  if (error3 instanceof CliError) throw error3;
@@ -38981,12 +39281,12 @@ function hasChildren(node2) {
38981
39281
  }
38982
39282
  function flattenLeaves(nodes2, ancestors = [], acc = []) {
38983
39283
  for (const node2 of nodes2) {
38984
- const path34 = [...ancestors, node2];
39284
+ const path33 = [...ancestors, node2];
38985
39285
  if (hasChildren(node2)) {
38986
- flattenLeaves(node2.children, path34, acc);
39286
+ flattenLeaves(node2.children, path33, acc);
38987
39287
  }
38988
39288
  if (isEnabledResourceLeafCandidate(node2)) {
38989
- const names2 = path34.map((item) => item.name.trim());
39289
+ const names2 = path33.map((item) => item.name.trim());
38990
39290
  if (names2.some((name) => !name)) {
38991
39291
  throw new CliError("\u5E73\u53F0\u7C7B\u578B\u94FE\u5B58\u5728\u7F3A\u5931\u540D\u79F0\uFF0C\u65E0\u6CD5\u5C55\u793A\u5B8C\u6574\u5C42\u7EA7", "TYPE_HIERARCHY_INVALID");
38992
39292
  }
@@ -38997,15 +39297,15 @@ function flattenLeaves(nodes2, ancestors = [], acc = []) {
38997
39297
  }
38998
39298
  async function resourceTypeTree(apis2) {
38999
39299
  assertPlatformAllowed();
39000
- const request5 = apis2.resourceTypes ?? ((params) => service_API_default.Resource.resourceTypes(params));
39300
+ const request5 = apis2.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
39001
39301
  return unwrapList(await readType(() => request5({ category: 1, status: 1, subjectType: 1 })));
39002
39302
  }
39003
39303
  function findTypePath(nodes2, code2, ancestors = []) {
39004
39304
  for (const node2 of nodes2) {
39005
- const path34 = [...ancestors, node2];
39006
- if (node2.code === code2) return path34;
39305
+ const path33 = [...ancestors, node2];
39306
+ if (node2.code === code2) return path33;
39007
39307
  if (hasChildren(node2)) {
39008
- const found = findTypePath(node2.children, code2, path34);
39308
+ const found = findTypePath(node2.children, code2, path33);
39009
39309
  if (found) return found;
39010
39310
  }
39011
39311
  }
@@ -39014,9 +39314,9 @@ function findTypePath(nodes2, code2, ancestors = []) {
39014
39314
  async function getTypeHierarchy(code2, apis2 = {}) {
39015
39315
  const normalized = code2.trim();
39016
39316
  if (!normalized) throw new CliError("\u8BF7\u63D0\u4F9B\u8D44\u6E90\u7C7B\u578B\u7F16\u53F7", "TYPE_CODE_REQUIRED");
39017
- const path34 = findTypePath(await resourceTypeTree(apis2), normalized);
39018
- if (!path34) throw new CliError(`\u5E73\u53F0\u7C7B\u578B\u6811\u4E0D\u5305\u542B\u5F53\u524D\u7C7B\u578B ${normalized}`, "TYPE_HIERARCHY_NOT_FOUND");
39019
- const names2 = path34.map((node2) => node2.name.trim());
39317
+ const path33 = findTypePath(await resourceTypeTree(apis2), normalized);
39318
+ if (!path33) throw new CliError(`\u5E73\u53F0\u7C7B\u578B\u6811\u4E0D\u5305\u542B\u5F53\u524D\u7C7B\u578B ${normalized}`, "TYPE_HIERARCHY_NOT_FOUND");
39319
+ const names2 = path33.map((node2) => node2.name.trim());
39020
39320
  if (names2.some((name) => !name)) {
39021
39321
  throw new CliError("\u5E73\u53F0\u7C7B\u578B\u94FE\u5B58\u5728\u7F3A\u5931\u540D\u79F0\uFF0C\u65E0\u6CD5\u5C55\u793A\u5B8C\u6574\u5C42\u7EA7", "TYPE_HIERARCHY_INVALID");
39022
39322
  }
@@ -39027,7 +39327,7 @@ async function listLeafTypes(apis2 = {}) {
39027
39327
  }
39028
39328
  async function searchLeafTypes(keyword, apis2 = {}) {
39029
39329
  assertPlatformAllowed();
39030
- const request5 = apis2.searchLeaves ?? ((params) => service_API_default.Resource.ListSimpleByParentCode(params));
39330
+ const request5 = apis2.searchLeaves ?? ((params) => FServiceAPI2.Resource.ListSimpleByParentCode(params));
39031
39331
  const [tree, response] = await Promise.all([
39032
39332
  resourceTypeTree(apis2),
39033
39333
  readType(
@@ -39044,11 +39344,11 @@ async function searchLeafTypes(keyword, apis2 = {}) {
39044
39344
  return unwrapList(response).flatMap((item) => {
39045
39345
  if (!item.code || codes2.has(item.code)) return [];
39046
39346
  codes2.add(item.code);
39047
- const path34 = findTypePath(tree, item.code);
39048
- if (!path34) return [];
39049
- const leaf = path34[path34.length - 1];
39347
+ const path33 = findTypePath(tree, item.code);
39348
+ if (!path33) return [];
39349
+ const leaf = path33[path33.length - 1];
39050
39350
  if (!isEnabledResourceLeafCandidate(leaf)) return [];
39051
- const names2 = path34.map((node2) => node2.name.trim());
39351
+ const names2 = path33.map((node2) => node2.name.trim());
39052
39352
  if (names2.some((name) => !name)) {
39053
39353
  throw new CliError("\u5E73\u53F0\u7C7B\u578B\u94FE\u5B58\u5728\u7F3A\u5931\u540D\u79F0\uFF0C\u65E0\u6CD5\u5C55\u793A\u5B8C\u6574\u5C42\u7EA7", "TYPE_HIERARCHY_INVALID");
39054
39354
  }
@@ -39061,7 +39361,7 @@ async function getTypeInfo(code2, apis2 = {}) {
39061
39361
  throw new CliError("\u8BF7\u63D0\u4F9B\u8D44\u6E90\u7C7B\u578B\u7F16\u53F7", "TYPE_CODE_REQUIRED");
39062
39362
  }
39063
39363
  assertPlatformAllowed();
39064
- const request5 = apis2.getByCode ?? ((params) => service_API_default.Resource.getResourceTypeInfoByCode(params));
39364
+ const request5 = apis2.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params));
39065
39365
  const rawInfo = unwrapOne(await readType(() => request5({ code: normalized })));
39066
39366
  const info2 = rawInfo ? normalizeTypeInfo(rawInfo) : void 0;
39067
39367
  if (!info2?.code || info2.code !== normalized) {
@@ -39360,7 +39660,7 @@ var init_transaction = __esm({
39360
39660
  });
39361
39661
 
39362
39662
  // src/local/lock.ts
39363
- import { AsyncLocalStorage } from "async_hooks";
39663
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
39364
39664
  import {
39365
39665
  realpathSync,
39366
39666
  closeSync,
@@ -39553,7 +39853,7 @@ var init_lock = __esm({
39553
39853
  init_errors();
39554
39854
  init_statePaths();
39555
39855
  init_transaction();
39556
- lockContext = new AsyncLocalStorage();
39856
+ lockContext = new AsyncLocalStorage2();
39557
39857
  }
39558
39858
  });
39559
39859
 
@@ -40446,7 +40746,7 @@ function storageHash(v) {
40446
40746
  return createHash4("sha256").update(JSON.stringify(v)).digest("hex");
40447
40747
  }
40448
40748
  function apiFor(i, key2) {
40449
- return i.apis?.[key2] ?? ((p) => key2 === "getResourceBySha1" ? service_API_default.Resource.getResourceBySha1(p) : service_API_default.Storage[key2](p));
40749
+ return i.apis?.[key2] ?? ((p) => key2 === "getResourceBySha1" ? FServiceAPI2.Resource.getResourceBySha1(p) : FServiceAPI2.Storage[key2](p));
40450
40750
  }
40451
40751
  async function storageRead(i, key2, p = {}) {
40452
40752
  try {
@@ -40604,7 +40904,7 @@ async function readFileUsage(input3) {
40604
40904
  let response;
40605
40905
  try {
40606
40906
  response = await withStorageTimeout(
40607
- () => (input3.query ?? ((params) => service_API_default.Resource.getResourceBySha1(params, {
40907
+ () => (input3.query ?? ((params) => FServiceAPI2.Resource.getResourceBySha1(params, {
40608
40908
  timeout: 3e4,
40609
40909
  signal: AbortSignal.timeout(3e4)
40610
40910
  })))({ fileSha1: input3.sha1 }),
@@ -40668,7 +40968,7 @@ async function readStorageObjectSnapshot(input3) {
40668
40968
  if (!input3.objectId || !/^[A-Za-z0-9_-]+$/u.test(input3.objectId))
40669
40969
  throw new CliError("\u8BF7\u63D0\u4F9B\u7CBE\u786E\u5B58\u50A8\u5BF9\u8C61ID", "STORAGE_SOURCE_ID_INVALID");
40670
40970
  const raw = await read(
40671
- input3.apis?.objectDetails ?? ((p) => service_API_default.Storage.objectDetails(p, readControls())),
40971
+ input3.apis?.objectDetails ?? ((p) => FServiceAPI2.Storage.objectDetails(p, readControls())),
40672
40972
  {
40673
40973
  objectIdOrName: input3.objectId
40674
40974
  }
@@ -40677,7 +40977,7 @@ async function readStorageObjectSnapshot(input3) {
40677
40977
  if (!record3(raw) || raw.objectId !== input3.objectId || raw.userId !== ownerUserId || typeof raw.bucketId !== "string" || !raw.bucketId || typeof raw.bucketName !== "string" || !raw.bucketName || typeof raw.objectName !== "string" || !raw.objectName || typeof raw.sha1 !== "string" || !/^[a-f0-9]{40}$/u.test(raw.sha1))
40678
40978
  throw new CliError("\u5BF9\u8C61\u4E0D\u5B58\u5728\u3001\u975E\u672C\u4EBA\u6216\u6587\u4EF6\u8EAB\u4EFD\u4E0D\u5B8C\u6574", "STORAGE_SOURCE_INVALID");
40679
40979
  const bucket = await read(
40680
- input3.apis?.bucketDetails ?? ((p) => service_API_default.Storage.bucketDetails(p, readControls())),
40980
+ input3.apis?.bucketDetails ?? ((p) => FServiceAPI2.Storage.bucketDetails(p, readControls())),
40681
40981
  {
40682
40982
  bucketName: raw.bucketName
40683
40983
  }
@@ -40706,7 +41006,7 @@ async function loadStorageSource(input3) {
40706
41006
  sha1: snapshot2.source.sha1,
40707
41007
  userId: snapshot2.source.ownerUserId,
40708
41008
  resourceId: input3.resourceId,
40709
- query: input3.apis?.getResourceBySha1 ?? ((p) => service_API_default.Resource.getResourceBySha1(p, readControls()))
41009
+ query: input3.apis?.getResourceBySha1 ?? ((p) => FServiceAPI2.Resource.getResourceBySha1(p, readControls()))
40710
41010
  });
40711
41011
  } catch (error3) {
40712
41012
  if (error3 instanceof CliError && error3.code === "FILE_USAGE_READ_FAILED")
@@ -40891,35 +41191,20 @@ var init_zip = __esm({
40891
41191
 
40892
41192
  // src/domain/resource/create.ts
40893
41193
  import path12 from "path";
40894
- function unwrapData2(result, code2, message, allowNull = false) {
40895
- const envelope = result;
40896
- const data3 = Object.hasOwn(envelope, "data") ? envelope.data : result;
40897
- if (allowNull && data3 === null) return {};
40898
- if (data3 === null || typeof data3 !== "object" || Array.isArray(data3)) throw new CliError(message, code2);
40899
- return data3;
40900
- }
40901
- function isNotFound(error3) {
40902
- const response = error3?.response;
40903
- if (Number(response?.status) === 404) return true;
40904
- const message = error3?.message;
40905
- if (typeof message !== "string") return false;
40906
- try {
40907
- return Number(JSON.parse(message).status) === 404;
40908
- } catch {
40909
- return false;
40910
- }
41194
+ function validResourceId(value) {
41195
+ return typeof value === "string" && value === value.trim() && /^[a-z\d_-]+$/iu.test(value) && !/^(?:undefined|null)$/iu.test(value);
40911
41196
  }
40912
41197
  async function lookupResource(infoApi2, params) {
41198
+ const code2 = "CREATE_LOOKUP_FAILED";
41199
+ const message = "\u65E0\u6CD5\u786E\u8BA4\u8BE5\u8D44\u6E90\u6807\u8BC6\u662F\u5426\u53EF\u7528\uFF0C\u672A\u63D0\u4EA4\u521B\u5EFA";
40913
41200
  try {
40914
41201
  const response = await infoApi2(params);
40915
- assertSuccessfulResponse(response, "CREATE_LOOKUP_FAILED", "\u67E5\u8BE2\u73B0\u6709\u8D44\u6E90\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u767B\u5F55\u548C\u7F51\u7EDC\u540E\u91CD\u8BD5");
40916
- return unwrapData2(response, "CREATE_LOOKUP_FAILED", "\u67E5\u8BE2\u73B0\u6709\u8D44\u6E90\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u767B\u5F55\u548C\u7F51\u7EDC\u540E\u91CD\u8BD5", true);
41202
+ assertSuccessfulResponse(response, code2, message);
41203
+ const data3 = response.data;
41204
+ if (data3 === null || object2(data3) && validResourceId(data3.resourceId)) return data3;
41205
+ throw new CliError(message, code2);
40917
41206
  } catch (error3) {
40918
- if (isNotFound(error3)) return {};
40919
- throwPlatformReadError(error3, {
40920
- code: "CREATE_LOOKUP_FAILED",
40921
- message: "\u67E5\u8BE2\u73B0\u6709\u8D44\u6E90\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u767B\u5F55\u548C\u7F51\u7EDC\u540E\u91CD\u8BD5"
40922
- });
41207
+ throwPlatformReadError(error3, { code: code2, message });
40923
41208
  }
40924
41209
  }
40925
41210
  function normalizeResourceName(raw) {
@@ -40969,14 +41254,12 @@ function resolveTargetIdentity(input3) {
40969
41254
  return void 0;
40970
41255
  }
40971
41256
  async function assertOwnShellAvailable(input3) {
40972
- const infoApi2 = input3.infoApi ?? ((params) => service_API_default.Resource.info(params));
41257
+ const infoApi2 = input3.infoApi ?? ((params) => FServiceAPI2.Resource.info(params));
40973
41258
  const existing = await lookupResource(infoApi2, {
40974
41259
  resourceIdOrName: `${input3.authLoginName}/${input3.name}`,
40975
41260
  isLoadLatestVersionInfo: 1
40976
41261
  });
40977
- if (!existing.resourceId) {
40978
- return;
40979
- }
41262
+ if (existing === null) return;
40980
41263
  const ownerId = existing.userId ?? existing.ownerId ?? existing.creatorId;
40981
41264
  if (ownerId !== input3.authUserId) {
40982
41265
  throw new CliError(`\u8D44\u6E90\u6388\u6743\u6807\u8BC6 ${input3.name} \u5DF2\u88AB\u4F7F\u7528\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002`, "CREATE_NAME_TAKEN");
@@ -40986,6 +41269,34 @@ async function assertOwnShellAvailable(input3) {
40986
41269
  "CREATE_OWN_SHELL"
40987
41270
  );
40988
41271
  }
41272
+ async function submitResourceCreation(params, resourceName, userId, create3) {
41273
+ const unknownResult3 = (error3) => {
41274
+ const reason = platformFailureMessage(error3, "");
41275
+ return new CliError(
41276
+ `\u65E0\u6CD5\u786E\u8BA4\u8D44\u6E90 ${resourceName} \u662F\u5426\u5DF2\u521B\u5EFA\u3002${reason ? `\u5E73\u53F0\u8FD4\u56DE\uFF1A${reason}\u3002` : ""}\u8BF7\u5148\u7528 resource show ${resourceName} \u6838\u5B9E\uFF0C\u786E\u8BA4\u540E\u7528 bind \u63A5\u5165\uFF0C\u8BF7\u52FF\u91CD\u590D\u521B\u5EFA\u3002`,
41277
+ "CREATE_RESULT_UNKNOWN"
41278
+ );
41279
+ };
41280
+ let response;
41281
+ try {
41282
+ response = await (create3 ?? FServiceAPI2.Resource.create)(params);
41283
+ if (classifyApiResponse(response).kind === "rejected") throw new ApiResponseError("\u5E73\u53F0\u62D2\u7EDD\u521B\u5EFA\u8D44\u6E90", response);
41284
+ } catch (error3) {
41285
+ const rejection = platformRejectionDescription(error3);
41286
+ if (rejection)
41287
+ throw new CliError(
41288
+ rejection.message,
41289
+ rejection.code === "PLATFORM_UNAUTHORIZED" ? rejection.code : "CREATE_REJECTED"
41290
+ );
41291
+ throw unknownResult3(error3);
41292
+ }
41293
+ if (classifyApiResponse(response).kind !== "success" || !object2(response) || !Object.hasOwn(response, "data"))
41294
+ throw unknownResult3();
41295
+ const data3 = response.data;
41296
+ if (!object2(data3) || !validResourceId(data3.resourceId) || Object.hasOwn(data3, "resourceName") && data3.resourceName !== resourceName || Object.hasOwn(data3, "resourceTypeCode") && data3.resourceTypeCode !== params.resourceTypeCode || Object.hasOwn(data3, "subjectType") && data3.subjectType !== 1 || Object.hasOwn(data3, "userId") && data3.userId !== userId)
41297
+ throw unknownResult3();
41298
+ return data3.resourceId;
41299
+ }
40989
41300
  function writeCreatedIdentity(input3) {
40990
41301
  const filePath = input3.file ?? input3.target?.filePath;
40991
41302
  if (!filePath && !input3.storageSource && !input3.target?.storageSource)
@@ -41005,11 +41316,16 @@ function writeCreatedIdentity(input3) {
41005
41316
  });
41006
41317
  }
41007
41318
  async function createResource(input3) {
41008
- assertPlatformAllowed();
41319
+ const env = assertPlatformAllowed();
41009
41320
  if (input3.file !== void 0 && input3.storageObject !== void 0)
41010
41321
  throw new CliError("--artifact \u4E0E --storage-object \u4E92\u65A5", "ARTIFACT_SOURCE_CONFLICT");
41011
41322
  assertResourceSelectorValue(input3.selector);
41012
41323
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
41324
+ const assertOriginalAccount = () => {
41325
+ const current2 = requireAuth(input3);
41326
+ if (getEnv2() !== env || current2.userId !== auth.userId || current2.loginName !== auth.loginName)
41327
+ throw new CliError("\u521B\u5EFA\u671F\u95F4\u8D26\u53F7\u6216\u73AF\u5883\u5DF2\u53D8\u5316", "RESOURCE_CONTEXT_CHANGED");
41328
+ };
41013
41329
  const prompts = input3.prompts ?? headlessPrompts;
41014
41330
  const reporter = input3.reporter ?? silentReporter;
41015
41331
  const interactive = !input3.yes && prompts.isInteractive();
@@ -41022,6 +41338,7 @@ async function createResource(input3) {
41022
41338
  code: "CREATE_FILE_OUTSIDE",
41023
41339
  message: "--artifact \u5FC5\u987B\u843D\u5728\u5F53\u524D\u5DE5\u7A0B\u91CC"
41024
41340
  }) : void 0;
41341
+ let submissionError;
41025
41342
  return withProjectLock(input3.cwd, async () => {
41026
41343
  const identities = validateLocalState(input3.cwd);
41027
41344
  const target = resolveTargetIdentity({
@@ -41130,27 +41447,28 @@ async function createResource(input3) {
41130
41447
  throw new CliError("\u521B\u5EFA\u671F\u95F4\u672C\u5730\u8D44\u6E90\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u6838\u5BF9\u540E\u91CD\u65B0\u6267\u884C", "CREATE_LOCAL_STATE_CHANGED");
41131
41448
  }
41132
41449
  if (artifact) assertArtifactAnchor(typeCode, path12.resolve(input3.cwd, artifact), input3.cwd);
41133
- const createApi = input3.apis?.create ?? ((params) => service_API_default.Resource.create(params));
41134
- const response = await createApi({
41135
- name,
41136
- resourceTitle: title,
41137
- resourceTypeCode: typeCode
41450
+ assertOriginalAccount();
41451
+ const resourceName = `${auth.loginName}/${name}`;
41452
+ const resourceId = await submitResourceCreation(
41453
+ { name, resourceTitle: title, resourceTypeCode: typeCode },
41454
+ resourceName,
41455
+ auth.userId,
41456
+ input3.apis?.create
41457
+ ).catch((error3) => {
41458
+ if (error3 instanceof CliError) submissionError = error3;
41459
+ throw error3;
41138
41460
  });
41139
- assertSuccessfulResponse(response, "CREATE_FAILED", "\u521B\u5EFA\u54CD\u5E94\u5931\u8D25\u6216\u65E0\u6548\uFF0C\u8BF7\u5148\u6838\u5BF9\u7EBF\u4E0A\u6761\u76EE\uFF0C\u518D\u51B3\u5B9A bind \u6216\u540E\u7EED\u64CD\u4F5C");
41140
- const created = unwrapData2(
41141
- response,
41142
- "CREATE_FAILED",
41143
- "\u521B\u5EFA\u54CD\u5E94\u5931\u8D25\u6216\u65E0\u6548\uFF0C\u8BF7\u5148\u6838\u5BF9\u7EBF\u4E0A\u6761\u76EE\uFF0C\u518D\u51B3\u5B9A bind \u6216\u540E\u7EED\u64CD\u4F5C"
41461
+ submissionError = new CliError(
41462
+ `\u8D44\u6E90 ${resourceName}\uFF08ID\uFF1A${resourceId}\uFF09\u5DF2\u521B\u5EFA\uFF0C\u4F46\u672C\u5730\u72B6\u6001\u672A\u80FD\u6B63\u5E38\u6536\u5C3E\u3002\u8BF7\u5148\u6838\u5BF9\u672C\u5730\u8EAB\u4EFD\uFF0C\u5C1A\u672A\u63A5\u5165\u65F6\u5728\u539F\u8D26\u53F7\u548C\u73AF\u5883\u7528 bind \u63A5\u5165\u3002`,
41463
+ "CREATE_LOCAL_STATE_FAILED"
41144
41464
  );
41145
- const resourceId = created.resourceId;
41146
- if (typeof resourceId !== "string" || !resourceId.trim()) {
41147
- throw new CliError("\u521B\u5EFA\u5931\u8D25\uFF1A\u5E73\u53F0\u672A\u8FD4\u56DE resourceId", "CREATE_FAILED");
41148
- }
41149
- const record21 = writeCreatedIdentity({
41465
+ assertOriginalAccount();
41466
+ if (JSON.stringify(validateLocalState(input3.cwd)) !== JSON.stringify(identities)) throw submissionError;
41467
+ return writeCreatedIdentity({
41150
41468
  cwd: input3.cwd,
41151
- env: getEnv2(),
41469
+ env,
41152
41470
  name,
41153
- resourceName: typeof created.resourceName === "string" && created.resourceName ? created.resourceName : `${auth.loginName}/${name}`,
41471
+ resourceName,
41154
41472
  typeCode,
41155
41473
  resourceId,
41156
41474
  title,
@@ -41158,7 +41476,8 @@ async function createResource(input3) {
41158
41476
  storageSource,
41159
41477
  target
41160
41478
  });
41161
- return record21;
41479
+ }).catch((error3) => {
41480
+ throw submissionError ?? error3;
41162
41481
  });
41163
41482
  }
41164
41483
  var init_create = __esm({
@@ -41173,7 +41492,9 @@ var init_create = __esm({
41173
41492
  init_requireAuth();
41174
41493
  init_env();
41175
41494
  init_api();
41495
+ init_platformError();
41176
41496
  init_unwrap();
41497
+ init_response();
41177
41498
  init_service();
41178
41499
  init_lock();
41179
41500
  init_projectPath();
@@ -41291,7 +41612,7 @@ function isLeaf(node2) {
41291
41612
  }
41292
41613
  async function readCollectionTypeTree(apis2) {
41293
41614
  assertPlatformAllowed();
41294
- const request5 = apis2.resourceTypes ?? ((params) => service_API_default.Resource.resourceTypes(params));
41615
+ const request5 = apis2.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
41295
41616
  const nodes2 = unwrapList2(await readType2(() => request5({ category: 1, status: 1, subjectType: 4 })));
41296
41617
  assertTree(nodes2);
41297
41618
  return nodes2;
@@ -41311,26 +41632,26 @@ async function getCollectionTypeInfo(code2, apis2 = {}) {
41311
41632
  const normalized = code2.trim();
41312
41633
  if (!normalized) throw new CliError("\u8BF7\u63D0\u4F9B\u5408\u96C6\u7C7B\u578B\u7F16\u53F7", "COLLECTION_TYPE_REQUIRED");
41313
41634
  assertPlatformAllowed();
41314
- const request5 = apis2.getByCode ?? ((params) => service_API_default.Resource.getResourceTypeInfoByCode(params));
41635
+ const request5 = apis2.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params));
41315
41636
  const [nodes2, raw] = await Promise.all([readCollectionTypeTree(apis2), readType2(() => request5({ code: normalized }))]);
41316
41637
  const info2 = unwrapOne2(raw);
41317
41638
  if (!info2?.code || info2.code !== normalized) {
41318
41639
  throw new CliError(`\u627E\u4E0D\u5230\u5408\u96C6\u7C7B\u578B ${normalized}`, "COLLECTION_TYPE_NOT_FOUND");
41319
41640
  }
41320
- const path34 = findPath(nodes2, normalized);
41321
- if (!isLeaf(info2) || !path34 || !isCollectionTypeCandidate(path34[path34.length - 1])) {
41641
+ const path33 = findPath(nodes2, normalized);
41642
+ if (!isLeaf(info2) || !path33 || !isCollectionTypeCandidate(path33[path33.length - 1])) {
41322
41643
  throw new CliError("\u5FC5\u987B\u662F\u542F\u7528\u4E2D\u7684\u5408\u96C6\u6700\u7EC8\u53F6\u5B50\u7C7B\u578B", "COLLECTION_TYPE_NOT_LEAF");
41323
41644
  }
41324
- return { ...info2, pathLabel: label(path34) };
41645
+ return { ...info2, pathLabel: label(path33) };
41325
41646
  }
41326
- function label(path34) {
41327
- const names2 = path34.map((node2) => node2.name?.trim());
41647
+ function label(path33) {
41648
+ const names2 = path33.map((node2) => node2.name?.trim());
41328
41649
  if (names2.some((name) => !name)) throw new CliError("\u5E73\u53F0\u5408\u96C6\u7C7B\u578B\u94FE\u7F3A\u5C11\u540D\u79F0", "COLLECTION_TYPE_HIERARCHY");
41329
41650
  return names2.join(" / ");
41330
41651
  }
41331
41652
  async function searchCollectionTypeLeaves(keyword, apis2) {
41332
41653
  assertPlatformAllowed();
41333
- const request5 = apis2.searchLeaves ?? ((params) => service_API_default.Resource.ListSimpleByParentCode(params));
41654
+ const request5 = apis2.searchLeaves ?? ((params) => FServiceAPI2.Resource.ListSimpleByParentCode(params));
41334
41655
  const [nodes2, response] = await Promise.all([
41335
41656
  readCollectionTypeTree(apis2),
41336
41657
  readType2(() => request5({ category: 1, nameChain: keyword, isTerminate: true, status: 1, subjectType: 4 }))
@@ -41339,9 +41660,9 @@ async function searchCollectionTypeLeaves(keyword, apis2) {
41339
41660
  return unwrapList2(response).flatMap((item) => {
41340
41661
  if (!item.code || seen.has(item.code)) return [];
41341
41662
  seen.add(item.code);
41342
- const path34 = findPath(nodes2, item.code);
41343
- if (!path34 || !isCollectionTypeCandidate(path34[path34.length - 1])) return [];
41344
- return [{ code: item.code, label: label(path34) }];
41663
+ const path33 = findPath(nodes2, item.code);
41664
+ if (!path33 || !isCollectionTypeCandidate(path33[path33.length - 1])) return [];
41665
+ return [{ code: item.code, label: label(path33) }];
41345
41666
  });
41346
41667
  }
41347
41668
  var init_resourceTypes = __esm({
@@ -41412,12 +41733,9 @@ var init_typePicker = __esm({
41412
41733
  function record5(value) {
41413
41734
  return value !== null && typeof value === "object" && !Array.isArray(value);
41414
41735
  }
41415
- function validResourceId(value) {
41736
+ function validResourceId2(value) {
41416
41737
  return typeof value === "string" && value.trim() === value && /^[a-zA-Z0-9_.-]+$/u.test(value) && value !== "." && value !== "..";
41417
41738
  }
41418
- function isNotFound2(error3) {
41419
- return record5(error3) && record5(error3.response) && error3.response.status === 404 || error3 instanceof Error && error3.message === '{"status":404}';
41420
- }
41421
41739
  function normalizeCollectionName(raw) {
41422
41740
  return normalizePlatformName(raw);
41423
41741
  }
@@ -41460,7 +41778,6 @@ async function assertNameAvailable(input3) {
41460
41778
  isLoadLatestVersionInfo: 1
41461
41779
  });
41462
41780
  } catch (error3) {
41463
- if (isNotFound2(error3)) return;
41464
41781
  throwPlatformReadError(error3, {
41465
41782
  code: "COLLECTION_LOOKUP_FAILED",
41466
41783
  message: "\u67E5\u8BE2\u73B0\u6709\u5408\u96C6\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u767B\u5F55\u548C\u7F51\u7EDC\u540E\u91CD\u8BD5"
@@ -41474,7 +41791,7 @@ async function assertNameAvailable(input3) {
41474
41791
  }
41475
41792
  if (response.data === null) return;
41476
41793
  const existing = response.data;
41477
- if (!record5(existing) || !validResourceId(existing.resourceId) || existing.resourceName !== resourceName || !Number.isSafeInteger(existing.userId) || Number(existing.userId) <= 0) {
41794
+ if (!record5(existing) || !validResourceId2(existing.resourceId) || existing.resourceName !== resourceName || !Number.isSafeInteger(existing.userId) || Number(existing.userId) <= 0) {
41478
41795
  throw new CliError("\u5E73\u53F0\u67E5\u91CD\u672A\u8FD4\u56DE\u53EF\u4FE1\u7684\u8D44\u6E90\u8EAB\u4EFD\uFF0C\u8BF7\u53EA\u8BFB\u6838\u5BF9\u540E\u91CD\u8BD5", "COLLECTION_LOOKUP_FAILED");
41479
41796
  }
41480
41797
  const values = Array.isArray(existing.subjectType) ? existing.subjectType : [existing.subjectType];
@@ -41491,7 +41808,7 @@ async function createCollection(input3) {
41491
41808
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
41492
41809
  const apis2 = input3.apis ?? {};
41493
41810
  const selected = await chooseInputs({ ...input3, apis: apis2 });
41494
- const info2 = apis2.info ?? ((params) => service_API_default.Resource.info(params));
41811
+ const info2 = apis2.info ?? ((params) => FServiceAPI2.Resource.info(params));
41495
41812
  await assertNameAvailable({ loginName: auth.loginName, userId: auth.userId, name: selected.name, info: info2 });
41496
41813
  await (input3.prompts ?? headlessPrompts).confirmWrite(
41497
41814
  `\u521B\u5EFA\u5408\u96C6
@@ -41500,7 +41817,7 @@ async function createCollection(input3) {
41500
41817
  \u6388\u6743\u6807\u8BC6\uFF1A${auth.loginName}/${selected.name}`,
41501
41818
  input3.yes
41502
41819
  );
41503
- const create3 = apis2.create ?? ((params) => service_API_default.Resource.create(params));
41820
+ const create3 = apis2.create ?? ((params) => FServiceAPI2.Resource.create(params));
41504
41821
  const resourceName = `${auth.loginName}/${selected.name}`;
41505
41822
  const unknownResult3 = (error3) => {
41506
41823
  const reason = platformFailureMessage(error3, "");
@@ -41529,7 +41846,7 @@ async function createCollection(input3) {
41529
41846
  throw unknownResult3();
41530
41847
  }
41531
41848
  const created = response.data;
41532
- if (!validResourceId(created.resourceId) || created.resourceName !== resourceName || created.resourceTypeCode !== selected.typeCode) {
41849
+ if (!validResourceId2(created.resourceId) || created.resourceName !== resourceName || created.resourceTypeCode !== selected.typeCode) {
41533
41850
  throw unknownResult3();
41534
41851
  }
41535
41852
  try {
@@ -41669,7 +41986,7 @@ function parseSelector2(selector) {
41669
41986
  throw new CliError("\u5408\u96C6\u9009\u62E9\u5668\u65E0\u6548\uFF1B\u8BF7\u4F7F\u7528 id:\u3001\u5B8C\u6574 name: \u6216 file:N.json", "COLLECTION_SELECTOR_INVALID");
41670
41987
  }
41671
41988
  async function chooseOnline(userId, apis2, prompts = headlessPrompts) {
41672
- const list2 = apis2?.listCollections ?? ((params) => service_API_default.Resource.list(params));
41989
+ const list2 = apis2?.listCollections ?? ((params) => FServiceAPI2.Resource.list(params));
41673
41990
  const pages = /* @__PURE__ */ new Map();
41674
41991
  const ids = /* @__PURE__ */ new Set();
41675
41992
  let total;
@@ -41761,7 +42078,7 @@ async function resolveCollectionTarget(input3) {
41761
42078
  const resourceIdOrName = local?.resourceId ?? (selector?.kind !== "file" ? selector?.value : void 0);
41762
42079
  if (!resourceIdOrName) throw new CliError("\u5408\u96C6\u9009\u62E9\u5668\u65E0\u6548", "COLLECTION_SELECTOR_INVALID");
41763
42080
  if (getEnv2() !== env) throw new CliError("\u9009\u62E9\u671F\u95F4\u73AF\u5883\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C", "COLLECTION_ENV_MISMATCH");
41764
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
42081
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
41765
42082
  const remote = dataObject(
41766
42083
  await readPlatformResult(
41767
42084
  info2,
@@ -42701,7 +43018,7 @@ async function querySubjectContracts(input3) {
42701
43018
  }
42702
43019
  let raw;
42703
43020
  try {
42704
- raw = await (input3.query ?? ((params) => service_API_default.Contract.batchContracts(params)))({
43021
+ raw = await (input3.query ?? ((params) => FServiceAPI2.Contract.batchContracts(params)))({
42705
43022
  subjectIds: [...requested.keys()].join(","),
42706
43023
  licenseeId: input3.licensee.id,
42707
43024
  licenseeIdentityType: input3.licensee.type,
@@ -42841,7 +43158,7 @@ async function planCollectionItemSigning(input3) {
42841
43158
  throw new CliError("\u4E0A\u6E38\u7B7E\u7EA6\u6620\u5C04\u5FC5\u987B\u552F\u4E00\u4E14\u5C5E\u4E8E\u672C\u6B21\u5FC5\u8981\u4E0A\u629B", "COLLECTION_ITEM_SIGN_POLICY_INVALID");
42842
43159
  selections.set(parts[0], parts[1]);
42843
43160
  }
42844
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
43161
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
42845
43162
  const subjects = await readContractSubjects(upstreamIds, info2);
42846
43163
  const assertSubjects = () => assertContractSubjectsUnchanged(subjects, info2);
42847
43164
  const readContracts = () => upstreamIds.length ? querySubjectContracts({
@@ -43344,8 +43661,8 @@ async function compileRules(rules, loginName, apis2) {
43344
43661
  );
43345
43662
  }
43346
43663
  async function assertNoManualDraftDifference(resourceId, apis2) {
43347
- const published = apis2.getPublishedItems ?? ((params) => service_API_default.Resource.getCollectionItems(params));
43348
- const draft = apis2.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params));
43664
+ const published = apis2.getPublishedItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems(params));
43665
+ const draft = apis2.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
43349
43666
  const [publishedItems, draftItems] = await Promise.all([
43350
43667
  readCollectionCatalogue(resourceId, published),
43351
43668
  readCollectionCatalogue(resourceId, draft)
@@ -43360,7 +43677,7 @@ function sameState(left, right) {
43360
43677
  async function getCollectionCollectRules2(input3) {
43361
43678
  assertPlatformAllowed();
43362
43679
  const target = await resolveCollectionTarget(input3);
43363
- const getRules = input3.apis?.getRules ?? ((params) => service_API_default.Resource.getCollectionCollectRules(params));
43680
+ const getRules = input3.apis?.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
43364
43681
  return asState(await getRules({ resourceId: target.resourceId }), target.info.serializeStatus);
43365
43682
  }
43366
43683
  async function setCollectionCollectRulesUnlocked(input3) {
@@ -43379,7 +43696,7 @@ async function setCollectionCollectRulesUnlocked(input3) {
43379
43696
  assertCollectionWriteTarget(input3, anchor);
43380
43697
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
43381
43698
  const apis2 = input3.apis ?? {};
43382
- const getRules = apis2.getRules ?? ((params) => service_API_default.Resource.getCollectionCollectRules(params));
43699
+ const getRules = apis2.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
43383
43700
  const current2 = asState(await getRules({ resourceId: target.resourceId }), target.info.serializeStatus);
43384
43701
  if (current2.serializeStatus === 1 && input3.serialize !== "serial" && (input3.auto === "all" || input3.auto === "any"))
43385
43702
  throw new CliError("\u5DF2\u5B8C\u7ED3\u7684\u5408\u96C6\u4E0D\u80FD\u5F00\u542F\u81EA\u52A8\u6536\u5F55\uFF1B\u8BF7\u663E\u5F0F\u6062\u590D\u8FDE\u8F7D\u540E\u5F00\u542F", "COLLECTION_COMPLETED_AUTO_CONFLICT");
@@ -43415,7 +43732,7 @@ async function setCollectionCollectRulesUnlocked(input3) {
43415
43732
  throw new CliError("\u5408\u96C6\u5B8C\u7ED3\u72B6\u6001\u5728\u786E\u8BA4\u671F\u95F4\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u8BFB\u53D6\u540E\u4FEE\u6539", "COLLECTION_RULES_CHANGED");
43416
43733
  }
43417
43734
  assertCollectionWriteTarget(input3, anchor);
43418
- const setRules = apis2.setRules ?? ((params) => service_API_default.Resource.setCollectRules(params));
43735
+ const setRules = apis2.setRules ?? ((params) => FServiceAPI2.Resource.setCollectRules(params));
43419
43736
  const unconfirmed = (error3) => {
43420
43737
  const reason = platformFailureMessage(error3, "");
43421
43738
  return new CliError(
@@ -43489,7 +43806,7 @@ async function assertCollectionManualWritable(target, apis2) {
43489
43806
  if (target.info.status === 2) throw new CliError("\u51BB\u7ED3\u5408\u96C6\u4E0D\u80FD\u4FEE\u6539\u76EE\u5F55\u8349\u7A3F", "COLLECTION_FROZEN");
43490
43807
  if (target.info.rssSource === "yes" || typeof target.info.feedUrl === "string" && target.info.feedUrl.trim())
43491
43808
  throw new CliError("RSS \u5408\u96C6\u4E0D\u80FD\u624B\u5DE5\u4FEE\u6539\u76EE\u5F55", "COLLECTION_RSS_READONLY");
43492
- const getRules = apis2?.getRules ?? ((params) => service_API_default.Resource.getCollectionCollectRules(params));
43809
+ const getRules = apis2?.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
43493
43810
  const rules = parseCollectionCollectRules(await getRules({ resourceId: target.resourceId }));
43494
43811
  if (rules.status === 1) throw new CliError("\u81EA\u52A8\u6536\u5F55\u5F00\u542F\u65F6\u4E0D\u80FD\u624B\u5DE5\u4FEE\u6539\u76EE\u5F55", "COLLECTION_AUTO_COLLECTING");
43495
43812
  }
@@ -43509,12 +43826,12 @@ async function readCollectionItemAuthorization(input3) {
43509
43826
  const target = await resolveCollectionTarget(input3);
43510
43827
  const catalogue = await readCollectionCatalogue(
43511
43828
  target.resourceId,
43512
- input3.apis?.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params))
43829
+ input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
43513
43830
  );
43514
43831
  const item = catalogue.find((row) => row.itemId === input3.itemId);
43515
43832
  if (!item || !isContractId(item.resourceId)) throw new CliError("\u76EE\u5F55\u8349\u7A3F\u6CA1\u6709\u8BE5\u5355\u54C1", "COLLECTION_ITEM_NOT_FOUND");
43516
43833
  const detail2 = contractResponseData(
43517
- await (input3.apis?.getItemDetail ?? ((params) => service_API_default.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: input3.itemId })
43834
+ await (input3.apis?.getItemDetail ?? ((params) => FServiceAPI2.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: input3.itemId })
43518
43835
  );
43519
43836
  if (!object3(detail2) || detail2.itemId !== item.itemId || !Array.isArray(detail2.resolveResourceContracts))
43520
43837
  throw invalid4();
@@ -43524,7 +43841,7 @@ async function readCollectionItemAuthorization(input3) {
43524
43841
  ids.push(row.resourceId);
43525
43842
  }
43526
43843
  if (!ids.includes(item.resourceId)) throw invalid4();
43527
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
43844
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
43528
43845
  const sourceResponse = await info2({ resourceIdOrName: item.resourceId, isLoadLatestVersionInfo: 1 });
43529
43846
  const rootSubject = contractSubjectFromInfo(sourceResponse, item.resourceId);
43530
43847
  if (rootSubject.type !== 1) throw invalid4();
@@ -43603,7 +43920,7 @@ async function applyCollectionItemContract(input3) {
43603
43920
  throw new CliError("\u786E\u8BA4\u671F\u95F4\u5355\u54C1\u6216\u5408\u540C\u5DF2\u53D8\u5316", "COLLECTION_ITEM_CATALOGUE_CHANGED");
43604
43921
  await assertContractSubjectsUnchanged(
43605
43922
  before.subjects,
43606
- input3.apis?.info ?? ((params) => service_API_default.Resource.info(params))
43923
+ input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
43607
43924
  );
43608
43925
  assertCollectionOperationActor(input3, initialScope);
43609
43926
  const body = {
@@ -43636,12 +43953,15 @@ async function applyCollectionItemContract(input3) {
43636
43953
  }
43637
43954
  });
43638
43955
  operation = markRemoteOperationSending(scope, operation);
43639
- const unknown2 = () => new CliError(
43640
- `\u5355\u54C1\u5E94\u7528\u7ED3\u679C\u672A\u786E\u8BA4\uFF0C\u64CD\u4F5C ${operation.operation.operationId} \u5DF2\u4FDD\u7559\uFF1B\u8BF7 collection publish resume \u6838\u9A8C`,
43641
- "COLLECTION_ITEM_AUTH_UNKNOWN"
43642
- );
43956
+ const unknown2 = (cause) => {
43957
+ const reason = platformFailureMessage(cause, "");
43958
+ return new CliError(
43959
+ `\u5355\u54C1\u5E94\u7528\u7ED3\u679C\u672A\u786E\u8BA4${reason ? `\uFF1A${reason}` : ""}\uFF0C\u64CD\u4F5C ${operation.operation.operationId} \u5DF2\u4FDD\u7559\uFF1B\u8BF7 collection publish resume \u6838\u9A8C`,
43960
+ "COLLECTION_ITEM_AUTH_UNKNOWN"
43961
+ );
43962
+ };
43643
43963
  try {
43644
- const response = await (input3.apis?.setItemAuthorization ?? ((params) => service_API_default.Resource.batchSetCollectionItemAuthorization_Draft(params)))(body);
43964
+ const response = await (input3.apis?.setItemAuthorization ?? ((params) => FServiceAPI2.Resource.batchSetCollectionItemAuthorization_Draft(params)))(body);
43645
43965
  const outcome = classifyApiResponse(response);
43646
43966
  if (outcome.kind === "rejected") {
43647
43967
  operation = markRemoteOperationRejected(scope, operation, {
@@ -43664,13 +43984,13 @@ async function applyCollectionItemContract(input3) {
43664
43984
  "COLLECTION_ITEM_AUTH_REJECTED"
43665
43985
  );
43666
43986
  }
43667
- throw unknown2();
43987
+ throw unknown2(error3);
43668
43988
  }
43669
43989
  try {
43670
43990
  const after = await readCollectionItemAuthorization(input3);
43671
43991
  await assertContractSubjectsUnchanged(
43672
43992
  before.subjects,
43673
- input3.apis?.info ?? ((params) => service_API_default.Resource.info(params))
43993
+ input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
43674
43994
  );
43675
43995
  assertCollectionOperationActor(input3, scope);
43676
43996
  if (after.item.resourceId !== before.item.resourceId || after.version !== before.version || authorizationPlanDigest(after.subjects) !== authorizationPlanDigest(before.subjects) || !after.state || authorizationPlanDigest(after.state) !== authorizationPlanDigest(plan.desired) || collectionCatalogueFingerprint(after.catalogue) !== collectionCatalogueFingerprint(before.catalogue))
@@ -43746,7 +44066,7 @@ async function recoverCollectionItemOperation(input3) {
43746
44066
  let confirmed = false;
43747
44067
  if (op.kind === "collection-item-sign" && op.contractPlan?.context.kind === "collection-item") {
43748
44068
  const expected = { id: op.sourceId, type: op.contractPlan.subjectType };
43749
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
44069
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
43750
44070
  const [actual] = await readContractSubjects([op.sourceId], info2);
43751
44071
  const revalidate = async () => {
43752
44072
  const current2 = await resolveCollectionTarget({ ...input3, selector: `id:${target.resourceId}` });
@@ -43775,7 +44095,7 @@ async function recoverCollectionItemOperation(input3) {
43775
44095
  const current2 = await readCollectionItemAuthorization({ ...input3, itemId: context5.itemId });
43776
44096
  await assertContractSubjectsUnchanged(
43777
44097
  current2.subjects,
43778
- input3.apis?.info ?? ((params) => service_API_default.Resource.info(params))
44098
+ input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
43779
44099
  );
43780
44100
  confirmed = current2.item.resourceId === context5.resourceId && current2.version === context5.version && current2.subjects.some((row) => row.id === op.authPlan.subjectId && row.type === op.authPlan.subjectType) && (op.state === "prepared" || !!current2.state && authorizationPlanDigest(current2.state) === (op.state === "rejected" ? op.previousStateSha256 : op.desiredStateSha256));
43781
44101
  } else if (op.kind === "collection-item-add") confirmed = await verifyCollectionItemAdd(input3, record21);
@@ -43800,7 +44120,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
43800
44120
  const target = await resolveCollectionTarget({ ...input3, selector: `id:${op.targetId}` });
43801
44121
  const after = observedCatalogue ?? await readCollectionCatalogue(
43802
44122
  target.resourceId,
43803
- input3.apis?.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params))
44123
+ input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
43804
44124
  );
43805
44125
  if (op.state === "prepared") return true;
43806
44126
  if (op.state === "rejected")
@@ -43832,7 +44152,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
43832
44152
  if (matches3.length !== 1) return false;
43833
44153
  if (!item.requiredContracts.length) continue;
43834
44154
  const detail2 = contractResponseData(
43835
- await (input3.apis?.getItemDetail ?? ((params) => service_API_default.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: matches3[0].itemId })
44155
+ await (input3.apis?.getItemDetail ?? ((params) => FServiceAPI2.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: matches3[0].itemId })
43836
44156
  );
43837
44157
  if (!object3(detail2) || detail2.itemId !== matches3[0].itemId || !Array.isArray(detail2.resolveResourceContracts))
43838
44158
  return false;
@@ -43844,7 +44164,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
43844
44164
  ].filter((subject, index, all3) => all3.findIndex((other) => other.id === subject.id) === index);
43845
44165
  const actualSubjects = await readContractSubjects(
43846
44166
  expectedSubjects.map((subject) => subject.id),
43847
- input3.apis?.info ?? ((params) => service_API_default.Resource.info(params))
44167
+ input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
43848
44168
  );
43849
44169
  if (actualSubjects.some((subject, index) => subject.type !== expectedSubjects[index].type)) return false;
43850
44170
  const contracts2 = await querySubjectContracts({
@@ -43854,7 +44174,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
43854
44174
  });
43855
44175
  await assertContractSubjectsUnchanged(
43856
44176
  expectedSubjects,
43857
- input3.apis?.info ?? ((params) => service_API_default.Resource.info(params))
44177
+ input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
43858
44178
  );
43859
44179
  const state = parseAuthorizationState({
43860
44180
  rootResourceId: item.resourceId,
@@ -44120,8 +44440,8 @@ function unavailable(r, userId, existing) {
44120
44440
  }
44121
44441
  async function pickCollectionItemSources(input3) {
44122
44442
  assertPlatformAllowed();
44123
- const request5 = input3.apis?.listResources ?? ((params) => service_API_default.Resource.list(params));
44124
- const typesRequest = input3.apis?.resourceTypes ?? ((params) => service_API_default.Resource.resourceTypes(params));
44443
+ const request5 = input3.apis?.listResources ?? ((params) => FServiceAPI2.Resource.list(params));
44444
+ const typesRequest = input3.apis?.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
44125
44445
  const select = input3.choose ?? ((message, choices) => (input3.prompts ?? headlessPrompts).selectQuestion(message, choices, "stderr"));
44126
44446
  const ask = input3.input ?? ((message) => (input3.prompts ?? headlessPrompts).askInput(message, "stderr"));
44127
44447
  const prompt2 = async (message, choices) => {
@@ -44306,7 +44626,7 @@ async function selectCollectionItemSources(input3) {
44306
44626
  async function listCollectionDraftItems(input3) {
44307
44627
  assertPlatformAllowed();
44308
44628
  const target = await resolveCollectionTarget(input3);
44309
- const getDraftItems = input3.apis?.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params));
44629
+ const getDraftItems = input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
44310
44630
  return readCollectionCatalogue(target.resourceId, getDraftItems, {
44311
44631
  keywords: input3.search,
44312
44632
  sortField: input3.sortField,
@@ -44350,7 +44670,7 @@ async function writeAndReadManualEdit(input3, resourceId, request5, params) {
44350
44670
  } catch (error3) {
44351
44671
  const rejection = platformRejectionDescription(error3);
44352
44672
  if (rejection) throw new CliError(rejection.message, "COLLECTION_ITEM_WRITE_REJECTED");
44353
- throw manualEditUnknown();
44673
+ throw manualEditUnknown(platformFailureMessage(error3, ""));
44354
44674
  }
44355
44675
  const outcome = classifyApiResponse(response);
44356
44676
  if (outcome.kind === "rejected")
@@ -44361,8 +44681,8 @@ async function writeAndReadManualEdit(input3, resourceId, request5, params) {
44361
44681
  if (outcome.kind !== "success") throw manualEditUnknown();
44362
44682
  try {
44363
44683
  return await listCollectionDraftItems({ ...input3, selector: `id:${resourceId}` });
44364
- } catch {
44365
- throw manualEditUnknown();
44684
+ } catch (error3) {
44685
+ throw manualEditUnknown(platformFailureMessage(error3, ""));
44366
44686
  }
44367
44687
  });
44368
44688
  }
@@ -44381,7 +44701,7 @@ async function renameCollectionDraftItem(input3) {
44381
44701
  throw new CliError("\u76EE\u5F55\u8349\u7A3F\u4E2D\u4E0D\u5B58\u5728\u8BE5 itemId", "COLLECTION_ITEM_NOT_FOUND");
44382
44702
  await confirmManualEdit(input3, target.resourceId, items, `\u4FEE\u6539\u5355\u54C1\u6807\u9898
44383
44703
  ${input3.itemId} \u2192 ${quotedItemTitle(title)}`);
44384
- const rename = input3.apis?.renameDraftItems ?? ((params) => service_API_default.Resource.updateCollectionItemsInfo_Draft(params));
44704
+ const rename = input3.apis?.renameDraftItems ?? ((params) => FServiceAPI2.Resource.updateCollectionItemsInfo_Draft(params));
44385
44705
  const after = await writeAndReadManualEdit(input3, target.resourceId, rename, {
44386
44706
  resourceId: target.resourceId,
44387
44707
  data: [{ itemId: input3.itemId, itemTitle: title }]
@@ -44401,7 +44721,7 @@ async function removeCollectionDraftItems(input3) {
44401
44721
  throw new CliError("\u76EE\u5F55\u8349\u7A3F\u4E2D\u5B58\u5728\u627E\u4E0D\u5230\u7684 itemId", "COLLECTION_ITEM_NOT_FOUND");
44402
44722
  await confirmManualEdit(input3, target.resourceId, before, `\u4ECE\u76EE\u5F55\u8349\u7A3F\u79FB\u9664 ${ids.length} \u4E2A\u5355\u54C1
44403
44723
  ${ids.join("\n")}`);
44404
- const remove = input3.apis?.removeDraftItems ?? ((params) => service_API_default.Resource.deleteCollectionItems_Draft(params));
44724
+ const remove = input3.apis?.removeDraftItems ?? ((params) => FServiceAPI2.Resource.deleteCollectionItems_Draft(params));
44405
44725
  const after = await writeAndReadManualEdit(input3, target.resourceId, remove, {
44406
44726
  resourceId: target.resourceId,
44407
44727
  removeCollectionItemIds: ids
@@ -44442,7 +44762,7 @@ async function moveCollectionDraftItem(input3) {
44442
44762
  items,
44443
44763
  `\u79FB\u52A8\u5355\u54C1 ${moving.itemId} \u5230 ${input3.before ? "\u4E4B\u524D" : "\u4E4B\u540E"} ${anchor.itemId}`
44444
44764
  );
44445
- const move = input3.apis?.moveDraftItems ?? ((params) => service_API_default.Resource.setCollectionItemsSortID_Draft(params));
44765
+ const move = input3.apis?.moveDraftItems ?? ((params) => FServiceAPI2.Resource.setCollectionItemsSortID_Draft(params));
44446
44766
  const after = await writeAndReadManualEdit(input3, target.resourceId, move, {
44447
44767
  resourceId: target.resourceId,
44448
44768
  data: { itemIds: [moving.itemId], targetSortId }
@@ -44467,7 +44787,7 @@ async function sortCollectionDraftItems(input3) {
44467
44787
  "resource-updated": "resourceUpdateDate"
44468
44788
  }[input3.by];
44469
44789
  await confirmManualEdit(input3, target.resourceId, before, `\u6309${input3.by} ${input3.direction}\u91CD\u65B0\u6392\u5E8F\u76EE\u5F55\u8349\u7A3F`);
44470
- const reorder = input3.apis?.reorderDraftItems ?? ((params) => service_API_default.Resource.reorderCollectionItems_Draft(params));
44790
+ const reorder = input3.apis?.reorderDraftItems ?? ((params) => FServiceAPI2.Resource.reorderCollectionItems_Draft(params));
44471
44791
  const after = await writeAndReadManualEdit(input3, target.resourceId, reorder, {
44472
44792
  resourceId: target.resourceId,
44473
44793
  sortField: reorderSortField,
@@ -44486,13 +44806,13 @@ async function collectionDraftAuthStatus(input3) {
44486
44806
  throw new CliError("itemId\u4E0D\u80FD\u4E3A\u7A7A\u6216\u5305\u542B\u7A7A\u767D\u3001\u9017\u53F7\u6216\u63A7\u5236\u5B57\u7B26", "COLLECTION_ITEM_ID_INVALID");
44487
44807
  }
44488
44808
  const target = await resolveCollectionTarget(input3);
44489
- const getDraftItems = input3.apis?.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params));
44809
+ const getDraftItems = input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
44490
44810
  const catalogue = await readCollectionCatalogue(target.resourceId, getDraftItems);
44491
44811
  const sources = new Map(catalogue.map((item) => [item.itemId, item.resourceId]));
44492
44812
  if (ids.some((id11) => !sources.has(id11))) throw new CliError("\u76EE\u5F55\u8349\u7A3F\u4E2D\u4E0D\u5B58\u5728\u8BE5 itemId", "COLLECTION_ITEM_NOT_FOUND");
44493
44813
  if (ids.some((id11) => invalidId(sources.get(id11))))
44494
44814
  throw new CliError("\u5E73\u53F0\u76EE\u5F55\u6765\u6E90\u8D44\u6E90ID\u683C\u5F0F\u65E0\u6548", "COLLECTION_ITEMS_RESPONSE_INVALID");
44495
- const getAuth = input3.apis?.getDraftAuth ?? ((params) => service_API_default.Resource.getCollectionItemsAuth_Draft(params));
44815
+ const getAuth = input3.apis?.getDraftAuth ?? ((params) => FServiceAPI2.Resource.getCollectionItemsAuth_Draft(params));
44496
44816
  const response = await getAuth({ resourceId: target.resourceId, itemIds: ids.join(",") });
44497
44817
  const invalid15 = () => new CliError("\u5E73\u53F0\u5355\u54C1\u6388\u6743\u72B6\u6001\u54CD\u5E94\u4E0D\u5B8C\u6574\u6216\u65E0\u6548", "COLLECTION_ITEM_AUTH_RESPONSE_INVALID");
44498
44818
  if (!response || typeof response !== "object" || Array.isArray(response) || classifyApiResponse(response).kind !== "success" || !("data" in response) || !Array.isArray(response.data) || response.data.length !== ids.length)
@@ -44509,7 +44829,7 @@ async function collectionDraftAuthStatus(input3) {
44509
44829
  }
44510
44830
  async function checkCollectionItemExistence(resourceId, ids, existing, apis2) {
44511
44831
  const invalid15 = () => new CliError("\u5E73\u53F0\u8349\u7A3F\u5355\u54C1\u5224\u91CD\u54CD\u5E94\u4E0D\u5B8C\u6574\u6216\u65E0\u6548\uFF0C\u672A\u63D0\u4EA4\u6DFB\u52A0\u3002", "COLLECTION_ITEM_EXISTENCE_RESPONSE_INVALID");
44512
- const check = apis2?.checkItems ?? ((params) => service_API_default.Resource.resourceIsExistInItems_Draft(params));
44832
+ const check = apis2?.checkItems ?? ((params) => FServiceAPI2.Resource.resourceIsExistInItems_Draft(params));
44513
44833
  let response;
44514
44834
  try {
44515
44835
  response = await check({ resourceId, resourceIds: ids.join(",") });
@@ -44552,7 +44872,7 @@ async function addCollectionDraftItems(input3) {
44552
44872
  await assertCollectionManualWritable(target, input3.apis);
44553
44873
  const draft = await listCollectionDraftItems({ ...input3, selector: `id:${target.resourceId}` });
44554
44874
  const existing = new Set(draft.map((item) => item.resourceId));
44555
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
44875
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
44556
44876
  const candidates = [];
44557
44877
  const unchanged = [];
44558
44878
  const sourceOrder = [];
@@ -44625,7 +44945,7 @@ ${candidates.map((item) => `- ${item.resourceId} ${quotedItemTitle(item.title)}`
44625
44945
  await revalidate();
44626
44946
  await signing.assertSubjects();
44627
44947
  assertCollectionOperationActor(input3, initialScope);
44628
- const addDraftItems = input3.apis?.addDraftItems ?? ((params) => service_API_default.Resource.addResourceItems_Draft(params));
44948
+ const addDraftItems = input3.apis?.addDraftItems ?? ((params) => FServiceAPI2.Resource.addResourceItems_Draft(params));
44629
44949
  const planItems = candidates.map((item) => ({
44630
44950
  resourceId: item.resourceId,
44631
44951
  itemTitle: item.title,
@@ -44684,7 +45004,9 @@ ${candidates.map((item) => `- ${item.resourceId} ${quotedItemTitle(item.title)}`
44684
45004
  "COLLECTION_ITEM_ADD_REJECTED"
44685
45005
  );
44686
45006
  }
44687
- throw collectionItemAddUnknown();
45007
+ const failure = collectionItemAddUnknown();
45008
+ const reason = platformFailureMessage(error3, "");
45009
+ throw reason ? new CliError(`${failure.message} \u5E73\u53F0\u8FD4\u56DE\uFF1A${reason}`, failure.code) : failure;
44688
45010
  }
44689
45011
  const requested = candidates.map((item) => item.resourceId);
44690
45012
  const groups = parseCollectionItemAddResult(response, requested);
@@ -44946,7 +45268,7 @@ async function readCollectionTagRecommendations(resourceTypeCode, availableTags2
44946
45268
  const invalid15 = () => new CliError("\u65E0\u6CD5\u5B8C\u6574\u8BFB\u53D6\u5408\u96C6\u6807\u7B7E\uFF0C\u8BF7\u6838\u5BF9\u5E73\u53F0\u540E\u91CD\u8BD5\uFF1B\u672C\u6B21\u672A\u63D0\u4EA4\u4FEE\u6539", "COLLECTION_TAGS_RESPONSE_INVALID");
44947
45269
  let response;
44948
45270
  try {
44949
- response = await (availableTags2 ?? ((params) => service_API_default.Resource.availableTags(params)))({ resourceTypeCode });
45271
+ response = await (availableTags2 ?? ((params) => FServiceAPI2.Resource.availableTags(params)))({ resourceTypeCode });
44950
45272
  } catch (error3) {
44951
45273
  throwPlatformReadError(error3, {
44952
45274
  code: "COLLECTION_TAGS_RESPONSE_INVALID",
@@ -44979,7 +45301,7 @@ async function prompt(ask) {
44979
45301
  try {
44980
45302
  return await ask();
44981
45303
  } catch (error3) {
44982
- const cancelled3 = error3 instanceof Error && ["ExitPromptError", "AbortPromptError"].includes(error3.name);
45304
+ const cancelled3 = error3 instanceof CliError && ["CANCELLED", "FORM_CANCELLED"].includes(error3.code ?? "") || error3 instanceof Error && ["ExitPromptError", "AbortPromptError"].includes(error3.name);
44983
45305
  throw new CliError(
44984
45306
  cancelled3 ? "\u5DF2\u53D6\u6D88\u6807\u7B7E\u7F16\u8F91\uFF0C\u672A\u63D0\u4EA4\u4FEE\u6539" : "\u6807\u7B7E\u7F16\u8F91\u672A\u80FD\u5B8C\u6210\uFF0C\u672A\u63D0\u4EA4\u4FEE\u6539",
44985
45307
  cancelled3 ? "FORM_CANCELLED" : "COLLECTION_TAGS_PROMPT_FAILED"
@@ -45179,7 +45501,7 @@ function readCover(cwd, source) {
45179
45501
  }
45180
45502
  }
45181
45503
  async function uploadCover(file3, apis2) {
45182
- const upload = apis2?.uploadImage ?? ((params) => service_API_default.Storage.uploadImage(params));
45504
+ const upload = apis2?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params));
45183
45505
  const result = await upload({ file: file3 });
45184
45506
  if (!result || typeof result !== "object" || Array.isArray(result) || classifyApiResponse(result).kind !== "success" || !("data" in result) || !result.data || typeof result.data !== "object" || Array.isArray(result.data)) {
45185
45507
  throw new CliError(
@@ -45281,7 +45603,7 @@ async function updateCollectionListing(input3) {
45281
45603
  syncTitleCache(verified2, false);
45282
45604
  return payload;
45283
45605
  }
45284
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
45606
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
45285
45607
  if (coverFile)
45286
45608
  (input3.reporter ?? silentReporter).warn(
45287
45609
  "\u63D0\u793A\uFF1ACLI \u4E0D\u63D0\u4F9B\u5C01\u9762\u88C1\u526A\uFF0C\u5C06\u4E0A\u4F20\u539F\u56FE\uFF1B\u8BF7\u5148\u5728\u672C\u5730\u786E\u8BA4\u6784\u56FE\u3001\u5C3A\u5BF8\u548C\u5C55\u793A\u6548\u679C\u3002"
@@ -45503,7 +45825,7 @@ async function readPages(options2) {
45503
45825
  }
45504
45826
  }
45505
45827
  function contractsRequest(apis2) {
45506
- return apis2?.getContracts ?? ((params) => service_API_default.Contract.contracts(params));
45828
+ return apis2?.getContracts ?? ((params) => FServiceAPI2.Contract.contracts(params));
45507
45829
  }
45508
45830
  function contractPages(targetId, options2, request5, filter2 = {}) {
45509
45831
  return readPages({
@@ -45518,7 +45840,7 @@ async function listCollectionUpdateLogs(input3) {
45518
45840
  readLimit(input3);
45519
45841
  const target = await resolveCollectionTarget(input3);
45520
45842
  await confirmAll(input3, target.resourceName);
45521
- const getLogs = input3.apis?.getLogs ?? ((params) => service_API_default.Resource.getCollectionUpdateLogs(params));
45843
+ const getLogs = input3.apis?.getLogs ?? ((params) => FServiceAPI2.Resource.getCollectionUpdateLogs(params));
45522
45844
  return readPages({
45523
45845
  ...input3,
45524
45846
  responseError: "COLLECTION_LOG_RESPONSE_INVALID",
@@ -45555,7 +45877,7 @@ async function getCollectionContract(input3) {
45555
45877
  contractsRequest(input3.apis)
45556
45878
  );
45557
45879
  if (!found) throw new CliError("\u8BE5\u5408\u540C\u4E0D\u5C5E\u4E8E\u5F53\u524D\u5408\u96C6\u7684\u6388\u6743\u5408\u7EA6", "COLLECTION_CONTRACT_NOT_FOUND");
45558
- const getContract = input3.apis?.getContract ?? ((params) => service_API_default.Contract.contractDetails(params));
45880
+ const getContract = input3.apis?.getContract ?? ((params) => FServiceAPI2.Contract.contractDetails(params));
45559
45881
  const response = await getContract({ contractId, isLoadPolicyInfo: 1 });
45560
45882
  if (!successful(response) || !record12(response.data) || response.data.contractId !== contractId || !validContract(response.data, target.resourceId) || response.data.subjectType !== found.subjectType) {
45561
45883
  throw new CliError("\u5E73\u53F0\u5408\u540C\u8BE6\u60C5\u8EAB\u4EFD\u3001\u5F52\u5C5E\u6216\u54CD\u5E94\u65E0\u6548", "COLLECTION_CONTRACT_RESPONSE_INVALID");
@@ -45795,14 +46117,40 @@ var init_optionKey = __esm({
45795
46117
  }
45796
46118
  });
45797
46119
 
46120
+ // src/platform/fileAnalysis.ts
46121
+ async function readFileAnalysis(params, consume) {
46122
+ let opened = false;
46123
+ try {
46124
+ return await withNodeStreamRequest(
46125
+ (controls) => FServiceAPI2.Storage.filesListInfoSse(params, controls),
46126
+ (stream4) => {
46127
+ opened = true;
46128
+ return consume(stream4);
46129
+ }
46130
+ );
46131
+ } catch (error3) {
46132
+ if (opened) throw error3;
46133
+ throwPlatformReadError(error3, {
46134
+ code: "FILE_ANALYZE_CONNECT_FAILED",
46135
+ message: "\u65E0\u6CD5\u8FDE\u63A5\u5C5E\u6027\u89E3\u6790\u670D\u52A1\u6216\u8FDE\u63A5\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u4EE3\u7406\u8BBE\u7F6E"
46136
+ });
46137
+ }
46138
+ }
46139
+ var init_fileAnalysis = __esm({
46140
+ "src/platform/fileAnalysis.ts"() {
46141
+ "use strict";
46142
+ init_api();
46143
+ init_readRequest();
46144
+ }
46145
+ });
46146
+
45798
46147
  // src/domain/artifacts/analyze.ts
45799
46148
  import { StringDecoder } from "string_decoder";
45800
46149
  async function waitAnalyze(sha1, typeCode, apis2) {
45801
- const filesListInfoSse2 = apis2.filesListInfoSse ?? ((params) => {
45802
- assertPlatformAllowed();
45803
- return service_API_default.Storage.filesListInfoSse(params);
45804
- });
45805
- return waitAnalyzeSse(await filesListInfoSse2({ sha1, resourceTypeCode: typeCode }), sha1);
46150
+ const params = { sha1, resourceTypeCode: typeCode };
46151
+ if (apis2.filesListInfoSse) return waitAnalyzeSse(await apis2.filesListInfoSse(params), sha1);
46152
+ assertPlatformAllowed();
46153
+ return readFileAnalysis(params, (stream4) => waitAnalyzeSse(stream4, sha1));
45806
46154
  }
45807
46155
  async function waitAnalyzeSse(stream4, sha1, timeoutMs = 12e4) {
45808
46156
  let buffer = "";
@@ -45832,8 +46180,8 @@ async function waitAnalyzeSse(stream4, sha1, timeoutMs = 12e4) {
45832
46180
  if (line.startsWith("data:")) dataLines.push(line.slice("data:".length).replace(/^ /u, ""));
45833
46181
  return void 0;
45834
46182
  };
45835
- const iterator2 = stream4[Symbol.asyncIterator]();
45836
46183
  try {
46184
+ const iterator2 = stream4[Symbol.asyncIterator]();
45837
46185
  while (true) {
45838
46186
  const remaining = deadline - Date.now();
45839
46187
  if (remaining <= 0) throw new CliError("\u5C5E\u6027\u89E3\u6790\u8D85\u65F6", "FILE_ANALYZE_TIMEOUT");
@@ -45877,7 +46225,7 @@ var init_analyze = __esm({
45877
46225
  "src/domain/artifacts/analyze.ts"() {
45878
46226
  "use strict";
45879
46227
  init_errors();
45880
- init_api();
46228
+ init_fileAnalysis();
45881
46229
  init_env();
45882
46230
  }
45883
46231
  });
@@ -46050,7 +46398,7 @@ async function loadAttributeDefinitions(attributes, includeDefinitions, apis2) {
46050
46398
  if (includeDefinitions === false) return attributes;
46051
46399
  const getDefinition = apis2.getAttrsInfoByKey ?? ((params) => {
46052
46400
  assertPlatformAllowed();
46053
- return service_API_default.Resource.getAttrsInfoByKey(params);
46401
+ return FServiceAPI2.Resource.getAttrsInfoByKey(params);
46054
46402
  });
46055
46403
  return Promise.all(
46056
46404
  attributes.map(async (attribute) => {
@@ -46067,7 +46415,7 @@ async function loadAttributeDefinitions(attributes, includeDefinitions, apis2) {
46067
46415
  async function loadTypeSystemAttributes(input3) {
46068
46416
  assertPlatformAllowed();
46069
46417
  const apis2 = input3.apis ?? {};
46070
- const filesInfo2 = apis2.filesInfo ?? ((params) => service_API_default.Storage.filesInfo(params));
46418
+ const filesInfo2 = apis2.filesInfo ?? ((params) => FServiceAPI2.Storage.filesInfo(params));
46071
46419
  const typeMetadata = await requestData(async () => {
46072
46420
  const response = await filesInfo2({ resourceTypeCode: input3.typeCode });
46073
46421
  if (!record13(response) || classifyApiResponse(response).kind !== "success" || !record13(response.data))
@@ -46092,7 +46440,7 @@ async function loadSystemAttributes(input3) {
46092
46440
  if (input3.analysis === void 0 && !input3.sha1) {
46093
46441
  const getByCode = apis2.getByCode ?? ((params) => {
46094
46442
  assertPlatformAllowed();
46095
- return service_API_default.Resource.getResourceTypeInfoByCode(params);
46443
+ return FServiceAPI2.Resource.getResourceTypeInfoByCode(params);
46096
46444
  });
46097
46445
  const type = await requestData(() => getByCode({ code: input3.typeCode }));
46098
46446
  const attrs = type.attrs;
@@ -46258,7 +46606,7 @@ async function loadCollectionSystemRules(type, apis2 = {}) {
46258
46606
  for (const field of namespace) addIdentity(field, false);
46259
46607
  const filesInfo2 = apis2.filesInfo ?? ((params) => {
46260
46608
  assertPlatformAllowed();
46261
- return service_API_default.Storage.filesInfo(params);
46609
+ return FServiceAPI2.Storage.filesInfo(params);
46262
46610
  });
46263
46611
  const data3 = await requestData2(() => filesInfo2({ resourceTypeCode: type.code }));
46264
46612
  if (!Array.isArray(data3.metaInfoArray)) return responseInvalid();
@@ -46274,7 +46622,7 @@ async function loadCollectionSystemRules(type, apis2 = {}) {
46274
46622
  }
46275
46623
  const getDefinition = apis2.getAttrsInfoByKey ?? ((params) => {
46276
46624
  assertPlatformAllowed();
46277
- return service_API_default.Resource.getAttrsInfoByKey(params);
46625
+ return FServiceAPI2.Resource.getAttrsInfoByKey(params);
46278
46626
  });
46279
46627
  let attrs;
46280
46628
  try {
@@ -46727,7 +47075,7 @@ var init_store = __esm({
46727
47075
  });
46728
47076
 
46729
47077
  // src/domain/collection/form/service.ts
46730
- function unwrapData3(result) {
47078
+ function unwrapData2(result) {
46731
47079
  const data3 = responseData2(result, "COLLECTION_FORM_RESPONSE_INVALID");
46732
47080
  if (!data3 || typeof data3 !== "object" || Array.isArray(data3))
46733
47081
  throw new CliError("\u5E73\u53F0\u5408\u96C6\u8868\u5355\u54CD\u5E94\u683C\u5F0F\u65E0\u6CD5\u8BC6\u522B", "COLLECTION_FORM_RESPONSE_INVALID");
@@ -46741,8 +47089,8 @@ async function readPublishedCollectionForm(input3) {
46741
47089
  return { form: emptyForm(), authExcludedItems: [] };
46742
47090
  }
46743
47091
  if (!latest.trim()) throw new CliError("\u5408\u96C6\u6700\u65B0\u5FEB\u7167\u5B57\u6BB5\u65E0\u6548", "COLLECTION_FORM_RESPONSE_INVALID");
46744
- const versionInfo = input3.apis?.versionInfo ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
46745
- const version2 = unwrapData3(await versionInfo({ resourceId: input3.resourceId, version: latest }));
47092
+ const versionInfo = input3.apis?.versionInfo ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
47093
+ const version2 = unwrapData2(await versionInfo({ resourceId: input3.resourceId, version: latest }));
46746
47094
  if (version2.resourceId !== input3.resourceId || version2.version !== latest)
46747
47095
  throw new CliError("\u5DF2\u53D1\u5E03\u5408\u96C6\u5FEB\u7167\u8EAB\u4EFD\u6216\u7248\u672C\u4E0D\u5339\u914D", "COLLECTION_FORM_RESPONSE_INVALID");
46748
47096
  return {
@@ -47784,7 +48132,7 @@ async function assertDependencyDeclarations(input3) {
47784
48132
  let target;
47785
48133
  try {
47786
48134
  target = contractResponseData(
47787
- await (input3.apis?.dependencyInfo ?? ((params) => service_API_default.Resource.info(params)))({
48135
+ await (input3.apis?.dependencyInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
47788
48136
  resourceIdOrName: dependency.resourceId,
47789
48137
  isLoadLatestVersionInfo: 1
47790
48138
  })
@@ -47804,7 +48152,7 @@ async function assertDependencyDeclarations(input3) {
47804
48152
  resourceId: dependency.resourceId,
47805
48153
  subjectType,
47806
48154
  latestVersion: target.latestVersion,
47807
- read: input3.apis?.dependencyVersions ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params)),
48155
+ read: input3.apis?.dependencyVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
47808
48156
  invalidCode: "DEPENDENCY_VERSIONS_INVALID"
47809
48157
  });
47810
48158
  assertRangeMatches(versions, dependency.versionRange, "DEPENDENCY_RANGE_INVALID", subjectType);
@@ -47813,7 +48161,7 @@ async function assertDependencyDeclarations(input3) {
47813
48161
  let cycle;
47814
48162
  try {
47815
48163
  cycle = contractResponseData(
47816
- await (input3.apis?.cycleDependencyCheck ?? ((params) => service_API_default.Resource.cycleDependencyCheck(params)))({ resourceId: input3.resourceId, dependencies })
48164
+ await (input3.apis?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params)))({ resourceId: input3.resourceId, dependencies })
47817
48165
  );
47818
48166
  } catch (error3) {
47819
48167
  throwPlatformReadError(error3, {
@@ -47842,8 +48190,8 @@ var init_validation = __esm({
47842
48190
  // src/domain/collection/publish.ts
47843
48191
  function itemRequests(apis2) {
47844
48192
  return {
47845
- published: apis2?.getPublishedItems ?? ((params) => service_API_default.Resource.getCollectionItems(params)),
47846
- draft: apis2?.getDraftItems ?? ((params) => service_API_default.Resource.getCollectionItems_Draft(params))
48193
+ published: apis2?.getPublishedItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems(params)),
48194
+ draft: apis2?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
47847
48195
  };
47848
48196
  }
47849
48197
  function assertWritable3(target) {
@@ -48098,7 +48446,7 @@ async function publishCollection(input3) {
48098
48446
  sentAt: (/* @__PURE__ */ new Date()).toISOString()
48099
48447
  });
48100
48448
  snapshot2 = saveCollectionIntent(input3.cwd, { ...snapshot2.intent, state: "sending" }, snapshot2);
48101
- const update2 = input3.apis?.updateCollection ?? ((params) => service_API_default.Resource.updateCollection(params));
48449
+ const update2 = input3.apis?.updateCollection ?? ((params) => FServiceAPI2.Resource.updateCollection(params));
48102
48450
  let result;
48103
48451
  let rejectionMessage;
48104
48452
  try {
@@ -48288,12 +48636,12 @@ var init_provider = __esm({
48288
48636
  });
48289
48637
 
48290
48638
  // src/domain/dependencyAuthorization/host.ts
48291
- import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
48639
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
48292
48640
  import { createHash as createHash15, randomUUID as randomUUID4 } from "crypto";
48293
48641
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
48294
48642
  import { z as z15 } from "zod";
48295
48643
  function createDependencyAuthorizationHost(input3) {
48296
- const queryContext = new AsyncLocalStorage2();
48644
+ const queryContext = new AsyncLocalStorage3();
48297
48645
  const scope = { ...input3.runtime.account, ...input3.homeDir ? { homeDir: input3.homeDir } : {} };
48298
48646
  const assertOutsideQuery = () => {
48299
48647
  if (queryContext.getStore())
@@ -48820,14 +49168,129 @@ var init_runtime = __esm({
48820
49168
  }
48821
49169
  });
48822
49170
 
49171
+ // src/domain/node/pending.ts
49172
+ function isNodeRecoveryKind(kind) {
49173
+ return nodeRecoveryKinds.includes(kind);
49174
+ }
49175
+ function isExhibitRecoveryOperation(operation) {
49176
+ return operation.targetType === 2 && !["dependency-sign", "exhibit-create"].includes(operation.kind) && !isNodeRecoveryKind(operation.kind);
49177
+ }
49178
+ function operationNodeId(operation) {
49179
+ if (operation.targetType !== 2 || operation.kind === "node-create" || operation.kind === "exhibit-create")
49180
+ return null;
49181
+ const value = operation.kind === "exhibit-collection-create" || operation.kind === "node-source-sign" || operation.kind === "exhibit-source-sign" ? operation.targetId : operation.sourceId;
49182
+ if (!/^[1-9]\d*$/u.test(value) || !Number.isSafeInteger(Number(value)))
49183
+ throw new CliError("\u672A\u51B3\u64CD\u4F5C\u7684\u8282\u70B9\u8303\u56F4\u4E0D\u53EF\u4FE1\uFF0C\u5DF2\u4FDD\u7559\u8BB0\u5F55\uFF0C\u8BF7\u5148\u6062\u590D\u6838\u9A8C", "REMOTE_OPERATION_INVALID");
49184
+ return Number(value);
49185
+ }
49186
+ function assertNoNodePending(scope, nodeId3) {
49187
+ const found = listRemoteOperations(scope).find(({ operation }) => operationNodeId(operation) === nodeId3);
49188
+ if (found)
49189
+ throw new CliError(
49190
+ `\u8282\u70B9 ${nodeId3} \u5DF2\u6709\u672A\u51B3\u64CD\u4F5C ${found.operation.operationId}\uFF0C\u8BF7\u5148 ${isNodeRecoveryKind(found.operation.kind) ? "node" : "exhibit"} recover ${found.operation.operationId}`,
49191
+ "REMOTE_OPERATION_PENDING"
49192
+ );
49193
+ }
49194
+ var nodeRecoveryKinds;
49195
+ var init_pending = __esm({
49196
+ "src/domain/node/pending.ts"() {
49197
+ "use strict";
49198
+ init_errors();
49199
+ init_remoteOperations();
49200
+ nodeRecoveryKinds = ["node-create", "node-info", "node-access", "node-delete"];
49201
+ }
49202
+ });
49203
+
49204
+ // src/adapters/authModuleRequests.ts
49205
+ import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
49206
+ async function withAuthModuleRequests(run) {
49207
+ const state = { closed: false };
49208
+ try {
49209
+ return await invocation.run(state, run);
49210
+ } catch (error3) {
49211
+ if (error3 instanceof AuthRequestFailure) throw error3.failure;
49212
+ throw error3;
49213
+ } finally {
49214
+ state.closed = true;
49215
+ }
49216
+ }
49217
+ function installRequestCheck() {
49218
+ if (installed) return;
49219
+ const request5 = utils_default2.Request;
49220
+ utils_default2.Request = (...args) => {
49221
+ const check = invocation.getStore()?.check;
49222
+ return check ? check(args[0], () => request5(...args)) : request5(...args);
49223
+ };
49224
+ installed = true;
49225
+ }
49226
+ function guardExhibitCreation(runtime) {
49227
+ const state = invocation.getStore();
49228
+ if (!state) return;
49229
+ installRequestCheck();
49230
+ state.check = async (config, send) => {
49231
+ if (config.method?.toUpperCase() !== "POST" || config.url !== "/v2/presentables") return send();
49232
+ let dispatched = false;
49233
+ try {
49234
+ const body = config.data;
49235
+ const node2 = body && typeof body === "object" ? Object.getOwnPropertyDescriptor(body, "nodeId")?.value : void 0;
49236
+ if (typeof node2 !== "number" || !Number.isSafeInteger(node2) || node2 <= 0)
49237
+ throw new CliError("\u521B\u5EFA\u5C55\u54C1\u8BF7\u6C42\u7F3A\u5C11\u6709\u6548\u8282\u70B9ID\uFF0C\u5DF2\u505C\u6B62\u63D0\u4EA4", "NODE_ID_INVALID");
49238
+ return await runtime.journal.withLock(() => {
49239
+ if (state.closed || config.signal?.aborted) throw new CliError("\u5DF2\u53D6\u6D88\u64CD\u4F5C", "CANCELLED");
49240
+ runtime.assertAccount();
49241
+ assertNoNodePending(runtime.account, node2);
49242
+ dispatched = true;
49243
+ return send();
49244
+ });
49245
+ } catch (error3) {
49246
+ if (dispatched) {
49247
+ const refusal = apiFailureDetails(error3);
49248
+ if (refusal?.kind === "http" && refusal.status === 403 && refusal.message?.trim()) {
49249
+ throw new AuthRequestFailure(
49250
+ new CliError(
49251
+ safePlatformMessage(refusal.message) ?? "\u6CA1\u6709\u6743\u9650\u5411\u8BE5\u8282\u70B9\u65B0\u589E\u5C55\u54C1\uFF0C\u8BF7\u68C0\u67E5\u8D26\u53F7\u53CA\u8282\u70B9\u6743\u9650",
49252
+ "PLATFORM_FORBIDDEN"
49253
+ )
49254
+ );
49255
+ }
49256
+ throw error3;
49257
+ }
49258
+ throw new AuthRequestFailure(
49259
+ error3 instanceof CliError ? error3 : new CliError("\u672A\u80FD\u68C0\u67E5\u8282\u70B9\u672A\u51B3\u64CD\u4F5C\uFF0C\u5DF2\u505C\u6B62\u521B\u5EFA\u5C55\u54C1", "EXHIBIT_CREATE_CHECK_FAILED")
49260
+ );
49261
+ }
49262
+ };
49263
+ }
49264
+ var invocation, installed, AuthRequestFailure;
49265
+ var init_authModuleRequests = __esm({
49266
+ "src/adapters/authModuleRequests.ts"() {
49267
+ "use strict";
49268
+ init_dist();
49269
+ init_errors();
49270
+ init_platformError();
49271
+ init_pending();
49272
+ init_api();
49273
+ invocation = new AsyncLocalStorage4();
49274
+ installed = false;
49275
+ AuthRequestFailure = class extends AuthCommandError {
49276
+ constructor(failure) {
49277
+ super(failure.message, failure.code ?? "CLI_ERROR", { category: "rejected" });
49278
+ this.failure = failure;
49279
+ }
49280
+ failure;
49281
+ };
49282
+ }
49283
+ });
49284
+
48823
49285
  // src/adapters/authModuleHost.ts
48824
49286
  function createAuthCommandHost(register, root) {
48825
49287
  let provider;
49288
+ const exhibitCreationCommands = /* @__PURE__ */ new WeakSet();
48826
49289
  const runtime = (command, online) => {
48827
49290
  const shared = readSharedOptions(command);
48828
49291
  if (online && shared.file !== void 0)
48829
49292
  throw new CliError("\u7EBF\u4E0A\u6388\u6743\u547D\u4EE4\u4E0D\u63A5\u53D7 --resource", "NODE_RESOURCE_SELECTOR_UNSUPPORTED");
48830
- return createAuthRuntime({
49293
+ const context5 = createAuthRuntime({
48831
49294
  cwd: resolveCwd(shared.cwd),
48832
49295
  yes: shared.yes,
48833
49296
  json: shared.json,
@@ -48839,6 +49302,8 @@ function createAuthCommandHost(register, root) {
48839
49302
  error: (value) => console.error(value)
48840
49303
  }
48841
49304
  });
49305
+ if (online && exhibitCreationCommands.has(command)) guardExhibitCreation(context5);
49306
+ return context5;
48842
49307
  };
48843
49308
  if (root) {
48844
49309
  commandRuntimes.set(root, (command) => runtime(command, false));
@@ -48847,7 +49312,11 @@ function createAuthCommandHost(register, root) {
48847
49312
  return {
48848
49313
  protocolVersion: AUTH_MODULE_PROTOCOL,
48849
49314
  capabilities: Object.freeze({ dependencyAuthorizationWorkflow: DEPENDENCY_AUTHORIZATION_WORKFLOW_ENABLED }),
48850
- register,
49315
+ register(parent, command, options2) {
49316
+ register(parent, command, options2);
49317
+ if (parent.length === 1 && parent[0] === "exhibit" && command.name() === "add")
49318
+ exhibitCreationCommands.add(command);
49319
+ },
48851
49320
  options: readSharedOptions,
48852
49321
  runtime: (command) => runtime(command, true),
48853
49322
  output: (value) => console.log(JSON.stringify(value, null, 2)),
@@ -48895,6 +49364,7 @@ var init_authModuleHost = __esm({
48895
49364
  init_headlessInteraction();
48896
49365
  init_runtime();
48897
49366
  init_featureFlags();
49367
+ init_authModuleRequests();
48898
49368
  commandRuntimes = /* @__PURE__ */ new WeakMap();
48899
49369
  commandProviders = /* @__PURE__ */ new WeakMap();
48900
49370
  }
@@ -49123,7 +49593,7 @@ function assertWritable4(target) {
49123
49593
  }
49124
49594
  }
49125
49595
  async function targetFacts(source, collectionId, apis2, loadPolicies = false, expectedSubjectType) {
49126
- const get2 = apis2.targetInfo ?? ((params) => service_API_default.Resource.info(params));
49596
+ const get2 = apis2.targetInfo ?? ((params) => FServiceAPI2.Resource.info(params));
49127
49597
  const invalid15 = () => new CliError("\u65E0\u6CD5\u53EF\u9760\u8BFB\u53D6\u4F9D\u8D56\u76EE\u6807\u7684\u6210\u529F\u54CD\u5E94\u53CA\u7CBE\u786E\u8EAB\u4EFD\uFF1B\u672C\u5730\u7A3F\u672A\u4FEE\u6539", "COLLECTION_DEP_TARGET_RESPONSE_INVALID");
49128
49598
  let response;
49129
49599
  try {
@@ -49190,7 +49660,7 @@ async function assertRange(fact, range, apis2) {
49190
49660
  resourceId: fact.id,
49191
49661
  latestVersion: fact.latest,
49192
49662
  subjectType: fact.subjectType,
49193
- read: apis2.getVersions ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params)),
49663
+ read: apis2.getVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
49194
49664
  invalidCode: "COLLECTION_DEP_VERSIONS_RESPONSE_INVALID"
49195
49665
  });
49196
49666
  assertRangeMatches(versions, range, "COLLECTION_DEP_RANGE_INVALID", fact.subjectType);
@@ -49224,7 +49694,7 @@ async function addCollectionDependency(input3) {
49224
49694
  existingRange: input3.mode === "range" && fact.subjectType === 1 ? void 0 : existing?.versionRange,
49225
49695
  prompts: input3.prompts,
49226
49696
  reporter: input3.reporter,
49227
- read: apis2.getVersions ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params)),
49697
+ read: apis2.getVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
49228
49698
  rangeCode: "COLLECTION_DEP_RANGE_INVALID",
49229
49699
  versionsCode: "COLLECTION_DEP_VERSIONS_RESPONSE_INVALID"
49230
49700
  });
@@ -49242,7 +49712,7 @@ async function addCollectionDependency(input3) {
49242
49712
  await assertRange(retained, dependency.versionRange, apis2);
49243
49713
  candidateTypes.set(retained.id, retained.subjectType);
49244
49714
  }
49245
- const cycle = apis2.cycleCheck ?? ((params) => service_API_default.Resource.cycleDependencyCheck(params));
49715
+ const cycle = apis2.cycleCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
49246
49716
  const invalid15 = () => new CliError("\u4F9D\u8D56\u73AF\u68C0\u6D4B\u672A\u8FD4\u56DE\u53EF\u4FE1\u7ED3\u679C\uFF1B\u672C\u5730\u7A3F\u672A\u4FEE\u6539\uFF0C\u8BF7\u6838\u5BF9\u540E\u518D\u8BD5\u3002", "COLLECTION_DEP_CYCLE_RESPONSE_INVALID");
49247
49717
  let result;
49248
49718
  try {
@@ -49781,7 +50251,7 @@ async function writeAndVerifyStatus(input3) {
49781
50251
  target = await recheckCollectionWriteTarget(input3, anchor);
49782
50252
  assertCollectionWriteTarget(input3, anchor);
49783
50253
  if (!needsWrite(target)) return unchanged();
49784
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
50254
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
49785
50255
  assertCollectionWriteTarget(input3, anchor);
49786
50256
  try {
49787
50257
  await update2({ resourceId: anchor.resourceId, status: input3.expectedStatus });
@@ -49911,7 +50381,7 @@ function fieldFrom(value) {
49911
50381
  const raw = value;
49912
50382
  const fieldId = stringAt(raw, ["id"]);
49913
50383
  if (!fieldId) error2("\u7B56\u7565\u6A21\u677F\u5B57\u6BB5\u7F3A\u5C11 id");
49914
- const type = raw.uiSectionType;
50384
+ const type = raw.uiSectionType === "dateTime" ? "datetime" : raw.uiSectionType;
49915
50385
  if (type !== "number" && type !== "select" && type !== "datetime") {
49916
50386
  error2(`\u7B56\u7565\u6A21\u677F\u5B57\u6BB5 ${fieldId} \u7684 uiSectionType \u4E0D\u53D7\u652F\u6301`);
49917
50387
  }
@@ -50286,7 +50756,7 @@ async function assertPolicySettlement(input3) {
50286
50756
  let qualification;
50287
50757
  try {
50288
50758
  qualification = await request4(
50289
- input3.withdrawStatus ?? ((params) => service_API_default.Payment.queryWithdrawStatus(params)),
50759
+ input3.withdrawStatus ?? ((params) => FServiceAPI2.Payment.queryWithdrawStatus(params)),
50290
50760
  { ownerId: input3.ownerId, accountType: input3.accountType },
50291
50761
  `${prefix2}_SETTLEMENT_INVALID`
50292
50762
  );
@@ -50351,7 +50821,7 @@ function assertWritable6(info2) {
50351
50821
  }
50352
50822
  async function catalog(input3) {
50353
50823
  const target = await resolveCollectionTarget(input3);
50354
- const request5 = input3.apis?.policyTemplates ?? ((params) => service_API_default.Policy.policyTemplates(params));
50824
+ const request5 = input3.apis?.policyTemplates ?? ((params) => FServiceAPI2.Policy.policyTemplates(params));
50355
50825
  return { target, templates: parsePolicyTemplateCatalog(await request5({}), "collection") };
50356
50826
  }
50357
50827
  async function getCollectionPolicyTemplateCatalog(input3) {
@@ -50374,8 +50844,8 @@ async function prepareCollectionPolicyTemplate(input3) {
50374
50844
  throw new CliError("\u5F53\u524D\u5408\u96C6\u5DF2\u5B58\u5728\u540C\u540D\u6388\u6743\u7B56\u7565", "POLICY_NAME_DUPLICATE");
50375
50845
  if (result.template.fingerprint !== input3.expectedFingerprint)
50376
50846
  throw new CliError("\u7B56\u7565\u6A21\u677F\u5DF2\u53D8\u5316\uFF1B\u8BF7\u91CD\u65B0\u67E5\u770B\u5E76\u9009\u62E9\u6A21\u677F", "POLICY_TEMPLATE_CHANGED");
50377
- const reCompile = input3.apis?.policyReCompile ?? ((params) => service_API_default.Policy.policyReCompile(params));
50378
- const translate = input3.apis?.policyTranslation ?? ((params) => service_API_default.Policy.policyTranslation(params));
50847
+ const reCompile = input3.apis?.policyReCompile ?? ((params) => FServiceAPI2.Policy.policyReCompile(params));
50848
+ const translate = input3.apis?.policyTranslation ?? ((params) => FServiceAPI2.Policy.policyTranslation(params));
50379
50849
  return preparePolicyWithSettlement(
50380
50850
  {
50381
50851
  template: result.template,
@@ -50407,7 +50877,7 @@ async function applyCollectionPolicy(input3) {
50407
50877
  accountType: 1,
50408
50878
  withdrawStatus: input3.apis?.withdrawStatus
50409
50879
  });
50410
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
50880
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
50411
50881
  await appendPolicy({
50412
50882
  subject: "\u5408\u96C6",
50413
50883
  resourceId: target.resourceId,
@@ -50420,7 +50890,7 @@ async function applyCollectionPolicy(input3) {
50420
50890
  async function setCollectionPolicy(input3) {
50421
50891
  const target = await resolveCollectionTarget(input3);
50422
50892
  assertWritable6(target.info);
50423
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
50893
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
50424
50894
  await togglePolicy({
50425
50895
  subject: "\u5408\u96C6",
50426
50896
  resourceId: target.resourceId,
@@ -50600,10 +51070,10 @@ var init_gates = __esm({
50600
51070
 
50601
51071
  // src/domain/policy/resourcePolicy.ts
50602
51072
  function infoApi(apis2) {
50603
- return apis2?.info ?? ((params) => service_API_default.Resource.info(params));
51073
+ return apis2?.info ?? ((params) => FServiceAPI2.Resource.info(params));
50604
51074
  }
50605
51075
  function updateApi(apis2) {
50606
- return apis2?.update ?? ((params) => service_API_default.Resource.update(params));
51076
+ return apis2?.update ?? ((params) => FServiceAPI2.Resource.update(params));
50607
51077
  }
50608
51078
  function readPolicies(info2) {
50609
51079
  const source = Array.isArray(info2.policies) ? info2.policies : [];
@@ -50678,7 +51148,7 @@ async function loadPolicyContext(input3) {
50678
51148
  }
50679
51149
  async function getPolicyTemplateCatalog(input3) {
50680
51150
  const context5 = await loadPolicyContext(input3);
50681
- const request5 = input3.apis?.policyTemplates ?? ((params) => service_API_default.Policy.policyTemplates(params));
51151
+ const request5 = input3.apis?.policyTemplates ?? ((params) => FServiceAPI2.Policy.policyTemplates(params));
50682
51152
  const templates = parsePolicyTemplateCatalog(await request5({}), "normal");
50683
51153
  return {
50684
51154
  subject: { kind: "resource", resourceId: context5.resourceId, typeCode: context5.typeCode },
@@ -50705,8 +51175,8 @@ async function preparePolicyTemplate(input3) {
50705
51175
  if (template.fingerprint !== input3.expectedFingerprint) {
50706
51176
  throw new CliError("\u7B56\u7565\u6A21\u677F\u5DF2\u53D8\u5316\uFF1B\u8BF7\u91CD\u65B0\u67E5\u770B\u5E76\u9009\u62E9\u6A21\u677F", "POLICY_TEMPLATE_CHANGED");
50707
51177
  }
50708
- const request5 = input3.apis?.policyReCompile ?? ((params) => service_API_default.Policy.policyReCompile(params));
50709
- const translate = input3.apis?.policyTranslation ?? ((params) => service_API_default.Policy.policyTranslation(params));
51178
+ const request5 = input3.apis?.policyReCompile ?? ((params) => FServiceAPI2.Policy.policyReCompile(params));
51179
+ const translate = input3.apis?.policyTranslation ?? ((params) => FServiceAPI2.Policy.policyTranslation(params));
50710
51180
  return preparePolicyWithSettlement(
50711
51181
  {
50712
51182
  template,
@@ -51247,15 +51717,14 @@ function assertResourceInfoExists(response) {
51247
51717
  if (classifyApiResponse(response).kind === "success" && Object.getOwnPropertyDescriptor(response, "data")?.value === null)
51248
51718
  throw new CliError("\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID", "RESOURCE_NOT_FOUND");
51249
51719
  }
51720
+ function assertSingleResourceSubject(info2) {
51721
+ if (info2.subjectType !== 1)
51722
+ throw new CliError("\u76EE\u6807\u4E0D\u662F\u5355\u8D44\u6E90\uFF1B\u5408\u96C6\u8BF7\u4F7F\u7528\u72EC\u7ACB\u7684\u5408\u96C6\u7BA1\u7406\u547D\u4EE4", "RESOURCE_INFO_SUBJECT_INVALID");
51723
+ }
51250
51724
  async function readResourceInfo(read2, resourceId, extra = {}) {
51251
- const response = await readPlatformResult(
51252
- read2,
51253
- { ...extra, resourceIdOrName: resourceId },
51254
- {
51255
- code: "RESOURCE_NOT_FOUND",
51256
- message: "\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID"
51257
- }
51258
- );
51725
+ if (typeof resourceId !== "string" || !resourceId.trim() || ["undefined", "null"].includes(resourceId.trim()))
51726
+ throw new CliError("\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A\u6216\u65E0\u6548", "CLI_ARGUMENT_INVALID");
51727
+ const response = await readPlatformResult(read2, { ...extra, resourceIdOrName: resourceId });
51259
51728
  assertResourceInfoExists(response);
51260
51729
  return unwrapData(response);
51261
51730
  }
@@ -51319,7 +51788,7 @@ function readCover2(cwd, cover) {
51319
51788
  }
51320
51789
  }
51321
51790
  async function uploadCover2(content, apis2) {
51322
- const upload = apis2?.uploadImage ?? ((params) => service_API_default.Storage.uploadImage(params));
51791
+ const upload = apis2?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params));
51323
51792
  const result = unwrapData(await upload({ file: content }));
51324
51793
  const url2 = result.url ?? result.fileUrl ?? result.fileURL;
51325
51794
  if (typeof url2 !== "string" || !url2.trim()) {
@@ -51399,7 +51868,7 @@ async function updateListing(input3) {
51399
51868
  async function updateListingLocked(input3, authUserId, noFlags) {
51400
51869
  const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
51401
51870
  const assertContext2 = resourceWriteContext(input3, identity4, authUserId);
51402
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
51871
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
51403
51872
  const remote = await readResourceInfo(info2, identity4.resourceId);
51404
51873
  assertContext2();
51405
51874
  assertRemoteResourceWritable({ info: remote, resourceId: identity4.resourceId, authUserId });
@@ -51468,24 +51937,12 @@ ${Object.entries(payload).filter(([key2]) => key2 !== "resourceId").map(([key2,
51468
51937
  input3.yes,
51469
51938
  promptOutput
51470
51939
  );
51471
- const revalidate = async () => {
51472
- assertContext2();
51473
- const current2 = await readResourceInfo(info2, identity4.resourceId);
51474
- assertContext2();
51475
- assertRemoteResourceWritable({ info: current2, resourceId: identity4.resourceId, authUserId });
51476
- if (["feedUrl", "rssGuid", "rssPubDate"].some(
51477
- (key2) => typeof current2[key2] === "string" && current2[key2].trim()
51478
- ))
51479
- throw new CliError("RSS \u76F8\u5173\u8D44\u6E90\u5F53\u524D\u4E0D\u652F\u6301\u4FEE\u6539\u5C55\u793A\u4FE1\u606F", "UPDATE_RSS_READONLY");
51480
- if (!isDeepStrictEqual4(listingView(current2), before))
51481
- throw new CliError("\u8D44\u6E90\u8D44\u6599\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u67E5\u8BE2\u540E\u4FEE\u6539", "UPDATE_CONFLICT");
51482
- };
51483
- await revalidate();
51940
+ assertContext2();
51484
51941
  if (coverBytes) {
51485
51942
  payload.coverImages = [await uploadCover2(coverBytes, input3.apis)];
51486
- await revalidate();
51943
+ assertContext2();
51487
51944
  }
51488
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
51945
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
51489
51946
  try {
51490
51947
  const response = await update2(payload);
51491
51948
  const rejection = new ApiResponseError("\u5E73\u53F0\u62D2\u7EDD\u8D44\u6E90\u8D44\u6599\u66F4\u65B0", response);
@@ -51507,13 +51964,13 @@ ${Object.entries(payload).filter(([key2]) => key2 !== "resourceId").map(([key2,
51507
51964
  assertRemoteResourceOwned({ info: afterInfo, resourceId: identity4.resourceId, authUserId });
51508
51965
  after = listingView(afterInfo);
51509
51966
  const expected = {
51510
- ...before,
51511
51967
  ...payload.resourceTitle !== void 0 ? { title: payload.resourceTitle } : {},
51512
51968
  ...payload.intro !== void 0 ? { intro: payload.intro } : {},
51513
51969
  ...payload.tags !== void 0 ? { tags: payload.tags } : {},
51514
51970
  ...payload.coverImages !== void 0 ? { coverImages: payload.coverImages } : {}
51515
51971
  };
51516
- if (afterInfo.isFrozen === true || !isDeepStrictEqual4(after, expected)) throw new Error("Listing mismatch");
51972
+ if (afterInfo.isFrozen === true || after.resourceName !== before.resourceName || Object.entries(expected).some(([key2, value]) => !isDeepStrictEqual4(after[key2], value)))
51973
+ throw new Error("Listing mismatch");
51517
51974
  } catch {
51518
51975
  throw new CliError("\u8D44\u6E90\u4FE1\u606F\u5199\u5165\u540E\u8BFB\u56DE\u4E0D\u4E00\u81F4\uFF1B\u8BF7\u5148\u6838\u5BF9\u7EBF\u4E0A\u8D44\u6599\uFF0C\u52FF\u91CD\u590D\u6267\u884C\u3002", "UPDATE_VERIFY_FAILED");
51519
51976
  }
@@ -51900,7 +52357,7 @@ async function bindResourceLocked(input3, originalIdentities) {
51900
52357
  throw new CliError(`\u672C\u5730\u4EA7\u7269\u4E0D\u5B58\u5728\uFF1A${absolute}`, "ARTIFACT_ANCHOR_MISSING");
51901
52358
  }
51902
52359
  }
51903
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
52360
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
51904
52361
  const response = await infoApi2({
51905
52362
  resourceIdOrName: input3.target,
51906
52363
  isLoadLatestVersionInfo: 1
@@ -52635,16 +53092,12 @@ async function statusProject(input3) {
52635
53092
  assertPlatformAllowed();
52636
53093
  requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
52637
53094
  resolveBoundIdentity(input3.cwd, input3.file);
52638
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
53095
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
52639
53096
  let result;
52640
53097
  try {
52641
53098
  result = await infoApi2({ resourceIdOrName: local.resourceId, isLoadLatestVersionInfo: 1 });
52642
53099
  } catch (error3) {
52643
- throwPlatformReadError(
52644
- error3,
52645
- { code: "STATUS_REQUEST_FAILED", message: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u65E0\u6CD5\u786E\u8BA4\u7EBF\u4E0A\u73B0\u72B6" },
52646
- { code: "RESOURCE_NOT_FOUND", message: "\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID" }
52647
- );
53100
+ throwPlatformReadError(error3, { code: "STATUS_REQUEST_FAILED", message: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u65E0\u6CD5\u786E\u8BA4\u7EBF\u4E0A\u73B0\u72B6" });
52648
53101
  }
52649
53102
  online = confirmedOnlineStatus(result, local.resourceId);
52650
53103
  }
@@ -52913,7 +53366,7 @@ async function syncResourceTitles(input3) {
52913
53366
  if (input3.selector !== void 0 && (targets[0].env ?? "prod") !== env) {
52914
53367
  throw new CliError("\u6240\u9009\u8D44\u6E90\u4E0D\u5C5E\u4E8E\u5F53\u524D\u73AF\u5883\uFF0C\u4E0D\u80FD\u540C\u6B65\u6807\u9898", "RESOURCE_SYNC_ENV_MISMATCH");
52915
53368
  }
52916
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
53369
+ const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
52917
53370
  const results = await Promise.all(
52918
53371
  targets.map(async (identity4) => ({
52919
53372
  identity: identity4,
@@ -53034,7 +53487,7 @@ async function inspectAndApplyPendingOperation(input3) {
53034
53487
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
53035
53488
  if (pending.schemaVersion === 4 && auth.userId !== pending.publication.consumption.userId)
53036
53489
  throw new CliError("\u6062\u590D\u8D26\u53F7\u4E0E\u672C\u6B21\u53D1\u884C\u6D88\u8D39\u5F15\u7528\u4E0D\u540C", "RECOVER_NOT_OWNER");
53037
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
53490
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
53038
53491
  const infoResponse = await infoApi2({ resourceIdOrName: pending.resourceId });
53039
53492
  assertSuccessfulResponse(infoResponse, "RECOVER_RESOURCE_INFO_INVALID", "\u5E73\u53F0\u672A\u8FD4\u56DE\u6210\u529F\u7684\u8D44\u6E90\u8BE6\u60C5\uFF0C\u65E0\u6CD5\u6838\u9A8C\u672A\u51B3\u63D0\u4EA4");
53040
53493
  const info2 = unwrapData(infoResponse);
@@ -53047,7 +53500,7 @@ async function inspectAndApplyPendingOperation(input3) {
53047
53500
  notOwner: "RECOVER_NOT_OWNER"
53048
53501
  }
53049
53502
  });
53050
- const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
53503
+ const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
53051
53504
  const versionResponse = await versionInfoApi({
53052
53505
  resourceId: pending.resourceId,
53053
53506
  version: pending.version
@@ -53267,8 +53720,7 @@ function detailsData(response) {
53267
53720
  const data3 = response.data;
53268
53721
  if (!nonempty(data3.resourceId) || !nonempty(data3.resourceName) || !FULL_NAME.test(data3.resourceName) || !nonempty(data3.resourceTitle) || !nonempty(data3.resourceTypeCode) || typeof data3.userId !== "number" || !Number.isSafeInteger(data3.userId) || typeof data3.intro !== "string" || !stringArray(data3.tags) || !stringArray(data3.coverImages) || !isResourceStatus(data3.status) || typeof data3.latestVersion !== "string")
53269
53722
  throw invalid8();
53270
- if (data3.subjectType !== 1)
53271
- throw new CliError("\u76EE\u6807\u4E0D\u662F\u5355\u8D44\u6E90\uFF1B\u5408\u96C6\u8BF7\u4F7F\u7528\u72EC\u7ACB\u7684\u5408\u96C6\u7BA1\u7406\u547D\u4EE4", "RESOURCE_INFO_SUBJECT_INVALID");
53723
+ assertSingleResourceSubject(data3);
53272
53724
  return {
53273
53725
  resourceId: data3.resourceId,
53274
53726
  resourceName: data3.resourceName,
@@ -53300,17 +53752,13 @@ async function readResourceDetails(input3) {
53300
53752
  };
53301
53753
  let response;
53302
53754
  try {
53303
- const info2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params, {
53304
- timeout: REQUEST_TIMEOUT_MS,
53305
- signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
53306
- }));
53307
- response = await info2({ resourceIdOrName: target });
53755
+ const params = { resourceIdOrName: target };
53756
+ response = await (input3.apis?.info ?? FServiceAPI2.Resource.info)(params);
53308
53757
  } catch (error3) {
53309
53758
  assertContext2();
53310
53759
  throwPlatformReadError(
53311
53760
  error3,
53312
- { code: "RESOURCE_INFO_REQUEST_FAILED", message: "\u8D44\u6E90\u8D44\u6599\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u786E\u8BA4\u7F51\u7EDC\u548C\u767B\u5F55\u540E\u91CD\u8BD5" },
53313
- { code: "RESOURCE_NOT_FOUND", message: "\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID" }
53761
+ apiFailureDetails(error3)?.kind === "network" ? NETWORK_FAILURE : { code: NETWORK_FAILURE.code, message: "\u6682\u65E0\u6CD5\u8BFB\u53D6\u8D44\u6E90\u8D44\u6599\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5" }
53314
53762
  );
53315
53763
  }
53316
53764
  assertContext2();
@@ -53322,7 +53770,7 @@ async function readResourceDetails(input3) {
53322
53770
  throw new CliError("\u53EA\u80FD\u67E5\u770B\u5F53\u524D\u8D26\u53F7\u7684\u4F5C\u8005\u8D44\u6E90\u8D44\u6599\uFF1B\u5176\u4ED6\u8D44\u6E90\u8BF7\u4F7F\u7528\u5E02\u573A\u67E5\u8BE2", "RESOURCE_INFO_NOT_OWNER");
53323
53771
  return details3;
53324
53772
  }
53325
- var REQUEST_TIMEOUT_MS, FULL_NAME, RESOURCE_ID, invalid8, nonempty, stringArray;
53773
+ var NETWORK_FAILURE, FULL_NAME, RESOURCE_ID, invalid8, nonempty, stringArray;
53326
53774
  var init_details = __esm({
53327
53775
  "src/domain/resource/details.ts"() {
53328
53776
  "use strict";
@@ -53336,7 +53784,10 @@ var init_details = __esm({
53336
53784
  init_gates();
53337
53785
  init_visibility();
53338
53786
  init_readInfo();
53339
- REQUEST_TIMEOUT_MS = 3e4;
53787
+ NETWORK_FAILURE = {
53788
+ code: "RESOURCE_INFO_REQUEST_FAILED",
53789
+ message: "\u8D44\u6E90\u8D44\u6599\u8BFB\u53D6\u5931\u8D25\uFF1A\u7F51\u7EDC\u8FDE\u63A5\u4E2D\u65AD\u6216\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u4EE3\u7406\u8BBE\u7F6E\u540E\u91CD\u8BD5"
53790
+ };
53340
53791
  FULL_NAME = /^[^\s/:]+\/[^\s/:]+$/u;
53341
53792
  RESOURCE_ID = /^[a-f\d]{24}$/iu;
53342
53793
  invalid8 = () => new CliError("\u5E73\u53F0\u8D44\u6E90\u8D44\u6599\u54CD\u5E94\u4E0D\u5B8C\u6574\u6216\u683C\u5F0F\u65E0\u6548\uFF0C\u672A\u8F93\u51FA\u8D44\u6599", "RESOURCE_INFO_RESPONSE_INVALID");
@@ -53450,9 +53901,8 @@ var init_resource = __esm({
53450
53901
  });
53451
53902
 
53452
53903
  // src/domain/resource/online.ts
53453
- import { isDeepStrictEqual as isDeepStrictEqual5 } from "util";
53454
53904
  async function loadInfo(resourceId, apis2) {
53455
- const infoApi2 = apis2?.info ?? ((params) => service_API_default.Resource.info(params));
53905
+ const infoApi2 = apis2?.info ?? ((params) => FServiceAPI2.Resource.info(params));
53456
53906
  return readResourceInfo(infoApi2, resourceId, {
53457
53907
  isLoadLatestVersionInfo: 1,
53458
53908
  isLoadPolicyInfo: 1
@@ -53467,7 +53917,9 @@ function validateForOnline(info2) {
53467
53917
  throw new CliError("\u4E0A\u67B6\u987B\u81F3\u5C11\u4E00\u6761\u542F\u7528\u7B56\u7565", "ONLINE_NO_POLICY");
53468
53918
  }
53469
53919
  }
53470
- function assertKnownShelfStatus(info2) {
53920
+ function assertShelfResource(info2, resourceId, authUserId) {
53921
+ assertRemoteResourceWritable({ info: info2, resourceId, authUserId });
53922
+ assertSingleResourceSubject(info2);
53471
53923
  if (![0, 1, 4, 8].includes(info2.status))
53472
53924
  throw new CliError("\u5E73\u53F0\u8D44\u6E90\u72B6\u6001\u65E0\u6548\uFF0C\u62D2\u7EDD\u4FEE\u6539\u4E0A\u4E0B\u67B6", "RESOURCE_STATUS_INVALID");
53473
53925
  }
@@ -53485,8 +53937,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
53485
53937
  const assertContext2 = resourceWriteContext(input3, identity4, authUserId);
53486
53938
  const info2 = await loadInfo(identity4.resourceId, input3.apis);
53487
53939
  assertContext2();
53488
- assertRemoteResourceWritable({ info: info2, resourceId: identity4.resourceId, authUserId });
53489
- assertKnownShelfStatus(info2);
53940
+ assertShelfResource(info2, identity4.resourceId, authUserId);
53490
53941
  const listing = isListedResourceStatus(desired);
53491
53942
  if (listing) validateForOnline(info2);
53492
53943
  if (info2.status === desired || desired === 4 && info2.status === 0) {
@@ -53504,15 +53955,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
53504
53955
  input3.json ? "stderr" : void 0
53505
53956
  );
53506
53957
  assertContext2();
53507
- const current2 = await loadInfo(identity4.resourceId, input3.apis);
53508
- assertContext2();
53509
- assertRemoteResourceWritable({ info: current2, resourceId: identity4.resourceId, authUserId });
53510
- assertKnownShelfStatus(current2);
53511
- if (listing) validateForOnline(current2);
53512
- const policyState = (value) => Array.isArray(value.policies) ? value.policies.map((p) => [p.policyId, p.status]) : void 0;
53513
- if (current2.status !== info2.status || listing && (current2.latestVersion !== info2.latestVersion || !isDeepStrictEqual5(policyState(current2), policyState(info2))))
53514
- throw new CliError("\u8D44\u6E90\u72B6\u6001\u6216\u4E0A\u67B6\u6761\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u67E5\u8BE2\u540E\u64CD\u4F5C", "SHELF_CONFLICT");
53515
- const update2 = input3.apis?.update ?? ((params) => service_API_default.Resource.update(params));
53958
+ const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
53516
53959
  const unknown2 = (cause) => {
53517
53960
  const reason = cause instanceof CliError && cause.code !== "SHELF_RESULT_UNKNOWN" ? safePlatformMessage(cause.message) : platformFailureMessage(cause, "");
53518
53961
  return new CliError(
@@ -53540,6 +53983,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
53540
53983
  }
53541
53984
  try {
53542
53985
  assertRemoteResourceOwned({ info: after, resourceId: identity4.resourceId, authUserId });
53986
+ assertSingleResourceSubject(after);
53543
53987
  if (after.status !== desired || after.isFrozen === true) throw new Error("Shelf mismatch");
53544
53988
  } catch {
53545
53989
  throw new CliError("\u4E0A\u4E0B\u67B6\u5199\u5165\u540E\u72B6\u6001\u8BFB\u56DE\u4E0D\u4E00\u81F4\uFF1B\u8BF7\u5148\u6838\u5BF9\u7EBF\u4E0A\u72B6\u6001\uFF0C\u52FF\u91CD\u590D\u6267\u884C\u3002", "SHELF_VERIFY_FAILED");
@@ -53648,17 +54092,12 @@ async function validateOnline(input3) {
53648
54092
  assertPlatformAllowed();
53649
54093
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
53650
54094
  const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
53651
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
54095
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
53652
54096
  const data3 = await readResourceInfo(infoApi2, identity4.resourceId, {
53653
54097
  isLoadLatestVersionInfo: 1,
53654
54098
  isLoadPolicyInfo: 1
53655
54099
  });
53656
- assertRemoteResourceWritable({
53657
- info: data3,
53658
- resourceId: identity4.resourceId,
53659
- authUserId: auth.userId
53660
- });
53661
- assertKnownShelfStatus(data3);
54100
+ assertShelfResource(data3, identity4.resourceId, auth.userId);
53662
54101
  validateForOnline(data3);
53663
54102
  return "\u53EF\u4EE5\u4E0A\u67B6";
53664
54103
  }
@@ -53709,13 +54148,13 @@ var init_validate2 = __esm({
53709
54148
  });
53710
54149
 
53711
54150
  // src/domain/resource/version/draftEdit.ts
53712
- import { isDeepStrictEqual as isDeepStrictEqual6 } from "util";
54151
+ import { isDeepStrictEqual as isDeepStrictEqual5 } from "util";
53713
54152
  async function beginDraftEdit(cwd, input3 = {}) {
53714
54153
  assertPlatformAllowed();
53715
54154
  const auth = requireAuth({ cwd, homeDir: input3.homeDir });
53716
54155
  const identity4 = resolveBoundIdentity(cwd, input3.file);
53717
54156
  const snapshot2 = readDraftSnapshot(cwd, identity4.n);
53718
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
54157
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
53719
54158
  const assertLocal = () => {
53720
54159
  const currentAuth2 = requireAuth({ cwd, homeDir: input3.homeDir });
53721
54160
  if (currentAuth2.userId !== auth.userId) {
@@ -53725,7 +54164,7 @@ async function beginDraftEdit(cwd, input3 = {}) {
53725
54164
  throw new CliError("\u7F16\u8F91\u671F\u95F4\u5DE5\u4F5C\u7A3F\u5DF2\u53D8\u5316\uFF0C\u672A\u8986\u76D6\u5F53\u524D\u7A3F", "DRAFT_CHANGED");
53726
54165
  }
53727
54166
  const current2 = resolveBoundIdentity(cwd, `file:${identity4.n}.json`);
53728
- if (!isDeepStrictEqual6(current2, identity4)) {
54167
+ if (!isDeepStrictEqual5(current2, identity4)) {
53729
54168
  throw new CliError("\u7F16\u8F91\u671F\u95F4\u8D44\u6E90\u8EAB\u4EFD\u5DF2\u53D8\u5316\uFF0C\u672A\u8986\u76D6\u5DE5\u4F5C\u7A3F", "DRAFT_IDENTITY_CHANGED");
53730
54169
  }
53731
54170
  return currentAuth2;
@@ -54690,7 +55129,7 @@ async function assertFileRules(input3) {
54690
55129
  let response;
54691
55130
  try {
54692
55131
  response = await withStorageTimeout(
54693
- () => (input3.apis?.getByCode ?? ((params) => service_API_default.Resource.getResourceTypeInfoByCode(params, {
55132
+ () => (input3.apis?.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params, {
54694
55133
  timeout: 3e4,
54695
55134
  signal: AbortSignal.timeout(3e4)
54696
55135
  })))({ code: input3.typeCode }),
@@ -54787,7 +55226,7 @@ async function submitVersionLocked(input3) {
54787
55226
  const apis2 = {
54788
55227
  ...input3.apis,
54789
55228
  getByCode: (params) => typeInfo ??= Promise.resolve().then(
54790
- () => input3.apis?.getByCode ? input3.apis.getByCode(params) : service_API_default.Resource.getResourceTypeInfoByCode(params)
55229
+ () => input3.apis?.getByCode ? input3.apis.getByCode(params) : FServiceAPI2.Resource.getResourceTypeInfoByCode(params)
54791
55230
  )
54792
55231
  };
54793
55232
  await assertDraftOptionsAllowed({
@@ -54824,7 +55263,7 @@ async function submitVersionLocked(input3) {
54824
55263
  version: input3.version,
54825
55264
  draft
54826
55265
  });
54827
- const createVersion2 = input3.apis?.createVersion ?? ((params) => service_API_default.Resource.createVersion(params));
55266
+ const createVersion2 = input3.apis?.createVersion ?? ((params) => FServiceAPI2.Resource.createVersion(params));
54828
55267
  const subjects = await assertDependencyDeclarations({
54829
55268
  resourceId: input3.identity.resourceId,
54830
55269
  dependencies: draft.dependencies ?? [],
@@ -54893,7 +55332,7 @@ async function submitVersionLocked(input3) {
54893
55332
  });
54894
55333
  if (currentUsage.some((id11) => !preparation.confirmedResourceIds.includes(id11)))
54895
55334
  throw new CliError("\u51C6\u5907\u540E\u51FA\u73B0\u65B0\u7684\u672C\u4EBA\u6587\u4EF6\u5360\u7528\uFF0C\u8BF7\u91CD\u65B0\u51C6\u5907\u5E76\u786E\u8BA4", "FILE_USAGE_CHANGED");
54896
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
55335
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
54897
55336
  if (input3.identity.storageSource) {
54898
55337
  if (draft.fileSha1 !== input3.identity.storageSource.sha1)
54899
55338
  throw new CliError("\u5DE5\u4F5C\u7A3F\u6587\u4EF6\u4E0E\u5DF2\u9009\u5B58\u50A8\u6765\u6E90\u4E0D\u4E00\u81F4", "STORAGE_SOURCE_DRAFT_MISMATCH");
@@ -54975,7 +55414,7 @@ async function submitVersionLocked(input3) {
54975
55414
  resourceId: input3.identity.resourceId,
54976
55415
  authUserId: initialAuth.userId
54977
55416
  });
54978
- const readVersion = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
55417
+ const readVersion = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
54979
55418
  const versionResponse = await readVersion({ resourceId: input3.identity.resourceId, version: input3.version });
54980
55419
  assertSuccessfulResponse(versionResponse, "SUBMIT_VERIFY_FAILED", "\u53D1\u884C\u540E\u5B8C\u6574\u7248\u672C\u8BFB\u53D6\u5931\u8D25");
54981
55420
  if (!matchesVersionPublication(publication, unwrapData(versionResponse), resource))
@@ -55156,7 +55595,7 @@ async function sha1OfFile(uploadPath) {
55156
55595
  return { sha1: hash6.digest("hex"), fingerprint: fingerprint3 };
55157
55596
  }
55158
55597
  async function uploadIfNew(uploadPath, sha1, fingerprint3, apis2, assertActor2) {
55159
- const fileIsExist2 = apis2.fileIsExist ?? ((params) => service_API_default.Storage.fileIsExist(params));
55598
+ const fileIsExist2 = apis2.fileIsExist ?? ((params) => FServiceAPI2.Storage.fileIsExist(params));
55160
55599
  const response = await fileIsExist2({ sha1 });
55161
55600
  const exists2 = unwrapFirst(response);
55162
55601
  assertActor2();
@@ -55167,7 +55606,7 @@ async function uploadIfNew(uploadPath, sha1, fingerprint3, apis2, assertActor2)
55167
55606
  assertFileUnchanged(uploadPath, fingerprint3);
55168
55607
  return;
55169
55608
  }
55170
- const upload = apis2.uploadFile ?? ((params) => service_API_default.Storage.uploadFile(params));
55609
+ const upload = apis2.uploadFile ?? ((params) => FServiceAPI2.Storage.uploadFile(params));
55171
55610
  assertFileUnchanged(uploadPath, fingerprint3);
55172
55611
  const filename = path25.basename(uploadPath);
55173
55612
  const file3 = new File([await openAsBlob(uploadPath, { type: mimeForFilename(filename) })], filename, {
@@ -55401,7 +55840,7 @@ async function runCreateVersionLocked(input3) {
55401
55840
  if (getEnv2() !== initialEnv || requireAuth(input3).userId !== auth.userId)
55402
55841
  throw new CliError("\u6587\u4EF6\u51C6\u5907\u671F\u95F4\u8D26\u53F7\u6216\u73AF\u5883\u53D8\u5316", "SUBMIT_CONTEXT_CHANGED");
55403
55842
  };
55404
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
55843
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
55405
55844
  const info2 = unwrapData(
55406
55845
  await infoApi2({
55407
55846
  resourceIdOrName: identity4.resourceId,
@@ -55612,7 +56051,7 @@ var init_create_version = __esm({
55612
56051
 
55613
56052
  // src/domain/resource/version/form/dep.ts
55614
56053
  import semver9 from "semver";
55615
- import { isDeepStrictEqual as isDeepStrictEqual7 } from "util";
56054
+ import { isDeepStrictEqual as isDeepStrictEqual6 } from "util";
55616
56055
  function dependencyIdentity(cwd, file3) {
55617
56056
  const identity4 = resolveBoundIdentity(cwd, file3);
55618
56057
  if (!identity4.resourceId) throw new CliError("\u8BF7\u5148 create \u6216 bind", "DEP_NEED_SHELL");
@@ -55624,7 +56063,7 @@ async function assertCurrentResourceWritable(input3) {
55624
56063
  if (!resourceId) {
55625
56064
  throw new CliError("\u8BF7\u5148 create \u6216 bind", "DEP_NEED_SHELL");
55626
56065
  }
55627
- const infoApi2 = input3.apis?.ownInfo ?? ((params) => service_API_default.Resource.info(params));
56066
+ const infoApi2 = input3.apis?.ownInfo ?? ((params) => FServiceAPI2.Resource.info(params));
55628
56067
  const response = await infoApi2({ ...input3.params, resourceIdOrName: resourceId });
55629
56068
  const info2 = dependencyInfo(response, "DEP_CURRENT_INFO_INVALID");
55630
56069
  assertRemoteResourceWritable({
@@ -55676,7 +56115,7 @@ async function loadDependencyTarget(input3) {
55676
56115
  const value = rawSource.replace(/^(?:id:|name:)/, "");
55677
56116
  if (byName ? !/^[^\s/:\p{Cc}\p{Cf}]+\/[^\s/:\p{Cc}\p{Cf}]+$/u.test(value) : !isContractId(value))
55678
56117
  throw new CliError("\u8BF7\u63D0\u4F9B\u7CBE\u786E\u4F9D\u8D56ID\u6216\u5B8C\u6574username/name", "DEP_TARGET_INVALID");
55679
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
56118
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
55680
56119
  const info2 = dependencyInfo(
55681
56120
  await infoApi2({
55682
56121
  resourceIdOrName: value,
@@ -55718,7 +56157,7 @@ async function loadDependencyTarget(input3) {
55718
56157
  return { resourceId, latestVersion, subjectType };
55719
56158
  }
55720
56159
  async function assertDependencyVersionRange(input3) {
55721
- const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params));
56160
+ const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params));
55722
56161
  const versions = await readDependencyVersions({
55723
56162
  resourceId: input3.resourceId,
55724
56163
  subjectType: input3.subjectType,
@@ -55745,7 +56184,7 @@ async function readPublishedDependencies(input3, resourceId, version2) {
55745
56184
  if (typeof version2 !== "string" || !semver9.valid(version2))
55746
56185
  throw new CliError("\u6CA1\u6709\u53EF\u8865\u7B7E\u7684\u5DF2\u53D1\u884C\u4F9D\u8D56\u6216\u5DE5\u4F5C\u7A3F", "DEP_NOT_FOUND");
55747
56186
  const published = contractResponseData(
55748
- await (input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params)))({
56187
+ await (input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params)))({
55749
56188
  resourceId,
55750
56189
  version: version2
55751
56190
  })
@@ -55798,7 +56237,7 @@ async function mutateDependency(input3, mode2) {
55798
56237
  existingRange: mode2 === "add" || target.subjectType === 4 ? existingRange : void 0,
55799
56238
  prompts: input3.prompts,
55800
56239
  reporter: input3.reporter,
55801
- read: input3.apis?.getVersionListByResourceID ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params))
56240
+ read: input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params))
55802
56241
  });
55803
56242
  const candidate = parseDependencyDeclarations(
55804
56243
  [
@@ -55819,7 +56258,7 @@ async function mutateDependency(input3, mode2) {
55819
56258
  await assertDependencyVersionRange({ ...retained, versionRange: dependency.versionRange, apis: input3.apis });
55820
56259
  candidateTypes.set(retained.resourceId, retained.subjectType);
55821
56260
  }
55822
- const cycleApi = input3.apis?.cycleDependencyCheck ?? ((params) => service_API_default.Resource.cycleDependencyCheck(params));
56261
+ const cycleApi = input3.apis?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
55823
56262
  const cycle = contractResponseData(await cycleApi({ resourceId: identity4.resourceId, dependencies: candidate }));
55824
56263
  if (cycle === false) throw new CliError("\u6DFB\u52A0\u6B64\u4F9D\u8D56\u4F1A\u5BFC\u81F4\u5FAA\u73AF\u4F9D\u8D56\uFF0C\u65E0\u6CD5\u6DFB\u52A0\u3002", "DEP_CYCLE");
55825
56264
  if (cycle !== true) throw new CliError("\u5FAA\u73AF\u4F9D\u8D56\u68C0\u67E5\u7ED3\u679C\u4E0D\u53EF\u4FE1\uFF0C\u672A\u7B7E\u7EA6\u6216\u5199\u7A3F", "DEP_CYCLE_RESPONSE_INVALID");
@@ -55936,7 +56375,7 @@ async function depSign(input3) {
55936
56375
  });
55937
56376
  if (published) {
55938
56377
  const fresh = await readPublishedDependencies(input3, identity4.resourceId, published.version);
55939
- if (!isDeepStrictEqual7(fresh.dependencies, published.dependencies))
56378
+ if (!isDeepStrictEqual6(fresh.dependencies, published.dependencies))
55940
56379
  throw new CliError("\u8865\u7B7E\u671F\u95F4\u7EBF\u4E0A\u4F9D\u8D56\u5FEB\u7167\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u67E5\u770B", "DEP_PUBLISHED_CHANGED");
55941
56380
  }
55942
56381
  const { info: freshInfo } = await assertCurrentResourceWritable({ ...input3, identity: identity4 });
@@ -55953,7 +56392,7 @@ async function depSign(input3) {
55953
56392
  prompts: input3.prompts,
55954
56393
  reporter: input3.reporter,
55955
56394
  readPolicies: async () => signingPoliciesFromInfo(
55956
- await (input3.apis?.info ?? ((params) => service_API_default.Resource.info(params)))({
56395
+ await (input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params)))({
55957
56396
  resourceIdOrName: target.resourceId,
55958
56397
  isLoadPolicyInfo: 1
55959
56398
  }),
@@ -55976,7 +56415,7 @@ async function depRecover(input3) {
55976
56415
  if (assertPlatformAllowed() !== env || requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir }).userId !== auth.userId || resolveRecoveryBoundIdentity(input3.cwd, input3.file).resourceId !== identity4.resourceId)
55977
56416
  throw new CliError("\u6062\u590D\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316", "DEP_CONTEXT_CHANGED");
55978
56417
  const own3 = dependencyInfo(
55979
- await (input3.apis?.ownInfo ?? ((params) => service_API_default.Resource.info(params)))({
56418
+ await (input3.apis?.ownInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
55980
56419
  resourceIdOrName: identity4.resourceId
55981
56420
  }),
55982
56421
  "DEP_CURRENT_INFO_INVALID"
@@ -56189,7 +56628,7 @@ var init_publishedVersions = __esm({
56189
56628
  });
56190
56629
 
56191
56630
  // src/domain/resource/version/description.ts
56192
- import { isDeepStrictEqual as isDeepStrictEqual8 } from "util";
56631
+ import { isDeepStrictEqual as isDeepStrictEqual7 } from "util";
56193
56632
  import semver11 from "semver";
56194
56633
  function immutableFields(value) {
56195
56634
  return [
@@ -56217,10 +56656,10 @@ async function updateOnlineDescription(input3) {
56217
56656
  const resourceId = identity4.resourceId;
56218
56657
  const assertContext2 = resourceWriteContext(input3, identity4, auth.userId);
56219
56658
  const output5 = input3.json ? "stderr" : void 0;
56220
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
56221
- const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params));
56222
- const detailApi = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
56223
- const updateApi2 = input3.apis?.updateResourceVersionInfo ?? ((params) => service_API_default.Resource.updateResourceVersionInfo(params));
56659
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
56660
+ const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params));
56661
+ const detailApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
56662
+ const updateApi2 = input3.apis?.updateResourceVersionInfo ?? ((params) => FServiceAPI2.Resource.updateResourceVersionInfo(params));
56224
56663
  const writableInfo = async () => {
56225
56664
  assertContext2();
56226
56665
  const info3 = await readResourceInfo(infoApi2, resourceId, { isLoadLatestVersionInfo: 1 });
@@ -56295,7 +56734,7 @@ ${description || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}
56295
56734
  await writableInfo();
56296
56735
  const latest = await readVersion();
56297
56736
  assertContext2();
56298
- if (!isDeepStrictEqual8(immutableFields(before), immutableFields(latest)) || latest.description !== current2) {
56737
+ if (!isDeepStrictEqual7(immutableFields(before), immutableFields(latest)) || latest.description !== current2) {
56299
56738
  throw new CliError("\u7248\u672C\u4FE1\u606F\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u67E5\u8BE2\u540E\u4FEE\u6539", "DESCRIPTION_VERIFY_FAILED");
56300
56739
  }
56301
56740
  try {
@@ -56315,7 +56754,7 @@ ${description || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}
56315
56754
  } catch (error3) {
56316
56755
  throw unknownResult2(error3);
56317
56756
  }
56318
- if (after.resourceId !== resourceId || after.version !== version2 || after.description !== description || !isDeepStrictEqual8(immutableFields(before), immutableFields(after))) {
56757
+ if (after.resourceId !== resourceId || after.version !== version2 || after.description !== description || !isDeepStrictEqual7(immutableFields(before), immutableFields(after))) {
56319
56758
  throw new CliError("\u7248\u672C\u8BF4\u660E\u6216\u5176\u5B83\u5DF2\u53D1\u5B57\u6BB5\u8BFB\u56DE\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u5148\u6838\u5BF9\uFF0C\u4E0D\u8981\u91CD\u590D\u63D0\u4EA4", "DESCRIPTION_VERIFY_FAILED");
56320
56759
  }
56321
56760
  return { version: version2, description, changed: true };
@@ -56519,7 +56958,7 @@ async function draftPullLocked(input3) {
56519
56958
  assertPlatformAllowed();
56520
56959
  const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
56521
56960
  const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
56522
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
56961
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
56523
56962
  const info2 = unwrapData(
56524
56963
  await infoApi2({
56525
56964
  resourceIdOrName: identity4.resourceId,
@@ -56543,7 +56982,7 @@ async function draftPullLocked(input3) {
56543
56982
  if (!want) {
56544
56983
  throw new CliError("\u8FD8\u6CA1\u6709\u53D1\u884C\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "GATE_USE_CREATE");
56545
56984
  }
56546
- const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
56985
+ const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
56547
56986
  const versionInfo = unwrapData(
56548
56987
  await versionInfoApi({
56549
56988
  resourceId: identity4.resourceId,
@@ -56607,7 +57046,7 @@ var init_draftPull = __esm({
56607
57046
  });
56608
57047
 
56609
57048
  // src/domain/resource/version/storageMetadata.ts
56610
- import { isDeepStrictEqual as isDeepStrictEqual9 } from "util";
57049
+ import { isDeepStrictEqual as isDeepStrictEqual8 } from "util";
56611
57050
  function record20(value) {
56612
57051
  return value !== null && typeof value === "object" && !Array.isArray(value);
56613
57052
  }
@@ -56637,7 +57076,7 @@ async function importStorageMetadata(input3) {
56637
57076
  const readNameDefinition = async (key2) => {
56638
57077
  try {
56639
57078
  const raw = await withStorageTimeout(
56640
- () => (input3.apis?.getAttrsInfoByKey ?? ((params) => service_API_default.Resource.getAttrsInfoByKey(params, {
57079
+ () => (input3.apis?.getAttrsInfoByKey ?? ((params) => FServiceAPI2.Resource.getAttrsInfoByKey(params, {
56641
57080
  timeout: 3e4,
56642
57081
  signal: AbortSignal.timeout(3e4)
56643
57082
  })))({ key: key2 }),
@@ -56814,7 +57253,7 @@ async function importStorageMetadata(input3) {
56814
57253
  });
56815
57254
  dependencyTypes.set(target.resourceId, target.subjectType);
56816
57255
  }
56817
- const cycleApi = input3.dependencies?.cycleDependencyCheck ?? ((params) => service_API_default.Resource.cycleDependencyCheck(params));
57256
+ const cycleApi = input3.dependencies?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
56818
57257
  const cycle = contractResponseData(
56819
57258
  await cycleApi({ resourceId: edit.identity.resourceId, dependencies: candidate.dependencies })
56820
57259
  );
@@ -56839,7 +57278,7 @@ ${JSON.stringify({ before: edit.draft, after: candidate }, null, 2)}`;
56839
57278
  return { imported: false, groups };
56840
57279
  await checkDependencies();
56841
57280
  const current2 = await readStorageObjectSnapshot(input3);
56842
- if (!isDeepStrictEqual9(current2, snapshot2))
57281
+ if (!isDeepStrictEqual8(current2, snapshot2))
56843
57282
  throw new CliError("\u786E\u8BA4\u671F\u95F4\u5BF9\u8C61\u5185\u5BB9\u6216\u5143\u6570\u636E\u5DF2\u53D8\u5316\uFF0C\u672A\u8986\u76D6\u5DE5\u4F5C\u7A3F", "STORAGE_METADATA_CHANGED");
56844
57283
  if (namespace) {
56845
57284
  const fresh = await loadAttributeNamespace({
@@ -56847,7 +57286,7 @@ ${JSON.stringify({ before: edit.draft, after: candidate }, null, 2)}`;
56847
57286
  metadataSource: "type",
56848
57287
  apis: input3.apis
56849
57288
  });
56850
- if (!isDeepStrictEqual9(fresh, namespace))
57289
+ if (!isDeepStrictEqual8(fresh, namespace))
56851
57290
  throw new CliError("\u786E\u8BA4\u671F\u95F4\u5F53\u524D\u7C7B\u578B\u6216\u5C5E\u6027\u5B9A\u4E49\u53D8\u5316\uFF0C\u672A\u66F4\u65B0\u5DE5\u4F5C\u7A3F", "STORAGE_METADATA_CHANGED");
56852
57291
  await assertDraftOptionsAllowed({
56853
57292
  cwd: input3.cwd,
@@ -56857,7 +57296,7 @@ ${JSON.stringify({ before: edit.draft, after: candidate }, null, 2)}`;
56857
57296
  apis: input3.apis
56858
57297
  });
56859
57298
  for (const [key2, definition] of nameDefinitions)
56860
- if (!isDeepStrictEqual9(await readNameDefinition(key2), definition))
57299
+ if (!isDeepStrictEqual8(await readNameDefinition(key2), definition))
56861
57300
  throw new CliError("\u786E\u8BA4\u671F\u95F4\u65E7\u5C5E\u6027\u540D\u79F0\u5B9A\u4E49\u53D8\u5316", "STORAGE_METADATA_CHANGED");
56862
57301
  }
56863
57302
  await edit.commitCheck();
@@ -57185,7 +57624,7 @@ async function showOnline(input3) {
57185
57624
  }
57186
57625
  const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
57187
57626
  const draft = readDraft(input3.cwd, identity4.n);
57188
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
57627
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
57189
57628
  const info2 = unwrapData(
57190
57629
  await infoApi2({
57191
57630
  resourceIdOrName: identity4.resourceId,
@@ -57204,7 +57643,7 @@ async function showOnline(input3) {
57204
57643
  if (typeof info2.latestVersion !== "string" || !info2.latestVersion) {
57205
57644
  throw new CliError("\u7EBF\u4E0A\u8FD8\u6CA1\u6709\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "VERSION_NOT_FOUND");
57206
57645
  }
57207
- const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params));
57646
+ const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params));
57208
57647
  const versions = readPublishedVersionList(await listApi({ resourceId: identity4.resourceId }), info2.latestVersion, {
57209
57648
  invalid: () => new CliError("\u7248\u672C\u5217\u8868\u65E0\u6548", "VERSION_LIST_INVALID"),
57210
57649
  empty: () => new CliError("\u7EBF\u4E0A\u8FD8\u6CA1\u6709\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "VERSION_NOT_FOUND"),
@@ -57220,7 +57659,7 @@ async function showOnline(input3) {
57220
57659
  cancelled: () => new CliError("\u5DF2\u53D6\u6D88\u67E5\u770B\u7248\u672C", "SHOW_CANCELLED"),
57221
57660
  missing: () => new CliError("\u6CA1\u6709\u8FD9\u4E2A\u7248\u672C", "VERSION_NOT_FOUND")
57222
57661
  });
57223
- const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
57662
+ const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
57224
57663
  const versionResponse = await versionInfoApi({
57225
57664
  resourceId: identity4.resourceId,
57226
57665
  version: version2
@@ -57380,7 +57819,7 @@ async function runUpdateVersionLocked(input3) {
57380
57819
  if (getEnv2() !== initialEnv || requireAuth(input3).userId !== auth.userId)
57381
57820
  throw new CliError("\u6587\u4EF6\u51C6\u5907\u671F\u95F4\u8D26\u53F7\u6216\u73AF\u5883\u53D8\u5316", "SUBMIT_CONTEXT_CHANGED");
57382
57821
  };
57383
- const infoApi2 = input3.apis?.info ?? ((params) => service_API_default.Resource.info(params));
57822
+ const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
57384
57823
  const info2 = unwrapData(
57385
57824
  await infoApi2({
57386
57825
  resourceIdOrName: identity4.resourceId,
@@ -57423,7 +57862,7 @@ async function runUpdateVersionLocked(input3) {
57423
57862
  throw new CliError("\u8BF7\u5148\u786E\u8BA4\u4E22\u5F03\u5DE5\u4F5C\u7A3F", "RESET_CONFIRMATION_REQUIRED");
57424
57863
  }
57425
57864
  if (existingDraft) {
57426
- const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params));
57865
+ const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
57427
57866
  const base = unwrapData(await versionInfoApi({ resourceId: identity4.resourceId, version: source }));
57428
57867
  if (typeof base.fileSha1 !== "string" || !base.fileSha1) {
57429
57868
  throw new CliError("\u6CA1\u6709\u8FD9\u4E2A\u7248\u672C", "DRAFT_VERSION_MISSING");
@@ -57452,7 +57891,7 @@ async function runUpdateVersionLocked(input3) {
57452
57891
  if (!native && info2.subjectType !== 1)
57453
57892
  throw new CliError("\u8BE5\u8D44\u6E90\u4E0D\u662F\u5355\u8D44\u6E90\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7684\u8D44\u6E90\u7BA1\u7406\u547D\u4EE4", "VERSION_SUBJECT_INVALID");
57454
57893
  const versionInfo = unwrapData(
57455
- await (input3.apis?.resourceVersionInfo1 ?? ((p) => service_API_default.Resource.resourceVersionInfo1(p)))({
57894
+ await (input3.apis?.resourceVersionInfo1 ?? ((p) => FServiceAPI2.Resource.resourceVersionInfo1(p)))({
57456
57895
  resourceId: identity4.resourceId,
57457
57896
  version: source
57458
57897
  })
@@ -57644,10 +58083,10 @@ var init_update_version = __esm({
57644
58083
  });
57645
58084
 
57646
58085
  // src/platform/pagination.ts
57647
- function pageData(raw, page, code2) {
58086
+ function pageData(raw, page, code2, options2) {
57648
58087
  if (!object2(raw) || !Array.isArray(raw.dataList) || !Number.isSafeInteger(raw.totalItem) || Number(raw.totalItem) < 0 || raw.dataList.length !== Math.min(50, Math.max(0, Number(raw.totalItem) - (page - 1) * 50)))
57649
58088
  throw new CliError("\u5206\u9875\u7ED3\u679C\u4E0D\u5B8C\u6574\uFF0C\u5DF2\u505C\u6B62\u800C\u4E0D\u731C\u6D4B\u4E0B\u4E00\u9875", code2);
57650
- if (page > 1 && (page - 1) * 50 >= Number(raw.totalItem))
58089
+ if (!options2?.sequential && page > 1 && (page - 1) * 50 >= Number(raw.totalItem))
57651
58090
  throw new CliError("\u9875\u7801\u8D85\u51FA\u5F53\u524D\u5217\u8868\u8303\u56F4", "NODE_PAGE_INVALID");
57652
58091
  return { rows: raw.dataList, total: Number(raw.totalItem) };
57653
58092
  }
@@ -57666,10 +58105,12 @@ function pageNumber(raw = 1) {
57666
58105
  throw new CliError("\u9875\u7801\u987B\u4E3A\u6B63\u6574\u6570", "NODE_PAGE_INVALID");
57667
58106
  return value;
57668
58107
  }
58108
+ var PAGE_OPTION_DESCRIPTION;
57669
58109
  var init_pagination2 = __esm({
57670
58110
  "src/core/pagination.ts"() {
57671
58111
  "use strict";
57672
58112
  init_errors();
58113
+ PAGE_OPTION_DESCRIPTION = "\u9875\u7801\uFF0C\u4ECE1\u5F00\u59CB\uFF0C\u6BCF\u987550\u6761\uFF0C\u91CD\u590D\u6307\u5B9A\u65F6\u53D6\u6700\u540E\u4E00\u4E2A\u503C";
57673
58114
  }
57674
58115
  });
57675
58116
 
@@ -57711,7 +58152,7 @@ async function searchMarket(input3) {
57711
58152
  if (!["all", "resource", "collection"].includes(subject))
57712
58153
  throw new CliError("\u5E02\u573A\u4E3B\u4F53\u7B5B\u9009\u65E0\u6548", "MARKET_SUBJECT_INVALID");
57713
58154
  const raw = await request4(
57714
- input3.apis?.resourceList ?? ((params) => service_API_default.Resource.list(params)),
58155
+ input3.apis?.resourceList ?? ((params) => FServiceAPI2.Resource.list(params)),
57715
58156
  {
57716
58157
  skip: (page - 1) * 50,
57717
58158
  limit: 50,
@@ -57735,7 +58176,7 @@ async function showMarketResource(input3) {
57735
58176
  assertPlatformAllowed();
57736
58177
  const source = parseSource2(input3.source);
57737
58178
  const raw = await request4(
57738
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params)),
58179
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params)),
57739
58180
  {
57740
58181
  resourceIdOrName: source,
57741
58182
  isLoadLatestVersionInfo: 1,
@@ -57751,7 +58192,7 @@ async function showMarketResource(input3) {
57751
58192
  async function marketVersions(input3) {
57752
58193
  if (input3.resource.subjectType === 4) return ["1.0.0"];
57753
58194
  const raw = await request4(
57754
- input3.apis?.resourceVersions ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params)),
58195
+ input3.apis?.resourceVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
57755
58196
  { resourceId: input3.resource.resourceId },
57756
58197
  "MARKET_VERSIONS_INVALID"
57757
58198
  );
@@ -57800,7 +58241,7 @@ async function listOwnedNodes(input3) {
57800
58241
  const userId = requireAuth(input3).userId;
57801
58242
  const page = pageNumber(input3.page);
57802
58243
  const raw = await request4(
57803
- input3.apis?.nodeList ?? ((params) => service_API_default.Node.nodes(params)),
58244
+ input3.apis?.nodeList ?? ((params) => FServiceAPI2.Node.nodes(params)),
57804
58245
  { skip: (page - 1) * 50, limit: 50 },
57805
58246
  "NODE_LIST_INVALID"
57806
58247
  );
@@ -57814,7 +58255,7 @@ async function loadOwnedNode(input3) {
57814
58255
  assertPlatformAllowed();
57815
58256
  const userId = requireAuth(input3).userId, id11 = nodeId2(input3.node);
57816
58257
  const raw = await request4(
57817
- input3.apis?.nodeDetails ?? ((params) => service_API_default.Node.details(params)),
58258
+ input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
57818
58259
  { nodeId: id11 },
57819
58260
  "NODE_DETAIL_INVALID"
57820
58261
  );
@@ -57890,7 +58331,7 @@ async function readPlan(input3) {
57890
58331
  });
57891
58332
  }
57892
58333
  async function lookup(input3, params) {
57893
- return request4(input3.apis?.nodeDetails ?? ((p) => service_API_default.Node.details(p)), params, "NODE_LOOKUP_INVALID");
58334
+ return request4(input3.apis?.nodeDetails ?? ((p) => FServiceAPI2.Node.details(p)), params, "NODE_LOOKUP_INVALID");
57894
58335
  }
57895
58336
  async function assertAvailable(input3, plan) {
57896
58337
  for (const query of [{ nodeName: plan.nodeName }, { nodeDomain: plan.nodeDomain }]) {
@@ -57985,7 +58426,7 @@ ${JSON.stringify({ env: scope.env, userId: scope.userId, existingNodes: before.d
57985
58426
  record21 = markRemoteOperationSending(scope, record21);
57986
58427
  let acknowledged = false;
57987
58428
  try {
57988
- const raw = await (input3.apis?.nodeCreate ?? ((p) => service_API_default.Node.create(p)))(plan);
58429
+ const raw = await (input3.apis?.nodeCreate ?? ((p) => FServiceAPI2.Node.create(p)))(plan);
57989
58430
  const rejection = nodeWriteRejection(raw, "response");
57990
58431
  if (rejection) throw new ApiResponseError("\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u521B\u5EFA\u8282\u70B9", raw, rejection.errCode);
57991
58432
  const data3 = responseData2(raw, "NODE_CREATE_UNCONFIRMED");
@@ -58000,25 +58441,26 @@ ${JSON.stringify({ env: scope.env, userId: scope.userId, existingNodes: before.d
58000
58441
  return result;
58001
58442
  } catch (error3) {
58002
58443
  const rejected = nodeWriteRejection(error3, "error");
58444
+ const unknown2 = () => {
58445
+ const reason = platformFailureMessage(error3, "");
58446
+ return new CliError(
58447
+ `\u8282\u70B9\u521B\u5EFA\u7ED3\u679C\u5F85\u6838\u9A8C${reason ? `\uFF1A${reason}` : ""}\uFF0C\u64CD\u4F5CID ${record21.operation.operationId}\uFF1B\u8BF7 node recover\uFF0C\u4E0D\u8981\u91CD\u590D\u521B\u5EFA`,
58448
+ "NODE_CREATE_UNKNOWN"
58449
+ );
58450
+ };
58003
58451
  if (!acknowledged && rejected) {
58004
58452
  try {
58005
58453
  assertNodeAccount(input3, scope.userId, scope.env);
58006
58454
  markRemoteOperationRejected(scope, record21, rejected);
58007
58455
  } catch {
58008
- throw new CliError(
58009
- `\u8282\u70B9\u521B\u5EFA\u7ED3\u679C\u5F85\u6838\u9A8C\uFF0C\u64CD\u4F5CID ${record21.operation.operationId}\uFF1B\u8BF7 node recover\uFF0C\u4E0D\u8981\u91CD\u590D\u521B\u5EFA`,
58010
- "NODE_CREATE_UNKNOWN"
58011
- );
58456
+ throw unknown2();
58012
58457
  }
58013
58458
  throw new CliError(
58014
58459
  `\u521B\u5EFA\u8282\u70B9\u5931\u8D25\uFF1A${platformFailureMessage(error3, "\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u521B\u5EFA\u8282\u70B9")}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u8BF7 node recover \u6838\u9A8C\u6536\u5C3E`,
58015
58460
  "NODE_CREATE_REJECTED"
58016
58461
  );
58017
58462
  }
58018
- throw new CliError(
58019
- `\u8282\u70B9\u521B\u5EFA\u7ED3\u679C\u5F85\u6838\u9A8C\uFF0C\u64CD\u4F5CID ${record21.operation.operationId}\uFF1B\u8BF7 node recover\uFF0C\u4E0D\u8981\u91CD\u590D\u521B\u5EFA`,
58020
- "NODE_CREATE_UNKNOWN"
58021
- );
58463
+ throw unknown2();
58022
58464
  }
58023
58465
  });
58024
58466
  }
@@ -58100,8 +58542,8 @@ function parseNodeInfo(raw, userId) {
58100
58542
  ...base,
58101
58543
  nodeDomain: raw.nodeDomain,
58102
58544
  nodeShortDescription: optional("nodeShortDescription"),
58103
- nodeLogo: optional("nodeLogo"),
58104
- coverImage: optional("coverImage"),
58545
+ nodeLogo: raw.nodeLogo == null ? null : optional("nodeLogo"),
58546
+ coverImage: raw.coverImage == null ? null : optional("coverImage"),
58105
58547
  nodeThemeId: optional("nodeThemeId"),
58106
58548
  nodeSuspendInfo: raw.nodeSuspendInfo == null ? null : optional("nodeSuspendInfo"),
58107
58549
  exhibitMatchTags: raw.exhibitMatchTags == null ? null : (() => {
@@ -58116,7 +58558,7 @@ async function readNodeInfo(input3) {
58116
58558
  const scope = nodeOperationScope(input3);
58117
58559
  const id11 = nodeId2(input3.node);
58118
58560
  const raw = await request4(
58119
- input3.apis?.nodeDetails ?? ((params) => service_API_default.Node.details(params)),
58561
+ input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
58120
58562
  { nodeId: id11 },
58121
58563
  "NODE_DETAIL_INVALID"
58122
58564
  );
@@ -58155,39 +58597,6 @@ var init_writeResponse = __esm({
58155
58597
  }
58156
58598
  });
58157
58599
 
58158
- // src/domain/node/pending.ts
58159
- function isNodeRecoveryKind(kind) {
58160
- return nodeRecoveryKinds.includes(kind);
58161
- }
58162
- function isExhibitRecoveryOperation(operation) {
58163
- return operation.targetType === 2 && !["dependency-sign", "exhibit-create"].includes(operation.kind) && !isNodeRecoveryKind(operation.kind);
58164
- }
58165
- function operationNodeId(operation) {
58166
- if (operation.targetType !== 2 || operation.kind === "node-create" || operation.kind === "exhibit-create")
58167
- return null;
58168
- const value = operation.kind === "exhibit-collection-create" || operation.kind === "node-source-sign" || operation.kind === "exhibit-source-sign" ? operation.targetId : operation.sourceId;
58169
- if (!/^[1-9]\d*$/u.test(value) || !Number.isSafeInteger(Number(value)))
58170
- throw new CliError("\u672A\u51B3\u64CD\u4F5C\u7684\u8282\u70B9\u8303\u56F4\u4E0D\u53EF\u4FE1\uFF0C\u5DF2\u4FDD\u7559\u8BB0\u5F55\uFF0C\u8BF7\u5148\u6062\u590D\u6838\u9A8C", "REMOTE_OPERATION_INVALID");
58171
- return Number(value);
58172
- }
58173
- function assertNoNodePending(scope, nodeId3) {
58174
- const found = listRemoteOperations(scope).find(({ operation }) => operationNodeId(operation) === nodeId3);
58175
- if (found)
58176
- throw new CliError(
58177
- `\u8282\u70B9 ${nodeId3} \u5DF2\u6709\u672A\u51B3\u64CD\u4F5C ${found.operation.operationId}\uFF0C\u8BF7\u5148 ${isNodeRecoveryKind(found.operation.kind) ? "node" : "exhibit"} recover ${found.operation.operationId}`,
58178
- "REMOTE_OPERATION_PENDING"
58179
- );
58180
- }
58181
- var nodeRecoveryKinds;
58182
- var init_pending = __esm({
58183
- "src/domain/node/pending.ts"() {
58184
- "use strict";
58185
- init_errors();
58186
- init_remoteOperations();
58187
- nodeRecoveryKinds = ["node-create", "node-info", "node-access", "node-delete"];
58188
- }
58189
- });
58190
-
58191
58600
  // src/domain/node/update.ts
58192
58601
  import { createHash as createHash21 } from "crypto";
58193
58602
  function textChanges(input3) {
@@ -58213,7 +58622,7 @@ function textChanges(input3) {
58213
58622
  }
58214
58623
  async function uploadImage2(input3, bytes) {
58215
58624
  try {
58216
- const raw = await (input3.apis?.uploadImage ?? ((params) => service_API_default.Storage.uploadImage(params)))({
58625
+ const raw = await (input3.apis?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params)))({
58217
58626
  file: bytes
58218
58627
  });
58219
58628
  const data3 = responseData2(raw, "NODE_IMAGE_UPLOAD_FAILED");
@@ -58310,7 +58719,7 @@ async function updateNode(input3) {
58310
58719
  let acknowledged = false;
58311
58720
  try {
58312
58721
  await verifiedWriteRequest(
58313
- input3.apis?.setNodeInfo ?? ((params) => service_API_default.Node.setNodeInfo(params)),
58722
+ input3.apis?.setNodeInfo ?? ((params) => FServiceAPI2.Node.setNodeInfo(params)),
58314
58723
  body
58315
58724
  );
58316
58725
  acknowledged = true;
@@ -58337,9 +58746,9 @@ async function updateNode(input3) {
58337
58746
  }
58338
58747
  });
58339
58748
  }
58340
- function imageSnapshot(cwd, path34, formats) {
58749
+ function imageSnapshot(cwd, path33, formats) {
58341
58750
  try {
58342
- return readLocalImage({ cwd, path: path34, maxBytes: 5 * 1024 * 1024, formats, staticGif: true });
58751
+ return readLocalImage({ cwd, path: path33, maxBytes: 5 * 1024 * 1024, formats, staticGif: true });
58343
58752
  } catch {
58344
58753
  throw new CliError(
58345
58754
  "\u8282\u70B9\u56FE\u7247\u5FC5\u987B\u662F\u5141\u8BB8\u683C\u5F0F\u7684\u672C\u5730\u56FE\u7247\u4E14\u4E0D\u8D85\u8FC75MiB\uFF1Bstage=image-validation\uFF0CnodeUpdateSent=false",
@@ -58439,7 +58848,7 @@ async function setNodeAccess(input3) {
58439
58848
  };
58440
58849
  let acknowledged = false, rejection, rejectionMessage;
58441
58850
  try {
58442
- const response = await (input3.apis?.setNodeInfo ?? ((params) => service_API_default.Node.setNodeInfo(params)))(
58851
+ const response = await (input3.apis?.setNodeInfo ?? ((params) => FServiceAPI2.Node.setNodeInfo(params)))(
58443
58852
  request5
58444
58853
  );
58445
58854
  assertNodeAccount(input3, scope.userId, scope.env);
@@ -58504,7 +58913,7 @@ var init_access = __esm({
58504
58913
  async function readDeletionState(input3, node2, scope) {
58505
58914
  const id11 = nodeId2(node2);
58506
58915
  const raw = await request4(
58507
- input3.apis?.nodeDetails ?? ((params) => service_API_default.Node.details(params)),
58916
+ input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
58508
58917
  { nodeId: id11 },
58509
58918
  "NODE_DELETE_DETAIL_INVALID"
58510
58919
  );
@@ -58516,7 +58925,7 @@ async function readDeletionState(input3, node2, scope) {
58516
58925
  }
58517
58926
  async function readFinancialAccount(input3, node2, scope) {
58518
58927
  const raw = await request4(
58519
- input3.apis?.financialAccountInfo ?? ((params) => service_API_default.Payment.queryFinancialAccountInfo(params)),
58928
+ input3.apis?.financialAccountInfo ?? ((params) => FServiceAPI2.Payment.queryFinancialAccountInfo(params)),
58520
58929
  { accountType: 2, ownerId: node2 },
58521
58930
  "NODE_DELETE_ACCOUNT_INVALID"
58522
58931
  );
@@ -58541,12 +58950,12 @@ async function readExhibitIds(input3, node2, scope) {
58541
58950
  let total;
58542
58951
  for (let page = 1; total === void 0 || ids.length < total; page++) {
58543
58952
  const raw = await request4(
58544
- input3.apis?.presentableList ?? ((params) => service_API_default.Exhibit.presentables(params)),
58953
+ input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
58545
58954
  { nodeId: node2, skip: (page - 1) * 50, limit: 50, onlineStatus: 2 },
58546
58955
  "NODE_DELETE_EXHIBITS_INVALID"
58547
58956
  );
58548
58957
  assertNodeAccount(input3, scope.userId, scope.env);
58549
- const parsed = pageData(raw, page, "NODE_DELETE_EXHIBITS_INVALID");
58958
+ const parsed = pageData(raw, page, "NODE_DELETE_EXHIBITS_INVALID", { sequential: true });
58550
58959
  if (total !== void 0 && total !== parsed.total)
58551
58960
  throw new CliError("\u8282\u70B9\u5C55\u54C1\u603B\u91CF\u5728\u8BFB\u53D6\u671F\u95F4\u53D8\u5316", "NODE_DELETE_EXHIBITS_CHANGED");
58552
58961
  total = parsed.total;
@@ -58652,20 +59061,23 @@ async function deleteOwnedNode(input3) {
58652
59061
  nodeDeletePlan: plan
58653
59062
  });
58654
59063
  record21 = markRemoteOperationSending(scope, record21);
58655
- let rejected, rejectionMessage, remoteDeleted = false;
58656
- const unknown2 = () => new CliError(
58657
- `${remoteDeleted ? "\u8FDC\u7AEF\u5220\u9664\u5DF2\u786E\u8BA4\u4F46\u672C\u5730\u6536\u5C3E\u672A\u5B8C\u6210" : "\u8282\u70B9\u5220\u9664\u7ED3\u679C\u672A\u786E\u8BA4"}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u8BF7 node recover ${record21.operation.operationId}\uFF0C\u4E0D\u8981\u91CD\u590DDELETE`,
58658
- "NODE_DELETE_UNKNOWN"
58659
- );
59064
+ let rejected, writeReason, remoteDeleted = false;
59065
+ const unknown2 = (cause) => {
59066
+ const reason = writeReason || platformFailureMessage(cause, "");
59067
+ return new CliError(
59068
+ `${remoteDeleted ? "\u8FDC\u7AEF\u5220\u9664\u5DF2\u786E\u8BA4\u4F46\u672C\u5730\u6536\u5C3E\u672A\u5B8C\u6210" : "\u8282\u70B9\u5220\u9664\u7ED3\u679C\u672A\u786E\u8BA4"}${reason ? `\uFF1A${reason}` : ""}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u8BF7 node recover ${record21.operation.operationId}\uFF0C\u4E0D\u8981\u91CD\u590DDELETE`,
59069
+ "NODE_DELETE_UNKNOWN"
59070
+ );
59071
+ };
58660
59072
  try {
58661
- const response = await (input3.apis?.deleteNode ?? ((params) => service_API_default.Node.deleteNode(params)))({
59073
+ const response = await (input3.apis?.deleteNode ?? ((params) => FServiceAPI2.Node.deleteNode(params)))({
58662
59074
  nodeId: id11
58663
59075
  });
58664
59076
  rejected = nodeWriteRejection(response, "response");
58665
- rejectionMessage = platformResponseMessage(response);
59077
+ writeReason = platformResponseMessage(response);
58666
59078
  } catch (error3) {
58667
59079
  rejected = nodeWriteRejection(error3, "error");
58668
- rejectionMessage = platformFailureMessage(error3, "\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u5220\u9664");
59080
+ writeReason = platformFailureMessage(error3, "");
58669
59081
  }
58670
59082
  if (rejected) {
58671
59083
  try {
@@ -58675,7 +59087,7 @@ async function deleteOwnedNode(input3) {
58675
59087
  throw unknown2();
58676
59088
  }
58677
59089
  throw new CliError(
58678
- `\u5220\u9664\u8282\u70B9\u5931\u8D25\uFF1A${rejectionMessage ?? "\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u5220\u9664"}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u8BF7 node recover ${record21.operation.operationId}`,
59090
+ `\u5220\u9664\u8282\u70B9\u5931\u8D25\uFF1A${writeReason || "\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u5220\u9664"}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u8BF7 node recover ${record21.operation.operationId}`,
58679
59091
  "NODE_DELETE_REJECTED"
58680
59092
  );
58681
59093
  }
@@ -58687,8 +59099,8 @@ async function deleteOwnedNode(input3) {
58687
59099
  remoteDeleted = true;
58688
59100
  closeRemoteOperation(scope, record21);
58689
59101
  return { nodeId: id11, deleted: true, alreadyDeleted: false, deleteSent: true };
58690
- } catch {
58691
- throw unknown2();
59102
+ } catch (error3) {
59103
+ throw unknown2(error3);
58692
59104
  }
58693
59105
  });
58694
59106
  }
@@ -58836,7 +59248,7 @@ async function readExhibit(input3) {
58836
59248
  const scope = operationScope(input3);
58837
59249
  try {
58838
59250
  const raw = await request4(
58839
- input3.apis?.presentableDetails ?? ((params) => service_API_default.Exhibit.presentableDetails(params)),
59251
+ input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
58840
59252
  {
58841
59253
  presentableId: input3.exhibitId,
58842
59254
  isLoadPolicyInfo: 1,
@@ -58866,7 +59278,7 @@ async function listExhibits(input3) {
58866
59278
  const node2 = await loadOwnedNode(input3), page = pageNumber(input3.page), status = input3.status ?? "all";
58867
59279
  if (!["all", "online", "offline"].includes(status)) throw new CliError("\u5C55\u54C1\u72B6\u6001\u7B5B\u9009\u65E0\u6548", "EXHIBIT_STATUS_INVALID");
58868
59280
  const raw = await request4(
58869
- input3.apis?.presentableList ?? ((params) => service_API_default.Exhibit.presentables(params)),
59281
+ input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
58870
59282
  {
58871
59283
  nodeId: node2.nodeId,
58872
59284
  skip: (page - 1) * 50,
@@ -59007,7 +59419,7 @@ async function readExhibitAuthResult(input3, node2, exhibitId, invalidCode = "EX
59007
59419
  reject(new CliError("\u5C55\u54C1\u6388\u6743\u67E5\u8BE2\u8D85\u65F6\uFF0C\u672A\u7EE7\u7EED\u64CD\u4F5C", invalidCode));
59008
59420
  }, 3e4);
59009
59421
  });
59010
- const read2 = input3.apis?.batchAuth ?? ((p) => service_API_default.Exhibit.batchAuth(p, {
59422
+ const read2 = input3.apis?.batchAuth ?? ((p) => FServiceAPI2.Exhibit.batchAuth(p, {
59011
59423
  timeout: 3e4,
59012
59424
  signal: controller.signal
59013
59425
  }));
@@ -59082,7 +59494,7 @@ function currentId(node2) {
59082
59494
  }
59083
59495
  async function readTheme(input3, id11, node2) {
59084
59496
  const raw = await request4(
59085
- input3.apis?.presentableDetails ?? ((params) => service_API_default.Exhibit.presentableDetails(params)),
59497
+ input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
59086
59498
  {
59087
59499
  presentableId: exactId(id11),
59088
59500
  isLoadPolicyInfo: 1,
@@ -59153,7 +59565,7 @@ async function listNodeThemes(input3) {
59153
59565
  const active = currentId(node2);
59154
59566
  const page = pageNumber(input3.page);
59155
59567
  const raw = await request4(
59156
- input3.apis?.presentableList ?? ((params) => service_API_default.Exhibit.presentables(params)),
59568
+ input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
59157
59569
  {
59158
59570
  nodeId: node2.nodeId,
59159
59571
  skip: (page - 1) * 50,
@@ -59195,7 +59607,7 @@ async function currentNodeTheme(input3) {
59195
59607
  async function useNodeTheme(input3) {
59196
59608
  const scope = operationScope(input3);
59197
59609
  const raw = await request4(
59198
- input3.apis?.presentableDetails ?? ((params) => service_API_default.Exhibit.presentableDetails(params)),
59610
+ input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
59199
59611
  { presentableId: exactId(input3.exhibitId), isLoadPolicyInfo: 1, isLoadResourceDetailInfo: 1 },
59200
59612
  "EXHIBIT_THEME_INVALID"
59201
59613
  );
@@ -59249,7 +59661,7 @@ async function useNodeTheme(input3) {
59249
59661
  oldObservation = result.previousTheme;
59250
59662
  return result.state;
59251
59663
  },
59252
- send: input3.apis?.shelf ?? ((params) => service_API_default.Exhibit.presentablesOnlineStatus(params))
59664
+ send: input3.apis?.shelf ?? ((params) => FServiceAPI2.Exhibit.presentablesOnlineStatus(params))
59253
59665
  });
59254
59666
  return {
59255
59667
  exhibitId: input3.exhibitId,
@@ -59383,9 +59795,9 @@ function createNodeCommand() {
59383
59795
  );
59384
59796
  });
59385
59797
  const theme = nodeOptions(root.command("theme")).description("\u67E5\u8BE2\u6216\u5207\u6362\u8282\u70B9\u4E3B\u9898\uFF0C\u4E0D\u901A\u8FC7\u666E\u901A\u4E0B\u67B6\u505C\u7528\u4E3B\u9898");
59386
- nodeOptions(theme.command("list")).option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID\uFF1B\u4EA4\u4E92\u65F6\u53EF\u9009\u62E9").option("--page <n>", "\u9875\u7801\uFF0C\u56FA\u5B9A\u6BCF\u987550\u6761", "1").action(async function(options2) {
59387
- const node2 = await chooseNode2(this, options2.node);
59798
+ nodeOptions(theme.command("list")).option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID\uFF1B\u4EA4\u4E92\u65F6\u53EF\u9009\u62E9").option("--page <n>", PAGE_OPTION_DESCRIPTION, "1").action(async function(options2) {
59388
59799
  let page = pageNumber(options2.page);
59800
+ const node2 = await chooseNode2(this, options2.node);
59389
59801
  for (; ; ) {
59390
59802
  const data3 = await listNodeThemes({ ...nodeContext(this), node: node2, page });
59391
59803
  output2(data3);
@@ -59410,7 +59822,7 @@ function createNodeCommand() {
59410
59822
  nodeOptions(theme.command("use <exhibitId>")).description("\u786E\u8BA4\u8282\u70B9\u6388\u6743\u548C\u6D88\u8D39\u7B56\u7565\u540E\u6FC0\u6D3B\u5DF2\u6709\u4E3B\u9898\u5C55\u54C1").action(async function(exhibitId) {
59411
59823
  output2(await useNodeTheme({ ...nodeContext(this), exhibitId }));
59412
59824
  });
59413
- nodeOptions(root.command("list")).option("--page <n>", "\u9875\u7801\uFF0C\u56FA\u5B9A\u6BCF\u987550\u6761", "1").action(async function(options2) {
59825
+ nodeOptions(root.command("list")).option("--page <n>", PAGE_OPTION_DESCRIPTION, "1").action(async function(options2) {
59414
59826
  let page = pageNumber(options2.page);
59415
59827
  for (; ; ) {
59416
59828
  const data3 = await listOwnedNodes({ ...nodeContext(this), page });
@@ -59476,7 +59888,7 @@ var init_node3 = __esm({
59476
59888
  import { Command as Command42 } from "commander";
59477
59889
  function createMarketCommand() {
59478
59890
  const root = nodeOptions(new Command42("market")).description("\u641C\u7D22\u5E73\u53F0\u4E0A\u67B6\u8D44\u6E90\u4E0E\u4F5C\u8005\u5408\u96C6");
59479
- nodeOptions(root.command("search")).argument("[keywords]", "\u5173\u952E\u8BCD", "").option("--subject <subject>", "all/resource/collection", "all").option("--page <n>", "\u9875\u7801\uFF0C\u6BCF\u987550", "1").action(async function(keywords, options2) {
59891
+ nodeOptions(root.command("search")).argument("[keywords]", "\u5173\u952E\u8BCD", "").option("--subject <subject>", "all/resource/collection", "all").option("--page <n>", PAGE_OPTION_DESCRIPTION, "1").action(async function(keywords, options2) {
59480
59892
  let page = pageNumber(options2.page);
59481
59893
  for (; ; ) {
59482
59894
  const data3 = await searchMarket({ keywords, subject: options2.subject, page });
@@ -59590,7 +60002,7 @@ async function setExhibitVersion(input3) {
59590
60002
  const before = exhibitVersionState(observed, "version");
59591
60003
  const versions = await readDependencyVersions({
59592
60004
  resourceId: observed.resourceId,
59593
- read: input3.apis?.resourceVersions ?? ((params) => service_API_default.Resource.getVersionListByResourceID(params)),
60005
+ read: input3.apis?.resourceVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
59594
60006
  invalidCode: "EXHIBIT_VERSIONS_INVALID"
59595
60007
  });
59596
60008
  assertNodeAccount(input3, scope.userId, scope.env);
@@ -59621,7 +60033,7 @@ async function setExhibitVersion(input3) {
59621
60033
  expected: { ...before, version: version2 },
59622
60034
  body: { presentableId: observed.presentableId, version: version2 },
59623
60035
  read: read2,
59624
- send: input3.apis?.setVersion ?? ((params) => service_API_default.Exhibit.presentablesVersion(params)),
60036
+ send: input3.apis?.setVersion ?? ((params) => FServiceAPI2.Exhibit.presentablesVersion(params)),
59625
60037
  preview: {
59626
60038
  \u5C55\u54C1: observed.presentableId,
59627
60039
  \u539F\u5C55\u793A\u7248\u672C: observed.version,
@@ -59662,7 +60074,7 @@ async function setExhibitAutoUpdate(input3) {
59662
60074
  expected: { ...before, autoUpdateStatus: input3.autoUpdateStatus },
59663
60075
  body: { presentableId: observed.presentableId, autoUpdateStatus: input3.autoUpdateStatus },
59664
60076
  read: read2,
59665
- send: input3.apis?.updatePresentable ?? ((params) => service_API_default.Exhibit.updatePresentable(params)),
60077
+ send: input3.apis?.updatePresentable ?? ((params) => FServiceAPI2.Exhibit.updatePresentable(params)),
59666
60078
  preview: {
59667
60079
  \u5C55\u54C1: observed.presentableId,
59668
60080
  \u5F53\u524D\u5C55\u793A\u7248\u672C: observed.version,
@@ -59769,7 +60181,7 @@ async function readExhibitEditFacts(input3) {
59769
60181
  const id11 = exactId(input3.exhibitId);
59770
60182
  try {
59771
60183
  const raw = await request4(
59772
- input3.apis?.presentableDetails ?? ((params) => service_API_default.Exhibit.presentableDetails(params)),
60184
+ input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
59773
60185
  {
59774
60186
  presentableId: id11,
59775
60187
  isLoadPolicyInfo: 1,
@@ -59926,7 +60338,7 @@ async function updateExhibitInfo(input3) {
59926
60338
  body: { presentableId: input3.exhibitId, ...changed },
59927
60339
  expected: projectInfo(before, changed)
59928
60340
  });
59929
- const send = input3.apis?.updatePresentable ?? ((params) => service_API_default.Exhibit.updatePresentable(params));
60341
+ const send = input3.apis?.updatePresentable ?? ((params) => FServiceAPI2.Exhibit.updatePresentable(params));
59930
60342
  const after = await runExhibitMutation(input3, {
59931
60343
  exhibitId: input3.exhibitId,
59932
60344
  node: before.exhibit.nodeId,
@@ -59952,7 +60364,7 @@ async function updateExhibitInfo(input3) {
59952
60364
  prepare: async () => {
59953
60365
  try {
59954
60366
  uploadAttempted = true;
59955
- const raw = await (input3.apis?.uploadImage ?? ((params) => service_API_default.Storage.uploadImage(params)))({
60367
+ const raw = await (input3.apis?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params)))({
59956
60368
  file: cover.bytes
59957
60369
  });
59958
60370
  assertActor2();
@@ -60202,7 +60614,7 @@ async function setExhibitProperties(input3) {
60202
60614
  expected,
60203
60615
  body: { presentableId: input3.exhibitId, rewriteProperty },
60204
60616
  read: () => readExhibitEditFacts(input3),
60205
- send: input3.apis?.updateRewriteProperty ?? ((params) => service_API_default.Exhibit.updateRewriteProperty(params)),
60617
+ send: input3.apis?.updateRewriteProperty ?? ((params) => FServiceAPI2.Exhibit.updateRewriteProperty(params)),
60206
60618
  preview: {
60207
60619
  action: "rewrite",
60208
60620
  exhibitId: input3.exhibitId,
@@ -60271,7 +60683,7 @@ async function readExhibitAuthorization(input3) {
60271
60683
  if (!ids.includes(exhibit2.resourceId)) throw invalid10();
60272
60684
  const subjects = await readContractSubjects(
60273
60685
  [...ids].sort(),
60274
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60686
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60275
60687
  );
60276
60688
  if (subjects.find((subject) => subject.id === exhibit2.resourceId).type !== exhibit2.subjectType) throw invalid10();
60277
60689
  const contracts2 = await querySubjectContracts({
@@ -60320,7 +60732,7 @@ async function listExhibitAuthorization(input3) {
60320
60732
  async function readPolicies2(input3, subject) {
60321
60733
  let response;
60322
60734
  try {
60323
- response = await (input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params)))({
60735
+ response = await (input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
60324
60736
  resourceIdOrName: subject.id,
60325
60737
  isLoadPolicyInfo: 1
60326
60738
  });
@@ -60336,7 +60748,7 @@ async function assertSigningSubject(input3, current2, resourceId) {
60336
60748
  if (resourceId === current2.exhibit.resourceId) return { id: resourceId, type: current2.exhibit.subjectType };
60337
60749
  let raw;
60338
60750
  try {
60339
- raw = await (input3.apis?.versionInfo ?? ((params) => service_API_default.Resource.resourceVersionInfo1(params)))({
60751
+ raw = await (input3.apis?.versionInfo ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params)))({
60340
60752
  resourceId: current2.exhibit.resourceId,
60341
60753
  version: current2.exhibit.version
60342
60754
  });
@@ -60375,7 +60787,7 @@ async function signExhibitAuthorization(input3) {
60375
60787
  await assertSigningSubject(input3, current2, input3.resourceId);
60376
60788
  await assertContractSubjectsUnchanged(
60377
60789
  before.subjects,
60378
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60790
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60379
60791
  );
60380
60792
  };
60381
60793
  return signSourceContract({
@@ -60387,7 +60799,7 @@ async function signExhibitAuthorization(input3) {
60387
60799
  readPolicies: () => readPolicies2(input3, subject),
60388
60800
  verifySubject: () => assertContractSubjectsUnchanged(
60389
60801
  before.subjects,
60390
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60802
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60391
60803
  ),
60392
60804
  revalidate,
60393
60805
  assertActor: () => assertNodeAccount(input3, scope.userId, scope.env)
@@ -60436,7 +60848,7 @@ async function changeExhibitAuthorization(input3) {
60436
60848
  const current3 = await readExhibitAuthorization(input3);
60437
60849
  await assertContractSubjectsUnchanged(
60438
60850
  current3.subjects,
60439
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60851
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60440
60852
  );
60441
60853
  assertNodeAccount(input3, scope.userId, scope.env);
60442
60854
  return current3;
@@ -60495,12 +60907,15 @@ async function changeExhibitAuthorization(input3) {
60495
60907
  }
60496
60908
  });
60497
60909
  operation = markRemoteOperationSending(scope, operation);
60498
- const unknown2 = () => new CliError(
60499
- `\u5408\u540C\u5E94\u7528\u7ED3\u679C\u672A\u786E\u8BA4\uFF0C\u64CD\u4F5C ${operation.operation.operationId} \u5DF2\u4FDD\u7559\uFF1B\u8BF7\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1`,
60500
- "EXHIBIT_AUTHORIZATION_UNKNOWN"
60501
- );
60910
+ const unknown2 = (cause) => {
60911
+ const reason = platformFailureMessage(cause, "");
60912
+ return new CliError(
60913
+ `\u5408\u540C\u5E94\u7528\u7ED3\u679C\u672A\u786E\u8BA4${reason ? `\uFF1A${reason}` : ""}\uFF0C\u64CD\u4F5C ${operation.operation.operationId} \u5DF2\u4FDD\u7559\uFF1B\u8BF7\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1`,
60914
+ "EXHIBIT_AUTHORIZATION_UNKNOWN"
60915
+ );
60916
+ };
60502
60917
  try {
60503
- const response = await (input3.apis?.setAuthorizationRange ?? ((data3) => service_API_default.Exhibit.batchSetAuthorizationRange(data3)))(body);
60918
+ const response = await (input3.apis?.setAuthorizationRange ?? ((data3) => FServiceAPI2.Exhibit.batchSetAuthorizationRange(data3)))(body);
60504
60919
  const classification = classifyApiResponse(response);
60505
60920
  if (classification.kind === "rejected") {
60506
60921
  operation = markRemoteOperationRejected(scope, operation, {
@@ -60522,7 +60937,7 @@ async function changeExhibitAuthorization(input3) {
60522
60937
  "EXHIBIT_AUTHORIZATION_REJECTED"
60523
60938
  );
60524
60939
  }
60525
- throw unknown2();
60940
+ throw unknown2(error3);
60526
60941
  }
60527
60942
  let after;
60528
60943
  try {
@@ -60530,8 +60945,8 @@ async function changeExhibitAuthorization(input3) {
60530
60945
  if (authorizationPlanDigest(after.identity) !== authorizationPlanDigest(before.identity) || !after.state || authorizationPlanDigest(after.state) !== authorizationPlanDigest(plan.desired))
60531
60946
  throw unknown2();
60532
60947
  closeRemoteOperation(scope, operation);
60533
- } catch {
60534
- throw unknown2();
60948
+ } catch (error3) {
60949
+ throw unknown2(error3);
60535
60950
  }
60536
60951
  return {
60537
60952
  exhibitId: input3.exhibitId,
@@ -60567,7 +60982,7 @@ async function recoverExhibitAuthorization(input3, record21) {
60567
60982
  throw new CliError("\u5C55\u54C1\u6765\u6E90\u6388\u6743\u6062\u590D\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF0C\u672A\u6536\u5C3E", "EXHIBIT_RECOVERY_CONFLICT");
60568
60983
  await assertContractSubjectsUnchanged(
60569
60984
  fresh.subjects,
60570
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60985
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60571
60986
  );
60572
60987
  },
60573
60988
  readPolicies: () => readPolicies2(input3, subject)
@@ -60578,7 +60993,7 @@ async function recoverExhibitAuthorization(input3, record21) {
60578
60993
  throw new CliError("\u4E0D\u662F\u5C55\u54C1\u5E94\u7528\u8BB0\u5F55", "EXHIBIT_RECOVERY_INVALID");
60579
60994
  await assertContractSubjectsUnchanged(
60580
60995
  current2.subjects,
60581
- input3.apis?.resourceInfo ?? ((params) => service_API_default.Resource.info(params))
60996
+ input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
60582
60997
  );
60583
60998
  return {
60584
60999
  confirmed: current2.subjects.some((row) => row.id === op.authPlan.subjectId && row.type === op.authPlan.subjectType) && (op.state === "prepared" || !!current2.state && authorizationPlanDigest(current2.state) === (op.state === "rejected" ? op.previousStateSha256 : op.desiredStateSha256)),
@@ -60646,12 +61061,12 @@ function parseCollection(raw, expectedId) {
60646
61061
  sortDirection: direction === "collection_sort_descending" ? "descending" : "ascending"
60647
61062
  };
60648
61063
  }
60649
- async function readCollection(input3, collectionId) {
61064
+ async function readCollectionWith(input3, collectionId, project2) {
60650
61065
  const scope = operationScope(input3);
60651
61066
  exactId(collectionId);
60652
61067
  try {
60653
61068
  const raw = await request4(
60654
- input3.apis?.presentableDetails ?? ((p) => service_API_default.Exhibit.presentableDetails(p)),
61069
+ input3.apis?.presentableDetails ?? ((p) => FServiceAPI2.Exhibit.presentableDetails(p)),
60655
61070
  {
60656
61071
  presentableId: collectionId,
60657
61072
  isLoadPolicyInfo: 1,
@@ -60665,18 +61080,40 @@ async function readCollection(input3, collectionId) {
60665
61080
  assertNodeAccount(input3, scope.userId, scope.env);
60666
61081
  const collection = parseCollection(raw, collectionId);
60667
61082
  await loadOwnedNode({ ...input3, node: collection.exhibit.nodeId });
60668
- return collection;
61083
+ return project2(collection, raw);
60669
61084
  } finally {
60670
61085
  assertNodeAccount(input3, scope.userId, scope.env);
60671
61086
  }
60672
61087
  }
61088
+ function readCollection(input3, collectionId) {
61089
+ return readCollectionWith(input3, collectionId, (collection) => collection);
61090
+ }
61091
+ function readCollectionDetails(input3, collectionId) {
61092
+ return readCollectionWith(input3, collectionId, (collection, raw) => {
61093
+ const invalid15 = () => new CliError("\u5C55\u54C1\u5408\u96C6\u5C01\u9762\u3001\u7B80\u4ECB\u6216\u6807\u7B7E\u683C\u5F0F\u4E0D\u53EF\u4FE1", "EXHIBIT_COLLECTION_METADATA_INVALID");
61094
+ if (!object2(raw)) throw invalid15();
61095
+ const presentableIntro = raw.presentableIntro ?? null;
61096
+ if (presentableIntro !== null && typeof presentableIntro !== "string") throw invalid15();
61097
+ const readStrings = (value) => {
61098
+ if (value == null) return null;
61099
+ if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) throw invalid15();
61100
+ return [...value];
61101
+ };
61102
+ return {
61103
+ ...collection,
61104
+ presentableIntro,
61105
+ tags: readStrings(raw.tags),
61106
+ coverImages: readStrings(raw.coverImages)
61107
+ };
61108
+ });
61109
+ }
60673
61110
  async function listExhibitCollections(input3) {
60674
61111
  const scope = operationScope(input3);
60675
61112
  try {
60676
61113
  const node2 = await loadOwnedNode(input3);
60677
61114
  const page = pageNumber(input3.page);
60678
61115
  const raw = await request4(
60679
- input3.apis?.presentableList ?? ((p) => service_API_default.Exhibit.presentables(p)),
61116
+ input3.apis?.presentableList ?? ((p) => FServiceAPI2.Exhibit.presentables(p)),
60680
61117
  {
60681
61118
  nodeId: node2.nodeId,
60682
61119
  subjectType: 5,
@@ -60717,7 +61154,7 @@ async function listExhibitCollectionTypes(input3) {
60717
61154
  }
60718
61155
  async function readExhibitCollectionTypes(input3) {
60719
61156
  const raw = await request4(
60720
- input3.apis?.resourceTypes ?? ((p) => service_API_default.Resource.resourceTypes(p)),
61157
+ input3.apis?.resourceTypes ?? ((p) => FServiceAPI2.Resource.resourceTypes(p)),
60721
61158
  { category: 1, status: 1, subjectType: 5 },
60722
61159
  "EXHIBIT_COLLECTION_TYPE_INVALID"
60723
61160
  );
@@ -60728,12 +61165,12 @@ async function readExhibitCollectionTypes(input3) {
60728
61165
  if (!object2(value) || typeof value.code !== "string" || !value.code.trim() || typeof value.name !== "string" || !value.name.trim() || codes2.has(value.code))
60729
61166
  throw new CliError("\u7C7B\u578B\u6811\u5B58\u5728\u7F3A\u5931\u6216\u91CD\u590D\u8EAB\u4EFD", "EXHIBIT_COLLECTION_TYPE_INVALID");
60730
61167
  codes2.add(value.code);
60731
- const path34 = [...parents, value.name];
61168
+ const path33 = [...parents, value.name];
60732
61169
  return {
60733
61170
  code: value.code,
60734
61171
  name: value.name,
60735
- path: path34,
60736
- children: value.children === void 0 || value.children === "" ? [] : decode(value.children, path34)
61172
+ path: path33,
61173
+ children: value.children === void 0 || value.children === "" ? [] : decode(value.children, path33)
60737
61174
  };
60738
61175
  });
60739
61176
  };
@@ -60744,7 +61181,7 @@ async function resolveExhibitCollectionType(input3, code2) {
60744
61181
  const tree = await readExhibitCollectionTypes(input3);
60745
61182
  const selected = leaves(tree).find((node2) => node2.code === code2.trim());
60746
61183
  const raw = await request4(
60747
- input3.apis?.getTypeInfo ?? ((p) => service_API_default.Resource.getResourceTypeInfoByCode(p)),
61184
+ input3.apis?.getTypeInfo ?? ((p) => FServiceAPI2.Resource.getResourceTypeInfoByCode(p)),
60748
61185
  { code: code2.trim() },
60749
61186
  "EXHIBIT_COLLECTION_TYPE_INVALID"
60750
61187
  );
@@ -60814,7 +61251,7 @@ var init_types = __esm({
60814
61251
  // src/domain/exhibit/collection/create.ts
60815
61252
  async function lookup2(input3, plan) {
60816
61253
  return request4(
60817
- input3.apis?.presentableDetails ?? ((p) => service_API_default.Exhibit.presentableDetails(p)),
61254
+ input3.apis?.presentableDetails ?? ((p) => FServiceAPI2.Exhibit.presentableDetails(p)),
60818
61255
  {
60819
61256
  nodeId: plan.nodeId,
60820
61257
  presentableName: plan.presentableName,
@@ -60905,7 +61342,7 @@ async function createExhibitCollection(input3) {
60905
61342
  let acknowledged = false;
60906
61343
  try {
60907
61344
  const data3 = await verifiedWriteRequest(
60908
- input3.apis?.createCollection ?? ((p) => service_API_default.Exhibit.createPresentableCollection(p)),
61345
+ input3.apis?.createCollection ?? ((p) => FServiceAPI2.Exhibit.createPresentableCollection(p)),
60909
61346
  plan
60910
61347
  );
60911
61348
  acknowledged = true;
@@ -60924,21 +61361,22 @@ async function createExhibitCollection(input3) {
60924
61361
  assertNodeAccount(input3, scope.userId, scope.env);
60925
61362
  markRemoteOperationRejected(scope, record21, error3.rejection);
60926
61363
  } catch {
60927
- throw unknown(record21);
61364
+ throw unknown(record21, error3);
60928
61365
  }
60929
61366
  throw new CliError(
60930
61367
  `\u521B\u5EFA\u5C55\u54C1\u5408\u96C6\u5931\u8D25\uFF1A${platformFailureMessage(error3, "\u5E73\u53F0\u62D2\u7EDD\u672C\u6B21\u521B\u5EFA")}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover`,
60931
61368
  "EXHIBIT_COLLECTION_CREATE_REJECTED"
60932
61369
  );
60933
61370
  }
60934
- throw unknown(record21);
61371
+ throw unknown(record21, error3);
60935
61372
  }
60936
61373
  })
60937
61374
  );
60938
61375
  }
60939
- function unknown(record21) {
61376
+ function unknown(record21, cause) {
61377
+ const reason = platformFailureMessage(cause, "");
60940
61378
  return new CliError(
60941
- `\u5C55\u54C1\u5408\u96C6\u521B\u5EFA\u7ED3\u679C\u5F85\u6838\u9A8C\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u590D\u521B\u5EFA`,
61379
+ `\u5C55\u54C1\u5408\u96C6\u521B\u5EFA\u7ED3\u679C\u5F85\u6838\u9A8C${reason ? `\uFF1A${reason}` : ""}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u590D\u521B\u5EFA`,
60942
61380
  "EXHIBIT_COLLECTION_CREATE_UNKNOWN"
60943
61381
  );
60944
61382
  }
@@ -61032,10 +61470,13 @@ async function collectionMutation(input3, plan) {
61032
61470
  collectionSelectionIds: selections
61033
61471
  });
61034
61472
  record21 = markRemoteOperationSending(scope, record21);
61035
- const unknown2 = () => new CliError(
61036
- `\u5C55\u54C1\u5408\u96C6\u4FEE\u6539\u7ED3\u679C\u5F85\u6838\u9A8C\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1`,
61037
- "EXHIBIT_COLLECTION_WRITE_UNKNOWN"
61038
- );
61473
+ const unknown2 = (cause) => {
61474
+ const reason = platformFailureMessage(cause, "");
61475
+ return new CliError(
61476
+ `\u5C55\u54C1\u5408\u96C6\u4FEE\u6539\u7ED3\u679C\u5F85\u6838\u9A8C${reason ? `\uFF1A${reason}` : ""}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1`,
61477
+ "EXHIBIT_COLLECTION_WRITE_UNKNOWN"
61478
+ );
61479
+ };
61039
61480
  let acknowledged = false;
61040
61481
  try {
61041
61482
  const data3 = await verifiedWriteRequest(plan.send, plan.body);
@@ -61059,14 +61500,14 @@ async function collectionMutation(input3, plan) {
61059
61500
  assertNodeAccount(input3, scope.userId, scope.env);
61060
61501
  markRemoteOperationRejected(scope, record21, error3.rejection);
61061
61502
  } catch {
61062
- throw unknown2();
61503
+ throw unknown2(error3);
61063
61504
  }
61064
61505
  throw new CliError(
61065
61506
  `\u5C55\u54C1\u5408\u96C6\u4FEE\u6539\u5931\u8D25\uFF1A${platformFailureMessage(error3, "\u5E73\u53F0\u62D2\u7EDD\u672C\u6B21\u4FEE\u6539")}\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\uFF0C\u5148 exhibit recover`,
61066
61507
  "EXHIBIT_COLLECTION_WRITE_REJECTED"
61067
61508
  );
61068
61509
  }
61069
- throw unknown2();
61510
+ throw unknown2(error3);
61070
61511
  }
61071
61512
  })
61072
61513
  );
@@ -61132,7 +61573,7 @@ function uniqueItems(items) {
61132
61573
  }
61133
61574
  async function itemPage(input3, id11, node2, page, keywords, sortType = 1) {
61134
61575
  const data3 = await request4(
61135
- input3.apis?.collectionItems ?? ((params) => service_API_default.Exhibit.getItemsFromPresentableCollection(params)),
61576
+ input3.apis?.collectionItems ?? ((params) => FServiceAPI2.Exhibit.getItemsFromPresentableCollection(params)),
61136
61577
  {
61137
61578
  presentableId: id11,
61138
61579
  skip: (page - 1) * 50,
@@ -61204,7 +61645,7 @@ async function listCollectionItems(input3) {
61204
61645
  let auth = /* @__PURE__ */ new Map();
61205
61646
  if (items.length) {
61206
61647
  const data3 = await request4(
61207
- input3.apis?.batchAuth ?? ((params) => service_API_default.Exhibit.batchAuth(params)),
61648
+ input3.apis?.batchAuth ?? ((params) => FServiceAPI2.Exhibit.batchAuth(params)),
61208
61649
  { nodeId: exhibit2.nodeId, authType: 3, presentableIds: items.map((item) => item.exhibitId).join(",") },
61209
61650
  "EXHIBIT_COLLECTION_AUTH_INVALID"
61210
61651
  );
@@ -61244,7 +61685,7 @@ function collectionSelection(ids, code2) {
61244
61685
  }
61245
61686
  async function assertMember(input3, id11, node2) {
61246
61687
  const raw = await request4(
61247
- input3.apis?.presentableDetails ?? ((params) => service_API_default.Exhibit.presentableDetails(params)),
61688
+ input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
61248
61689
  { presentableId: id11, isLoadPolicyInfo: 1, isLoadResourceDetailInfo: 1 },
61249
61690
  "EXHIBIT_COLLECTION_MEMBER_INVALID"
61250
61691
  );
@@ -61286,7 +61727,7 @@ async function addCollectionItems(input3) {
61286
61727
  beforeSend: async () => {
61287
61728
  await assertMembers(input3, selected, directory2.nodeId, assertActor2);
61288
61729
  },
61289
- send: input3.apis?.addCollectionItems ?? ((params) => service_API_default.Exhibit.addItemsToPresentableCollection(params)),
61730
+ send: input3.apis?.addCollectionItems ?? ((params) => FServiceAPI2.Exhibit.addItemsToPresentableCollection(params)),
61290
61731
  body: {
61291
61732
  presentableId: input3.collectionId,
61292
61733
  addCollectionItems: added.map((presentableId) => ({ presentableId }))
@@ -61329,7 +61770,7 @@ async function removeCollectionItems(input3) {
61329
61770
  before,
61330
61771
  expected: { ...before, items: before.items.filter((item) => !selected.includes(item.itemId)) },
61331
61772
  read: () => readCollectionRemovalState(input3, input3.collectionId),
61332
- send: input3.apis?.removeCollectionItems ?? ((params) => service_API_default.Exhibit.removeItemsFromPresentableCollection(params)),
61773
+ send: input3.apis?.removeCollectionItems ?? ((params) => FServiceAPI2.Exhibit.removeItemsFromPresentableCollection(params)),
61333
61774
  body: { presentableId: input3.collectionId, removeIds: selected.join(","), idType: "itemId" }
61334
61775
  });
61335
61776
  });
@@ -61389,7 +61830,7 @@ async function moveCollectionItems(input3) {
61389
61830
  before,
61390
61831
  expected: { ...before, itemIds },
61391
61832
  read: () => readCollectionOrderState(input3, input3.collectionId),
61392
- send: input3.apis?.manualSort ?? ((params) => service_API_default.Exhibit.setItemsSortFromPresentableCollectionManual(params)),
61833
+ send: input3.apis?.manualSort ?? ((params) => FServiceAPI2.Exhibit.setItemsSortFromPresentableCollectionManual(params)),
61393
61834
  body: { presentableId: input3.collectionId, itemIds: moving, targetSortId: input3.position }
61394
61835
  });
61395
61836
  });
@@ -61427,7 +61868,7 @@ async function quickSortCollectionItems(input3) {
61427
61868
  exhibitIds: observed.items.map((item) => item.exhibitId).sort()
61428
61869
  };
61429
61870
  },
61430
- send: input3.apis?.quickSort ?? ((params) => service_API_default.Exhibit.setItemsSortFromPresentableCollectionQuick(params)),
61871
+ send: input3.apis?.quickSort ?? ((params) => FServiceAPI2.Exhibit.setItemsSortFromPresentableCollectionQuick(params)),
61431
61872
  body: {
61432
61873
  presentableId: input3.collectionId,
61433
61874
  sortField: field,
@@ -61453,7 +61894,7 @@ async function setCollectionDirection(input3) {
61453
61894
  before,
61454
61895
  expected: { ...before, direction: input3.direction },
61455
61896
  read: () => readCollectionDirectionState(input3, input3.collectionId),
61456
- send: input3.apis?.updateCollection ?? ((params) => service_API_default.Exhibit.updatePresentableCollection(params)),
61897
+ send: input3.apis?.updateCollection ?? ((params) => FServiceAPI2.Exhibit.updatePresentableCollection(params)),
61457
61898
  body: {
61458
61899
  presentableId: input3.collectionId,
61459
61900
  catalogueProperty: { collection_sort_list: `collection_sort_${input3.direction}` }
@@ -61552,7 +61993,7 @@ async function readCollectionRuleState(input3, collectionId) {
61552
61993
  try {
61553
61994
  const { exhibit: exhibit2 } = await readCollection(input3, collectionId);
61554
61995
  const raw = await request4(
61555
- input3.apis?.getCollectRule ?? ((params) => service_API_default.Exhibit.getItemsAutoCollectRule(params)),
61996
+ input3.apis?.getCollectRule ?? ((params) => FServiceAPI2.Exhibit.getItemsAutoCollectRule(params)),
61556
61997
  { presentableId: collectionId },
61557
61998
  INVALID2
61558
61999
  );
@@ -61583,7 +62024,7 @@ async function saveRule(input3, rule, original, assertActor2) {
61583
62024
  if (rule.status === 1) await validateTypes(input3, rule);
61584
62025
  return readCollectionRuleState(input3, input3.collectionId);
61585
62026
  },
61586
- send: input3.apis?.setCollectRule ?? ((params) => service_API_default.Exhibit.setItemsAutoCollectRule(params)),
62027
+ send: input3.apis?.setCollectRule ?? ((params) => FServiceAPI2.Exhibit.setItemsAutoCollectRule(params)),
61587
62028
  body: { presentableId: input3.collectionId, ...rule }
61588
62029
  });
61589
62030
  }
@@ -61710,8 +62151,9 @@ async function writeExhibit(input3, previous, intent, body, write, matches3, bef
61710
62151
  "EXHIBIT_WRITE_REJECTED"
61711
62152
  );
61712
62153
  }
62154
+ const reason = error3 instanceof CliError ? safePlatformMessage(error3.message) : platformFailureMessage(error3, "");
61713
62155
  throw new CliError(
61714
- `\u5C55\u54C1 ${previous.presentableId} \u5199\u5165\u7ED3\u679C\u5F85\u6838\u9A8C\uFF1B\u64CD\u4F5CID ${record21.operation.operationId}\u3002\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1\u3002`,
62156
+ `\u5C55\u54C1 ${previous.presentableId} \u5199\u5165\u7ED3\u679C\u5F85\u6838\u9A8C\uFF1B${reason ? `\u539F\u56E0\uFF1A${reason}\uFF1B` : ""}\u64CD\u4F5CID ${record21.operation.operationId}\u3002\u5148 exhibit recover\uFF0C\u4E0D\u8981\u91CD\u53D1\u3002`,
61715
62157
  "EXHIBIT_WRITE_UNKNOWN"
61716
62158
  );
61717
62159
  }
@@ -61736,7 +62178,7 @@ async function setExhibitPolicy(input3) {
61736
62178
  previousIds: exhibit2.policies.map((p) => p.policyId)
61737
62179
  },
61738
62180
  { presentableId: exhibit2.presentableId, updatePolicies: [{ policyId: policy.policyId, status: input3.status }] },
61739
- input3.apis?.updatePresentable ?? ((p) => service_API_default.Exhibit.updatePresentable(p)),
62181
+ input3.apis?.updatePresentable ?? ((p) => FServiceAPI2.Exhibit.updatePresentable(p)),
61740
62182
  (fresh) => fresh.policies.some((p) => p.policyId === policy.policyId && p.status === input3.status)
61741
62183
  );
61742
62184
  return { exhibitId: exhibit2.presentableId, policyId: policy.policyId, status: input3.status, reused: false };
@@ -61764,7 +62206,7 @@ async function shelfExhibit(input3) {
61764
62206
  exhibit2,
61765
62207
  { kind: "exhibit-shelf", onlineStatus: input3.onlineStatus, policyIds: [], previousIds: [] },
61766
62208
  { presentableId: exhibit2.presentableId, onlineStatus: input3.onlineStatus },
61767
- input3.apis?.shelf ?? ((p) => service_API_default.Exhibit.presentablesOnlineStatus(p)),
62209
+ input3.apis?.shelf ?? ((p) => FServiceAPI2.Exhibit.presentablesOnlineStatus(p)),
61768
62210
  (fresh) => fresh.onlineStatus === input3.onlineStatus,
61769
62211
  input3.onlineStatus === 1 ? (fresh) => assertExhibitAuthorized(input3, fresh.nodeId, fresh.presentableId) : void 0
61770
62212
  );
@@ -61871,7 +62313,7 @@ async function exhibitTemplates(input3) {
61871
62313
  const exhibit2 = await readExhibit(input3);
61872
62314
  if (!exhibit2.resourceTypeCode) throw new CliError("\u5C55\u54C1\u8BE6\u60C5\u7F3A\u5C11\u6765\u6E90\u7C7B\u578B\uFF0C\u4E0D\u80FD\u731C\u6D4B\u6A21\u677F\u4E0A\u4E0B\u6587", "EXHIBIT_TYPE_MISSING");
61873
62315
  const raw = await request4(
61874
- input3.apis?.templates ?? ((p) => service_API_default.Policy.policyTemplates(p)),
62316
+ input3.apis?.templates ?? ((p) => FServiceAPI2.Policy.policyTemplates(p)),
61875
62317
  { resourceTypeCodes4Presentable: [exhibit2.resourceTypeCode] },
61876
62318
  "EXHIBIT_TEMPLATES_INVALID"
61877
62319
  );
@@ -61906,8 +62348,8 @@ async function applyExhibitTemplate(input3) {
61906
62348
  params: input3.params,
61907
62349
  requireEveryParam: !input3.interactive,
61908
62350
  // 保留真实成功/失败信封交给共享模板模型,不先解包再伪装成裸data。
61909
- reCompile: input3.apis?.reCompile ?? ((p) => service_API_default.Policy.policyReCompile(p)),
61910
- translate: input3.apis?.translate ?? ((p) => service_API_default.Policy.policyTranslation(p))
62351
+ reCompile: input3.apis?.reCompile ?? ((p) => FServiceAPI2.Policy.policyReCompile(p)),
62352
+ translate: input3.apis?.translate ?? ((p) => FServiceAPI2.Policy.policyTranslation(p))
61911
62353
  },
61912
62354
  {
61913
62355
  ownerId: exhibit2.nodeId,
@@ -61934,7 +62376,7 @@ async function applyExhibitTemplate(input3) {
61934
62376
  presentableId: exhibit2.presentableId,
61935
62377
  addPolicies: [{ policyName: input3.name, policyText: compiled.policyText, status: 1 }]
61936
62378
  },
61937
- input3.apis?.updatePresentable ?? ((p) => service_API_default.Exhibit.updatePresentable(p)),
62379
+ input3.apis?.updatePresentable ?? ((p) => FServiceAPI2.Exhibit.updatePresentable(p)),
61938
62380
  (fresh) => fresh.policies.filter(
61939
62381
  (p) => !exhibit2.policies.some((old) => old.policyId === p.policyId) && p.policyName === input3.name && p.policyText === compiled.policyText && p.status === 1
61940
62382
  ).length === 1,
@@ -61989,20 +62431,21 @@ function createExhibitCollectionCommand() {
61989
62431
  await createExhibitCollection({ ...nodeContext(this), ...options2, node: await chooseNode2(this, options2.node) })
61990
62432
  );
61991
62433
  });
61992
- nodeOptions(root.command("list")).description("\u67E5\u8BE2\u672C\u4EBA\u8282\u70B9\u81EA\u5EFA\u7684\u5C55\u54C1\u5408\u96C6\uFF0C\u6BCF\u987550\u6761").option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID").option("--page <n>", "\u9875\u7801\uFF0C\u4ECE1\u5F00\u59CB").action(async function(options2) {
62434
+ nodeOptions(root.command("list")).description("\u67E5\u8BE2\u672C\u4EBA\u8282\u70B9\u81EA\u5EFA\u7684\u5C55\u54C1\u5408\u96C6\uFF0C\u6BCF\u987550\u6761").option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID").option("--page <n>", PAGE_OPTION_DESCRIPTION).action(async function(options2) {
62435
+ const page = pageNumber(options2.page);
61993
62436
  output2(
61994
62437
  await listExhibitCollections({
61995
62438
  ...nodeContext(this),
61996
62439
  node: await chooseNode2(this, options2.node),
61997
- page: pageNumber(options2.page)
62440
+ page
61998
62441
  })
61999
62442
  );
62000
62443
  });
62001
62444
  nodeOptions(root.command("show <collectionId>")).description("\u67E5\u8BE2\u81EA\u5EFA\u5C55\u54C1\u5408\u96C6\uFF1B\u4F5C\u8005\u5408\u96C6\u5C55\u54C1\u4E0D\u53EF\u4F7F\u7528\u6B64\u5165\u53E3").action(async function(collectionId) {
62002
- output2(await readCollection(nodeContext(this), collectionId));
62445
+ output2(await readCollectionDetails(nodeContext(this), collectionId));
62003
62446
  });
62004
62447
  const item = nodeOptions(root.command("item")).description("\u6210\u5458\u662F\u672C\u8282\u70B9\u666E\u901A\u5C55\u54C1\uFF1B\u79FB\u9664\u53EA\u89E3\u9664\u6536\u5F55\u5173\u7CFB");
62005
- nodeOptions(item.command("list <collectionId>")).description("\u5206\u9875\u67E5\u8BE2\u6210\u5458\u53CA\u8282\u70B9\u4FA7\u6388\u6743\u89C2\u5BDF\uFF0C\u4E0D\u663E\u793A\u5408\u540C\u6216\u7B56\u7565\u8BE6\u60C5").option("--page <n>", "\u9875\u7801\uFF0C\u4ECE1\u5F00\u59CB").option("--keywords <text>", "\u6309\u6807\u9898\u6216\u6388\u6743\u6807\u8BC6\u641C\u7D22").action(async function(collectionId, options2) {
62448
+ nodeOptions(item.command("list <collectionId>")).description("\u5206\u9875\u67E5\u8BE2\u6210\u5458\u53CA\u8282\u70B9\u4FA7\u6388\u6743\u89C2\u5BDF\uFF0C\u4E0D\u663E\u793A\u5408\u540C\u6216\u7B56\u7565\u8BE6\u60C5").option("--page <n>", PAGE_OPTION_DESCRIPTION).option("--keywords <text>", "\u6309\u6807\u9898\u6216\u6388\u6743\u6807\u8BC6\u641C\u7D22").action(async function(collectionId, options2) {
62006
62449
  output2(
62007
62450
  await listCollectionItems({
62008
62451
  ...nodeContext(this),
@@ -62271,9 +62714,9 @@ function createExhibitCommand() {
62271
62714
  throw new CliError("--on \u4E0E --off \u5FC5\u987B\u4E14\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A", "EXHIBIT_AUTO_UPDATE_REQUIRED");
62272
62715
  output2(await setExhibitAutoUpdate({ ...nodeContext(this), exhibitId, autoUpdateStatus: options2.on ? 1 : 0 }));
62273
62716
  });
62274
- nodeOptions(root.command("list")).option("--node <id>").option("--page <n>", "\u9875\u7801\uFF0C\u6BCF\u987550", "1").option("--status <status>", "all/online/offline", "all").action(async function(options2) {
62275
- const node2 = await chooseNode2(this, options2.node);
62717
+ nodeOptions(root.command("list")).option("--node <id>").option("--page <n>", PAGE_OPTION_DESCRIPTION, "1").option("--status <status>", "all/online/offline", "all").action(async function(options2) {
62276
62718
  let page = pageNumber(options2.page);
62719
+ const node2 = await chooseNode2(this, options2.node);
62277
62720
  for (; ; ) {
62278
62721
  const data3 = await listExhibits({ ...nodeContext(this), node: node2, page, status: options2.status });
62279
62722
  output2(data3);
@@ -62937,8 +63380,8 @@ function createStorageCommand() {
62937
63380
  options(root.command("show <objectId>")).action(async function(objectId) {
62938
63381
  output3(await showStorageObject(context2(this), objectId));
62939
63382
  });
62940
- options(root.command("upload <path>")).requiredOption("--bucket <name>", "\u7A7A\u95F4\u540D\u79F0").option("--name <name>", "\u5B58\u50A8\u5BF9\u8C61\u6587\u4EF6\u540D\uFF0C\u9ED8\u8BA4\u672C\u5730\u6587\u4EF6\u540D").option("--replace", "\u663E\u5F0F\u5141\u8BB8\u540C\u540D\u66FF\u6362\uFF0C\u4ECD\u9700\u786E\u8BA4").action(async function(path34, o) {
62941
- output3(await uploadStorageObject({ ...context2(this), path: path34, ...o }));
63383
+ options(root.command("upload <path>")).requiredOption("--bucket <name>", "\u7A7A\u95F4\u540D\u79F0").option("--name <name>", "\u5B58\u50A8\u5BF9\u8C61\u6587\u4EF6\u540D\uFF0C\u9ED8\u8BA4\u672C\u5730\u6587\u4EF6\u540D").option("--replace", "\u663E\u5F0F\u5141\u8BB8\u540C\u540D\u66FF\u6362\uFF0C\u4ECD\u9700\u786E\u8BA4").action(async function(path33, o) {
63384
+ output3(await uploadStorageObject({ ...context2(this), path: path33, ...o }));
62942
63385
  });
62943
63386
  options(root.command("remove <objectId>")).action(async function(objectId) {
62944
63387
  output3(await removeStorageObject({ ...context2(this), objectId }));
@@ -63331,10 +63774,10 @@ var init_service5 = __esm({
63331
63774
  init_store2();
63332
63775
  init_browser();
63333
63776
  defaults2 = {
63334
- contractDetails: (params, config) => service_API_default.Contract.contractDetails(params, config),
63335
- contractsTransitionRecord: (params, config) => service_API_default.Contract.contractsTransitionRecord(params, config),
63336
- availablePaymentMethods: (params, config) => service_API_default.Payment.availablePaymentMethods(params, config),
63337
- queryPayment: (params, config) => service_API_default.Payment.queryPayment(params, config)
63777
+ contractDetails: (params, config) => FServiceAPI2.Contract.contractDetails(params, config),
63778
+ contractsTransitionRecord: (params, config) => FServiceAPI2.Contract.contractsTransitionRecord(params, config),
63779
+ availablePaymentMethods: (params, config) => FServiceAPI2.Payment.availablePaymentMethods(params, config),
63780
+ queryPayment: (params, config) => FServiceAPI2.Payment.queryPayment(params, config)
63338
63781
  };
63339
63782
  }
63340
63783
  });
@@ -63596,16 +64039,8 @@ var init_batchFailure = __esm({
63596
64039
  });
63597
64040
 
63598
64041
  // src/core/usageDocs.ts
63599
- import { existsSync as existsSync21 } from "fs";
63600
- import path32 from "path";
63601
- import { fileURLToPath } from "url";
63602
- function usageDocsPath() {
63603
- const moduleDir = path32.dirname(fileURLToPath(import.meta.url));
63604
- const bundledPath = path32.resolve(moduleDir, "../docs/README.md");
63605
- if (existsSync21(bundledPath)) {
63606
- return bundledPath;
63607
- }
63608
- return path32.resolve(moduleDir, "../../../../docs/README.md");
64042
+ function usageDocsUrl() {
64043
+ return "https://widget-docs.freelog.cn/cli/";
63609
64044
  }
63610
64045
  var init_usageDocs = __esm({
63611
64046
  "src/core/usageDocs.ts"() {
@@ -63615,11 +64050,11 @@ var init_usageDocs = __esm({
63615
64050
 
63616
64051
  // src/core/packageVersion.ts
63617
64052
  import { readFileSync as readFileSync17 } from "fs";
63618
- import path33 from "path";
63619
- import { fileURLToPath as fileURLToPath2 } from "url";
64053
+ import path32 from "path";
64054
+ import { fileURLToPath } from "url";
63620
64055
  function packageVersion() {
63621
- const moduleDir = path33.dirname(fileURLToPath2(import.meta.url));
63622
- const packageJson = path33.resolve(moduleDir, "../..", "package.json");
64056
+ const moduleDir = path32.dirname(fileURLToPath(import.meta.url));
64057
+ const packageJson = path32.resolve(moduleDir, "../..", "package.json");
63623
64058
  const value = JSON.parse(readFileSync17(packageJson, "utf8"));
63624
64059
  return typeof value.version === "string" ? value.version : "unknown";
63625
64060
  }
@@ -63703,7 +64138,7 @@ function createProgram(options2 = {}) {
63703
64138
  // i18n: cli.flag.cli_version
63704
64139
  "\u6253\u5370 CLI \u7248\u672C"
63705
64140
  ).addHelpText("after", `
63706
- \u4F7F\u7528\u6587\u6863\uFF1A${usageDocsPath()}
64141
+ \u4F7F\u7528\u6587\u6863\uFF1A${usageDocsUrl()}
63707
64142
  `);
63708
64143
  addSharedOptions(program);
63709
64144
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -63833,7 +64268,7 @@ async function runCli(argv, options2 = {}) {
63833
64268
  { writeOut: (v) => frameworkOut.push(v), writeErr: (v) => frameworkErr.push(v) },
63834
64269
  observe2
63835
64270
  );
63836
- await program.parseAsync(argv, { from: options2.from ?? "user" });
64271
+ await withAuthModuleRequests(() => program.parseAsync(argv, { from: options2.from ?? "user" }));
63837
64272
  flushFramework();
63838
64273
  return Number(process.exitCode ?? 0);
63839
64274
  } catch (error3) {
@@ -63874,6 +64309,7 @@ var init_program = __esm({
63874
64309
  init_resolve();
63875
64310
  init_dist();
63876
64311
  init_authModuleHost();
64312
+ init_authModuleRequests();
63877
64313
  init_moduleRegistration();
63878
64314
  }
63879
64315
  });
@@ -63896,19 +64332,8 @@ function isSupportedNodeVersion(value) {
63896
64332
  return true;
63897
64333
  }
63898
64334
 
63899
- // src/platform/os/interactive-terminal.mjs
63900
- function prepareInteractiveTerminal({
63901
- platform = process.platform,
63902
- input: input3 = process.stdin,
63903
- output: output5 = process.stdout,
63904
- env = process.env
63905
- } = {}) {
63906
- if (platform === "win32" && input3.isTTY && output5.isTTY && env.TERM === "dumb") {
63907
- delete env.TERM;
63908
- }
63909
- }
63910
-
63911
64335
  // src/bin/index.ts
64336
+ init_interactive_terminal();
63912
64337
  try {
63913
64338
  if (!isSupportedNodeVersion(process.versions.node)) {
63914
64339
  throw new CliError(