@timeback/core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +8 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.js +463 -47
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3825 -1042
- package/dist/types.js +1 -17
- package/dist/utils.js +656 -202
- package/package.json +9 -7
package/dist/utils.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
1
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
2
|
var __export = (target, all) => {
|
|
19
3
|
for (var name in all)
|
|
20
4
|
__defProp(target, name, {
|
|
@@ -24,7 +8,7 @@ var __export = (target, all) => {
|
|
|
24
8
|
set: (newValue) => all[name] = () => newValue
|
|
25
9
|
});
|
|
26
10
|
};
|
|
27
|
-
var
|
|
11
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
28
12
|
|
|
29
13
|
// ../edubridge/dist/index.js
|
|
30
14
|
var __defProp2 = Object.defineProperty;
|
|
@@ -37,6 +21,423 @@ var __export2 = (target, all) => {
|
|
|
37
21
|
set: (newValue) => all[name] = () => newValue
|
|
38
22
|
});
|
|
39
23
|
};
|
|
24
|
+
var __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
25
|
+
var exports_util = {};
|
|
26
|
+
__export2(exports_util, {
|
|
27
|
+
types: () => types,
|
|
28
|
+
promisify: () => promisify,
|
|
29
|
+
log: () => log,
|
|
30
|
+
isUndefined: () => isUndefined,
|
|
31
|
+
isSymbol: () => isSymbol,
|
|
32
|
+
isString: () => isString,
|
|
33
|
+
isRegExp: () => isRegExp,
|
|
34
|
+
isPrimitive: () => isPrimitive,
|
|
35
|
+
isObject: () => isObject,
|
|
36
|
+
isNumber: () => isNumber,
|
|
37
|
+
isNullOrUndefined: () => isNullOrUndefined,
|
|
38
|
+
isNull: () => isNull,
|
|
39
|
+
isFunction: () => isFunction,
|
|
40
|
+
isError: () => isError,
|
|
41
|
+
isDate: () => isDate,
|
|
42
|
+
isBuffer: () => isBuffer,
|
|
43
|
+
isBoolean: () => isBoolean,
|
|
44
|
+
isArray: () => isArray,
|
|
45
|
+
inspect: () => inspect,
|
|
46
|
+
inherits: () => inherits,
|
|
47
|
+
format: () => format,
|
|
48
|
+
deprecate: () => deprecate,
|
|
49
|
+
default: () => util_default,
|
|
50
|
+
debuglog: () => debuglog,
|
|
51
|
+
callbackifyOnRejected: () => callbackifyOnRejected,
|
|
52
|
+
callbackify: () => callbackify,
|
|
53
|
+
_extend: () => _extend,
|
|
54
|
+
TextEncoder: () => TextEncoder,
|
|
55
|
+
TextDecoder: () => TextDecoder
|
|
56
|
+
});
|
|
57
|
+
function format(f, ...args) {
|
|
58
|
+
if (!isString(f)) {
|
|
59
|
+
var objects = [f];
|
|
60
|
+
for (var i = 0;i < args.length; i++)
|
|
61
|
+
objects.push(inspect(args[i]));
|
|
62
|
+
return objects.join(" ");
|
|
63
|
+
}
|
|
64
|
+
var i = 0, len = args.length, str = String(f).replace(formatRegExp, function(x2) {
|
|
65
|
+
if (x2 === "%%")
|
|
66
|
+
return "%";
|
|
67
|
+
if (i >= len)
|
|
68
|
+
return x2;
|
|
69
|
+
switch (x2) {
|
|
70
|
+
case "%s":
|
|
71
|
+
return String(args[i++]);
|
|
72
|
+
case "%d":
|
|
73
|
+
return Number(args[i++]);
|
|
74
|
+
case "%j":
|
|
75
|
+
try {
|
|
76
|
+
return JSON.stringify(args[i++]);
|
|
77
|
+
} catch (_) {
|
|
78
|
+
return "[Circular]";
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
return x2;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
for (var x = args[i];i < len; x = args[++i])
|
|
85
|
+
if (isNull(x) || !isObject(x))
|
|
86
|
+
str += " " + x;
|
|
87
|
+
else
|
|
88
|
+
str += " " + inspect(x);
|
|
89
|
+
return str;
|
|
90
|
+
}
|
|
91
|
+
function deprecate(fn, msg) {
|
|
92
|
+
if (typeof process > "u" || process?.noDeprecation === true)
|
|
93
|
+
return fn;
|
|
94
|
+
var warned = false;
|
|
95
|
+
function deprecated(...args) {
|
|
96
|
+
if (!warned) {
|
|
97
|
+
if (process.throwDeprecation)
|
|
98
|
+
throw Error(msg);
|
|
99
|
+
else if (process.traceDeprecation)
|
|
100
|
+
console.trace(msg);
|
|
101
|
+
else
|
|
102
|
+
console.error(msg);
|
|
103
|
+
warned = true;
|
|
104
|
+
}
|
|
105
|
+
return fn.apply(this, ...args);
|
|
106
|
+
}
|
|
107
|
+
return deprecated;
|
|
108
|
+
}
|
|
109
|
+
function stylizeWithColor(str, styleType) {
|
|
110
|
+
var style = inspect.styles[styleType];
|
|
111
|
+
if (style)
|
|
112
|
+
return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
|
|
113
|
+
else
|
|
114
|
+
return str;
|
|
115
|
+
}
|
|
116
|
+
function stylizeNoColor(str, styleType) {
|
|
117
|
+
return str;
|
|
118
|
+
}
|
|
119
|
+
function arrayToHash(array) {
|
|
120
|
+
var hash = {};
|
|
121
|
+
return array.forEach(function(val, idx) {
|
|
122
|
+
hash[val] = true;
|
|
123
|
+
}), hash;
|
|
124
|
+
}
|
|
125
|
+
function formatValue(ctx, value, recurseTimes) {
|
|
126
|
+
if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== inspect && !(value.constructor && value.constructor.prototype === value)) {
|
|
127
|
+
var ret = value.inspect(recurseTimes, ctx);
|
|
128
|
+
if (!isString(ret))
|
|
129
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
|
130
|
+
return ret;
|
|
131
|
+
}
|
|
132
|
+
var primitive = formatPrimitive(ctx, value);
|
|
133
|
+
if (primitive)
|
|
134
|
+
return primitive;
|
|
135
|
+
var keys = Object.keys(value), visibleKeys = arrayToHash(keys);
|
|
136
|
+
if (ctx.showHidden)
|
|
137
|
+
keys = Object.getOwnPropertyNames(value);
|
|
138
|
+
if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0))
|
|
139
|
+
return formatError(value);
|
|
140
|
+
if (keys.length === 0) {
|
|
141
|
+
if (isFunction(value)) {
|
|
142
|
+
var name = value.name ? ": " + value.name : "";
|
|
143
|
+
return ctx.stylize("[Function" + name + "]", "special");
|
|
144
|
+
}
|
|
145
|
+
if (isRegExp(value))
|
|
146
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
|
|
147
|
+
if (isDate(value))
|
|
148
|
+
return ctx.stylize(Date.prototype.toString.call(value), "date");
|
|
149
|
+
if (isError(value))
|
|
150
|
+
return formatError(value);
|
|
151
|
+
}
|
|
152
|
+
var base = "", array = false, braces = ["{", "}"];
|
|
153
|
+
if (isArray(value))
|
|
154
|
+
array = true, braces = ["[", "]"];
|
|
155
|
+
if (isFunction(value)) {
|
|
156
|
+
var n = value.name ? ": " + value.name : "";
|
|
157
|
+
base = " [Function" + n + "]";
|
|
158
|
+
}
|
|
159
|
+
if (isRegExp(value))
|
|
160
|
+
base = " " + RegExp.prototype.toString.call(value);
|
|
161
|
+
if (isDate(value))
|
|
162
|
+
base = " " + Date.prototype.toUTCString.call(value);
|
|
163
|
+
if (isError(value))
|
|
164
|
+
base = " " + formatError(value);
|
|
165
|
+
if (keys.length === 0 && (!array || value.length == 0))
|
|
166
|
+
return braces[0] + base + braces[1];
|
|
167
|
+
if (recurseTimes < 0)
|
|
168
|
+
if (isRegExp(value))
|
|
169
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
|
|
170
|
+
else
|
|
171
|
+
return ctx.stylize("[Object]", "special");
|
|
172
|
+
ctx.seen.push(value);
|
|
173
|
+
var output;
|
|
174
|
+
if (array)
|
|
175
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
|
176
|
+
else
|
|
177
|
+
output = keys.map(function(key) {
|
|
178
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
179
|
+
});
|
|
180
|
+
return ctx.seen.pop(), reduceToSingleString(output, base, braces);
|
|
181
|
+
}
|
|
182
|
+
function formatPrimitive(ctx, value) {
|
|
183
|
+
if (isUndefined(value))
|
|
184
|
+
return ctx.stylize("undefined", "undefined");
|
|
185
|
+
if (isString(value)) {
|
|
186
|
+
var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
|
|
187
|
+
return ctx.stylize(simple, "string");
|
|
188
|
+
}
|
|
189
|
+
if (isNumber(value))
|
|
190
|
+
return ctx.stylize("" + value, "number");
|
|
191
|
+
if (isBoolean(value))
|
|
192
|
+
return ctx.stylize("" + value, "boolean");
|
|
193
|
+
if (isNull(value))
|
|
194
|
+
return ctx.stylize("null", "null");
|
|
195
|
+
}
|
|
196
|
+
function formatError(value) {
|
|
197
|
+
return "[" + Error.prototype.toString.call(value) + "]";
|
|
198
|
+
}
|
|
199
|
+
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
200
|
+
var output = [];
|
|
201
|
+
for (var i = 0, l = value.length;i < l; ++i)
|
|
202
|
+
if (hasOwnProperty(value, String(i)))
|
|
203
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
|
|
204
|
+
else
|
|
205
|
+
output.push("");
|
|
206
|
+
return keys.forEach(function(key) {
|
|
207
|
+
if (!key.match(/^\d+$/))
|
|
208
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
|
|
209
|
+
}), output;
|
|
210
|
+
}
|
|
211
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
212
|
+
var name, str, desc;
|
|
213
|
+
if (desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }, desc.get)
|
|
214
|
+
if (desc.set)
|
|
215
|
+
str = ctx.stylize("[Getter/Setter]", "special");
|
|
216
|
+
else
|
|
217
|
+
str = ctx.stylize("[Getter]", "special");
|
|
218
|
+
else if (desc.set)
|
|
219
|
+
str = ctx.stylize("[Setter]", "special");
|
|
220
|
+
if (!hasOwnProperty(visibleKeys, key))
|
|
221
|
+
name = "[" + key + "]";
|
|
222
|
+
if (!str)
|
|
223
|
+
if (ctx.seen.indexOf(desc.value) < 0) {
|
|
224
|
+
if (isNull(recurseTimes))
|
|
225
|
+
str = formatValue(ctx, desc.value, null);
|
|
226
|
+
else
|
|
227
|
+
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
|
228
|
+
if (str.indexOf(`
|
|
229
|
+
`) > -1)
|
|
230
|
+
if (array)
|
|
231
|
+
str = str.split(`
|
|
232
|
+
`).map(function(line) {
|
|
233
|
+
return " " + line;
|
|
234
|
+
}).join(`
|
|
235
|
+
`).slice(2);
|
|
236
|
+
else
|
|
237
|
+
str = `
|
|
238
|
+
` + str.split(`
|
|
239
|
+
`).map(function(line) {
|
|
240
|
+
return " " + line;
|
|
241
|
+
}).join(`
|
|
242
|
+
`);
|
|
243
|
+
} else
|
|
244
|
+
str = ctx.stylize("[Circular]", "special");
|
|
245
|
+
if (isUndefined(name)) {
|
|
246
|
+
if (array && key.match(/^\d+$/))
|
|
247
|
+
return str;
|
|
248
|
+
if (name = JSON.stringify("" + key), name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))
|
|
249
|
+
name = name.slice(1, -1), name = ctx.stylize(name, "name");
|
|
250
|
+
else
|
|
251
|
+
name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), name = ctx.stylize(name, "string");
|
|
252
|
+
}
|
|
253
|
+
return name + ": " + str;
|
|
254
|
+
}
|
|
255
|
+
function reduceToSingleString(output, base, braces) {
|
|
256
|
+
var numLinesEst = 0, length = output.reduce(function(prev, cur) {
|
|
257
|
+
if (numLinesEst++, cur.indexOf(`
|
|
258
|
+
`) >= 0)
|
|
259
|
+
numLinesEst++;
|
|
260
|
+
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
|
|
261
|
+
}, 0);
|
|
262
|
+
if (length > 60)
|
|
263
|
+
return braces[0] + (base === "" ? "" : base + `
|
|
264
|
+
`) + " " + output.join(`,
|
|
265
|
+
`) + " " + braces[1];
|
|
266
|
+
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
|
|
267
|
+
}
|
|
268
|
+
function isArray(ar) {
|
|
269
|
+
return Array.isArray(ar);
|
|
270
|
+
}
|
|
271
|
+
function isBoolean(arg) {
|
|
272
|
+
return typeof arg === "boolean";
|
|
273
|
+
}
|
|
274
|
+
function isNull(arg) {
|
|
275
|
+
return arg === null;
|
|
276
|
+
}
|
|
277
|
+
function isNullOrUndefined(arg) {
|
|
278
|
+
return arg == null;
|
|
279
|
+
}
|
|
280
|
+
function isNumber(arg) {
|
|
281
|
+
return typeof arg === "number";
|
|
282
|
+
}
|
|
283
|
+
function isString(arg) {
|
|
284
|
+
return typeof arg === "string";
|
|
285
|
+
}
|
|
286
|
+
function isSymbol(arg) {
|
|
287
|
+
return typeof arg === "symbol";
|
|
288
|
+
}
|
|
289
|
+
function isUndefined(arg) {
|
|
290
|
+
return arg === undefined;
|
|
291
|
+
}
|
|
292
|
+
function isRegExp(re) {
|
|
293
|
+
return isObject(re) && objectToString(re) === "[object RegExp]";
|
|
294
|
+
}
|
|
295
|
+
function isObject(arg) {
|
|
296
|
+
return typeof arg === "object" && arg !== null;
|
|
297
|
+
}
|
|
298
|
+
function isDate(d) {
|
|
299
|
+
return isObject(d) && objectToString(d) === "[object Date]";
|
|
300
|
+
}
|
|
301
|
+
function isError(e) {
|
|
302
|
+
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
|
|
303
|
+
}
|
|
304
|
+
function isFunction(arg) {
|
|
305
|
+
return typeof arg === "function";
|
|
306
|
+
}
|
|
307
|
+
function isPrimitive(arg) {
|
|
308
|
+
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg > "u";
|
|
309
|
+
}
|
|
310
|
+
function isBuffer(arg) {
|
|
311
|
+
return arg instanceof Buffer;
|
|
312
|
+
}
|
|
313
|
+
function objectToString(o) {
|
|
314
|
+
return Object.prototype.toString.call(o);
|
|
315
|
+
}
|
|
316
|
+
function pad(n) {
|
|
317
|
+
return n < 10 ? "0" + n.toString(10) : n.toString(10);
|
|
318
|
+
}
|
|
319
|
+
function timestamp() {
|
|
320
|
+
var d = new Date, time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
|
|
321
|
+
return [d.getDate(), months[d.getMonth()], time].join(" ");
|
|
322
|
+
}
|
|
323
|
+
function log(...args) {
|
|
324
|
+
console.log("%s - %s", timestamp(), format.apply(null, args));
|
|
325
|
+
}
|
|
326
|
+
function inherits(ctor, superCtor) {
|
|
327
|
+
if (superCtor)
|
|
328
|
+
ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } });
|
|
329
|
+
}
|
|
330
|
+
function _extend(origin, add) {
|
|
331
|
+
if (!add || !isObject(add))
|
|
332
|
+
return origin;
|
|
333
|
+
var keys = Object.keys(add), i = keys.length;
|
|
334
|
+
while (i--)
|
|
335
|
+
origin[keys[i]] = add[keys[i]];
|
|
336
|
+
return origin;
|
|
337
|
+
}
|
|
338
|
+
function hasOwnProperty(obj, prop) {
|
|
339
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
340
|
+
}
|
|
341
|
+
function callbackifyOnRejected(reason, cb) {
|
|
342
|
+
if (!reason) {
|
|
343
|
+
var newReason = Error("Promise was rejected with a falsy value");
|
|
344
|
+
newReason.reason = reason, reason = newReason;
|
|
345
|
+
}
|
|
346
|
+
return cb(reason);
|
|
347
|
+
}
|
|
348
|
+
function callbackify(original) {
|
|
349
|
+
if (typeof original !== "function")
|
|
350
|
+
throw TypeError('The "original" argument must be of type Function');
|
|
351
|
+
function callbackified(...args) {
|
|
352
|
+
var maybeCb = args.pop();
|
|
353
|
+
if (typeof maybeCb !== "function")
|
|
354
|
+
throw TypeError("The last argument must be of type Function");
|
|
355
|
+
var self = this, cb = function(...args2) {
|
|
356
|
+
return maybeCb.apply(self, ...args2);
|
|
357
|
+
};
|
|
358
|
+
original.apply(this, args).then(function(ret) {
|
|
359
|
+
process.nextTick(cb.bind(null, null, ret));
|
|
360
|
+
}, function(rej) {
|
|
361
|
+
process.nextTick(callbackifyOnRejected.bind(null, rej, cb));
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
return Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)), Object.defineProperties(callbackified, Object.getOwnPropertyDescriptors(original)), callbackified;
|
|
365
|
+
}
|
|
366
|
+
var formatRegExp;
|
|
367
|
+
var debuglog;
|
|
368
|
+
var inspect;
|
|
369
|
+
var types = () => {};
|
|
370
|
+
var months;
|
|
371
|
+
var promisify;
|
|
372
|
+
var TextEncoder;
|
|
373
|
+
var TextDecoder;
|
|
374
|
+
var util_default;
|
|
375
|
+
var init_util = __esm2(() => {
|
|
376
|
+
formatRegExp = /%[sdj%]/g;
|
|
377
|
+
debuglog = ((debugs = {}, debugEnvRegex = {}, debugEnv) => ((debugEnv = typeof process < "u" && false) && (debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase()), debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"), (set) => {
|
|
378
|
+
if (set = set.toUpperCase(), !debugs[set])
|
|
379
|
+
if (debugEnvRegex.test(set))
|
|
380
|
+
debugs[set] = function(...args) {
|
|
381
|
+
console.error("%s: %s", set, pid, format.apply(null, ...args));
|
|
382
|
+
};
|
|
383
|
+
else
|
|
384
|
+
debugs[set] = function() {};
|
|
385
|
+
return debugs[set];
|
|
386
|
+
}))();
|
|
387
|
+
inspect = ((i) => (i.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39] }, i.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red" }, i.custom = Symbol.for("nodejs.util.inspect.custom"), i))(function(obj, opts, ...rest) {
|
|
388
|
+
var ctx = { seen: [], stylize: stylizeNoColor };
|
|
389
|
+
if (rest.length >= 1)
|
|
390
|
+
ctx.depth = rest[0];
|
|
391
|
+
if (rest.length >= 2)
|
|
392
|
+
ctx.colors = rest[1];
|
|
393
|
+
if (isBoolean(opts))
|
|
394
|
+
ctx.showHidden = opts;
|
|
395
|
+
else if (opts)
|
|
396
|
+
_extend(ctx, opts);
|
|
397
|
+
if (isUndefined(ctx.showHidden))
|
|
398
|
+
ctx.showHidden = false;
|
|
399
|
+
if (isUndefined(ctx.depth))
|
|
400
|
+
ctx.depth = 2;
|
|
401
|
+
if (isUndefined(ctx.colors))
|
|
402
|
+
ctx.colors = false;
|
|
403
|
+
if (ctx.colors)
|
|
404
|
+
ctx.stylize = stylizeWithColor;
|
|
405
|
+
return formatValue(ctx, obj, ctx.depth);
|
|
406
|
+
});
|
|
407
|
+
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
408
|
+
promisify = ((x) => (x.custom = Symbol.for("nodejs.util.promisify.custom"), x))(function(original) {
|
|
409
|
+
if (typeof original !== "function")
|
|
410
|
+
throw TypeError('The "original" argument must be of type Function');
|
|
411
|
+
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
|
412
|
+
var fn = original[kCustomPromisifiedSymbol];
|
|
413
|
+
if (typeof fn !== "function")
|
|
414
|
+
throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');
|
|
415
|
+
return Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }), fn;
|
|
416
|
+
}
|
|
417
|
+
function fn(...args) {
|
|
418
|
+
var promiseResolve, promiseReject, promise = new Promise(function(resolve, reject) {
|
|
419
|
+
promiseResolve = resolve, promiseReject = reject;
|
|
420
|
+
});
|
|
421
|
+
args.push(function(err, value) {
|
|
422
|
+
if (err)
|
|
423
|
+
promiseReject(err);
|
|
424
|
+
else
|
|
425
|
+
promiseResolve(value);
|
|
426
|
+
});
|
|
427
|
+
try {
|
|
428
|
+
original.apply(this, args);
|
|
429
|
+
} catch (err) {
|
|
430
|
+
promiseReject(err);
|
|
431
|
+
}
|
|
432
|
+
return promise;
|
|
433
|
+
}
|
|
434
|
+
if (Object.setPrototypeOf(fn, Object.getPrototypeOf(original)), kCustomPromisifiedSymbol)
|
|
435
|
+
Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true });
|
|
436
|
+
return Object.defineProperties(fn, Object.getOwnPropertyDescriptors(original));
|
|
437
|
+
});
|
|
438
|
+
({ TextEncoder, TextDecoder } = globalThis);
|
|
439
|
+
util_default = { TextEncoder, TextDecoder, promisify, log, inherits, _extend, callbackifyOnRejected, callbackify };
|
|
440
|
+
});
|
|
40
441
|
var DEFAULT_PLATFORM = "BEYOND_AI";
|
|
41
442
|
var BEYONDAI_TOKEN_URLS = {
|
|
42
443
|
staging: "https://staging-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token",
|
|
@@ -184,7 +585,7 @@ function detectEnvironment() {
|
|
|
184
585
|
var nodeInspect;
|
|
185
586
|
if (!isBrowser()) {
|
|
186
587
|
try {
|
|
187
|
-
const util = await
|
|
588
|
+
const util = await Promise.resolve().then(() => (init_util(), exports_util));
|
|
188
589
|
nodeInspect = util.inspect;
|
|
189
590
|
} catch {}
|
|
190
591
|
}
|
|
@@ -237,10 +638,10 @@ var terminalFormatter = (entry) => {
|
|
|
237
638
|
const consoleMethod = getConsoleMethod(entry.level);
|
|
238
639
|
const levelUpper = entry.level.toUpperCase().padEnd(5);
|
|
239
640
|
const isoString = entry.timestamp.toISOString().replace(/\.\d{3}Z$/, "");
|
|
240
|
-
const
|
|
641
|
+
const timestamp2 = `${colors.dim}[${isoString}]${colors.reset}`;
|
|
241
642
|
const level = `${levelColor}${levelUpper}${colors.reset}`;
|
|
242
643
|
const scope = entry.scope ? `${colors.bold}[${entry.scope}]${colors.reset} ` : "";
|
|
243
|
-
const prefix = `${
|
|
644
|
+
const prefix = `${timestamp2} ${level} ${scope}${entry.message}`;
|
|
244
645
|
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
245
646
|
consoleMethod(prefix, formatContext(entry.context));
|
|
246
647
|
} else {
|
|
@@ -254,9 +655,9 @@ var LEVEL_PREFIX = {
|
|
|
254
655
|
error: "[ERROR]"
|
|
255
656
|
};
|
|
256
657
|
function formatContext2(context) {
|
|
257
|
-
return Object.entries(context).map(([key, value]) => `${key}=${
|
|
658
|
+
return Object.entries(context).map(([key, value]) => `${key}=${formatValue2(value)}`).join(" ");
|
|
258
659
|
}
|
|
259
|
-
function
|
|
660
|
+
function formatValue2(value) {
|
|
260
661
|
if (typeof value === "string")
|
|
261
662
|
return value;
|
|
262
663
|
if (typeof value === "number")
|
|
@@ -412,7 +813,7 @@ function isDebug() {
|
|
|
412
813
|
return false;
|
|
413
814
|
}
|
|
414
815
|
}
|
|
415
|
-
var
|
|
816
|
+
var log2 = createLogger({ scope: "auth", minLevel: isDebug() ? "debug" : "warn" });
|
|
416
817
|
|
|
417
818
|
class TokenManager {
|
|
418
819
|
config;
|
|
@@ -426,11 +827,11 @@ class TokenManager {
|
|
|
426
827
|
}
|
|
427
828
|
async getToken() {
|
|
428
829
|
if (this.accessToken && Date.now() < this.tokenExpiry) {
|
|
429
|
-
|
|
830
|
+
log2.debug("Using cached token");
|
|
430
831
|
return this.accessToken;
|
|
431
832
|
}
|
|
432
833
|
if (this.pendingRequest) {
|
|
433
|
-
|
|
834
|
+
log2.debug("Waiting for in-flight token request");
|
|
434
835
|
return this.pendingRequest;
|
|
435
836
|
}
|
|
436
837
|
this.pendingRequest = this.fetchToken();
|
|
@@ -441,7 +842,7 @@ class TokenManager {
|
|
|
441
842
|
}
|
|
442
843
|
}
|
|
443
844
|
async fetchToken() {
|
|
444
|
-
|
|
845
|
+
log2.debug("Fetching new access token...");
|
|
445
846
|
const { clientId, clientSecret } = this.config.credentials;
|
|
446
847
|
const credentials = btoa(`${clientId}:${clientSecret}`);
|
|
447
848
|
const start = performance.now();
|
|
@@ -455,17 +856,17 @@ class TokenManager {
|
|
|
455
856
|
});
|
|
456
857
|
const duration = Math.round(performance.now() - start);
|
|
457
858
|
if (!response.ok) {
|
|
458
|
-
|
|
859
|
+
log2.error(`Token request failed: ${response.status} ${response.statusText}`);
|
|
459
860
|
throw new Error(`Failed to obtain access token: ${response.status} ${response.statusText}`);
|
|
460
861
|
}
|
|
461
862
|
const data = await response.json();
|
|
462
863
|
this.accessToken = data.access_token;
|
|
463
864
|
this.tokenExpiry = Date.now() + (data.expires_in - 60) * 1000;
|
|
464
|
-
|
|
865
|
+
log2.debug(`Token acquired (${duration}ms, expires in ${data.expires_in}s)`);
|
|
465
866
|
return this.accessToken;
|
|
466
867
|
}
|
|
467
868
|
invalidate() {
|
|
468
|
-
|
|
869
|
+
log2.debug("Token invalidated");
|
|
469
870
|
this.accessToken = null;
|
|
470
871
|
this.tokenExpiry = 0;
|
|
471
872
|
}
|
|
@@ -699,7 +1100,17 @@ class TimebackProvider {
|
|
|
699
1100
|
}
|
|
700
1101
|
function getEnv(key) {
|
|
701
1102
|
try {
|
|
702
|
-
|
|
1103
|
+
if (typeof process === "undefined")
|
|
1104
|
+
return;
|
|
1105
|
+
if (typeof key === "string") {
|
|
1106
|
+
return process.env[key];
|
|
1107
|
+
}
|
|
1108
|
+
for (const k of key) {
|
|
1109
|
+
const value = process.env[k];
|
|
1110
|
+
if (value !== undefined)
|
|
1111
|
+
return value;
|
|
1112
|
+
}
|
|
1113
|
+
return;
|
|
703
1114
|
} catch {
|
|
704
1115
|
return;
|
|
705
1116
|
}
|
|
@@ -730,6 +1141,18 @@ var DEFAULT_PROVIDER_REGISTRY = {
|
|
|
730
1141
|
}
|
|
731
1142
|
}
|
|
732
1143
|
};
|
|
1144
|
+
function primaryEnvVar(key) {
|
|
1145
|
+
if (typeof key === "string") {
|
|
1146
|
+
return key;
|
|
1147
|
+
}
|
|
1148
|
+
if (key.length === 0) {
|
|
1149
|
+
throw new Error(`Missing env var key: ${key}`);
|
|
1150
|
+
}
|
|
1151
|
+
return key[0];
|
|
1152
|
+
}
|
|
1153
|
+
function formatEnvVarKey(key) {
|
|
1154
|
+
return primaryEnvVar(key);
|
|
1155
|
+
}
|
|
733
1156
|
function validateEnv(env) {
|
|
734
1157
|
if (env !== "staging" && env !== "production") {
|
|
735
1158
|
throw new Error(`Invalid env "${env}": must be "staging" or "production"`);
|
|
@@ -740,10 +1163,10 @@ function validateAuth(auth, envVars) {
|
|
|
740
1163
|
const clientId = auth?.clientId ?? getEnv(envVars.clientId);
|
|
741
1164
|
const clientSecret = auth?.clientSecret ?? getEnv(envVars.clientSecret);
|
|
742
1165
|
if (!clientId) {
|
|
743
|
-
throw new Error(`Missing clientId: provide in config or set ${envVars.clientId}`);
|
|
1166
|
+
throw new Error(`Missing clientId: provide in config or set ${formatEnvVarKey(envVars.clientId)}`);
|
|
744
1167
|
}
|
|
745
1168
|
if (!clientSecret) {
|
|
746
|
-
throw new Error(`Missing clientSecret: provide in config or set ${envVars.clientSecret}`);
|
|
1169
|
+
throw new Error(`Missing clientSecret: provide in config or set ${formatEnvVarKey(envVars.clientSecret)}`);
|
|
747
1170
|
}
|
|
748
1171
|
return { clientId, clientSecret };
|
|
749
1172
|
}
|
|
@@ -759,21 +1182,21 @@ function buildMissingEnvError(envVars) {
|
|
|
759
1182
|
const clientId = getEnv(envVars.clientId);
|
|
760
1183
|
const clientSecret = getEnv(envVars.clientSecret);
|
|
761
1184
|
if (baseUrl === undefined && clientId === undefined) {
|
|
762
|
-
const hint = envVars.env ?? envVars.baseUrl;
|
|
1185
|
+
const hint = formatEnvVarKey(envVars.env ?? envVars.baseUrl);
|
|
763
1186
|
return `Missing env: provide in config or set ${hint}`;
|
|
764
1187
|
}
|
|
765
1188
|
const missing = [];
|
|
766
1189
|
if (baseUrl === undefined) {
|
|
767
|
-
missing.push(envVars.env ?? envVars.baseUrl);
|
|
1190
|
+
missing.push(formatEnvVarKey(envVars.env ?? envVars.baseUrl));
|
|
768
1191
|
}
|
|
769
1192
|
if (baseUrl !== undefined && authUrl === undefined) {
|
|
770
|
-
missing.push(envVars.authUrl);
|
|
1193
|
+
missing.push(formatEnvVarKey(envVars.authUrl));
|
|
771
1194
|
}
|
|
772
1195
|
if (clientId === undefined) {
|
|
773
|
-
missing.push(envVars.clientId);
|
|
1196
|
+
missing.push(formatEnvVarKey(envVars.clientId));
|
|
774
1197
|
}
|
|
775
1198
|
if (clientSecret === undefined) {
|
|
776
|
-
missing.push(envVars.clientSecret);
|
|
1199
|
+
missing.push(formatEnvVarKey(envVars.clientSecret));
|
|
777
1200
|
}
|
|
778
1201
|
return `Missing environment variables: ${missing.join(", ")}`;
|
|
779
1202
|
}
|
|
@@ -912,7 +1335,7 @@ var MODE_TOKEN_PROVIDER = {
|
|
|
912
1335
|
return "tokenProvider" in config;
|
|
913
1336
|
},
|
|
914
1337
|
resolve() {
|
|
915
|
-
throw new Error("TokenProvider mode is not supported with provider pattern. Use { provider: TimebackProvider } or { env, auth } instead.");
|
|
1338
|
+
throw new Error("TokenProvider mode is not supported with provider pattern. " + "Use { provider: TimebackProvider } or { env, auth } instead.");
|
|
916
1339
|
}
|
|
917
1340
|
};
|
|
918
1341
|
var MODES = [
|
|
@@ -1264,15 +1687,15 @@ function validateNonEmptyString(value, name) {
|
|
|
1264
1687
|
}
|
|
1265
1688
|
}
|
|
1266
1689
|
var EDUBRIDGE_ENV_VARS = {
|
|
1267
|
-
baseUrl: "EDUBRIDGE_BASE_URL",
|
|
1268
|
-
clientId: "EDUBRIDGE_CLIENT_ID",
|
|
1269
|
-
clientSecret: "EDUBRIDGE_CLIENT_SECRET",
|
|
1270
|
-
authUrl: "EDUBRIDGE_TOKEN_URL"
|
|
1690
|
+
baseUrl: ["TIMEBACK_API_BASE_URL", "TIMEBACK_BASE_URL", "EDUBRIDGE_BASE_URL"],
|
|
1691
|
+
clientId: ["TIMEBACK_API_CLIENT_ID", "TIMEBACK_CLIENT_ID", "EDUBRIDGE_CLIENT_ID"],
|
|
1692
|
+
clientSecret: ["TIMEBACK_API_CLIENT_SECRET", "TIMEBACK_CLIENT_SECRET", "EDUBRIDGE_CLIENT_SECRET"],
|
|
1693
|
+
authUrl: ["TIMEBACK_API_AUTH_URL", "TIMEBACK_AUTH_URL", "EDUBRIDGE_TOKEN_URL"]
|
|
1271
1694
|
};
|
|
1272
1695
|
function resolveToProvider2(config, registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
1273
1696
|
return resolveToProvider(config, EDUBRIDGE_ENV_VARS, registry);
|
|
1274
1697
|
}
|
|
1275
|
-
var
|
|
1698
|
+
var log3 = createScopedLogger("edubridge");
|
|
1276
1699
|
function normalizeBoolean(value) {
|
|
1277
1700
|
if (typeof value === "boolean")
|
|
1278
1701
|
return value;
|
|
@@ -1337,7 +1760,7 @@ function aggregateActivityMetrics(data) {
|
|
|
1337
1760
|
class Transport extends BaseTransport {
|
|
1338
1761
|
paths;
|
|
1339
1762
|
constructor(config) {
|
|
1340
|
-
super({ config, logger:
|
|
1763
|
+
super({ config, logger: log3 });
|
|
1341
1764
|
this.paths = config.paths;
|
|
1342
1765
|
}
|
|
1343
1766
|
async requestPaginated(path, options = {}) {
|
|
@@ -1381,7 +1804,7 @@ __export2(exports_external, {
|
|
|
1381
1804
|
uuidv6: () => uuidv6,
|
|
1382
1805
|
uuidv4: () => uuidv4,
|
|
1383
1806
|
uuid: () => uuid2,
|
|
1384
|
-
util: () =>
|
|
1807
|
+
util: () => exports_util2,
|
|
1385
1808
|
url: () => url,
|
|
1386
1809
|
uppercase: () => _uppercase,
|
|
1387
1810
|
unknown: () => unknown,
|
|
@@ -1490,7 +1913,7 @@ __export2(exports_external, {
|
|
|
1490
1913
|
getErrorMap: () => getErrorMap,
|
|
1491
1914
|
function: () => _function,
|
|
1492
1915
|
fromJSONSchema: () => fromJSONSchema,
|
|
1493
|
-
formatError: () =>
|
|
1916
|
+
formatError: () => formatError2,
|
|
1494
1917
|
float64: () => float64,
|
|
1495
1918
|
float32: () => float32,
|
|
1496
1919
|
flattenError: () => flattenError,
|
|
@@ -1614,7 +2037,7 @@ __export2(exports_external, {
|
|
|
1614
2037
|
var exports_core2 = {};
|
|
1615
2038
|
__export2(exports_core2, {
|
|
1616
2039
|
version: () => version,
|
|
1617
|
-
util: () =>
|
|
2040
|
+
util: () => exports_util2,
|
|
1618
2041
|
treeifyError: () => treeifyError,
|
|
1619
2042
|
toJSONSchema: () => toJSONSchema,
|
|
1620
2043
|
toDotPath: () => toDotPath,
|
|
@@ -1638,7 +2061,7 @@ __export2(exports_core2, {
|
|
|
1638
2061
|
initializeContext: () => initializeContext,
|
|
1639
2062
|
globalRegistry: () => globalRegistry,
|
|
1640
2063
|
globalConfig: () => globalConfig,
|
|
1641
|
-
formatError: () =>
|
|
2064
|
+
formatError: () => formatError2,
|
|
1642
2065
|
flattenError: () => flattenError,
|
|
1643
2066
|
finalize: () => finalize,
|
|
1644
2067
|
extractDefs: () => extractDefs,
|
|
@@ -1962,8 +2385,8 @@ function config(newConfig) {
|
|
|
1962
2385
|
Object.assign(globalConfig, newConfig);
|
|
1963
2386
|
return globalConfig;
|
|
1964
2387
|
}
|
|
1965
|
-
var
|
|
1966
|
-
__export2(
|
|
2388
|
+
var exports_util2 = {};
|
|
2389
|
+
__export2(exports_util2, {
|
|
1967
2390
|
unwrapMessage: () => unwrapMessage,
|
|
1968
2391
|
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
1969
2392
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
@@ -1993,7 +2416,7 @@ __export2(exports_util, {
|
|
|
1993
2416
|
joinValues: () => joinValues,
|
|
1994
2417
|
issue: () => issue2,
|
|
1995
2418
|
isPlainObject: () => isPlainObject,
|
|
1996
|
-
isObject: () =>
|
|
2419
|
+
isObject: () => isObject2,
|
|
1997
2420
|
hexToUint8Array: () => hexToUint8Array,
|
|
1998
2421
|
getSizableOrigin: () => getSizableOrigin,
|
|
1999
2422
|
getParsedType: () => getParsedType,
|
|
@@ -2162,7 +2585,7 @@ function slugify(input) {
|
|
|
2162
2585
|
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2163
2586
|
}
|
|
2164
2587
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
2165
|
-
function
|
|
2588
|
+
function isObject2(data) {
|
|
2166
2589
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
2167
2590
|
}
|
|
2168
2591
|
var allowsEval = cached(() => {
|
|
@@ -2178,7 +2601,7 @@ var allowsEval = cached(() => {
|
|
|
2178
2601
|
}
|
|
2179
2602
|
});
|
|
2180
2603
|
function isPlainObject(o) {
|
|
2181
|
-
if (
|
|
2604
|
+
if (isObject2(o) === false)
|
|
2182
2605
|
return false;
|
|
2183
2606
|
const ctor = o.constructor;
|
|
2184
2607
|
if (ctor === undefined)
|
|
@@ -2186,7 +2609,7 @@ function isPlainObject(o) {
|
|
|
2186
2609
|
if (typeof ctor !== "function")
|
|
2187
2610
|
return true;
|
|
2188
2611
|
const prot = ctor.prototype;
|
|
2189
|
-
if (
|
|
2612
|
+
if (isObject2(prot) === false)
|
|
2190
2613
|
return false;
|
|
2191
2614
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
2192
2615
|
return false;
|
|
@@ -2665,7 +3088,7 @@ function flattenError(error, mapper = (issue3) => issue3.message) {
|
|
|
2665
3088
|
}
|
|
2666
3089
|
return { formErrors, fieldErrors };
|
|
2667
3090
|
}
|
|
2668
|
-
function
|
|
3091
|
+
function formatError2(error, mapper = (issue3) => issue3.message) {
|
|
2669
3092
|
const fieldErrors = { _errors: [] };
|
|
2670
3093
|
const processError = (error2) => {
|
|
2671
3094
|
for (const issue3 of error2.issues) {
|
|
@@ -3595,7 +4018,7 @@ class Doc {
|
|
|
3595
4018
|
var version = {
|
|
3596
4019
|
major: 4,
|
|
3597
4020
|
minor: 3,
|
|
3598
|
-
patch:
|
|
4021
|
+
patch: 6
|
|
3599
4022
|
};
|
|
3600
4023
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
3601
4024
|
var _a;
|
|
@@ -4180,15 +4603,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
4180
4603
|
} catch (_err) {}
|
|
4181
4604
|
}
|
|
4182
4605
|
const input = payload.value;
|
|
4183
|
-
const
|
|
4184
|
-
const isValidDate =
|
|
4606
|
+
const isDate2 = input instanceof Date;
|
|
4607
|
+
const isValidDate = isDate2 && !Number.isNaN(input.getTime());
|
|
4185
4608
|
if (isValidDate)
|
|
4186
4609
|
return payload;
|
|
4187
4610
|
payload.issues.push({
|
|
4188
4611
|
expected: "date",
|
|
4189
4612
|
code: "invalid_type",
|
|
4190
4613
|
input,
|
|
4191
|
-
...
|
|
4614
|
+
...isDate2 ? { received: "Invalid Date" } : {},
|
|
4192
4615
|
inst
|
|
4193
4616
|
});
|
|
4194
4617
|
return payload;
|
|
@@ -4327,13 +4750,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
4327
4750
|
}
|
|
4328
4751
|
return propValues;
|
|
4329
4752
|
});
|
|
4330
|
-
const
|
|
4753
|
+
const isObject3 = isObject2;
|
|
4331
4754
|
const catchall = def.catchall;
|
|
4332
4755
|
let value;
|
|
4333
4756
|
inst._zod.parse = (payload, ctx) => {
|
|
4334
4757
|
value ?? (value = _normalized.value);
|
|
4335
4758
|
const input = payload.value;
|
|
4336
|
-
if (!
|
|
4759
|
+
if (!isObject3(input)) {
|
|
4337
4760
|
payload.issues.push({
|
|
4338
4761
|
expected: "object",
|
|
4339
4762
|
code: "invalid_type",
|
|
@@ -4431,7 +4854,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
4431
4854
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
4432
4855
|
};
|
|
4433
4856
|
let fastpass;
|
|
4434
|
-
const
|
|
4857
|
+
const isObject3 = isObject2;
|
|
4435
4858
|
const jit = !globalConfig.jitless;
|
|
4436
4859
|
const allowsEval2 = allowsEval;
|
|
4437
4860
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -4440,7 +4863,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
4440
4863
|
inst._zod.parse = (payload, ctx) => {
|
|
4441
4864
|
value ?? (value = _normalized.value);
|
|
4442
4865
|
const input = payload.value;
|
|
4443
|
-
if (!
|
|
4866
|
+
if (!isObject3(input)) {
|
|
4444
4867
|
payload.issues.push({
|
|
4445
4868
|
expected: "object",
|
|
4446
4869
|
code: "invalid_type",
|
|
@@ -4618,7 +5041,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4618
5041
|
});
|
|
4619
5042
|
inst._zod.parse = (payload, ctx) => {
|
|
4620
5043
|
const input = payload.value;
|
|
4621
|
-
if (!
|
|
5044
|
+
if (!isObject2(input)) {
|
|
4622
5045
|
payload.issues.push({
|
|
4623
5046
|
code: "invalid_type",
|
|
4624
5047
|
expected: "object",
|
|
@@ -4739,7 +5162,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
4739
5162
|
return result;
|
|
4740
5163
|
const merged = mergeValues(left.value, right.value);
|
|
4741
5164
|
if (!merged.valid) {
|
|
4742
|
-
throw new Error(`Unmergable intersection. Error path:
|
|
5165
|
+
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
4743
5166
|
}
|
|
4744
5167
|
result.value = merged.data;
|
|
4745
5168
|
return result;
|
|
@@ -4879,7 +5302,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4879
5302
|
if (keyResult instanceof Promise) {
|
|
4880
5303
|
throw new Error("Async schemas not supported in object keys currently");
|
|
4881
5304
|
}
|
|
4882
|
-
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length
|
|
5305
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
4883
5306
|
if (checkNumericKey) {
|
|
4884
5307
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
4885
5308
|
if (retryResult instanceof Promise) {
|
|
@@ -11657,10 +12080,10 @@ function _property(property, schema, params) {
|
|
|
11657
12080
|
...normalizeParams(params)
|
|
11658
12081
|
});
|
|
11659
12082
|
}
|
|
11660
|
-
function _mime(
|
|
12083
|
+
function _mime(types2, params) {
|
|
11661
12084
|
return new $ZodCheckMimeType({
|
|
11662
12085
|
check: "mime_type",
|
|
11663
|
-
mime:
|
|
12086
|
+
mime: types2,
|
|
11664
12087
|
...normalizeParams(params)
|
|
11665
12088
|
});
|
|
11666
12089
|
}
|
|
@@ -11983,13 +12406,13 @@ function _stringbool(Classes, _params) {
|
|
|
11983
12406
|
});
|
|
11984
12407
|
return codec;
|
|
11985
12408
|
}
|
|
11986
|
-
function _stringFormat(Class2,
|
|
12409
|
+
function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
|
|
11987
12410
|
const params = normalizeParams(_params);
|
|
11988
12411
|
const def = {
|
|
11989
12412
|
...normalizeParams(_params),
|
|
11990
12413
|
check: "string_format",
|
|
11991
12414
|
type: "string",
|
|
11992
|
-
format,
|
|
12415
|
+
format: format2,
|
|
11993
12416
|
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
11994
12417
|
...params
|
|
11995
12418
|
};
|
|
@@ -12127,9 +12550,7 @@ function extractDefs(ctx, schema) {
|
|
|
12127
12550
|
for (const entry of ctx.seen.entries()) {
|
|
12128
12551
|
const seen = entry[1];
|
|
12129
12552
|
if (seen.cycle) {
|
|
12130
|
-
throw new Error(
|
|
12131
|
-
|
|
12132
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
12553
|
+
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
12133
12554
|
}
|
|
12134
12555
|
}
|
|
12135
12556
|
}
|
|
@@ -12196,7 +12617,7 @@ function finalize(ctx, schema) {
|
|
|
12196
12617
|
}
|
|
12197
12618
|
}
|
|
12198
12619
|
}
|
|
12199
|
-
if (refSchema.$ref) {
|
|
12620
|
+
if (refSchema.$ref && refSeen.def) {
|
|
12200
12621
|
for (const key in schema2) {
|
|
12201
12622
|
if (key === "$ref" || key === "allOf")
|
|
12202
12623
|
continue;
|
|
@@ -12355,16 +12776,16 @@ var formatMap = {
|
|
|
12355
12776
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
12356
12777
|
const json = _json;
|
|
12357
12778
|
json.type = "string";
|
|
12358
|
-
const { minimum, maximum, format, patterns: patterns2, contentEncoding } = schema._zod.bag;
|
|
12779
|
+
const { minimum, maximum, format: format2, patterns: patterns2, contentEncoding } = schema._zod.bag;
|
|
12359
12780
|
if (typeof minimum === "number")
|
|
12360
12781
|
json.minLength = minimum;
|
|
12361
12782
|
if (typeof maximum === "number")
|
|
12362
12783
|
json.maxLength = maximum;
|
|
12363
|
-
if (
|
|
12364
|
-
json.format = formatMap[
|
|
12784
|
+
if (format2) {
|
|
12785
|
+
json.format = formatMap[format2] ?? format2;
|
|
12365
12786
|
if (json.format === "")
|
|
12366
12787
|
delete json.format;
|
|
12367
|
-
if (
|
|
12788
|
+
if (format2 === "time") {
|
|
12368
12789
|
delete json.format;
|
|
12369
12790
|
}
|
|
12370
12791
|
}
|
|
@@ -12386,8 +12807,8 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
12386
12807
|
};
|
|
12387
12808
|
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
12388
12809
|
const json = _json;
|
|
12389
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
12390
|
-
if (typeof
|
|
12810
|
+
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
12811
|
+
if (typeof format2 === "string" && format2.includes("int"))
|
|
12391
12812
|
json.type = "integer";
|
|
12392
12813
|
else
|
|
12393
12814
|
json.type = "number";
|
|
@@ -13192,7 +13613,7 @@ var initializer2 = (inst, issues) => {
|
|
|
13192
13613
|
inst.name = "ZodError";
|
|
13193
13614
|
Object.defineProperties(inst, {
|
|
13194
13615
|
format: {
|
|
13195
|
-
value: (mapper) =>
|
|
13616
|
+
value: (mapper) => formatError2(inst, mapper)
|
|
13196
13617
|
},
|
|
13197
13618
|
flatten: {
|
|
13198
13619
|
value: (mapper) => flattenError(inst, mapper)
|
|
@@ -13245,7 +13666,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
13245
13666
|
inst.type = def.type;
|
|
13246
13667
|
Object.defineProperty(inst, "_def", { value: def });
|
|
13247
13668
|
inst.check = (...checks2) => {
|
|
13248
|
-
return inst.clone(
|
|
13669
|
+
return inst.clone(exports_util2.mergeDefs(def, {
|
|
13249
13670
|
checks: [
|
|
13250
13671
|
...def.checks ?? [],
|
|
13251
13672
|
...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
@@ -13418,7 +13839,7 @@ function httpUrl(params) {
|
|
|
13418
13839
|
return _url(ZodURL, {
|
|
13419
13840
|
protocol: /^https?$/,
|
|
13420
13841
|
hostname: exports_regexes.domain,
|
|
13421
|
-
...
|
|
13842
|
+
...exports_util2.normalizeParams(params)
|
|
13422
13843
|
});
|
|
13423
13844
|
}
|
|
13424
13845
|
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
@@ -13537,8 +13958,8 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
|
|
|
13537
13958
|
$ZodCustomStringFormat.init(inst, def);
|
|
13538
13959
|
ZodStringFormat.init(inst, def);
|
|
13539
13960
|
});
|
|
13540
|
-
function stringFormat(
|
|
13541
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
13961
|
+
function stringFormat(format2, fnOrRegex, _params = {}) {
|
|
13962
|
+
return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
|
|
13542
13963
|
}
|
|
13543
13964
|
function hostname2(_params) {
|
|
13544
13965
|
return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
|
|
@@ -13548,11 +13969,11 @@ function hex2(_params) {
|
|
|
13548
13969
|
}
|
|
13549
13970
|
function hash(alg, params) {
|
|
13550
13971
|
const enc = params?.enc ?? "hex";
|
|
13551
|
-
const
|
|
13552
|
-
const regex = exports_regexes[
|
|
13972
|
+
const format2 = `${alg}_${enc}`;
|
|
13973
|
+
const regex = exports_regexes[format2];
|
|
13553
13974
|
if (!regex)
|
|
13554
|
-
throw new Error(`Unrecognized hash format: ${
|
|
13555
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
13975
|
+
throw new Error(`Unrecognized hash format: ${format2}`);
|
|
13976
|
+
return _stringFormat(ZodCustomStringFormat, format2, regex, params);
|
|
13556
13977
|
}
|
|
13557
13978
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
13558
13979
|
$ZodNumber.init(inst, def);
|
|
@@ -13736,7 +14157,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
13736
14157
|
$ZodObjectJIT.init(inst, def);
|
|
13737
14158
|
ZodType.init(inst, def);
|
|
13738
14159
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
13739
|
-
|
|
14160
|
+
exports_util2.defineLazy(inst, "shape", () => {
|
|
13740
14161
|
return def.shape;
|
|
13741
14162
|
});
|
|
13742
14163
|
inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape));
|
|
@@ -13746,22 +14167,22 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
13746
14167
|
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
13747
14168
|
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
|
13748
14169
|
inst.extend = (incoming) => {
|
|
13749
|
-
return
|
|
14170
|
+
return exports_util2.extend(inst, incoming);
|
|
13750
14171
|
};
|
|
13751
14172
|
inst.safeExtend = (incoming) => {
|
|
13752
|
-
return
|
|
14173
|
+
return exports_util2.safeExtend(inst, incoming);
|
|
13753
14174
|
};
|
|
13754
|
-
inst.merge = (other) =>
|
|
13755
|
-
inst.pick = (mask) =>
|
|
13756
|
-
inst.omit = (mask) =>
|
|
13757
|
-
inst.partial = (...args) =>
|
|
13758
|
-
inst.required = (...args) =>
|
|
14175
|
+
inst.merge = (other) => exports_util2.merge(inst, other);
|
|
14176
|
+
inst.pick = (mask) => exports_util2.pick(inst, mask);
|
|
14177
|
+
inst.omit = (mask) => exports_util2.omit(inst, mask);
|
|
14178
|
+
inst.partial = (...args) => exports_util2.partial(ZodOptional, inst, args[0]);
|
|
14179
|
+
inst.required = (...args) => exports_util2.required(ZodNonOptional, inst, args[0]);
|
|
13759
14180
|
});
|
|
13760
14181
|
function object(shape, params) {
|
|
13761
14182
|
const def = {
|
|
13762
14183
|
type: "object",
|
|
13763
14184
|
shape: shape ?? {},
|
|
13764
|
-
...
|
|
14185
|
+
...exports_util2.normalizeParams(params)
|
|
13765
14186
|
};
|
|
13766
14187
|
return new ZodObject(def);
|
|
13767
14188
|
}
|
|
@@ -13770,7 +14191,7 @@ function strictObject(shape, params) {
|
|
|
13770
14191
|
type: "object",
|
|
13771
14192
|
shape,
|
|
13772
14193
|
catchall: never(),
|
|
13773
|
-
...
|
|
14194
|
+
...exports_util2.normalizeParams(params)
|
|
13774
14195
|
});
|
|
13775
14196
|
}
|
|
13776
14197
|
function looseObject(shape, params) {
|
|
@@ -13778,7 +14199,7 @@ function looseObject(shape, params) {
|
|
|
13778
14199
|
type: "object",
|
|
13779
14200
|
shape,
|
|
13780
14201
|
catchall: unknown(),
|
|
13781
|
-
...
|
|
14202
|
+
...exports_util2.normalizeParams(params)
|
|
13782
14203
|
});
|
|
13783
14204
|
}
|
|
13784
14205
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
@@ -13791,7 +14212,7 @@ function union(options, params) {
|
|
|
13791
14212
|
return new ZodUnion({
|
|
13792
14213
|
type: "union",
|
|
13793
14214
|
options,
|
|
13794
|
-
...
|
|
14215
|
+
...exports_util2.normalizeParams(params)
|
|
13795
14216
|
});
|
|
13796
14217
|
}
|
|
13797
14218
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
@@ -13805,7 +14226,7 @@ function xor(options, params) {
|
|
|
13805
14226
|
type: "union",
|
|
13806
14227
|
options,
|
|
13807
14228
|
inclusive: false,
|
|
13808
|
-
...
|
|
14229
|
+
...exports_util2.normalizeParams(params)
|
|
13809
14230
|
});
|
|
13810
14231
|
}
|
|
13811
14232
|
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
@@ -13817,7 +14238,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
13817
14238
|
type: "union",
|
|
13818
14239
|
options,
|
|
13819
14240
|
discriminator,
|
|
13820
|
-
...
|
|
14241
|
+
...exports_util2.normalizeParams(params)
|
|
13821
14242
|
});
|
|
13822
14243
|
}
|
|
13823
14244
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
@@ -13849,7 +14270,7 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
13849
14270
|
type: "tuple",
|
|
13850
14271
|
items,
|
|
13851
14272
|
rest,
|
|
13852
|
-
...
|
|
14273
|
+
...exports_util2.normalizeParams(params)
|
|
13853
14274
|
});
|
|
13854
14275
|
}
|
|
13855
14276
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
@@ -13864,7 +14285,7 @@ function record(keyType, valueType, params) {
|
|
|
13864
14285
|
type: "record",
|
|
13865
14286
|
keyType,
|
|
13866
14287
|
valueType,
|
|
13867
|
-
...
|
|
14288
|
+
...exports_util2.normalizeParams(params)
|
|
13868
14289
|
});
|
|
13869
14290
|
}
|
|
13870
14291
|
function partialRecord(keyType, valueType, params) {
|
|
@@ -13874,7 +14295,7 @@ function partialRecord(keyType, valueType, params) {
|
|
|
13874
14295
|
type: "record",
|
|
13875
14296
|
keyType: k,
|
|
13876
14297
|
valueType,
|
|
13877
|
-
...
|
|
14298
|
+
...exports_util2.normalizeParams(params)
|
|
13878
14299
|
});
|
|
13879
14300
|
}
|
|
13880
14301
|
function looseRecord(keyType, valueType, params) {
|
|
@@ -13883,7 +14304,7 @@ function looseRecord(keyType, valueType, params) {
|
|
|
13883
14304
|
keyType,
|
|
13884
14305
|
valueType,
|
|
13885
14306
|
mode: "loose",
|
|
13886
|
-
...
|
|
14307
|
+
...exports_util2.normalizeParams(params)
|
|
13887
14308
|
});
|
|
13888
14309
|
}
|
|
13889
14310
|
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
@@ -13902,7 +14323,7 @@ function map(keyType, valueType, params) {
|
|
|
13902
14323
|
type: "map",
|
|
13903
14324
|
keyType,
|
|
13904
14325
|
valueType,
|
|
13905
|
-
...
|
|
14326
|
+
...exports_util2.normalizeParams(params)
|
|
13906
14327
|
});
|
|
13907
14328
|
}
|
|
13908
14329
|
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
@@ -13918,7 +14339,7 @@ function set(valueType, params) {
|
|
|
13918
14339
|
return new ZodSet({
|
|
13919
14340
|
type: "set",
|
|
13920
14341
|
valueType,
|
|
13921
|
-
...
|
|
14342
|
+
...exports_util2.normalizeParams(params)
|
|
13922
14343
|
});
|
|
13923
14344
|
}
|
|
13924
14345
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
@@ -13939,7 +14360,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
13939
14360
|
return new ZodEnum({
|
|
13940
14361
|
...def,
|
|
13941
14362
|
checks: [],
|
|
13942
|
-
...
|
|
14363
|
+
...exports_util2.normalizeParams(params),
|
|
13943
14364
|
entries: newEntries
|
|
13944
14365
|
});
|
|
13945
14366
|
};
|
|
@@ -13954,7 +14375,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
13954
14375
|
return new ZodEnum({
|
|
13955
14376
|
...def,
|
|
13956
14377
|
checks: [],
|
|
13957
|
-
...
|
|
14378
|
+
...exports_util2.normalizeParams(params),
|
|
13958
14379
|
entries: newEntries
|
|
13959
14380
|
});
|
|
13960
14381
|
};
|
|
@@ -13964,14 +14385,14 @@ function _enum2(values, params) {
|
|
|
13964
14385
|
return new ZodEnum({
|
|
13965
14386
|
type: "enum",
|
|
13966
14387
|
entries,
|
|
13967
|
-
...
|
|
14388
|
+
...exports_util2.normalizeParams(params)
|
|
13968
14389
|
});
|
|
13969
14390
|
}
|
|
13970
14391
|
function nativeEnum(entries, params) {
|
|
13971
14392
|
return new ZodEnum({
|
|
13972
14393
|
type: "enum",
|
|
13973
14394
|
entries,
|
|
13974
|
-
...
|
|
14395
|
+
...exports_util2.normalizeParams(params)
|
|
13975
14396
|
});
|
|
13976
14397
|
}
|
|
13977
14398
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
@@ -13992,7 +14413,7 @@ function literal(value, params) {
|
|
|
13992
14413
|
return new ZodLiteral({
|
|
13993
14414
|
type: "literal",
|
|
13994
14415
|
values: Array.isArray(value) ? value : [value],
|
|
13995
|
-
...
|
|
14416
|
+
...exports_util2.normalizeParams(params)
|
|
13996
14417
|
});
|
|
13997
14418
|
}
|
|
13998
14419
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
@@ -14001,7 +14422,7 @@ var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
|
14001
14422
|
inst._zod.processJSONSchema = (ctx, json, params) => fileProcessor(inst, ctx, json, params);
|
|
14002
14423
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
14003
14424
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
14004
|
-
inst.mime = (
|
|
14425
|
+
inst.mime = (types2, params) => inst.check(_mime(Array.isArray(types2) ? types2 : [types2], params));
|
|
14005
14426
|
});
|
|
14006
14427
|
function file(params) {
|
|
14007
14428
|
return _file(ZodFile, params);
|
|
@@ -14016,7 +14437,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
14016
14437
|
}
|
|
14017
14438
|
payload.addIssue = (issue3) => {
|
|
14018
14439
|
if (typeof issue3 === "string") {
|
|
14019
|
-
payload.issues.push(
|
|
14440
|
+
payload.issues.push(exports_util2.issue(issue3, payload.value, def));
|
|
14020
14441
|
} else {
|
|
14021
14442
|
const _issue = issue3;
|
|
14022
14443
|
if (_issue.fatal)
|
|
@@ -14024,7 +14445,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
14024
14445
|
_issue.code ?? (_issue.code = "custom");
|
|
14025
14446
|
_issue.input ?? (_issue.input = payload.value);
|
|
14026
14447
|
_issue.inst ?? (_issue.inst = inst);
|
|
14027
|
-
payload.issues.push(
|
|
14448
|
+
payload.issues.push(exports_util2.issue(_issue));
|
|
14028
14449
|
}
|
|
14029
14450
|
};
|
|
14030
14451
|
const output = def.transform(payload.value, payload);
|
|
@@ -14095,7 +14516,7 @@ function _default2(innerType, defaultValue) {
|
|
|
14095
14516
|
type: "default",
|
|
14096
14517
|
innerType,
|
|
14097
14518
|
get defaultValue() {
|
|
14098
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
14519
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util2.shallowClone(defaultValue);
|
|
14099
14520
|
}
|
|
14100
14521
|
});
|
|
14101
14522
|
}
|
|
@@ -14110,7 +14531,7 @@ function prefault(innerType, defaultValue) {
|
|
|
14110
14531
|
type: "prefault",
|
|
14111
14532
|
innerType,
|
|
14112
14533
|
get defaultValue() {
|
|
14113
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
14534
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util2.shallowClone(defaultValue);
|
|
14114
14535
|
}
|
|
14115
14536
|
});
|
|
14116
14537
|
}
|
|
@@ -14124,7 +14545,7 @@ function nonoptional(innerType, params) {
|
|
|
14124
14545
|
return new ZodNonOptional({
|
|
14125
14546
|
type: "nonoptional",
|
|
14126
14547
|
innerType,
|
|
14127
|
-
...
|
|
14548
|
+
...exports_util2.normalizeParams(params)
|
|
14128
14549
|
});
|
|
14129
14550
|
}
|
|
14130
14551
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
@@ -14209,7 +14630,7 @@ function templateLiteral(parts, params) {
|
|
|
14209
14630
|
return new ZodTemplateLiteral({
|
|
14210
14631
|
type: "template_literal",
|
|
14211
14632
|
parts,
|
|
14212
|
-
...
|
|
14633
|
+
...exports_util2.normalizeParams(params)
|
|
14213
14634
|
});
|
|
14214
14635
|
}
|
|
14215
14636
|
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
@@ -14277,7 +14698,7 @@ function _instanceof(cls, params = {}) {
|
|
|
14277
14698
|
check: "custom",
|
|
14278
14699
|
fn: (data) => data instanceof cls,
|
|
14279
14700
|
abort: true,
|
|
14280
|
-
...
|
|
14701
|
+
...exports_util2.normalizeParams(params)
|
|
14281
14702
|
});
|
|
14282
14703
|
inst._zod.bag.Class = cls;
|
|
14283
14704
|
inst._zod.check = (payload) => {
|
|
@@ -14509,52 +14930,52 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14509
14930
|
case "string": {
|
|
14510
14931
|
let stringSchema = z.string();
|
|
14511
14932
|
if (schema.format) {
|
|
14512
|
-
const
|
|
14513
|
-
if (
|
|
14933
|
+
const format2 = schema.format;
|
|
14934
|
+
if (format2 === "email") {
|
|
14514
14935
|
stringSchema = stringSchema.check(z.email());
|
|
14515
|
-
} else if (
|
|
14936
|
+
} else if (format2 === "uri" || format2 === "uri-reference") {
|
|
14516
14937
|
stringSchema = stringSchema.check(z.url());
|
|
14517
|
-
} else if (
|
|
14938
|
+
} else if (format2 === "uuid" || format2 === "guid") {
|
|
14518
14939
|
stringSchema = stringSchema.check(z.uuid());
|
|
14519
|
-
} else if (
|
|
14940
|
+
} else if (format2 === "date-time") {
|
|
14520
14941
|
stringSchema = stringSchema.check(z.iso.datetime());
|
|
14521
|
-
} else if (
|
|
14942
|
+
} else if (format2 === "date") {
|
|
14522
14943
|
stringSchema = stringSchema.check(z.iso.date());
|
|
14523
|
-
} else if (
|
|
14944
|
+
} else if (format2 === "time") {
|
|
14524
14945
|
stringSchema = stringSchema.check(z.iso.time());
|
|
14525
|
-
} else if (
|
|
14946
|
+
} else if (format2 === "duration") {
|
|
14526
14947
|
stringSchema = stringSchema.check(z.iso.duration());
|
|
14527
|
-
} else if (
|
|
14948
|
+
} else if (format2 === "ipv4") {
|
|
14528
14949
|
stringSchema = stringSchema.check(z.ipv4());
|
|
14529
|
-
} else if (
|
|
14950
|
+
} else if (format2 === "ipv6") {
|
|
14530
14951
|
stringSchema = stringSchema.check(z.ipv6());
|
|
14531
|
-
} else if (
|
|
14952
|
+
} else if (format2 === "mac") {
|
|
14532
14953
|
stringSchema = stringSchema.check(z.mac());
|
|
14533
|
-
} else if (
|
|
14954
|
+
} else if (format2 === "cidr") {
|
|
14534
14955
|
stringSchema = stringSchema.check(z.cidrv4());
|
|
14535
|
-
} else if (
|
|
14956
|
+
} else if (format2 === "cidr-v6") {
|
|
14536
14957
|
stringSchema = stringSchema.check(z.cidrv6());
|
|
14537
|
-
} else if (
|
|
14958
|
+
} else if (format2 === "base64") {
|
|
14538
14959
|
stringSchema = stringSchema.check(z.base64());
|
|
14539
|
-
} else if (
|
|
14960
|
+
} else if (format2 === "base64url") {
|
|
14540
14961
|
stringSchema = stringSchema.check(z.base64url());
|
|
14541
|
-
} else if (
|
|
14962
|
+
} else if (format2 === "e164") {
|
|
14542
14963
|
stringSchema = stringSchema.check(z.e164());
|
|
14543
|
-
} else if (
|
|
14964
|
+
} else if (format2 === "jwt") {
|
|
14544
14965
|
stringSchema = stringSchema.check(z.jwt());
|
|
14545
|
-
} else if (
|
|
14966
|
+
} else if (format2 === "emoji") {
|
|
14546
14967
|
stringSchema = stringSchema.check(z.emoji());
|
|
14547
|
-
} else if (
|
|
14968
|
+
} else if (format2 === "nanoid") {
|
|
14548
14969
|
stringSchema = stringSchema.check(z.nanoid());
|
|
14549
|
-
} else if (
|
|
14970
|
+
} else if (format2 === "cuid") {
|
|
14550
14971
|
stringSchema = stringSchema.check(z.cuid());
|
|
14551
|
-
} else if (
|
|
14972
|
+
} else if (format2 === "cuid2") {
|
|
14552
14973
|
stringSchema = stringSchema.check(z.cuid2());
|
|
14553
|
-
} else if (
|
|
14974
|
+
} else if (format2 === "ulid") {
|
|
14554
14975
|
stringSchema = stringSchema.check(z.ulid());
|
|
14555
|
-
} else if (
|
|
14976
|
+
} else if (format2 === "xid") {
|
|
14556
14977
|
stringSchema = stringSchema.check(z.xid());
|
|
14557
|
-
} else if (
|
|
14978
|
+
} else if (format2 === "ksuid") {
|
|
14558
14979
|
stringSchema = stringSchema.check(z.ksuid());
|
|
14559
14980
|
}
|
|
14560
14981
|
}
|
|
@@ -14828,7 +15249,7 @@ var TimebackSubject = exports_external.enum([
|
|
|
14828
15249
|
"Math",
|
|
14829
15250
|
"None",
|
|
14830
15251
|
"Other"
|
|
14831
|
-
]);
|
|
15252
|
+
]).meta({ id: "TimebackSubject", description: "Subject area" });
|
|
14832
15253
|
var TimebackGrade = exports_external.union([
|
|
14833
15254
|
exports_external.literal(-1),
|
|
14834
15255
|
exports_external.literal(0),
|
|
@@ -14845,7 +15266,10 @@ var TimebackGrade = exports_external.union([
|
|
|
14845
15266
|
exports_external.literal(11),
|
|
14846
15267
|
exports_external.literal(12),
|
|
14847
15268
|
exports_external.literal(13)
|
|
14848
|
-
])
|
|
15269
|
+
]).meta({
|
|
15270
|
+
id: "TimebackGrade",
|
|
15271
|
+
description: "Grade level (-1 = Pre-K, 0 = K, 1-12 = grades, 13 = AP)"
|
|
15272
|
+
});
|
|
14849
15273
|
var ScoreStatus = exports_external.enum([
|
|
14850
15274
|
"exempt",
|
|
14851
15275
|
"fully graded",
|
|
@@ -14989,6 +15413,8 @@ var ActivityCompletedInput = exports_external.object({
|
|
|
14989
15413
|
metricsId: exports_external.string().optional(),
|
|
14990
15414
|
id: exports_external.string().optional(),
|
|
14991
15415
|
extensions: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
15416
|
+
edApp: exports_external.union([exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())]).optional(),
|
|
15417
|
+
session: exports_external.union([exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())]).optional(),
|
|
14992
15418
|
attempt: exports_external.number().int().min(1).optional(),
|
|
14993
15419
|
generatedExtensions: exports_external.object({
|
|
14994
15420
|
pctCompleteApp: exports_external.number().optional()
|
|
@@ -15001,7 +15427,9 @@ var TimeSpentInput = exports_external.object({
|
|
|
15001
15427
|
eventTime: IsoDateTimeString.optional(),
|
|
15002
15428
|
metricsId: exports_external.string().optional(),
|
|
15003
15429
|
id: exports_external.string().optional(),
|
|
15004
|
-
extensions: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
15430
|
+
extensions: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
15431
|
+
edApp: exports_external.union([exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())]).optional(),
|
|
15432
|
+
session: exports_external.union([exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())]).optional()
|
|
15005
15433
|
}).strict();
|
|
15006
15434
|
var TimebackEvent = exports_external.union([TimebackActivityEvent, TimebackTimeSpentEvent]);
|
|
15007
15435
|
var CaliperEnvelope = exports_external.object({
|
|
@@ -15075,62 +15503,84 @@ var CaliperListEventsParams = exports_external.object({
|
|
|
15075
15503
|
actorEmail: exports_external.email().optional()
|
|
15076
15504
|
}).strict();
|
|
15077
15505
|
var CourseIds = exports_external.object({
|
|
15078
|
-
staging: exports_external.string().optional(),
|
|
15079
|
-
production: exports_external.string().optional()
|
|
15080
|
-
});
|
|
15081
|
-
var CourseType = exports_external.enum(["base", "hole-filling", "optional"]);
|
|
15082
|
-
var PublishStatus = exports_external.enum(["draft", "testing", "published", "deactivated"]);
|
|
15506
|
+
staging: exports_external.string().meta({ description: "Course ID in staging environment" }).optional(),
|
|
15507
|
+
production: exports_external.string().meta({ description: "Course ID in production environment" }).optional()
|
|
15508
|
+
}).meta({ id: "CourseIds", description: "Environment-specific course IDs (populated by sync)" });
|
|
15509
|
+
var CourseType = exports_external.enum(["base", "hole-filling", "optional"]).meta({ id: "CourseType", description: "Course classification type" });
|
|
15510
|
+
var PublishStatus = exports_external.enum(["draft", "testing", "published", "deactivated"]).meta({ id: "PublishStatus", description: "Course publication status" });
|
|
15083
15511
|
var CourseGoals = exports_external.object({
|
|
15084
|
-
dailyXp: exports_external.number().int().positive().optional(),
|
|
15085
|
-
dailyLessons: exports_external.number().int().positive().optional(),
|
|
15086
|
-
dailyActiveMinutes: exports_external.number().int().positive().optional(),
|
|
15087
|
-
dailyAccuracy: exports_external.number().int().min(0).max(100).optional(),
|
|
15088
|
-
dailyMasteredUnits: exports_external.number().int().positive().optional()
|
|
15089
|
-
});
|
|
15512
|
+
dailyXp: exports_external.number().int().positive().meta({ description: "Target XP to earn per day" }).optional(),
|
|
15513
|
+
dailyLessons: exports_external.number().int().positive().meta({ description: "Target lessons to complete per day" }).optional(),
|
|
15514
|
+
dailyActiveMinutes: exports_external.number().int().positive().meta({ description: "Target active learning minutes per day" }).optional(),
|
|
15515
|
+
dailyAccuracy: exports_external.number().int().min(0).max(100).meta({ description: "Target accuracy percentage (0-100)" }).optional(),
|
|
15516
|
+
dailyMasteredUnits: exports_external.number().int().positive().meta({ description: "Target units to master per day" }).optional()
|
|
15517
|
+
}).meta({ id: "CourseGoals", description: "Daily learning goals for a course" });
|
|
15090
15518
|
var CourseMetrics = exports_external.object({
|
|
15091
|
-
totalXp: exports_external.number().int().positive().optional(),
|
|
15092
|
-
totalLessons: exports_external.number().int().positive().optional(),
|
|
15093
|
-
totalGrades: exports_external.number().int().positive().optional()
|
|
15094
|
-
});
|
|
15519
|
+
totalXp: exports_external.number().int().positive().meta({ description: "Total XP available in the course" }).optional(),
|
|
15520
|
+
totalLessons: exports_external.number().int().positive().meta({ description: "Total number of lessons/activities" }).optional(),
|
|
15521
|
+
totalGrades: exports_external.number().int().positive().meta({ description: "Total grade levels covered" }).optional()
|
|
15522
|
+
}).meta({ id: "CourseMetrics", description: "Aggregate metrics for a course" });
|
|
15095
15523
|
var CourseMetadata = exports_external.object({
|
|
15096
15524
|
courseType: CourseType.optional(),
|
|
15097
|
-
isSupplemental: exports_external.boolean().optional(),
|
|
15098
|
-
isCustom: exports_external.boolean().optional(),
|
|
15525
|
+
isSupplemental: exports_external.boolean().meta({ description: "Whether this is supplemental to a base course" }).optional(),
|
|
15526
|
+
isCustom: exports_external.boolean().meta({ description: "Whether this is a custom course for an individual student" }).optional(),
|
|
15099
15527
|
publishStatus: PublishStatus.optional(),
|
|
15100
|
-
contactEmail: exports_external.email().optional(),
|
|
15101
|
-
primaryApp: exports_external.string().optional(),
|
|
15528
|
+
contactEmail: exports_external.email().meta({ description: "Contact email for course issues" }).optional(),
|
|
15529
|
+
primaryApp: exports_external.string().meta({ description: "Primary application identifier" }).optional(),
|
|
15102
15530
|
goals: CourseGoals.optional(),
|
|
15103
15531
|
metrics: CourseMetrics.optional()
|
|
15104
|
-
});
|
|
15532
|
+
}).meta({ id: "CourseMetadata", description: "Course metadata (matches API metadata object)" });
|
|
15105
15533
|
var CourseDefaults = exports_external.object({
|
|
15106
|
-
courseCode: exports_external.string().optional(),
|
|
15107
|
-
level: exports_external.string().optional(),
|
|
15534
|
+
courseCode: exports_external.string().meta({ description: "Course code (e.g., 'MATH101')" }).optional(),
|
|
15535
|
+
level: exports_external.string().meta({ description: "Course level (e.g., 'AP', 'Honors')" }).optional(),
|
|
15108
15536
|
metadata: CourseMetadata.optional()
|
|
15537
|
+
}).meta({
|
|
15538
|
+
id: "CourseDefaults",
|
|
15539
|
+
description: "Default properties that apply to all courses unless overridden"
|
|
15109
15540
|
});
|
|
15110
15541
|
var CourseEnvOverrides = exports_external.object({
|
|
15111
|
-
level: exports_external.string().optional(),
|
|
15112
|
-
sensor: exports_external.
|
|
15113
|
-
launchUrl: exports_external.
|
|
15542
|
+
level: exports_external.string().meta({ description: "Course level for this environment" }).optional(),
|
|
15543
|
+
sensor: exports_external.url().meta({ description: "Caliper sensor endpoint URL for this environment" }).optional(),
|
|
15544
|
+
launchUrl: exports_external.url().meta({ description: "LTI launch URL for this environment" }).optional(),
|
|
15114
15545
|
metadata: CourseMetadata.optional()
|
|
15546
|
+
}).meta({
|
|
15547
|
+
id: "CourseEnvOverrides",
|
|
15548
|
+
description: "Environment-specific course overrides (non-identity fields)"
|
|
15115
15549
|
});
|
|
15116
15550
|
var CourseOverrides = exports_external.object({
|
|
15117
|
-
staging: CourseEnvOverrides.
|
|
15118
|
-
|
|
15119
|
-
})
|
|
15551
|
+
staging: CourseEnvOverrides.meta({
|
|
15552
|
+
description: "Overrides for staging environment"
|
|
15553
|
+
}).optional(),
|
|
15554
|
+
production: CourseEnvOverrides.meta({
|
|
15555
|
+
description: "Overrides for production environment"
|
|
15556
|
+
}).optional()
|
|
15557
|
+
}).meta({ id: "CourseOverrides", description: "Per-environment course overrides" });
|
|
15120
15558
|
var CourseConfig = CourseDefaults.extend({
|
|
15121
|
-
subject: TimebackSubject,
|
|
15122
|
-
grade: TimebackGrade.
|
|
15559
|
+
subject: TimebackSubject.meta({ description: "Subject area for this course" }),
|
|
15560
|
+
grade: TimebackGrade.meta({
|
|
15561
|
+
description: "Grade level (-1 = Pre-K, 0 = K, 1-12 = grades, 13 = AP)"
|
|
15562
|
+
}).optional(),
|
|
15123
15563
|
ids: CourseIds.nullable().optional(),
|
|
15124
|
-
sensor: exports_external.
|
|
15125
|
-
launchUrl: exports_external.
|
|
15564
|
+
sensor: exports_external.url().meta({ description: "Caliper sensor endpoint URL for this course" }).optional(),
|
|
15565
|
+
launchUrl: exports_external.url().meta({ description: "LTI launch URL for this course" }).optional(),
|
|
15126
15566
|
overrides: CourseOverrides.optional()
|
|
15567
|
+
}).meta({
|
|
15568
|
+
id: "CourseConfig",
|
|
15569
|
+
description: "Configuration for a single course. Must have either grade or courseCode (or both)."
|
|
15127
15570
|
});
|
|
15128
15571
|
var TimebackConfig = exports_external.object({
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15572
|
+
$schema: exports_external.string().meta({ description: "JSON Schema reference for editor support" }).optional(),
|
|
15573
|
+
name: exports_external.string().min(1, "App name is required").meta({ description: "Display name for your app" }),
|
|
15574
|
+
defaults: CourseDefaults.meta({
|
|
15575
|
+
description: "Default properties applied to all courses"
|
|
15576
|
+
}).optional(),
|
|
15577
|
+
courses: exports_external.array(CourseConfig).min(1, "At least one course is required").meta({ description: "Courses available in this app" }),
|
|
15578
|
+
sensor: exports_external.url().meta({ description: "Default Caliper sensor endpoint URL for all courses" }).optional(),
|
|
15579
|
+
launchUrl: exports_external.url().meta({ description: "Default LTI launch URL for all courses" }).optional()
|
|
15580
|
+
}).meta({
|
|
15581
|
+
id: "TimebackConfig",
|
|
15582
|
+
title: "Timeback Config",
|
|
15583
|
+
description: "Configuration schema for timeback.config.json files"
|
|
15134
15584
|
}).refine((config2) => {
|
|
15135
15585
|
return config2.courses.every((c) => c.grade !== undefined || c.courseCode !== undefined);
|
|
15136
15586
|
}, {
|
|
@@ -15151,17 +15601,23 @@ var TimebackConfig = exports_external.object({
|
|
|
15151
15601
|
message: "Duplicate courseCode found; each must be unique",
|
|
15152
15602
|
path: ["courses"]
|
|
15153
15603
|
}).refine((config2) => {
|
|
15154
|
-
return config2.courses.every((c) =>
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15604
|
+
return config2.courses.every((c) => {
|
|
15605
|
+
if (c.sensor !== undefined || config2.sensor !== undefined) {
|
|
15606
|
+
return true;
|
|
15607
|
+
}
|
|
15608
|
+
const launchUrls = [
|
|
15609
|
+
c.launchUrl,
|
|
15610
|
+
config2.launchUrl,
|
|
15611
|
+
c.overrides?.staging?.launchUrl,
|
|
15612
|
+
c.overrides?.production?.launchUrl
|
|
15613
|
+
].filter(Boolean);
|
|
15614
|
+
return launchUrls.length > 0;
|
|
15615
|
+
});
|
|
15160
15616
|
}, {
|
|
15161
|
-
message: "Each course must have an effective
|
|
15617
|
+
message: "Each course must have an effective sensor. Either set `sensor` explicitly (top-level or per-course), or provide a `launchUrl` so sensor can be derived from its origin.",
|
|
15162
15618
|
path: ["courses"]
|
|
15163
15619
|
});
|
|
15164
|
-
var EdubridgeDateString = exports_external.union([
|
|
15620
|
+
var EdubridgeDateString = exports_external.union([IsoDateTimeString, IsoDateString]);
|
|
15165
15621
|
var EduBridgeEnrollment = exports_external.object({
|
|
15166
15622
|
id: exports_external.string(),
|
|
15167
15623
|
role: exports_external.string(),
|
|
@@ -15225,13 +15681,11 @@ var EmailOrStudentId = exports_external.object({
|
|
|
15225
15681
|
});
|
|
15226
15682
|
var SubjectTrackInput = exports_external.object({
|
|
15227
15683
|
subject: NonEmptyString,
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
});
|
|
15232
|
-
var SubjectTrackUpsertInput = SubjectTrackInput.extend({
|
|
15233
|
-
id: NonEmptyString
|
|
15684
|
+
grade: NonEmptyString,
|
|
15685
|
+
courseId: NonEmptyString,
|
|
15686
|
+
orgSourcedId: NonEmptyString.optional()
|
|
15234
15687
|
});
|
|
15688
|
+
var SubjectTrackUpsertInput = SubjectTrackInput;
|
|
15235
15689
|
var EdubridgeListEnrollmentsParams = exports_external.object({
|
|
15236
15690
|
userId: NonEmptyString
|
|
15237
15691
|
});
|
|
@@ -16361,7 +16815,7 @@ function createEdubridgeClient(registry2 = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
16361
16815
|
const resolved = resolveToProvider2(config3, registry2);
|
|
16362
16816
|
if (resolved.mode === "transport") {
|
|
16363
16817
|
this.transport = resolved.transport;
|
|
16364
|
-
|
|
16818
|
+
log3.info("Client initialized with custom transport");
|
|
16365
16819
|
} else {
|
|
16366
16820
|
const { provider } = resolved;
|
|
16367
16821
|
const { baseUrl, paths } = provider.getEndpointWithPaths("edubridge");
|
|
@@ -16376,7 +16830,7 @@ function createEdubridgeClient(registry2 = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
16376
16830
|
timeout: provider.timeout,
|
|
16377
16831
|
paths
|
|
16378
16832
|
});
|
|
16379
|
-
|
|
16833
|
+
log3.info("Client initialized", {
|
|
16380
16834
|
platform: provider.platform,
|
|
16381
16835
|
env: provider.env,
|
|
16382
16836
|
baseUrl
|