@learncard/network-plugin 2.1.7 → 2.1.8
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/lcn-plugin.cjs.development.js +850 -5
- package/dist/lcn-plugin.cjs.development.js.map +4 -4
- package/dist/lcn-plugin.cjs.production.min.js +2 -2
- package/dist/lcn-plugin.cjs.production.min.js.map +4 -4
- package/dist/lcn-plugin.esm.js +850 -5
- package/dist/lcn-plugin.esm.js.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -1,6 +1,808 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/double-indexed-kv.js
|
|
5
|
+
var DoubleIndexedKV = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.keyToValue = /* @__PURE__ */ new Map();
|
|
8
|
+
this.valueToKey = /* @__PURE__ */ new Map();
|
|
9
|
+
}
|
|
10
|
+
set(key, value) {
|
|
11
|
+
this.keyToValue.set(key, value);
|
|
12
|
+
this.valueToKey.set(value, key);
|
|
13
|
+
}
|
|
14
|
+
getByKey(key) {
|
|
15
|
+
return this.keyToValue.get(key);
|
|
16
|
+
}
|
|
17
|
+
getByValue(value) {
|
|
18
|
+
return this.valueToKey.get(value);
|
|
19
|
+
}
|
|
20
|
+
clear() {
|
|
21
|
+
this.keyToValue.clear();
|
|
22
|
+
this.valueToKey.clear();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
__name(DoubleIndexedKV, "DoubleIndexedKV");
|
|
26
|
+
|
|
27
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/registry.js
|
|
28
|
+
var Registry = class {
|
|
29
|
+
constructor(generateIdentifier) {
|
|
30
|
+
this.generateIdentifier = generateIdentifier;
|
|
31
|
+
this.kv = new DoubleIndexedKV();
|
|
32
|
+
}
|
|
33
|
+
register(value, identifier) {
|
|
34
|
+
if (this.kv.getByValue(value)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!identifier) {
|
|
38
|
+
identifier = this.generateIdentifier(value);
|
|
39
|
+
}
|
|
40
|
+
this.kv.set(identifier, value);
|
|
41
|
+
}
|
|
42
|
+
clear() {
|
|
43
|
+
this.kv.clear();
|
|
44
|
+
}
|
|
45
|
+
getIdentifier(value) {
|
|
46
|
+
return this.kv.getByValue(value);
|
|
47
|
+
}
|
|
48
|
+
getValue(identifier) {
|
|
49
|
+
return this.kv.getByKey(identifier);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
__name(Registry, "Registry");
|
|
53
|
+
|
|
54
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/class-registry.js
|
|
55
|
+
var ClassRegistry = class extends Registry {
|
|
56
|
+
constructor() {
|
|
57
|
+
super((c) => c.name);
|
|
58
|
+
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
59
|
+
}
|
|
60
|
+
register(value, options) {
|
|
61
|
+
if (typeof options === "object") {
|
|
62
|
+
if (options.allowProps) {
|
|
63
|
+
this.classToAllowedProps.set(value, options.allowProps);
|
|
64
|
+
}
|
|
65
|
+
super.register(value, options.identifier);
|
|
66
|
+
} else {
|
|
67
|
+
super.register(value, options);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
getAllowedProps(value) {
|
|
71
|
+
return this.classToAllowedProps.get(value);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
__name(ClassRegistry, "ClassRegistry");
|
|
75
|
+
|
|
76
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/util.js
|
|
77
|
+
function valuesOfObj(record) {
|
|
78
|
+
if ("values" in Object) {
|
|
79
|
+
return Object.values(record);
|
|
80
|
+
}
|
|
81
|
+
const values = [];
|
|
82
|
+
for (const key in record) {
|
|
83
|
+
if (record.hasOwnProperty(key)) {
|
|
84
|
+
values.push(record[key]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return values;
|
|
88
|
+
}
|
|
89
|
+
__name(valuesOfObj, "valuesOfObj");
|
|
90
|
+
function find(record, predicate) {
|
|
91
|
+
const values = valuesOfObj(record);
|
|
92
|
+
if ("find" in values) {
|
|
93
|
+
return values.find(predicate);
|
|
94
|
+
}
|
|
95
|
+
const valuesNotNever = values;
|
|
96
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
97
|
+
const value = valuesNotNever[i];
|
|
98
|
+
if (predicate(value)) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
__name(find, "find");
|
|
105
|
+
function forEach(record, run) {
|
|
106
|
+
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
107
|
+
}
|
|
108
|
+
__name(forEach, "forEach");
|
|
109
|
+
function includes(arr, value) {
|
|
110
|
+
return arr.indexOf(value) !== -1;
|
|
111
|
+
}
|
|
112
|
+
__name(includes, "includes");
|
|
113
|
+
function findArr(record, predicate) {
|
|
114
|
+
for (let i = 0; i < record.length; i++) {
|
|
115
|
+
const value = record[i];
|
|
116
|
+
if (predicate(value)) {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
__name(findArr, "findArr");
|
|
123
|
+
|
|
124
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/custom-transformer-registry.js
|
|
125
|
+
var CustomTransformerRegistry = class {
|
|
126
|
+
constructor() {
|
|
127
|
+
this.transfomers = {};
|
|
128
|
+
}
|
|
129
|
+
register(transformer) {
|
|
130
|
+
this.transfomers[transformer.name] = transformer;
|
|
131
|
+
}
|
|
132
|
+
findApplicable(v) {
|
|
133
|
+
return find(this.transfomers, (transformer) => transformer.isApplicable(v));
|
|
134
|
+
}
|
|
135
|
+
findByName(name) {
|
|
136
|
+
return this.transfomers[name];
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__name(CustomTransformerRegistry, "CustomTransformerRegistry");
|
|
140
|
+
|
|
141
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/is.js
|
|
142
|
+
var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
|
|
143
|
+
var isUndefined = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
|
|
144
|
+
var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
|
|
145
|
+
var isPlainObject = /* @__PURE__ */ __name((payload) => {
|
|
146
|
+
if (typeof payload !== "object" || payload === null)
|
|
147
|
+
return false;
|
|
148
|
+
if (payload === Object.prototype)
|
|
149
|
+
return false;
|
|
150
|
+
if (Object.getPrototypeOf(payload) === null)
|
|
151
|
+
return true;
|
|
152
|
+
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
153
|
+
}, "isPlainObject");
|
|
154
|
+
var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject(payload) && Object.keys(payload).length === 0, "isEmptyObject");
|
|
155
|
+
var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
|
|
156
|
+
var isString = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
|
|
157
|
+
var isNumber = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
|
|
158
|
+
var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
|
|
159
|
+
var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
|
|
160
|
+
var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
|
|
161
|
+
var isSet = /* @__PURE__ */ __name((payload) => payload instanceof Set, "isSet");
|
|
162
|
+
var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol", "isSymbol");
|
|
163
|
+
var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
|
|
164
|
+
var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
|
|
165
|
+
var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
|
|
166
|
+
var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload), "isPrimitive");
|
|
167
|
+
var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
|
|
168
|
+
var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
|
|
169
|
+
var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
|
|
170
|
+
var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL");
|
|
171
|
+
|
|
172
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/pathstringifier.js
|
|
173
|
+
var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
|
|
174
|
+
var stringifyPath = /* @__PURE__ */ __name((path) => path.map(String).map(escapeKey).join("."), "stringifyPath");
|
|
175
|
+
var parsePath = /* @__PURE__ */ __name((string) => {
|
|
176
|
+
const result = [];
|
|
177
|
+
let segment = "";
|
|
178
|
+
for (let i = 0; i < string.length; i++) {
|
|
179
|
+
let char = string.charAt(i);
|
|
180
|
+
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
181
|
+
if (isEscapedDot) {
|
|
182
|
+
segment += ".";
|
|
183
|
+
i++;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const isEndOfSegment = char === ".";
|
|
187
|
+
if (isEndOfSegment) {
|
|
188
|
+
result.push(segment);
|
|
189
|
+
segment = "";
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
segment += char;
|
|
193
|
+
}
|
|
194
|
+
const lastSegment = segment;
|
|
195
|
+
result.push(lastSegment);
|
|
196
|
+
return result;
|
|
197
|
+
}, "parsePath");
|
|
198
|
+
|
|
199
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/transformer.js
|
|
200
|
+
function simpleTransformation(isApplicable, annotation, transform, untransform) {
|
|
201
|
+
return {
|
|
202
|
+
isApplicable,
|
|
203
|
+
annotation,
|
|
204
|
+
transform,
|
|
205
|
+
untransform
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
__name(simpleTransformation, "simpleTransformation");
|
|
209
|
+
var simpleRules = [
|
|
210
|
+
simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
|
|
211
|
+
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
212
|
+
if (typeof BigInt !== "undefined") {
|
|
213
|
+
return BigInt(v);
|
|
214
|
+
}
|
|
215
|
+
console.error("Please add a BigInt polyfill.");
|
|
216
|
+
return v;
|
|
217
|
+
}),
|
|
218
|
+
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
219
|
+
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
220
|
+
const baseError = {
|
|
221
|
+
name: v.name,
|
|
222
|
+
message: v.message
|
|
223
|
+
};
|
|
224
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
225
|
+
baseError[prop] = v[prop];
|
|
226
|
+
});
|
|
227
|
+
return baseError;
|
|
228
|
+
}, (v, superJson) => {
|
|
229
|
+
const e = new Error(v.message);
|
|
230
|
+
e.name = v.name;
|
|
231
|
+
e.stack = v.stack;
|
|
232
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
233
|
+
e[prop] = v[prop];
|
|
234
|
+
});
|
|
235
|
+
return e;
|
|
236
|
+
}),
|
|
237
|
+
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
238
|
+
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
239
|
+
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
240
|
+
return new RegExp(body, flags);
|
|
241
|
+
}),
|
|
242
|
+
simpleTransformation(
|
|
243
|
+
isSet,
|
|
244
|
+
"set",
|
|
245
|
+
(v) => [...v.values()],
|
|
246
|
+
(v) => new Set(v)
|
|
247
|
+
),
|
|
248
|
+
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
249
|
+
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
250
|
+
if (isNaNValue(v)) {
|
|
251
|
+
return "NaN";
|
|
252
|
+
}
|
|
253
|
+
if (v > 0) {
|
|
254
|
+
return "Infinity";
|
|
255
|
+
} else {
|
|
256
|
+
return "-Infinity";
|
|
257
|
+
}
|
|
258
|
+
}, Number),
|
|
259
|
+
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
260
|
+
return "-0";
|
|
261
|
+
}, Number),
|
|
262
|
+
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
263
|
+
];
|
|
264
|
+
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
265
|
+
return {
|
|
266
|
+
isApplicable,
|
|
267
|
+
annotation,
|
|
268
|
+
transform,
|
|
269
|
+
untransform
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
__name(compositeTransformation, "compositeTransformation");
|
|
273
|
+
var symbolRule = compositeTransformation((s, superJson) => {
|
|
274
|
+
if (isSymbol(s)) {
|
|
275
|
+
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
276
|
+
return isRegistered;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}, (s, superJson) => {
|
|
280
|
+
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
281
|
+
return ["symbol", identifier];
|
|
282
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
283
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
284
|
+
if (!value) {
|
|
285
|
+
throw new Error("Trying to deserialize unknown symbol");
|
|
286
|
+
}
|
|
287
|
+
return value;
|
|
288
|
+
});
|
|
289
|
+
var constructorToName = [
|
|
290
|
+
Int8Array,
|
|
291
|
+
Uint8Array,
|
|
292
|
+
Int16Array,
|
|
293
|
+
Uint16Array,
|
|
294
|
+
Int32Array,
|
|
295
|
+
Uint32Array,
|
|
296
|
+
Float32Array,
|
|
297
|
+
Float64Array,
|
|
298
|
+
Uint8ClampedArray
|
|
299
|
+
].reduce((obj, ctor) => {
|
|
300
|
+
obj[ctor.name] = ctor;
|
|
301
|
+
return obj;
|
|
302
|
+
}, {});
|
|
303
|
+
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
304
|
+
const ctor = constructorToName[a[1]];
|
|
305
|
+
if (!ctor) {
|
|
306
|
+
throw new Error("Trying to deserialize unknown typed array");
|
|
307
|
+
}
|
|
308
|
+
return new ctor(v);
|
|
309
|
+
});
|
|
310
|
+
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
311
|
+
if (potentialClass?.constructor) {
|
|
312
|
+
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
313
|
+
return isRegistered;
|
|
314
|
+
}
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
__name(isInstanceOfRegisteredClass, "isInstanceOfRegisteredClass");
|
|
318
|
+
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
319
|
+
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
320
|
+
return ["class", identifier];
|
|
321
|
+
}, (clazz, superJson) => {
|
|
322
|
+
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
323
|
+
if (!allowedProps) {
|
|
324
|
+
return { ...clazz };
|
|
325
|
+
}
|
|
326
|
+
const result = {};
|
|
327
|
+
allowedProps.forEach((prop) => {
|
|
328
|
+
result[prop] = clazz[prop];
|
|
329
|
+
});
|
|
330
|
+
return result;
|
|
331
|
+
}, (v, a, superJson) => {
|
|
332
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
333
|
+
if (!clazz) {
|
|
334
|
+
throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");
|
|
335
|
+
}
|
|
336
|
+
return Object.assign(Object.create(clazz.prototype), v);
|
|
337
|
+
});
|
|
338
|
+
var customRule = compositeTransformation((value, superJson) => {
|
|
339
|
+
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
340
|
+
}, (value, superJson) => {
|
|
341
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
342
|
+
return ["custom", transformer.name];
|
|
343
|
+
}, (value, superJson) => {
|
|
344
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
345
|
+
return transformer.serialize(value);
|
|
346
|
+
}, (v, a, superJson) => {
|
|
347
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
348
|
+
if (!transformer) {
|
|
349
|
+
throw new Error("Trying to deserialize unknown custom value");
|
|
350
|
+
}
|
|
351
|
+
return transformer.deserialize(v);
|
|
352
|
+
});
|
|
353
|
+
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
354
|
+
var transformValue = /* @__PURE__ */ __name((value, superJson) => {
|
|
355
|
+
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
356
|
+
if (applicableCompositeRule) {
|
|
357
|
+
return {
|
|
358
|
+
value: applicableCompositeRule.transform(value, superJson),
|
|
359
|
+
type: applicableCompositeRule.annotation(value, superJson)
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
|
|
363
|
+
if (applicableSimpleRule) {
|
|
364
|
+
return {
|
|
365
|
+
value: applicableSimpleRule.transform(value, superJson),
|
|
366
|
+
type: applicableSimpleRule.annotation
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
return void 0;
|
|
370
|
+
}, "transformValue");
|
|
371
|
+
var simpleRulesByAnnotation = {};
|
|
372
|
+
simpleRules.forEach((rule) => {
|
|
373
|
+
simpleRulesByAnnotation[rule.annotation] = rule;
|
|
374
|
+
});
|
|
375
|
+
var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
|
|
376
|
+
if (isArray(type)) {
|
|
377
|
+
switch (type[0]) {
|
|
378
|
+
case "symbol":
|
|
379
|
+
return symbolRule.untransform(json, type, superJson);
|
|
380
|
+
case "class":
|
|
381
|
+
return classRule.untransform(json, type, superJson);
|
|
382
|
+
case "custom":
|
|
383
|
+
return customRule.untransform(json, type, superJson);
|
|
384
|
+
case "typed-array":
|
|
385
|
+
return typedArrayRule.untransform(json, type, superJson);
|
|
386
|
+
default:
|
|
387
|
+
throw new Error("Unknown transformation: " + type);
|
|
388
|
+
}
|
|
389
|
+
} else {
|
|
390
|
+
const transformation = simpleRulesByAnnotation[type];
|
|
391
|
+
if (!transformation) {
|
|
392
|
+
throw new Error("Unknown transformation: " + type);
|
|
393
|
+
}
|
|
394
|
+
return transformation.untransform(json, superJson);
|
|
395
|
+
}
|
|
396
|
+
}, "untransformValue");
|
|
397
|
+
|
|
398
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/accessDeep.js
|
|
399
|
+
var getNthKey = /* @__PURE__ */ __name((value, n) => {
|
|
400
|
+
const keys = value.keys();
|
|
401
|
+
while (n > 0) {
|
|
402
|
+
keys.next();
|
|
403
|
+
n--;
|
|
404
|
+
}
|
|
405
|
+
return keys.next().value;
|
|
406
|
+
}, "getNthKey");
|
|
407
|
+
function validatePath(path) {
|
|
408
|
+
if (includes(path, "__proto__")) {
|
|
409
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
410
|
+
}
|
|
411
|
+
if (includes(path, "prototype")) {
|
|
412
|
+
throw new Error("prototype is not allowed as a property");
|
|
413
|
+
}
|
|
414
|
+
if (includes(path, "constructor")) {
|
|
415
|
+
throw new Error("constructor is not allowed as a property");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
__name(validatePath, "validatePath");
|
|
419
|
+
var getDeep = /* @__PURE__ */ __name((object, path) => {
|
|
420
|
+
validatePath(path);
|
|
421
|
+
for (let i = 0; i < path.length; i++) {
|
|
422
|
+
const key = path[i];
|
|
423
|
+
if (isSet(object)) {
|
|
424
|
+
object = getNthKey(object, +key);
|
|
425
|
+
} else if (isMap(object)) {
|
|
426
|
+
const row = +key;
|
|
427
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
428
|
+
const keyOfRow = getNthKey(object, row);
|
|
429
|
+
switch (type) {
|
|
430
|
+
case "key":
|
|
431
|
+
object = keyOfRow;
|
|
432
|
+
break;
|
|
433
|
+
case "value":
|
|
434
|
+
object = object.get(keyOfRow);
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
object = object[key];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return object;
|
|
442
|
+
}, "getDeep");
|
|
443
|
+
var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
|
|
444
|
+
validatePath(path);
|
|
445
|
+
if (path.length === 0) {
|
|
446
|
+
return mapper(object);
|
|
447
|
+
}
|
|
448
|
+
let parent = object;
|
|
449
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
450
|
+
const key = path[i];
|
|
451
|
+
if (isArray(parent)) {
|
|
452
|
+
const index = +key;
|
|
453
|
+
parent = parent[index];
|
|
454
|
+
} else if (isPlainObject(parent)) {
|
|
455
|
+
parent = parent[key];
|
|
456
|
+
} else if (isSet(parent)) {
|
|
457
|
+
const row = +key;
|
|
458
|
+
parent = getNthKey(parent, row);
|
|
459
|
+
} else if (isMap(parent)) {
|
|
460
|
+
const isEnd = i === path.length - 2;
|
|
461
|
+
if (isEnd) {
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
const row = +key;
|
|
465
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
466
|
+
const keyOfRow = getNthKey(parent, row);
|
|
467
|
+
switch (type) {
|
|
468
|
+
case "key":
|
|
469
|
+
parent = keyOfRow;
|
|
470
|
+
break;
|
|
471
|
+
case "value":
|
|
472
|
+
parent = parent.get(keyOfRow);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const lastKey = path[path.length - 1];
|
|
478
|
+
if (isArray(parent)) {
|
|
479
|
+
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
480
|
+
} else if (isPlainObject(parent)) {
|
|
481
|
+
parent[lastKey] = mapper(parent[lastKey]);
|
|
482
|
+
}
|
|
483
|
+
if (isSet(parent)) {
|
|
484
|
+
const oldValue = getNthKey(parent, +lastKey);
|
|
485
|
+
const newValue = mapper(oldValue);
|
|
486
|
+
if (oldValue !== newValue) {
|
|
487
|
+
parent.delete(oldValue);
|
|
488
|
+
parent.add(newValue);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (isMap(parent)) {
|
|
492
|
+
const row = +path[path.length - 2];
|
|
493
|
+
const keyToRow = getNthKey(parent, row);
|
|
494
|
+
const type = +lastKey === 0 ? "key" : "value";
|
|
495
|
+
switch (type) {
|
|
496
|
+
case "key": {
|
|
497
|
+
const newKey = mapper(keyToRow);
|
|
498
|
+
parent.set(newKey, parent.get(keyToRow));
|
|
499
|
+
if (newKey !== keyToRow) {
|
|
500
|
+
parent.delete(keyToRow);
|
|
501
|
+
}
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
case "value": {
|
|
505
|
+
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return object;
|
|
511
|
+
}, "setDeep");
|
|
512
|
+
|
|
513
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/plainer.js
|
|
514
|
+
function traverse(tree, walker2, origin = []) {
|
|
515
|
+
if (!tree) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
if (!isArray(tree)) {
|
|
519
|
+
forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
const [nodeValue, children] = tree;
|
|
523
|
+
if (children) {
|
|
524
|
+
forEach(children, (child, key) => {
|
|
525
|
+
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
walker2(nodeValue, origin);
|
|
529
|
+
}
|
|
530
|
+
__name(traverse, "traverse");
|
|
531
|
+
function applyValueAnnotations(plain, annotations, superJson) {
|
|
532
|
+
traverse(annotations, (type, path) => {
|
|
533
|
+
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
534
|
+
});
|
|
535
|
+
return plain;
|
|
536
|
+
}
|
|
537
|
+
__name(applyValueAnnotations, "applyValueAnnotations");
|
|
538
|
+
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
539
|
+
function apply(identicalPaths, path) {
|
|
540
|
+
const object = getDeep(plain, parsePath(path));
|
|
541
|
+
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
542
|
+
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
__name(apply, "apply");
|
|
546
|
+
if (isArray(annotations)) {
|
|
547
|
+
const [root, other] = annotations;
|
|
548
|
+
root.forEach((identicalPath) => {
|
|
549
|
+
plain = setDeep(plain, parsePath(identicalPath), () => plain);
|
|
550
|
+
});
|
|
551
|
+
if (other) {
|
|
552
|
+
forEach(other, apply);
|
|
553
|
+
}
|
|
554
|
+
} else {
|
|
555
|
+
forEach(annotations, apply);
|
|
556
|
+
}
|
|
557
|
+
return plain;
|
|
558
|
+
}
|
|
559
|
+
__name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
|
|
560
|
+
var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
|
|
561
|
+
function addIdentity(object, path, identities) {
|
|
562
|
+
const existingSet = identities.get(object);
|
|
563
|
+
if (existingSet) {
|
|
564
|
+
existingSet.push(path);
|
|
565
|
+
} else {
|
|
566
|
+
identities.set(object, [path]);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
__name(addIdentity, "addIdentity");
|
|
570
|
+
function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
571
|
+
const result = {};
|
|
572
|
+
let rootEqualityPaths = void 0;
|
|
573
|
+
identitites.forEach((paths) => {
|
|
574
|
+
if (paths.length <= 1) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (!dedupe) {
|
|
578
|
+
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
579
|
+
}
|
|
580
|
+
const [representativePath, ...identicalPaths] = paths;
|
|
581
|
+
if (representativePath.length === 0) {
|
|
582
|
+
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
583
|
+
} else {
|
|
584
|
+
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
if (rootEqualityPaths) {
|
|
588
|
+
if (isEmptyObject(result)) {
|
|
589
|
+
return [rootEqualityPaths];
|
|
590
|
+
} else {
|
|
591
|
+
return [rootEqualityPaths, result];
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
return isEmptyObject(result) ? void 0 : result;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
__name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
|
|
598
|
+
var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
|
|
599
|
+
const primitive = isPrimitive(object);
|
|
600
|
+
if (!primitive) {
|
|
601
|
+
addIdentity(object, path, identities);
|
|
602
|
+
const seen = seenObjects.get(object);
|
|
603
|
+
if (seen) {
|
|
604
|
+
return dedupe ? {
|
|
605
|
+
transformedValue: null
|
|
606
|
+
} : seen;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (!isDeep(object, superJson)) {
|
|
610
|
+
const transformed2 = transformValue(object, superJson);
|
|
611
|
+
const result2 = transformed2 ? {
|
|
612
|
+
transformedValue: transformed2.value,
|
|
613
|
+
annotations: [transformed2.type]
|
|
614
|
+
} : {
|
|
615
|
+
transformedValue: object
|
|
616
|
+
};
|
|
617
|
+
if (!primitive) {
|
|
618
|
+
seenObjects.set(object, result2);
|
|
619
|
+
}
|
|
620
|
+
return result2;
|
|
621
|
+
}
|
|
622
|
+
if (includes(objectsInThisPath, object)) {
|
|
623
|
+
return {
|
|
624
|
+
transformedValue: null
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
const transformationResult = transformValue(object, superJson);
|
|
628
|
+
const transformed = transformationResult?.value ?? object;
|
|
629
|
+
const transformedValue = isArray(transformed) ? [] : {};
|
|
630
|
+
const innerAnnotations = {};
|
|
631
|
+
forEach(transformed, (value, index) => {
|
|
632
|
+
if (index === "__proto__" || index === "constructor" || index === "prototype") {
|
|
633
|
+
throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
634
|
+
}
|
|
635
|
+
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
636
|
+
transformedValue[index] = recursiveResult.transformedValue;
|
|
637
|
+
if (isArray(recursiveResult.annotations)) {
|
|
638
|
+
innerAnnotations[index] = recursiveResult.annotations;
|
|
639
|
+
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
640
|
+
forEach(recursiveResult.annotations, (tree, key) => {
|
|
641
|
+
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
const result = isEmptyObject(innerAnnotations) ? {
|
|
646
|
+
transformedValue,
|
|
647
|
+
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
648
|
+
} : {
|
|
649
|
+
transformedValue,
|
|
650
|
+
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
651
|
+
};
|
|
652
|
+
if (!primitive) {
|
|
653
|
+
seenObjects.set(object, result);
|
|
654
|
+
}
|
|
655
|
+
return result;
|
|
656
|
+
}, "walker");
|
|
657
|
+
|
|
658
|
+
// ../../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
659
|
+
function getType2(payload) {
|
|
660
|
+
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
661
|
+
}
|
|
662
|
+
__name(getType2, "getType");
|
|
663
|
+
function isArray2(payload) {
|
|
664
|
+
return getType2(payload) === "Array";
|
|
665
|
+
}
|
|
666
|
+
__name(isArray2, "isArray");
|
|
667
|
+
function isPlainObject2(payload) {
|
|
668
|
+
if (getType2(payload) !== "Object")
|
|
669
|
+
return false;
|
|
670
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
671
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
672
|
+
}
|
|
673
|
+
__name(isPlainObject2, "isPlainObject");
|
|
674
|
+
function isNull2(payload) {
|
|
675
|
+
return getType2(payload) === "Null";
|
|
676
|
+
}
|
|
677
|
+
__name(isNull2, "isNull");
|
|
678
|
+
function isOneOf(a, b, c, d, e) {
|
|
679
|
+
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
680
|
+
}
|
|
681
|
+
__name(isOneOf, "isOneOf");
|
|
682
|
+
function isUndefined2(payload) {
|
|
683
|
+
return getType2(payload) === "Undefined";
|
|
684
|
+
}
|
|
685
|
+
__name(isUndefined2, "isUndefined");
|
|
686
|
+
var isNullOrUndefined = isOneOf(isNull2, isUndefined2);
|
|
687
|
+
|
|
688
|
+
// ../../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
689
|
+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
690
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
691
|
+
if (propType === "enumerable")
|
|
692
|
+
carry[key] = newVal;
|
|
693
|
+
if (includeNonenumerable && propType === "nonenumerable") {
|
|
694
|
+
Object.defineProperty(carry, key, {
|
|
695
|
+
value: newVal,
|
|
696
|
+
enumerable: false,
|
|
697
|
+
writable: true,
|
|
698
|
+
configurable: true
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
__name(assignProp, "assignProp");
|
|
703
|
+
function copy(target, options = {}) {
|
|
704
|
+
if (isArray2(target)) {
|
|
705
|
+
return target.map((item) => copy(item, options));
|
|
706
|
+
}
|
|
707
|
+
if (!isPlainObject2(target)) {
|
|
708
|
+
return target;
|
|
709
|
+
}
|
|
710
|
+
const props = Object.getOwnPropertyNames(target);
|
|
711
|
+
const symbols = Object.getOwnPropertySymbols(target);
|
|
712
|
+
return [...props, ...symbols].reduce((carry, key) => {
|
|
713
|
+
if (isArray2(options.props) && !options.props.includes(key)) {
|
|
714
|
+
return carry;
|
|
715
|
+
}
|
|
716
|
+
const val = target[key];
|
|
717
|
+
const newVal = copy(val, options);
|
|
718
|
+
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
719
|
+
return carry;
|
|
720
|
+
}, {});
|
|
721
|
+
}
|
|
722
|
+
__name(copy, "copy");
|
|
723
|
+
|
|
724
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js
|
|
725
|
+
var SuperJSON = class {
|
|
726
|
+
constructor({ dedupe = false } = {}) {
|
|
727
|
+
this.classRegistry = new ClassRegistry();
|
|
728
|
+
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
729
|
+
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
730
|
+
this.allowedErrorProps = [];
|
|
731
|
+
this.dedupe = dedupe;
|
|
732
|
+
}
|
|
733
|
+
serialize(object) {
|
|
734
|
+
const identities = /* @__PURE__ */ new Map();
|
|
735
|
+
const output = walker(object, identities, this, this.dedupe);
|
|
736
|
+
const res = {
|
|
737
|
+
json: output.transformedValue
|
|
738
|
+
};
|
|
739
|
+
if (output.annotations) {
|
|
740
|
+
res.meta = {
|
|
741
|
+
...res.meta,
|
|
742
|
+
values: output.annotations
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
746
|
+
if (equalityAnnotations) {
|
|
747
|
+
res.meta = {
|
|
748
|
+
...res.meta,
|
|
749
|
+
referentialEqualities: equalityAnnotations
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
return res;
|
|
753
|
+
}
|
|
754
|
+
deserialize(payload) {
|
|
755
|
+
const { json, meta } = payload;
|
|
756
|
+
let result = copy(json);
|
|
757
|
+
if (meta?.values) {
|
|
758
|
+
result = applyValueAnnotations(result, meta.values, this);
|
|
759
|
+
}
|
|
760
|
+
if (meta?.referentialEqualities) {
|
|
761
|
+
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
762
|
+
}
|
|
763
|
+
return result;
|
|
764
|
+
}
|
|
765
|
+
stringify(object) {
|
|
766
|
+
return JSON.stringify(this.serialize(object));
|
|
767
|
+
}
|
|
768
|
+
parse(string) {
|
|
769
|
+
return this.deserialize(JSON.parse(string));
|
|
770
|
+
}
|
|
771
|
+
registerClass(v, options) {
|
|
772
|
+
this.classRegistry.register(v, options);
|
|
773
|
+
}
|
|
774
|
+
registerSymbol(v, identifier) {
|
|
775
|
+
this.symbolRegistry.register(v, identifier);
|
|
776
|
+
}
|
|
777
|
+
registerCustom(transformer, name) {
|
|
778
|
+
this.customTransformerRegistry.register({
|
|
779
|
+
name,
|
|
780
|
+
...transformer
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
allowErrorProps(...props) {
|
|
784
|
+
this.allowedErrorProps.push(...props);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
__name(SuperJSON, "SuperJSON");
|
|
788
|
+
SuperJSON.defaultInstance = new SuperJSON();
|
|
789
|
+
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
790
|
+
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
791
|
+
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
792
|
+
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
793
|
+
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
794
|
+
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
795
|
+
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
796
|
+
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
797
|
+
var serialize = SuperJSON.serialize;
|
|
798
|
+
var deserialize = SuperJSON.deserialize;
|
|
799
|
+
var stringify = SuperJSON.stringify;
|
|
800
|
+
var parse = SuperJSON.parse;
|
|
801
|
+
var registerClass = SuperJSON.registerClass;
|
|
802
|
+
var registerCustom = SuperJSON.registerCustom;
|
|
803
|
+
var registerSymbol = SuperJSON.registerSymbol;
|
|
804
|
+
var allowErrorProps = SuperJSON.allowErrorProps;
|
|
805
|
+
|
|
4
806
|
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
|
|
5
807
|
function identity(x) {
|
|
6
808
|
return x;
|
|
@@ -992,7 +1794,7 @@ function getTextDecoder(customTextDecoder) {
|
|
|
992
1794
|
}
|
|
993
1795
|
__name(getTextDecoder, "getTextDecoder");
|
|
994
1796
|
async function parseJSONStream(opts) {
|
|
995
|
-
const
|
|
1797
|
+
const parse2 = opts.parse ?? JSON.parse;
|
|
996
1798
|
const onLine = /* @__PURE__ */ __name((line) => {
|
|
997
1799
|
if (opts.signal?.aborted)
|
|
998
1800
|
return;
|
|
@@ -1002,7 +1804,7 @@ async function parseJSONStream(opts) {
|
|
|
1002
1804
|
const indexOfColon = line.indexOf(":");
|
|
1003
1805
|
const indexAsStr = line.substring(2, indexOfColon - 1);
|
|
1004
1806
|
const text = line.substring(indexOfColon + 1);
|
|
1005
|
-
opts.onSingle(Number(indexAsStr),
|
|
1807
|
+
opts.onSingle(Number(indexAsStr), parse2(text));
|
|
1006
1808
|
}, "onLine");
|
|
1007
1809
|
await readLines(opts.readableStream, onLine, opts.textDecoder);
|
|
1008
1810
|
}
|
|
@@ -1174,6 +1976,7 @@ var callbackLink = /* @__PURE__ */ __name2((callback) => {
|
|
|
1174
1976
|
var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
1175
1977
|
let challenges = [];
|
|
1176
1978
|
const challengeRequester = createTRPCProxyClient({
|
|
1979
|
+
transformer: SuperJSON,
|
|
1177
1980
|
links: [
|
|
1178
1981
|
httpBatchLink({
|
|
1179
1982
|
url,
|
|
@@ -1187,6 +1990,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
1187
1990
|
}, "getChallenges");
|
|
1188
1991
|
challenges = await getChallenges();
|
|
1189
1992
|
const trpc = createTRPCProxyClient({
|
|
1993
|
+
transformer: SuperJSON,
|
|
1190
1994
|
links: [
|
|
1191
1995
|
callbackLink(async () => {
|
|
1192
1996
|
challenges = await getChallenges();
|
|
@@ -4528,6 +5332,8 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4528
5332
|
});
|
|
4529
5333
|
|
|
4530
5334
|
// ../../learn-card-types/dist/types.esm.js
|
|
5335
|
+
var __defProp3 = Object.defineProperty;
|
|
5336
|
+
var __name3 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", { value, configurable: true }), "__name");
|
|
4531
5337
|
var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
|
|
4532
5338
|
var AchievementCriteriaValidator = mod.object({
|
|
4533
5339
|
type: mod.string().optional(),
|
|
@@ -4931,6 +5737,35 @@ var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
|
4931
5737
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
4932
5738
|
records: EncryptedCredentialRecordValidator.array()
|
|
4933
5739
|
});
|
|
5740
|
+
var parseRegexString = /* @__PURE__ */ __name3((regexStr) => {
|
|
5741
|
+
const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
|
|
5742
|
+
if (!match)
|
|
5743
|
+
throw new Error("Invalid RegExp string format");
|
|
5744
|
+
return { pattern: match[1], flags: match[2] };
|
|
5745
|
+
}, "parseRegexString");
|
|
5746
|
+
var RegExpValidator = mod.instanceof(RegExp).or(
|
|
5747
|
+
mod.string().refine(
|
|
5748
|
+
(str) => {
|
|
5749
|
+
try {
|
|
5750
|
+
parseRegexString(str);
|
|
5751
|
+
return true;
|
|
5752
|
+
} catch {
|
|
5753
|
+
return false;
|
|
5754
|
+
}
|
|
5755
|
+
},
|
|
5756
|
+
{
|
|
5757
|
+
message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
|
|
5758
|
+
}
|
|
5759
|
+
).transform((str) => {
|
|
5760
|
+
const { pattern, flags } = parseRegexString(str);
|
|
5761
|
+
try {
|
|
5762
|
+
return new RegExp(pattern, flags);
|
|
5763
|
+
} catch (error) {
|
|
5764
|
+
throw new Error(`Invalid RegExp: ${error.message}`);
|
|
5765
|
+
}
|
|
5766
|
+
})
|
|
5767
|
+
);
|
|
5768
|
+
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
|
4934
5769
|
var LCNProfileValidator = mod.object({
|
|
4935
5770
|
profileId: mod.string().min(3).max(40),
|
|
4936
5771
|
displayName: mod.string().default(""),
|
|
@@ -4945,6 +5780,16 @@ var LCNProfileValidator = mod.object({
|
|
|
4945
5780
|
type: mod.string().optional(),
|
|
4946
5781
|
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
|
4947
5782
|
});
|
|
5783
|
+
var LCNProfileQueryValidator = mod.object({
|
|
5784
|
+
profileId: StringQuery,
|
|
5785
|
+
displayName: StringQuery,
|
|
5786
|
+
shortBio: StringQuery,
|
|
5787
|
+
bio: StringQuery,
|
|
5788
|
+
email: StringQuery,
|
|
5789
|
+
websiteLink: StringQuery,
|
|
5790
|
+
isServiceProfile: mod.boolean(),
|
|
5791
|
+
type: StringQuery
|
|
5792
|
+
}).partial();
|
|
4948
5793
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
4949
5794
|
records: LCNProfileValidator.array()
|
|
4950
5795
|
});
|
|
@@ -4985,7 +5830,6 @@ var BoostValidator = mod.object({
|
|
|
4985
5830
|
meta: mod.record(mod.any()).optional(),
|
|
4986
5831
|
claimPermissions: BoostPermissionsValidator.optional()
|
|
4987
5832
|
});
|
|
4988
|
-
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: mod.instanceof(RegExp) }));
|
|
4989
5833
|
var BoostQueryValidator = mod.object({
|
|
4990
5834
|
uri: StringQuery,
|
|
4991
5835
|
name: StringQuery,
|
|
@@ -5575,14 +6419,15 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
5575
6419
|
includeUnacceptedBoosts
|
|
5576
6420
|
});
|
|
5577
6421
|
},
|
|
5578
|
-
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true) => {
|
|
6422
|
+
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true, query) => {
|
|
5579
6423
|
if (!userData)
|
|
5580
6424
|
throw new Error("Please make an account first!");
|
|
5581
6425
|
return client.boost.getPaginatedBoostRecipients.query({
|
|
5582
6426
|
uri,
|
|
5583
6427
|
limit,
|
|
5584
6428
|
cursor,
|
|
5585
|
-
includeUnacceptedBoosts
|
|
6429
|
+
includeUnacceptedBoosts,
|
|
6430
|
+
query
|
|
5586
6431
|
});
|
|
5587
6432
|
},
|
|
5588
6433
|
countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
|