openclaw-telegram-manager 1.3.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/commands/archive.js +3 -3
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/doctor-all.d.ts.map +1 -1
- package/dist/commands/doctor-all.js +2 -2
- package/dist/commands/doctor-all.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +3 -7
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +47 -138
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/rename.d.ts +1 -1
- package/dist/commands/rename.d.ts.map +1 -1
- package/dist/commands/rename.js +22 -70
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/snooze.js +1 -1
- package/dist/commands/snooze.js.map +1 -1
- package/dist/commands/upgrade.js +4 -4
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/capsule.d.ts +8 -2
- package/dist/lib/capsule.d.ts.map +1 -1
- package/dist/lib/capsule.js +25 -19
- package/dist/lib/capsule.js.map +1 -1
- package/dist/lib/include-generator.d.ts +4 -1
- package/dist/lib/include-generator.d.ts.map +1 -1
- package/dist/lib/include-generator.js +7 -4
- package/dist/lib/include-generator.js.map +1 -1
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +11 -2
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/security.d.ts +2 -11
- package/dist/lib/security.d.ts.map +1 -1
- package/dist/lib/security.js +9 -29
- package/dist/lib/security.js.map +1 -1
- package/dist/lib/telegram.d.ts +5 -9
- package/dist/lib/telegram.d.ts.map +1 -1
- package/dist/lib/telegram.js +13 -21
- package/dist/lib/telegram.js.map +1 -1
- package/dist/lib/types.d.ts +9 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +15 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/plugin.js +644 -756
- package/dist/setup.js +1 -1
- package/dist/tool.js +6 -9
- package/dist/tool.js.map +1 -1
- package/package.json +1 -1
- package/skills/tm/SKILL.md +2 -2
package/dist/plugin.js
CHANGED
|
@@ -60,54 +60,54 @@ var require_polyfills = __commonJS({
|
|
|
60
60
|
}
|
|
61
61
|
var chdir;
|
|
62
62
|
module.exports = patch;
|
|
63
|
-
function patch(
|
|
63
|
+
function patch(fs12) {
|
|
64
64
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
65
|
-
patchLchmod(
|
|
66
|
-
}
|
|
67
|
-
if (!
|
|
68
|
-
patchLutimes(
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
65
|
+
patchLchmod(fs12);
|
|
66
|
+
}
|
|
67
|
+
if (!fs12.lutimes) {
|
|
68
|
+
patchLutimes(fs12);
|
|
69
|
+
}
|
|
70
|
+
fs12.chown = chownFix(fs12.chown);
|
|
71
|
+
fs12.fchown = chownFix(fs12.fchown);
|
|
72
|
+
fs12.lchown = chownFix(fs12.lchown);
|
|
73
|
+
fs12.chmod = chmodFix(fs12.chmod);
|
|
74
|
+
fs12.fchmod = chmodFix(fs12.fchmod);
|
|
75
|
+
fs12.lchmod = chmodFix(fs12.lchmod);
|
|
76
|
+
fs12.chownSync = chownFixSync(fs12.chownSync);
|
|
77
|
+
fs12.fchownSync = chownFixSync(fs12.fchownSync);
|
|
78
|
+
fs12.lchownSync = chownFixSync(fs12.lchownSync);
|
|
79
|
+
fs12.chmodSync = chmodFixSync(fs12.chmodSync);
|
|
80
|
+
fs12.fchmodSync = chmodFixSync(fs12.fchmodSync);
|
|
81
|
+
fs12.lchmodSync = chmodFixSync(fs12.lchmodSync);
|
|
82
|
+
fs12.stat = statFix(fs12.stat);
|
|
83
|
+
fs12.fstat = statFix(fs12.fstat);
|
|
84
|
+
fs12.lstat = statFix(fs12.lstat);
|
|
85
|
+
fs12.statSync = statFixSync(fs12.statSync);
|
|
86
|
+
fs12.fstatSync = statFixSync(fs12.fstatSync);
|
|
87
|
+
fs12.lstatSync = statFixSync(fs12.lstatSync);
|
|
88
|
+
if (fs12.chmod && !fs12.lchmod) {
|
|
89
|
+
fs12.lchmod = function(path13, mode, cb) {
|
|
90
90
|
if (cb) process.nextTick(cb);
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
fs12.lchmodSync = function() {
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
95
|
+
if (fs12.chown && !fs12.lchown) {
|
|
96
|
+
fs12.lchown = function(path13, uid, gid, cb) {
|
|
97
97
|
if (cb) process.nextTick(cb);
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
fs12.lchownSync = function() {
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
if (platform === "win32") {
|
|
103
|
-
|
|
103
|
+
fs12.rename = typeof fs12.rename !== "function" ? fs12.rename : (function(fs$rename) {
|
|
104
104
|
function rename(from, to, cb) {
|
|
105
105
|
var start = Date.now();
|
|
106
106
|
var backoff = 0;
|
|
107
107
|
fs$rename(from, to, function CB(er) {
|
|
108
108
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
109
109
|
setTimeout(function() {
|
|
110
|
-
|
|
110
|
+
fs12.stat(to, function(stater, st) {
|
|
111
111
|
if (stater && stater.code === "ENOENT")
|
|
112
112
|
fs$rename(from, to, CB);
|
|
113
113
|
else
|
|
@@ -123,9 +123,9 @@ var require_polyfills = __commonJS({
|
|
|
123
123
|
}
|
|
124
124
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
125
125
|
return rename;
|
|
126
|
-
})(
|
|
126
|
+
})(fs12.rename);
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
fs12.read = typeof fs12.read !== "function" ? fs12.read : (function(fs$read) {
|
|
129
129
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
130
130
|
var callback;
|
|
131
131
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -133,22 +133,22 @@ var require_polyfills = __commonJS({
|
|
|
133
133
|
callback = function(er, _, __) {
|
|
134
134
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
135
135
|
eagCounter++;
|
|
136
|
-
return fs$read.call(
|
|
136
|
+
return fs$read.call(fs12, fd, buffer, offset, length, position, callback);
|
|
137
137
|
}
|
|
138
138
|
callback_.apply(this, arguments);
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
return fs$read.call(
|
|
141
|
+
return fs$read.call(fs12, fd, buffer, offset, length, position, callback);
|
|
142
142
|
}
|
|
143
143
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
144
144
|
return read;
|
|
145
|
-
})(
|
|
146
|
-
|
|
145
|
+
})(fs12.read);
|
|
146
|
+
fs12.readSync = typeof fs12.readSync !== "function" ? fs12.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
147
147
|
return function(fd, buffer, offset, length, position) {
|
|
148
148
|
var eagCounter = 0;
|
|
149
149
|
while (true) {
|
|
150
150
|
try {
|
|
151
|
-
return fs$readSync.call(
|
|
151
|
+
return fs$readSync.call(fs12, fd, buffer, offset, length, position);
|
|
152
152
|
} catch (er) {
|
|
153
153
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
154
154
|
eagCounter++;
|
|
@@ -158,11 +158,11 @@ var require_polyfills = __commonJS({
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
})(
|
|
162
|
-
function patchLchmod(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
})(fs12.readSync);
|
|
162
|
+
function patchLchmod(fs13) {
|
|
163
|
+
fs13.lchmod = function(path13, mode, callback) {
|
|
164
|
+
fs13.open(
|
|
165
|
+
path13,
|
|
166
166
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
167
167
|
mode,
|
|
168
168
|
function(err, fd) {
|
|
@@ -170,80 +170,80 @@ var require_polyfills = __commonJS({
|
|
|
170
170
|
if (callback) callback(err);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
fs13.fchmod(fd, mode, function(err2) {
|
|
174
|
+
fs13.close(fd, function(err22) {
|
|
175
175
|
if (callback) callback(err2 || err22);
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
);
|
|
180
180
|
};
|
|
181
|
-
|
|
182
|
-
var fd =
|
|
181
|
+
fs13.lchmodSync = function(path13, mode) {
|
|
182
|
+
var fd = fs13.openSync(path13, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
183
183
|
var threw = true;
|
|
184
184
|
var ret;
|
|
185
185
|
try {
|
|
186
|
-
ret =
|
|
186
|
+
ret = fs13.fchmodSync(fd, mode);
|
|
187
187
|
threw = false;
|
|
188
188
|
} finally {
|
|
189
189
|
if (threw) {
|
|
190
190
|
try {
|
|
191
|
-
|
|
191
|
+
fs13.closeSync(fd);
|
|
192
192
|
} catch (er) {
|
|
193
193
|
}
|
|
194
194
|
} else {
|
|
195
|
-
|
|
195
|
+
fs13.closeSync(fd);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
return ret;
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
function patchLutimes(
|
|
202
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
function patchLutimes(fs13) {
|
|
202
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs13.futimes) {
|
|
203
|
+
fs13.lutimes = function(path13, at, mt, cb) {
|
|
204
|
+
fs13.open(path13, constants.O_SYMLINK, function(er, fd) {
|
|
205
205
|
if (er) {
|
|
206
206
|
if (cb) cb(er);
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
fs13.futimes(fd, at, mt, function(er2) {
|
|
210
|
+
fs13.close(fd, function(er22) {
|
|
211
211
|
if (cb) cb(er2 || er22);
|
|
212
212
|
});
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
215
|
};
|
|
216
|
-
|
|
217
|
-
var fd =
|
|
216
|
+
fs13.lutimesSync = function(path13, at, mt) {
|
|
217
|
+
var fd = fs13.openSync(path13, constants.O_SYMLINK);
|
|
218
218
|
var ret;
|
|
219
219
|
var threw = true;
|
|
220
220
|
try {
|
|
221
|
-
ret =
|
|
221
|
+
ret = fs13.futimesSync(fd, at, mt);
|
|
222
222
|
threw = false;
|
|
223
223
|
} finally {
|
|
224
224
|
if (threw) {
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
fs13.closeSync(fd);
|
|
227
227
|
} catch (er) {
|
|
228
228
|
}
|
|
229
229
|
} else {
|
|
230
|
-
|
|
230
|
+
fs13.closeSync(fd);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
return ret;
|
|
234
234
|
};
|
|
235
|
-
} else if (
|
|
236
|
-
|
|
235
|
+
} else if (fs13.futimes) {
|
|
236
|
+
fs13.lutimes = function(_a, _b, _c, cb) {
|
|
237
237
|
if (cb) process.nextTick(cb);
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
fs13.lutimesSync = function() {
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
function chmodFix(orig) {
|
|
244
244
|
if (!orig) return orig;
|
|
245
245
|
return function(target, mode, cb) {
|
|
246
|
-
return orig.call(
|
|
246
|
+
return orig.call(fs12, target, mode, function(er) {
|
|
247
247
|
if (chownErOk(er)) er = null;
|
|
248
248
|
if (cb) cb.apply(this, arguments);
|
|
249
249
|
});
|
|
@@ -253,7 +253,7 @@ var require_polyfills = __commonJS({
|
|
|
253
253
|
if (!orig) return orig;
|
|
254
254
|
return function(target, mode) {
|
|
255
255
|
try {
|
|
256
|
-
return orig.call(
|
|
256
|
+
return orig.call(fs12, target, mode);
|
|
257
257
|
} catch (er) {
|
|
258
258
|
if (!chownErOk(er)) throw er;
|
|
259
259
|
}
|
|
@@ -262,7 +262,7 @@ var require_polyfills = __commonJS({
|
|
|
262
262
|
function chownFix(orig) {
|
|
263
263
|
if (!orig) return orig;
|
|
264
264
|
return function(target, uid, gid, cb) {
|
|
265
|
-
return orig.call(
|
|
265
|
+
return orig.call(fs12, target, uid, gid, function(er) {
|
|
266
266
|
if (chownErOk(er)) er = null;
|
|
267
267
|
if (cb) cb.apply(this, arguments);
|
|
268
268
|
});
|
|
@@ -272,7 +272,7 @@ var require_polyfills = __commonJS({
|
|
|
272
272
|
if (!orig) return orig;
|
|
273
273
|
return function(target, uid, gid) {
|
|
274
274
|
try {
|
|
275
|
-
return orig.call(
|
|
275
|
+
return orig.call(fs12, target, uid, gid);
|
|
276
276
|
} catch (er) {
|
|
277
277
|
if (!chownErOk(er)) throw er;
|
|
278
278
|
}
|
|
@@ -292,13 +292,13 @@ var require_polyfills = __commonJS({
|
|
|
292
292
|
}
|
|
293
293
|
if (cb) cb.apply(this, arguments);
|
|
294
294
|
}
|
|
295
|
-
return options ? orig.call(
|
|
295
|
+
return options ? orig.call(fs12, target, options, callback) : orig.call(fs12, target, callback);
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
function statFixSync(orig) {
|
|
299
299
|
if (!orig) return orig;
|
|
300
300
|
return function(target, options) {
|
|
301
|
-
var stats = options ? orig.call(
|
|
301
|
+
var stats = options ? orig.call(fs12, target, options) : orig.call(fs12, target);
|
|
302
302
|
if (stats) {
|
|
303
303
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
304
304
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -327,16 +327,16 @@ var require_legacy_streams = __commonJS({
|
|
|
327
327
|
"node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
328
328
|
var Stream = __require("stream").Stream;
|
|
329
329
|
module.exports = legacy;
|
|
330
|
-
function legacy(
|
|
330
|
+
function legacy(fs12) {
|
|
331
331
|
return {
|
|
332
332
|
ReadStream,
|
|
333
333
|
WriteStream
|
|
334
334
|
};
|
|
335
|
-
function ReadStream(
|
|
336
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
335
|
+
function ReadStream(path13, options) {
|
|
336
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path13, options);
|
|
337
337
|
Stream.call(this);
|
|
338
338
|
var self = this;
|
|
339
|
-
this.path =
|
|
339
|
+
this.path = path13;
|
|
340
340
|
this.fd = null;
|
|
341
341
|
this.readable = true;
|
|
342
342
|
this.paused = false;
|
|
@@ -370,7 +370,7 @@ var require_legacy_streams = __commonJS({
|
|
|
370
370
|
});
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
|
|
373
|
+
fs12.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
374
374
|
if (err) {
|
|
375
375
|
self.emit("error", err);
|
|
376
376
|
self.readable = false;
|
|
@@ -381,10 +381,10 @@ var require_legacy_streams = __commonJS({
|
|
|
381
381
|
self._read();
|
|
382
382
|
});
|
|
383
383
|
}
|
|
384
|
-
function WriteStream(
|
|
385
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
384
|
+
function WriteStream(path13, options) {
|
|
385
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path13, options);
|
|
386
386
|
Stream.call(this);
|
|
387
|
-
this.path =
|
|
387
|
+
this.path = path13;
|
|
388
388
|
this.fd = null;
|
|
389
389
|
this.writable = true;
|
|
390
390
|
this.flags = "w";
|
|
@@ -409,7 +409,7 @@ var require_legacy_streams = __commonJS({
|
|
|
409
409
|
this.busy = false;
|
|
410
410
|
this._queue = [];
|
|
411
411
|
if (this.fd === null) {
|
|
412
|
-
this._open =
|
|
412
|
+
this._open = fs12.open;
|
|
413
413
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
414
414
|
this.flush();
|
|
415
415
|
}
|
|
@@ -444,7 +444,7 @@ var require_clone = __commonJS({
|
|
|
444
444
|
// node_modules/graceful-fs/graceful-fs.js
|
|
445
445
|
var require_graceful_fs = __commonJS({
|
|
446
446
|
"node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
447
|
-
var
|
|
447
|
+
var fs12 = __require("fs");
|
|
448
448
|
var polyfills = require_polyfills();
|
|
449
449
|
var legacy = require_legacy_streams();
|
|
450
450
|
var clone = require_clone();
|
|
@@ -476,12 +476,12 @@ var require_graceful_fs = __commonJS({
|
|
|
476
476
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
477
477
|
console.error(m);
|
|
478
478
|
};
|
|
479
|
-
if (!
|
|
479
|
+
if (!fs12[gracefulQueue]) {
|
|
480
480
|
queue = global[gracefulQueue] || [];
|
|
481
|
-
publishQueue(
|
|
482
|
-
|
|
481
|
+
publishQueue(fs12, queue);
|
|
482
|
+
fs12.close = (function(fs$close) {
|
|
483
483
|
function close(fd, cb) {
|
|
484
|
-
return fs$close.call(
|
|
484
|
+
return fs$close.call(fs12, fd, function(err) {
|
|
485
485
|
if (!err) {
|
|
486
486
|
resetQueue();
|
|
487
487
|
}
|
|
@@ -493,48 +493,48 @@ var require_graceful_fs = __commonJS({
|
|
|
493
493
|
value: fs$close
|
|
494
494
|
});
|
|
495
495
|
return close;
|
|
496
|
-
})(
|
|
497
|
-
|
|
496
|
+
})(fs12.close);
|
|
497
|
+
fs12.closeSync = (function(fs$closeSync) {
|
|
498
498
|
function closeSync2(fd) {
|
|
499
|
-
fs$closeSync.apply(
|
|
499
|
+
fs$closeSync.apply(fs12, arguments);
|
|
500
500
|
resetQueue();
|
|
501
501
|
}
|
|
502
502
|
Object.defineProperty(closeSync2, previousSymbol, {
|
|
503
503
|
value: fs$closeSync
|
|
504
504
|
});
|
|
505
505
|
return closeSync2;
|
|
506
|
-
})(
|
|
506
|
+
})(fs12.closeSync);
|
|
507
507
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
508
508
|
process.on("exit", function() {
|
|
509
|
-
debug(
|
|
510
|
-
__require("assert").equal(
|
|
509
|
+
debug(fs12[gracefulQueue]);
|
|
510
|
+
__require("assert").equal(fs12[gracefulQueue].length, 0);
|
|
511
511
|
});
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
var queue;
|
|
515
515
|
if (!global[gracefulQueue]) {
|
|
516
|
-
publishQueue(global,
|
|
517
|
-
}
|
|
518
|
-
module.exports = patch(clone(
|
|
519
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
520
|
-
module.exports = patch(
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
function patch(
|
|
524
|
-
polyfills(
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
var fs$readFile =
|
|
529
|
-
|
|
530
|
-
function readFile(
|
|
516
|
+
publishQueue(global, fs12[gracefulQueue]);
|
|
517
|
+
}
|
|
518
|
+
module.exports = patch(clone(fs12));
|
|
519
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs12.__patched) {
|
|
520
|
+
module.exports = patch(fs12);
|
|
521
|
+
fs12.__patched = true;
|
|
522
|
+
}
|
|
523
|
+
function patch(fs13) {
|
|
524
|
+
polyfills(fs13);
|
|
525
|
+
fs13.gracefulify = patch;
|
|
526
|
+
fs13.createReadStream = createReadStream;
|
|
527
|
+
fs13.createWriteStream = createWriteStream;
|
|
528
|
+
var fs$readFile = fs13.readFile;
|
|
529
|
+
fs13.readFile = readFile;
|
|
530
|
+
function readFile(path13, options, cb) {
|
|
531
531
|
if (typeof options === "function")
|
|
532
532
|
cb = options, options = null;
|
|
533
|
-
return go$readFile(
|
|
534
|
-
function go$readFile(
|
|
535
|
-
return fs$readFile(
|
|
533
|
+
return go$readFile(path13, options, cb);
|
|
534
|
+
function go$readFile(path14, options2, cb2, startTime) {
|
|
535
|
+
return fs$readFile(path14, options2, function(err) {
|
|
536
536
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
537
|
-
enqueue([go$readFile, [
|
|
537
|
+
enqueue([go$readFile, [path14, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
538
538
|
else {
|
|
539
539
|
if (typeof cb2 === "function")
|
|
540
540
|
cb2.apply(this, arguments);
|
|
@@ -542,16 +542,16 @@ var require_graceful_fs = __commonJS({
|
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
var fs$writeFile =
|
|
546
|
-
|
|
547
|
-
function writeFile(
|
|
545
|
+
var fs$writeFile = fs13.writeFile;
|
|
546
|
+
fs13.writeFile = writeFile;
|
|
547
|
+
function writeFile(path13, data, options, cb) {
|
|
548
548
|
if (typeof options === "function")
|
|
549
549
|
cb = options, options = null;
|
|
550
|
-
return go$writeFile(
|
|
551
|
-
function go$writeFile(
|
|
552
|
-
return fs$writeFile(
|
|
550
|
+
return go$writeFile(path13, data, options, cb);
|
|
551
|
+
function go$writeFile(path14, data2, options2, cb2, startTime) {
|
|
552
|
+
return fs$writeFile(path14, data2, options2, function(err) {
|
|
553
553
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
554
|
-
enqueue([go$writeFile, [
|
|
554
|
+
enqueue([go$writeFile, [path14, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
555
555
|
else {
|
|
556
556
|
if (typeof cb2 === "function")
|
|
557
557
|
cb2.apply(this, arguments);
|
|
@@ -559,17 +559,17 @@ var require_graceful_fs = __commonJS({
|
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
var fs$appendFile =
|
|
562
|
+
var fs$appendFile = fs13.appendFile;
|
|
563
563
|
if (fs$appendFile)
|
|
564
|
-
|
|
565
|
-
function appendFile(
|
|
564
|
+
fs13.appendFile = appendFile;
|
|
565
|
+
function appendFile(path13, data, options, cb) {
|
|
566
566
|
if (typeof options === "function")
|
|
567
567
|
cb = options, options = null;
|
|
568
|
-
return go$appendFile(
|
|
569
|
-
function go$appendFile(
|
|
570
|
-
return fs$appendFile(
|
|
568
|
+
return go$appendFile(path13, data, options, cb);
|
|
569
|
+
function go$appendFile(path14, data2, options2, cb2, startTime) {
|
|
570
|
+
return fs$appendFile(path14, data2, options2, function(err) {
|
|
571
571
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
572
|
-
enqueue([go$appendFile, [
|
|
572
|
+
enqueue([go$appendFile, [path14, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
573
573
|
else {
|
|
574
574
|
if (typeof cb2 === "function")
|
|
575
575
|
cb2.apply(this, arguments);
|
|
@@ -577,9 +577,9 @@ var require_graceful_fs = __commonJS({
|
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
var fs$copyFile =
|
|
580
|
+
var fs$copyFile = fs13.copyFile;
|
|
581
581
|
if (fs$copyFile)
|
|
582
|
-
|
|
582
|
+
fs13.copyFile = copyFile;
|
|
583
583
|
function copyFile(src, dest, flags, cb) {
|
|
584
584
|
if (typeof flags === "function") {
|
|
585
585
|
cb = flags;
|
|
@@ -597,34 +597,34 @@ var require_graceful_fs = __commonJS({
|
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
var fs$readdir =
|
|
601
|
-
|
|
600
|
+
var fs$readdir = fs13.readdir;
|
|
601
|
+
fs13.readdir = readdir;
|
|
602
602
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
603
|
-
function readdir(
|
|
603
|
+
function readdir(path13, options, cb) {
|
|
604
604
|
if (typeof options === "function")
|
|
605
605
|
cb = options, options = null;
|
|
606
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
607
|
-
return fs$readdir(
|
|
608
|
-
|
|
606
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path14, options2, cb2, startTime) {
|
|
607
|
+
return fs$readdir(path14, fs$readdirCallback(
|
|
608
|
+
path14,
|
|
609
609
|
options2,
|
|
610
610
|
cb2,
|
|
611
611
|
startTime
|
|
612
612
|
));
|
|
613
|
-
} : function go$readdir2(
|
|
614
|
-
return fs$readdir(
|
|
615
|
-
|
|
613
|
+
} : function go$readdir2(path14, options2, cb2, startTime) {
|
|
614
|
+
return fs$readdir(path14, options2, fs$readdirCallback(
|
|
615
|
+
path14,
|
|
616
616
|
options2,
|
|
617
617
|
cb2,
|
|
618
618
|
startTime
|
|
619
619
|
));
|
|
620
620
|
};
|
|
621
|
-
return go$readdir(
|
|
622
|
-
function fs$readdirCallback(
|
|
621
|
+
return go$readdir(path13, options, cb);
|
|
622
|
+
function fs$readdirCallback(path14, options2, cb2, startTime) {
|
|
623
623
|
return function(err, files) {
|
|
624
624
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
625
625
|
enqueue([
|
|
626
626
|
go$readdir,
|
|
627
|
-
[
|
|
627
|
+
[path14, options2, cb2],
|
|
628
628
|
err,
|
|
629
629
|
startTime || Date.now(),
|
|
630
630
|
Date.now()
|
|
@@ -639,21 +639,21 @@ var require_graceful_fs = __commonJS({
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
642
|
-
var legStreams = legacy(
|
|
642
|
+
var legStreams = legacy(fs13);
|
|
643
643
|
ReadStream = legStreams.ReadStream;
|
|
644
644
|
WriteStream = legStreams.WriteStream;
|
|
645
645
|
}
|
|
646
|
-
var fs$ReadStream =
|
|
646
|
+
var fs$ReadStream = fs13.ReadStream;
|
|
647
647
|
if (fs$ReadStream) {
|
|
648
648
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
649
649
|
ReadStream.prototype.open = ReadStream$open;
|
|
650
650
|
}
|
|
651
|
-
var fs$WriteStream =
|
|
651
|
+
var fs$WriteStream = fs13.WriteStream;
|
|
652
652
|
if (fs$WriteStream) {
|
|
653
653
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
654
654
|
WriteStream.prototype.open = WriteStream$open;
|
|
655
655
|
}
|
|
656
|
-
Object.defineProperty(
|
|
656
|
+
Object.defineProperty(fs13, "ReadStream", {
|
|
657
657
|
get: function() {
|
|
658
658
|
return ReadStream;
|
|
659
659
|
},
|
|
@@ -663,7 +663,7 @@ var require_graceful_fs = __commonJS({
|
|
|
663
663
|
enumerable: true,
|
|
664
664
|
configurable: true
|
|
665
665
|
});
|
|
666
|
-
Object.defineProperty(
|
|
666
|
+
Object.defineProperty(fs13, "WriteStream", {
|
|
667
667
|
get: function() {
|
|
668
668
|
return WriteStream;
|
|
669
669
|
},
|
|
@@ -674,7 +674,7 @@ var require_graceful_fs = __commonJS({
|
|
|
674
674
|
configurable: true
|
|
675
675
|
});
|
|
676
676
|
var FileReadStream = ReadStream;
|
|
677
|
-
Object.defineProperty(
|
|
677
|
+
Object.defineProperty(fs13, "FileReadStream", {
|
|
678
678
|
get: function() {
|
|
679
679
|
return FileReadStream;
|
|
680
680
|
},
|
|
@@ -685,7 +685,7 @@ var require_graceful_fs = __commonJS({
|
|
|
685
685
|
configurable: true
|
|
686
686
|
});
|
|
687
687
|
var FileWriteStream = WriteStream;
|
|
688
|
-
Object.defineProperty(
|
|
688
|
+
Object.defineProperty(fs13, "FileWriteStream", {
|
|
689
689
|
get: function() {
|
|
690
690
|
return FileWriteStream;
|
|
691
691
|
},
|
|
@@ -695,7 +695,7 @@ var require_graceful_fs = __commonJS({
|
|
|
695
695
|
enumerable: true,
|
|
696
696
|
configurable: true
|
|
697
697
|
});
|
|
698
|
-
function ReadStream(
|
|
698
|
+
function ReadStream(path13, options) {
|
|
699
699
|
if (this instanceof ReadStream)
|
|
700
700
|
return fs$ReadStream.apply(this, arguments), this;
|
|
701
701
|
else
|
|
@@ -715,7 +715,7 @@ var require_graceful_fs = __commonJS({
|
|
|
715
715
|
}
|
|
716
716
|
});
|
|
717
717
|
}
|
|
718
|
-
function WriteStream(
|
|
718
|
+
function WriteStream(path13, options) {
|
|
719
719
|
if (this instanceof WriteStream)
|
|
720
720
|
return fs$WriteStream.apply(this, arguments), this;
|
|
721
721
|
else
|
|
@@ -733,22 +733,22 @@ var require_graceful_fs = __commonJS({
|
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
}
|
|
736
|
-
function createReadStream(
|
|
737
|
-
return new
|
|
736
|
+
function createReadStream(path13, options) {
|
|
737
|
+
return new fs13.ReadStream(path13, options);
|
|
738
738
|
}
|
|
739
|
-
function createWriteStream(
|
|
740
|
-
return new
|
|
739
|
+
function createWriteStream(path13, options) {
|
|
740
|
+
return new fs13.WriteStream(path13, options);
|
|
741
741
|
}
|
|
742
|
-
var fs$open =
|
|
743
|
-
|
|
744
|
-
function open(
|
|
742
|
+
var fs$open = fs13.open;
|
|
743
|
+
fs13.open = open;
|
|
744
|
+
function open(path13, flags, mode, cb) {
|
|
745
745
|
if (typeof mode === "function")
|
|
746
746
|
cb = mode, mode = null;
|
|
747
|
-
return go$open(
|
|
748
|
-
function go$open(
|
|
749
|
-
return fs$open(
|
|
747
|
+
return go$open(path13, flags, mode, cb);
|
|
748
|
+
function go$open(path14, flags2, mode2, cb2, startTime) {
|
|
749
|
+
return fs$open(path14, flags2, mode2, function(err, fd) {
|
|
750
750
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
751
|
-
enqueue([go$open, [
|
|
751
|
+
enqueue([go$open, [path14, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
752
752
|
else {
|
|
753
753
|
if (typeof cb2 === "function")
|
|
754
754
|
cb2.apply(this, arguments);
|
|
@@ -756,20 +756,20 @@ var require_graceful_fs = __commonJS({
|
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
return
|
|
759
|
+
return fs13;
|
|
760
760
|
}
|
|
761
761
|
function enqueue(elem) {
|
|
762
762
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
763
|
-
|
|
763
|
+
fs12[gracefulQueue].push(elem);
|
|
764
764
|
retry();
|
|
765
765
|
}
|
|
766
766
|
var retryTimer;
|
|
767
767
|
function resetQueue() {
|
|
768
768
|
var now = Date.now();
|
|
769
|
-
for (var i = 0; i <
|
|
770
|
-
if (
|
|
771
|
-
|
|
772
|
-
|
|
769
|
+
for (var i = 0; i < fs12[gracefulQueue].length; ++i) {
|
|
770
|
+
if (fs12[gracefulQueue][i].length > 2) {
|
|
771
|
+
fs12[gracefulQueue][i][3] = now;
|
|
772
|
+
fs12[gracefulQueue][i][4] = now;
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
retry();
|
|
@@ -777,9 +777,9 @@ var require_graceful_fs = __commonJS({
|
|
|
777
777
|
function retry() {
|
|
778
778
|
clearTimeout(retryTimer);
|
|
779
779
|
retryTimer = void 0;
|
|
780
|
-
if (
|
|
780
|
+
if (fs12[gracefulQueue].length === 0)
|
|
781
781
|
return;
|
|
782
|
-
var elem =
|
|
782
|
+
var elem = fs12[gracefulQueue].shift();
|
|
783
783
|
var fn = elem[0];
|
|
784
784
|
var args = elem[1];
|
|
785
785
|
var err = elem[2];
|
|
@@ -801,7 +801,7 @@ var require_graceful_fs = __commonJS({
|
|
|
801
801
|
debug("RETRY", fn.name, args);
|
|
802
802
|
fn.apply(null, args.concat([startTime]));
|
|
803
803
|
} else {
|
|
804
|
-
|
|
804
|
+
fs12[gracefulQueue].push(elem);
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
807
|
if (retryTimer === void 0) {
|
|
@@ -1236,10 +1236,10 @@ var require_mtime_precision = __commonJS({
|
|
|
1236
1236
|
"node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
1237
1237
|
"use strict";
|
|
1238
1238
|
var cacheSymbol = Symbol();
|
|
1239
|
-
function probe(file,
|
|
1240
|
-
const cachedPrecision =
|
|
1239
|
+
function probe(file, fs12, callback) {
|
|
1240
|
+
const cachedPrecision = fs12[cacheSymbol];
|
|
1241
1241
|
if (cachedPrecision) {
|
|
1242
|
-
return
|
|
1242
|
+
return fs12.stat(file, (err, stat) => {
|
|
1243
1243
|
if (err) {
|
|
1244
1244
|
return callback(err);
|
|
1245
1245
|
}
|
|
@@ -1247,16 +1247,16 @@ var require_mtime_precision = __commonJS({
|
|
|
1247
1247
|
});
|
|
1248
1248
|
}
|
|
1249
1249
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
1250
|
-
|
|
1250
|
+
fs12.utimes(file, mtime, mtime, (err) => {
|
|
1251
1251
|
if (err) {
|
|
1252
1252
|
return callback(err);
|
|
1253
1253
|
}
|
|
1254
|
-
|
|
1254
|
+
fs12.stat(file, (err2, stat) => {
|
|
1255
1255
|
if (err2) {
|
|
1256
1256
|
return callback(err2);
|
|
1257
1257
|
}
|
|
1258
1258
|
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1259
|
-
Object.defineProperty(
|
|
1259
|
+
Object.defineProperty(fs12, cacheSymbol, { value: precision });
|
|
1260
1260
|
callback(null, stat.mtime, precision);
|
|
1261
1261
|
});
|
|
1262
1262
|
});
|
|
@@ -1277,8 +1277,8 @@ var require_mtime_precision = __commonJS({
|
|
|
1277
1277
|
var require_lockfile = __commonJS({
|
|
1278
1278
|
"node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1279
1279
|
"use strict";
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
1280
|
+
var path13 = __require("path");
|
|
1281
|
+
var fs12 = require_graceful_fs();
|
|
1282
1282
|
var retry = require_retry2();
|
|
1283
1283
|
var onExit = require_signal_exit();
|
|
1284
1284
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -1288,7 +1288,7 @@ var require_lockfile = __commonJS({
|
|
|
1288
1288
|
}
|
|
1289
1289
|
function resolveCanonicalPath(file, options, callback) {
|
|
1290
1290
|
if (!options.realpath) {
|
|
1291
|
-
return callback(null,
|
|
1291
|
+
return callback(null, path13.resolve(file));
|
|
1292
1292
|
}
|
|
1293
1293
|
options.fs.realpath(file, callback);
|
|
1294
1294
|
}
|
|
@@ -1409,7 +1409,7 @@ var require_lockfile = __commonJS({
|
|
|
1409
1409
|
update: null,
|
|
1410
1410
|
realpath: true,
|
|
1411
1411
|
retries: 0,
|
|
1412
|
-
fs:
|
|
1412
|
+
fs: fs12,
|
|
1413
1413
|
onCompromised: (err) => {
|
|
1414
1414
|
throw err;
|
|
1415
1415
|
},
|
|
@@ -1453,7 +1453,7 @@ var require_lockfile = __commonJS({
|
|
|
1453
1453
|
}
|
|
1454
1454
|
function unlock(file, options, callback) {
|
|
1455
1455
|
options = {
|
|
1456
|
-
fs:
|
|
1456
|
+
fs: fs12,
|
|
1457
1457
|
realpath: true,
|
|
1458
1458
|
...options
|
|
1459
1459
|
};
|
|
@@ -1475,7 +1475,7 @@ var require_lockfile = __commonJS({
|
|
|
1475
1475
|
options = {
|
|
1476
1476
|
stale: 1e4,
|
|
1477
1477
|
realpath: true,
|
|
1478
|
-
fs:
|
|
1478
|
+
fs: fs12,
|
|
1479
1479
|
...options
|
|
1480
1480
|
};
|
|
1481
1481
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -1514,16 +1514,16 @@ var require_lockfile = __commonJS({
|
|
|
1514
1514
|
var require_adapter = __commonJS({
|
|
1515
1515
|
"node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
1516
1516
|
"use strict";
|
|
1517
|
-
var
|
|
1518
|
-
function createSyncFs(
|
|
1517
|
+
var fs12 = require_graceful_fs();
|
|
1518
|
+
function createSyncFs(fs13) {
|
|
1519
1519
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1520
|
-
const newFs = { ...
|
|
1520
|
+
const newFs = { ...fs13 };
|
|
1521
1521
|
methods.forEach((method) => {
|
|
1522
1522
|
newFs[method] = (...args) => {
|
|
1523
1523
|
const callback = args.pop();
|
|
1524
1524
|
let ret;
|
|
1525
1525
|
try {
|
|
1526
|
-
ret =
|
|
1526
|
+
ret = fs13[`${method}Sync`](...args);
|
|
1527
1527
|
} catch (err) {
|
|
1528
1528
|
return callback(err);
|
|
1529
1529
|
}
|
|
@@ -1561,7 +1561,7 @@ var require_adapter = __commonJS({
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function toSyncOptions(options) {
|
|
1563
1563
|
options = { ...options };
|
|
1564
|
-
options.fs = createSyncFs(options.fs ||
|
|
1564
|
+
options.fs = createSyncFs(options.fs || fs12);
|
|
1565
1565
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
1566
1566
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
1567
1567
|
}
|
|
@@ -2724,8 +2724,8 @@ var require_lib = __commonJS({
|
|
|
2724
2724
|
});
|
|
2725
2725
|
|
|
2726
2726
|
// src/index.ts
|
|
2727
|
-
import * as
|
|
2728
|
-
import * as
|
|
2727
|
+
import * as fs11 from "node:fs";
|
|
2728
|
+
import * as path12 from "node:path";
|
|
2729
2729
|
|
|
2730
2730
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
2731
2731
|
var value_exports = {};
|
|
@@ -6298,32 +6298,32 @@ var ValueErrorIterator = class {
|
|
|
6298
6298
|
return next.done ? void 0 : next.value;
|
|
6299
6299
|
}
|
|
6300
6300
|
};
|
|
6301
|
-
function Create(errorType, schema,
|
|
6301
|
+
function Create(errorType, schema, path13, value, errors = []) {
|
|
6302
6302
|
return {
|
|
6303
6303
|
type: errorType,
|
|
6304
6304
|
schema,
|
|
6305
|
-
path:
|
|
6305
|
+
path: path13,
|
|
6306
6306
|
value,
|
|
6307
|
-
message: GetErrorFunction()({ errorType, path:
|
|
6307
|
+
message: GetErrorFunction()({ errorType, path: path13, schema, value, errors }),
|
|
6308
6308
|
errors
|
|
6309
6309
|
};
|
|
6310
6310
|
}
|
|
6311
|
-
function* FromAny3(schema, references,
|
|
6311
|
+
function* FromAny3(schema, references, path13, value) {
|
|
6312
6312
|
}
|
|
6313
|
-
function* FromArgument3(schema, references,
|
|
6313
|
+
function* FromArgument3(schema, references, path13, value) {
|
|
6314
6314
|
}
|
|
6315
|
-
function* FromArray8(schema, references,
|
|
6315
|
+
function* FromArray8(schema, references, path13, value) {
|
|
6316
6316
|
if (!IsArray2(value)) {
|
|
6317
|
-
return yield Create(ValueErrorType.Array, schema,
|
|
6317
|
+
return yield Create(ValueErrorType.Array, schema, path13, value);
|
|
6318
6318
|
}
|
|
6319
6319
|
if (IsDefined2(schema.minItems) && !(value.length >= schema.minItems)) {
|
|
6320
|
-
yield Create(ValueErrorType.ArrayMinItems, schema,
|
|
6320
|
+
yield Create(ValueErrorType.ArrayMinItems, schema, path13, value);
|
|
6321
6321
|
}
|
|
6322
6322
|
if (IsDefined2(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
6323
|
-
yield Create(ValueErrorType.ArrayMaxItems, schema,
|
|
6323
|
+
yield Create(ValueErrorType.ArrayMaxItems, schema, path13, value);
|
|
6324
6324
|
}
|
|
6325
6325
|
for (let i = 0; i < value.length; i++) {
|
|
6326
|
-
yield* Visit6(schema.items, references, `${
|
|
6326
|
+
yield* Visit6(schema.items, references, `${path13}/${i}`, value[i]);
|
|
6327
6327
|
}
|
|
6328
6328
|
if (schema.uniqueItems === true && !(function() {
|
|
6329
6329
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -6337,116 +6337,116 @@ function* FromArray8(schema, references, path14, value) {
|
|
|
6337
6337
|
}
|
|
6338
6338
|
return true;
|
|
6339
6339
|
})()) {
|
|
6340
|
-
yield Create(ValueErrorType.ArrayUniqueItems, schema,
|
|
6340
|
+
yield Create(ValueErrorType.ArrayUniqueItems, schema, path13, value);
|
|
6341
6341
|
}
|
|
6342
6342
|
if (!(IsDefined2(schema.contains) || IsDefined2(schema.minContains) || IsDefined2(schema.maxContains))) {
|
|
6343
6343
|
return;
|
|
6344
6344
|
}
|
|
6345
6345
|
const containsSchema = IsDefined2(schema.contains) ? schema.contains : Never();
|
|
6346
|
-
const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${
|
|
6346
|
+
const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${path13}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
|
|
6347
6347
|
if (containsCount === 0) {
|
|
6348
|
-
yield Create(ValueErrorType.ArrayContains, schema,
|
|
6348
|
+
yield Create(ValueErrorType.ArrayContains, schema, path13, value);
|
|
6349
6349
|
}
|
|
6350
6350
|
if (IsNumber2(schema.minContains) && containsCount < schema.minContains) {
|
|
6351
|
-
yield Create(ValueErrorType.ArrayMinContains, schema,
|
|
6351
|
+
yield Create(ValueErrorType.ArrayMinContains, schema, path13, value);
|
|
6352
6352
|
}
|
|
6353
6353
|
if (IsNumber2(schema.maxContains) && containsCount > schema.maxContains) {
|
|
6354
|
-
yield Create(ValueErrorType.ArrayMaxContains, schema,
|
|
6354
|
+
yield Create(ValueErrorType.ArrayMaxContains, schema, path13, value);
|
|
6355
6355
|
}
|
|
6356
6356
|
}
|
|
6357
|
-
function* FromAsyncIterator5(schema, references,
|
|
6357
|
+
function* FromAsyncIterator5(schema, references, path13, value) {
|
|
6358
6358
|
if (!IsAsyncIterator2(value))
|
|
6359
|
-
yield Create(ValueErrorType.AsyncIterator, schema,
|
|
6359
|
+
yield Create(ValueErrorType.AsyncIterator, schema, path13, value);
|
|
6360
6360
|
}
|
|
6361
|
-
function* FromBigInt3(schema, references,
|
|
6361
|
+
function* FromBigInt3(schema, references, path13, value) {
|
|
6362
6362
|
if (!IsBigInt2(value))
|
|
6363
|
-
return yield Create(ValueErrorType.BigInt, schema,
|
|
6363
|
+
return yield Create(ValueErrorType.BigInt, schema, path13, value);
|
|
6364
6364
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6365
|
-
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema,
|
|
6365
|
+
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path13, value);
|
|
6366
6366
|
}
|
|
6367
6367
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6368
|
-
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema,
|
|
6368
|
+
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path13, value);
|
|
6369
6369
|
}
|
|
6370
6370
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6371
|
-
yield Create(ValueErrorType.BigIntMaximum, schema,
|
|
6371
|
+
yield Create(ValueErrorType.BigIntMaximum, schema, path13, value);
|
|
6372
6372
|
}
|
|
6373
6373
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6374
|
-
yield Create(ValueErrorType.BigIntMinimum, schema,
|
|
6374
|
+
yield Create(ValueErrorType.BigIntMinimum, schema, path13, value);
|
|
6375
6375
|
}
|
|
6376
6376
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
|
|
6377
|
-
yield Create(ValueErrorType.BigIntMultipleOf, schema,
|
|
6377
|
+
yield Create(ValueErrorType.BigIntMultipleOf, schema, path13, value);
|
|
6378
6378
|
}
|
|
6379
6379
|
}
|
|
6380
|
-
function* FromBoolean3(schema, references,
|
|
6380
|
+
function* FromBoolean3(schema, references, path13, value) {
|
|
6381
6381
|
if (!IsBoolean2(value))
|
|
6382
|
-
yield Create(ValueErrorType.Boolean, schema,
|
|
6382
|
+
yield Create(ValueErrorType.Boolean, schema, path13, value);
|
|
6383
6383
|
}
|
|
6384
|
-
function* FromConstructor5(schema, references,
|
|
6385
|
-
yield* Visit6(schema.returns, references,
|
|
6384
|
+
function* FromConstructor5(schema, references, path13, value) {
|
|
6385
|
+
yield* Visit6(schema.returns, references, path13, value.prototype);
|
|
6386
6386
|
}
|
|
6387
|
-
function* FromDate3(schema, references,
|
|
6387
|
+
function* FromDate3(schema, references, path13, value) {
|
|
6388
6388
|
if (!IsDate2(value))
|
|
6389
|
-
return yield Create(ValueErrorType.Date, schema,
|
|
6389
|
+
return yield Create(ValueErrorType.Date, schema, path13, value);
|
|
6390
6390
|
if (IsDefined2(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
|
6391
|
-
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema,
|
|
6391
|
+
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path13, value);
|
|
6392
6392
|
}
|
|
6393
6393
|
if (IsDefined2(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
|
6394
|
-
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema,
|
|
6394
|
+
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path13, value);
|
|
6395
6395
|
}
|
|
6396
6396
|
if (IsDefined2(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
|
6397
|
-
yield Create(ValueErrorType.DateMaximumTimestamp, schema,
|
|
6397
|
+
yield Create(ValueErrorType.DateMaximumTimestamp, schema, path13, value);
|
|
6398
6398
|
}
|
|
6399
6399
|
if (IsDefined2(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
|
6400
|
-
yield Create(ValueErrorType.DateMinimumTimestamp, schema,
|
|
6400
|
+
yield Create(ValueErrorType.DateMinimumTimestamp, schema, path13, value);
|
|
6401
6401
|
}
|
|
6402
6402
|
if (IsDefined2(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
|
|
6403
|
-
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema,
|
|
6403
|
+
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path13, value);
|
|
6404
6404
|
}
|
|
6405
6405
|
}
|
|
6406
|
-
function* FromFunction5(schema, references,
|
|
6406
|
+
function* FromFunction5(schema, references, path13, value) {
|
|
6407
6407
|
if (!IsFunction2(value))
|
|
6408
|
-
yield Create(ValueErrorType.Function, schema,
|
|
6408
|
+
yield Create(ValueErrorType.Function, schema, path13, value);
|
|
6409
6409
|
}
|
|
6410
|
-
function* FromImport2(schema, references,
|
|
6410
|
+
function* FromImport2(schema, references, path13, value) {
|
|
6411
6411
|
const definitions = globalThis.Object.values(schema.$defs);
|
|
6412
6412
|
const target = schema.$defs[schema.$ref];
|
|
6413
|
-
yield* Visit6(target, [...references, ...definitions],
|
|
6413
|
+
yield* Visit6(target, [...references, ...definitions], path13, value);
|
|
6414
6414
|
}
|
|
6415
|
-
function* FromInteger3(schema, references,
|
|
6415
|
+
function* FromInteger3(schema, references, path13, value) {
|
|
6416
6416
|
if (!IsInteger(value))
|
|
6417
|
-
return yield Create(ValueErrorType.Integer, schema,
|
|
6417
|
+
return yield Create(ValueErrorType.Integer, schema, path13, value);
|
|
6418
6418
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6419
|
-
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema,
|
|
6419
|
+
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path13, value);
|
|
6420
6420
|
}
|
|
6421
6421
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6422
|
-
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema,
|
|
6422
|
+
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path13, value);
|
|
6423
6423
|
}
|
|
6424
6424
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6425
|
-
yield Create(ValueErrorType.IntegerMaximum, schema,
|
|
6425
|
+
yield Create(ValueErrorType.IntegerMaximum, schema, path13, value);
|
|
6426
6426
|
}
|
|
6427
6427
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6428
|
-
yield Create(ValueErrorType.IntegerMinimum, schema,
|
|
6428
|
+
yield Create(ValueErrorType.IntegerMinimum, schema, path13, value);
|
|
6429
6429
|
}
|
|
6430
6430
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
6431
|
-
yield Create(ValueErrorType.IntegerMultipleOf, schema,
|
|
6431
|
+
yield Create(ValueErrorType.IntegerMultipleOf, schema, path13, value);
|
|
6432
6432
|
}
|
|
6433
6433
|
}
|
|
6434
|
-
function* FromIntersect10(schema, references,
|
|
6434
|
+
function* FromIntersect10(schema, references, path13, value) {
|
|
6435
6435
|
let hasError = false;
|
|
6436
6436
|
for (const inner of schema.allOf) {
|
|
6437
|
-
for (const error of Visit6(inner, references,
|
|
6437
|
+
for (const error of Visit6(inner, references, path13, value)) {
|
|
6438
6438
|
hasError = true;
|
|
6439
6439
|
yield error;
|
|
6440
6440
|
}
|
|
6441
6441
|
}
|
|
6442
6442
|
if (hasError) {
|
|
6443
|
-
return yield Create(ValueErrorType.Intersect, schema,
|
|
6443
|
+
return yield Create(ValueErrorType.Intersect, schema, path13, value);
|
|
6444
6444
|
}
|
|
6445
6445
|
if (schema.unevaluatedProperties === false) {
|
|
6446
6446
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
6447
6447
|
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
6448
6448
|
if (!keyCheck.test(valueKey)) {
|
|
6449
|
-
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${
|
|
6449
|
+
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path13}/${valueKey}`, value);
|
|
6450
6450
|
}
|
|
6451
6451
|
}
|
|
6452
6452
|
}
|
|
@@ -6454,59 +6454,59 @@ function* FromIntersect10(schema, references, path14, value) {
|
|
|
6454
6454
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
6455
6455
|
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
6456
6456
|
if (!keyCheck.test(valueKey)) {
|
|
6457
|
-
const next = Visit6(schema.unevaluatedProperties, references, `${
|
|
6457
|
+
const next = Visit6(schema.unevaluatedProperties, references, `${path13}/${valueKey}`, value[valueKey]).next();
|
|
6458
6458
|
if (!next.done)
|
|
6459
6459
|
yield next.value;
|
|
6460
6460
|
}
|
|
6461
6461
|
}
|
|
6462
6462
|
}
|
|
6463
6463
|
}
|
|
6464
|
-
function* FromIterator5(schema, references,
|
|
6464
|
+
function* FromIterator5(schema, references, path13, value) {
|
|
6465
6465
|
if (!IsIterator2(value))
|
|
6466
|
-
yield Create(ValueErrorType.Iterator, schema,
|
|
6466
|
+
yield Create(ValueErrorType.Iterator, schema, path13, value);
|
|
6467
6467
|
}
|
|
6468
|
-
function* FromLiteral4(schema, references,
|
|
6468
|
+
function* FromLiteral4(schema, references, path13, value) {
|
|
6469
6469
|
if (!(value === schema.const))
|
|
6470
|
-
yield Create(ValueErrorType.Literal, schema,
|
|
6470
|
+
yield Create(ValueErrorType.Literal, schema, path13, value);
|
|
6471
6471
|
}
|
|
6472
|
-
function* FromNever3(schema, references,
|
|
6473
|
-
yield Create(ValueErrorType.Never, schema,
|
|
6472
|
+
function* FromNever3(schema, references, path13, value) {
|
|
6473
|
+
yield Create(ValueErrorType.Never, schema, path13, value);
|
|
6474
6474
|
}
|
|
6475
|
-
function* FromNot3(schema, references,
|
|
6476
|
-
if (Visit6(schema.not, references,
|
|
6477
|
-
yield Create(ValueErrorType.Not, schema,
|
|
6475
|
+
function* FromNot3(schema, references, path13, value) {
|
|
6476
|
+
if (Visit6(schema.not, references, path13, value).next().done === true)
|
|
6477
|
+
yield Create(ValueErrorType.Not, schema, path13, value);
|
|
6478
6478
|
}
|
|
6479
|
-
function* FromNull3(schema, references,
|
|
6479
|
+
function* FromNull3(schema, references, path13, value) {
|
|
6480
6480
|
if (!IsNull2(value))
|
|
6481
|
-
yield Create(ValueErrorType.Null, schema,
|
|
6481
|
+
yield Create(ValueErrorType.Null, schema, path13, value);
|
|
6482
6482
|
}
|
|
6483
|
-
function* FromNumber3(schema, references,
|
|
6483
|
+
function* FromNumber3(schema, references, path13, value) {
|
|
6484
6484
|
if (!TypeSystemPolicy.IsNumberLike(value))
|
|
6485
|
-
return yield Create(ValueErrorType.Number, schema,
|
|
6485
|
+
return yield Create(ValueErrorType.Number, schema, path13, value);
|
|
6486
6486
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6487
|
-
yield Create(ValueErrorType.NumberExclusiveMaximum, schema,
|
|
6487
|
+
yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path13, value);
|
|
6488
6488
|
}
|
|
6489
6489
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6490
|
-
yield Create(ValueErrorType.NumberExclusiveMinimum, schema,
|
|
6490
|
+
yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path13, value);
|
|
6491
6491
|
}
|
|
6492
6492
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6493
|
-
yield Create(ValueErrorType.NumberMaximum, schema,
|
|
6493
|
+
yield Create(ValueErrorType.NumberMaximum, schema, path13, value);
|
|
6494
6494
|
}
|
|
6495
6495
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6496
|
-
yield Create(ValueErrorType.NumberMinimum, schema,
|
|
6496
|
+
yield Create(ValueErrorType.NumberMinimum, schema, path13, value);
|
|
6497
6497
|
}
|
|
6498
6498
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
6499
|
-
yield Create(ValueErrorType.NumberMultipleOf, schema,
|
|
6499
|
+
yield Create(ValueErrorType.NumberMultipleOf, schema, path13, value);
|
|
6500
6500
|
}
|
|
6501
6501
|
}
|
|
6502
|
-
function* FromObject9(schema, references,
|
|
6502
|
+
function* FromObject9(schema, references, path13, value) {
|
|
6503
6503
|
if (!TypeSystemPolicy.IsObjectLike(value))
|
|
6504
|
-
return yield Create(ValueErrorType.Object, schema,
|
|
6504
|
+
return yield Create(ValueErrorType.Object, schema, path13, value);
|
|
6505
6505
|
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
6506
|
-
yield Create(ValueErrorType.ObjectMinProperties, schema,
|
|
6506
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path13, value);
|
|
6507
6507
|
}
|
|
6508
6508
|
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
6509
|
-
yield Create(ValueErrorType.ObjectMaxProperties, schema,
|
|
6509
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path13, value);
|
|
6510
6510
|
}
|
|
6511
6511
|
const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
|
|
6512
6512
|
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
|
@@ -6514,12 +6514,12 @@ function* FromObject9(schema, references, path14, value) {
|
|
|
6514
6514
|
for (const requiredKey of requiredKeys) {
|
|
6515
6515
|
if (unknownKeys.includes(requiredKey))
|
|
6516
6516
|
continue;
|
|
6517
|
-
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${
|
|
6517
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path13}/${EscapeKey(requiredKey)}`, void 0);
|
|
6518
6518
|
}
|
|
6519
6519
|
if (schema.additionalProperties === false) {
|
|
6520
6520
|
for (const valueKey of unknownKeys) {
|
|
6521
6521
|
if (!knownKeys.includes(valueKey)) {
|
|
6522
|
-
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${
|
|
6522
|
+
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path13}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
6523
6523
|
}
|
|
6524
6524
|
}
|
|
6525
6525
|
}
|
|
@@ -6527,235 +6527,235 @@ function* FromObject9(schema, references, path14, value) {
|
|
|
6527
6527
|
for (const valueKey of unknownKeys) {
|
|
6528
6528
|
if (knownKeys.includes(valueKey))
|
|
6529
6529
|
continue;
|
|
6530
|
-
yield* Visit6(schema.additionalProperties, references, `${
|
|
6530
|
+
yield* Visit6(schema.additionalProperties, references, `${path13}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
6531
6531
|
}
|
|
6532
6532
|
}
|
|
6533
6533
|
for (const knownKey of knownKeys) {
|
|
6534
6534
|
const property = schema.properties[knownKey];
|
|
6535
6535
|
if (schema.required && schema.required.includes(knownKey)) {
|
|
6536
|
-
yield* Visit6(property, references, `${
|
|
6536
|
+
yield* Visit6(property, references, `${path13}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
6537
6537
|
if (ExtendsUndefinedCheck(schema) && !(knownKey in value)) {
|
|
6538
|
-
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${
|
|
6538
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path13}/${EscapeKey(knownKey)}`, void 0);
|
|
6539
6539
|
}
|
|
6540
6540
|
} else {
|
|
6541
6541
|
if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
|
|
6542
|
-
yield* Visit6(property, references, `${
|
|
6542
|
+
yield* Visit6(property, references, `${path13}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
6543
6543
|
}
|
|
6544
6544
|
}
|
|
6545
6545
|
}
|
|
6546
6546
|
}
|
|
6547
|
-
function* FromPromise5(schema, references,
|
|
6547
|
+
function* FromPromise5(schema, references, path13, value) {
|
|
6548
6548
|
if (!IsPromise(value))
|
|
6549
|
-
yield Create(ValueErrorType.Promise, schema,
|
|
6549
|
+
yield Create(ValueErrorType.Promise, schema, path13, value);
|
|
6550
6550
|
}
|
|
6551
|
-
function* FromRecord5(schema, references,
|
|
6551
|
+
function* FromRecord5(schema, references, path13, value) {
|
|
6552
6552
|
if (!TypeSystemPolicy.IsRecordLike(value))
|
|
6553
|
-
return yield Create(ValueErrorType.Object, schema,
|
|
6553
|
+
return yield Create(ValueErrorType.Object, schema, path13, value);
|
|
6554
6554
|
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
6555
|
-
yield Create(ValueErrorType.ObjectMinProperties, schema,
|
|
6555
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path13, value);
|
|
6556
6556
|
}
|
|
6557
6557
|
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
6558
|
-
yield Create(ValueErrorType.ObjectMaxProperties, schema,
|
|
6558
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path13, value);
|
|
6559
6559
|
}
|
|
6560
6560
|
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
6561
6561
|
const regex = new RegExp(patternKey);
|
|
6562
6562
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6563
6563
|
if (regex.test(propertyKey))
|
|
6564
|
-
yield* Visit6(patternSchema, references, `${
|
|
6564
|
+
yield* Visit6(patternSchema, references, `${path13}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6565
6565
|
}
|
|
6566
6566
|
if (typeof schema.additionalProperties === "object") {
|
|
6567
6567
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6568
6568
|
if (!regex.test(propertyKey))
|
|
6569
|
-
yield* Visit6(schema.additionalProperties, references, `${
|
|
6569
|
+
yield* Visit6(schema.additionalProperties, references, `${path13}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6570
6570
|
}
|
|
6571
6571
|
}
|
|
6572
6572
|
if (schema.additionalProperties === false) {
|
|
6573
6573
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6574
6574
|
if (regex.test(propertyKey))
|
|
6575
6575
|
continue;
|
|
6576
|
-
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${
|
|
6576
|
+
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path13}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6577
6577
|
}
|
|
6578
6578
|
}
|
|
6579
6579
|
}
|
|
6580
|
-
function* FromRef6(schema, references,
|
|
6581
|
-
yield* Visit6(Deref(schema, references), references,
|
|
6580
|
+
function* FromRef6(schema, references, path13, value) {
|
|
6581
|
+
yield* Visit6(Deref(schema, references), references, path13, value);
|
|
6582
6582
|
}
|
|
6583
|
-
function* FromRegExp3(schema, references,
|
|
6583
|
+
function* FromRegExp3(schema, references, path13, value) {
|
|
6584
6584
|
if (!IsString2(value))
|
|
6585
|
-
return yield Create(ValueErrorType.String, schema,
|
|
6585
|
+
return yield Create(ValueErrorType.String, schema, path13, value);
|
|
6586
6586
|
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
6587
|
-
yield Create(ValueErrorType.StringMinLength, schema,
|
|
6587
|
+
yield Create(ValueErrorType.StringMinLength, schema, path13, value);
|
|
6588
6588
|
}
|
|
6589
6589
|
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
6590
|
-
yield Create(ValueErrorType.StringMaxLength, schema,
|
|
6590
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path13, value);
|
|
6591
6591
|
}
|
|
6592
6592
|
const regex = new RegExp(schema.source, schema.flags);
|
|
6593
6593
|
if (!regex.test(value)) {
|
|
6594
|
-
return yield Create(ValueErrorType.RegExp, schema,
|
|
6594
|
+
return yield Create(ValueErrorType.RegExp, schema, path13, value);
|
|
6595
6595
|
}
|
|
6596
6596
|
}
|
|
6597
|
-
function* FromString3(schema, references,
|
|
6597
|
+
function* FromString3(schema, references, path13, value) {
|
|
6598
6598
|
if (!IsString2(value))
|
|
6599
|
-
return yield Create(ValueErrorType.String, schema,
|
|
6599
|
+
return yield Create(ValueErrorType.String, schema, path13, value);
|
|
6600
6600
|
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
6601
|
-
yield Create(ValueErrorType.StringMinLength, schema,
|
|
6601
|
+
yield Create(ValueErrorType.StringMinLength, schema, path13, value);
|
|
6602
6602
|
}
|
|
6603
6603
|
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
6604
|
-
yield Create(ValueErrorType.StringMaxLength, schema,
|
|
6604
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path13, value);
|
|
6605
6605
|
}
|
|
6606
6606
|
if (IsString2(schema.pattern)) {
|
|
6607
6607
|
const regex = new RegExp(schema.pattern);
|
|
6608
6608
|
if (!regex.test(value)) {
|
|
6609
|
-
yield Create(ValueErrorType.StringPattern, schema,
|
|
6609
|
+
yield Create(ValueErrorType.StringPattern, schema, path13, value);
|
|
6610
6610
|
}
|
|
6611
6611
|
}
|
|
6612
6612
|
if (IsString2(schema.format)) {
|
|
6613
6613
|
if (!format_exports.Has(schema.format)) {
|
|
6614
|
-
yield Create(ValueErrorType.StringFormatUnknown, schema,
|
|
6614
|
+
yield Create(ValueErrorType.StringFormatUnknown, schema, path13, value);
|
|
6615
6615
|
} else {
|
|
6616
6616
|
const format = format_exports.Get(schema.format);
|
|
6617
6617
|
if (!format(value)) {
|
|
6618
|
-
yield Create(ValueErrorType.StringFormat, schema,
|
|
6618
|
+
yield Create(ValueErrorType.StringFormat, schema, path13, value);
|
|
6619
6619
|
}
|
|
6620
6620
|
}
|
|
6621
6621
|
}
|
|
6622
6622
|
}
|
|
6623
|
-
function* FromSymbol3(schema, references,
|
|
6623
|
+
function* FromSymbol3(schema, references, path13, value) {
|
|
6624
6624
|
if (!IsSymbol2(value))
|
|
6625
|
-
yield Create(ValueErrorType.Symbol, schema,
|
|
6625
|
+
yield Create(ValueErrorType.Symbol, schema, path13, value);
|
|
6626
6626
|
}
|
|
6627
|
-
function* FromTemplateLiteral5(schema, references,
|
|
6627
|
+
function* FromTemplateLiteral5(schema, references, path13, value) {
|
|
6628
6628
|
if (!IsString2(value))
|
|
6629
|
-
return yield Create(ValueErrorType.String, schema,
|
|
6629
|
+
return yield Create(ValueErrorType.String, schema, path13, value);
|
|
6630
6630
|
const regex = new RegExp(schema.pattern);
|
|
6631
6631
|
if (!regex.test(value)) {
|
|
6632
|
-
yield Create(ValueErrorType.StringPattern, schema,
|
|
6632
|
+
yield Create(ValueErrorType.StringPattern, schema, path13, value);
|
|
6633
6633
|
}
|
|
6634
6634
|
}
|
|
6635
|
-
function* FromThis2(schema, references,
|
|
6636
|
-
yield* Visit6(Deref(schema, references), references,
|
|
6635
|
+
function* FromThis2(schema, references, path13, value) {
|
|
6636
|
+
yield* Visit6(Deref(schema, references), references, path13, value);
|
|
6637
6637
|
}
|
|
6638
|
-
function* FromTuple7(schema, references,
|
|
6638
|
+
function* FromTuple7(schema, references, path13, value) {
|
|
6639
6639
|
if (!IsArray2(value))
|
|
6640
|
-
return yield Create(ValueErrorType.Tuple, schema,
|
|
6640
|
+
return yield Create(ValueErrorType.Tuple, schema, path13, value);
|
|
6641
6641
|
if (schema.items === void 0 && !(value.length === 0)) {
|
|
6642
|
-
return yield Create(ValueErrorType.TupleLength, schema,
|
|
6642
|
+
return yield Create(ValueErrorType.TupleLength, schema, path13, value);
|
|
6643
6643
|
}
|
|
6644
6644
|
if (!(value.length === schema.maxItems)) {
|
|
6645
|
-
return yield Create(ValueErrorType.TupleLength, schema,
|
|
6645
|
+
return yield Create(ValueErrorType.TupleLength, schema, path13, value);
|
|
6646
6646
|
}
|
|
6647
6647
|
if (!schema.items) {
|
|
6648
6648
|
return;
|
|
6649
6649
|
}
|
|
6650
6650
|
for (let i = 0; i < schema.items.length; i++) {
|
|
6651
|
-
yield* Visit6(schema.items[i], references, `${
|
|
6651
|
+
yield* Visit6(schema.items[i], references, `${path13}/${i}`, value[i]);
|
|
6652
6652
|
}
|
|
6653
6653
|
}
|
|
6654
|
-
function* FromUndefined3(schema, references,
|
|
6654
|
+
function* FromUndefined3(schema, references, path13, value) {
|
|
6655
6655
|
if (!IsUndefined2(value))
|
|
6656
|
-
yield Create(ValueErrorType.Undefined, schema,
|
|
6656
|
+
yield Create(ValueErrorType.Undefined, schema, path13, value);
|
|
6657
6657
|
}
|
|
6658
|
-
function* FromUnion12(schema, references,
|
|
6658
|
+
function* FromUnion12(schema, references, path13, value) {
|
|
6659
6659
|
if (Check(schema, references, value))
|
|
6660
6660
|
return;
|
|
6661
|
-
const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references,
|
|
6662
|
-
yield Create(ValueErrorType.Union, schema,
|
|
6661
|
+
const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references, path13, value)));
|
|
6662
|
+
yield Create(ValueErrorType.Union, schema, path13, value, errors);
|
|
6663
6663
|
}
|
|
6664
|
-
function* FromUint8Array3(schema, references,
|
|
6664
|
+
function* FromUint8Array3(schema, references, path13, value) {
|
|
6665
6665
|
if (!IsUint8Array2(value))
|
|
6666
|
-
return yield Create(ValueErrorType.Uint8Array, schema,
|
|
6666
|
+
return yield Create(ValueErrorType.Uint8Array, schema, path13, value);
|
|
6667
6667
|
if (IsDefined2(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
|
6668
|
-
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema,
|
|
6668
|
+
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path13, value);
|
|
6669
6669
|
}
|
|
6670
6670
|
if (IsDefined2(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
|
6671
|
-
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema,
|
|
6671
|
+
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path13, value);
|
|
6672
6672
|
}
|
|
6673
6673
|
}
|
|
6674
|
-
function* FromUnknown3(schema, references,
|
|
6674
|
+
function* FromUnknown3(schema, references, path13, value) {
|
|
6675
6675
|
}
|
|
6676
|
-
function* FromVoid3(schema, references,
|
|
6676
|
+
function* FromVoid3(schema, references, path13, value) {
|
|
6677
6677
|
if (!TypeSystemPolicy.IsVoidLike(value))
|
|
6678
|
-
yield Create(ValueErrorType.Void, schema,
|
|
6678
|
+
yield Create(ValueErrorType.Void, schema, path13, value);
|
|
6679
6679
|
}
|
|
6680
|
-
function* FromKind2(schema, references,
|
|
6680
|
+
function* FromKind2(schema, references, path13, value) {
|
|
6681
6681
|
const check2 = type_exports2.Get(schema[Kind]);
|
|
6682
6682
|
if (!check2(schema, value))
|
|
6683
|
-
yield Create(ValueErrorType.Kind, schema,
|
|
6683
|
+
yield Create(ValueErrorType.Kind, schema, path13, value);
|
|
6684
6684
|
}
|
|
6685
|
-
function* Visit6(schema, references,
|
|
6685
|
+
function* Visit6(schema, references, path13, value) {
|
|
6686
6686
|
const references_ = IsDefined2(schema.$id) ? [...references, schema] : references;
|
|
6687
6687
|
const schema_ = schema;
|
|
6688
6688
|
switch (schema_[Kind]) {
|
|
6689
6689
|
case "Any":
|
|
6690
|
-
return yield* FromAny3(schema_, references_,
|
|
6690
|
+
return yield* FromAny3(schema_, references_, path13, value);
|
|
6691
6691
|
case "Argument":
|
|
6692
|
-
return yield* FromArgument3(schema_, references_,
|
|
6692
|
+
return yield* FromArgument3(schema_, references_, path13, value);
|
|
6693
6693
|
case "Array":
|
|
6694
|
-
return yield* FromArray8(schema_, references_,
|
|
6694
|
+
return yield* FromArray8(schema_, references_, path13, value);
|
|
6695
6695
|
case "AsyncIterator":
|
|
6696
|
-
return yield* FromAsyncIterator5(schema_, references_,
|
|
6696
|
+
return yield* FromAsyncIterator5(schema_, references_, path13, value);
|
|
6697
6697
|
case "BigInt":
|
|
6698
|
-
return yield* FromBigInt3(schema_, references_,
|
|
6698
|
+
return yield* FromBigInt3(schema_, references_, path13, value);
|
|
6699
6699
|
case "Boolean":
|
|
6700
|
-
return yield* FromBoolean3(schema_, references_,
|
|
6700
|
+
return yield* FromBoolean3(schema_, references_, path13, value);
|
|
6701
6701
|
case "Constructor":
|
|
6702
|
-
return yield* FromConstructor5(schema_, references_,
|
|
6702
|
+
return yield* FromConstructor5(schema_, references_, path13, value);
|
|
6703
6703
|
case "Date":
|
|
6704
|
-
return yield* FromDate3(schema_, references_,
|
|
6704
|
+
return yield* FromDate3(schema_, references_, path13, value);
|
|
6705
6705
|
case "Function":
|
|
6706
|
-
return yield* FromFunction5(schema_, references_,
|
|
6706
|
+
return yield* FromFunction5(schema_, references_, path13, value);
|
|
6707
6707
|
case "Import":
|
|
6708
|
-
return yield* FromImport2(schema_, references_,
|
|
6708
|
+
return yield* FromImport2(schema_, references_, path13, value);
|
|
6709
6709
|
case "Integer":
|
|
6710
|
-
return yield* FromInteger3(schema_, references_,
|
|
6710
|
+
return yield* FromInteger3(schema_, references_, path13, value);
|
|
6711
6711
|
case "Intersect":
|
|
6712
|
-
return yield* FromIntersect10(schema_, references_,
|
|
6712
|
+
return yield* FromIntersect10(schema_, references_, path13, value);
|
|
6713
6713
|
case "Iterator":
|
|
6714
|
-
return yield* FromIterator5(schema_, references_,
|
|
6714
|
+
return yield* FromIterator5(schema_, references_, path13, value);
|
|
6715
6715
|
case "Literal":
|
|
6716
|
-
return yield* FromLiteral4(schema_, references_,
|
|
6716
|
+
return yield* FromLiteral4(schema_, references_, path13, value);
|
|
6717
6717
|
case "Never":
|
|
6718
|
-
return yield* FromNever3(schema_, references_,
|
|
6718
|
+
return yield* FromNever3(schema_, references_, path13, value);
|
|
6719
6719
|
case "Not":
|
|
6720
|
-
return yield* FromNot3(schema_, references_,
|
|
6720
|
+
return yield* FromNot3(schema_, references_, path13, value);
|
|
6721
6721
|
case "Null":
|
|
6722
|
-
return yield* FromNull3(schema_, references_,
|
|
6722
|
+
return yield* FromNull3(schema_, references_, path13, value);
|
|
6723
6723
|
case "Number":
|
|
6724
|
-
return yield* FromNumber3(schema_, references_,
|
|
6724
|
+
return yield* FromNumber3(schema_, references_, path13, value);
|
|
6725
6725
|
case "Object":
|
|
6726
|
-
return yield* FromObject9(schema_, references_,
|
|
6726
|
+
return yield* FromObject9(schema_, references_, path13, value);
|
|
6727
6727
|
case "Promise":
|
|
6728
|
-
return yield* FromPromise5(schema_, references_,
|
|
6728
|
+
return yield* FromPromise5(schema_, references_, path13, value);
|
|
6729
6729
|
case "Record":
|
|
6730
|
-
return yield* FromRecord5(schema_, references_,
|
|
6730
|
+
return yield* FromRecord5(schema_, references_, path13, value);
|
|
6731
6731
|
case "Ref":
|
|
6732
|
-
return yield* FromRef6(schema_, references_,
|
|
6732
|
+
return yield* FromRef6(schema_, references_, path13, value);
|
|
6733
6733
|
case "RegExp":
|
|
6734
|
-
return yield* FromRegExp3(schema_, references_,
|
|
6734
|
+
return yield* FromRegExp3(schema_, references_, path13, value);
|
|
6735
6735
|
case "String":
|
|
6736
|
-
return yield* FromString3(schema_, references_,
|
|
6736
|
+
return yield* FromString3(schema_, references_, path13, value);
|
|
6737
6737
|
case "Symbol":
|
|
6738
|
-
return yield* FromSymbol3(schema_, references_,
|
|
6738
|
+
return yield* FromSymbol3(schema_, references_, path13, value);
|
|
6739
6739
|
case "TemplateLiteral":
|
|
6740
|
-
return yield* FromTemplateLiteral5(schema_, references_,
|
|
6740
|
+
return yield* FromTemplateLiteral5(schema_, references_, path13, value);
|
|
6741
6741
|
case "This":
|
|
6742
|
-
return yield* FromThis2(schema_, references_,
|
|
6742
|
+
return yield* FromThis2(schema_, references_, path13, value);
|
|
6743
6743
|
case "Tuple":
|
|
6744
|
-
return yield* FromTuple7(schema_, references_,
|
|
6744
|
+
return yield* FromTuple7(schema_, references_, path13, value);
|
|
6745
6745
|
case "Undefined":
|
|
6746
|
-
return yield* FromUndefined3(schema_, references_,
|
|
6746
|
+
return yield* FromUndefined3(schema_, references_, path13, value);
|
|
6747
6747
|
case "Union":
|
|
6748
|
-
return yield* FromUnion12(schema_, references_,
|
|
6748
|
+
return yield* FromUnion12(schema_, references_, path13, value);
|
|
6749
6749
|
case "Uint8Array":
|
|
6750
|
-
return yield* FromUint8Array3(schema_, references_,
|
|
6750
|
+
return yield* FromUint8Array3(schema_, references_, path13, value);
|
|
6751
6751
|
case "Unknown":
|
|
6752
|
-
return yield* FromUnknown3(schema_, references_,
|
|
6752
|
+
return yield* FromUnknown3(schema_, references_, path13, value);
|
|
6753
6753
|
case "Void":
|
|
6754
|
-
return yield* FromVoid3(schema_, references_,
|
|
6754
|
+
return yield* FromVoid3(schema_, references_, path13, value);
|
|
6755
6755
|
default:
|
|
6756
6756
|
if (!type_exports2.Has(schema_[Kind]))
|
|
6757
6757
|
throw new ValueErrorsUnknownTypeError(schema);
|
|
6758
|
-
return yield* FromKind2(schema_, references_,
|
|
6758
|
+
return yield* FromKind2(schema_, references_, path13, value);
|
|
6759
6759
|
}
|
|
6760
6760
|
}
|
|
6761
6761
|
function Errors(...args) {
|
|
@@ -7797,58 +7797,58 @@ var TransformDecodeCheckError = class extends TypeBoxError {
|
|
|
7797
7797
|
}
|
|
7798
7798
|
};
|
|
7799
7799
|
var TransformDecodeError = class extends TypeBoxError {
|
|
7800
|
-
constructor(schema,
|
|
7800
|
+
constructor(schema, path13, value, error) {
|
|
7801
7801
|
super(error instanceof Error ? error.message : "Unknown error");
|
|
7802
7802
|
this.schema = schema;
|
|
7803
|
-
this.path =
|
|
7803
|
+
this.path = path13;
|
|
7804
7804
|
this.value = value;
|
|
7805
7805
|
this.error = error;
|
|
7806
7806
|
}
|
|
7807
7807
|
};
|
|
7808
|
-
function Default3(schema,
|
|
7808
|
+
function Default3(schema, path13, value) {
|
|
7809
7809
|
try {
|
|
7810
7810
|
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
7811
7811
|
} catch (error) {
|
|
7812
|
-
throw new TransformDecodeError(schema,
|
|
7812
|
+
throw new TransformDecodeError(schema, path13, value, error);
|
|
7813
7813
|
}
|
|
7814
7814
|
}
|
|
7815
|
-
function FromArray14(schema, references,
|
|
7816
|
-
return IsArray2(value) ? Default3(schema,
|
|
7815
|
+
function FromArray14(schema, references, path13, value) {
|
|
7816
|
+
return IsArray2(value) ? Default3(schema, path13, value.map((value2, index) => Visit11(schema.items, references, `${path13}/${index}`, value2))) : Default3(schema, path13, value);
|
|
7817
7817
|
}
|
|
7818
|
-
function FromIntersect15(schema, references,
|
|
7818
|
+
function FromIntersect15(schema, references, path13, value) {
|
|
7819
7819
|
if (!IsObject2(value) || IsValueType(value))
|
|
7820
|
-
return Default3(schema,
|
|
7820
|
+
return Default3(schema, path13, value);
|
|
7821
7821
|
const knownEntries = KeyOfPropertyEntries(schema);
|
|
7822
7822
|
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
7823
7823
|
const knownProperties = { ...value };
|
|
7824
7824
|
for (const [knownKey, knownSchema] of knownEntries)
|
|
7825
7825
|
if (knownKey in knownProperties) {
|
|
7826
|
-
knownProperties[knownKey] = Visit11(knownSchema, references, `${
|
|
7826
|
+
knownProperties[knownKey] = Visit11(knownSchema, references, `${path13}/${knownKey}`, knownProperties[knownKey]);
|
|
7827
7827
|
}
|
|
7828
7828
|
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
7829
|
-
return Default3(schema,
|
|
7829
|
+
return Default3(schema, path13, knownProperties);
|
|
7830
7830
|
}
|
|
7831
7831
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7832
7832
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
7833
7833
|
const unknownProperties = { ...knownProperties };
|
|
7834
7834
|
for (const key of unknownKeys)
|
|
7835
7835
|
if (!knownKeys.includes(key)) {
|
|
7836
|
-
unknownProperties[key] = Default3(unevaluatedProperties, `${
|
|
7836
|
+
unknownProperties[key] = Default3(unevaluatedProperties, `${path13}/${key}`, unknownProperties[key]);
|
|
7837
7837
|
}
|
|
7838
|
-
return Default3(schema,
|
|
7838
|
+
return Default3(schema, path13, unknownProperties);
|
|
7839
7839
|
}
|
|
7840
|
-
function FromImport7(schema, references,
|
|
7840
|
+
function FromImport7(schema, references, path13, value) {
|
|
7841
7841
|
const additional = globalThis.Object.values(schema.$defs);
|
|
7842
7842
|
const target = schema.$defs[schema.$ref];
|
|
7843
|
-
const result = Visit11(target, [...references, ...additional],
|
|
7844
|
-
return Default3(schema,
|
|
7843
|
+
const result = Visit11(target, [...references, ...additional], path13, value);
|
|
7844
|
+
return Default3(schema, path13, result);
|
|
7845
7845
|
}
|
|
7846
|
-
function FromNot5(schema, references,
|
|
7847
|
-
return Default3(schema,
|
|
7846
|
+
function FromNot5(schema, references, path13, value) {
|
|
7847
|
+
return Default3(schema, path13, Visit11(schema.not, references, path13, value));
|
|
7848
7848
|
}
|
|
7849
|
-
function FromObject15(schema, references,
|
|
7849
|
+
function FromObject15(schema, references, path13, value) {
|
|
7850
7850
|
if (!IsObject2(value))
|
|
7851
|
-
return Default3(schema,
|
|
7851
|
+
return Default3(schema, path13, value);
|
|
7852
7852
|
const knownKeys = KeyOfPropertyKeys(schema);
|
|
7853
7853
|
const knownProperties = { ...value };
|
|
7854
7854
|
for (const key of knownKeys) {
|
|
@@ -7856,90 +7856,90 @@ function FromObject15(schema, references, path14, value) {
|
|
|
7856
7856
|
continue;
|
|
7857
7857
|
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
7858
7858
|
continue;
|
|
7859
|
-
knownProperties[key] = Visit11(schema.properties[key], references, `${
|
|
7859
|
+
knownProperties[key] = Visit11(schema.properties[key], references, `${path13}/${key}`, knownProperties[key]);
|
|
7860
7860
|
}
|
|
7861
7861
|
if (!IsSchema(schema.additionalProperties)) {
|
|
7862
|
-
return Default3(schema,
|
|
7862
|
+
return Default3(schema, path13, knownProperties);
|
|
7863
7863
|
}
|
|
7864
7864
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7865
7865
|
const additionalProperties = schema.additionalProperties;
|
|
7866
7866
|
const unknownProperties = { ...knownProperties };
|
|
7867
7867
|
for (const key of unknownKeys)
|
|
7868
7868
|
if (!knownKeys.includes(key)) {
|
|
7869
|
-
unknownProperties[key] = Default3(additionalProperties, `${
|
|
7869
|
+
unknownProperties[key] = Default3(additionalProperties, `${path13}/${key}`, unknownProperties[key]);
|
|
7870
7870
|
}
|
|
7871
|
-
return Default3(schema,
|
|
7871
|
+
return Default3(schema, path13, unknownProperties);
|
|
7872
7872
|
}
|
|
7873
|
-
function FromRecord10(schema, references,
|
|
7873
|
+
function FromRecord10(schema, references, path13, value) {
|
|
7874
7874
|
if (!IsObject2(value))
|
|
7875
|
-
return Default3(schema,
|
|
7875
|
+
return Default3(schema, path13, value);
|
|
7876
7876
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7877
7877
|
const knownKeys = new RegExp(pattern);
|
|
7878
7878
|
const knownProperties = { ...value };
|
|
7879
7879
|
for (const key of Object.getOwnPropertyNames(value))
|
|
7880
7880
|
if (knownKeys.test(key)) {
|
|
7881
|
-
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${
|
|
7881
|
+
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path13}/${key}`, knownProperties[key]);
|
|
7882
7882
|
}
|
|
7883
7883
|
if (!IsSchema(schema.additionalProperties)) {
|
|
7884
|
-
return Default3(schema,
|
|
7884
|
+
return Default3(schema, path13, knownProperties);
|
|
7885
7885
|
}
|
|
7886
7886
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7887
7887
|
const additionalProperties = schema.additionalProperties;
|
|
7888
7888
|
const unknownProperties = { ...knownProperties };
|
|
7889
7889
|
for (const key of unknownKeys)
|
|
7890
7890
|
if (!knownKeys.test(key)) {
|
|
7891
|
-
unknownProperties[key] = Default3(additionalProperties, `${
|
|
7891
|
+
unknownProperties[key] = Default3(additionalProperties, `${path13}/${key}`, unknownProperties[key]);
|
|
7892
7892
|
}
|
|
7893
|
-
return Default3(schema,
|
|
7893
|
+
return Default3(schema, path13, unknownProperties);
|
|
7894
7894
|
}
|
|
7895
|
-
function FromRef11(schema, references,
|
|
7895
|
+
function FromRef11(schema, references, path13, value) {
|
|
7896
7896
|
const target = Deref(schema, references);
|
|
7897
|
-
return Default3(schema,
|
|
7897
|
+
return Default3(schema, path13, Visit11(target, references, path13, value));
|
|
7898
7898
|
}
|
|
7899
|
-
function FromThis7(schema, references,
|
|
7899
|
+
function FromThis7(schema, references, path13, value) {
|
|
7900
7900
|
const target = Deref(schema, references);
|
|
7901
|
-
return Default3(schema,
|
|
7901
|
+
return Default3(schema, path13, Visit11(target, references, path13, value));
|
|
7902
7902
|
}
|
|
7903
|
-
function FromTuple12(schema, references,
|
|
7904
|
-
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema,
|
|
7903
|
+
function FromTuple12(schema, references, path13, value) {
|
|
7904
|
+
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path13, schema.items.map((schema2, index) => Visit11(schema2, references, `${path13}/${index}`, value[index]))) : Default3(schema, path13, value);
|
|
7905
7905
|
}
|
|
7906
|
-
function FromUnion17(schema, references,
|
|
7906
|
+
function FromUnion17(schema, references, path13, value) {
|
|
7907
7907
|
for (const subschema of schema.anyOf) {
|
|
7908
7908
|
if (!Check(subschema, references, value))
|
|
7909
7909
|
continue;
|
|
7910
|
-
const decoded = Visit11(subschema, references,
|
|
7911
|
-
return Default3(schema,
|
|
7910
|
+
const decoded = Visit11(subschema, references, path13, value);
|
|
7911
|
+
return Default3(schema, path13, decoded);
|
|
7912
7912
|
}
|
|
7913
|
-
return Default3(schema,
|
|
7913
|
+
return Default3(schema, path13, value);
|
|
7914
7914
|
}
|
|
7915
|
-
function Visit11(schema, references,
|
|
7915
|
+
function Visit11(schema, references, path13, value) {
|
|
7916
7916
|
const references_ = Pushref(schema, references);
|
|
7917
7917
|
const schema_ = schema;
|
|
7918
7918
|
switch (schema[Kind]) {
|
|
7919
7919
|
case "Array":
|
|
7920
|
-
return FromArray14(schema_, references_,
|
|
7920
|
+
return FromArray14(schema_, references_, path13, value);
|
|
7921
7921
|
case "Import":
|
|
7922
|
-
return FromImport7(schema_, references_,
|
|
7922
|
+
return FromImport7(schema_, references_, path13, value);
|
|
7923
7923
|
case "Intersect":
|
|
7924
|
-
return FromIntersect15(schema_, references_,
|
|
7924
|
+
return FromIntersect15(schema_, references_, path13, value);
|
|
7925
7925
|
case "Not":
|
|
7926
|
-
return FromNot5(schema_, references_,
|
|
7926
|
+
return FromNot5(schema_, references_, path13, value);
|
|
7927
7927
|
case "Object":
|
|
7928
|
-
return FromObject15(schema_, references_,
|
|
7928
|
+
return FromObject15(schema_, references_, path13, value);
|
|
7929
7929
|
case "Record":
|
|
7930
|
-
return FromRecord10(schema_, references_,
|
|
7930
|
+
return FromRecord10(schema_, references_, path13, value);
|
|
7931
7931
|
case "Ref":
|
|
7932
|
-
return FromRef11(schema_, references_,
|
|
7932
|
+
return FromRef11(schema_, references_, path13, value);
|
|
7933
7933
|
case "Symbol":
|
|
7934
|
-
return Default3(schema_,
|
|
7934
|
+
return Default3(schema_, path13, value);
|
|
7935
7935
|
case "This":
|
|
7936
|
-
return FromThis7(schema_, references_,
|
|
7936
|
+
return FromThis7(schema_, references_, path13, value);
|
|
7937
7937
|
case "Tuple":
|
|
7938
|
-
return FromTuple12(schema_, references_,
|
|
7938
|
+
return FromTuple12(schema_, references_, path13, value);
|
|
7939
7939
|
case "Union":
|
|
7940
|
-
return FromUnion17(schema_, references_,
|
|
7940
|
+
return FromUnion17(schema_, references_, path13, value);
|
|
7941
7941
|
default:
|
|
7942
|
-
return Default3(schema_,
|
|
7942
|
+
return Default3(schema_, path13, value);
|
|
7943
7943
|
}
|
|
7944
7944
|
}
|
|
7945
7945
|
function TransformDecode(schema, references, value) {
|
|
@@ -7956,33 +7956,33 @@ var TransformEncodeCheckError = class extends TypeBoxError {
|
|
|
7956
7956
|
}
|
|
7957
7957
|
};
|
|
7958
7958
|
var TransformEncodeError = class extends TypeBoxError {
|
|
7959
|
-
constructor(schema,
|
|
7959
|
+
constructor(schema, path13, value, error) {
|
|
7960
7960
|
super(`${error instanceof Error ? error.message : "Unknown error"}`);
|
|
7961
7961
|
this.schema = schema;
|
|
7962
|
-
this.path =
|
|
7962
|
+
this.path = path13;
|
|
7963
7963
|
this.value = value;
|
|
7964
7964
|
this.error = error;
|
|
7965
7965
|
}
|
|
7966
7966
|
};
|
|
7967
|
-
function Default4(schema,
|
|
7967
|
+
function Default4(schema, path13, value) {
|
|
7968
7968
|
try {
|
|
7969
7969
|
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
7970
7970
|
} catch (error) {
|
|
7971
|
-
throw new TransformEncodeError(schema,
|
|
7971
|
+
throw new TransformEncodeError(schema, path13, value, error);
|
|
7972
7972
|
}
|
|
7973
7973
|
}
|
|
7974
|
-
function FromArray15(schema, references,
|
|
7975
|
-
const defaulted = Default4(schema,
|
|
7976
|
-
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${
|
|
7974
|
+
function FromArray15(schema, references, path13, value) {
|
|
7975
|
+
const defaulted = Default4(schema, path13, value);
|
|
7976
|
+
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path13}/${index}`, value2)) : defaulted;
|
|
7977
7977
|
}
|
|
7978
|
-
function FromImport8(schema, references,
|
|
7978
|
+
function FromImport8(schema, references, path13, value) {
|
|
7979
7979
|
const additional = globalThis.Object.values(schema.$defs);
|
|
7980
7980
|
const target = schema.$defs[schema.$ref];
|
|
7981
|
-
const result = Default4(schema,
|
|
7982
|
-
return Visit12(target, [...references, ...additional],
|
|
7981
|
+
const result = Default4(schema, path13, value);
|
|
7982
|
+
return Visit12(target, [...references, ...additional], path13, result);
|
|
7983
7983
|
}
|
|
7984
|
-
function FromIntersect16(schema, references,
|
|
7985
|
-
const defaulted = Default4(schema,
|
|
7984
|
+
function FromIntersect16(schema, references, path13, value) {
|
|
7985
|
+
const defaulted = Default4(schema, path13, value);
|
|
7986
7986
|
if (!IsObject2(value) || IsValueType(value))
|
|
7987
7987
|
return defaulted;
|
|
7988
7988
|
const knownEntries = KeyOfPropertyEntries(schema);
|
|
@@ -7990,7 +7990,7 @@ function FromIntersect16(schema, references, path14, value) {
|
|
|
7990
7990
|
const knownProperties = { ...defaulted };
|
|
7991
7991
|
for (const [knownKey, knownSchema] of knownEntries)
|
|
7992
7992
|
if (knownKey in knownProperties) {
|
|
7993
|
-
knownProperties[knownKey] = Visit12(knownSchema, references, `${
|
|
7993
|
+
knownProperties[knownKey] = Visit12(knownSchema, references, `${path13}/${knownKey}`, knownProperties[knownKey]);
|
|
7994
7994
|
}
|
|
7995
7995
|
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
7996
7996
|
return knownProperties;
|
|
@@ -8000,15 +8000,15 @@ function FromIntersect16(schema, references, path14, value) {
|
|
|
8000
8000
|
const properties = { ...knownProperties };
|
|
8001
8001
|
for (const key of unknownKeys)
|
|
8002
8002
|
if (!knownKeys.includes(key)) {
|
|
8003
|
-
properties[key] = Default4(unevaluatedProperties, `${
|
|
8003
|
+
properties[key] = Default4(unevaluatedProperties, `${path13}/${key}`, properties[key]);
|
|
8004
8004
|
}
|
|
8005
8005
|
return properties;
|
|
8006
8006
|
}
|
|
8007
|
-
function FromNot6(schema, references,
|
|
8008
|
-
return Default4(schema.not,
|
|
8007
|
+
function FromNot6(schema, references, path13, value) {
|
|
8008
|
+
return Default4(schema.not, path13, Default4(schema, path13, value));
|
|
8009
8009
|
}
|
|
8010
|
-
function FromObject16(schema, references,
|
|
8011
|
-
const defaulted = Default4(schema,
|
|
8010
|
+
function FromObject16(schema, references, path13, value) {
|
|
8011
|
+
const defaulted = Default4(schema, path13, value);
|
|
8012
8012
|
if (!IsObject2(defaulted))
|
|
8013
8013
|
return defaulted;
|
|
8014
8014
|
const knownKeys = KeyOfPropertyKeys(schema);
|
|
@@ -8018,7 +8018,7 @@ function FromObject16(schema, references, path14, value) {
|
|
|
8018
8018
|
continue;
|
|
8019
8019
|
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
8020
8020
|
continue;
|
|
8021
|
-
knownProperties[key] = Visit12(schema.properties[key], references, `${
|
|
8021
|
+
knownProperties[key] = Visit12(schema.properties[key], references, `${path13}/${key}`, knownProperties[key]);
|
|
8022
8022
|
}
|
|
8023
8023
|
if (!IsSchema(schema.additionalProperties)) {
|
|
8024
8024
|
return knownProperties;
|
|
@@ -8028,12 +8028,12 @@ function FromObject16(schema, references, path14, value) {
|
|
|
8028
8028
|
const properties = { ...knownProperties };
|
|
8029
8029
|
for (const key of unknownKeys)
|
|
8030
8030
|
if (!knownKeys.includes(key)) {
|
|
8031
|
-
properties[key] = Default4(additionalProperties, `${
|
|
8031
|
+
properties[key] = Default4(additionalProperties, `${path13}/${key}`, properties[key]);
|
|
8032
8032
|
}
|
|
8033
8033
|
return properties;
|
|
8034
8034
|
}
|
|
8035
|
-
function FromRecord11(schema, references,
|
|
8036
|
-
const defaulted = Default4(schema,
|
|
8035
|
+
function FromRecord11(schema, references, path13, value) {
|
|
8036
|
+
const defaulted = Default4(schema, path13, value);
|
|
8037
8037
|
if (!IsObject2(value))
|
|
8038
8038
|
return defaulted;
|
|
8039
8039
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
@@ -8041,7 +8041,7 @@ function FromRecord11(schema, references, path14, value) {
|
|
|
8041
8041
|
const knownProperties = { ...defaulted };
|
|
8042
8042
|
for (const key of Object.getOwnPropertyNames(value))
|
|
8043
8043
|
if (knownKeys.test(key)) {
|
|
8044
|
-
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${
|
|
8044
|
+
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path13}/${key}`, knownProperties[key]);
|
|
8045
8045
|
}
|
|
8046
8046
|
if (!IsSchema(schema.additionalProperties)) {
|
|
8047
8047
|
return knownProperties;
|
|
@@ -8051,65 +8051,65 @@ function FromRecord11(schema, references, path14, value) {
|
|
|
8051
8051
|
const properties = { ...knownProperties };
|
|
8052
8052
|
for (const key of unknownKeys)
|
|
8053
8053
|
if (!knownKeys.test(key)) {
|
|
8054
|
-
properties[key] = Default4(additionalProperties, `${
|
|
8054
|
+
properties[key] = Default4(additionalProperties, `${path13}/${key}`, properties[key]);
|
|
8055
8055
|
}
|
|
8056
8056
|
return properties;
|
|
8057
8057
|
}
|
|
8058
|
-
function FromRef12(schema, references,
|
|
8058
|
+
function FromRef12(schema, references, path13, value) {
|
|
8059
8059
|
const target = Deref(schema, references);
|
|
8060
|
-
const resolved = Visit12(target, references,
|
|
8061
|
-
return Default4(schema,
|
|
8060
|
+
const resolved = Visit12(target, references, path13, value);
|
|
8061
|
+
return Default4(schema, path13, resolved);
|
|
8062
8062
|
}
|
|
8063
|
-
function FromThis8(schema, references,
|
|
8063
|
+
function FromThis8(schema, references, path13, value) {
|
|
8064
8064
|
const target = Deref(schema, references);
|
|
8065
|
-
const resolved = Visit12(target, references,
|
|
8066
|
-
return Default4(schema,
|
|
8065
|
+
const resolved = Visit12(target, references, path13, value);
|
|
8066
|
+
return Default4(schema, path13, resolved);
|
|
8067
8067
|
}
|
|
8068
|
-
function FromTuple13(schema, references,
|
|
8069
|
-
const value1 = Default4(schema,
|
|
8070
|
-
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${
|
|
8068
|
+
function FromTuple13(schema, references, path13, value) {
|
|
8069
|
+
const value1 = Default4(schema, path13, value);
|
|
8070
|
+
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path13}/${index}`, value1[index])) : [];
|
|
8071
8071
|
}
|
|
8072
|
-
function FromUnion18(schema, references,
|
|
8072
|
+
function FromUnion18(schema, references, path13, value) {
|
|
8073
8073
|
for (const subschema of schema.anyOf) {
|
|
8074
8074
|
if (!Check(subschema, references, value))
|
|
8075
8075
|
continue;
|
|
8076
|
-
const value1 = Visit12(subschema, references,
|
|
8077
|
-
return Default4(schema,
|
|
8076
|
+
const value1 = Visit12(subschema, references, path13, value);
|
|
8077
|
+
return Default4(schema, path13, value1);
|
|
8078
8078
|
}
|
|
8079
8079
|
for (const subschema of schema.anyOf) {
|
|
8080
|
-
const value1 = Visit12(subschema, references,
|
|
8080
|
+
const value1 = Visit12(subschema, references, path13, value);
|
|
8081
8081
|
if (!Check(schema, references, value1))
|
|
8082
8082
|
continue;
|
|
8083
|
-
return Default4(schema,
|
|
8083
|
+
return Default4(schema, path13, value1);
|
|
8084
8084
|
}
|
|
8085
|
-
return Default4(schema,
|
|
8085
|
+
return Default4(schema, path13, value);
|
|
8086
8086
|
}
|
|
8087
|
-
function Visit12(schema, references,
|
|
8087
|
+
function Visit12(schema, references, path13, value) {
|
|
8088
8088
|
const references_ = Pushref(schema, references);
|
|
8089
8089
|
const schema_ = schema;
|
|
8090
8090
|
switch (schema[Kind]) {
|
|
8091
8091
|
case "Array":
|
|
8092
|
-
return FromArray15(schema_, references_,
|
|
8092
|
+
return FromArray15(schema_, references_, path13, value);
|
|
8093
8093
|
case "Import":
|
|
8094
|
-
return FromImport8(schema_, references_,
|
|
8094
|
+
return FromImport8(schema_, references_, path13, value);
|
|
8095
8095
|
case "Intersect":
|
|
8096
|
-
return FromIntersect16(schema_, references_,
|
|
8096
|
+
return FromIntersect16(schema_, references_, path13, value);
|
|
8097
8097
|
case "Not":
|
|
8098
|
-
return FromNot6(schema_, references_,
|
|
8098
|
+
return FromNot6(schema_, references_, path13, value);
|
|
8099
8099
|
case "Object":
|
|
8100
|
-
return FromObject16(schema_, references_,
|
|
8100
|
+
return FromObject16(schema_, references_, path13, value);
|
|
8101
8101
|
case "Record":
|
|
8102
|
-
return FromRecord11(schema_, references_,
|
|
8102
|
+
return FromRecord11(schema_, references_, path13, value);
|
|
8103
8103
|
case "Ref":
|
|
8104
|
-
return FromRef12(schema_, references_,
|
|
8104
|
+
return FromRef12(schema_, references_, path13, value);
|
|
8105
8105
|
case "This":
|
|
8106
|
-
return FromThis8(schema_, references_,
|
|
8106
|
+
return FromThis8(schema_, references_, path13, value);
|
|
8107
8107
|
case "Tuple":
|
|
8108
|
-
return FromTuple13(schema_, references_,
|
|
8108
|
+
return FromTuple13(schema_, references_, path13, value);
|
|
8109
8109
|
case "Union":
|
|
8110
|
-
return FromUnion18(schema_, references_,
|
|
8110
|
+
return FromUnion18(schema_, references_, path13, value);
|
|
8111
8111
|
default:
|
|
8112
|
-
return Default4(schema_,
|
|
8112
|
+
return Default4(schema_, path13, value);
|
|
8113
8113
|
}
|
|
8114
8114
|
}
|
|
8115
8115
|
function TransformEncode(schema, references, value) {
|
|
@@ -8377,18 +8377,18 @@ __export(pointer_exports, {
|
|
|
8377
8377
|
ValuePointerRootSetError: () => ValuePointerRootSetError
|
|
8378
8378
|
});
|
|
8379
8379
|
var ValuePointerRootSetError = class extends TypeBoxError {
|
|
8380
|
-
constructor(value,
|
|
8380
|
+
constructor(value, path13, update) {
|
|
8381
8381
|
super("Cannot set root value");
|
|
8382
8382
|
this.value = value;
|
|
8383
|
-
this.path =
|
|
8383
|
+
this.path = path13;
|
|
8384
8384
|
this.update = update;
|
|
8385
8385
|
}
|
|
8386
8386
|
};
|
|
8387
8387
|
var ValuePointerRootDeleteError = class extends TypeBoxError {
|
|
8388
|
-
constructor(value,
|
|
8388
|
+
constructor(value, path13) {
|
|
8389
8389
|
super("Cannot delete root value");
|
|
8390
8390
|
this.value = value;
|
|
8391
|
-
this.path =
|
|
8391
|
+
this.path = path13;
|
|
8392
8392
|
}
|
|
8393
8393
|
};
|
|
8394
8394
|
function Escape2(component) {
|
|
@@ -8532,82 +8532,82 @@ var ValueDiffError = class extends TypeBoxError {
|
|
|
8532
8532
|
this.value = value;
|
|
8533
8533
|
}
|
|
8534
8534
|
};
|
|
8535
|
-
function CreateUpdate(
|
|
8536
|
-
return { type: "update", path:
|
|
8535
|
+
function CreateUpdate(path13, value) {
|
|
8536
|
+
return { type: "update", path: path13, value };
|
|
8537
8537
|
}
|
|
8538
|
-
function CreateInsert(
|
|
8539
|
-
return { type: "insert", path:
|
|
8538
|
+
function CreateInsert(path13, value) {
|
|
8539
|
+
return { type: "insert", path: path13, value };
|
|
8540
8540
|
}
|
|
8541
|
-
function CreateDelete(
|
|
8542
|
-
return { type: "delete", path:
|
|
8541
|
+
function CreateDelete(path13) {
|
|
8542
|
+
return { type: "delete", path: path13 };
|
|
8543
8543
|
}
|
|
8544
8544
|
function AssertDiffable(value) {
|
|
8545
8545
|
if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
|
|
8546
8546
|
throw new ValueDiffError(value, "Cannot diff objects with symbols");
|
|
8547
8547
|
}
|
|
8548
|
-
function* ObjectType4(
|
|
8548
|
+
function* ObjectType4(path13, current, next) {
|
|
8549
8549
|
AssertDiffable(current);
|
|
8550
8550
|
AssertDiffable(next);
|
|
8551
8551
|
if (!IsStandardObject(next))
|
|
8552
|
-
return yield CreateUpdate(
|
|
8552
|
+
return yield CreateUpdate(path13, next);
|
|
8553
8553
|
const currentKeys = globalThis.Object.getOwnPropertyNames(current);
|
|
8554
8554
|
const nextKeys = globalThis.Object.getOwnPropertyNames(next);
|
|
8555
8555
|
for (const key of nextKeys) {
|
|
8556
8556
|
if (HasPropertyKey2(current, key))
|
|
8557
8557
|
continue;
|
|
8558
|
-
yield CreateInsert(`${
|
|
8558
|
+
yield CreateInsert(`${path13}/${key}`, next[key]);
|
|
8559
8559
|
}
|
|
8560
8560
|
for (const key of currentKeys) {
|
|
8561
8561
|
if (!HasPropertyKey2(next, key))
|
|
8562
8562
|
continue;
|
|
8563
8563
|
if (Equal(current, next))
|
|
8564
8564
|
continue;
|
|
8565
|
-
yield* Visit15(`${
|
|
8565
|
+
yield* Visit15(`${path13}/${key}`, current[key], next[key]);
|
|
8566
8566
|
}
|
|
8567
8567
|
for (const key of currentKeys) {
|
|
8568
8568
|
if (HasPropertyKey2(next, key))
|
|
8569
8569
|
continue;
|
|
8570
|
-
yield CreateDelete(`${
|
|
8570
|
+
yield CreateDelete(`${path13}/${key}`);
|
|
8571
8571
|
}
|
|
8572
8572
|
}
|
|
8573
|
-
function* ArrayType4(
|
|
8573
|
+
function* ArrayType4(path13, current, next) {
|
|
8574
8574
|
if (!IsArray2(next))
|
|
8575
|
-
return yield CreateUpdate(
|
|
8575
|
+
return yield CreateUpdate(path13, next);
|
|
8576
8576
|
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
8577
|
-
yield* Visit15(`${
|
|
8577
|
+
yield* Visit15(`${path13}/${i}`, current[i], next[i]);
|
|
8578
8578
|
}
|
|
8579
8579
|
for (let i = 0; i < next.length; i++) {
|
|
8580
8580
|
if (i < current.length)
|
|
8581
8581
|
continue;
|
|
8582
|
-
yield CreateInsert(`${
|
|
8582
|
+
yield CreateInsert(`${path13}/${i}`, next[i]);
|
|
8583
8583
|
}
|
|
8584
8584
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
8585
8585
|
if (i < next.length)
|
|
8586
8586
|
continue;
|
|
8587
|
-
yield CreateDelete(`${
|
|
8587
|
+
yield CreateDelete(`${path13}/${i}`);
|
|
8588
8588
|
}
|
|
8589
8589
|
}
|
|
8590
|
-
function* TypedArrayType2(
|
|
8590
|
+
function* TypedArrayType2(path13, current, next) {
|
|
8591
8591
|
if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
|
8592
|
-
return yield CreateUpdate(
|
|
8592
|
+
return yield CreateUpdate(path13, next);
|
|
8593
8593
|
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
8594
|
-
yield* Visit15(`${
|
|
8594
|
+
yield* Visit15(`${path13}/${i}`, current[i], next[i]);
|
|
8595
8595
|
}
|
|
8596
8596
|
}
|
|
8597
|
-
function* ValueType2(
|
|
8597
|
+
function* ValueType2(path13, current, next) {
|
|
8598
8598
|
if (current === next)
|
|
8599
8599
|
return;
|
|
8600
|
-
yield CreateUpdate(
|
|
8600
|
+
yield CreateUpdate(path13, next);
|
|
8601
8601
|
}
|
|
8602
|
-
function* Visit15(
|
|
8602
|
+
function* Visit15(path13, current, next) {
|
|
8603
8603
|
if (IsStandardObject(current))
|
|
8604
|
-
return yield* ObjectType4(
|
|
8604
|
+
return yield* ObjectType4(path13, current, next);
|
|
8605
8605
|
if (IsArray2(current))
|
|
8606
|
-
return yield* ArrayType4(
|
|
8606
|
+
return yield* ArrayType4(path13, current, next);
|
|
8607
8607
|
if (IsTypedArray(current))
|
|
8608
|
-
return yield* TypedArrayType2(
|
|
8608
|
+
return yield* TypedArrayType2(path13, current, next);
|
|
8609
8609
|
if (IsValueType(current))
|
|
8610
|
-
return yield* ValueType2(
|
|
8610
|
+
return yield* ValueType2(path13, current, next);
|
|
8611
8611
|
throw new ValueDiffError(current, "Unable to diff value");
|
|
8612
8612
|
}
|
|
8613
8613
|
function Diff(current, next) {
|
|
@@ -8664,9 +8664,9 @@ var ValueMutateError = class extends TypeBoxError {
|
|
|
8664
8664
|
super(message);
|
|
8665
8665
|
}
|
|
8666
8666
|
};
|
|
8667
|
-
function ObjectType5(root,
|
|
8667
|
+
function ObjectType5(root, path13, current, next) {
|
|
8668
8668
|
if (!IsStandardObject2(current)) {
|
|
8669
|
-
pointer_exports.Set(root,
|
|
8669
|
+
pointer_exports.Set(root, path13, Clone2(next));
|
|
8670
8670
|
} else {
|
|
8671
8671
|
const currentKeys = Object.getOwnPropertyNames(current);
|
|
8672
8672
|
const nextKeys = Object.getOwnPropertyNames(next);
|
|
@@ -8681,43 +8681,43 @@ function ObjectType5(root, path14, current, next) {
|
|
|
8681
8681
|
}
|
|
8682
8682
|
}
|
|
8683
8683
|
for (const nextKey of nextKeys) {
|
|
8684
|
-
Visit16(root, `${
|
|
8684
|
+
Visit16(root, `${path13}/${nextKey}`, current[nextKey], next[nextKey]);
|
|
8685
8685
|
}
|
|
8686
8686
|
}
|
|
8687
8687
|
}
|
|
8688
|
-
function ArrayType5(root,
|
|
8688
|
+
function ArrayType5(root, path13, current, next) {
|
|
8689
8689
|
if (!IsArray2(current)) {
|
|
8690
|
-
pointer_exports.Set(root,
|
|
8690
|
+
pointer_exports.Set(root, path13, Clone2(next));
|
|
8691
8691
|
} else {
|
|
8692
8692
|
for (let index = 0; index < next.length; index++) {
|
|
8693
|
-
Visit16(root, `${
|
|
8693
|
+
Visit16(root, `${path13}/${index}`, current[index], next[index]);
|
|
8694
8694
|
}
|
|
8695
8695
|
current.splice(next.length);
|
|
8696
8696
|
}
|
|
8697
8697
|
}
|
|
8698
|
-
function TypedArrayType3(root,
|
|
8698
|
+
function TypedArrayType3(root, path13, current, next) {
|
|
8699
8699
|
if (IsTypedArray(current) && current.length === next.length) {
|
|
8700
8700
|
for (let i = 0; i < current.length; i++) {
|
|
8701
8701
|
current[i] = next[i];
|
|
8702
8702
|
}
|
|
8703
8703
|
} else {
|
|
8704
|
-
pointer_exports.Set(root,
|
|
8704
|
+
pointer_exports.Set(root, path13, Clone2(next));
|
|
8705
8705
|
}
|
|
8706
8706
|
}
|
|
8707
|
-
function ValueType3(root,
|
|
8707
|
+
function ValueType3(root, path13, current, next) {
|
|
8708
8708
|
if (current === next)
|
|
8709
8709
|
return;
|
|
8710
|
-
pointer_exports.Set(root,
|
|
8710
|
+
pointer_exports.Set(root, path13, next);
|
|
8711
8711
|
}
|
|
8712
|
-
function Visit16(root,
|
|
8712
|
+
function Visit16(root, path13, current, next) {
|
|
8713
8713
|
if (IsArray2(next))
|
|
8714
|
-
return ArrayType5(root,
|
|
8714
|
+
return ArrayType5(root, path13, current, next);
|
|
8715
8715
|
if (IsTypedArray(next))
|
|
8716
|
-
return TypedArrayType3(root,
|
|
8716
|
+
return TypedArrayType3(root, path13, current, next);
|
|
8717
8717
|
if (IsStandardObject2(next))
|
|
8718
|
-
return ObjectType5(root,
|
|
8718
|
+
return ObjectType5(root, path13, current, next);
|
|
8719
8719
|
if (IsValueType(next))
|
|
8720
|
-
return ValueType3(root,
|
|
8720
|
+
return ValueType3(root, path13, current, next);
|
|
8721
8721
|
}
|
|
8722
8722
|
function IsNonMutableValue(value) {
|
|
8723
8723
|
return IsTypedArray(value) || IsValueType(value);
|
|
@@ -8815,9 +8815,10 @@ __export(value_exports2, {
|
|
|
8815
8815
|
});
|
|
8816
8816
|
|
|
8817
8817
|
// src/lib/types.ts
|
|
8818
|
-
var CURRENT_REGISTRY_VERSION =
|
|
8818
|
+
var CURRENT_REGISTRY_VERSION = 2;
|
|
8819
8819
|
var CAPSULE_VERSION = 1;
|
|
8820
8820
|
var MAX_POST_ERROR_LENGTH = 500;
|
|
8821
|
+
var MAX_NAME_LENGTH = 100;
|
|
8821
8822
|
var DOCTOR_ALL_COOLDOWN_MS = 60 * 60 * 1e3;
|
|
8822
8823
|
var DOCTOR_PER_TOPIC_CAP_MS = 24 * 60 * 60 * 1e3;
|
|
8823
8824
|
var INACTIVE_AFTER_DAYS = 7;
|
|
@@ -8842,6 +8843,7 @@ var TopicEntrySchema = Type.Object({
|
|
|
8842
8843
|
groupId: Type.String({ pattern: "^-?\\d+$" }),
|
|
8843
8844
|
threadId: Type.String({ pattern: "^\\d+$" }),
|
|
8844
8845
|
slug: Type.String({ pattern: "^[a-z][a-z0-9-]{0,49}$" }),
|
|
8846
|
+
name: Type.String({ minLength: 1, maxLength: MAX_NAME_LENGTH }),
|
|
8845
8847
|
type: TopicTypeSchema,
|
|
8846
8848
|
status: TopicStatusSchema,
|
|
8847
8849
|
capsuleVersion: Type.Integer({ minimum: 1 }),
|
|
@@ -8880,6 +8882,12 @@ var BASE_FILES = [
|
|
|
8880
8882
|
function topicKey(groupId, threadId) {
|
|
8881
8883
|
return `${groupId}:${threadId}`;
|
|
8882
8884
|
}
|
|
8885
|
+
function generateSlug(threadId, groupId, existingSlugs) {
|
|
8886
|
+
const base = `t-${threadId}`;
|
|
8887
|
+
if (!existingSlugs.has(base)) return base;
|
|
8888
|
+
const suffix = groupId.replace(/^-/, "").slice(-4);
|
|
8889
|
+
return `t-${threadId}-${suffix}`;
|
|
8890
|
+
}
|
|
8883
8891
|
|
|
8884
8892
|
// src/lib/registry.ts
|
|
8885
8893
|
var REGISTRY_FILENAME = "topics.json";
|
|
@@ -8890,8 +8898,17 @@ function registryPath(workspaceDir) {
|
|
|
8890
8898
|
return path.join(workspaceDir, "projects", REGISTRY_FILENAME);
|
|
8891
8899
|
}
|
|
8892
8900
|
var migrations = {
|
|
8893
|
-
|
|
8894
|
-
|
|
8901
|
+
"1_to_2": (data) => {
|
|
8902
|
+
const topics = data["topics"];
|
|
8903
|
+
if (topics && typeof topics === "object" && !Array.isArray(topics)) {
|
|
8904
|
+
for (const entry of Object.values(topics)) {
|
|
8905
|
+
if (!entry["name"] && typeof entry["slug"] === "string") {
|
|
8906
|
+
entry["name"] = entry["slug"];
|
|
8907
|
+
}
|
|
8908
|
+
}
|
|
8909
|
+
}
|
|
8910
|
+
return data;
|
|
8911
|
+
}
|
|
8895
8912
|
};
|
|
8896
8913
|
function migrateRegistry(data) {
|
|
8897
8914
|
const rawVersion = data["version"];
|
|
@@ -8994,13 +9011,6 @@ async function withRegistry(workspaceDir, fn) {
|
|
|
8994
9011
|
import * as crypto from "node:crypto";
|
|
8995
9012
|
import * as fs2 from "node:fs";
|
|
8996
9013
|
import * as path2 from "node:path";
|
|
8997
|
-
var SLUG_RE = /^[a-z][a-z0-9-]{0,49}$/;
|
|
8998
|
-
function validateSlug(slug) {
|
|
8999
|
-
return SLUG_RE.test(slug);
|
|
9000
|
-
}
|
|
9001
|
-
function sanitizeSlug(title) {
|
|
9002
|
-
return title.toLowerCase().replace(/\./g, "").replace(/[^a-z0-9-]/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "").slice(0, 50);
|
|
9003
|
-
}
|
|
9004
9014
|
function jailCheck(base, userPath) {
|
|
9005
9015
|
const resolved = path2.resolve(base, userPath);
|
|
9006
9016
|
const normalizedBase = path2.resolve(base) + path2.sep;
|
|
@@ -9045,21 +9055,21 @@ function validateGroupId(id) {
|
|
|
9045
9055
|
function validateThreadId(id) {
|
|
9046
9056
|
return THREAD_ID_RE.test(id);
|
|
9047
9057
|
}
|
|
9048
|
-
var CALLBACK_RE = /^tm:[a-z0-9]
|
|
9049
|
-
function buildCallbackData(action,
|
|
9050
|
-
const payload = `tm:${action}:${
|
|
9058
|
+
var CALLBACK_RE = /^tm:[a-z0-9]+:-?\d+:\d+:[a-f0-9]+$/;
|
|
9059
|
+
function buildCallbackData(action, groupId, threadId, secret) {
|
|
9060
|
+
const payload = `tm:${action}:${groupId}:${threadId}`;
|
|
9051
9061
|
const sig = hmacSign(secret, payload);
|
|
9052
9062
|
return `${payload}:${sig}`;
|
|
9053
9063
|
}
|
|
9054
9064
|
function parseAndVerifyCallback(data, secret, contextGroupId, contextThreadId) {
|
|
9055
9065
|
if (!CALLBACK_RE.test(data)) return null;
|
|
9056
9066
|
const parts = data.split(":");
|
|
9057
|
-
if (parts.length !==
|
|
9058
|
-
const [, action,
|
|
9067
|
+
if (parts.length !== 5) return null;
|
|
9068
|
+
const [, action, groupId, threadId, signature] = parts;
|
|
9059
9069
|
if (groupId !== contextGroupId || threadId !== contextThreadId) return null;
|
|
9060
|
-
const payload = `tm:${action}:${
|
|
9070
|
+
const payload = `tm:${action}:${groupId}:${threadId}`;
|
|
9061
9071
|
if (!hmacVerify(secret, payload, signature)) return null;
|
|
9062
|
-
return { action,
|
|
9072
|
+
return { action, groupId, threadId };
|
|
9063
9073
|
}
|
|
9064
9074
|
|
|
9065
9075
|
// src/lib/audit.ts
|
|
@@ -9148,11 +9158,11 @@ function checkAuthorization(userId, command, registry, topicAllowFrom) {
|
|
|
9148
9158
|
import * as fs4 from "node:fs";
|
|
9149
9159
|
import * as path4 from "node:path";
|
|
9150
9160
|
var BASE_TEMPLATES = {
|
|
9151
|
-
"README.md": (
|
|
9161
|
+
"README.md": (name) => `# ${name}
|
|
9152
9162
|
|
|
9153
9163
|
_Describe what this topic is about._
|
|
9154
9164
|
`,
|
|
9155
|
-
"STATUS.md": (
|
|
9165
|
+
"STATUS.md": (name) => `# Status: ${name}
|
|
9156
9166
|
|
|
9157
9167
|
## Last done (UTC)
|
|
9158
9168
|
|
|
@@ -9166,7 +9176,7 @@ _No work recorded yet._
|
|
|
9166
9176
|
2. [T-2] _Define second task in TODO.md_
|
|
9167
9177
|
3. [T-3] _Define third task in TODO.md_
|
|
9168
9178
|
`,
|
|
9169
|
-
"TODO.md": (
|
|
9179
|
+
"TODO.md": (name) => `# TODO: ${name}
|
|
9170
9180
|
|
|
9171
9181
|
## Backlog
|
|
9172
9182
|
|
|
@@ -9178,51 +9188,51 @@ _No work recorded yet._
|
|
|
9178
9188
|
|
|
9179
9189
|
_None yet._
|
|
9180
9190
|
`,
|
|
9181
|
-
"COMMANDS.md": (
|
|
9191
|
+
"COMMANDS.md": (name) => `# Commands: ${name}
|
|
9182
9192
|
|
|
9183
9193
|
_Build, deploy, test, and other commands for this topic. Kept here so they're not lost on reset._
|
|
9184
9194
|
`,
|
|
9185
|
-
"LINKS.md": (
|
|
9195
|
+
"LINKS.md": (name) => `# Links: ${name}
|
|
9186
9196
|
|
|
9187
9197
|
_URLs, paths, and service endpoints for this topic._
|
|
9188
9198
|
`,
|
|
9189
|
-
"CRON.md": (
|
|
9199
|
+
"CRON.md": (name) => `# Cron: ${name}
|
|
9190
9200
|
|
|
9191
9201
|
_Cron job IDs and schedules for this topic._
|
|
9192
9202
|
`,
|
|
9193
|
-
"NOTES.md": (
|
|
9203
|
+
"NOTES.md": (name) => `# Notes: ${name}
|
|
9194
9204
|
|
|
9195
9205
|
_Anything worth remembering about this topic._
|
|
9196
9206
|
`
|
|
9197
9207
|
};
|
|
9198
9208
|
var OVERLAY_TEMPLATES = {
|
|
9199
|
-
"ARCHITECTURE.md": (
|
|
9209
|
+
"ARCHITECTURE.md": (name) => `# Architecture: ${name}
|
|
9200
9210
|
|
|
9201
9211
|
_Components, data flow, dependencies, and design decisions._
|
|
9202
9212
|
`,
|
|
9203
|
-
"DEPLOY.md": (
|
|
9213
|
+
"DEPLOY.md": (name) => `# Deployment: ${name}
|
|
9204
9214
|
|
|
9205
9215
|
_Environments, deployment steps, rollback procedures, and infra details._
|
|
9206
9216
|
`,
|
|
9207
|
-
"SOURCES.md": (
|
|
9217
|
+
"SOURCES.md": (name) => `# Sources: ${name}
|
|
9208
9218
|
|
|
9209
9219
|
_Papers, articles, datasets, APIs, and other reference material._
|
|
9210
9220
|
`,
|
|
9211
|
-
"FINDINGS.md": (
|
|
9221
|
+
"FINDINGS.md": (name) => `# Findings: ${name}
|
|
9212
9222
|
|
|
9213
9223
|
_Conclusions, insights, data summaries, and recommendations._
|
|
9214
9224
|
`,
|
|
9215
|
-
"CAMPAIGNS.md": (
|
|
9225
|
+
"CAMPAIGNS.md": (name) => `# Campaigns: ${name}
|
|
9216
9226
|
|
|
9217
9227
|
_Active campaigns, target audiences, channels, timelines, and budgets._
|
|
9218
9228
|
`,
|
|
9219
|
-
"METRICS.md": (
|
|
9229
|
+
"METRICS.md": (name) => `# Metrics: ${name}
|
|
9220
9230
|
|
|
9221
9231
|
_KPIs, conversion rates, engagement stats, and performance data._
|
|
9222
9232
|
`
|
|
9223
9233
|
};
|
|
9224
9234
|
var CAPSULE_FILE_MODE = 416;
|
|
9225
|
-
function scaffoldCapsule(projectsBase, slug, type) {
|
|
9235
|
+
function scaffoldCapsule(projectsBase, slug, name, type) {
|
|
9226
9236
|
const capsuleDir = path4.join(projectsBase, slug);
|
|
9227
9237
|
if (!jailCheck(projectsBase, slug)) {
|
|
9228
9238
|
throw new Error(`Path escapes projects directory: ${slug}`);
|
|
@@ -9235,7 +9245,7 @@ function scaffoldCapsule(projectsBase, slug, type) {
|
|
|
9235
9245
|
const templateFn = BASE_TEMPLATES[file];
|
|
9236
9246
|
if (templateFn) {
|
|
9237
9247
|
const filePath = path4.join(capsuleDir, file);
|
|
9238
|
-
fs4.writeFileSync(filePath, templateFn(
|
|
9248
|
+
fs4.writeFileSync(filePath, templateFn(name), { mode: CAPSULE_FILE_MODE });
|
|
9239
9249
|
}
|
|
9240
9250
|
}
|
|
9241
9251
|
const overlays = OVERLAY_FILES[type];
|
|
@@ -9243,11 +9253,11 @@ function scaffoldCapsule(projectsBase, slug, type) {
|
|
|
9243
9253
|
const templateFn = OVERLAY_TEMPLATES[file];
|
|
9244
9254
|
if (templateFn) {
|
|
9245
9255
|
const filePath = path4.join(capsuleDir, file);
|
|
9246
|
-
fs4.writeFileSync(filePath, templateFn(
|
|
9256
|
+
fs4.writeFileSync(filePath, templateFn(name), { mode: CAPSULE_FILE_MODE });
|
|
9247
9257
|
}
|
|
9248
9258
|
}
|
|
9249
9259
|
}
|
|
9250
|
-
function upgradeCapsule(projectsBase, slug, type, currentVersion) {
|
|
9260
|
+
function upgradeCapsule(projectsBase, slug, name, type, currentVersion) {
|
|
9251
9261
|
if (currentVersion >= CAPSULE_VERSION) {
|
|
9252
9262
|
return { upgraded: false, newVersion: currentVersion, addedFiles: [] };
|
|
9253
9263
|
}
|
|
@@ -9264,7 +9274,7 @@ function upgradeCapsule(projectsBase, slug, type, currentVersion) {
|
|
|
9264
9274
|
if (!fs4.existsSync(filePath)) {
|
|
9265
9275
|
const templateFn = BASE_TEMPLATES[file];
|
|
9266
9276
|
if (templateFn) {
|
|
9267
|
-
fs4.writeFileSync(filePath, templateFn(
|
|
9277
|
+
fs4.writeFileSync(filePath, templateFn(name), { mode: CAPSULE_FILE_MODE });
|
|
9268
9278
|
addedFiles.push(file);
|
|
9269
9279
|
}
|
|
9270
9280
|
}
|
|
@@ -9275,7 +9285,7 @@ function upgradeCapsule(projectsBase, slug, type, currentVersion) {
|
|
|
9275
9285
|
if (!fs4.existsSync(filePath)) {
|
|
9276
9286
|
const templateFn = OVERLAY_TEMPLATES[file];
|
|
9277
9287
|
if (templateFn) {
|
|
9278
|
-
fs4.writeFileSync(filePath, templateFn(
|
|
9288
|
+
fs4.writeFileSync(filePath, templateFn(name), { mode: CAPSULE_FILE_MODE });
|
|
9279
9289
|
addedFiles.push(file);
|
|
9280
9290
|
}
|
|
9281
9291
|
}
|
|
@@ -9292,8 +9302,8 @@ var TELEGRAM_MSG_LIMIT = 4096;
|
|
|
9292
9302
|
function buildInlineKeyboard(rows) {
|
|
9293
9303
|
return { inline_keyboard: rows };
|
|
9294
9304
|
}
|
|
9295
|
-
function buildDoctorButtons(
|
|
9296
|
-
const cb = (action) => buildCallbackData(action,
|
|
9305
|
+
function buildDoctorButtons(groupId, threadId, secret) {
|
|
9306
|
+
const cb = (action) => buildCallbackData(action, groupId, threadId, secret);
|
|
9297
9307
|
return buildInlineKeyboard([
|
|
9298
9308
|
[
|
|
9299
9309
|
{ text: "Fix", callback_data: cb("fix") },
|
|
@@ -9306,14 +9316,8 @@ function buildDoctorButtons(slug, groupId, threadId, secret) {
|
|
|
9306
9316
|
]
|
|
9307
9317
|
]);
|
|
9308
9318
|
}
|
|
9309
|
-
function
|
|
9310
|
-
const cb = (action) => buildCallbackData(action,
|
|
9311
|
-
return buildInlineKeyboard([
|
|
9312
|
-
[{ text: "Confirm", callback_data: cb("is") }]
|
|
9313
|
-
]);
|
|
9314
|
-
}
|
|
9315
|
-
function buildInitTypeButtons(slug, groupId, threadId, secret) {
|
|
9316
|
-
const cb = (action) => buildCallbackData(action, slug, groupId, threadId, secret);
|
|
9319
|
+
function buildInitTypeButtons(groupId, threadId, secret) {
|
|
9320
|
+
const cb = (action) => buildCallbackData(action, groupId, threadId, secret);
|
|
9317
9321
|
return buildInlineKeyboard([
|
|
9318
9322
|
[
|
|
9319
9323
|
{ text: "Coding", callback_data: cb("ic") },
|
|
@@ -9325,12 +9329,13 @@ function buildInitTypeButtons(slug, groupId, threadId, secret) {
|
|
|
9325
9329
|
]
|
|
9326
9330
|
]);
|
|
9327
9331
|
}
|
|
9328
|
-
function buildTopicCard(slug, type, capsuleVersion) {
|
|
9332
|
+
function buildTopicCard(name, slug, type, capsuleVersion) {
|
|
9333
|
+
const n = htmlEscape(name);
|
|
9329
9334
|
const s = htmlEscape(slug);
|
|
9330
9335
|
const t = htmlEscape(type);
|
|
9331
9336
|
const v = htmlEscape(String(capsuleVersion));
|
|
9332
9337
|
return [
|
|
9333
|
-
`<b>Topic: ${
|
|
9338
|
+
`<b>Topic: ${n}</b>`,
|
|
9334
9339
|
`Type: ${t} | Version: ${v}`,
|
|
9335
9340
|
`Capsule: projects/${s}/`,
|
|
9336
9341
|
"",
|
|
@@ -9343,9 +9348,9 @@ function buildTopicCard(slug, type, capsuleVersion) {
|
|
|
9343
9348
|
"/tm help \u2014 command reference"
|
|
9344
9349
|
].join("\n");
|
|
9345
9350
|
}
|
|
9346
|
-
function buildDoctorReport(
|
|
9347
|
-
const
|
|
9348
|
-
const lines = [`<b>Doctor: ${
|
|
9351
|
+
function buildDoctorReport(name, results) {
|
|
9352
|
+
const n = htmlEscape(name);
|
|
9353
|
+
const lines = [`<b>Doctor: ${n}</b>`, ""];
|
|
9349
9354
|
if (results.length === 0) {
|
|
9350
9355
|
lines.push("All checks passed.");
|
|
9351
9356
|
return lines.join("\n");
|
|
@@ -9385,7 +9390,7 @@ function buildHelpCard() {
|
|
|
9385
9390
|
"/tm status \u2014 quick STATUS.md view",
|
|
9386
9391
|
"/tm list \u2014 show all topics",
|
|
9387
9392
|
"/tm sync \u2014 re-apply config",
|
|
9388
|
-
"/tm rename <
|
|
9393
|
+
"/tm rename <name> \u2014 rename topic",
|
|
9389
9394
|
"/tm upgrade \u2014 update capsule template",
|
|
9390
9395
|
"/tm snooze <Nd> \u2014 snooze doctor (7d, 30d, etc.)",
|
|
9391
9396
|
"/tm archive \u2014 archive topic",
|
|
@@ -9405,7 +9410,7 @@ function buildListMessage(topics) {
|
|
|
9405
9410
|
let rendered = 0;
|
|
9406
9411
|
for (const t of sorted) {
|
|
9407
9412
|
const entry = [
|
|
9408
|
-
`<
|
|
9413
|
+
`<b>${htmlEscape(t.name)}</b> [${htmlEscape(t.type)}] ${htmlEscape(t.status)}`,
|
|
9409
9414
|
` Last active: ${t.lastMessageAt ? relativeTime(t.lastMessageAt) : "never"}`,
|
|
9410
9415
|
` Thread: #${htmlEscape(t.threadId)}`
|
|
9411
9416
|
].join("\n");
|
|
@@ -9449,8 +9454,8 @@ import * as fs5 from "node:fs";
|
|
|
9449
9454
|
import * as path5 from "node:path";
|
|
9450
9455
|
var INCLUDE_FILENAME = "telegram-manager.generated.groups.json5";
|
|
9451
9456
|
var FILE_MODE3 = 384;
|
|
9452
|
-
function getSystemPromptTemplate(slug, absoluteWorkspacePath) {
|
|
9453
|
-
return `You are the assistant for the Telegram topic: ${
|
|
9457
|
+
function getSystemPromptTemplate(name, slug, absoluteWorkspacePath) {
|
|
9458
|
+
return `You are the assistant for the Telegram topic: ${name}.
|
|
9454
9459
|
|
|
9455
9460
|
Determinism rules:
|
|
9456
9461
|
- Source of truth is the project capsule at: ${absoluteWorkspacePath}/projects/${slug}/
|
|
@@ -9494,7 +9499,7 @@ function buildIncludeObject(registry, workspaceDir, existingInclude) {
|
|
|
9494
9499
|
}
|
|
9495
9500
|
}
|
|
9496
9501
|
for (const entry of Object.values(registry.topics)) {
|
|
9497
|
-
const { groupId, threadId, slug, type, status } = entry;
|
|
9502
|
+
const { groupId, threadId, slug, name, type, status } = entry;
|
|
9498
9503
|
if (!groups[groupId]) {
|
|
9499
9504
|
groups[groupId] = { topics: {} };
|
|
9500
9505
|
}
|
|
@@ -9503,7 +9508,7 @@ function buildIncludeObject(registry, workspaceDir, existingInclude) {
|
|
|
9503
9508
|
}
|
|
9504
9509
|
const isEnabled = status !== "archived";
|
|
9505
9510
|
const skills = getSkillsForType(type);
|
|
9506
|
-
const systemPrompt = getSystemPromptTemplate(slug, absoluteWorkspacePath);
|
|
9511
|
+
const systemPrompt = getSystemPromptTemplate(name, slug, absoluteWorkspacePath);
|
|
9507
9512
|
groups[groupId].topics[threadId] = {
|
|
9508
9513
|
enabled: isEnabled,
|
|
9509
9514
|
skills,
|
|
@@ -9693,60 +9698,42 @@ async function handleInit(ctx, args) {
|
|
|
9693
9698
|
const key = topicKey(groupId, threadId);
|
|
9694
9699
|
if (registry.topics[key]) {
|
|
9695
9700
|
return {
|
|
9696
|
-
text: `This topic is already registered as <
|
|
9701
|
+
text: `This topic is already registered as <b>${htmlEscape(registry.topics[key].name)}</b>.`,
|
|
9697
9702
|
parseMode: "HTML"
|
|
9698
9703
|
};
|
|
9699
9704
|
}
|
|
9700
9705
|
const parts = args.trim().split(/\s+/);
|
|
9701
|
-
let
|
|
9702
|
-
let
|
|
9706
|
+
let nameArg = "";
|
|
9707
|
+
let topicType = "coding";
|
|
9708
|
+
if (parts.length > 0 && parts[parts.length - 1] && VALID_TYPES.has(parts[parts.length - 1].toLowerCase())) {
|
|
9709
|
+
topicType = parts.pop().toLowerCase();
|
|
9710
|
+
nameArg = parts.join(" ");
|
|
9711
|
+
} else {
|
|
9712
|
+
nameArg = parts.join(" ");
|
|
9713
|
+
}
|
|
9703
9714
|
const topicTitle = messageContext?.["topicTitle"] ?? "";
|
|
9704
|
-
let
|
|
9705
|
-
if (
|
|
9706
|
-
|
|
9715
|
+
let name;
|
|
9716
|
+
if (nameArg) {
|
|
9717
|
+
name = nameArg;
|
|
9707
9718
|
} else if (topicTitle) {
|
|
9708
|
-
|
|
9719
|
+
name = topicTitle;
|
|
9709
9720
|
} else {
|
|
9710
|
-
|
|
9711
|
-
}
|
|
9712
|
-
if (slug && !/^[a-z]/.test(slug)) {
|
|
9713
|
-
slug = "t-" + slug;
|
|
9721
|
+
name = `Topic ${threadId}`;
|
|
9714
9722
|
}
|
|
9715
|
-
if (
|
|
9716
|
-
|
|
9717
|
-
text: `Invalid slug "${htmlEscape(slug)}". Must start with a letter, lowercase alphanumeric + hyphens, max 50 chars.`
|
|
9718
|
-
};
|
|
9719
|
-
}
|
|
9720
|
-
let topicType = "coding";
|
|
9721
|
-
if (typeArg && VALID_TYPES.has(typeArg.toLowerCase())) {
|
|
9722
|
-
topicType = typeArg.toLowerCase();
|
|
9723
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
9724
|
+
name = name.slice(0, MAX_NAME_LENGTH);
|
|
9723
9725
|
}
|
|
9726
|
+
const existingSlugs = new Set(Object.values(registry.topics).map((t) => t.slug));
|
|
9727
|
+
const finalSlug = generateSlug(threadId, groupId, existingSlugs);
|
|
9724
9728
|
const projectsBase = path6.join(workspaceDir, "projects");
|
|
9725
|
-
if (!jailCheck(projectsBase,
|
|
9729
|
+
if (!jailCheck(projectsBase, finalSlug)) {
|
|
9726
9730
|
return { text: "Path safety check failed. Slug may escape the projects directory." };
|
|
9727
9731
|
}
|
|
9728
9732
|
if (rejectSymlink(projectsBase)) {
|
|
9729
9733
|
return { text: "Projects base is a symlink. Aborting for security." };
|
|
9730
9734
|
}
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
let finalSlug = slug;
|
|
9734
|
-
if (slugInUse || diskExists) {
|
|
9735
|
-
const suffix = groupId.replace(/^-/, "").slice(-4);
|
|
9736
|
-
finalSlug = `${slug}-${suffix}`.slice(0, 50);
|
|
9737
|
-
if (!validateSlug(finalSlug)) {
|
|
9738
|
-
return { text: `Could not generate a unique slug. Please provide one: /tm init <slug> [type]` };
|
|
9739
|
-
}
|
|
9740
|
-
const fallbackInUse = Object.values(registry.topics).some((t) => t.slug === finalSlug);
|
|
9741
|
-
if (fallbackInUse) {
|
|
9742
|
-
return {
|
|
9743
|
-
text: `Both <code>${htmlEscape(slug)}</code> and <code>${htmlEscape(finalSlug)}</code> are taken. Please provide a unique slug: /tm init <slug> [type]`,
|
|
9744
|
-
parseMode: "HTML"
|
|
9745
|
-
};
|
|
9746
|
-
}
|
|
9747
|
-
if (!jailCheck(projectsBase, finalSlug)) {
|
|
9748
|
-
return { text: "Path safety check failed for fallback slug." };
|
|
9749
|
-
}
|
|
9735
|
+
if (fs6.existsSync(path6.join(projectsBase, finalSlug))) {
|
|
9736
|
+
return { text: `Directory projects/${htmlEscape(finalSlug)}/ already exists on disk.` };
|
|
9750
9737
|
}
|
|
9751
9738
|
const targetPath = path6.join(projectsBase, finalSlug);
|
|
9752
9739
|
if (rejectSymlink(targetPath)) {
|
|
@@ -9755,11 +9742,12 @@ async function handleInit(ctx, args) {
|
|
|
9755
9742
|
const isFirstUser = registry.topicManagerAdmins.length === 0;
|
|
9756
9743
|
try {
|
|
9757
9744
|
await withRegistry(workspaceDir, (data) => {
|
|
9758
|
-
scaffoldCapsule(projectsBase, finalSlug, topicType);
|
|
9745
|
+
scaffoldCapsule(projectsBase, finalSlug, name, topicType);
|
|
9759
9746
|
const newEntry = {
|
|
9760
9747
|
groupId,
|
|
9761
9748
|
threadId,
|
|
9762
9749
|
slug: finalSlug,
|
|
9750
|
+
name,
|
|
9763
9751
|
type: topicType,
|
|
9764
9752
|
status: "active",
|
|
9765
9753
|
capsuleVersion: CAPSULE_VERSION,
|
|
@@ -9799,38 +9787,27 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
|
|
|
9799
9787
|
}
|
|
9800
9788
|
appendAudit(
|
|
9801
9789
|
workspaceDir,
|
|
9802
|
-
buildAuditEntry(userId, "init", finalSlug, `Initialized topic type=${topicType} group=${groupId} thread=${threadId}`)
|
|
9790
|
+
buildAuditEntry(userId, "init", finalSlug, `Initialized topic name="${name}" type=${topicType} group=${groupId} thread=${threadId}`)
|
|
9803
9791
|
);
|
|
9804
|
-
const topicCard = buildTopicCard(finalSlug, topicType, CAPSULE_VERSION);
|
|
9792
|
+
const topicCard = buildTopicCard(name, finalSlug, topicType, CAPSULE_VERSION);
|
|
9805
9793
|
let adminNote = "";
|
|
9806
9794
|
if (isFirstUser) {
|
|
9807
9795
|
adminNote = "\n\nYou are the first user and have been added as a telegram-manager admin.";
|
|
9808
9796
|
}
|
|
9809
|
-
let slugNote = "";
|
|
9810
|
-
if (finalSlug !== slug) {
|
|
9811
|
-
slugNote = `
|
|
9812
|
-
|
|
9813
|
-
Note: slug <code>${htmlEscape(slug)}</code> was taken, using <code>${htmlEscape(finalSlug)}</code> instead.`;
|
|
9814
|
-
}
|
|
9815
9797
|
return {
|
|
9816
|
-
text: `${topicCard}${
|
|
9798
|
+
text: `${topicCard}${adminNote}${restartMsg}`,
|
|
9817
9799
|
parseMode: "HTML",
|
|
9818
9800
|
pin: true
|
|
9819
9801
|
};
|
|
9820
9802
|
}
|
|
9821
|
-
var CALLBACK_BYTE_LIMIT = 64;
|
|
9822
|
-
function fitsCallbackLimit(action, slug, groupId, threadId, secret) {
|
|
9823
|
-
const data = buildCallbackData(action, slug, groupId, threadId, secret);
|
|
9824
|
-
return Buffer.byteLength(data, "utf-8") <= CALLBACK_BYTE_LIMIT;
|
|
9825
|
-
}
|
|
9826
9803
|
async function handleInitInteractive(ctx, args) {
|
|
9827
9804
|
if (args.trim()) {
|
|
9828
9805
|
return handleInit(ctx, args);
|
|
9829
9806
|
}
|
|
9830
|
-
return
|
|
9807
|
+
return buildTypePicker(ctx);
|
|
9831
9808
|
}
|
|
9832
|
-
async function
|
|
9833
|
-
const { workspaceDir, userId, groupId, threadId
|
|
9809
|
+
async function buildTypePicker(ctx) {
|
|
9810
|
+
const { workspaceDir, userId, groupId, threadId } = ctx;
|
|
9834
9811
|
if (!userId || !groupId || !threadId) {
|
|
9835
9812
|
return { text: "Missing context: groupId, threadId, or userId not available. Run this command inside a Telegram forum topic." };
|
|
9836
9813
|
}
|
|
@@ -9852,69 +9829,19 @@ async function buildSlugConfirmation(ctx) {
|
|
|
9852
9829
|
const key = topicKey(groupId, threadId);
|
|
9853
9830
|
if (registry.topics[key]) {
|
|
9854
9831
|
return {
|
|
9855
|
-
text: `This topic is already registered as <
|
|
9856
|
-
parseMode: "HTML"
|
|
9857
|
-
};
|
|
9858
|
-
}
|
|
9859
|
-
const topicTitle = messageContext?.["topicTitle"] ?? "";
|
|
9860
|
-
let slug;
|
|
9861
|
-
if (topicTitle) {
|
|
9862
|
-
slug = sanitizeSlug(topicTitle);
|
|
9863
|
-
} else {
|
|
9864
|
-
slug = `topic-${threadId}`;
|
|
9865
|
-
}
|
|
9866
|
-
if (slug && !/^[a-z]/.test(slug)) {
|
|
9867
|
-
slug = "t-" + slug;
|
|
9868
|
-
}
|
|
9869
|
-
if (!validateSlug(slug)) {
|
|
9870
|
-
return {
|
|
9871
|
-
text: `Invalid derived slug "${htmlEscape(slug)}". Please provide one: /tm init <slug> [type]`
|
|
9872
|
-
};
|
|
9873
|
-
}
|
|
9874
|
-
if (!fitsCallbackLimit("is", slug, groupId, threadId, registry.callbackSecret)) {
|
|
9875
|
-
return {
|
|
9876
|
-
text: `Suggested slug: <code>${htmlEscape(slug)}</code>
|
|
9877
|
-
|
|
9878
|
-
Slug is too long for inline buttons. Please run:
|
|
9879
|
-
<code>/tm init ${htmlEscape(slug)} [type]</code>`,
|
|
9880
|
-
parseMode: "HTML"
|
|
9881
|
-
};
|
|
9882
|
-
}
|
|
9883
|
-
const keyboard = buildInitSlugButtons(slug, groupId, threadId, registry.callbackSecret);
|
|
9884
|
-
return {
|
|
9885
|
-
text: `Initialize this topic as <code>${htmlEscape(slug)}</code>?`,
|
|
9886
|
-
parseMode: "HTML",
|
|
9887
|
-
inlineKeyboard: keyboard
|
|
9888
|
-
};
|
|
9889
|
-
}
|
|
9890
|
-
async function handleInitSlugConfirm(ctx, slug) {
|
|
9891
|
-
const { workspaceDir, userId, groupId, threadId } = ctx;
|
|
9892
|
-
if (!userId || !groupId || !threadId) {
|
|
9893
|
-
return { text: "Missing context." };
|
|
9894
|
-
}
|
|
9895
|
-
const registry = readRegistry(workspaceDir);
|
|
9896
|
-
const auth = checkAuthorization(userId, "init", registry);
|
|
9897
|
-
if (!auth.authorized) {
|
|
9898
|
-
return { text: auth.message ?? "Not authorized." };
|
|
9899
|
-
}
|
|
9900
|
-
const key = topicKey(groupId, threadId);
|
|
9901
|
-
if (registry.topics[key]) {
|
|
9902
|
-
return {
|
|
9903
|
-
text: `This topic is already registered as <code>${htmlEscape(registry.topics[key].slug)}</code>.`,
|
|
9832
|
+
text: `This topic is already registered as <b>${htmlEscape(registry.topics[key].name)}</b>.`,
|
|
9904
9833
|
parseMode: "HTML"
|
|
9905
9834
|
};
|
|
9906
9835
|
}
|
|
9907
|
-
const keyboard = buildInitTypeButtons(
|
|
9836
|
+
const keyboard = buildInitTypeButtons(groupId, threadId, registry.callbackSecret);
|
|
9908
9837
|
return {
|
|
9909
|
-
text:
|
|
9910
|
-
|
|
9911
|
-
Pick a topic type:`,
|
|
9838
|
+
text: "Pick a topic type:",
|
|
9912
9839
|
parseMode: "HTML",
|
|
9913
9840
|
inlineKeyboard: keyboard
|
|
9914
9841
|
};
|
|
9915
9842
|
}
|
|
9916
|
-
async function handleInitTypeSelect(ctx,
|
|
9917
|
-
return handleInit(ctx,
|
|
9843
|
+
async function handleInitTypeSelect(ctx, type) {
|
|
9844
|
+
return handleInit(ctx, type);
|
|
9918
9845
|
}
|
|
9919
9846
|
|
|
9920
9847
|
// src/commands/doctor.ts
|
|
@@ -10335,9 +10262,8 @@ async function handleDoctor(ctx) {
|
|
|
10335
10262
|
registry,
|
|
10336
10263
|
cronJobsPath
|
|
10337
10264
|
);
|
|
10338
|
-
const reportText = buildDoctorReport(entry.
|
|
10265
|
+
const reportText = buildDoctorReport(entry.name, results);
|
|
10339
10266
|
const keyboard = buildDoctorButtons(
|
|
10340
|
-
entry.slug,
|
|
10341
10267
|
groupId,
|
|
10342
10268
|
threadId,
|
|
10343
10269
|
registry.callbackSecret
|
|
@@ -10419,9 +10345,8 @@ async function handleDoctorAll(ctx) {
|
|
|
10419
10345
|
if (isSpam) {
|
|
10420
10346
|
logger.info(`[doctor-all] Auto-snoozing ${entry.slug} (${entry.consecutiveSilentDoctors} silent runs)`);
|
|
10421
10347
|
}
|
|
10422
|
-
const reportText = buildDoctorReport(entry.
|
|
10348
|
+
const reportText = buildDoctorReport(entry.name, results);
|
|
10423
10349
|
const keyboard = buildDoctorButtons(
|
|
10424
|
-
entry.slug,
|
|
10425
10350
|
entry.groupId,
|
|
10426
10351
|
entry.threadId,
|
|
10427
10352
|
registry.callbackSecret
|
|
@@ -10619,21 +10544,17 @@ async function handleSync(ctx) {
|
|
|
10619
10544
|
}
|
|
10620
10545
|
|
|
10621
10546
|
// src/commands/rename.ts
|
|
10622
|
-
|
|
10623
|
-
import * as path11 from "node:path";
|
|
10624
|
-
async function handleRename(ctx, newSlug) {
|
|
10547
|
+
async function handleRename(ctx, newName) {
|
|
10625
10548
|
const { workspaceDir, configDir, userId, groupId, threadId, rpc, logger } = ctx;
|
|
10626
10549
|
if (!userId || !groupId || !threadId) {
|
|
10627
10550
|
return { text: "Missing context: userId, groupId, or threadId not available." };
|
|
10628
10551
|
}
|
|
10629
|
-
const
|
|
10630
|
-
if (!
|
|
10631
|
-
return { text: "Usage: /tm rename <new-
|
|
10552
|
+
const trimmedName = newName.trim();
|
|
10553
|
+
if (!trimmedName) {
|
|
10554
|
+
return { text: "Usage: /tm rename <new-name>" };
|
|
10632
10555
|
}
|
|
10633
|
-
if (
|
|
10634
|
-
return {
|
|
10635
|
-
text: `Invalid slug "${htmlEscape(trimmedSlug)}". Must match: lowercase letter start, alphanumeric + hyphens, max 50 chars.`
|
|
10636
|
-
};
|
|
10556
|
+
if (trimmedName.length > MAX_NAME_LENGTH) {
|
|
10557
|
+
return { text: `Name too long (max ${MAX_NAME_LENGTH} characters).` };
|
|
10637
10558
|
}
|
|
10638
10559
|
const registry = readRegistry(workspaceDir);
|
|
10639
10560
|
const auth = checkAuthorization(userId, "rename", registry);
|
|
@@ -10645,53 +10566,16 @@ async function handleRename(ctx, newSlug) {
|
|
|
10645
10566
|
if (!entry) {
|
|
10646
10567
|
return { text: "This topic is not registered. Run /tm init first." };
|
|
10647
10568
|
}
|
|
10648
|
-
const
|
|
10649
|
-
if (
|
|
10650
|
-
return { text: `Topic is already named <
|
|
10651
|
-
}
|
|
10652
|
-
const projectsBase = path11.join(workspaceDir, "projects");
|
|
10653
|
-
if (!jailCheck(projectsBase, oldSlug)) {
|
|
10654
|
-
return { text: "Path safety check failed for current slug." };
|
|
10655
|
-
}
|
|
10656
|
-
if (!jailCheck(projectsBase, trimmedSlug)) {
|
|
10657
|
-
return { text: "Path safety check failed for new slug." };
|
|
10658
|
-
}
|
|
10659
|
-
const oldPath = path11.join(projectsBase, oldSlug);
|
|
10660
|
-
const newPath = path11.join(projectsBase, trimmedSlug);
|
|
10661
|
-
if (rejectSymlink(oldPath)) {
|
|
10662
|
-
return { text: "Current capsule directory is a symlink. Aborting for security." };
|
|
10663
|
-
}
|
|
10664
|
-
if (rejectSymlink(newPath)) {
|
|
10665
|
-
return { text: "Target capsule directory is a symlink. Aborting for security." };
|
|
10666
|
-
}
|
|
10667
|
-
const collisionInRegistry = Object.values(registry.topics).some((t) => t.slug === trimmedSlug);
|
|
10668
|
-
if (collisionInRegistry) {
|
|
10669
|
-
return {
|
|
10670
|
-
text: `Slug <code>${htmlEscape(trimmedSlug)}</code> is already used by another topic.`,
|
|
10671
|
-
parseMode: "HTML"
|
|
10672
|
-
};
|
|
10673
|
-
}
|
|
10674
|
-
if (fs11.existsSync(newPath)) {
|
|
10675
|
-
return {
|
|
10676
|
-
text: `Directory projects/${htmlEscape(trimmedSlug)}/ already exists on disk.`,
|
|
10677
|
-
parseMode: "HTML"
|
|
10678
|
-
};
|
|
10679
|
-
}
|
|
10680
|
-
if (!fs11.existsSync(oldPath)) {
|
|
10681
|
-
return { text: `Source capsule directory not found: projects/${htmlEscape(oldSlug)}/` };
|
|
10682
|
-
}
|
|
10683
|
-
try {
|
|
10684
|
-
await withRegistry(workspaceDir, (data) => {
|
|
10685
|
-
const topic = data.topics[key];
|
|
10686
|
-
if (topic) {
|
|
10687
|
-
fs11.renameSync(oldPath, newPath);
|
|
10688
|
-
topic.slug = trimmedSlug;
|
|
10689
|
-
}
|
|
10690
|
-
});
|
|
10691
|
-
} catch (err) {
|
|
10692
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
10693
|
-
return { text: `Failed to rename capsule: ${htmlEscape(msg)}` };
|
|
10569
|
+
const oldName = entry.name;
|
|
10570
|
+
if (oldName === trimmedName) {
|
|
10571
|
+
return { text: `Topic is already named <b>${htmlEscape(oldName)}</b>.`, parseMode: "HTML" };
|
|
10694
10572
|
}
|
|
10573
|
+
await withRegistry(workspaceDir, (data) => {
|
|
10574
|
+
const topic = data.topics[key];
|
|
10575
|
+
if (topic) {
|
|
10576
|
+
topic.name = trimmedName;
|
|
10577
|
+
}
|
|
10578
|
+
});
|
|
10695
10579
|
let restartMsg = "";
|
|
10696
10580
|
const configWritesEnabled = await getConfigWrites(ctx.rpc);
|
|
10697
10581
|
if (configWritesEnabled) {
|
|
@@ -10710,11 +10594,11 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
|
|
|
10710
10594
|
}
|
|
10711
10595
|
appendAudit(
|
|
10712
10596
|
workspaceDir,
|
|
10713
|
-
buildAuditEntry(userId, "rename",
|
|
10597
|
+
buildAuditEntry(userId, "rename", entry.slug, `Renamed from "${oldName}" to "${trimmedName}"`)
|
|
10714
10598
|
);
|
|
10715
|
-
const topicCard = buildTopicCard(
|
|
10599
|
+
const topicCard = buildTopicCard(trimmedName, entry.slug, entry.type, entry.capsuleVersion);
|
|
10716
10600
|
return {
|
|
10717
|
-
text: `Topic renamed from <
|
|
10601
|
+
text: `Topic renamed from <b>${htmlEscape(oldName)}</b> to <b>${htmlEscape(trimmedName)}</b>.
|
|
10718
10602
|
|
|
10719
10603
|
${topicCard}${restartMsg}`,
|
|
10720
10604
|
parseMode: "HTML"
|
|
@@ -10722,7 +10606,7 @@ ${topicCard}${restartMsg}`,
|
|
|
10722
10606
|
}
|
|
10723
10607
|
|
|
10724
10608
|
// src/commands/upgrade.ts
|
|
10725
|
-
import * as
|
|
10609
|
+
import * as path11 from "node:path";
|
|
10726
10610
|
async function handleUpgrade(ctx) {
|
|
10727
10611
|
const { workspaceDir, userId, groupId, threadId } = ctx;
|
|
10728
10612
|
if (!userId || !groupId || !threadId) {
|
|
@@ -10740,15 +10624,15 @@ async function handleUpgrade(ctx) {
|
|
|
10740
10624
|
}
|
|
10741
10625
|
if (entry.capsuleVersion >= CAPSULE_VERSION) {
|
|
10742
10626
|
return {
|
|
10743
|
-
text: `Topic <
|
|
10627
|
+
text: `Topic <b>${htmlEscape(entry.name)}</b> is already at capsule version ${CAPSULE_VERSION}. No upgrade needed.`,
|
|
10744
10628
|
parseMode: "HTML"
|
|
10745
10629
|
};
|
|
10746
10630
|
}
|
|
10747
|
-
const projectsBase =
|
|
10748
|
-
const result = upgradeCapsule(projectsBase, entry.slug, entry.type, entry.capsuleVersion);
|
|
10631
|
+
const projectsBase = path11.join(workspaceDir, "projects");
|
|
10632
|
+
const result = upgradeCapsule(projectsBase, entry.slug, entry.name, entry.type, entry.capsuleVersion);
|
|
10749
10633
|
if (!result.upgraded) {
|
|
10750
10634
|
return {
|
|
10751
|
-
text: `No upgrade needed for <
|
|
10635
|
+
text: `No upgrade needed for <b>${htmlEscape(entry.name)}</b>.`,
|
|
10752
10636
|
parseMode: "HTML"
|
|
10753
10637
|
};
|
|
10754
10638
|
}
|
|
@@ -10761,7 +10645,7 @@ async function handleUpgrade(ctx) {
|
|
|
10761
10645
|
const addedList = result.addedFiles.length > 0 ? `
|
|
10762
10646
|
Added files: ${result.addedFiles.map((f) => htmlEscape(f)).join(", ")}` : "\nNo new files added.";
|
|
10763
10647
|
return {
|
|
10764
|
-
text: `Topic <
|
|
10648
|
+
text: `Topic <b>${htmlEscape(entry.name)}</b> upgraded from v${entry.capsuleVersion} to v${result.newVersion}.${addedList}`,
|
|
10765
10649
|
parseMode: "HTML"
|
|
10766
10650
|
};
|
|
10767
10651
|
}
|
|
@@ -10809,7 +10693,7 @@ async function handleSnooze(ctx, args) {
|
|
|
10809
10693
|
buildAuditEntry(userId, "snooze", entry.slug, `Snoozed for ${days} days until ${snoozeUntil}`)
|
|
10810
10694
|
);
|
|
10811
10695
|
return {
|
|
10812
|
-
text: `Topic <
|
|
10696
|
+
text: `Topic <b>${htmlEscape(entry.name)}</b> snoozed for ${days} days (until ${htmlEscape(snoozeUntil)}).`,
|
|
10813
10697
|
parseMode: "HTML"
|
|
10814
10698
|
};
|
|
10815
10699
|
}
|
|
@@ -10838,10 +10722,10 @@ async function handleArchiveToggle(ctx, archive) {
|
|
|
10838
10722
|
return { text: "This topic is not registered. Run /tm init first." };
|
|
10839
10723
|
}
|
|
10840
10724
|
if (archive && entry.status === "archived") {
|
|
10841
|
-
return { text: `Topic <
|
|
10725
|
+
return { text: `Topic <b>${htmlEscape(entry.name)}</b> is already archived.`, parseMode: "HTML" };
|
|
10842
10726
|
}
|
|
10843
10727
|
if (!archive && entry.status !== "archived") {
|
|
10844
|
-
return { text: `Topic <
|
|
10728
|
+
return { text: `Topic <b>${htmlEscape(entry.name)}</b> is not archived.`, parseMode: "HTML" };
|
|
10845
10729
|
}
|
|
10846
10730
|
const newStatus = archive ? "archived" : "active";
|
|
10847
10731
|
await withRegistry(workspaceDir, (data) => {
|
|
@@ -10875,7 +10759,7 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
|
|
|
10875
10759
|
);
|
|
10876
10760
|
const action = archive ? "archived" : "unarchived";
|
|
10877
10761
|
return {
|
|
10878
|
-
text: `Topic <
|
|
10762
|
+
text: `Topic <b>${htmlEscape(entry.name)}</b> ${action}.${restartMsg}`,
|
|
10879
10763
|
parseMode: "HTML"
|
|
10880
10764
|
};
|
|
10881
10765
|
}
|
|
@@ -11006,23 +10890,20 @@ async function handleCallback(data, ctx) {
|
|
|
11006
10890
|
if (!parsed) {
|
|
11007
10891
|
return { text: "Invalid or expired callback." };
|
|
11008
10892
|
}
|
|
11009
|
-
const { action
|
|
10893
|
+
const { action } = parsed;
|
|
11010
10894
|
const initTypeMap = {
|
|
11011
10895
|
ic: "coding",
|
|
11012
10896
|
ir: "research",
|
|
11013
10897
|
im: "marketing",
|
|
11014
10898
|
ix: "custom"
|
|
11015
10899
|
};
|
|
11016
|
-
if (action === "is") {
|
|
11017
|
-
return handleInitSlugConfirm(ctx, slug);
|
|
11018
|
-
}
|
|
11019
10900
|
if (action in initTypeMap) {
|
|
11020
|
-
return handleInitTypeSelect(ctx,
|
|
10901
|
+
return handleInitTypeSelect(ctx, initTypeMap[action]);
|
|
11021
10902
|
}
|
|
11022
10903
|
const key = topicKey(groupId, threadId);
|
|
11023
10904
|
const entry = registry.topics[key];
|
|
11024
|
-
if (!entry
|
|
11025
|
-
return { text: "Topic not found
|
|
10905
|
+
if (!entry) {
|
|
10906
|
+
return { text: "Topic not found." };
|
|
11026
10907
|
}
|
|
11027
10908
|
switch (action) {
|
|
11028
10909
|
case "fix":
|
|
@@ -11056,25 +10937,25 @@ async function handleCallbackFix(ctx) {
|
|
|
11056
10937
|
// src/index.ts
|
|
11057
10938
|
function resolveConfigDir() {
|
|
11058
10939
|
const thisFile = new URL(import.meta.url).pathname;
|
|
11059
|
-
const parts = thisFile.split(
|
|
10940
|
+
const parts = thisFile.split(path12.sep);
|
|
11060
10941
|
const extIndex = parts.lastIndexOf("extensions");
|
|
11061
10942
|
if (extIndex > 0) {
|
|
11062
|
-
const candidate = parts.slice(0, extIndex).join(
|
|
11063
|
-
if (
|
|
10943
|
+
const candidate = parts.slice(0, extIndex).join(path12.sep);
|
|
10944
|
+
if (fs11.existsSync(path12.join(candidate, "openclaw.json")) || fs11.existsSync(path12.join(candidate, "extensions"))) {
|
|
11064
10945
|
return candidate;
|
|
11065
10946
|
}
|
|
11066
10947
|
}
|
|
11067
10948
|
const envDir = process.env["OPENCLAW_CONFIG_DIR"];
|
|
11068
|
-
if (envDir &&
|
|
10949
|
+
if (envDir && fs11.existsSync(envDir)) return path12.resolve(envDir);
|
|
11069
10950
|
const homeDir = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
|
|
11070
|
-
const defaultDir =
|
|
11071
|
-
if (
|
|
10951
|
+
const defaultDir = path12.join(homeDir, ".openclaw");
|
|
10952
|
+
if (fs11.existsSync(defaultDir)) return defaultDir;
|
|
11072
10953
|
return void 0;
|
|
11073
10954
|
}
|
|
11074
10955
|
function register(api) {
|
|
11075
10956
|
const resolvedConfigDir = resolveConfigDir();
|
|
11076
10957
|
const configDir = api.configDir ?? api.pluginConfig?.configDir ?? resolvedConfigDir;
|
|
11077
|
-
const workspaceDir = api.workspaceDir ?? api.pluginConfig?.workspaceDir ?? (resolvedConfigDir ?
|
|
10958
|
+
const workspaceDir = api.workspaceDir ?? api.pluginConfig?.workspaceDir ?? (resolvedConfigDir ? path12.join(resolvedConfigDir, "workspace") : void 0);
|
|
11078
10959
|
if (!configDir || !workspaceDir) {
|
|
11079
10960
|
api.logger.error(
|
|
11080
10961
|
"telegram-manager: configDir or workspaceDir not available. Plugin cannot initialize."
|
|
@@ -11092,7 +10973,7 @@ function register(api) {
|
|
|
11092
10973
|
description: "Manage Telegram forum topics as deterministic workcells. Sub-commands: init, doctor, list, status, sync, rename, upgrade, snooze, archive, unarchive, help.",
|
|
11093
10974
|
parameters: Type.Object({
|
|
11094
10975
|
command: Type.String({
|
|
11095
|
-
description: "Sub-command and arguments (e.g., 'init', 'doctor --all', 'rename new-
|
|
10976
|
+
description: "Sub-command and arguments (e.g., 'init', 'doctor --all', 'rename new-name')"
|
|
11096
10977
|
})
|
|
11097
10978
|
}),
|
|
11098
10979
|
async execute(id, params, context) {
|
|
@@ -11110,7 +10991,7 @@ function register(api) {
|
|
|
11110
10991
|
requireAuth: false,
|
|
11111
10992
|
async handler(ctx) {
|
|
11112
10993
|
const userId = ctx.senderId;
|
|
11113
|
-
const groupId = ctx.
|
|
10994
|
+
const groupId = ctx.from?.replace(/^telegram:(?:group:)?/, "").split(":topic:")[0] || void 0;
|
|
11114
10995
|
const threadId = ctx.messageThreadId != null ? String(ctx.messageThreadId) : void 0;
|
|
11115
10996
|
const execContext = {};
|
|
11116
10997
|
if (userId) execContext.userId = userId;
|
|
@@ -11120,8 +11001,15 @@ function register(api) {
|
|
|
11120
11001
|
const reply = {
|
|
11121
11002
|
text: result.text
|
|
11122
11003
|
};
|
|
11004
|
+
const telegramData = {};
|
|
11123
11005
|
if (result.inlineKeyboard) {
|
|
11124
|
-
|
|
11006
|
+
telegramData.buttons = result.inlineKeyboard.inline_keyboard;
|
|
11007
|
+
}
|
|
11008
|
+
if (result.parseMode) {
|
|
11009
|
+
telegramData.parse_mode = result.parseMode;
|
|
11010
|
+
}
|
|
11011
|
+
if (Object.keys(telegramData).length > 0) {
|
|
11012
|
+
reply.channelData = { telegram: telegramData };
|
|
11125
11013
|
}
|
|
11126
11014
|
return reply;
|
|
11127
11015
|
}
|