@freelog/cli 0.10.1 → 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.
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/bin/index.js +1217 -801
- package/dist/bin/index.js.map +1 -1
- package/package.json +1 -1
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() {
|
|
@@ -13334,7 +13053,7 @@ var require_src2 = __commonJS({
|
|
|
13334
13053
|
return new createAgent.Agent(callback, opts);
|
|
13335
13054
|
}
|
|
13336
13055
|
(function(createAgent2) {
|
|
13337
|
-
class
|
|
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 =
|
|
13208
|
+
createAgent2.Agent = Agent2;
|
|
13490
13209
|
createAgent2.prototype = createAgent2.Agent.prototype;
|
|
13491
13210
|
})(createAgent || (createAgent = {}));
|
|
13492
13211
|
module.exports = createAgent;
|
|
@@ -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";
|
|
@@ -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
|
|
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 }) {
|
|
@@ -23573,7 +23651,7 @@ function createCodeLoginSession(options2 = {}) {
|
|
|
23573
23651
|
for (const controller of active) controller.abort();
|
|
23574
23652
|
active.clear();
|
|
23575
23653
|
};
|
|
23576
|
-
|
|
23654
|
+
async function request22(config, responseCookies = cookies) {
|
|
23577
23655
|
if (closed) throw new CodeLoginSessionError("LOGIN_SESSION_CLOSED");
|
|
23578
23656
|
const url2 = new URL(config.url ?? "", base);
|
|
23579
23657
|
if (url2.origin !== base.origin || !["GET", "POST"].includes(config.method ?? ""))
|
|
@@ -23605,8 +23683,11 @@ function createCodeLoginSession(options2 = {}) {
|
|
|
23605
23683
|
const separator = pair?.indexOf("=") ?? -1;
|
|
23606
23684
|
if (!pair || separator < 1) continue;
|
|
23607
23685
|
const name = pair.slice(0, separator);
|
|
23608
|
-
if (/;\s*max-age\s*=\s*0\s*(?:;|$)/i.test(item) || pair.slice(separator + 1) === "")
|
|
23609
|
-
|
|
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
|
+
}
|
|
23610
23691
|
}
|
|
23611
23692
|
return result;
|
|
23612
23693
|
};
|
|
@@ -23634,8 +23715,8 @@ function createCodeLoginSession(options2 = {}) {
|
|
|
23634
23715
|
if (timer !== void 0) clearTimeout(timer);
|
|
23635
23716
|
active.delete(controller);
|
|
23636
23717
|
}
|
|
23637
|
-
}
|
|
23638
|
-
const transport = { request: request22 };
|
|
23718
|
+
}
|
|
23719
|
+
const transport = { request: (config) => request22(config) };
|
|
23639
23720
|
return {
|
|
23640
23721
|
lookupUser: (params) => userDetails(params, transport),
|
|
23641
23722
|
getImageCaptcha: async () => {
|
|
@@ -23647,17 +23728,24 @@ function createCodeLoginSession(options2 = {}) {
|
|
|
23647
23728
|
verifyImageCaptcha: (captchaInput) => verifyImageCaptcha({ captchaKey: "login", captchaInput }, transport),
|
|
23648
23729
|
sendCode: (loginName, captchaInput) => sendCodeWithImageCaptcha({ loginName, captchaInput, authCodeType: "login" }, transport),
|
|
23649
23730
|
login: async (loginName, loginCode) => {
|
|
23650
|
-
const
|
|
23651
|
-
const
|
|
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("; ");
|
|
23652
23739
|
return { envelope, ...cookie ? { cookie } : {} };
|
|
23653
23740
|
},
|
|
23654
23741
|
close
|
|
23655
23742
|
};
|
|
23656
23743
|
}
|
|
23657
|
-
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;
|
|
23658
23745
|
var init_node2 = __esm({
|
|
23659
23746
|
"../tools-lib/dist/node.mjs"() {
|
|
23660
23747
|
"use strict";
|
|
23748
|
+
init_axios2();
|
|
23661
23749
|
import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
23662
23750
|
init_axios2();
|
|
23663
23751
|
init_i18next();
|
|
@@ -23669,6 +23757,8 @@ var init_node2 = __esm({
|
|
|
23669
23757
|
__defProp2(target, name, { get: all3[name], enumerable: true });
|
|
23670
23758
|
};
|
|
23671
23759
|
currentPlatform = null;
|
|
23760
|
+
requestProtection = new AsyncLocalStorage();
|
|
23761
|
+
DEFAULT_TIMEOUT_MS = 3e4;
|
|
23672
23762
|
ApiResponseError = class extends Error {
|
|
23673
23763
|
constructor(message, result, errCode) {
|
|
23674
23764
|
super(message);
|
|
@@ -24457,7 +24547,7 @@ var init_node2 = __esm({
|
|
|
24457
24547
|
};
|
|
24458
24548
|
console_catalog_default = {
|
|
24459
24549
|
source: "https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs-test/i18n.json",
|
|
24460
|
-
fetchedAt: "2026-11-
|
|
24550
|
+
fetchedAt: "2026-11-23T02:29:32.696Z",
|
|
24461
24551
|
entryCount: 2999,
|
|
24462
24552
|
sha256: "6aed2fb956f1eeeb4a4693ecc50332e376370d0e4c8a2197dcf888ca3fd2f301",
|
|
24463
24553
|
translations: {
|
|
@@ -37218,6 +37308,7 @@ var init_dist = __esm({
|
|
|
37218
37308
|
});
|
|
37219
37309
|
|
|
37220
37310
|
// src/platform/api.ts
|
|
37311
|
+
var FServiceAPI2;
|
|
37221
37312
|
var init_api = __esm({
|
|
37222
37313
|
"src/platform/api.ts"() {
|
|
37223
37314
|
"use strict";
|
|
@@ -37226,6 +37317,18 @@ var init_api = __esm({
|
|
|
37226
37317
|
init_node2();
|
|
37227
37318
|
init_node2();
|
|
37228
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
|
+
);
|
|
37229
37332
|
}
|
|
37230
37333
|
});
|
|
37231
37334
|
|
|
@@ -37363,6 +37466,7 @@ var init_errorOutcome = __esm({
|
|
|
37363
37466
|
"LOGIN_PHONE_INVALID",
|
|
37364
37467
|
"LOGIN_EMAIL_INVALID",
|
|
37365
37468
|
"NODE_RESOURCE_SELECTOR_UNSUPPORTED",
|
|
37469
|
+
"NODE_PAGE_INVALID",
|
|
37366
37470
|
"EXHIBIT_RESOURCE_SELECTOR_UNSUPPORTED",
|
|
37367
37471
|
"RESOURCE_INFO_TARGET_CONFLICT",
|
|
37368
37472
|
"RESOURCE_INFO_TARGET_REQUIRED",
|
|
@@ -37418,6 +37522,7 @@ var init_errorOutcome = __esm({
|
|
|
37418
37522
|
],
|
|
37419
37523
|
rejected: [
|
|
37420
37524
|
"PLATFORM_REQUEST_REJECTED",
|
|
37525
|
+
"CREATE_REJECTED",
|
|
37421
37526
|
"SUBMIT_FAILED",
|
|
37422
37527
|
"UPDATE_FAILED",
|
|
37423
37528
|
"DESCRIPTION_FAILED",
|
|
@@ -37439,6 +37544,7 @@ var init_errorOutcome = __esm({
|
|
|
37439
37544
|
"EXHIBIT_AUTHORIZATION_REJECTED"
|
|
37440
37545
|
],
|
|
37441
37546
|
result_unknown: [
|
|
37547
|
+
"CREATE_RESULT_UNKNOWN",
|
|
37442
37548
|
"SUBMIT_RESULT_UNKNOWN",
|
|
37443
37549
|
"SUBMIT_VERIFY_FAILED",
|
|
37444
37550
|
"UPDATE_RESULT_UNKNOWN",
|
|
@@ -37618,7 +37724,7 @@ function resolveEnv(input3 = {}) {
|
|
|
37618
37724
|
if (fromProcess !== void 0 && fromProcess !== "") {
|
|
37619
37725
|
return normalizeEnvToken(fromProcess);
|
|
37620
37726
|
}
|
|
37621
|
-
return
|
|
37727
|
+
return DEFAULT_ENV;
|
|
37622
37728
|
}
|
|
37623
37729
|
function applyCliEnv(input3 = {}) {
|
|
37624
37730
|
activeEnv = resolveEnv(input3);
|
|
@@ -37633,12 +37739,13 @@ function assertPlatformAllowed(env = activeEnv) {
|
|
|
37633
37739
|
}
|
|
37634
37740
|
return env;
|
|
37635
37741
|
}
|
|
37636
|
-
var activeEnv;
|
|
37742
|
+
var DEFAULT_ENV, activeEnv;
|
|
37637
37743
|
var init_env = __esm({
|
|
37638
37744
|
"src/domain/env.ts"() {
|
|
37639
37745
|
"use strict";
|
|
37640
37746
|
init_errors();
|
|
37641
|
-
|
|
37747
|
+
DEFAULT_ENV = "dev";
|
|
37748
|
+
activeEnv = DEFAULT_ENV;
|
|
37642
37749
|
}
|
|
37643
37750
|
});
|
|
37644
37751
|
|
|
@@ -38040,7 +38147,7 @@ function addSharedOptions(command) {
|
|
|
38040
38147
|
command,
|
|
38041
38148
|
"--env <env>",
|
|
38042
38149
|
// i18n: cli.flag.env
|
|
38043
|
-
"\u73AF\u5883"
|
|
38150
|
+
"\u73AF\u5883\uFF08\u672A\u6307\u5B9A\u65F6\u8BFB\u53D6 FREELOG_ENV\uFF0C\u65E0\u914D\u7F6E\u65F6\u9ED8\u8BA4 dev\uFF09"
|
|
38044
38151
|
);
|
|
38045
38152
|
command.option(
|
|
38046
38153
|
"--yes",
|
|
@@ -38169,6 +38276,40 @@ var init_passwordInput = __esm({
|
|
|
38169
38276
|
}
|
|
38170
38277
|
});
|
|
38171
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
|
+
|
|
38172
38313
|
// src/domain/account/loginCredentials.ts
|
|
38173
38314
|
import os2 from "os";
|
|
38174
38315
|
import { existsSync as existsSync2 } from "fs";
|
|
@@ -38243,6 +38384,8 @@ function loginFailed() {
|
|
|
38243
38384
|
}
|
|
38244
38385
|
async function loginWithInjectedApi(loginApi, loginName, password2) {
|
|
38245
38386
|
const result = await loginApi({ loginName, password: password2 });
|
|
38387
|
+
const rejection = passwordRejection(result);
|
|
38388
|
+
if (rejection) throw rejection;
|
|
38246
38389
|
return parseLoginCredentials(result, { secrets: [password2], redact: [loginName] });
|
|
38247
38390
|
}
|
|
38248
38391
|
async function loginWithPlatformApi(loginName, password2, timeoutMs) {
|
|
@@ -38266,6 +38409,8 @@ async function loginWithPlatformApi(loginName, password2, timeoutMs) {
|
|
|
38266
38409
|
if (reason) throw new CliError(reason, "LOGIN_FAILED");
|
|
38267
38410
|
throw loginFailed();
|
|
38268
38411
|
}
|
|
38412
|
+
const rejection = response.status === 200 ? passwordRejection(envelope) : void 0;
|
|
38413
|
+
if (rejection) throw rejection;
|
|
38269
38414
|
const credentials = parseLoginCredentials(envelope, messageOptions);
|
|
38270
38415
|
return {
|
|
38271
38416
|
...credentials,
|
|
@@ -38355,6 +38500,7 @@ var init_login = __esm({
|
|
|
38355
38500
|
init_platformError();
|
|
38356
38501
|
init_passwordInput();
|
|
38357
38502
|
init_env();
|
|
38503
|
+
init_loginRejection();
|
|
38358
38504
|
init_loginCredentials();
|
|
38359
38505
|
LOGIN_TIMEOUT_MS = 15e3;
|
|
38360
38506
|
}
|
|
@@ -38455,33 +38601,83 @@ async function request3(operation, messageOptions) {
|
|
|
38455
38601
|
function normalizeCaptcha(value) {
|
|
38456
38602
|
return value.replace(/[\uff01-\uff5e]/gu, (character) => String.fromCharCode(character.charCodeAt(0) - 65248)).replace(/\u3000/gu, " ").trim();
|
|
38457
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
|
+
}
|
|
38458
38669
|
async function loginByCodeAccount(input3) {
|
|
38459
38670
|
const env = assertPlatformAllowed(getEnv2());
|
|
38460
38671
|
assertLoginTargetAvailable(input3);
|
|
38461
|
-
const
|
|
38462
|
-
if (!
|
|
38672
|
+
const initialName = input3.loginName.trim();
|
|
38673
|
+
if (!initialName) throw new CliError("\u8BF7\u63D0\u4F9B --login-name", "LOGIN_NAME_REQUIRED");
|
|
38463
38674
|
let session;
|
|
38464
38675
|
try {
|
|
38465
38676
|
session = await request3(async () => (input3.sessionFactory ?? createCodeLoginSession)());
|
|
38466
38677
|
const currentSession = session;
|
|
38467
|
-
await
|
|
38468
|
-
|
|
38469
|
-
await input3.interaction.showCaptcha(svg);
|
|
38470
|
-
let captchaInput = normalizeCaptcha(await input3.interaction.readCaptcha());
|
|
38471
|
-
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);
|
|
38472
38680
|
try {
|
|
38473
|
-
const verification = await request3(() => currentSession.verifyImageCaptcha(captchaInput), {
|
|
38474
|
-
secrets: [captchaInput],
|
|
38475
|
-
redact: [loginName]
|
|
38476
|
-
});
|
|
38477
|
-
const verified = successfulEnvelope(verification);
|
|
38478
|
-
if (verified?.data !== true) {
|
|
38479
|
-
const reason = codeLoginRejectionMessage(verification, loginName, [captchaInput]);
|
|
38480
|
-
throw new CliError(
|
|
38481
|
-
`${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`,
|
|
38482
|
-
"LOGIN_CAPTCHA_INVALID"
|
|
38483
|
-
);
|
|
38484
|
-
}
|
|
38485
38681
|
const sending = await request3(() => currentSession.sendCode(loginName, captchaInput), {
|
|
38486
38682
|
secrets: [captchaInput],
|
|
38487
38683
|
redact: [loginName]
|
|
@@ -38494,27 +38690,7 @@ async function loginByCodeAccount(input3) {
|
|
|
38494
38690
|
throw new CliError(reason ?? fallback, "LOGIN_CODE_SEND_FAILED");
|
|
38495
38691
|
}
|
|
38496
38692
|
const address = typeof data3?.address === "string" ? data3.address.trim() || void 0 : void 0;
|
|
38497
|
-
|
|
38498
|
-
try {
|
|
38499
|
-
if (!/^\d{6}$/u.test(loginCode)) throw new CliError("\u8BF7\u8F93\u5165\u516D\u4F4D\u6570\u5B57\u9A8C\u8BC1\u7801", "LOGIN_CODE_INVALID");
|
|
38500
|
-
const result = await request3(() => currentSession.login(loginName, loginCode), {
|
|
38501
|
-
secrets: [captchaInput, loginCode],
|
|
38502
|
-
redact: [loginName]
|
|
38503
|
-
});
|
|
38504
|
-
const reason = codeLoginRejectionMessage(result.envelope, loginName, [captchaInput, loginCode]);
|
|
38505
|
-
if (reason) throw new CliError(reason, "LOGIN_FAILED");
|
|
38506
|
-
const credentials = parseLoginCredentials(result.envelope, {
|
|
38507
|
-
secrets: [captchaInput, loginCode],
|
|
38508
|
-
redact: [loginName]
|
|
38509
|
-
});
|
|
38510
|
-
return saveLoginCredentials(
|
|
38511
|
-
input3,
|
|
38512
|
-
{ ...credentials, ...result.cookie ? { cookie: result.cookie } : {} },
|
|
38513
|
-
env
|
|
38514
|
-
);
|
|
38515
|
-
} finally {
|
|
38516
|
-
loginCode = "";
|
|
38517
|
-
}
|
|
38693
|
+
return await authenticateCode(currentSession, input3, loginName, captchaInput, address, env);
|
|
38518
38694
|
} finally {
|
|
38519
38695
|
captchaInput = "";
|
|
38520
38696
|
}
|
|
@@ -38522,6 +38698,7 @@ async function loginByCodeAccount(input3) {
|
|
|
38522
38698
|
session?.close();
|
|
38523
38699
|
}
|
|
38524
38700
|
}
|
|
38701
|
+
var CORRECTABLE_LOGIN_NAMES;
|
|
38525
38702
|
var init_loginByCode = __esm({
|
|
38526
38703
|
"src/domain/account/loginByCode.ts"() {
|
|
38527
38704
|
"use strict";
|
|
@@ -38530,8 +38707,10 @@ var init_loginByCode = __esm({
|
|
|
38530
38707
|
init_platformError();
|
|
38531
38708
|
init_codeLoginMessages();
|
|
38532
38709
|
init_codeLoginName();
|
|
38710
|
+
init_loginRejection();
|
|
38533
38711
|
init_env();
|
|
38534
38712
|
init_loginCredentials();
|
|
38713
|
+
CORRECTABLE_LOGIN_NAMES = /* @__PURE__ */ new Set(["LOGIN_PHONE_INVALID", "LOGIN_EMAIL_INVALID", "LOGIN_ACCOUNT_NOT_FOUND"]);
|
|
38535
38714
|
}
|
|
38536
38715
|
});
|
|
38537
38716
|
|
|
@@ -38673,6 +38852,53 @@ var init_captchaImage = __esm({
|
|
|
38673
38852
|
}
|
|
38674
38853
|
});
|
|
38675
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
|
+
|
|
38676
38902
|
// src/adapters/accountLogin.ts
|
|
38677
38903
|
import { input as input2, password } from "@inquirer/prompts";
|
|
38678
38904
|
import { mkdtemp, open as openFile, unlink, rmdir } from "fs/promises";
|
|
@@ -38683,8 +38909,49 @@ function createCodeLoginInteraction(options2 = {}) {
|
|
|
38683
38909
|
let directory2;
|
|
38684
38910
|
let file3;
|
|
38685
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
|
+
}
|
|
38686
38949
|
const interaction = {
|
|
38687
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
|
+
}
|
|
38688
38955
|
try {
|
|
38689
38956
|
const png = await renderCaptchaImage(svg);
|
|
38690
38957
|
directory2 = await mkdtemp(path3.join(tmpdir(), "freelog-login-captcha-"));
|
|
@@ -38721,65 +38988,35 @@ function createCodeLoginInteraction(options2 = {}) {
|
|
|
38721
38988
|
}
|
|
38722
38989
|
},
|
|
38723
38990
|
async readCaptcha() {
|
|
38724
|
-
return input2
|
|
38725
|
-
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"
|
|
38726
38994
|
});
|
|
38727
38995
|
},
|
|
38728
38996
|
async readCode(address) {
|
|
38729
|
-
|
|
38730
|
-
|
|
38731
|
-
|
|
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, {
|
|
38732
39003
|
message: "\u516D\u4F4D\u9A8C\u8BC1\u7801\uFF08\u8F93\u5165\u663E\u793A\u661F\u53F7\uFF0C\u6309 Enter \u63D0\u4EA4\uFF1BCtrl+C \u53D6\u6D88\uFF09",
|
|
38733
39004
|
mask: "*",
|
|
38734
39005
|
validate: (value) => /^\d{6}$/u.test(value) || "\u8BF7\u8F93\u5165\u516D\u4F4D\u6570\u5B57\u9A8C\u8BC1\u7801"
|
|
38735
39006
|
});
|
|
39007
|
+
},
|
|
39008
|
+
reportRetry(message) {
|
|
39009
|
+
console.error(message);
|
|
38736
39010
|
}
|
|
38737
39011
|
};
|
|
38738
|
-
return {
|
|
38739
|
-
interaction,
|
|
38740
|
-
async dispose() {
|
|
38741
|
-
let failed = false;
|
|
38742
|
-
for (const [target, remove, release] of [
|
|
38743
|
-
[
|
|
38744
|
-
pngFile,
|
|
38745
|
-
unlink,
|
|
38746
|
-
() => {
|
|
38747
|
-
pngFile = void 0;
|
|
38748
|
-
}
|
|
38749
|
-
],
|
|
38750
|
-
[
|
|
38751
|
-
file3,
|
|
38752
|
-
unlink,
|
|
38753
|
-
() => {
|
|
38754
|
-
file3 = void 0;
|
|
38755
|
-
}
|
|
38756
|
-
],
|
|
38757
|
-
[
|
|
38758
|
-
directory2,
|
|
38759
|
-
rmdir,
|
|
38760
|
-
() => {
|
|
38761
|
-
directory2 = void 0;
|
|
38762
|
-
}
|
|
38763
|
-
]
|
|
38764
|
-
]) {
|
|
38765
|
-
if (!target) continue;
|
|
38766
|
-
try {
|
|
38767
|
-
await remove(target);
|
|
38768
|
-
release();
|
|
38769
|
-
} catch (error3) {
|
|
38770
|
-
if (error3?.code === "ENOENT") release();
|
|
38771
|
-
else failed = true;
|
|
38772
|
-
}
|
|
38773
|
-
}
|
|
38774
|
-
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");
|
|
38775
|
-
}
|
|
38776
|
-
};
|
|
39012
|
+
return { interaction, dispose };
|
|
38777
39013
|
}
|
|
38778
39014
|
var init_accountLogin = __esm({
|
|
38779
39015
|
"src/adapters/accountLogin.ts"() {
|
|
38780
39016
|
"use strict";
|
|
38781
39017
|
init_errors();
|
|
38782
39018
|
init_captchaImage();
|
|
39019
|
+
init_terminalInteraction();
|
|
38783
39020
|
}
|
|
38784
39021
|
});
|
|
38785
39022
|
|
|
@@ -38817,11 +39054,20 @@ function createLoginCommand() {
|
|
|
38817
39054
|
);
|
|
38818
39055
|
}
|
|
38819
39056
|
assertLoginTargetAvailable(target);
|
|
38820
|
-
const
|
|
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();
|
|
38821
39062
|
const { interaction, dispose } = createCodeLoginInteraction({ openCaptcha: options2.openCaptcha === true });
|
|
38822
39063
|
try {
|
|
38823
|
-
const
|
|
38824
|
-
|
|
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}`);
|
|
38825
39071
|
} finally {
|
|
38826
39072
|
await dispose();
|
|
38827
39073
|
}
|
|
@@ -38835,19 +39081,39 @@ function createLoginCommand() {
|
|
|
38835
39081
|
throw new CliError("\u975E\u4EA4\u4E92\u767B\u5F55\u8BF7\u4F7F\u7528 --login-name --password-stdin --yes", "LOGIN_NON_TTY_FLAGS");
|
|
38836
39082
|
}
|
|
38837
39083
|
assertLoginTargetAvailable(target);
|
|
38838
|
-
const
|
|
38839
|
-
const
|
|
38840
|
-
|
|
38841
|
-
|
|
38842
|
-
|
|
38843
|
-
|
|
38844
|
-
|
|
38845
|
-
|
|
38846
|
-
|
|
38847
|
-
|
|
38848
|
-
|
|
38849
|
-
|
|
38850
|
-
|
|
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
|
+
}
|
|
38851
39117
|
});
|
|
38852
39118
|
return withCommandExecution(command, { ...WORKSPACE_EXECUTION, pending: "allow" }, {});
|
|
38853
39119
|
}
|
|
@@ -38861,7 +39127,9 @@ var init_login2 = __esm({
|
|
|
38861
39127
|
init_login();
|
|
38862
39128
|
init_loginByCode();
|
|
38863
39129
|
init_loginCredentials();
|
|
39130
|
+
init_loginRejection();
|
|
38864
39131
|
init_accountLogin();
|
|
39132
|
+
init_terminalInteraction();
|
|
38865
39133
|
init_context();
|
|
38866
39134
|
init_env();
|
|
38867
39135
|
}
|
|
@@ -38928,49 +39196,6 @@ var init_logout2 = __esm({
|
|
|
38928
39196
|
}
|
|
38929
39197
|
});
|
|
38930
39198
|
|
|
38931
|
-
// src/adapters/terminalInteraction.ts
|
|
38932
|
-
async function terminalQuestion(question) {
|
|
38933
|
-
try {
|
|
38934
|
-
return await question();
|
|
38935
|
-
} catch (error3) {
|
|
38936
|
-
if (error3 instanceof Error && ["ExitPromptError", "AbortPromptError"].includes(error3.name))
|
|
38937
|
-
throw new CliError("\u5DF2\u53D6\u6D88\u64CD\u4F5C", "CANCELLED");
|
|
38938
|
-
throw error3;
|
|
38939
|
-
}
|
|
38940
|
-
}
|
|
38941
|
-
var terminalPrompts, terminalReporter;
|
|
38942
|
-
var init_terminalInteraction = __esm({
|
|
38943
|
-
"src/adapters/terminalInteraction.ts"() {
|
|
38944
|
-
"use strict";
|
|
38945
|
-
init_tty();
|
|
38946
|
-
init_errors();
|
|
38947
|
-
terminalPrompts = Object.freeze({
|
|
38948
|
-
isInteractive: () => isInteractive(),
|
|
38949
|
-
askInput: (message, channel) => terminalQuestion(
|
|
38950
|
-
() => channel ? askInput(message, channel === "stderr" ? process.stderr : process.stdout) : askInput(message)
|
|
38951
|
-
),
|
|
38952
|
-
selectQuestion: (message, choices, channel) => terminalQuestion(
|
|
38953
|
-
() => channel ? selectQuestion(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectQuestion(message, [...choices])
|
|
38954
|
-
),
|
|
38955
|
-
selectMany: (message, choices, channel) => terminalQuestion(
|
|
38956
|
-
() => channel ? selectMany(message, [...choices], channel === "stderr" ? process.stderr : process.stdout) : selectMany(message, [...choices])
|
|
38957
|
-
),
|
|
38958
|
-
confirmQuestion: (message, defaultYes, channel) => terminalQuestion(
|
|
38959
|
-
() => channel ? confirmQuestion(message, defaultYes, channel === "stderr" ? process.stderr : process.stdout) : confirmQuestion(message, defaultYes)
|
|
38960
|
-
),
|
|
38961
|
-
confirmWrite: (preview2, yes, channel) => terminalQuestion(
|
|
38962
|
-
() => channel ? confirmWrite(preview2, yes, channel === "stderr" ? process.stderr : process.stdout) : confirmWrite(preview2, yes)
|
|
38963
|
-
),
|
|
38964
|
-
confirmDestructive: (...args) => terminalQuestion(() => confirmDestructive(...args))
|
|
38965
|
-
});
|
|
38966
|
-
terminalReporter = Object.freeze({
|
|
38967
|
-
log: (message) => console.log(message),
|
|
38968
|
-
warn: (message) => console.warn(message),
|
|
38969
|
-
error: (message) => console.error(message)
|
|
38970
|
-
});
|
|
38971
|
-
}
|
|
38972
|
-
});
|
|
38973
|
-
|
|
38974
39199
|
// src/platform/readRequest.ts
|
|
38975
39200
|
function throwPlatformReadError(error3, fallback, notFound) {
|
|
38976
39201
|
if (error3 instanceof CliError) throw error3;
|
|
@@ -39072,7 +39297,7 @@ function flattenLeaves(nodes2, ancestors = [], acc = []) {
|
|
|
39072
39297
|
}
|
|
39073
39298
|
async function resourceTypeTree(apis2) {
|
|
39074
39299
|
assertPlatformAllowed();
|
|
39075
|
-
const request5 = apis2.resourceTypes ?? ((params) =>
|
|
39300
|
+
const request5 = apis2.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
|
|
39076
39301
|
return unwrapList(await readType(() => request5({ category: 1, status: 1, subjectType: 1 })));
|
|
39077
39302
|
}
|
|
39078
39303
|
function findTypePath(nodes2, code2, ancestors = []) {
|
|
@@ -39102,7 +39327,7 @@ async function listLeafTypes(apis2 = {}) {
|
|
|
39102
39327
|
}
|
|
39103
39328
|
async function searchLeafTypes(keyword, apis2 = {}) {
|
|
39104
39329
|
assertPlatformAllowed();
|
|
39105
|
-
const request5 = apis2.searchLeaves ?? ((params) =>
|
|
39330
|
+
const request5 = apis2.searchLeaves ?? ((params) => FServiceAPI2.Resource.ListSimpleByParentCode(params));
|
|
39106
39331
|
const [tree, response] = await Promise.all([
|
|
39107
39332
|
resourceTypeTree(apis2),
|
|
39108
39333
|
readType(
|
|
@@ -39136,7 +39361,7 @@ async function getTypeInfo(code2, apis2 = {}) {
|
|
|
39136
39361
|
throw new CliError("\u8BF7\u63D0\u4F9B\u8D44\u6E90\u7C7B\u578B\u7F16\u53F7", "TYPE_CODE_REQUIRED");
|
|
39137
39362
|
}
|
|
39138
39363
|
assertPlatformAllowed();
|
|
39139
|
-
const request5 = apis2.getByCode ?? ((params) =>
|
|
39364
|
+
const request5 = apis2.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params));
|
|
39140
39365
|
const rawInfo = unwrapOne(await readType(() => request5({ code: normalized })));
|
|
39141
39366
|
const info2 = rawInfo ? normalizeTypeInfo(rawInfo) : void 0;
|
|
39142
39367
|
if (!info2?.code || info2.code !== normalized) {
|
|
@@ -39435,7 +39660,7 @@ var init_transaction = __esm({
|
|
|
39435
39660
|
});
|
|
39436
39661
|
|
|
39437
39662
|
// src/local/lock.ts
|
|
39438
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
39663
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
39439
39664
|
import {
|
|
39440
39665
|
realpathSync,
|
|
39441
39666
|
closeSync,
|
|
@@ -39628,7 +39853,7 @@ var init_lock = __esm({
|
|
|
39628
39853
|
init_errors();
|
|
39629
39854
|
init_statePaths();
|
|
39630
39855
|
init_transaction();
|
|
39631
|
-
lockContext = new
|
|
39856
|
+
lockContext = new AsyncLocalStorage2();
|
|
39632
39857
|
}
|
|
39633
39858
|
});
|
|
39634
39859
|
|
|
@@ -40521,7 +40746,7 @@ function storageHash(v) {
|
|
|
40521
40746
|
return createHash4("sha256").update(JSON.stringify(v)).digest("hex");
|
|
40522
40747
|
}
|
|
40523
40748
|
function apiFor(i, key2) {
|
|
40524
|
-
return i.apis?.[key2] ?? ((p) => key2 === "getResourceBySha1" ?
|
|
40749
|
+
return i.apis?.[key2] ?? ((p) => key2 === "getResourceBySha1" ? FServiceAPI2.Resource.getResourceBySha1(p) : FServiceAPI2.Storage[key2](p));
|
|
40525
40750
|
}
|
|
40526
40751
|
async function storageRead(i, key2, p = {}) {
|
|
40527
40752
|
try {
|
|
@@ -40679,7 +40904,7 @@ async function readFileUsage(input3) {
|
|
|
40679
40904
|
let response;
|
|
40680
40905
|
try {
|
|
40681
40906
|
response = await withStorageTimeout(
|
|
40682
|
-
() => (input3.query ?? ((params) =>
|
|
40907
|
+
() => (input3.query ?? ((params) => FServiceAPI2.Resource.getResourceBySha1(params, {
|
|
40683
40908
|
timeout: 3e4,
|
|
40684
40909
|
signal: AbortSignal.timeout(3e4)
|
|
40685
40910
|
})))({ fileSha1: input3.sha1 }),
|
|
@@ -40743,7 +40968,7 @@ async function readStorageObjectSnapshot(input3) {
|
|
|
40743
40968
|
if (!input3.objectId || !/^[A-Za-z0-9_-]+$/u.test(input3.objectId))
|
|
40744
40969
|
throw new CliError("\u8BF7\u63D0\u4F9B\u7CBE\u786E\u5B58\u50A8\u5BF9\u8C61ID", "STORAGE_SOURCE_ID_INVALID");
|
|
40745
40970
|
const raw = await read(
|
|
40746
|
-
input3.apis?.objectDetails ?? ((p) =>
|
|
40971
|
+
input3.apis?.objectDetails ?? ((p) => FServiceAPI2.Storage.objectDetails(p, readControls())),
|
|
40747
40972
|
{
|
|
40748
40973
|
objectIdOrName: input3.objectId
|
|
40749
40974
|
}
|
|
@@ -40752,7 +40977,7 @@ async function readStorageObjectSnapshot(input3) {
|
|
|
40752
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))
|
|
40753
40978
|
throw new CliError("\u5BF9\u8C61\u4E0D\u5B58\u5728\u3001\u975E\u672C\u4EBA\u6216\u6587\u4EF6\u8EAB\u4EFD\u4E0D\u5B8C\u6574", "STORAGE_SOURCE_INVALID");
|
|
40754
40979
|
const bucket = await read(
|
|
40755
|
-
input3.apis?.bucketDetails ?? ((p) =>
|
|
40980
|
+
input3.apis?.bucketDetails ?? ((p) => FServiceAPI2.Storage.bucketDetails(p, readControls())),
|
|
40756
40981
|
{
|
|
40757
40982
|
bucketName: raw.bucketName
|
|
40758
40983
|
}
|
|
@@ -40781,7 +41006,7 @@ async function loadStorageSource(input3) {
|
|
|
40781
41006
|
sha1: snapshot2.source.sha1,
|
|
40782
41007
|
userId: snapshot2.source.ownerUserId,
|
|
40783
41008
|
resourceId: input3.resourceId,
|
|
40784
|
-
query: input3.apis?.getResourceBySha1 ?? ((p) =>
|
|
41009
|
+
query: input3.apis?.getResourceBySha1 ?? ((p) => FServiceAPI2.Resource.getResourceBySha1(p, readControls()))
|
|
40785
41010
|
});
|
|
40786
41011
|
} catch (error3) {
|
|
40787
41012
|
if (error3 instanceof CliError && error3.code === "FILE_USAGE_READ_FAILED")
|
|
@@ -40966,23 +41191,20 @@ var init_zip = __esm({
|
|
|
40966
41191
|
|
|
40967
41192
|
// src/domain/resource/create.ts
|
|
40968
41193
|
import path12 from "path";
|
|
40969
|
-
function
|
|
40970
|
-
|
|
40971
|
-
const data3 = Object.hasOwn(envelope, "data") ? envelope.data : result;
|
|
40972
|
-
if (allowNull && data3 === null) return {};
|
|
40973
|
-
if (data3 === null || typeof data3 !== "object" || Array.isArray(data3)) throw new CliError(message, code2);
|
|
40974
|
-
return data3;
|
|
41194
|
+
function validResourceId(value) {
|
|
41195
|
+
return typeof value === "string" && value === value.trim() && /^[a-z\d_-]+$/iu.test(value) && !/^(?:undefined|null)$/iu.test(value);
|
|
40975
41196
|
}
|
|
40976
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";
|
|
40977
41200
|
try {
|
|
40978
41201
|
const response = await infoApi2(params);
|
|
40979
|
-
assertSuccessfulResponse(response,
|
|
40980
|
-
|
|
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);
|
|
40981
41206
|
} catch (error3) {
|
|
40982
|
-
throwPlatformReadError(error3, {
|
|
40983
|
-
code: "CREATE_LOOKUP_FAILED",
|
|
40984
|
-
message: "\u67E5\u8BE2\u73B0\u6709\u8D44\u6E90\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u767B\u5F55\u548C\u7F51\u7EDC\u540E\u91CD\u8BD5"
|
|
40985
|
-
});
|
|
41207
|
+
throwPlatformReadError(error3, { code: code2, message });
|
|
40986
41208
|
}
|
|
40987
41209
|
}
|
|
40988
41210
|
function normalizeResourceName(raw) {
|
|
@@ -41032,14 +41254,12 @@ function resolveTargetIdentity(input3) {
|
|
|
41032
41254
|
return void 0;
|
|
41033
41255
|
}
|
|
41034
41256
|
async function assertOwnShellAvailable(input3) {
|
|
41035
|
-
const infoApi2 = input3.infoApi ?? ((params) =>
|
|
41257
|
+
const infoApi2 = input3.infoApi ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
41036
41258
|
const existing = await lookupResource(infoApi2, {
|
|
41037
41259
|
resourceIdOrName: `${input3.authLoginName}/${input3.name}`,
|
|
41038
41260
|
isLoadLatestVersionInfo: 1
|
|
41039
41261
|
});
|
|
41040
|
-
if (
|
|
41041
|
-
return;
|
|
41042
|
-
}
|
|
41262
|
+
if (existing === null) return;
|
|
41043
41263
|
const ownerId = existing.userId ?? existing.ownerId ?? existing.creatorId;
|
|
41044
41264
|
if (ownerId !== input3.authUserId) {
|
|
41045
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");
|
|
@@ -41049,6 +41269,34 @@ async function assertOwnShellAvailable(input3) {
|
|
|
41049
41269
|
"CREATE_OWN_SHELL"
|
|
41050
41270
|
);
|
|
41051
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
|
+
}
|
|
41052
41300
|
function writeCreatedIdentity(input3) {
|
|
41053
41301
|
const filePath = input3.file ?? input3.target?.filePath;
|
|
41054
41302
|
if (!filePath && !input3.storageSource && !input3.target?.storageSource)
|
|
@@ -41068,11 +41316,16 @@ function writeCreatedIdentity(input3) {
|
|
|
41068
41316
|
});
|
|
41069
41317
|
}
|
|
41070
41318
|
async function createResource(input3) {
|
|
41071
|
-
assertPlatformAllowed();
|
|
41319
|
+
const env = assertPlatformAllowed();
|
|
41072
41320
|
if (input3.file !== void 0 && input3.storageObject !== void 0)
|
|
41073
41321
|
throw new CliError("--artifact \u4E0E --storage-object \u4E92\u65A5", "ARTIFACT_SOURCE_CONFLICT");
|
|
41074
41322
|
assertResourceSelectorValue(input3.selector);
|
|
41075
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
|
+
};
|
|
41076
41329
|
const prompts = input3.prompts ?? headlessPrompts;
|
|
41077
41330
|
const reporter = input3.reporter ?? silentReporter;
|
|
41078
41331
|
const interactive = !input3.yes && prompts.isInteractive();
|
|
@@ -41085,6 +41338,7 @@ async function createResource(input3) {
|
|
|
41085
41338
|
code: "CREATE_FILE_OUTSIDE",
|
|
41086
41339
|
message: "--artifact \u5FC5\u987B\u843D\u5728\u5F53\u524D\u5DE5\u7A0B\u91CC"
|
|
41087
41340
|
}) : void 0;
|
|
41341
|
+
let submissionError;
|
|
41088
41342
|
return withProjectLock(input3.cwd, async () => {
|
|
41089
41343
|
const identities = validateLocalState(input3.cwd);
|
|
41090
41344
|
const target = resolveTargetIdentity({
|
|
@@ -41193,27 +41447,28 @@ async function createResource(input3) {
|
|
|
41193
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");
|
|
41194
41448
|
}
|
|
41195
41449
|
if (artifact) assertArtifactAnchor(typeCode, path12.resolve(input3.cwd, artifact), input3.cwd);
|
|
41196
|
-
|
|
41197
|
-
const
|
|
41198
|
-
|
|
41199
|
-
resourceTitle: title,
|
|
41200
|
-
|
|
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;
|
|
41201
41460
|
});
|
|
41202
|
-
|
|
41203
|
-
|
|
41204
|
-
|
|
41205
|
-
"CREATE_FAILED",
|
|
41206
|
-
"\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"
|
|
41207
41464
|
);
|
|
41208
|
-
|
|
41209
|
-
if (
|
|
41210
|
-
|
|
41211
|
-
}
|
|
41212
|
-
const record21 = writeCreatedIdentity({
|
|
41465
|
+
assertOriginalAccount();
|
|
41466
|
+
if (JSON.stringify(validateLocalState(input3.cwd)) !== JSON.stringify(identities)) throw submissionError;
|
|
41467
|
+
return writeCreatedIdentity({
|
|
41213
41468
|
cwd: input3.cwd,
|
|
41214
|
-
env
|
|
41469
|
+
env,
|
|
41215
41470
|
name,
|
|
41216
|
-
resourceName
|
|
41471
|
+
resourceName,
|
|
41217
41472
|
typeCode,
|
|
41218
41473
|
resourceId,
|
|
41219
41474
|
title,
|
|
@@ -41221,7 +41476,8 @@ async function createResource(input3) {
|
|
|
41221
41476
|
storageSource,
|
|
41222
41477
|
target
|
|
41223
41478
|
});
|
|
41224
|
-
|
|
41479
|
+
}).catch((error3) => {
|
|
41480
|
+
throw submissionError ?? error3;
|
|
41225
41481
|
});
|
|
41226
41482
|
}
|
|
41227
41483
|
var init_create = __esm({
|
|
@@ -41236,7 +41492,9 @@ var init_create = __esm({
|
|
|
41236
41492
|
init_requireAuth();
|
|
41237
41493
|
init_env();
|
|
41238
41494
|
init_api();
|
|
41495
|
+
init_platformError();
|
|
41239
41496
|
init_unwrap();
|
|
41497
|
+
init_response();
|
|
41240
41498
|
init_service();
|
|
41241
41499
|
init_lock();
|
|
41242
41500
|
init_projectPath();
|
|
@@ -41354,7 +41612,7 @@ function isLeaf(node2) {
|
|
|
41354
41612
|
}
|
|
41355
41613
|
async function readCollectionTypeTree(apis2) {
|
|
41356
41614
|
assertPlatformAllowed();
|
|
41357
|
-
const request5 = apis2.resourceTypes ?? ((params) =>
|
|
41615
|
+
const request5 = apis2.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
|
|
41358
41616
|
const nodes2 = unwrapList2(await readType2(() => request5({ category: 1, status: 1, subjectType: 4 })));
|
|
41359
41617
|
assertTree(nodes2);
|
|
41360
41618
|
return nodes2;
|
|
@@ -41374,7 +41632,7 @@ async function getCollectionTypeInfo(code2, apis2 = {}) {
|
|
|
41374
41632
|
const normalized = code2.trim();
|
|
41375
41633
|
if (!normalized) throw new CliError("\u8BF7\u63D0\u4F9B\u5408\u96C6\u7C7B\u578B\u7F16\u53F7", "COLLECTION_TYPE_REQUIRED");
|
|
41376
41634
|
assertPlatformAllowed();
|
|
41377
|
-
const request5 = apis2.getByCode ?? ((params) =>
|
|
41635
|
+
const request5 = apis2.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params));
|
|
41378
41636
|
const [nodes2, raw] = await Promise.all([readCollectionTypeTree(apis2), readType2(() => request5({ code: normalized }))]);
|
|
41379
41637
|
const info2 = unwrapOne2(raw);
|
|
41380
41638
|
if (!info2?.code || info2.code !== normalized) {
|
|
@@ -41393,7 +41651,7 @@ function label(path33) {
|
|
|
41393
41651
|
}
|
|
41394
41652
|
async function searchCollectionTypeLeaves(keyword, apis2) {
|
|
41395
41653
|
assertPlatformAllowed();
|
|
41396
|
-
const request5 = apis2.searchLeaves ?? ((params) =>
|
|
41654
|
+
const request5 = apis2.searchLeaves ?? ((params) => FServiceAPI2.Resource.ListSimpleByParentCode(params));
|
|
41397
41655
|
const [nodes2, response] = await Promise.all([
|
|
41398
41656
|
readCollectionTypeTree(apis2),
|
|
41399
41657
|
readType2(() => request5({ category: 1, nameChain: keyword, isTerminate: true, status: 1, subjectType: 4 }))
|
|
@@ -41475,7 +41733,7 @@ var init_typePicker = __esm({
|
|
|
41475
41733
|
function record5(value) {
|
|
41476
41734
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
41477
41735
|
}
|
|
41478
|
-
function
|
|
41736
|
+
function validResourceId2(value) {
|
|
41479
41737
|
return typeof value === "string" && value.trim() === value && /^[a-zA-Z0-9_.-]+$/u.test(value) && value !== "." && value !== "..";
|
|
41480
41738
|
}
|
|
41481
41739
|
function normalizeCollectionName(raw) {
|
|
@@ -41533,7 +41791,7 @@ async function assertNameAvailable(input3) {
|
|
|
41533
41791
|
}
|
|
41534
41792
|
if (response.data === null) return;
|
|
41535
41793
|
const existing = response.data;
|
|
41536
|
-
if (!record5(existing) || !
|
|
41794
|
+
if (!record5(existing) || !validResourceId2(existing.resourceId) || existing.resourceName !== resourceName || !Number.isSafeInteger(existing.userId) || Number(existing.userId) <= 0) {
|
|
41537
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");
|
|
41538
41796
|
}
|
|
41539
41797
|
const values = Array.isArray(existing.subjectType) ? existing.subjectType : [existing.subjectType];
|
|
@@ -41550,7 +41808,7 @@ async function createCollection(input3) {
|
|
|
41550
41808
|
const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
41551
41809
|
const apis2 = input3.apis ?? {};
|
|
41552
41810
|
const selected = await chooseInputs({ ...input3, apis: apis2 });
|
|
41553
|
-
const info2 = apis2.info ?? ((params) =>
|
|
41811
|
+
const info2 = apis2.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
41554
41812
|
await assertNameAvailable({ loginName: auth.loginName, userId: auth.userId, name: selected.name, info: info2 });
|
|
41555
41813
|
await (input3.prompts ?? headlessPrompts).confirmWrite(
|
|
41556
41814
|
`\u521B\u5EFA\u5408\u96C6
|
|
@@ -41559,7 +41817,7 @@ async function createCollection(input3) {
|
|
|
41559
41817
|
\u6388\u6743\u6807\u8BC6\uFF1A${auth.loginName}/${selected.name}`,
|
|
41560
41818
|
input3.yes
|
|
41561
41819
|
);
|
|
41562
|
-
const create3 = apis2.create ?? ((params) =>
|
|
41820
|
+
const create3 = apis2.create ?? ((params) => FServiceAPI2.Resource.create(params));
|
|
41563
41821
|
const resourceName = `${auth.loginName}/${selected.name}`;
|
|
41564
41822
|
const unknownResult3 = (error3) => {
|
|
41565
41823
|
const reason = platformFailureMessage(error3, "");
|
|
@@ -41588,7 +41846,7 @@ async function createCollection(input3) {
|
|
|
41588
41846
|
throw unknownResult3();
|
|
41589
41847
|
}
|
|
41590
41848
|
const created = response.data;
|
|
41591
|
-
if (!
|
|
41849
|
+
if (!validResourceId2(created.resourceId) || created.resourceName !== resourceName || created.resourceTypeCode !== selected.typeCode) {
|
|
41592
41850
|
throw unknownResult3();
|
|
41593
41851
|
}
|
|
41594
41852
|
try {
|
|
@@ -41728,7 +41986,7 @@ function parseSelector2(selector) {
|
|
|
41728
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");
|
|
41729
41987
|
}
|
|
41730
41988
|
async function chooseOnline(userId, apis2, prompts = headlessPrompts) {
|
|
41731
|
-
const list2 = apis2?.listCollections ?? ((params) =>
|
|
41989
|
+
const list2 = apis2?.listCollections ?? ((params) => FServiceAPI2.Resource.list(params));
|
|
41732
41990
|
const pages = /* @__PURE__ */ new Map();
|
|
41733
41991
|
const ids = /* @__PURE__ */ new Set();
|
|
41734
41992
|
let total;
|
|
@@ -41820,7 +42078,7 @@ async function resolveCollectionTarget(input3) {
|
|
|
41820
42078
|
const resourceIdOrName = local?.resourceId ?? (selector?.kind !== "file" ? selector?.value : void 0);
|
|
41821
42079
|
if (!resourceIdOrName) throw new CliError("\u5408\u96C6\u9009\u62E9\u5668\u65E0\u6548", "COLLECTION_SELECTOR_INVALID");
|
|
41822
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");
|
|
41823
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
42081
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
41824
42082
|
const remote = dataObject(
|
|
41825
42083
|
await readPlatformResult(
|
|
41826
42084
|
info2,
|
|
@@ -42760,7 +43018,7 @@ async function querySubjectContracts(input3) {
|
|
|
42760
43018
|
}
|
|
42761
43019
|
let raw;
|
|
42762
43020
|
try {
|
|
42763
|
-
raw = await (input3.query ?? ((params) =>
|
|
43021
|
+
raw = await (input3.query ?? ((params) => FServiceAPI2.Contract.batchContracts(params)))({
|
|
42764
43022
|
subjectIds: [...requested.keys()].join(","),
|
|
42765
43023
|
licenseeId: input3.licensee.id,
|
|
42766
43024
|
licenseeIdentityType: input3.licensee.type,
|
|
@@ -42900,7 +43158,7 @@ async function planCollectionItemSigning(input3) {
|
|
|
42900
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");
|
|
42901
43159
|
selections.set(parts[0], parts[1]);
|
|
42902
43160
|
}
|
|
42903
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
43161
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
42904
43162
|
const subjects = await readContractSubjects(upstreamIds, info2);
|
|
42905
43163
|
const assertSubjects = () => assertContractSubjectsUnchanged(subjects, info2);
|
|
42906
43164
|
const readContracts = () => upstreamIds.length ? querySubjectContracts({
|
|
@@ -43403,8 +43661,8 @@ async function compileRules(rules, loginName, apis2) {
|
|
|
43403
43661
|
);
|
|
43404
43662
|
}
|
|
43405
43663
|
async function assertNoManualDraftDifference(resourceId, apis2) {
|
|
43406
|
-
const published = apis2.getPublishedItems ?? ((params) =>
|
|
43407
|
-
const draft = apis2.getDraftItems ?? ((params) =>
|
|
43664
|
+
const published = apis2.getPublishedItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems(params));
|
|
43665
|
+
const draft = apis2.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
|
|
43408
43666
|
const [publishedItems, draftItems] = await Promise.all([
|
|
43409
43667
|
readCollectionCatalogue(resourceId, published),
|
|
43410
43668
|
readCollectionCatalogue(resourceId, draft)
|
|
@@ -43419,7 +43677,7 @@ function sameState(left, right) {
|
|
|
43419
43677
|
async function getCollectionCollectRules2(input3) {
|
|
43420
43678
|
assertPlatformAllowed();
|
|
43421
43679
|
const target = await resolveCollectionTarget(input3);
|
|
43422
|
-
const getRules = input3.apis?.getRules ?? ((params) =>
|
|
43680
|
+
const getRules = input3.apis?.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
|
|
43423
43681
|
return asState(await getRules({ resourceId: target.resourceId }), target.info.serializeStatus);
|
|
43424
43682
|
}
|
|
43425
43683
|
async function setCollectionCollectRulesUnlocked(input3) {
|
|
@@ -43438,7 +43696,7 @@ async function setCollectionCollectRulesUnlocked(input3) {
|
|
|
43438
43696
|
assertCollectionWriteTarget(input3, anchor);
|
|
43439
43697
|
const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
43440
43698
|
const apis2 = input3.apis ?? {};
|
|
43441
|
-
const getRules = apis2.getRules ?? ((params) =>
|
|
43699
|
+
const getRules = apis2.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
|
|
43442
43700
|
const current2 = asState(await getRules({ resourceId: target.resourceId }), target.info.serializeStatus);
|
|
43443
43701
|
if (current2.serializeStatus === 1 && input3.serialize !== "serial" && (input3.auto === "all" || input3.auto === "any"))
|
|
43444
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");
|
|
@@ -43474,7 +43732,7 @@ async function setCollectionCollectRulesUnlocked(input3) {
|
|
|
43474
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");
|
|
43475
43733
|
}
|
|
43476
43734
|
assertCollectionWriteTarget(input3, anchor);
|
|
43477
|
-
const setRules = apis2.setRules ?? ((params) =>
|
|
43735
|
+
const setRules = apis2.setRules ?? ((params) => FServiceAPI2.Resource.setCollectRules(params));
|
|
43478
43736
|
const unconfirmed = (error3) => {
|
|
43479
43737
|
const reason = platformFailureMessage(error3, "");
|
|
43480
43738
|
return new CliError(
|
|
@@ -43548,7 +43806,7 @@ async function assertCollectionManualWritable(target, apis2) {
|
|
|
43548
43806
|
if (target.info.status === 2) throw new CliError("\u51BB\u7ED3\u5408\u96C6\u4E0D\u80FD\u4FEE\u6539\u76EE\u5F55\u8349\u7A3F", "COLLECTION_FROZEN");
|
|
43549
43807
|
if (target.info.rssSource === "yes" || typeof target.info.feedUrl === "string" && target.info.feedUrl.trim())
|
|
43550
43808
|
throw new CliError("RSS \u5408\u96C6\u4E0D\u80FD\u624B\u5DE5\u4FEE\u6539\u76EE\u5F55", "COLLECTION_RSS_READONLY");
|
|
43551
|
-
const getRules = apis2?.getRules ?? ((params) =>
|
|
43809
|
+
const getRules = apis2?.getRules ?? ((params) => FServiceAPI2.Resource.getCollectionCollectRules(params));
|
|
43552
43810
|
const rules = parseCollectionCollectRules(await getRules({ resourceId: target.resourceId }));
|
|
43553
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");
|
|
43554
43812
|
}
|
|
@@ -43568,12 +43826,12 @@ async function readCollectionItemAuthorization(input3) {
|
|
|
43568
43826
|
const target = await resolveCollectionTarget(input3);
|
|
43569
43827
|
const catalogue = await readCollectionCatalogue(
|
|
43570
43828
|
target.resourceId,
|
|
43571
|
-
input3.apis?.getDraftItems ?? ((params) =>
|
|
43829
|
+
input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
|
|
43572
43830
|
);
|
|
43573
43831
|
const item = catalogue.find((row) => row.itemId === input3.itemId);
|
|
43574
43832
|
if (!item || !isContractId(item.resourceId)) throw new CliError("\u76EE\u5F55\u8349\u7A3F\u6CA1\u6709\u8BE5\u5355\u54C1", "COLLECTION_ITEM_NOT_FOUND");
|
|
43575
43833
|
const detail2 = contractResponseData(
|
|
43576
|
-
await (input3.apis?.getItemDetail ?? ((params) =>
|
|
43834
|
+
await (input3.apis?.getItemDetail ?? ((params) => FServiceAPI2.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: input3.itemId })
|
|
43577
43835
|
);
|
|
43578
43836
|
if (!object3(detail2) || detail2.itemId !== item.itemId || !Array.isArray(detail2.resolveResourceContracts))
|
|
43579
43837
|
throw invalid4();
|
|
@@ -43583,7 +43841,7 @@ async function readCollectionItemAuthorization(input3) {
|
|
|
43583
43841
|
ids.push(row.resourceId);
|
|
43584
43842
|
}
|
|
43585
43843
|
if (!ids.includes(item.resourceId)) throw invalid4();
|
|
43586
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
43844
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
43587
43845
|
const sourceResponse = await info2({ resourceIdOrName: item.resourceId, isLoadLatestVersionInfo: 1 });
|
|
43588
43846
|
const rootSubject = contractSubjectFromInfo(sourceResponse, item.resourceId);
|
|
43589
43847
|
if (rootSubject.type !== 1) throw invalid4();
|
|
@@ -43662,7 +43920,7 @@ async function applyCollectionItemContract(input3) {
|
|
|
43662
43920
|
throw new CliError("\u786E\u8BA4\u671F\u95F4\u5355\u54C1\u6216\u5408\u540C\u5DF2\u53D8\u5316", "COLLECTION_ITEM_CATALOGUE_CHANGED");
|
|
43663
43921
|
await assertContractSubjectsUnchanged(
|
|
43664
43922
|
before.subjects,
|
|
43665
|
-
input3.apis?.info ?? ((params) =>
|
|
43923
|
+
input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
43666
43924
|
);
|
|
43667
43925
|
assertCollectionOperationActor(input3, initialScope);
|
|
43668
43926
|
const body = {
|
|
@@ -43695,12 +43953,15 @@ async function applyCollectionItemContract(input3) {
|
|
|
43695
43953
|
}
|
|
43696
43954
|
});
|
|
43697
43955
|
operation = markRemoteOperationSending(scope, operation);
|
|
43698
|
-
const unknown2 = () =>
|
|
43699
|
-
|
|
43700
|
-
|
|
43701
|
-
|
|
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
|
+
};
|
|
43702
43963
|
try {
|
|
43703
|
-
const response = await (input3.apis?.setItemAuthorization ?? ((params) =>
|
|
43964
|
+
const response = await (input3.apis?.setItemAuthorization ?? ((params) => FServiceAPI2.Resource.batchSetCollectionItemAuthorization_Draft(params)))(body);
|
|
43704
43965
|
const outcome = classifyApiResponse(response);
|
|
43705
43966
|
if (outcome.kind === "rejected") {
|
|
43706
43967
|
operation = markRemoteOperationRejected(scope, operation, {
|
|
@@ -43723,13 +43984,13 @@ async function applyCollectionItemContract(input3) {
|
|
|
43723
43984
|
"COLLECTION_ITEM_AUTH_REJECTED"
|
|
43724
43985
|
);
|
|
43725
43986
|
}
|
|
43726
|
-
throw unknown2();
|
|
43987
|
+
throw unknown2(error3);
|
|
43727
43988
|
}
|
|
43728
43989
|
try {
|
|
43729
43990
|
const after = await readCollectionItemAuthorization(input3);
|
|
43730
43991
|
await assertContractSubjectsUnchanged(
|
|
43731
43992
|
before.subjects,
|
|
43732
|
-
input3.apis?.info ?? ((params) =>
|
|
43993
|
+
input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
43733
43994
|
);
|
|
43734
43995
|
assertCollectionOperationActor(input3, scope);
|
|
43735
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))
|
|
@@ -43805,7 +44066,7 @@ async function recoverCollectionItemOperation(input3) {
|
|
|
43805
44066
|
let confirmed = false;
|
|
43806
44067
|
if (op.kind === "collection-item-sign" && op.contractPlan?.context.kind === "collection-item") {
|
|
43807
44068
|
const expected = { id: op.sourceId, type: op.contractPlan.subjectType };
|
|
43808
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
44069
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
43809
44070
|
const [actual] = await readContractSubjects([op.sourceId], info2);
|
|
43810
44071
|
const revalidate = async () => {
|
|
43811
44072
|
const current2 = await resolveCollectionTarget({ ...input3, selector: `id:${target.resourceId}` });
|
|
@@ -43834,7 +44095,7 @@ async function recoverCollectionItemOperation(input3) {
|
|
|
43834
44095
|
const current2 = await readCollectionItemAuthorization({ ...input3, itemId: context5.itemId });
|
|
43835
44096
|
await assertContractSubjectsUnchanged(
|
|
43836
44097
|
current2.subjects,
|
|
43837
|
-
input3.apis?.info ?? ((params) =>
|
|
44098
|
+
input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
43838
44099
|
);
|
|
43839
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));
|
|
43840
44101
|
} else if (op.kind === "collection-item-add") confirmed = await verifyCollectionItemAdd(input3, record21);
|
|
@@ -43859,7 +44120,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
|
|
|
43859
44120
|
const target = await resolveCollectionTarget({ ...input3, selector: `id:${op.targetId}` });
|
|
43860
44121
|
const after = observedCatalogue ?? await readCollectionCatalogue(
|
|
43861
44122
|
target.resourceId,
|
|
43862
|
-
input3.apis?.getDraftItems ?? ((params) =>
|
|
44123
|
+
input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
|
|
43863
44124
|
);
|
|
43864
44125
|
if (op.state === "prepared") return true;
|
|
43865
44126
|
if (op.state === "rejected")
|
|
@@ -43891,7 +44152,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
|
|
|
43891
44152
|
if (matches3.length !== 1) return false;
|
|
43892
44153
|
if (!item.requiredContracts.length) continue;
|
|
43893
44154
|
const detail2 = contractResponseData(
|
|
43894
|
-
await (input3.apis?.getItemDetail ?? ((params) =>
|
|
44155
|
+
await (input3.apis?.getItemDetail ?? ((params) => FServiceAPI2.Resource.getCollectionItemDetail_Draft(params)))({ resourceId: target.resourceId, itemId: matches3[0].itemId })
|
|
43895
44156
|
);
|
|
43896
44157
|
if (!object3(detail2) || detail2.itemId !== matches3[0].itemId || !Array.isArray(detail2.resolveResourceContracts))
|
|
43897
44158
|
return false;
|
|
@@ -43903,7 +44164,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
|
|
|
43903
44164
|
].filter((subject, index, all3) => all3.findIndex((other) => other.id === subject.id) === index);
|
|
43904
44165
|
const actualSubjects = await readContractSubjects(
|
|
43905
44166
|
expectedSubjects.map((subject) => subject.id),
|
|
43906
|
-
input3.apis?.info ?? ((params) =>
|
|
44167
|
+
input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
43907
44168
|
);
|
|
43908
44169
|
if (actualSubjects.some((subject, index) => subject.type !== expectedSubjects[index].type)) return false;
|
|
43909
44170
|
const contracts2 = await querySubjectContracts({
|
|
@@ -43913,7 +44174,7 @@ async function verifyCollectionItemAdd(input3, record21, observedCatalogue) {
|
|
|
43913
44174
|
});
|
|
43914
44175
|
await assertContractSubjectsUnchanged(
|
|
43915
44176
|
expectedSubjects,
|
|
43916
|
-
input3.apis?.info ?? ((params) =>
|
|
44177
|
+
input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
43917
44178
|
);
|
|
43918
44179
|
const state = parseAuthorizationState({
|
|
43919
44180
|
rootResourceId: item.resourceId,
|
|
@@ -44179,8 +44440,8 @@ function unavailable(r, userId, existing) {
|
|
|
44179
44440
|
}
|
|
44180
44441
|
async function pickCollectionItemSources(input3) {
|
|
44181
44442
|
assertPlatformAllowed();
|
|
44182
|
-
const request5 = input3.apis?.listResources ?? ((params) =>
|
|
44183
|
-
const typesRequest = input3.apis?.resourceTypes ?? ((params) =>
|
|
44443
|
+
const request5 = input3.apis?.listResources ?? ((params) => FServiceAPI2.Resource.list(params));
|
|
44444
|
+
const typesRequest = input3.apis?.resourceTypes ?? ((params) => FServiceAPI2.Resource.resourceTypes(params));
|
|
44184
44445
|
const select = input3.choose ?? ((message, choices) => (input3.prompts ?? headlessPrompts).selectQuestion(message, choices, "stderr"));
|
|
44185
44446
|
const ask = input3.input ?? ((message) => (input3.prompts ?? headlessPrompts).askInput(message, "stderr"));
|
|
44186
44447
|
const prompt2 = async (message, choices) => {
|
|
@@ -44365,7 +44626,7 @@ async function selectCollectionItemSources(input3) {
|
|
|
44365
44626
|
async function listCollectionDraftItems(input3) {
|
|
44366
44627
|
assertPlatformAllowed();
|
|
44367
44628
|
const target = await resolveCollectionTarget(input3);
|
|
44368
|
-
const getDraftItems = input3.apis?.getDraftItems ?? ((params) =>
|
|
44629
|
+
const getDraftItems = input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
|
|
44369
44630
|
return readCollectionCatalogue(target.resourceId, getDraftItems, {
|
|
44370
44631
|
keywords: input3.search,
|
|
44371
44632
|
sortField: input3.sortField,
|
|
@@ -44409,7 +44670,7 @@ async function writeAndReadManualEdit(input3, resourceId, request5, params) {
|
|
|
44409
44670
|
} catch (error3) {
|
|
44410
44671
|
const rejection = platformRejectionDescription(error3);
|
|
44411
44672
|
if (rejection) throw new CliError(rejection.message, "COLLECTION_ITEM_WRITE_REJECTED");
|
|
44412
|
-
throw manualEditUnknown();
|
|
44673
|
+
throw manualEditUnknown(platformFailureMessage(error3, ""));
|
|
44413
44674
|
}
|
|
44414
44675
|
const outcome = classifyApiResponse(response);
|
|
44415
44676
|
if (outcome.kind === "rejected")
|
|
@@ -44420,8 +44681,8 @@ async function writeAndReadManualEdit(input3, resourceId, request5, params) {
|
|
|
44420
44681
|
if (outcome.kind !== "success") throw manualEditUnknown();
|
|
44421
44682
|
try {
|
|
44422
44683
|
return await listCollectionDraftItems({ ...input3, selector: `id:${resourceId}` });
|
|
44423
|
-
} catch {
|
|
44424
|
-
throw manualEditUnknown();
|
|
44684
|
+
} catch (error3) {
|
|
44685
|
+
throw manualEditUnknown(platformFailureMessage(error3, ""));
|
|
44425
44686
|
}
|
|
44426
44687
|
});
|
|
44427
44688
|
}
|
|
@@ -44440,7 +44701,7 @@ async function renameCollectionDraftItem(input3) {
|
|
|
44440
44701
|
throw new CliError("\u76EE\u5F55\u8349\u7A3F\u4E2D\u4E0D\u5B58\u5728\u8BE5 itemId", "COLLECTION_ITEM_NOT_FOUND");
|
|
44441
44702
|
await confirmManualEdit(input3, target.resourceId, items, `\u4FEE\u6539\u5355\u54C1\u6807\u9898
|
|
44442
44703
|
${input3.itemId} \u2192 ${quotedItemTitle(title)}`);
|
|
44443
|
-
const rename = input3.apis?.renameDraftItems ?? ((params) =>
|
|
44704
|
+
const rename = input3.apis?.renameDraftItems ?? ((params) => FServiceAPI2.Resource.updateCollectionItemsInfo_Draft(params));
|
|
44444
44705
|
const after = await writeAndReadManualEdit(input3, target.resourceId, rename, {
|
|
44445
44706
|
resourceId: target.resourceId,
|
|
44446
44707
|
data: [{ itemId: input3.itemId, itemTitle: title }]
|
|
@@ -44460,7 +44721,7 @@ async function removeCollectionDraftItems(input3) {
|
|
|
44460
44721
|
throw new CliError("\u76EE\u5F55\u8349\u7A3F\u4E2D\u5B58\u5728\u627E\u4E0D\u5230\u7684 itemId", "COLLECTION_ITEM_NOT_FOUND");
|
|
44461
44722
|
await confirmManualEdit(input3, target.resourceId, before, `\u4ECE\u76EE\u5F55\u8349\u7A3F\u79FB\u9664 ${ids.length} \u4E2A\u5355\u54C1
|
|
44462
44723
|
${ids.join("\n")}`);
|
|
44463
|
-
const remove = input3.apis?.removeDraftItems ?? ((params) =>
|
|
44724
|
+
const remove = input3.apis?.removeDraftItems ?? ((params) => FServiceAPI2.Resource.deleteCollectionItems_Draft(params));
|
|
44464
44725
|
const after = await writeAndReadManualEdit(input3, target.resourceId, remove, {
|
|
44465
44726
|
resourceId: target.resourceId,
|
|
44466
44727
|
removeCollectionItemIds: ids
|
|
@@ -44501,7 +44762,7 @@ async function moveCollectionDraftItem(input3) {
|
|
|
44501
44762
|
items,
|
|
44502
44763
|
`\u79FB\u52A8\u5355\u54C1 ${moving.itemId} \u5230 ${input3.before ? "\u4E4B\u524D" : "\u4E4B\u540E"} ${anchor.itemId}`
|
|
44503
44764
|
);
|
|
44504
|
-
const move = input3.apis?.moveDraftItems ?? ((params) =>
|
|
44765
|
+
const move = input3.apis?.moveDraftItems ?? ((params) => FServiceAPI2.Resource.setCollectionItemsSortID_Draft(params));
|
|
44505
44766
|
const after = await writeAndReadManualEdit(input3, target.resourceId, move, {
|
|
44506
44767
|
resourceId: target.resourceId,
|
|
44507
44768
|
data: { itemIds: [moving.itemId], targetSortId }
|
|
@@ -44526,7 +44787,7 @@ async function sortCollectionDraftItems(input3) {
|
|
|
44526
44787
|
"resource-updated": "resourceUpdateDate"
|
|
44527
44788
|
}[input3.by];
|
|
44528
44789
|
await confirmManualEdit(input3, target.resourceId, before, `\u6309${input3.by} ${input3.direction}\u91CD\u65B0\u6392\u5E8F\u76EE\u5F55\u8349\u7A3F`);
|
|
44529
|
-
const reorder = input3.apis?.reorderDraftItems ?? ((params) =>
|
|
44790
|
+
const reorder = input3.apis?.reorderDraftItems ?? ((params) => FServiceAPI2.Resource.reorderCollectionItems_Draft(params));
|
|
44530
44791
|
const after = await writeAndReadManualEdit(input3, target.resourceId, reorder, {
|
|
44531
44792
|
resourceId: target.resourceId,
|
|
44532
44793
|
sortField: reorderSortField,
|
|
@@ -44545,13 +44806,13 @@ async function collectionDraftAuthStatus(input3) {
|
|
|
44545
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");
|
|
44546
44807
|
}
|
|
44547
44808
|
const target = await resolveCollectionTarget(input3);
|
|
44548
|
-
const getDraftItems = input3.apis?.getDraftItems ?? ((params) =>
|
|
44809
|
+
const getDraftItems = input3.apis?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params));
|
|
44549
44810
|
const catalogue = await readCollectionCatalogue(target.resourceId, getDraftItems);
|
|
44550
44811
|
const sources = new Map(catalogue.map((item) => [item.itemId, item.resourceId]));
|
|
44551
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");
|
|
44552
44813
|
if (ids.some((id11) => invalidId(sources.get(id11))))
|
|
44553
44814
|
throw new CliError("\u5E73\u53F0\u76EE\u5F55\u6765\u6E90\u8D44\u6E90ID\u683C\u5F0F\u65E0\u6548", "COLLECTION_ITEMS_RESPONSE_INVALID");
|
|
44554
|
-
const getAuth = input3.apis?.getDraftAuth ?? ((params) =>
|
|
44815
|
+
const getAuth = input3.apis?.getDraftAuth ?? ((params) => FServiceAPI2.Resource.getCollectionItemsAuth_Draft(params));
|
|
44555
44816
|
const response = await getAuth({ resourceId: target.resourceId, itemIds: ids.join(",") });
|
|
44556
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");
|
|
44557
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)
|
|
@@ -44568,7 +44829,7 @@ async function collectionDraftAuthStatus(input3) {
|
|
|
44568
44829
|
}
|
|
44569
44830
|
async function checkCollectionItemExistence(resourceId, ids, existing, apis2) {
|
|
44570
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");
|
|
44571
|
-
const check = apis2?.checkItems ?? ((params) =>
|
|
44832
|
+
const check = apis2?.checkItems ?? ((params) => FServiceAPI2.Resource.resourceIsExistInItems_Draft(params));
|
|
44572
44833
|
let response;
|
|
44573
44834
|
try {
|
|
44574
44835
|
response = await check({ resourceId, resourceIds: ids.join(",") });
|
|
@@ -44611,7 +44872,7 @@ async function addCollectionDraftItems(input3) {
|
|
|
44611
44872
|
await assertCollectionManualWritable(target, input3.apis);
|
|
44612
44873
|
const draft = await listCollectionDraftItems({ ...input3, selector: `id:${target.resourceId}` });
|
|
44613
44874
|
const existing = new Set(draft.map((item) => item.resourceId));
|
|
44614
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
44875
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
44615
44876
|
const candidates = [];
|
|
44616
44877
|
const unchanged = [];
|
|
44617
44878
|
const sourceOrder = [];
|
|
@@ -44684,7 +44945,7 @@ ${candidates.map((item) => `- ${item.resourceId} ${quotedItemTitle(item.title)}`
|
|
|
44684
44945
|
await revalidate();
|
|
44685
44946
|
await signing.assertSubjects();
|
|
44686
44947
|
assertCollectionOperationActor(input3, initialScope);
|
|
44687
|
-
const addDraftItems = input3.apis?.addDraftItems ?? ((params) =>
|
|
44948
|
+
const addDraftItems = input3.apis?.addDraftItems ?? ((params) => FServiceAPI2.Resource.addResourceItems_Draft(params));
|
|
44688
44949
|
const planItems = candidates.map((item) => ({
|
|
44689
44950
|
resourceId: item.resourceId,
|
|
44690
44951
|
itemTitle: item.title,
|
|
@@ -44743,7 +45004,9 @@ ${candidates.map((item) => `- ${item.resourceId} ${quotedItemTitle(item.title)}`
|
|
|
44743
45004
|
"COLLECTION_ITEM_ADD_REJECTED"
|
|
44744
45005
|
);
|
|
44745
45006
|
}
|
|
44746
|
-
|
|
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;
|
|
44747
45010
|
}
|
|
44748
45011
|
const requested = candidates.map((item) => item.resourceId);
|
|
44749
45012
|
const groups = parseCollectionItemAddResult(response, requested);
|
|
@@ -45005,7 +45268,7 @@ async function readCollectionTagRecommendations(resourceTypeCode, availableTags2
|
|
|
45005
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");
|
|
45006
45269
|
let response;
|
|
45007
45270
|
try {
|
|
45008
|
-
response = await (availableTags2 ?? ((params) =>
|
|
45271
|
+
response = await (availableTags2 ?? ((params) => FServiceAPI2.Resource.availableTags(params)))({ resourceTypeCode });
|
|
45009
45272
|
} catch (error3) {
|
|
45010
45273
|
throwPlatformReadError(error3, {
|
|
45011
45274
|
code: "COLLECTION_TAGS_RESPONSE_INVALID",
|
|
@@ -45238,7 +45501,7 @@ function readCover(cwd, source) {
|
|
|
45238
45501
|
}
|
|
45239
45502
|
}
|
|
45240
45503
|
async function uploadCover(file3, apis2) {
|
|
45241
|
-
const upload = apis2?.uploadImage ?? ((params) =>
|
|
45504
|
+
const upload = apis2?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params));
|
|
45242
45505
|
const result = await upload({ file: file3 });
|
|
45243
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)) {
|
|
45244
45507
|
throw new CliError(
|
|
@@ -45340,7 +45603,7 @@ async function updateCollectionListing(input3) {
|
|
|
45340
45603
|
syncTitleCache(verified2, false);
|
|
45341
45604
|
return payload;
|
|
45342
45605
|
}
|
|
45343
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
45606
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
45344
45607
|
if (coverFile)
|
|
45345
45608
|
(input3.reporter ?? silentReporter).warn(
|
|
45346
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"
|
|
@@ -45562,7 +45825,7 @@ async function readPages(options2) {
|
|
|
45562
45825
|
}
|
|
45563
45826
|
}
|
|
45564
45827
|
function contractsRequest(apis2) {
|
|
45565
|
-
return apis2?.getContracts ?? ((params) =>
|
|
45828
|
+
return apis2?.getContracts ?? ((params) => FServiceAPI2.Contract.contracts(params));
|
|
45566
45829
|
}
|
|
45567
45830
|
function contractPages(targetId, options2, request5, filter2 = {}) {
|
|
45568
45831
|
return readPages({
|
|
@@ -45577,7 +45840,7 @@ async function listCollectionUpdateLogs(input3) {
|
|
|
45577
45840
|
readLimit(input3);
|
|
45578
45841
|
const target = await resolveCollectionTarget(input3);
|
|
45579
45842
|
await confirmAll(input3, target.resourceName);
|
|
45580
|
-
const getLogs = input3.apis?.getLogs ?? ((params) =>
|
|
45843
|
+
const getLogs = input3.apis?.getLogs ?? ((params) => FServiceAPI2.Resource.getCollectionUpdateLogs(params));
|
|
45581
45844
|
return readPages({
|
|
45582
45845
|
...input3,
|
|
45583
45846
|
responseError: "COLLECTION_LOG_RESPONSE_INVALID",
|
|
@@ -45614,7 +45877,7 @@ async function getCollectionContract(input3) {
|
|
|
45614
45877
|
contractsRequest(input3.apis)
|
|
45615
45878
|
);
|
|
45616
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");
|
|
45617
|
-
const getContract = input3.apis?.getContract ?? ((params) =>
|
|
45880
|
+
const getContract = input3.apis?.getContract ?? ((params) => FServiceAPI2.Contract.contractDetails(params));
|
|
45618
45881
|
const response = await getContract({ contractId, isLoadPolicyInfo: 1 });
|
|
45619
45882
|
if (!successful(response) || !record12(response.data) || response.data.contractId !== contractId || !validContract(response.data, target.resourceId) || response.data.subjectType !== found.subjectType) {
|
|
45620
45883
|
throw new CliError("\u5E73\u53F0\u5408\u540C\u8BE6\u60C5\u8EAB\u4EFD\u3001\u5F52\u5C5E\u6216\u54CD\u5E94\u65E0\u6548", "COLLECTION_CONTRACT_RESPONSE_INVALID");
|
|
@@ -45854,14 +46117,40 @@ var init_optionKey = __esm({
|
|
|
45854
46117
|
}
|
|
45855
46118
|
});
|
|
45856
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
|
+
|
|
45857
46147
|
// src/domain/artifacts/analyze.ts
|
|
45858
46148
|
import { StringDecoder } from "string_decoder";
|
|
45859
46149
|
async function waitAnalyze(sha1, typeCode, apis2) {
|
|
45860
|
-
const
|
|
45861
|
-
|
|
45862
|
-
|
|
45863
|
-
|
|
45864
|
-
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));
|
|
45865
46154
|
}
|
|
45866
46155
|
async function waitAnalyzeSse(stream4, sha1, timeoutMs = 12e4) {
|
|
45867
46156
|
let buffer = "";
|
|
@@ -45891,8 +46180,8 @@ async function waitAnalyzeSse(stream4, sha1, timeoutMs = 12e4) {
|
|
|
45891
46180
|
if (line.startsWith("data:")) dataLines.push(line.slice("data:".length).replace(/^ /u, ""));
|
|
45892
46181
|
return void 0;
|
|
45893
46182
|
};
|
|
45894
|
-
const iterator2 = stream4[Symbol.asyncIterator]();
|
|
45895
46183
|
try {
|
|
46184
|
+
const iterator2 = stream4[Symbol.asyncIterator]();
|
|
45896
46185
|
while (true) {
|
|
45897
46186
|
const remaining = deadline - Date.now();
|
|
45898
46187
|
if (remaining <= 0) throw new CliError("\u5C5E\u6027\u89E3\u6790\u8D85\u65F6", "FILE_ANALYZE_TIMEOUT");
|
|
@@ -45936,7 +46225,7 @@ var init_analyze = __esm({
|
|
|
45936
46225
|
"src/domain/artifacts/analyze.ts"() {
|
|
45937
46226
|
"use strict";
|
|
45938
46227
|
init_errors();
|
|
45939
|
-
|
|
46228
|
+
init_fileAnalysis();
|
|
45940
46229
|
init_env();
|
|
45941
46230
|
}
|
|
45942
46231
|
});
|
|
@@ -46109,7 +46398,7 @@ async function loadAttributeDefinitions(attributes, includeDefinitions, apis2) {
|
|
|
46109
46398
|
if (includeDefinitions === false) return attributes;
|
|
46110
46399
|
const getDefinition = apis2.getAttrsInfoByKey ?? ((params) => {
|
|
46111
46400
|
assertPlatformAllowed();
|
|
46112
|
-
return
|
|
46401
|
+
return FServiceAPI2.Resource.getAttrsInfoByKey(params);
|
|
46113
46402
|
});
|
|
46114
46403
|
return Promise.all(
|
|
46115
46404
|
attributes.map(async (attribute) => {
|
|
@@ -46126,7 +46415,7 @@ async function loadAttributeDefinitions(attributes, includeDefinitions, apis2) {
|
|
|
46126
46415
|
async function loadTypeSystemAttributes(input3) {
|
|
46127
46416
|
assertPlatformAllowed();
|
|
46128
46417
|
const apis2 = input3.apis ?? {};
|
|
46129
|
-
const filesInfo2 = apis2.filesInfo ?? ((params) =>
|
|
46418
|
+
const filesInfo2 = apis2.filesInfo ?? ((params) => FServiceAPI2.Storage.filesInfo(params));
|
|
46130
46419
|
const typeMetadata = await requestData(async () => {
|
|
46131
46420
|
const response = await filesInfo2({ resourceTypeCode: input3.typeCode });
|
|
46132
46421
|
if (!record13(response) || classifyApiResponse(response).kind !== "success" || !record13(response.data))
|
|
@@ -46151,7 +46440,7 @@ async function loadSystemAttributes(input3) {
|
|
|
46151
46440
|
if (input3.analysis === void 0 && !input3.sha1) {
|
|
46152
46441
|
const getByCode = apis2.getByCode ?? ((params) => {
|
|
46153
46442
|
assertPlatformAllowed();
|
|
46154
|
-
return
|
|
46443
|
+
return FServiceAPI2.Resource.getResourceTypeInfoByCode(params);
|
|
46155
46444
|
});
|
|
46156
46445
|
const type = await requestData(() => getByCode({ code: input3.typeCode }));
|
|
46157
46446
|
const attrs = type.attrs;
|
|
@@ -46317,7 +46606,7 @@ async function loadCollectionSystemRules(type, apis2 = {}) {
|
|
|
46317
46606
|
for (const field of namespace) addIdentity(field, false);
|
|
46318
46607
|
const filesInfo2 = apis2.filesInfo ?? ((params) => {
|
|
46319
46608
|
assertPlatformAllowed();
|
|
46320
|
-
return
|
|
46609
|
+
return FServiceAPI2.Storage.filesInfo(params);
|
|
46321
46610
|
});
|
|
46322
46611
|
const data3 = await requestData2(() => filesInfo2({ resourceTypeCode: type.code }));
|
|
46323
46612
|
if (!Array.isArray(data3.metaInfoArray)) return responseInvalid();
|
|
@@ -46333,7 +46622,7 @@ async function loadCollectionSystemRules(type, apis2 = {}) {
|
|
|
46333
46622
|
}
|
|
46334
46623
|
const getDefinition = apis2.getAttrsInfoByKey ?? ((params) => {
|
|
46335
46624
|
assertPlatformAllowed();
|
|
46336
|
-
return
|
|
46625
|
+
return FServiceAPI2.Resource.getAttrsInfoByKey(params);
|
|
46337
46626
|
});
|
|
46338
46627
|
let attrs;
|
|
46339
46628
|
try {
|
|
@@ -46786,7 +47075,7 @@ var init_store = __esm({
|
|
|
46786
47075
|
});
|
|
46787
47076
|
|
|
46788
47077
|
// src/domain/collection/form/service.ts
|
|
46789
|
-
function
|
|
47078
|
+
function unwrapData2(result) {
|
|
46790
47079
|
const data3 = responseData2(result, "COLLECTION_FORM_RESPONSE_INVALID");
|
|
46791
47080
|
if (!data3 || typeof data3 !== "object" || Array.isArray(data3))
|
|
46792
47081
|
throw new CliError("\u5E73\u53F0\u5408\u96C6\u8868\u5355\u54CD\u5E94\u683C\u5F0F\u65E0\u6CD5\u8BC6\u522B", "COLLECTION_FORM_RESPONSE_INVALID");
|
|
@@ -46800,8 +47089,8 @@ async function readPublishedCollectionForm(input3) {
|
|
|
46800
47089
|
return { form: emptyForm(), authExcludedItems: [] };
|
|
46801
47090
|
}
|
|
46802
47091
|
if (!latest.trim()) throw new CliError("\u5408\u96C6\u6700\u65B0\u5FEB\u7167\u5B57\u6BB5\u65E0\u6548", "COLLECTION_FORM_RESPONSE_INVALID");
|
|
46803
|
-
const versionInfo = input3.apis?.versionInfo ?? ((params) =>
|
|
46804
|
-
const version2 =
|
|
47092
|
+
const versionInfo = input3.apis?.versionInfo ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
47093
|
+
const version2 = unwrapData2(await versionInfo({ resourceId: input3.resourceId, version: latest }));
|
|
46805
47094
|
if (version2.resourceId !== input3.resourceId || version2.version !== latest)
|
|
46806
47095
|
throw new CliError("\u5DF2\u53D1\u5E03\u5408\u96C6\u5FEB\u7167\u8EAB\u4EFD\u6216\u7248\u672C\u4E0D\u5339\u914D", "COLLECTION_FORM_RESPONSE_INVALID");
|
|
46807
47096
|
return {
|
|
@@ -47843,7 +48132,7 @@ async function assertDependencyDeclarations(input3) {
|
|
|
47843
48132
|
let target;
|
|
47844
48133
|
try {
|
|
47845
48134
|
target = contractResponseData(
|
|
47846
|
-
await (input3.apis?.dependencyInfo ?? ((params) =>
|
|
48135
|
+
await (input3.apis?.dependencyInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
|
|
47847
48136
|
resourceIdOrName: dependency.resourceId,
|
|
47848
48137
|
isLoadLatestVersionInfo: 1
|
|
47849
48138
|
})
|
|
@@ -47863,7 +48152,7 @@ async function assertDependencyDeclarations(input3) {
|
|
|
47863
48152
|
resourceId: dependency.resourceId,
|
|
47864
48153
|
subjectType,
|
|
47865
48154
|
latestVersion: target.latestVersion,
|
|
47866
|
-
read: input3.apis?.dependencyVersions ?? ((params) =>
|
|
48155
|
+
read: input3.apis?.dependencyVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
|
|
47867
48156
|
invalidCode: "DEPENDENCY_VERSIONS_INVALID"
|
|
47868
48157
|
});
|
|
47869
48158
|
assertRangeMatches(versions, dependency.versionRange, "DEPENDENCY_RANGE_INVALID", subjectType);
|
|
@@ -47872,7 +48161,7 @@ async function assertDependencyDeclarations(input3) {
|
|
|
47872
48161
|
let cycle;
|
|
47873
48162
|
try {
|
|
47874
48163
|
cycle = contractResponseData(
|
|
47875
|
-
await (input3.apis?.cycleDependencyCheck ?? ((params) =>
|
|
48164
|
+
await (input3.apis?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params)))({ resourceId: input3.resourceId, dependencies })
|
|
47876
48165
|
);
|
|
47877
48166
|
} catch (error3) {
|
|
47878
48167
|
throwPlatformReadError(error3, {
|
|
@@ -47901,8 +48190,8 @@ var init_validation = __esm({
|
|
|
47901
48190
|
// src/domain/collection/publish.ts
|
|
47902
48191
|
function itemRequests(apis2) {
|
|
47903
48192
|
return {
|
|
47904
|
-
published: apis2?.getPublishedItems ?? ((params) =>
|
|
47905
|
-
draft: apis2?.getDraftItems ?? ((params) =>
|
|
48193
|
+
published: apis2?.getPublishedItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems(params)),
|
|
48194
|
+
draft: apis2?.getDraftItems ?? ((params) => FServiceAPI2.Resource.getCollectionItems_Draft(params))
|
|
47906
48195
|
};
|
|
47907
48196
|
}
|
|
47908
48197
|
function assertWritable3(target) {
|
|
@@ -48157,7 +48446,7 @@ async function publishCollection(input3) {
|
|
|
48157
48446
|
sentAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
48158
48447
|
});
|
|
48159
48448
|
snapshot2 = saveCollectionIntent(input3.cwd, { ...snapshot2.intent, state: "sending" }, snapshot2);
|
|
48160
|
-
const update2 = input3.apis?.updateCollection ?? ((params) =>
|
|
48449
|
+
const update2 = input3.apis?.updateCollection ?? ((params) => FServiceAPI2.Resource.updateCollection(params));
|
|
48161
48450
|
let result;
|
|
48162
48451
|
let rejectionMessage;
|
|
48163
48452
|
try {
|
|
@@ -48347,12 +48636,12 @@ var init_provider = __esm({
|
|
|
48347
48636
|
});
|
|
48348
48637
|
|
|
48349
48638
|
// src/domain/dependencyAuthorization/host.ts
|
|
48350
|
-
import { AsyncLocalStorage as
|
|
48639
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
48351
48640
|
import { createHash as createHash15, randomUUID as randomUUID4 } from "crypto";
|
|
48352
48641
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
|
|
48353
48642
|
import { z as z15 } from "zod";
|
|
48354
48643
|
function createDependencyAuthorizationHost(input3) {
|
|
48355
|
-
const queryContext = new
|
|
48644
|
+
const queryContext = new AsyncLocalStorage3();
|
|
48356
48645
|
const scope = { ...input3.runtime.account, ...input3.homeDir ? { homeDir: input3.homeDir } : {} };
|
|
48357
48646
|
const assertOutsideQuery = () => {
|
|
48358
48647
|
if (queryContext.getStore())
|
|
@@ -48879,14 +49168,129 @@ var init_runtime = __esm({
|
|
|
48879
49168
|
}
|
|
48880
49169
|
});
|
|
48881
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
|
+
|
|
48882
49285
|
// src/adapters/authModuleHost.ts
|
|
48883
49286
|
function createAuthCommandHost(register, root) {
|
|
48884
49287
|
let provider;
|
|
49288
|
+
const exhibitCreationCommands = /* @__PURE__ */ new WeakSet();
|
|
48885
49289
|
const runtime = (command, online) => {
|
|
48886
49290
|
const shared = readSharedOptions(command);
|
|
48887
49291
|
if (online && shared.file !== void 0)
|
|
48888
49292
|
throw new CliError("\u7EBF\u4E0A\u6388\u6743\u547D\u4EE4\u4E0D\u63A5\u53D7 --resource", "NODE_RESOURCE_SELECTOR_UNSUPPORTED");
|
|
48889
|
-
|
|
49293
|
+
const context5 = createAuthRuntime({
|
|
48890
49294
|
cwd: resolveCwd(shared.cwd),
|
|
48891
49295
|
yes: shared.yes,
|
|
48892
49296
|
json: shared.json,
|
|
@@ -48898,6 +49302,8 @@ function createAuthCommandHost(register, root) {
|
|
|
48898
49302
|
error: (value) => console.error(value)
|
|
48899
49303
|
}
|
|
48900
49304
|
});
|
|
49305
|
+
if (online && exhibitCreationCommands.has(command)) guardExhibitCreation(context5);
|
|
49306
|
+
return context5;
|
|
48901
49307
|
};
|
|
48902
49308
|
if (root) {
|
|
48903
49309
|
commandRuntimes.set(root, (command) => runtime(command, false));
|
|
@@ -48906,7 +49312,11 @@ function createAuthCommandHost(register, root) {
|
|
|
48906
49312
|
return {
|
|
48907
49313
|
protocolVersion: AUTH_MODULE_PROTOCOL,
|
|
48908
49314
|
capabilities: Object.freeze({ dependencyAuthorizationWorkflow: DEPENDENCY_AUTHORIZATION_WORKFLOW_ENABLED }),
|
|
48909
|
-
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
|
+
},
|
|
48910
49320
|
options: readSharedOptions,
|
|
48911
49321
|
runtime: (command) => runtime(command, true),
|
|
48912
49322
|
output: (value) => console.log(JSON.stringify(value, null, 2)),
|
|
@@ -48954,6 +49364,7 @@ var init_authModuleHost = __esm({
|
|
|
48954
49364
|
init_headlessInteraction();
|
|
48955
49365
|
init_runtime();
|
|
48956
49366
|
init_featureFlags();
|
|
49367
|
+
init_authModuleRequests();
|
|
48957
49368
|
commandRuntimes = /* @__PURE__ */ new WeakMap();
|
|
48958
49369
|
commandProviders = /* @__PURE__ */ new WeakMap();
|
|
48959
49370
|
}
|
|
@@ -49182,7 +49593,7 @@ function assertWritable4(target) {
|
|
|
49182
49593
|
}
|
|
49183
49594
|
}
|
|
49184
49595
|
async function targetFacts(source, collectionId, apis2, loadPolicies = false, expectedSubjectType) {
|
|
49185
|
-
const get2 = apis2.targetInfo ?? ((params) =>
|
|
49596
|
+
const get2 = apis2.targetInfo ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
49186
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");
|
|
49187
49598
|
let response;
|
|
49188
49599
|
try {
|
|
@@ -49249,7 +49660,7 @@ async function assertRange(fact, range, apis2) {
|
|
|
49249
49660
|
resourceId: fact.id,
|
|
49250
49661
|
latestVersion: fact.latest,
|
|
49251
49662
|
subjectType: fact.subjectType,
|
|
49252
|
-
read: apis2.getVersions ?? ((params) =>
|
|
49663
|
+
read: apis2.getVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
|
|
49253
49664
|
invalidCode: "COLLECTION_DEP_VERSIONS_RESPONSE_INVALID"
|
|
49254
49665
|
});
|
|
49255
49666
|
assertRangeMatches(versions, range, "COLLECTION_DEP_RANGE_INVALID", fact.subjectType);
|
|
@@ -49283,7 +49694,7 @@ async function addCollectionDependency(input3) {
|
|
|
49283
49694
|
existingRange: input3.mode === "range" && fact.subjectType === 1 ? void 0 : existing?.versionRange,
|
|
49284
49695
|
prompts: input3.prompts,
|
|
49285
49696
|
reporter: input3.reporter,
|
|
49286
|
-
read: apis2.getVersions ?? ((params) =>
|
|
49697
|
+
read: apis2.getVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
|
|
49287
49698
|
rangeCode: "COLLECTION_DEP_RANGE_INVALID",
|
|
49288
49699
|
versionsCode: "COLLECTION_DEP_VERSIONS_RESPONSE_INVALID"
|
|
49289
49700
|
});
|
|
@@ -49301,7 +49712,7 @@ async function addCollectionDependency(input3) {
|
|
|
49301
49712
|
await assertRange(retained, dependency.versionRange, apis2);
|
|
49302
49713
|
candidateTypes.set(retained.id, retained.subjectType);
|
|
49303
49714
|
}
|
|
49304
|
-
const cycle = apis2.cycleCheck ?? ((params) =>
|
|
49715
|
+
const cycle = apis2.cycleCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
|
|
49305
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");
|
|
49306
49717
|
let result;
|
|
49307
49718
|
try {
|
|
@@ -49840,7 +50251,7 @@ async function writeAndVerifyStatus(input3) {
|
|
|
49840
50251
|
target = await recheckCollectionWriteTarget(input3, anchor);
|
|
49841
50252
|
assertCollectionWriteTarget(input3, anchor);
|
|
49842
50253
|
if (!needsWrite(target)) return unchanged();
|
|
49843
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
50254
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
49844
50255
|
assertCollectionWriteTarget(input3, anchor);
|
|
49845
50256
|
try {
|
|
49846
50257
|
await update2({ resourceId: anchor.resourceId, status: input3.expectedStatus });
|
|
@@ -49970,7 +50381,7 @@ function fieldFrom(value) {
|
|
|
49970
50381
|
const raw = value;
|
|
49971
50382
|
const fieldId = stringAt(raw, ["id"]);
|
|
49972
50383
|
if (!fieldId) error2("\u7B56\u7565\u6A21\u677F\u5B57\u6BB5\u7F3A\u5C11 id");
|
|
49973
|
-
const type = raw.uiSectionType;
|
|
50384
|
+
const type = raw.uiSectionType === "dateTime" ? "datetime" : raw.uiSectionType;
|
|
49974
50385
|
if (type !== "number" && type !== "select" && type !== "datetime") {
|
|
49975
50386
|
error2(`\u7B56\u7565\u6A21\u677F\u5B57\u6BB5 ${fieldId} \u7684 uiSectionType \u4E0D\u53D7\u652F\u6301`);
|
|
49976
50387
|
}
|
|
@@ -50345,7 +50756,7 @@ async function assertPolicySettlement(input3) {
|
|
|
50345
50756
|
let qualification;
|
|
50346
50757
|
try {
|
|
50347
50758
|
qualification = await request4(
|
|
50348
|
-
input3.withdrawStatus ?? ((params) =>
|
|
50759
|
+
input3.withdrawStatus ?? ((params) => FServiceAPI2.Payment.queryWithdrawStatus(params)),
|
|
50349
50760
|
{ ownerId: input3.ownerId, accountType: input3.accountType },
|
|
50350
50761
|
`${prefix2}_SETTLEMENT_INVALID`
|
|
50351
50762
|
);
|
|
@@ -50410,7 +50821,7 @@ function assertWritable6(info2) {
|
|
|
50410
50821
|
}
|
|
50411
50822
|
async function catalog(input3) {
|
|
50412
50823
|
const target = await resolveCollectionTarget(input3);
|
|
50413
|
-
const request5 = input3.apis?.policyTemplates ?? ((params) =>
|
|
50824
|
+
const request5 = input3.apis?.policyTemplates ?? ((params) => FServiceAPI2.Policy.policyTemplates(params));
|
|
50414
50825
|
return { target, templates: parsePolicyTemplateCatalog(await request5({}), "collection") };
|
|
50415
50826
|
}
|
|
50416
50827
|
async function getCollectionPolicyTemplateCatalog(input3) {
|
|
@@ -50433,8 +50844,8 @@ async function prepareCollectionPolicyTemplate(input3) {
|
|
|
50433
50844
|
throw new CliError("\u5F53\u524D\u5408\u96C6\u5DF2\u5B58\u5728\u540C\u540D\u6388\u6743\u7B56\u7565", "POLICY_NAME_DUPLICATE");
|
|
50434
50845
|
if (result.template.fingerprint !== input3.expectedFingerprint)
|
|
50435
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");
|
|
50436
|
-
const reCompile = input3.apis?.policyReCompile ?? ((params) =>
|
|
50437
|
-
const translate = input3.apis?.policyTranslation ?? ((params) =>
|
|
50847
|
+
const reCompile = input3.apis?.policyReCompile ?? ((params) => FServiceAPI2.Policy.policyReCompile(params));
|
|
50848
|
+
const translate = input3.apis?.policyTranslation ?? ((params) => FServiceAPI2.Policy.policyTranslation(params));
|
|
50438
50849
|
return preparePolicyWithSettlement(
|
|
50439
50850
|
{
|
|
50440
50851
|
template: result.template,
|
|
@@ -50466,7 +50877,7 @@ async function applyCollectionPolicy(input3) {
|
|
|
50466
50877
|
accountType: 1,
|
|
50467
50878
|
withdrawStatus: input3.apis?.withdrawStatus
|
|
50468
50879
|
});
|
|
50469
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
50880
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
50470
50881
|
await appendPolicy({
|
|
50471
50882
|
subject: "\u5408\u96C6",
|
|
50472
50883
|
resourceId: target.resourceId,
|
|
@@ -50479,7 +50890,7 @@ async function applyCollectionPolicy(input3) {
|
|
|
50479
50890
|
async function setCollectionPolicy(input3) {
|
|
50480
50891
|
const target = await resolveCollectionTarget(input3);
|
|
50481
50892
|
assertWritable6(target.info);
|
|
50482
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
50893
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
50483
50894
|
await togglePolicy({
|
|
50484
50895
|
subject: "\u5408\u96C6",
|
|
50485
50896
|
resourceId: target.resourceId,
|
|
@@ -50659,10 +51070,10 @@ var init_gates = __esm({
|
|
|
50659
51070
|
|
|
50660
51071
|
// src/domain/policy/resourcePolicy.ts
|
|
50661
51072
|
function infoApi(apis2) {
|
|
50662
|
-
return apis2?.info ?? ((params) =>
|
|
51073
|
+
return apis2?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
50663
51074
|
}
|
|
50664
51075
|
function updateApi(apis2) {
|
|
50665
|
-
return apis2?.update ?? ((params) =>
|
|
51076
|
+
return apis2?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
50666
51077
|
}
|
|
50667
51078
|
function readPolicies(info2) {
|
|
50668
51079
|
const source = Array.isArray(info2.policies) ? info2.policies : [];
|
|
@@ -50737,7 +51148,7 @@ async function loadPolicyContext(input3) {
|
|
|
50737
51148
|
}
|
|
50738
51149
|
async function getPolicyTemplateCatalog(input3) {
|
|
50739
51150
|
const context5 = await loadPolicyContext(input3);
|
|
50740
|
-
const request5 = input3.apis?.policyTemplates ?? ((params) =>
|
|
51151
|
+
const request5 = input3.apis?.policyTemplates ?? ((params) => FServiceAPI2.Policy.policyTemplates(params));
|
|
50741
51152
|
const templates = parsePolicyTemplateCatalog(await request5({}), "normal");
|
|
50742
51153
|
return {
|
|
50743
51154
|
subject: { kind: "resource", resourceId: context5.resourceId, typeCode: context5.typeCode },
|
|
@@ -50764,8 +51175,8 @@ async function preparePolicyTemplate(input3) {
|
|
|
50764
51175
|
if (template.fingerprint !== input3.expectedFingerprint) {
|
|
50765
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");
|
|
50766
51177
|
}
|
|
50767
|
-
const request5 = input3.apis?.policyReCompile ?? ((params) =>
|
|
50768
|
-
const translate = input3.apis?.policyTranslation ?? ((params) =>
|
|
51178
|
+
const request5 = input3.apis?.policyReCompile ?? ((params) => FServiceAPI2.Policy.policyReCompile(params));
|
|
51179
|
+
const translate = input3.apis?.policyTranslation ?? ((params) => FServiceAPI2.Policy.policyTranslation(params));
|
|
50769
51180
|
return preparePolicyWithSettlement(
|
|
50770
51181
|
{
|
|
50771
51182
|
template,
|
|
@@ -51306,6 +51717,10 @@ function assertResourceInfoExists(response) {
|
|
|
51306
51717
|
if (classifyApiResponse(response).kind === "success" && Object.getOwnPropertyDescriptor(response, "data")?.value === null)
|
|
51307
51718
|
throw new CliError("\u8D44\u6E90\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u8D44\u6E90ID", "RESOURCE_NOT_FOUND");
|
|
51308
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
|
+
}
|
|
51309
51724
|
async function readResourceInfo(read2, resourceId, extra = {}) {
|
|
51310
51725
|
if (typeof resourceId !== "string" || !resourceId.trim() || ["undefined", "null"].includes(resourceId.trim()))
|
|
51311
51726
|
throw new CliError("\u8D44\u6E90ID\u4E0D\u80FD\u4E3A\u7A7A\u6216\u65E0\u6548", "CLI_ARGUMENT_INVALID");
|
|
@@ -51373,7 +51788,7 @@ function readCover2(cwd, cover) {
|
|
|
51373
51788
|
}
|
|
51374
51789
|
}
|
|
51375
51790
|
async function uploadCover2(content, apis2) {
|
|
51376
|
-
const upload = apis2?.uploadImage ?? ((params) =>
|
|
51791
|
+
const upload = apis2?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params));
|
|
51377
51792
|
const result = unwrapData(await upload({ file: content }));
|
|
51378
51793
|
const url2 = result.url ?? result.fileUrl ?? result.fileURL;
|
|
51379
51794
|
if (typeof url2 !== "string" || !url2.trim()) {
|
|
@@ -51453,7 +51868,7 @@ async function updateListing(input3) {
|
|
|
51453
51868
|
async function updateListingLocked(input3, authUserId, noFlags) {
|
|
51454
51869
|
const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
|
|
51455
51870
|
const assertContext2 = resourceWriteContext(input3, identity4, authUserId);
|
|
51456
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
51871
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
51457
51872
|
const remote = await readResourceInfo(info2, identity4.resourceId);
|
|
51458
51873
|
assertContext2();
|
|
51459
51874
|
assertRemoteResourceWritable({ info: remote, resourceId: identity4.resourceId, authUserId });
|
|
@@ -51527,7 +51942,7 @@ ${Object.entries(payload).filter(([key2]) => key2 !== "resourceId").map(([key2,
|
|
|
51527
51942
|
payload.coverImages = [await uploadCover2(coverBytes, input3.apis)];
|
|
51528
51943
|
assertContext2();
|
|
51529
51944
|
}
|
|
51530
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
51945
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
51531
51946
|
try {
|
|
51532
51947
|
const response = await update2(payload);
|
|
51533
51948
|
const rejection = new ApiResponseError("\u5E73\u53F0\u62D2\u7EDD\u8D44\u6E90\u8D44\u6599\u66F4\u65B0", response);
|
|
@@ -51942,7 +52357,7 @@ async function bindResourceLocked(input3, originalIdentities) {
|
|
|
51942
52357
|
throw new CliError(`\u672C\u5730\u4EA7\u7269\u4E0D\u5B58\u5728\uFF1A${absolute}`, "ARTIFACT_ANCHOR_MISSING");
|
|
51943
52358
|
}
|
|
51944
52359
|
}
|
|
51945
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
52360
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
51946
52361
|
const response = await infoApi2({
|
|
51947
52362
|
resourceIdOrName: input3.target,
|
|
51948
52363
|
isLoadLatestVersionInfo: 1
|
|
@@ -52677,7 +53092,7 @@ async function statusProject(input3) {
|
|
|
52677
53092
|
assertPlatformAllowed();
|
|
52678
53093
|
requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
52679
53094
|
resolveBoundIdentity(input3.cwd, input3.file);
|
|
52680
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
53095
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
52681
53096
|
let result;
|
|
52682
53097
|
try {
|
|
52683
53098
|
result = await infoApi2({ resourceIdOrName: local.resourceId, isLoadLatestVersionInfo: 1 });
|
|
@@ -52951,7 +53366,7 @@ async function syncResourceTitles(input3) {
|
|
|
52951
53366
|
if (input3.selector !== void 0 && (targets[0].env ?? "prod") !== env) {
|
|
52952
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");
|
|
52953
53368
|
}
|
|
52954
|
-
const info2 = input3.apis?.info ?? ((params) =>
|
|
53369
|
+
const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
52955
53370
|
const results = await Promise.all(
|
|
52956
53371
|
targets.map(async (identity4) => ({
|
|
52957
53372
|
identity: identity4,
|
|
@@ -53072,7 +53487,7 @@ async function inspectAndApplyPendingOperation(input3) {
|
|
|
53072
53487
|
const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
53073
53488
|
if (pending.schemaVersion === 4 && auth.userId !== pending.publication.consumption.userId)
|
|
53074
53489
|
throw new CliError("\u6062\u590D\u8D26\u53F7\u4E0E\u672C\u6B21\u53D1\u884C\u6D88\u8D39\u5F15\u7528\u4E0D\u540C", "RECOVER_NOT_OWNER");
|
|
53075
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
53490
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
53076
53491
|
const infoResponse = await infoApi2({ resourceIdOrName: pending.resourceId });
|
|
53077
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");
|
|
53078
53493
|
const info2 = unwrapData(infoResponse);
|
|
@@ -53085,7 +53500,7 @@ async function inspectAndApplyPendingOperation(input3) {
|
|
|
53085
53500
|
notOwner: "RECOVER_NOT_OWNER"
|
|
53086
53501
|
}
|
|
53087
53502
|
});
|
|
53088
|
-
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
53503
|
+
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
53089
53504
|
const versionResponse = await versionInfoApi({
|
|
53090
53505
|
resourceId: pending.resourceId,
|
|
53091
53506
|
version: pending.version
|
|
@@ -53305,8 +53720,7 @@ function detailsData(response) {
|
|
|
53305
53720
|
const data3 = response.data;
|
|
53306
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")
|
|
53307
53722
|
throw invalid8();
|
|
53308
|
-
|
|
53309
|
-
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);
|
|
53310
53724
|
return {
|
|
53311
53725
|
resourceId: data3.resourceId,
|
|
53312
53726
|
resourceName: data3.resourceName,
|
|
@@ -53338,17 +53752,14 @@ async function readResourceDetails(input3) {
|
|
|
53338
53752
|
};
|
|
53339
53753
|
let response;
|
|
53340
53754
|
try {
|
|
53341
|
-
const
|
|
53342
|
-
|
|
53343
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
53344
|
-
}));
|
|
53345
|
-
response = await info2({ resourceIdOrName: target });
|
|
53755
|
+
const params = { resourceIdOrName: target };
|
|
53756
|
+
response = await (input3.apis?.info ?? FServiceAPI2.Resource.info)(params);
|
|
53346
53757
|
} catch (error3) {
|
|
53347
53758
|
assertContext2();
|
|
53348
|
-
throwPlatformReadError(
|
|
53349
|
-
|
|
53350
|
-
message: "\
|
|
53351
|
-
|
|
53759
|
+
throwPlatformReadError(
|
|
53760
|
+
error3,
|
|
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" }
|
|
53762
|
+
);
|
|
53352
53763
|
}
|
|
53353
53764
|
assertContext2();
|
|
53354
53765
|
assertResourceInfoExists(response);
|
|
@@ -53359,7 +53770,7 @@ async function readResourceDetails(input3) {
|
|
|
53359
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");
|
|
53360
53771
|
return details3;
|
|
53361
53772
|
}
|
|
53362
|
-
var
|
|
53773
|
+
var NETWORK_FAILURE, FULL_NAME, RESOURCE_ID, invalid8, nonempty, stringArray;
|
|
53363
53774
|
var init_details = __esm({
|
|
53364
53775
|
"src/domain/resource/details.ts"() {
|
|
53365
53776
|
"use strict";
|
|
@@ -53373,7 +53784,10 @@ var init_details = __esm({
|
|
|
53373
53784
|
init_gates();
|
|
53374
53785
|
init_visibility();
|
|
53375
53786
|
init_readInfo();
|
|
53376
|
-
|
|
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
|
+
};
|
|
53377
53791
|
FULL_NAME = /^[^\s/:]+\/[^\s/:]+$/u;
|
|
53378
53792
|
RESOURCE_ID = /^[a-f\d]{24}$/iu;
|
|
53379
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");
|
|
@@ -53488,7 +53902,7 @@ var init_resource = __esm({
|
|
|
53488
53902
|
|
|
53489
53903
|
// src/domain/resource/online.ts
|
|
53490
53904
|
async function loadInfo(resourceId, apis2) {
|
|
53491
|
-
const infoApi2 = apis2?.info ?? ((params) =>
|
|
53905
|
+
const infoApi2 = apis2?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
53492
53906
|
return readResourceInfo(infoApi2, resourceId, {
|
|
53493
53907
|
isLoadLatestVersionInfo: 1,
|
|
53494
53908
|
isLoadPolicyInfo: 1
|
|
@@ -53503,7 +53917,9 @@ function validateForOnline(info2) {
|
|
|
53503
53917
|
throw new CliError("\u4E0A\u67B6\u987B\u81F3\u5C11\u4E00\u6761\u542F\u7528\u7B56\u7565", "ONLINE_NO_POLICY");
|
|
53504
53918
|
}
|
|
53505
53919
|
}
|
|
53506
|
-
function
|
|
53920
|
+
function assertShelfResource(info2, resourceId, authUserId) {
|
|
53921
|
+
assertRemoteResourceWritable({ info: info2, resourceId, authUserId });
|
|
53922
|
+
assertSingleResourceSubject(info2);
|
|
53507
53923
|
if (![0, 1, 4, 8].includes(info2.status))
|
|
53508
53924
|
throw new CliError("\u5E73\u53F0\u8D44\u6E90\u72B6\u6001\u65E0\u6548\uFF0C\u62D2\u7EDD\u4FEE\u6539\u4E0A\u4E0B\u67B6", "RESOURCE_STATUS_INVALID");
|
|
53509
53925
|
}
|
|
@@ -53521,8 +53937,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
|
|
|
53521
53937
|
const assertContext2 = resourceWriteContext(input3, identity4, authUserId);
|
|
53522
53938
|
const info2 = await loadInfo(identity4.resourceId, input3.apis);
|
|
53523
53939
|
assertContext2();
|
|
53524
|
-
|
|
53525
|
-
assertKnownShelfStatus(info2);
|
|
53940
|
+
assertShelfResource(info2, identity4.resourceId, authUserId);
|
|
53526
53941
|
const listing = isListedResourceStatus(desired);
|
|
53527
53942
|
if (listing) validateForOnline(info2);
|
|
53528
53943
|
if (info2.status === desired || desired === 4 && info2.status === 0) {
|
|
@@ -53540,7 +53955,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
|
|
|
53540
53955
|
input3.json ? "stderr" : void 0
|
|
53541
53956
|
);
|
|
53542
53957
|
assertContext2();
|
|
53543
|
-
const update2 = input3.apis?.update ?? ((params) =>
|
|
53958
|
+
const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
|
|
53544
53959
|
const unknown2 = (cause) => {
|
|
53545
53960
|
const reason = cause instanceof CliError && cause.code !== "SHELF_RESULT_UNKNOWN" ? safePlatformMessage(cause.message) : platformFailureMessage(cause, "");
|
|
53546
53961
|
return new CliError(
|
|
@@ -53568,6 +53983,7 @@ async function changeShelfLocked(input3, authUserId, desired) {
|
|
|
53568
53983
|
}
|
|
53569
53984
|
try {
|
|
53570
53985
|
assertRemoteResourceOwned({ info: after, resourceId: identity4.resourceId, authUserId });
|
|
53986
|
+
assertSingleResourceSubject(after);
|
|
53571
53987
|
if (after.status !== desired || after.isFrozen === true) throw new Error("Shelf mismatch");
|
|
53572
53988
|
} catch {
|
|
53573
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");
|
|
@@ -53676,17 +54092,12 @@ async function validateOnline(input3) {
|
|
|
53676
54092
|
assertPlatformAllowed();
|
|
53677
54093
|
const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
53678
54094
|
const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
|
|
53679
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
54095
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
53680
54096
|
const data3 = await readResourceInfo(infoApi2, identity4.resourceId, {
|
|
53681
54097
|
isLoadLatestVersionInfo: 1,
|
|
53682
54098
|
isLoadPolicyInfo: 1
|
|
53683
54099
|
});
|
|
53684
|
-
|
|
53685
|
-
info: data3,
|
|
53686
|
-
resourceId: identity4.resourceId,
|
|
53687
|
-
authUserId: auth.userId
|
|
53688
|
-
});
|
|
53689
|
-
assertKnownShelfStatus(data3);
|
|
54100
|
+
assertShelfResource(data3, identity4.resourceId, auth.userId);
|
|
53690
54101
|
validateForOnline(data3);
|
|
53691
54102
|
return "\u53EF\u4EE5\u4E0A\u67B6";
|
|
53692
54103
|
}
|
|
@@ -53743,7 +54154,7 @@ async function beginDraftEdit(cwd, input3 = {}) {
|
|
|
53743
54154
|
const auth = requireAuth({ cwd, homeDir: input3.homeDir });
|
|
53744
54155
|
const identity4 = resolveBoundIdentity(cwd, input3.file);
|
|
53745
54156
|
const snapshot2 = readDraftSnapshot(cwd, identity4.n);
|
|
53746
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
54157
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
53747
54158
|
const assertLocal = () => {
|
|
53748
54159
|
const currentAuth2 = requireAuth({ cwd, homeDir: input3.homeDir });
|
|
53749
54160
|
if (currentAuth2.userId !== auth.userId) {
|
|
@@ -54718,7 +55129,7 @@ async function assertFileRules(input3) {
|
|
|
54718
55129
|
let response;
|
|
54719
55130
|
try {
|
|
54720
55131
|
response = await withStorageTimeout(
|
|
54721
|
-
() => (input3.apis?.getByCode ?? ((params) =>
|
|
55132
|
+
() => (input3.apis?.getByCode ?? ((params) => FServiceAPI2.Resource.getResourceTypeInfoByCode(params, {
|
|
54722
55133
|
timeout: 3e4,
|
|
54723
55134
|
signal: AbortSignal.timeout(3e4)
|
|
54724
55135
|
})))({ code: input3.typeCode }),
|
|
@@ -54815,7 +55226,7 @@ async function submitVersionLocked(input3) {
|
|
|
54815
55226
|
const apis2 = {
|
|
54816
55227
|
...input3.apis,
|
|
54817
55228
|
getByCode: (params) => typeInfo ??= Promise.resolve().then(
|
|
54818
|
-
() => input3.apis?.getByCode ? input3.apis.getByCode(params) :
|
|
55229
|
+
() => input3.apis?.getByCode ? input3.apis.getByCode(params) : FServiceAPI2.Resource.getResourceTypeInfoByCode(params)
|
|
54819
55230
|
)
|
|
54820
55231
|
};
|
|
54821
55232
|
await assertDraftOptionsAllowed({
|
|
@@ -54852,7 +55263,7 @@ async function submitVersionLocked(input3) {
|
|
|
54852
55263
|
version: input3.version,
|
|
54853
55264
|
draft
|
|
54854
55265
|
});
|
|
54855
|
-
const createVersion2 = input3.apis?.createVersion ?? ((params) =>
|
|
55266
|
+
const createVersion2 = input3.apis?.createVersion ?? ((params) => FServiceAPI2.Resource.createVersion(params));
|
|
54856
55267
|
const subjects = await assertDependencyDeclarations({
|
|
54857
55268
|
resourceId: input3.identity.resourceId,
|
|
54858
55269
|
dependencies: draft.dependencies ?? [],
|
|
@@ -54921,7 +55332,7 @@ async function submitVersionLocked(input3) {
|
|
|
54921
55332
|
});
|
|
54922
55333
|
if (currentUsage.some((id11) => !preparation.confirmedResourceIds.includes(id11)))
|
|
54923
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");
|
|
54924
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
55335
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
54925
55336
|
if (input3.identity.storageSource) {
|
|
54926
55337
|
if (draft.fileSha1 !== input3.identity.storageSource.sha1)
|
|
54927
55338
|
throw new CliError("\u5DE5\u4F5C\u7A3F\u6587\u4EF6\u4E0E\u5DF2\u9009\u5B58\u50A8\u6765\u6E90\u4E0D\u4E00\u81F4", "STORAGE_SOURCE_DRAFT_MISMATCH");
|
|
@@ -55003,7 +55414,7 @@ async function submitVersionLocked(input3) {
|
|
|
55003
55414
|
resourceId: input3.identity.resourceId,
|
|
55004
55415
|
authUserId: initialAuth.userId
|
|
55005
55416
|
});
|
|
55006
|
-
const readVersion = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
55417
|
+
const readVersion = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
55007
55418
|
const versionResponse = await readVersion({ resourceId: input3.identity.resourceId, version: input3.version });
|
|
55008
55419
|
assertSuccessfulResponse(versionResponse, "SUBMIT_VERIFY_FAILED", "\u53D1\u884C\u540E\u5B8C\u6574\u7248\u672C\u8BFB\u53D6\u5931\u8D25");
|
|
55009
55420
|
if (!matchesVersionPublication(publication, unwrapData(versionResponse), resource))
|
|
@@ -55184,7 +55595,7 @@ async function sha1OfFile(uploadPath) {
|
|
|
55184
55595
|
return { sha1: hash6.digest("hex"), fingerprint: fingerprint3 };
|
|
55185
55596
|
}
|
|
55186
55597
|
async function uploadIfNew(uploadPath, sha1, fingerprint3, apis2, assertActor2) {
|
|
55187
|
-
const fileIsExist2 = apis2.fileIsExist ?? ((params) =>
|
|
55598
|
+
const fileIsExist2 = apis2.fileIsExist ?? ((params) => FServiceAPI2.Storage.fileIsExist(params));
|
|
55188
55599
|
const response = await fileIsExist2({ sha1 });
|
|
55189
55600
|
const exists2 = unwrapFirst(response);
|
|
55190
55601
|
assertActor2();
|
|
@@ -55195,7 +55606,7 @@ async function uploadIfNew(uploadPath, sha1, fingerprint3, apis2, assertActor2)
|
|
|
55195
55606
|
assertFileUnchanged(uploadPath, fingerprint3);
|
|
55196
55607
|
return;
|
|
55197
55608
|
}
|
|
55198
|
-
const upload = apis2.uploadFile ?? ((params) =>
|
|
55609
|
+
const upload = apis2.uploadFile ?? ((params) => FServiceAPI2.Storage.uploadFile(params));
|
|
55199
55610
|
assertFileUnchanged(uploadPath, fingerprint3);
|
|
55200
55611
|
const filename = path25.basename(uploadPath);
|
|
55201
55612
|
const file3 = new File([await openAsBlob(uploadPath, { type: mimeForFilename(filename) })], filename, {
|
|
@@ -55429,7 +55840,7 @@ async function runCreateVersionLocked(input3) {
|
|
|
55429
55840
|
if (getEnv2() !== initialEnv || requireAuth(input3).userId !== auth.userId)
|
|
55430
55841
|
throw new CliError("\u6587\u4EF6\u51C6\u5907\u671F\u95F4\u8D26\u53F7\u6216\u73AF\u5883\u53D8\u5316", "SUBMIT_CONTEXT_CHANGED");
|
|
55431
55842
|
};
|
|
55432
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
55843
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
55433
55844
|
const info2 = unwrapData(
|
|
55434
55845
|
await infoApi2({
|
|
55435
55846
|
resourceIdOrName: identity4.resourceId,
|
|
@@ -55652,7 +56063,7 @@ async function assertCurrentResourceWritable(input3) {
|
|
|
55652
56063
|
if (!resourceId) {
|
|
55653
56064
|
throw new CliError("\u8BF7\u5148 create \u6216 bind", "DEP_NEED_SHELL");
|
|
55654
56065
|
}
|
|
55655
|
-
const infoApi2 = input3.apis?.ownInfo ?? ((params) =>
|
|
56066
|
+
const infoApi2 = input3.apis?.ownInfo ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
55656
56067
|
const response = await infoApi2({ ...input3.params, resourceIdOrName: resourceId });
|
|
55657
56068
|
const info2 = dependencyInfo(response, "DEP_CURRENT_INFO_INVALID");
|
|
55658
56069
|
assertRemoteResourceWritable({
|
|
@@ -55704,7 +56115,7 @@ async function loadDependencyTarget(input3) {
|
|
|
55704
56115
|
const value = rawSource.replace(/^(?:id:|name:)/, "");
|
|
55705
56116
|
if (byName ? !/^[^\s/:\p{Cc}\p{Cf}]+\/[^\s/:\p{Cc}\p{Cf}]+$/u.test(value) : !isContractId(value))
|
|
55706
56117
|
throw new CliError("\u8BF7\u63D0\u4F9B\u7CBE\u786E\u4F9D\u8D56ID\u6216\u5B8C\u6574username/name", "DEP_TARGET_INVALID");
|
|
55707
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
56118
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
55708
56119
|
const info2 = dependencyInfo(
|
|
55709
56120
|
await infoApi2({
|
|
55710
56121
|
resourceIdOrName: value,
|
|
@@ -55746,7 +56157,7 @@ async function loadDependencyTarget(input3) {
|
|
|
55746
56157
|
return { resourceId, latestVersion, subjectType };
|
|
55747
56158
|
}
|
|
55748
56159
|
async function assertDependencyVersionRange(input3) {
|
|
55749
|
-
const listApi = input3.apis?.getVersionListByResourceID ?? ((params) =>
|
|
56160
|
+
const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params));
|
|
55750
56161
|
const versions = await readDependencyVersions({
|
|
55751
56162
|
resourceId: input3.resourceId,
|
|
55752
56163
|
subjectType: input3.subjectType,
|
|
@@ -55773,7 +56184,7 @@ async function readPublishedDependencies(input3, resourceId, version2) {
|
|
|
55773
56184
|
if (typeof version2 !== "string" || !semver9.valid(version2))
|
|
55774
56185
|
throw new CliError("\u6CA1\u6709\u53EF\u8865\u7B7E\u7684\u5DF2\u53D1\u884C\u4F9D\u8D56\u6216\u5DE5\u4F5C\u7A3F", "DEP_NOT_FOUND");
|
|
55775
56186
|
const published = contractResponseData(
|
|
55776
|
-
await (input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
56187
|
+
await (input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params)))({
|
|
55777
56188
|
resourceId,
|
|
55778
56189
|
version: version2
|
|
55779
56190
|
})
|
|
@@ -55826,7 +56237,7 @@ async function mutateDependency(input3, mode2) {
|
|
|
55826
56237
|
existingRange: mode2 === "add" || target.subjectType === 4 ? existingRange : void 0,
|
|
55827
56238
|
prompts: input3.prompts,
|
|
55828
56239
|
reporter: input3.reporter,
|
|
55829
|
-
read: input3.apis?.getVersionListByResourceID ?? ((params) =>
|
|
56240
|
+
read: input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params))
|
|
55830
56241
|
});
|
|
55831
56242
|
const candidate = parseDependencyDeclarations(
|
|
55832
56243
|
[
|
|
@@ -55847,7 +56258,7 @@ async function mutateDependency(input3, mode2) {
|
|
|
55847
56258
|
await assertDependencyVersionRange({ ...retained, versionRange: dependency.versionRange, apis: input3.apis });
|
|
55848
56259
|
candidateTypes.set(retained.resourceId, retained.subjectType);
|
|
55849
56260
|
}
|
|
55850
|
-
const cycleApi = input3.apis?.cycleDependencyCheck ?? ((params) =>
|
|
56261
|
+
const cycleApi = input3.apis?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
|
|
55851
56262
|
const cycle = contractResponseData(await cycleApi({ resourceId: identity4.resourceId, dependencies: candidate }));
|
|
55852
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");
|
|
55853
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");
|
|
@@ -55981,7 +56392,7 @@ async function depSign(input3) {
|
|
|
55981
56392
|
prompts: input3.prompts,
|
|
55982
56393
|
reporter: input3.reporter,
|
|
55983
56394
|
readPolicies: async () => signingPoliciesFromInfo(
|
|
55984
|
-
await (input3.apis?.info ?? ((params) =>
|
|
56395
|
+
await (input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params)))({
|
|
55985
56396
|
resourceIdOrName: target.resourceId,
|
|
55986
56397
|
isLoadPolicyInfo: 1
|
|
55987
56398
|
}),
|
|
@@ -56004,7 +56415,7 @@ async function depRecover(input3) {
|
|
|
56004
56415
|
if (assertPlatformAllowed() !== env || requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir }).userId !== auth.userId || resolveRecoveryBoundIdentity(input3.cwd, input3.file).resourceId !== identity4.resourceId)
|
|
56005
56416
|
throw new CliError("\u6062\u590D\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316", "DEP_CONTEXT_CHANGED");
|
|
56006
56417
|
const own3 = dependencyInfo(
|
|
56007
|
-
await (input3.apis?.ownInfo ?? ((params) =>
|
|
56418
|
+
await (input3.apis?.ownInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
|
|
56008
56419
|
resourceIdOrName: identity4.resourceId
|
|
56009
56420
|
}),
|
|
56010
56421
|
"DEP_CURRENT_INFO_INVALID"
|
|
@@ -56245,10 +56656,10 @@ async function updateOnlineDescription(input3) {
|
|
|
56245
56656
|
const resourceId = identity4.resourceId;
|
|
56246
56657
|
const assertContext2 = resourceWriteContext(input3, identity4, auth.userId);
|
|
56247
56658
|
const output5 = input3.json ? "stderr" : void 0;
|
|
56248
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
56249
|
-
const listApi = input3.apis?.getVersionListByResourceID ?? ((params) =>
|
|
56250
|
-
const detailApi = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
56251
|
-
const updateApi2 = input3.apis?.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));
|
|
56252
56663
|
const writableInfo = async () => {
|
|
56253
56664
|
assertContext2();
|
|
56254
56665
|
const info3 = await readResourceInfo(infoApi2, resourceId, { isLoadLatestVersionInfo: 1 });
|
|
@@ -56547,7 +56958,7 @@ async function draftPullLocked(input3) {
|
|
|
56547
56958
|
assertPlatformAllowed();
|
|
56548
56959
|
const auth = requireAuth({ cwd: input3.cwd, homeDir: input3.homeDir });
|
|
56549
56960
|
const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
|
|
56550
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
56961
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
56551
56962
|
const info2 = unwrapData(
|
|
56552
56963
|
await infoApi2({
|
|
56553
56964
|
resourceIdOrName: identity4.resourceId,
|
|
@@ -56571,7 +56982,7 @@ async function draftPullLocked(input3) {
|
|
|
56571
56982
|
if (!want) {
|
|
56572
56983
|
throw new CliError("\u8FD8\u6CA1\u6709\u53D1\u884C\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "GATE_USE_CREATE");
|
|
56573
56984
|
}
|
|
56574
|
-
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
56985
|
+
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
56575
56986
|
const versionInfo = unwrapData(
|
|
56576
56987
|
await versionInfoApi({
|
|
56577
56988
|
resourceId: identity4.resourceId,
|
|
@@ -56665,7 +57076,7 @@ async function importStorageMetadata(input3) {
|
|
|
56665
57076
|
const readNameDefinition = async (key2) => {
|
|
56666
57077
|
try {
|
|
56667
57078
|
const raw = await withStorageTimeout(
|
|
56668
|
-
() => (input3.apis?.getAttrsInfoByKey ?? ((params) =>
|
|
57079
|
+
() => (input3.apis?.getAttrsInfoByKey ?? ((params) => FServiceAPI2.Resource.getAttrsInfoByKey(params, {
|
|
56669
57080
|
timeout: 3e4,
|
|
56670
57081
|
signal: AbortSignal.timeout(3e4)
|
|
56671
57082
|
})))({ key: key2 }),
|
|
@@ -56842,7 +57253,7 @@ async function importStorageMetadata(input3) {
|
|
|
56842
57253
|
});
|
|
56843
57254
|
dependencyTypes.set(target.resourceId, target.subjectType);
|
|
56844
57255
|
}
|
|
56845
|
-
const cycleApi = input3.dependencies?.cycleDependencyCheck ?? ((params) =>
|
|
57256
|
+
const cycleApi = input3.dependencies?.cycleDependencyCheck ?? ((params) => FServiceAPI2.Resource.cycleDependencyCheck(params));
|
|
56846
57257
|
const cycle = contractResponseData(
|
|
56847
57258
|
await cycleApi({ resourceId: edit.identity.resourceId, dependencies: candidate.dependencies })
|
|
56848
57259
|
);
|
|
@@ -57213,7 +57624,7 @@ async function showOnline(input3) {
|
|
|
57213
57624
|
}
|
|
57214
57625
|
const identity4 = resolveBoundIdentity(input3.cwd, input3.file);
|
|
57215
57626
|
const draft = readDraft(input3.cwd, identity4.n);
|
|
57216
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
57627
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
57217
57628
|
const info2 = unwrapData(
|
|
57218
57629
|
await infoApi2({
|
|
57219
57630
|
resourceIdOrName: identity4.resourceId,
|
|
@@ -57232,7 +57643,7 @@ async function showOnline(input3) {
|
|
|
57232
57643
|
if (typeof info2.latestVersion !== "string" || !info2.latestVersion) {
|
|
57233
57644
|
throw new CliError("\u7EBF\u4E0A\u8FD8\u6CA1\u6709\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "VERSION_NOT_FOUND");
|
|
57234
57645
|
}
|
|
57235
|
-
const listApi = input3.apis?.getVersionListByResourceID ?? ((params) =>
|
|
57646
|
+
const listApi = input3.apis?.getVersionListByResourceID ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params));
|
|
57236
57647
|
const versions = readPublishedVersionList(await listApi({ resourceId: identity4.resourceId }), info2.latestVersion, {
|
|
57237
57648
|
invalid: () => new CliError("\u7248\u672C\u5217\u8868\u65E0\u6548", "VERSION_LIST_INVALID"),
|
|
57238
57649
|
empty: () => new CliError("\u7EBF\u4E0A\u8FD8\u6CA1\u6709\u7248\u672C\uFF0C\u8BF7\u5148 create-version", "VERSION_NOT_FOUND"),
|
|
@@ -57248,7 +57659,7 @@ async function showOnline(input3) {
|
|
|
57248
57659
|
cancelled: () => new CliError("\u5DF2\u53D6\u6D88\u67E5\u770B\u7248\u672C", "SHOW_CANCELLED"),
|
|
57249
57660
|
missing: () => new CliError("\u6CA1\u6709\u8FD9\u4E2A\u7248\u672C", "VERSION_NOT_FOUND")
|
|
57250
57661
|
});
|
|
57251
|
-
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
57662
|
+
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
57252
57663
|
const versionResponse = await versionInfoApi({
|
|
57253
57664
|
resourceId: identity4.resourceId,
|
|
57254
57665
|
version: version2
|
|
@@ -57408,7 +57819,7 @@ async function runUpdateVersionLocked(input3) {
|
|
|
57408
57819
|
if (getEnv2() !== initialEnv || requireAuth(input3).userId !== auth.userId)
|
|
57409
57820
|
throw new CliError("\u6587\u4EF6\u51C6\u5907\u671F\u95F4\u8D26\u53F7\u6216\u73AF\u5883\u53D8\u5316", "SUBMIT_CONTEXT_CHANGED");
|
|
57410
57821
|
};
|
|
57411
|
-
const infoApi2 = input3.apis?.info ?? ((params) =>
|
|
57822
|
+
const infoApi2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
|
|
57412
57823
|
const info2 = unwrapData(
|
|
57413
57824
|
await infoApi2({
|
|
57414
57825
|
resourceIdOrName: identity4.resourceId,
|
|
@@ -57451,7 +57862,7 @@ async function runUpdateVersionLocked(input3) {
|
|
|
57451
57862
|
throw new CliError("\u8BF7\u5148\u786E\u8BA4\u4E22\u5F03\u5DE5\u4F5C\u7A3F", "RESET_CONFIRMATION_REQUIRED");
|
|
57452
57863
|
}
|
|
57453
57864
|
if (existingDraft) {
|
|
57454
|
-
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) =>
|
|
57865
|
+
const versionInfoApi = input3.apis?.resourceVersionInfo1 ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params));
|
|
57455
57866
|
const base = unwrapData(await versionInfoApi({ resourceId: identity4.resourceId, version: source }));
|
|
57456
57867
|
if (typeof base.fileSha1 !== "string" || !base.fileSha1) {
|
|
57457
57868
|
throw new CliError("\u6CA1\u6709\u8FD9\u4E2A\u7248\u672C", "DRAFT_VERSION_MISSING");
|
|
@@ -57480,7 +57891,7 @@ async function runUpdateVersionLocked(input3) {
|
|
|
57480
57891
|
if (!native && info2.subjectType !== 1)
|
|
57481
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");
|
|
57482
57893
|
const versionInfo = unwrapData(
|
|
57483
|
-
await (input3.apis?.resourceVersionInfo1 ?? ((p) =>
|
|
57894
|
+
await (input3.apis?.resourceVersionInfo1 ?? ((p) => FServiceAPI2.Resource.resourceVersionInfo1(p)))({
|
|
57484
57895
|
resourceId: identity4.resourceId,
|
|
57485
57896
|
version: source
|
|
57486
57897
|
})
|
|
@@ -57672,10 +58083,10 @@ var init_update_version = __esm({
|
|
|
57672
58083
|
});
|
|
57673
58084
|
|
|
57674
58085
|
// src/platform/pagination.ts
|
|
57675
|
-
function pageData(raw, page, code2) {
|
|
58086
|
+
function pageData(raw, page, code2, options2) {
|
|
57676
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)))
|
|
57677
58088
|
throw new CliError("\u5206\u9875\u7ED3\u679C\u4E0D\u5B8C\u6574\uFF0C\u5DF2\u505C\u6B62\u800C\u4E0D\u731C\u6D4B\u4E0B\u4E00\u9875", code2);
|
|
57678
|
-
if (page > 1 && (page - 1) * 50 >= Number(raw.totalItem))
|
|
58089
|
+
if (!options2?.sequential && page > 1 && (page - 1) * 50 >= Number(raw.totalItem))
|
|
57679
58090
|
throw new CliError("\u9875\u7801\u8D85\u51FA\u5F53\u524D\u5217\u8868\u8303\u56F4", "NODE_PAGE_INVALID");
|
|
57680
58091
|
return { rows: raw.dataList, total: Number(raw.totalItem) };
|
|
57681
58092
|
}
|
|
@@ -57694,10 +58105,12 @@ function pageNumber(raw = 1) {
|
|
|
57694
58105
|
throw new CliError("\u9875\u7801\u987B\u4E3A\u6B63\u6574\u6570", "NODE_PAGE_INVALID");
|
|
57695
58106
|
return value;
|
|
57696
58107
|
}
|
|
58108
|
+
var PAGE_OPTION_DESCRIPTION;
|
|
57697
58109
|
var init_pagination2 = __esm({
|
|
57698
58110
|
"src/core/pagination.ts"() {
|
|
57699
58111
|
"use strict";
|
|
57700
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";
|
|
57701
58114
|
}
|
|
57702
58115
|
});
|
|
57703
58116
|
|
|
@@ -57739,7 +58152,7 @@ async function searchMarket(input3) {
|
|
|
57739
58152
|
if (!["all", "resource", "collection"].includes(subject))
|
|
57740
58153
|
throw new CliError("\u5E02\u573A\u4E3B\u4F53\u7B5B\u9009\u65E0\u6548", "MARKET_SUBJECT_INVALID");
|
|
57741
58154
|
const raw = await request4(
|
|
57742
|
-
input3.apis?.resourceList ?? ((params) =>
|
|
58155
|
+
input3.apis?.resourceList ?? ((params) => FServiceAPI2.Resource.list(params)),
|
|
57743
58156
|
{
|
|
57744
58157
|
skip: (page - 1) * 50,
|
|
57745
58158
|
limit: 50,
|
|
@@ -57763,7 +58176,7 @@ async function showMarketResource(input3) {
|
|
|
57763
58176
|
assertPlatformAllowed();
|
|
57764
58177
|
const source = parseSource2(input3.source);
|
|
57765
58178
|
const raw = await request4(
|
|
57766
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
58179
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params)),
|
|
57767
58180
|
{
|
|
57768
58181
|
resourceIdOrName: source,
|
|
57769
58182
|
isLoadLatestVersionInfo: 1,
|
|
@@ -57779,7 +58192,7 @@ async function showMarketResource(input3) {
|
|
|
57779
58192
|
async function marketVersions(input3) {
|
|
57780
58193
|
if (input3.resource.subjectType === 4) return ["1.0.0"];
|
|
57781
58194
|
const raw = await request4(
|
|
57782
|
-
input3.apis?.resourceVersions ?? ((params) =>
|
|
58195
|
+
input3.apis?.resourceVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
|
|
57783
58196
|
{ resourceId: input3.resource.resourceId },
|
|
57784
58197
|
"MARKET_VERSIONS_INVALID"
|
|
57785
58198
|
);
|
|
@@ -57828,7 +58241,7 @@ async function listOwnedNodes(input3) {
|
|
|
57828
58241
|
const userId = requireAuth(input3).userId;
|
|
57829
58242
|
const page = pageNumber(input3.page);
|
|
57830
58243
|
const raw = await request4(
|
|
57831
|
-
input3.apis?.nodeList ?? ((params) =>
|
|
58244
|
+
input3.apis?.nodeList ?? ((params) => FServiceAPI2.Node.nodes(params)),
|
|
57832
58245
|
{ skip: (page - 1) * 50, limit: 50 },
|
|
57833
58246
|
"NODE_LIST_INVALID"
|
|
57834
58247
|
);
|
|
@@ -57842,7 +58255,7 @@ async function loadOwnedNode(input3) {
|
|
|
57842
58255
|
assertPlatformAllowed();
|
|
57843
58256
|
const userId = requireAuth(input3).userId, id11 = nodeId2(input3.node);
|
|
57844
58257
|
const raw = await request4(
|
|
57845
|
-
input3.apis?.nodeDetails ?? ((params) =>
|
|
58258
|
+
input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
|
|
57846
58259
|
{ nodeId: id11 },
|
|
57847
58260
|
"NODE_DETAIL_INVALID"
|
|
57848
58261
|
);
|
|
@@ -57918,7 +58331,7 @@ async function readPlan(input3) {
|
|
|
57918
58331
|
});
|
|
57919
58332
|
}
|
|
57920
58333
|
async function lookup(input3, params) {
|
|
57921
|
-
return request4(input3.apis?.nodeDetails ?? ((p) =>
|
|
58334
|
+
return request4(input3.apis?.nodeDetails ?? ((p) => FServiceAPI2.Node.details(p)), params, "NODE_LOOKUP_INVALID");
|
|
57922
58335
|
}
|
|
57923
58336
|
async function assertAvailable(input3, plan) {
|
|
57924
58337
|
for (const query of [{ nodeName: plan.nodeName }, { nodeDomain: plan.nodeDomain }]) {
|
|
@@ -58013,7 +58426,7 @@ ${JSON.stringify({ env: scope.env, userId: scope.userId, existingNodes: before.d
|
|
|
58013
58426
|
record21 = markRemoteOperationSending(scope, record21);
|
|
58014
58427
|
let acknowledged = false;
|
|
58015
58428
|
try {
|
|
58016
|
-
const raw = await (input3.apis?.nodeCreate ?? ((p) =>
|
|
58429
|
+
const raw = await (input3.apis?.nodeCreate ?? ((p) => FServiceAPI2.Node.create(p)))(plan);
|
|
58017
58430
|
const rejection = nodeWriteRejection(raw, "response");
|
|
58018
58431
|
if (rejection) throw new ApiResponseError("\u5E73\u53F0\u660E\u786E\u62D2\u7EDD\u521B\u5EFA\u8282\u70B9", raw, rejection.errCode);
|
|
58019
58432
|
const data3 = responseData2(raw, "NODE_CREATE_UNCONFIRMED");
|
|
@@ -58028,25 +58441,26 @@ ${JSON.stringify({ env: scope.env, userId: scope.userId, existingNodes: before.d
|
|
|
58028
58441
|
return result;
|
|
58029
58442
|
} catch (error3) {
|
|
58030
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
|
+
};
|
|
58031
58451
|
if (!acknowledged && rejected) {
|
|
58032
58452
|
try {
|
|
58033
58453
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
58034
58454
|
markRemoteOperationRejected(scope, record21, rejected);
|
|
58035
58455
|
} catch {
|
|
58036
|
-
throw
|
|
58037
|
-
`\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`,
|
|
58038
|
-
"NODE_CREATE_UNKNOWN"
|
|
58039
|
-
);
|
|
58456
|
+
throw unknown2();
|
|
58040
58457
|
}
|
|
58041
58458
|
throw new CliError(
|
|
58042
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`,
|
|
58043
58460
|
"NODE_CREATE_REJECTED"
|
|
58044
58461
|
);
|
|
58045
58462
|
}
|
|
58046
|
-
throw
|
|
58047
|
-
`\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`,
|
|
58048
|
-
"NODE_CREATE_UNKNOWN"
|
|
58049
|
-
);
|
|
58463
|
+
throw unknown2();
|
|
58050
58464
|
}
|
|
58051
58465
|
});
|
|
58052
58466
|
}
|
|
@@ -58128,8 +58542,8 @@ function parseNodeInfo(raw, userId) {
|
|
|
58128
58542
|
...base,
|
|
58129
58543
|
nodeDomain: raw.nodeDomain,
|
|
58130
58544
|
nodeShortDescription: optional("nodeShortDescription"),
|
|
58131
|
-
nodeLogo: optional("nodeLogo"),
|
|
58132
|
-
coverImage: optional("coverImage"),
|
|
58545
|
+
nodeLogo: raw.nodeLogo == null ? null : optional("nodeLogo"),
|
|
58546
|
+
coverImage: raw.coverImage == null ? null : optional("coverImage"),
|
|
58133
58547
|
nodeThemeId: optional("nodeThemeId"),
|
|
58134
58548
|
nodeSuspendInfo: raw.nodeSuspendInfo == null ? null : optional("nodeSuspendInfo"),
|
|
58135
58549
|
exhibitMatchTags: raw.exhibitMatchTags == null ? null : (() => {
|
|
@@ -58144,7 +58558,7 @@ async function readNodeInfo(input3) {
|
|
|
58144
58558
|
const scope = nodeOperationScope(input3);
|
|
58145
58559
|
const id11 = nodeId2(input3.node);
|
|
58146
58560
|
const raw = await request4(
|
|
58147
|
-
input3.apis?.nodeDetails ?? ((params) =>
|
|
58561
|
+
input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
|
|
58148
58562
|
{ nodeId: id11 },
|
|
58149
58563
|
"NODE_DETAIL_INVALID"
|
|
58150
58564
|
);
|
|
@@ -58183,39 +58597,6 @@ var init_writeResponse = __esm({
|
|
|
58183
58597
|
}
|
|
58184
58598
|
});
|
|
58185
58599
|
|
|
58186
|
-
// src/domain/node/pending.ts
|
|
58187
|
-
function isNodeRecoveryKind(kind) {
|
|
58188
|
-
return nodeRecoveryKinds.includes(kind);
|
|
58189
|
-
}
|
|
58190
|
-
function isExhibitRecoveryOperation(operation) {
|
|
58191
|
-
return operation.targetType === 2 && !["dependency-sign", "exhibit-create"].includes(operation.kind) && !isNodeRecoveryKind(operation.kind);
|
|
58192
|
-
}
|
|
58193
|
-
function operationNodeId(operation) {
|
|
58194
|
-
if (operation.targetType !== 2 || operation.kind === "node-create" || operation.kind === "exhibit-create")
|
|
58195
|
-
return null;
|
|
58196
|
-
const value = operation.kind === "exhibit-collection-create" || operation.kind === "node-source-sign" || operation.kind === "exhibit-source-sign" ? operation.targetId : operation.sourceId;
|
|
58197
|
-
if (!/^[1-9]\d*$/u.test(value) || !Number.isSafeInteger(Number(value)))
|
|
58198
|
-
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");
|
|
58199
|
-
return Number(value);
|
|
58200
|
-
}
|
|
58201
|
-
function assertNoNodePending(scope, nodeId3) {
|
|
58202
|
-
const found = listRemoteOperations(scope).find(({ operation }) => operationNodeId(operation) === nodeId3);
|
|
58203
|
-
if (found)
|
|
58204
|
-
throw new CliError(
|
|
58205
|
-
`\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}`,
|
|
58206
|
-
"REMOTE_OPERATION_PENDING"
|
|
58207
|
-
);
|
|
58208
|
-
}
|
|
58209
|
-
var nodeRecoveryKinds;
|
|
58210
|
-
var init_pending = __esm({
|
|
58211
|
-
"src/domain/node/pending.ts"() {
|
|
58212
|
-
"use strict";
|
|
58213
|
-
init_errors();
|
|
58214
|
-
init_remoteOperations();
|
|
58215
|
-
nodeRecoveryKinds = ["node-create", "node-info", "node-access", "node-delete"];
|
|
58216
|
-
}
|
|
58217
|
-
});
|
|
58218
|
-
|
|
58219
58600
|
// src/domain/node/update.ts
|
|
58220
58601
|
import { createHash as createHash21 } from "crypto";
|
|
58221
58602
|
function textChanges(input3) {
|
|
@@ -58241,7 +58622,7 @@ function textChanges(input3) {
|
|
|
58241
58622
|
}
|
|
58242
58623
|
async function uploadImage2(input3, bytes) {
|
|
58243
58624
|
try {
|
|
58244
|
-
const raw = await (input3.apis?.uploadImage ?? ((params) =>
|
|
58625
|
+
const raw = await (input3.apis?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params)))({
|
|
58245
58626
|
file: bytes
|
|
58246
58627
|
});
|
|
58247
58628
|
const data3 = responseData2(raw, "NODE_IMAGE_UPLOAD_FAILED");
|
|
@@ -58338,7 +58719,7 @@ async function updateNode(input3) {
|
|
|
58338
58719
|
let acknowledged = false;
|
|
58339
58720
|
try {
|
|
58340
58721
|
await verifiedWriteRequest(
|
|
58341
|
-
input3.apis?.setNodeInfo ?? ((params) =>
|
|
58722
|
+
input3.apis?.setNodeInfo ?? ((params) => FServiceAPI2.Node.setNodeInfo(params)),
|
|
58342
58723
|
body
|
|
58343
58724
|
);
|
|
58344
58725
|
acknowledged = true;
|
|
@@ -58467,7 +58848,7 @@ async function setNodeAccess(input3) {
|
|
|
58467
58848
|
};
|
|
58468
58849
|
let acknowledged = false, rejection, rejectionMessage;
|
|
58469
58850
|
try {
|
|
58470
|
-
const response = await (input3.apis?.setNodeInfo ?? ((params) =>
|
|
58851
|
+
const response = await (input3.apis?.setNodeInfo ?? ((params) => FServiceAPI2.Node.setNodeInfo(params)))(
|
|
58471
58852
|
request5
|
|
58472
58853
|
);
|
|
58473
58854
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
@@ -58532,7 +58913,7 @@ var init_access = __esm({
|
|
|
58532
58913
|
async function readDeletionState(input3, node2, scope) {
|
|
58533
58914
|
const id11 = nodeId2(node2);
|
|
58534
58915
|
const raw = await request4(
|
|
58535
|
-
input3.apis?.nodeDetails ?? ((params) =>
|
|
58916
|
+
input3.apis?.nodeDetails ?? ((params) => FServiceAPI2.Node.details(params)),
|
|
58536
58917
|
{ nodeId: id11 },
|
|
58537
58918
|
"NODE_DELETE_DETAIL_INVALID"
|
|
58538
58919
|
);
|
|
@@ -58544,7 +58925,7 @@ async function readDeletionState(input3, node2, scope) {
|
|
|
58544
58925
|
}
|
|
58545
58926
|
async function readFinancialAccount(input3, node2, scope) {
|
|
58546
58927
|
const raw = await request4(
|
|
58547
|
-
input3.apis?.financialAccountInfo ?? ((params) =>
|
|
58928
|
+
input3.apis?.financialAccountInfo ?? ((params) => FServiceAPI2.Payment.queryFinancialAccountInfo(params)),
|
|
58548
58929
|
{ accountType: 2, ownerId: node2 },
|
|
58549
58930
|
"NODE_DELETE_ACCOUNT_INVALID"
|
|
58550
58931
|
);
|
|
@@ -58569,12 +58950,12 @@ async function readExhibitIds(input3, node2, scope) {
|
|
|
58569
58950
|
let total;
|
|
58570
58951
|
for (let page = 1; total === void 0 || ids.length < total; page++) {
|
|
58571
58952
|
const raw = await request4(
|
|
58572
|
-
input3.apis?.presentableList ?? ((params) =>
|
|
58953
|
+
input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
|
|
58573
58954
|
{ nodeId: node2, skip: (page - 1) * 50, limit: 50, onlineStatus: 2 },
|
|
58574
58955
|
"NODE_DELETE_EXHIBITS_INVALID"
|
|
58575
58956
|
);
|
|
58576
58957
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
58577
|
-
const parsed = pageData(raw, page, "NODE_DELETE_EXHIBITS_INVALID");
|
|
58958
|
+
const parsed = pageData(raw, page, "NODE_DELETE_EXHIBITS_INVALID", { sequential: true });
|
|
58578
58959
|
if (total !== void 0 && total !== parsed.total)
|
|
58579
58960
|
throw new CliError("\u8282\u70B9\u5C55\u54C1\u603B\u91CF\u5728\u8BFB\u53D6\u671F\u95F4\u53D8\u5316", "NODE_DELETE_EXHIBITS_CHANGED");
|
|
58580
58961
|
total = parsed.total;
|
|
@@ -58680,20 +59061,23 @@ async function deleteOwnedNode(input3) {
|
|
|
58680
59061
|
nodeDeletePlan: plan
|
|
58681
59062
|
});
|
|
58682
59063
|
record21 = markRemoteOperationSending(scope, record21);
|
|
58683
|
-
let rejected,
|
|
58684
|
-
const unknown2 = () =>
|
|
58685
|
-
|
|
58686
|
-
|
|
58687
|
-
|
|
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
|
+
};
|
|
58688
59072
|
try {
|
|
58689
|
-
const response = await (input3.apis?.deleteNode ?? ((params) =>
|
|
59073
|
+
const response = await (input3.apis?.deleteNode ?? ((params) => FServiceAPI2.Node.deleteNode(params)))({
|
|
58690
59074
|
nodeId: id11
|
|
58691
59075
|
});
|
|
58692
59076
|
rejected = nodeWriteRejection(response, "response");
|
|
58693
|
-
|
|
59077
|
+
writeReason = platformResponseMessage(response);
|
|
58694
59078
|
} catch (error3) {
|
|
58695
59079
|
rejected = nodeWriteRejection(error3, "error");
|
|
58696
|
-
|
|
59080
|
+
writeReason = platformFailureMessage(error3, "");
|
|
58697
59081
|
}
|
|
58698
59082
|
if (rejected) {
|
|
58699
59083
|
try {
|
|
@@ -58703,7 +59087,7 @@ async function deleteOwnedNode(input3) {
|
|
|
58703
59087
|
throw unknown2();
|
|
58704
59088
|
}
|
|
58705
59089
|
throw new CliError(
|
|
58706
|
-
`\u5220\u9664\u8282\u70B9\u5931\u8D25\uFF1A${
|
|
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}`,
|
|
58707
59091
|
"NODE_DELETE_REJECTED"
|
|
58708
59092
|
);
|
|
58709
59093
|
}
|
|
@@ -58715,8 +59099,8 @@ async function deleteOwnedNode(input3) {
|
|
|
58715
59099
|
remoteDeleted = true;
|
|
58716
59100
|
closeRemoteOperation(scope, record21);
|
|
58717
59101
|
return { nodeId: id11, deleted: true, alreadyDeleted: false, deleteSent: true };
|
|
58718
|
-
} catch {
|
|
58719
|
-
throw unknown2();
|
|
59102
|
+
} catch (error3) {
|
|
59103
|
+
throw unknown2(error3);
|
|
58720
59104
|
}
|
|
58721
59105
|
});
|
|
58722
59106
|
}
|
|
@@ -58864,7 +59248,7 @@ async function readExhibit(input3) {
|
|
|
58864
59248
|
const scope = operationScope(input3);
|
|
58865
59249
|
try {
|
|
58866
59250
|
const raw = await request4(
|
|
58867
|
-
input3.apis?.presentableDetails ?? ((params) =>
|
|
59251
|
+
input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
|
|
58868
59252
|
{
|
|
58869
59253
|
presentableId: input3.exhibitId,
|
|
58870
59254
|
isLoadPolicyInfo: 1,
|
|
@@ -58894,7 +59278,7 @@ async function listExhibits(input3) {
|
|
|
58894
59278
|
const node2 = await loadOwnedNode(input3), page = pageNumber(input3.page), status = input3.status ?? "all";
|
|
58895
59279
|
if (!["all", "online", "offline"].includes(status)) throw new CliError("\u5C55\u54C1\u72B6\u6001\u7B5B\u9009\u65E0\u6548", "EXHIBIT_STATUS_INVALID");
|
|
58896
59280
|
const raw = await request4(
|
|
58897
|
-
input3.apis?.presentableList ?? ((params) =>
|
|
59281
|
+
input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
|
|
58898
59282
|
{
|
|
58899
59283
|
nodeId: node2.nodeId,
|
|
58900
59284
|
skip: (page - 1) * 50,
|
|
@@ -59035,7 +59419,7 @@ async function readExhibitAuthResult(input3, node2, exhibitId, invalidCode = "EX
|
|
|
59035
59419
|
reject(new CliError("\u5C55\u54C1\u6388\u6743\u67E5\u8BE2\u8D85\u65F6\uFF0C\u672A\u7EE7\u7EED\u64CD\u4F5C", invalidCode));
|
|
59036
59420
|
}, 3e4);
|
|
59037
59421
|
});
|
|
59038
|
-
const read2 = input3.apis?.batchAuth ?? ((p) =>
|
|
59422
|
+
const read2 = input3.apis?.batchAuth ?? ((p) => FServiceAPI2.Exhibit.batchAuth(p, {
|
|
59039
59423
|
timeout: 3e4,
|
|
59040
59424
|
signal: controller.signal
|
|
59041
59425
|
}));
|
|
@@ -59110,7 +59494,7 @@ function currentId(node2) {
|
|
|
59110
59494
|
}
|
|
59111
59495
|
async function readTheme(input3, id11, node2) {
|
|
59112
59496
|
const raw = await request4(
|
|
59113
|
-
input3.apis?.presentableDetails ?? ((params) =>
|
|
59497
|
+
input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
|
|
59114
59498
|
{
|
|
59115
59499
|
presentableId: exactId(id11),
|
|
59116
59500
|
isLoadPolicyInfo: 1,
|
|
@@ -59181,7 +59565,7 @@ async function listNodeThemes(input3) {
|
|
|
59181
59565
|
const active = currentId(node2);
|
|
59182
59566
|
const page = pageNumber(input3.page);
|
|
59183
59567
|
const raw = await request4(
|
|
59184
|
-
input3.apis?.presentableList ?? ((params) =>
|
|
59568
|
+
input3.apis?.presentableList ?? ((params) => FServiceAPI2.Exhibit.presentables(params)),
|
|
59185
59569
|
{
|
|
59186
59570
|
nodeId: node2.nodeId,
|
|
59187
59571
|
skip: (page - 1) * 50,
|
|
@@ -59223,7 +59607,7 @@ async function currentNodeTheme(input3) {
|
|
|
59223
59607
|
async function useNodeTheme(input3) {
|
|
59224
59608
|
const scope = operationScope(input3);
|
|
59225
59609
|
const raw = await request4(
|
|
59226
|
-
input3.apis?.presentableDetails ?? ((params) =>
|
|
59610
|
+
input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
|
|
59227
59611
|
{ presentableId: exactId(input3.exhibitId), isLoadPolicyInfo: 1, isLoadResourceDetailInfo: 1 },
|
|
59228
59612
|
"EXHIBIT_THEME_INVALID"
|
|
59229
59613
|
);
|
|
@@ -59277,7 +59661,7 @@ async function useNodeTheme(input3) {
|
|
|
59277
59661
|
oldObservation = result.previousTheme;
|
|
59278
59662
|
return result.state;
|
|
59279
59663
|
},
|
|
59280
|
-
send: input3.apis?.shelf ?? ((params) =>
|
|
59664
|
+
send: input3.apis?.shelf ?? ((params) => FServiceAPI2.Exhibit.presentablesOnlineStatus(params))
|
|
59281
59665
|
});
|
|
59282
59666
|
return {
|
|
59283
59667
|
exhibitId: input3.exhibitId,
|
|
@@ -59411,9 +59795,9 @@ function createNodeCommand() {
|
|
|
59411
59795
|
);
|
|
59412
59796
|
});
|
|
59413
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");
|
|
59414
|
-
nodeOptions(theme.command("list")).option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID\uFF1B\u4EA4\u4E92\u65F6\u53EF\u9009\u62E9").option("--page <n>",
|
|
59415
|
-
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) {
|
|
59416
59799
|
let page = pageNumber(options2.page);
|
|
59800
|
+
const node2 = await chooseNode2(this, options2.node);
|
|
59417
59801
|
for (; ; ) {
|
|
59418
59802
|
const data3 = await listNodeThemes({ ...nodeContext(this), node: node2, page });
|
|
59419
59803
|
output2(data3);
|
|
@@ -59438,7 +59822,7 @@ function createNodeCommand() {
|
|
|
59438
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) {
|
|
59439
59823
|
output2(await useNodeTheme({ ...nodeContext(this), exhibitId }));
|
|
59440
59824
|
});
|
|
59441
|
-
nodeOptions(root.command("list")).option("--page <n>",
|
|
59825
|
+
nodeOptions(root.command("list")).option("--page <n>", PAGE_OPTION_DESCRIPTION, "1").action(async function(options2) {
|
|
59442
59826
|
let page = pageNumber(options2.page);
|
|
59443
59827
|
for (; ; ) {
|
|
59444
59828
|
const data3 = await listOwnedNodes({ ...nodeContext(this), page });
|
|
@@ -59504,7 +59888,7 @@ var init_node3 = __esm({
|
|
|
59504
59888
|
import { Command as Command42 } from "commander";
|
|
59505
59889
|
function createMarketCommand() {
|
|
59506
59890
|
const root = nodeOptions(new Command42("market")).description("\u641C\u7D22\u5E73\u53F0\u4E0A\u67B6\u8D44\u6E90\u4E0E\u4F5C\u8005\u5408\u96C6");
|
|
59507
|
-
nodeOptions(root.command("search")).argument("[keywords]", "\u5173\u952E\u8BCD", "").option("--subject <subject>", "all/resource/collection", "all").option("--page <n>",
|
|
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) {
|
|
59508
59892
|
let page = pageNumber(options2.page);
|
|
59509
59893
|
for (; ; ) {
|
|
59510
59894
|
const data3 = await searchMarket({ keywords, subject: options2.subject, page });
|
|
@@ -59618,7 +60002,7 @@ async function setExhibitVersion(input3) {
|
|
|
59618
60002
|
const before = exhibitVersionState(observed, "version");
|
|
59619
60003
|
const versions = await readDependencyVersions({
|
|
59620
60004
|
resourceId: observed.resourceId,
|
|
59621
|
-
read: input3.apis?.resourceVersions ?? ((params) =>
|
|
60005
|
+
read: input3.apis?.resourceVersions ?? ((params) => FServiceAPI2.Resource.getVersionListByResourceID(params)),
|
|
59622
60006
|
invalidCode: "EXHIBIT_VERSIONS_INVALID"
|
|
59623
60007
|
});
|
|
59624
60008
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
@@ -59649,7 +60033,7 @@ async function setExhibitVersion(input3) {
|
|
|
59649
60033
|
expected: { ...before, version: version2 },
|
|
59650
60034
|
body: { presentableId: observed.presentableId, version: version2 },
|
|
59651
60035
|
read: read2,
|
|
59652
|
-
send: input3.apis?.setVersion ?? ((params) =>
|
|
60036
|
+
send: input3.apis?.setVersion ?? ((params) => FServiceAPI2.Exhibit.presentablesVersion(params)),
|
|
59653
60037
|
preview: {
|
|
59654
60038
|
\u5C55\u54C1: observed.presentableId,
|
|
59655
60039
|
\u539F\u5C55\u793A\u7248\u672C: observed.version,
|
|
@@ -59690,7 +60074,7 @@ async function setExhibitAutoUpdate(input3) {
|
|
|
59690
60074
|
expected: { ...before, autoUpdateStatus: input3.autoUpdateStatus },
|
|
59691
60075
|
body: { presentableId: observed.presentableId, autoUpdateStatus: input3.autoUpdateStatus },
|
|
59692
60076
|
read: read2,
|
|
59693
|
-
send: input3.apis?.updatePresentable ?? ((params) =>
|
|
60077
|
+
send: input3.apis?.updatePresentable ?? ((params) => FServiceAPI2.Exhibit.updatePresentable(params)),
|
|
59694
60078
|
preview: {
|
|
59695
60079
|
\u5C55\u54C1: observed.presentableId,
|
|
59696
60080
|
\u5F53\u524D\u5C55\u793A\u7248\u672C: observed.version,
|
|
@@ -59797,7 +60181,7 @@ async function readExhibitEditFacts(input3) {
|
|
|
59797
60181
|
const id11 = exactId(input3.exhibitId);
|
|
59798
60182
|
try {
|
|
59799
60183
|
const raw = await request4(
|
|
59800
|
-
input3.apis?.presentableDetails ?? ((params) =>
|
|
60184
|
+
input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
|
|
59801
60185
|
{
|
|
59802
60186
|
presentableId: id11,
|
|
59803
60187
|
isLoadPolicyInfo: 1,
|
|
@@ -59954,7 +60338,7 @@ async function updateExhibitInfo(input3) {
|
|
|
59954
60338
|
body: { presentableId: input3.exhibitId, ...changed },
|
|
59955
60339
|
expected: projectInfo(before, changed)
|
|
59956
60340
|
});
|
|
59957
|
-
const send = input3.apis?.updatePresentable ?? ((params) =>
|
|
60341
|
+
const send = input3.apis?.updatePresentable ?? ((params) => FServiceAPI2.Exhibit.updatePresentable(params));
|
|
59958
60342
|
const after = await runExhibitMutation(input3, {
|
|
59959
60343
|
exhibitId: input3.exhibitId,
|
|
59960
60344
|
node: before.exhibit.nodeId,
|
|
@@ -59980,7 +60364,7 @@ async function updateExhibitInfo(input3) {
|
|
|
59980
60364
|
prepare: async () => {
|
|
59981
60365
|
try {
|
|
59982
60366
|
uploadAttempted = true;
|
|
59983
|
-
const raw = await (input3.apis?.uploadImage ?? ((params) =>
|
|
60367
|
+
const raw = await (input3.apis?.uploadImage ?? ((params) => FServiceAPI2.Storage.uploadImage(params)))({
|
|
59984
60368
|
file: cover.bytes
|
|
59985
60369
|
});
|
|
59986
60370
|
assertActor2();
|
|
@@ -60230,7 +60614,7 @@ async function setExhibitProperties(input3) {
|
|
|
60230
60614
|
expected,
|
|
60231
60615
|
body: { presentableId: input3.exhibitId, rewriteProperty },
|
|
60232
60616
|
read: () => readExhibitEditFacts(input3),
|
|
60233
|
-
send: input3.apis?.updateRewriteProperty ?? ((params) =>
|
|
60617
|
+
send: input3.apis?.updateRewriteProperty ?? ((params) => FServiceAPI2.Exhibit.updateRewriteProperty(params)),
|
|
60234
60618
|
preview: {
|
|
60235
60619
|
action: "rewrite",
|
|
60236
60620
|
exhibitId: input3.exhibitId,
|
|
@@ -60299,7 +60683,7 @@ async function readExhibitAuthorization(input3) {
|
|
|
60299
60683
|
if (!ids.includes(exhibit2.resourceId)) throw invalid10();
|
|
60300
60684
|
const subjects = await readContractSubjects(
|
|
60301
60685
|
[...ids].sort(),
|
|
60302
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60686
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60303
60687
|
);
|
|
60304
60688
|
if (subjects.find((subject) => subject.id === exhibit2.resourceId).type !== exhibit2.subjectType) throw invalid10();
|
|
60305
60689
|
const contracts2 = await querySubjectContracts({
|
|
@@ -60348,7 +60732,7 @@ async function listExhibitAuthorization(input3) {
|
|
|
60348
60732
|
async function readPolicies2(input3, subject) {
|
|
60349
60733
|
let response;
|
|
60350
60734
|
try {
|
|
60351
|
-
response = await (input3.apis?.resourceInfo ?? ((params) =>
|
|
60735
|
+
response = await (input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params)))({
|
|
60352
60736
|
resourceIdOrName: subject.id,
|
|
60353
60737
|
isLoadPolicyInfo: 1
|
|
60354
60738
|
});
|
|
@@ -60364,7 +60748,7 @@ async function assertSigningSubject(input3, current2, resourceId) {
|
|
|
60364
60748
|
if (resourceId === current2.exhibit.resourceId) return { id: resourceId, type: current2.exhibit.subjectType };
|
|
60365
60749
|
let raw;
|
|
60366
60750
|
try {
|
|
60367
|
-
raw = await (input3.apis?.versionInfo ?? ((params) =>
|
|
60751
|
+
raw = await (input3.apis?.versionInfo ?? ((params) => FServiceAPI2.Resource.resourceVersionInfo1(params)))({
|
|
60368
60752
|
resourceId: current2.exhibit.resourceId,
|
|
60369
60753
|
version: current2.exhibit.version
|
|
60370
60754
|
});
|
|
@@ -60403,7 +60787,7 @@ async function signExhibitAuthorization(input3) {
|
|
|
60403
60787
|
await assertSigningSubject(input3, current2, input3.resourceId);
|
|
60404
60788
|
await assertContractSubjectsUnchanged(
|
|
60405
60789
|
before.subjects,
|
|
60406
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60790
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60407
60791
|
);
|
|
60408
60792
|
};
|
|
60409
60793
|
return signSourceContract({
|
|
@@ -60415,7 +60799,7 @@ async function signExhibitAuthorization(input3) {
|
|
|
60415
60799
|
readPolicies: () => readPolicies2(input3, subject),
|
|
60416
60800
|
verifySubject: () => assertContractSubjectsUnchanged(
|
|
60417
60801
|
before.subjects,
|
|
60418
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60802
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60419
60803
|
),
|
|
60420
60804
|
revalidate,
|
|
60421
60805
|
assertActor: () => assertNodeAccount(input3, scope.userId, scope.env)
|
|
@@ -60464,7 +60848,7 @@ async function changeExhibitAuthorization(input3) {
|
|
|
60464
60848
|
const current3 = await readExhibitAuthorization(input3);
|
|
60465
60849
|
await assertContractSubjectsUnchanged(
|
|
60466
60850
|
current3.subjects,
|
|
60467
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60851
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60468
60852
|
);
|
|
60469
60853
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
60470
60854
|
return current3;
|
|
@@ -60523,12 +60907,15 @@ async function changeExhibitAuthorization(input3) {
|
|
|
60523
60907
|
}
|
|
60524
60908
|
});
|
|
60525
60909
|
operation = markRemoteOperationSending(scope, operation);
|
|
60526
|
-
const unknown2 = () =>
|
|
60527
|
-
|
|
60528
|
-
|
|
60529
|
-
|
|
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
|
+
};
|
|
60530
60917
|
try {
|
|
60531
|
-
const response = await (input3.apis?.setAuthorizationRange ?? ((data3) =>
|
|
60918
|
+
const response = await (input3.apis?.setAuthorizationRange ?? ((data3) => FServiceAPI2.Exhibit.batchSetAuthorizationRange(data3)))(body);
|
|
60532
60919
|
const classification = classifyApiResponse(response);
|
|
60533
60920
|
if (classification.kind === "rejected") {
|
|
60534
60921
|
operation = markRemoteOperationRejected(scope, operation, {
|
|
@@ -60550,7 +60937,7 @@ async function changeExhibitAuthorization(input3) {
|
|
|
60550
60937
|
"EXHIBIT_AUTHORIZATION_REJECTED"
|
|
60551
60938
|
);
|
|
60552
60939
|
}
|
|
60553
|
-
throw unknown2();
|
|
60940
|
+
throw unknown2(error3);
|
|
60554
60941
|
}
|
|
60555
60942
|
let after;
|
|
60556
60943
|
try {
|
|
@@ -60558,8 +60945,8 @@ async function changeExhibitAuthorization(input3) {
|
|
|
60558
60945
|
if (authorizationPlanDigest(after.identity) !== authorizationPlanDigest(before.identity) || !after.state || authorizationPlanDigest(after.state) !== authorizationPlanDigest(plan.desired))
|
|
60559
60946
|
throw unknown2();
|
|
60560
60947
|
closeRemoteOperation(scope, operation);
|
|
60561
|
-
} catch {
|
|
60562
|
-
throw unknown2();
|
|
60948
|
+
} catch (error3) {
|
|
60949
|
+
throw unknown2(error3);
|
|
60563
60950
|
}
|
|
60564
60951
|
return {
|
|
60565
60952
|
exhibitId: input3.exhibitId,
|
|
@@ -60595,7 +60982,7 @@ async function recoverExhibitAuthorization(input3, record21) {
|
|
|
60595
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");
|
|
60596
60983
|
await assertContractSubjectsUnchanged(
|
|
60597
60984
|
fresh.subjects,
|
|
60598
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60985
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60599
60986
|
);
|
|
60600
60987
|
},
|
|
60601
60988
|
readPolicies: () => readPolicies2(input3, subject)
|
|
@@ -60606,7 +60993,7 @@ async function recoverExhibitAuthorization(input3, record21) {
|
|
|
60606
60993
|
throw new CliError("\u4E0D\u662F\u5C55\u54C1\u5E94\u7528\u8BB0\u5F55", "EXHIBIT_RECOVERY_INVALID");
|
|
60607
60994
|
await assertContractSubjectsUnchanged(
|
|
60608
60995
|
current2.subjects,
|
|
60609
|
-
input3.apis?.resourceInfo ?? ((params) =>
|
|
60996
|
+
input3.apis?.resourceInfo ?? ((params) => FServiceAPI2.Resource.info(params))
|
|
60610
60997
|
);
|
|
60611
60998
|
return {
|
|
60612
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)),
|
|
@@ -60674,12 +61061,12 @@ function parseCollection(raw, expectedId) {
|
|
|
60674
61061
|
sortDirection: direction === "collection_sort_descending" ? "descending" : "ascending"
|
|
60675
61062
|
};
|
|
60676
61063
|
}
|
|
60677
|
-
async function
|
|
61064
|
+
async function readCollectionWith(input3, collectionId, project2) {
|
|
60678
61065
|
const scope = operationScope(input3);
|
|
60679
61066
|
exactId(collectionId);
|
|
60680
61067
|
try {
|
|
60681
61068
|
const raw = await request4(
|
|
60682
|
-
input3.apis?.presentableDetails ?? ((p) =>
|
|
61069
|
+
input3.apis?.presentableDetails ?? ((p) => FServiceAPI2.Exhibit.presentableDetails(p)),
|
|
60683
61070
|
{
|
|
60684
61071
|
presentableId: collectionId,
|
|
60685
61072
|
isLoadPolicyInfo: 1,
|
|
@@ -60693,18 +61080,40 @@ async function readCollection(input3, collectionId) {
|
|
|
60693
61080
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
60694
61081
|
const collection = parseCollection(raw, collectionId);
|
|
60695
61082
|
await loadOwnedNode({ ...input3, node: collection.exhibit.nodeId });
|
|
60696
|
-
return collection;
|
|
61083
|
+
return project2(collection, raw);
|
|
60697
61084
|
} finally {
|
|
60698
61085
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
60699
61086
|
}
|
|
60700
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
|
+
}
|
|
60701
61110
|
async function listExhibitCollections(input3) {
|
|
60702
61111
|
const scope = operationScope(input3);
|
|
60703
61112
|
try {
|
|
60704
61113
|
const node2 = await loadOwnedNode(input3);
|
|
60705
61114
|
const page = pageNumber(input3.page);
|
|
60706
61115
|
const raw = await request4(
|
|
60707
|
-
input3.apis?.presentableList ?? ((p) =>
|
|
61116
|
+
input3.apis?.presentableList ?? ((p) => FServiceAPI2.Exhibit.presentables(p)),
|
|
60708
61117
|
{
|
|
60709
61118
|
nodeId: node2.nodeId,
|
|
60710
61119
|
subjectType: 5,
|
|
@@ -60745,7 +61154,7 @@ async function listExhibitCollectionTypes(input3) {
|
|
|
60745
61154
|
}
|
|
60746
61155
|
async function readExhibitCollectionTypes(input3) {
|
|
60747
61156
|
const raw = await request4(
|
|
60748
|
-
input3.apis?.resourceTypes ?? ((p) =>
|
|
61157
|
+
input3.apis?.resourceTypes ?? ((p) => FServiceAPI2.Resource.resourceTypes(p)),
|
|
60749
61158
|
{ category: 1, status: 1, subjectType: 5 },
|
|
60750
61159
|
"EXHIBIT_COLLECTION_TYPE_INVALID"
|
|
60751
61160
|
);
|
|
@@ -60772,7 +61181,7 @@ async function resolveExhibitCollectionType(input3, code2) {
|
|
|
60772
61181
|
const tree = await readExhibitCollectionTypes(input3);
|
|
60773
61182
|
const selected = leaves(tree).find((node2) => node2.code === code2.trim());
|
|
60774
61183
|
const raw = await request4(
|
|
60775
|
-
input3.apis?.getTypeInfo ?? ((p) =>
|
|
61184
|
+
input3.apis?.getTypeInfo ?? ((p) => FServiceAPI2.Resource.getResourceTypeInfoByCode(p)),
|
|
60776
61185
|
{ code: code2.trim() },
|
|
60777
61186
|
"EXHIBIT_COLLECTION_TYPE_INVALID"
|
|
60778
61187
|
);
|
|
@@ -60842,7 +61251,7 @@ var init_types = __esm({
|
|
|
60842
61251
|
// src/domain/exhibit/collection/create.ts
|
|
60843
61252
|
async function lookup2(input3, plan) {
|
|
60844
61253
|
return request4(
|
|
60845
|
-
input3.apis?.presentableDetails ?? ((p) =>
|
|
61254
|
+
input3.apis?.presentableDetails ?? ((p) => FServiceAPI2.Exhibit.presentableDetails(p)),
|
|
60846
61255
|
{
|
|
60847
61256
|
nodeId: plan.nodeId,
|
|
60848
61257
|
presentableName: plan.presentableName,
|
|
@@ -60933,7 +61342,7 @@ async function createExhibitCollection(input3) {
|
|
|
60933
61342
|
let acknowledged = false;
|
|
60934
61343
|
try {
|
|
60935
61344
|
const data3 = await verifiedWriteRequest(
|
|
60936
|
-
input3.apis?.createCollection ?? ((p) =>
|
|
61345
|
+
input3.apis?.createCollection ?? ((p) => FServiceAPI2.Exhibit.createPresentableCollection(p)),
|
|
60937
61346
|
plan
|
|
60938
61347
|
);
|
|
60939
61348
|
acknowledged = true;
|
|
@@ -60952,21 +61361,22 @@ async function createExhibitCollection(input3) {
|
|
|
60952
61361
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
60953
61362
|
markRemoteOperationRejected(scope, record21, error3.rejection);
|
|
60954
61363
|
} catch {
|
|
60955
|
-
throw unknown(record21);
|
|
61364
|
+
throw unknown(record21, error3);
|
|
60956
61365
|
}
|
|
60957
61366
|
throw new CliError(
|
|
60958
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`,
|
|
60959
61368
|
"EXHIBIT_COLLECTION_CREATE_REJECTED"
|
|
60960
61369
|
);
|
|
60961
61370
|
}
|
|
60962
|
-
throw unknown(record21);
|
|
61371
|
+
throw unknown(record21, error3);
|
|
60963
61372
|
}
|
|
60964
61373
|
})
|
|
60965
61374
|
);
|
|
60966
61375
|
}
|
|
60967
|
-
function unknown(record21) {
|
|
61376
|
+
function unknown(record21, cause) {
|
|
61377
|
+
const reason = platformFailureMessage(cause, "");
|
|
60968
61378
|
return new CliError(
|
|
60969
|
-
`\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`,
|
|
60970
61380
|
"EXHIBIT_COLLECTION_CREATE_UNKNOWN"
|
|
60971
61381
|
);
|
|
60972
61382
|
}
|
|
@@ -61060,10 +61470,13 @@ async function collectionMutation(input3, plan) {
|
|
|
61060
61470
|
collectionSelectionIds: selections
|
|
61061
61471
|
});
|
|
61062
61472
|
record21 = markRemoteOperationSending(scope, record21);
|
|
61063
|
-
const unknown2 = () =>
|
|
61064
|
-
|
|
61065
|
-
|
|
61066
|
-
|
|
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
|
+
};
|
|
61067
61480
|
let acknowledged = false;
|
|
61068
61481
|
try {
|
|
61069
61482
|
const data3 = await verifiedWriteRequest(plan.send, plan.body);
|
|
@@ -61087,14 +61500,14 @@ async function collectionMutation(input3, plan) {
|
|
|
61087
61500
|
assertNodeAccount(input3, scope.userId, scope.env);
|
|
61088
61501
|
markRemoteOperationRejected(scope, record21, error3.rejection);
|
|
61089
61502
|
} catch {
|
|
61090
|
-
throw unknown2();
|
|
61503
|
+
throw unknown2(error3);
|
|
61091
61504
|
}
|
|
61092
61505
|
throw new CliError(
|
|
61093
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`,
|
|
61094
61507
|
"EXHIBIT_COLLECTION_WRITE_REJECTED"
|
|
61095
61508
|
);
|
|
61096
61509
|
}
|
|
61097
|
-
throw unknown2();
|
|
61510
|
+
throw unknown2(error3);
|
|
61098
61511
|
}
|
|
61099
61512
|
})
|
|
61100
61513
|
);
|
|
@@ -61160,7 +61573,7 @@ function uniqueItems(items) {
|
|
|
61160
61573
|
}
|
|
61161
61574
|
async function itemPage(input3, id11, node2, page, keywords, sortType = 1) {
|
|
61162
61575
|
const data3 = await request4(
|
|
61163
|
-
input3.apis?.collectionItems ?? ((params) =>
|
|
61576
|
+
input3.apis?.collectionItems ?? ((params) => FServiceAPI2.Exhibit.getItemsFromPresentableCollection(params)),
|
|
61164
61577
|
{
|
|
61165
61578
|
presentableId: id11,
|
|
61166
61579
|
skip: (page - 1) * 50,
|
|
@@ -61232,7 +61645,7 @@ async function listCollectionItems(input3) {
|
|
|
61232
61645
|
let auth = /* @__PURE__ */ new Map();
|
|
61233
61646
|
if (items.length) {
|
|
61234
61647
|
const data3 = await request4(
|
|
61235
|
-
input3.apis?.batchAuth ?? ((params) =>
|
|
61648
|
+
input3.apis?.batchAuth ?? ((params) => FServiceAPI2.Exhibit.batchAuth(params)),
|
|
61236
61649
|
{ nodeId: exhibit2.nodeId, authType: 3, presentableIds: items.map((item) => item.exhibitId).join(",") },
|
|
61237
61650
|
"EXHIBIT_COLLECTION_AUTH_INVALID"
|
|
61238
61651
|
);
|
|
@@ -61272,7 +61685,7 @@ function collectionSelection(ids, code2) {
|
|
|
61272
61685
|
}
|
|
61273
61686
|
async function assertMember(input3, id11, node2) {
|
|
61274
61687
|
const raw = await request4(
|
|
61275
|
-
input3.apis?.presentableDetails ?? ((params) =>
|
|
61688
|
+
input3.apis?.presentableDetails ?? ((params) => FServiceAPI2.Exhibit.presentableDetails(params)),
|
|
61276
61689
|
{ presentableId: id11, isLoadPolicyInfo: 1, isLoadResourceDetailInfo: 1 },
|
|
61277
61690
|
"EXHIBIT_COLLECTION_MEMBER_INVALID"
|
|
61278
61691
|
);
|
|
@@ -61314,7 +61727,7 @@ async function addCollectionItems(input3) {
|
|
|
61314
61727
|
beforeSend: async () => {
|
|
61315
61728
|
await assertMembers(input3, selected, directory2.nodeId, assertActor2);
|
|
61316
61729
|
},
|
|
61317
|
-
send: input3.apis?.addCollectionItems ?? ((params) =>
|
|
61730
|
+
send: input3.apis?.addCollectionItems ?? ((params) => FServiceAPI2.Exhibit.addItemsToPresentableCollection(params)),
|
|
61318
61731
|
body: {
|
|
61319
61732
|
presentableId: input3.collectionId,
|
|
61320
61733
|
addCollectionItems: added.map((presentableId) => ({ presentableId }))
|
|
@@ -61357,7 +61770,7 @@ async function removeCollectionItems(input3) {
|
|
|
61357
61770
|
before,
|
|
61358
61771
|
expected: { ...before, items: before.items.filter((item) => !selected.includes(item.itemId)) },
|
|
61359
61772
|
read: () => readCollectionRemovalState(input3, input3.collectionId),
|
|
61360
|
-
send: input3.apis?.removeCollectionItems ?? ((params) =>
|
|
61773
|
+
send: input3.apis?.removeCollectionItems ?? ((params) => FServiceAPI2.Exhibit.removeItemsFromPresentableCollection(params)),
|
|
61361
61774
|
body: { presentableId: input3.collectionId, removeIds: selected.join(","), idType: "itemId" }
|
|
61362
61775
|
});
|
|
61363
61776
|
});
|
|
@@ -61417,7 +61830,7 @@ async function moveCollectionItems(input3) {
|
|
|
61417
61830
|
before,
|
|
61418
61831
|
expected: { ...before, itemIds },
|
|
61419
61832
|
read: () => readCollectionOrderState(input3, input3.collectionId),
|
|
61420
|
-
send: input3.apis?.manualSort ?? ((params) =>
|
|
61833
|
+
send: input3.apis?.manualSort ?? ((params) => FServiceAPI2.Exhibit.setItemsSortFromPresentableCollectionManual(params)),
|
|
61421
61834
|
body: { presentableId: input3.collectionId, itemIds: moving, targetSortId: input3.position }
|
|
61422
61835
|
});
|
|
61423
61836
|
});
|
|
@@ -61455,7 +61868,7 @@ async function quickSortCollectionItems(input3) {
|
|
|
61455
61868
|
exhibitIds: observed.items.map((item) => item.exhibitId).sort()
|
|
61456
61869
|
};
|
|
61457
61870
|
},
|
|
61458
|
-
send: input3.apis?.quickSort ?? ((params) =>
|
|
61871
|
+
send: input3.apis?.quickSort ?? ((params) => FServiceAPI2.Exhibit.setItemsSortFromPresentableCollectionQuick(params)),
|
|
61459
61872
|
body: {
|
|
61460
61873
|
presentableId: input3.collectionId,
|
|
61461
61874
|
sortField: field,
|
|
@@ -61481,7 +61894,7 @@ async function setCollectionDirection(input3) {
|
|
|
61481
61894
|
before,
|
|
61482
61895
|
expected: { ...before, direction: input3.direction },
|
|
61483
61896
|
read: () => readCollectionDirectionState(input3, input3.collectionId),
|
|
61484
|
-
send: input3.apis?.updateCollection ?? ((params) =>
|
|
61897
|
+
send: input3.apis?.updateCollection ?? ((params) => FServiceAPI2.Exhibit.updatePresentableCollection(params)),
|
|
61485
61898
|
body: {
|
|
61486
61899
|
presentableId: input3.collectionId,
|
|
61487
61900
|
catalogueProperty: { collection_sort_list: `collection_sort_${input3.direction}` }
|
|
@@ -61580,7 +61993,7 @@ async function readCollectionRuleState(input3, collectionId) {
|
|
|
61580
61993
|
try {
|
|
61581
61994
|
const { exhibit: exhibit2 } = await readCollection(input3, collectionId);
|
|
61582
61995
|
const raw = await request4(
|
|
61583
|
-
input3.apis?.getCollectRule ?? ((params) =>
|
|
61996
|
+
input3.apis?.getCollectRule ?? ((params) => FServiceAPI2.Exhibit.getItemsAutoCollectRule(params)),
|
|
61584
61997
|
{ presentableId: collectionId },
|
|
61585
61998
|
INVALID2
|
|
61586
61999
|
);
|
|
@@ -61611,7 +62024,7 @@ async function saveRule(input3, rule, original, assertActor2) {
|
|
|
61611
62024
|
if (rule.status === 1) await validateTypes(input3, rule);
|
|
61612
62025
|
return readCollectionRuleState(input3, input3.collectionId);
|
|
61613
62026
|
},
|
|
61614
|
-
send: input3.apis?.setCollectRule ?? ((params) =>
|
|
62027
|
+
send: input3.apis?.setCollectRule ?? ((params) => FServiceAPI2.Exhibit.setItemsAutoCollectRule(params)),
|
|
61615
62028
|
body: { presentableId: input3.collectionId, ...rule }
|
|
61616
62029
|
});
|
|
61617
62030
|
}
|
|
@@ -61738,8 +62151,9 @@ async function writeExhibit(input3, previous, intent, body, write, matches3, bef
|
|
|
61738
62151
|
"EXHIBIT_WRITE_REJECTED"
|
|
61739
62152
|
);
|
|
61740
62153
|
}
|
|
62154
|
+
const reason = error3 instanceof CliError ? safePlatformMessage(error3.message) : platformFailureMessage(error3, "");
|
|
61741
62155
|
throw new CliError(
|
|
61742
|
-
`\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`,
|
|
61743
62157
|
"EXHIBIT_WRITE_UNKNOWN"
|
|
61744
62158
|
);
|
|
61745
62159
|
}
|
|
@@ -61764,7 +62178,7 @@ async function setExhibitPolicy(input3) {
|
|
|
61764
62178
|
previousIds: exhibit2.policies.map((p) => p.policyId)
|
|
61765
62179
|
},
|
|
61766
62180
|
{ presentableId: exhibit2.presentableId, updatePolicies: [{ policyId: policy.policyId, status: input3.status }] },
|
|
61767
|
-
input3.apis?.updatePresentable ?? ((p) =>
|
|
62181
|
+
input3.apis?.updatePresentable ?? ((p) => FServiceAPI2.Exhibit.updatePresentable(p)),
|
|
61768
62182
|
(fresh) => fresh.policies.some((p) => p.policyId === policy.policyId && p.status === input3.status)
|
|
61769
62183
|
);
|
|
61770
62184
|
return { exhibitId: exhibit2.presentableId, policyId: policy.policyId, status: input3.status, reused: false };
|
|
@@ -61792,7 +62206,7 @@ async function shelfExhibit(input3) {
|
|
|
61792
62206
|
exhibit2,
|
|
61793
62207
|
{ kind: "exhibit-shelf", onlineStatus: input3.onlineStatus, policyIds: [], previousIds: [] },
|
|
61794
62208
|
{ presentableId: exhibit2.presentableId, onlineStatus: input3.onlineStatus },
|
|
61795
|
-
input3.apis?.shelf ?? ((p) =>
|
|
62209
|
+
input3.apis?.shelf ?? ((p) => FServiceAPI2.Exhibit.presentablesOnlineStatus(p)),
|
|
61796
62210
|
(fresh) => fresh.onlineStatus === input3.onlineStatus,
|
|
61797
62211
|
input3.onlineStatus === 1 ? (fresh) => assertExhibitAuthorized(input3, fresh.nodeId, fresh.presentableId) : void 0
|
|
61798
62212
|
);
|
|
@@ -61899,7 +62313,7 @@ async function exhibitTemplates(input3) {
|
|
|
61899
62313
|
const exhibit2 = await readExhibit(input3);
|
|
61900
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");
|
|
61901
62315
|
const raw = await request4(
|
|
61902
|
-
input3.apis?.templates ?? ((p) =>
|
|
62316
|
+
input3.apis?.templates ?? ((p) => FServiceAPI2.Policy.policyTemplates(p)),
|
|
61903
62317
|
{ resourceTypeCodes4Presentable: [exhibit2.resourceTypeCode] },
|
|
61904
62318
|
"EXHIBIT_TEMPLATES_INVALID"
|
|
61905
62319
|
);
|
|
@@ -61934,8 +62348,8 @@ async function applyExhibitTemplate(input3) {
|
|
|
61934
62348
|
params: input3.params,
|
|
61935
62349
|
requireEveryParam: !input3.interactive,
|
|
61936
62350
|
// 保留真实成功/失败信封交给共享模板模型,不先解包再伪装成裸data。
|
|
61937
|
-
reCompile: input3.apis?.reCompile ?? ((p) =>
|
|
61938
|
-
translate: input3.apis?.translate ?? ((p) =>
|
|
62351
|
+
reCompile: input3.apis?.reCompile ?? ((p) => FServiceAPI2.Policy.policyReCompile(p)),
|
|
62352
|
+
translate: input3.apis?.translate ?? ((p) => FServiceAPI2.Policy.policyTranslation(p))
|
|
61939
62353
|
},
|
|
61940
62354
|
{
|
|
61941
62355
|
ownerId: exhibit2.nodeId,
|
|
@@ -61962,7 +62376,7 @@ async function applyExhibitTemplate(input3) {
|
|
|
61962
62376
|
presentableId: exhibit2.presentableId,
|
|
61963
62377
|
addPolicies: [{ policyName: input3.name, policyText: compiled.policyText, status: 1 }]
|
|
61964
62378
|
},
|
|
61965
|
-
input3.apis?.updatePresentable ?? ((p) =>
|
|
62379
|
+
input3.apis?.updatePresentable ?? ((p) => FServiceAPI2.Exhibit.updatePresentable(p)),
|
|
61966
62380
|
(fresh) => fresh.policies.filter(
|
|
61967
62381
|
(p) => !exhibit2.policies.some((old) => old.policyId === p.policyId) && p.policyName === input3.name && p.policyText === compiled.policyText && p.status === 1
|
|
61968
62382
|
).length === 1,
|
|
@@ -62017,20 +62431,21 @@ function createExhibitCollectionCommand() {
|
|
|
62017
62431
|
await createExhibitCollection({ ...nodeContext(this), ...options2, node: await chooseNode2(this, options2.node) })
|
|
62018
62432
|
);
|
|
62019
62433
|
});
|
|
62020
|
-
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>",
|
|
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);
|
|
62021
62436
|
output2(
|
|
62022
62437
|
await listExhibitCollections({
|
|
62023
62438
|
...nodeContext(this),
|
|
62024
62439
|
node: await chooseNode2(this, options2.node),
|
|
62025
|
-
page
|
|
62440
|
+
page
|
|
62026
62441
|
})
|
|
62027
62442
|
);
|
|
62028
62443
|
});
|
|
62029
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) {
|
|
62030
|
-
output2(await
|
|
62445
|
+
output2(await readCollectionDetails(nodeContext(this), collectionId));
|
|
62031
62446
|
});
|
|
62032
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");
|
|
62033
|
-
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>",
|
|
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) {
|
|
62034
62449
|
output2(
|
|
62035
62450
|
await listCollectionItems({
|
|
62036
62451
|
...nodeContext(this),
|
|
@@ -62299,9 +62714,9 @@ function createExhibitCommand() {
|
|
|
62299
62714
|
throw new CliError("--on \u4E0E --off \u5FC5\u987B\u4E14\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A", "EXHIBIT_AUTO_UPDATE_REQUIRED");
|
|
62300
62715
|
output2(await setExhibitAutoUpdate({ ...nodeContext(this), exhibitId, autoUpdateStatus: options2.on ? 1 : 0 }));
|
|
62301
62716
|
});
|
|
62302
|
-
nodeOptions(root.command("list")).option("--node <id>").option("--page <n>",
|
|
62303
|
-
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) {
|
|
62304
62718
|
let page = pageNumber(options2.page);
|
|
62719
|
+
const node2 = await chooseNode2(this, options2.node);
|
|
62305
62720
|
for (; ; ) {
|
|
62306
62721
|
const data3 = await listExhibits({ ...nodeContext(this), node: node2, page, status: options2.status });
|
|
62307
62722
|
output2(data3);
|
|
@@ -63359,10 +63774,10 @@ var init_service5 = __esm({
|
|
|
63359
63774
|
init_store2();
|
|
63360
63775
|
init_browser();
|
|
63361
63776
|
defaults2 = {
|
|
63362
|
-
contractDetails: (params, config) =>
|
|
63363
|
-
contractsTransitionRecord: (params, config) =>
|
|
63364
|
-
availablePaymentMethods: (params, config) =>
|
|
63365
|
-
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)
|
|
63366
63781
|
};
|
|
63367
63782
|
}
|
|
63368
63783
|
});
|
|
@@ -63853,7 +64268,7 @@ async function runCli(argv, options2 = {}) {
|
|
|
63853
64268
|
{ writeOut: (v) => frameworkOut.push(v), writeErr: (v) => frameworkErr.push(v) },
|
|
63854
64269
|
observe2
|
|
63855
64270
|
);
|
|
63856
|
-
await program.parseAsync(argv, { from: options2.from ?? "user" });
|
|
64271
|
+
await withAuthModuleRequests(() => program.parseAsync(argv, { from: options2.from ?? "user" }));
|
|
63857
64272
|
flushFramework();
|
|
63858
64273
|
return Number(process.exitCode ?? 0);
|
|
63859
64274
|
} catch (error3) {
|
|
@@ -63894,6 +64309,7 @@ var init_program = __esm({
|
|
|
63894
64309
|
init_resolve();
|
|
63895
64310
|
init_dist();
|
|
63896
64311
|
init_authModuleHost();
|
|
64312
|
+
init_authModuleRequests();
|
|
63897
64313
|
init_moduleRegistration();
|
|
63898
64314
|
}
|
|
63899
64315
|
});
|