@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
|
@@ -26,6 +26,808 @@ __export(src_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
|
|
29
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/double-indexed-kv.js
|
|
30
|
+
var DoubleIndexedKV = class {
|
|
31
|
+
constructor() {
|
|
32
|
+
this.keyToValue = /* @__PURE__ */ new Map();
|
|
33
|
+
this.valueToKey = /* @__PURE__ */ new Map();
|
|
34
|
+
}
|
|
35
|
+
set(key, value) {
|
|
36
|
+
this.keyToValue.set(key, value);
|
|
37
|
+
this.valueToKey.set(value, key);
|
|
38
|
+
}
|
|
39
|
+
getByKey(key) {
|
|
40
|
+
return this.keyToValue.get(key);
|
|
41
|
+
}
|
|
42
|
+
getByValue(value) {
|
|
43
|
+
return this.valueToKey.get(value);
|
|
44
|
+
}
|
|
45
|
+
clear() {
|
|
46
|
+
this.keyToValue.clear();
|
|
47
|
+
this.valueToKey.clear();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
__name(DoubleIndexedKV, "DoubleIndexedKV");
|
|
51
|
+
|
|
52
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/registry.js
|
|
53
|
+
var Registry = class {
|
|
54
|
+
constructor(generateIdentifier) {
|
|
55
|
+
this.generateIdentifier = generateIdentifier;
|
|
56
|
+
this.kv = new DoubleIndexedKV();
|
|
57
|
+
}
|
|
58
|
+
register(value, identifier) {
|
|
59
|
+
if (this.kv.getByValue(value)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!identifier) {
|
|
63
|
+
identifier = this.generateIdentifier(value);
|
|
64
|
+
}
|
|
65
|
+
this.kv.set(identifier, value);
|
|
66
|
+
}
|
|
67
|
+
clear() {
|
|
68
|
+
this.kv.clear();
|
|
69
|
+
}
|
|
70
|
+
getIdentifier(value) {
|
|
71
|
+
return this.kv.getByValue(value);
|
|
72
|
+
}
|
|
73
|
+
getValue(identifier) {
|
|
74
|
+
return this.kv.getByKey(identifier);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
__name(Registry, "Registry");
|
|
78
|
+
|
|
79
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/class-registry.js
|
|
80
|
+
var ClassRegistry = class extends Registry {
|
|
81
|
+
constructor() {
|
|
82
|
+
super((c) => c.name);
|
|
83
|
+
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
84
|
+
}
|
|
85
|
+
register(value, options) {
|
|
86
|
+
if (typeof options === "object") {
|
|
87
|
+
if (options.allowProps) {
|
|
88
|
+
this.classToAllowedProps.set(value, options.allowProps);
|
|
89
|
+
}
|
|
90
|
+
super.register(value, options.identifier);
|
|
91
|
+
} else {
|
|
92
|
+
super.register(value, options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
getAllowedProps(value) {
|
|
96
|
+
return this.classToAllowedProps.get(value);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__name(ClassRegistry, "ClassRegistry");
|
|
100
|
+
|
|
101
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/util.js
|
|
102
|
+
function valuesOfObj(record) {
|
|
103
|
+
if ("values" in Object) {
|
|
104
|
+
return Object.values(record);
|
|
105
|
+
}
|
|
106
|
+
const values = [];
|
|
107
|
+
for (const key in record) {
|
|
108
|
+
if (record.hasOwnProperty(key)) {
|
|
109
|
+
values.push(record[key]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return values;
|
|
113
|
+
}
|
|
114
|
+
__name(valuesOfObj, "valuesOfObj");
|
|
115
|
+
function find(record, predicate) {
|
|
116
|
+
const values = valuesOfObj(record);
|
|
117
|
+
if ("find" in values) {
|
|
118
|
+
return values.find(predicate);
|
|
119
|
+
}
|
|
120
|
+
const valuesNotNever = values;
|
|
121
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
122
|
+
const value = valuesNotNever[i];
|
|
123
|
+
if (predicate(value)) {
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
__name(find, "find");
|
|
130
|
+
function forEach(record, run) {
|
|
131
|
+
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
132
|
+
}
|
|
133
|
+
__name(forEach, "forEach");
|
|
134
|
+
function includes(arr, value) {
|
|
135
|
+
return arr.indexOf(value) !== -1;
|
|
136
|
+
}
|
|
137
|
+
__name(includes, "includes");
|
|
138
|
+
function findArr(record, predicate) {
|
|
139
|
+
for (let i = 0; i < record.length; i++) {
|
|
140
|
+
const value = record[i];
|
|
141
|
+
if (predicate(value)) {
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
__name(findArr, "findArr");
|
|
148
|
+
|
|
149
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/custom-transformer-registry.js
|
|
150
|
+
var CustomTransformerRegistry = class {
|
|
151
|
+
constructor() {
|
|
152
|
+
this.transfomers = {};
|
|
153
|
+
}
|
|
154
|
+
register(transformer) {
|
|
155
|
+
this.transfomers[transformer.name] = transformer;
|
|
156
|
+
}
|
|
157
|
+
findApplicable(v) {
|
|
158
|
+
return find(this.transfomers, (transformer) => transformer.isApplicable(v));
|
|
159
|
+
}
|
|
160
|
+
findByName(name) {
|
|
161
|
+
return this.transfomers[name];
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
__name(CustomTransformerRegistry, "CustomTransformerRegistry");
|
|
165
|
+
|
|
166
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/is.js
|
|
167
|
+
var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
|
|
168
|
+
var isUndefined = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
|
|
169
|
+
var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
|
|
170
|
+
var isPlainObject = /* @__PURE__ */ __name((payload) => {
|
|
171
|
+
if (typeof payload !== "object" || payload === null)
|
|
172
|
+
return false;
|
|
173
|
+
if (payload === Object.prototype)
|
|
174
|
+
return false;
|
|
175
|
+
if (Object.getPrototypeOf(payload) === null)
|
|
176
|
+
return true;
|
|
177
|
+
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
178
|
+
}, "isPlainObject");
|
|
179
|
+
var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject(payload) && Object.keys(payload).length === 0, "isEmptyObject");
|
|
180
|
+
var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
|
|
181
|
+
var isString = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
|
|
182
|
+
var isNumber = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
|
|
183
|
+
var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
|
|
184
|
+
var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
|
|
185
|
+
var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
|
|
186
|
+
var isSet = /* @__PURE__ */ __name((payload) => payload instanceof Set, "isSet");
|
|
187
|
+
var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol", "isSymbol");
|
|
188
|
+
var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
|
|
189
|
+
var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
|
|
190
|
+
var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
|
|
191
|
+
var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload), "isPrimitive");
|
|
192
|
+
var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
|
|
193
|
+
var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
|
|
194
|
+
var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
|
|
195
|
+
var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL");
|
|
196
|
+
|
|
197
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/pathstringifier.js
|
|
198
|
+
var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
|
|
199
|
+
var stringifyPath = /* @__PURE__ */ __name((path) => path.map(String).map(escapeKey).join("."), "stringifyPath");
|
|
200
|
+
var parsePath = /* @__PURE__ */ __name((string) => {
|
|
201
|
+
const result = [];
|
|
202
|
+
let segment = "";
|
|
203
|
+
for (let i = 0; i < string.length; i++) {
|
|
204
|
+
let char = string.charAt(i);
|
|
205
|
+
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
206
|
+
if (isEscapedDot) {
|
|
207
|
+
segment += ".";
|
|
208
|
+
i++;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const isEndOfSegment = char === ".";
|
|
212
|
+
if (isEndOfSegment) {
|
|
213
|
+
result.push(segment);
|
|
214
|
+
segment = "";
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
segment += char;
|
|
218
|
+
}
|
|
219
|
+
const lastSegment = segment;
|
|
220
|
+
result.push(lastSegment);
|
|
221
|
+
return result;
|
|
222
|
+
}, "parsePath");
|
|
223
|
+
|
|
224
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/transformer.js
|
|
225
|
+
function simpleTransformation(isApplicable, annotation, transform, untransform) {
|
|
226
|
+
return {
|
|
227
|
+
isApplicable,
|
|
228
|
+
annotation,
|
|
229
|
+
transform,
|
|
230
|
+
untransform
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
__name(simpleTransformation, "simpleTransformation");
|
|
234
|
+
var simpleRules = [
|
|
235
|
+
simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
|
|
236
|
+
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
237
|
+
if (typeof BigInt !== "undefined") {
|
|
238
|
+
return BigInt(v);
|
|
239
|
+
}
|
|
240
|
+
console.error("Please add a BigInt polyfill.");
|
|
241
|
+
return v;
|
|
242
|
+
}),
|
|
243
|
+
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
244
|
+
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
245
|
+
const baseError = {
|
|
246
|
+
name: v.name,
|
|
247
|
+
message: v.message
|
|
248
|
+
};
|
|
249
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
250
|
+
baseError[prop] = v[prop];
|
|
251
|
+
});
|
|
252
|
+
return baseError;
|
|
253
|
+
}, (v, superJson) => {
|
|
254
|
+
const e = new Error(v.message);
|
|
255
|
+
e.name = v.name;
|
|
256
|
+
e.stack = v.stack;
|
|
257
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
258
|
+
e[prop] = v[prop];
|
|
259
|
+
});
|
|
260
|
+
return e;
|
|
261
|
+
}),
|
|
262
|
+
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
263
|
+
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
264
|
+
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
265
|
+
return new RegExp(body, flags);
|
|
266
|
+
}),
|
|
267
|
+
simpleTransformation(
|
|
268
|
+
isSet,
|
|
269
|
+
"set",
|
|
270
|
+
(v) => [...v.values()],
|
|
271
|
+
(v) => new Set(v)
|
|
272
|
+
),
|
|
273
|
+
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
274
|
+
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
275
|
+
if (isNaNValue(v)) {
|
|
276
|
+
return "NaN";
|
|
277
|
+
}
|
|
278
|
+
if (v > 0) {
|
|
279
|
+
return "Infinity";
|
|
280
|
+
} else {
|
|
281
|
+
return "-Infinity";
|
|
282
|
+
}
|
|
283
|
+
}, Number),
|
|
284
|
+
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
285
|
+
return "-0";
|
|
286
|
+
}, Number),
|
|
287
|
+
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
288
|
+
];
|
|
289
|
+
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
290
|
+
return {
|
|
291
|
+
isApplicable,
|
|
292
|
+
annotation,
|
|
293
|
+
transform,
|
|
294
|
+
untransform
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
__name(compositeTransformation, "compositeTransformation");
|
|
298
|
+
var symbolRule = compositeTransformation((s, superJson) => {
|
|
299
|
+
if (isSymbol(s)) {
|
|
300
|
+
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
301
|
+
return isRegistered;
|
|
302
|
+
}
|
|
303
|
+
return false;
|
|
304
|
+
}, (s, superJson) => {
|
|
305
|
+
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
306
|
+
return ["symbol", identifier];
|
|
307
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
308
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
309
|
+
if (!value) {
|
|
310
|
+
throw new Error("Trying to deserialize unknown symbol");
|
|
311
|
+
}
|
|
312
|
+
return value;
|
|
313
|
+
});
|
|
314
|
+
var constructorToName = [
|
|
315
|
+
Int8Array,
|
|
316
|
+
Uint8Array,
|
|
317
|
+
Int16Array,
|
|
318
|
+
Uint16Array,
|
|
319
|
+
Int32Array,
|
|
320
|
+
Uint32Array,
|
|
321
|
+
Float32Array,
|
|
322
|
+
Float64Array,
|
|
323
|
+
Uint8ClampedArray
|
|
324
|
+
].reduce((obj, ctor) => {
|
|
325
|
+
obj[ctor.name] = ctor;
|
|
326
|
+
return obj;
|
|
327
|
+
}, {});
|
|
328
|
+
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
329
|
+
const ctor = constructorToName[a[1]];
|
|
330
|
+
if (!ctor) {
|
|
331
|
+
throw new Error("Trying to deserialize unknown typed array");
|
|
332
|
+
}
|
|
333
|
+
return new ctor(v);
|
|
334
|
+
});
|
|
335
|
+
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
336
|
+
if (potentialClass?.constructor) {
|
|
337
|
+
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
338
|
+
return isRegistered;
|
|
339
|
+
}
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
__name(isInstanceOfRegisteredClass, "isInstanceOfRegisteredClass");
|
|
343
|
+
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
344
|
+
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
345
|
+
return ["class", identifier];
|
|
346
|
+
}, (clazz, superJson) => {
|
|
347
|
+
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
348
|
+
if (!allowedProps) {
|
|
349
|
+
return { ...clazz };
|
|
350
|
+
}
|
|
351
|
+
const result = {};
|
|
352
|
+
allowedProps.forEach((prop) => {
|
|
353
|
+
result[prop] = clazz[prop];
|
|
354
|
+
});
|
|
355
|
+
return result;
|
|
356
|
+
}, (v, a, superJson) => {
|
|
357
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
358
|
+
if (!clazz) {
|
|
359
|
+
throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");
|
|
360
|
+
}
|
|
361
|
+
return Object.assign(Object.create(clazz.prototype), v);
|
|
362
|
+
});
|
|
363
|
+
var customRule = compositeTransformation((value, superJson) => {
|
|
364
|
+
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
365
|
+
}, (value, superJson) => {
|
|
366
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
367
|
+
return ["custom", transformer.name];
|
|
368
|
+
}, (value, superJson) => {
|
|
369
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
370
|
+
return transformer.serialize(value);
|
|
371
|
+
}, (v, a, superJson) => {
|
|
372
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
373
|
+
if (!transformer) {
|
|
374
|
+
throw new Error("Trying to deserialize unknown custom value");
|
|
375
|
+
}
|
|
376
|
+
return transformer.deserialize(v);
|
|
377
|
+
});
|
|
378
|
+
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
379
|
+
var transformValue = /* @__PURE__ */ __name((value, superJson) => {
|
|
380
|
+
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
381
|
+
if (applicableCompositeRule) {
|
|
382
|
+
return {
|
|
383
|
+
value: applicableCompositeRule.transform(value, superJson),
|
|
384
|
+
type: applicableCompositeRule.annotation(value, superJson)
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
|
|
388
|
+
if (applicableSimpleRule) {
|
|
389
|
+
return {
|
|
390
|
+
value: applicableSimpleRule.transform(value, superJson),
|
|
391
|
+
type: applicableSimpleRule.annotation
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
return void 0;
|
|
395
|
+
}, "transformValue");
|
|
396
|
+
var simpleRulesByAnnotation = {};
|
|
397
|
+
simpleRules.forEach((rule) => {
|
|
398
|
+
simpleRulesByAnnotation[rule.annotation] = rule;
|
|
399
|
+
});
|
|
400
|
+
var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
|
|
401
|
+
if (isArray(type)) {
|
|
402
|
+
switch (type[0]) {
|
|
403
|
+
case "symbol":
|
|
404
|
+
return symbolRule.untransform(json, type, superJson);
|
|
405
|
+
case "class":
|
|
406
|
+
return classRule.untransform(json, type, superJson);
|
|
407
|
+
case "custom":
|
|
408
|
+
return customRule.untransform(json, type, superJson);
|
|
409
|
+
case "typed-array":
|
|
410
|
+
return typedArrayRule.untransform(json, type, superJson);
|
|
411
|
+
default:
|
|
412
|
+
throw new Error("Unknown transformation: " + type);
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
const transformation = simpleRulesByAnnotation[type];
|
|
416
|
+
if (!transformation) {
|
|
417
|
+
throw new Error("Unknown transformation: " + type);
|
|
418
|
+
}
|
|
419
|
+
return transformation.untransform(json, superJson);
|
|
420
|
+
}
|
|
421
|
+
}, "untransformValue");
|
|
422
|
+
|
|
423
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/accessDeep.js
|
|
424
|
+
var getNthKey = /* @__PURE__ */ __name((value, n) => {
|
|
425
|
+
const keys = value.keys();
|
|
426
|
+
while (n > 0) {
|
|
427
|
+
keys.next();
|
|
428
|
+
n--;
|
|
429
|
+
}
|
|
430
|
+
return keys.next().value;
|
|
431
|
+
}, "getNthKey");
|
|
432
|
+
function validatePath(path) {
|
|
433
|
+
if (includes(path, "__proto__")) {
|
|
434
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
435
|
+
}
|
|
436
|
+
if (includes(path, "prototype")) {
|
|
437
|
+
throw new Error("prototype is not allowed as a property");
|
|
438
|
+
}
|
|
439
|
+
if (includes(path, "constructor")) {
|
|
440
|
+
throw new Error("constructor is not allowed as a property");
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
__name(validatePath, "validatePath");
|
|
444
|
+
var getDeep = /* @__PURE__ */ __name((object, path) => {
|
|
445
|
+
validatePath(path);
|
|
446
|
+
for (let i = 0; i < path.length; i++) {
|
|
447
|
+
const key = path[i];
|
|
448
|
+
if (isSet(object)) {
|
|
449
|
+
object = getNthKey(object, +key);
|
|
450
|
+
} else if (isMap(object)) {
|
|
451
|
+
const row = +key;
|
|
452
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
453
|
+
const keyOfRow = getNthKey(object, row);
|
|
454
|
+
switch (type) {
|
|
455
|
+
case "key":
|
|
456
|
+
object = keyOfRow;
|
|
457
|
+
break;
|
|
458
|
+
case "value":
|
|
459
|
+
object = object.get(keyOfRow);
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
} else {
|
|
463
|
+
object = object[key];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return object;
|
|
467
|
+
}, "getDeep");
|
|
468
|
+
var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
|
|
469
|
+
validatePath(path);
|
|
470
|
+
if (path.length === 0) {
|
|
471
|
+
return mapper(object);
|
|
472
|
+
}
|
|
473
|
+
let parent = object;
|
|
474
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
475
|
+
const key = path[i];
|
|
476
|
+
if (isArray(parent)) {
|
|
477
|
+
const index = +key;
|
|
478
|
+
parent = parent[index];
|
|
479
|
+
} else if (isPlainObject(parent)) {
|
|
480
|
+
parent = parent[key];
|
|
481
|
+
} else if (isSet(parent)) {
|
|
482
|
+
const row = +key;
|
|
483
|
+
parent = getNthKey(parent, row);
|
|
484
|
+
} else if (isMap(parent)) {
|
|
485
|
+
const isEnd = i === path.length - 2;
|
|
486
|
+
if (isEnd) {
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
const row = +key;
|
|
490
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
491
|
+
const keyOfRow = getNthKey(parent, row);
|
|
492
|
+
switch (type) {
|
|
493
|
+
case "key":
|
|
494
|
+
parent = keyOfRow;
|
|
495
|
+
break;
|
|
496
|
+
case "value":
|
|
497
|
+
parent = parent.get(keyOfRow);
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const lastKey = path[path.length - 1];
|
|
503
|
+
if (isArray(parent)) {
|
|
504
|
+
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
505
|
+
} else if (isPlainObject(parent)) {
|
|
506
|
+
parent[lastKey] = mapper(parent[lastKey]);
|
|
507
|
+
}
|
|
508
|
+
if (isSet(parent)) {
|
|
509
|
+
const oldValue = getNthKey(parent, +lastKey);
|
|
510
|
+
const newValue = mapper(oldValue);
|
|
511
|
+
if (oldValue !== newValue) {
|
|
512
|
+
parent.delete(oldValue);
|
|
513
|
+
parent.add(newValue);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (isMap(parent)) {
|
|
517
|
+
const row = +path[path.length - 2];
|
|
518
|
+
const keyToRow = getNthKey(parent, row);
|
|
519
|
+
const type = +lastKey === 0 ? "key" : "value";
|
|
520
|
+
switch (type) {
|
|
521
|
+
case "key": {
|
|
522
|
+
const newKey = mapper(keyToRow);
|
|
523
|
+
parent.set(newKey, parent.get(keyToRow));
|
|
524
|
+
if (newKey !== keyToRow) {
|
|
525
|
+
parent.delete(keyToRow);
|
|
526
|
+
}
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
case "value": {
|
|
530
|
+
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return object;
|
|
536
|
+
}, "setDeep");
|
|
537
|
+
|
|
538
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/plainer.js
|
|
539
|
+
function traverse(tree, walker2, origin = []) {
|
|
540
|
+
if (!tree) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (!isArray(tree)) {
|
|
544
|
+
forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const [nodeValue, children] = tree;
|
|
548
|
+
if (children) {
|
|
549
|
+
forEach(children, (child, key) => {
|
|
550
|
+
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
walker2(nodeValue, origin);
|
|
554
|
+
}
|
|
555
|
+
__name(traverse, "traverse");
|
|
556
|
+
function applyValueAnnotations(plain, annotations, superJson) {
|
|
557
|
+
traverse(annotations, (type, path) => {
|
|
558
|
+
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
559
|
+
});
|
|
560
|
+
return plain;
|
|
561
|
+
}
|
|
562
|
+
__name(applyValueAnnotations, "applyValueAnnotations");
|
|
563
|
+
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
564
|
+
function apply(identicalPaths, path) {
|
|
565
|
+
const object = getDeep(plain, parsePath(path));
|
|
566
|
+
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
567
|
+
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
__name(apply, "apply");
|
|
571
|
+
if (isArray(annotations)) {
|
|
572
|
+
const [root, other] = annotations;
|
|
573
|
+
root.forEach((identicalPath) => {
|
|
574
|
+
plain = setDeep(plain, parsePath(identicalPath), () => plain);
|
|
575
|
+
});
|
|
576
|
+
if (other) {
|
|
577
|
+
forEach(other, apply);
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
forEach(annotations, apply);
|
|
581
|
+
}
|
|
582
|
+
return plain;
|
|
583
|
+
}
|
|
584
|
+
__name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
|
|
585
|
+
var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
|
|
586
|
+
function addIdentity(object, path, identities) {
|
|
587
|
+
const existingSet = identities.get(object);
|
|
588
|
+
if (existingSet) {
|
|
589
|
+
existingSet.push(path);
|
|
590
|
+
} else {
|
|
591
|
+
identities.set(object, [path]);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
__name(addIdentity, "addIdentity");
|
|
595
|
+
function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
596
|
+
const result = {};
|
|
597
|
+
let rootEqualityPaths = void 0;
|
|
598
|
+
identitites.forEach((paths) => {
|
|
599
|
+
if (paths.length <= 1) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (!dedupe) {
|
|
603
|
+
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
604
|
+
}
|
|
605
|
+
const [representativePath, ...identicalPaths] = paths;
|
|
606
|
+
if (representativePath.length === 0) {
|
|
607
|
+
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
608
|
+
} else {
|
|
609
|
+
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
if (rootEqualityPaths) {
|
|
613
|
+
if (isEmptyObject(result)) {
|
|
614
|
+
return [rootEqualityPaths];
|
|
615
|
+
} else {
|
|
616
|
+
return [rootEqualityPaths, result];
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
return isEmptyObject(result) ? void 0 : result;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
__name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
|
|
623
|
+
var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
|
|
624
|
+
const primitive = isPrimitive(object);
|
|
625
|
+
if (!primitive) {
|
|
626
|
+
addIdentity(object, path, identities);
|
|
627
|
+
const seen = seenObjects.get(object);
|
|
628
|
+
if (seen) {
|
|
629
|
+
return dedupe ? {
|
|
630
|
+
transformedValue: null
|
|
631
|
+
} : seen;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (!isDeep(object, superJson)) {
|
|
635
|
+
const transformed2 = transformValue(object, superJson);
|
|
636
|
+
const result2 = transformed2 ? {
|
|
637
|
+
transformedValue: transformed2.value,
|
|
638
|
+
annotations: [transformed2.type]
|
|
639
|
+
} : {
|
|
640
|
+
transformedValue: object
|
|
641
|
+
};
|
|
642
|
+
if (!primitive) {
|
|
643
|
+
seenObjects.set(object, result2);
|
|
644
|
+
}
|
|
645
|
+
return result2;
|
|
646
|
+
}
|
|
647
|
+
if (includes(objectsInThisPath, object)) {
|
|
648
|
+
return {
|
|
649
|
+
transformedValue: null
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const transformationResult = transformValue(object, superJson);
|
|
653
|
+
const transformed = transformationResult?.value ?? object;
|
|
654
|
+
const transformedValue = isArray(transformed) ? [] : {};
|
|
655
|
+
const innerAnnotations = {};
|
|
656
|
+
forEach(transformed, (value, index) => {
|
|
657
|
+
if (index === "__proto__" || index === "constructor" || index === "prototype") {
|
|
658
|
+
throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
659
|
+
}
|
|
660
|
+
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
661
|
+
transformedValue[index] = recursiveResult.transformedValue;
|
|
662
|
+
if (isArray(recursiveResult.annotations)) {
|
|
663
|
+
innerAnnotations[index] = recursiveResult.annotations;
|
|
664
|
+
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
665
|
+
forEach(recursiveResult.annotations, (tree, key) => {
|
|
666
|
+
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
const result = isEmptyObject(innerAnnotations) ? {
|
|
671
|
+
transformedValue,
|
|
672
|
+
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
673
|
+
} : {
|
|
674
|
+
transformedValue,
|
|
675
|
+
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
676
|
+
};
|
|
677
|
+
if (!primitive) {
|
|
678
|
+
seenObjects.set(object, result);
|
|
679
|
+
}
|
|
680
|
+
return result;
|
|
681
|
+
}, "walker");
|
|
682
|
+
|
|
683
|
+
// ../../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
684
|
+
function getType2(payload) {
|
|
685
|
+
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
686
|
+
}
|
|
687
|
+
__name(getType2, "getType");
|
|
688
|
+
function isArray2(payload) {
|
|
689
|
+
return getType2(payload) === "Array";
|
|
690
|
+
}
|
|
691
|
+
__name(isArray2, "isArray");
|
|
692
|
+
function isPlainObject2(payload) {
|
|
693
|
+
if (getType2(payload) !== "Object")
|
|
694
|
+
return false;
|
|
695
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
696
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
697
|
+
}
|
|
698
|
+
__name(isPlainObject2, "isPlainObject");
|
|
699
|
+
function isNull2(payload) {
|
|
700
|
+
return getType2(payload) === "Null";
|
|
701
|
+
}
|
|
702
|
+
__name(isNull2, "isNull");
|
|
703
|
+
function isOneOf(a, b, c, d, e) {
|
|
704
|
+
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
705
|
+
}
|
|
706
|
+
__name(isOneOf, "isOneOf");
|
|
707
|
+
function isUndefined2(payload) {
|
|
708
|
+
return getType2(payload) === "Undefined";
|
|
709
|
+
}
|
|
710
|
+
__name(isUndefined2, "isUndefined");
|
|
711
|
+
var isNullOrUndefined = isOneOf(isNull2, isUndefined2);
|
|
712
|
+
|
|
713
|
+
// ../../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
714
|
+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
715
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
716
|
+
if (propType === "enumerable")
|
|
717
|
+
carry[key] = newVal;
|
|
718
|
+
if (includeNonenumerable && propType === "nonenumerable") {
|
|
719
|
+
Object.defineProperty(carry, key, {
|
|
720
|
+
value: newVal,
|
|
721
|
+
enumerable: false,
|
|
722
|
+
writable: true,
|
|
723
|
+
configurable: true
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
__name(assignProp, "assignProp");
|
|
728
|
+
function copy(target, options = {}) {
|
|
729
|
+
if (isArray2(target)) {
|
|
730
|
+
return target.map((item) => copy(item, options));
|
|
731
|
+
}
|
|
732
|
+
if (!isPlainObject2(target)) {
|
|
733
|
+
return target;
|
|
734
|
+
}
|
|
735
|
+
const props = Object.getOwnPropertyNames(target);
|
|
736
|
+
const symbols = Object.getOwnPropertySymbols(target);
|
|
737
|
+
return [...props, ...symbols].reduce((carry, key) => {
|
|
738
|
+
if (isArray2(options.props) && !options.props.includes(key)) {
|
|
739
|
+
return carry;
|
|
740
|
+
}
|
|
741
|
+
const val = target[key];
|
|
742
|
+
const newVal = copy(val, options);
|
|
743
|
+
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
744
|
+
return carry;
|
|
745
|
+
}, {});
|
|
746
|
+
}
|
|
747
|
+
__name(copy, "copy");
|
|
748
|
+
|
|
749
|
+
// ../../../node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js
|
|
750
|
+
var SuperJSON = class {
|
|
751
|
+
constructor({ dedupe = false } = {}) {
|
|
752
|
+
this.classRegistry = new ClassRegistry();
|
|
753
|
+
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
754
|
+
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
755
|
+
this.allowedErrorProps = [];
|
|
756
|
+
this.dedupe = dedupe;
|
|
757
|
+
}
|
|
758
|
+
serialize(object) {
|
|
759
|
+
const identities = /* @__PURE__ */ new Map();
|
|
760
|
+
const output = walker(object, identities, this, this.dedupe);
|
|
761
|
+
const res = {
|
|
762
|
+
json: output.transformedValue
|
|
763
|
+
};
|
|
764
|
+
if (output.annotations) {
|
|
765
|
+
res.meta = {
|
|
766
|
+
...res.meta,
|
|
767
|
+
values: output.annotations
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
771
|
+
if (equalityAnnotations) {
|
|
772
|
+
res.meta = {
|
|
773
|
+
...res.meta,
|
|
774
|
+
referentialEqualities: equalityAnnotations
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
return res;
|
|
778
|
+
}
|
|
779
|
+
deserialize(payload) {
|
|
780
|
+
const { json, meta } = payload;
|
|
781
|
+
let result = copy(json);
|
|
782
|
+
if (meta?.values) {
|
|
783
|
+
result = applyValueAnnotations(result, meta.values, this);
|
|
784
|
+
}
|
|
785
|
+
if (meta?.referentialEqualities) {
|
|
786
|
+
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
stringify(object) {
|
|
791
|
+
return JSON.stringify(this.serialize(object));
|
|
792
|
+
}
|
|
793
|
+
parse(string) {
|
|
794
|
+
return this.deserialize(JSON.parse(string));
|
|
795
|
+
}
|
|
796
|
+
registerClass(v, options) {
|
|
797
|
+
this.classRegistry.register(v, options);
|
|
798
|
+
}
|
|
799
|
+
registerSymbol(v, identifier) {
|
|
800
|
+
this.symbolRegistry.register(v, identifier);
|
|
801
|
+
}
|
|
802
|
+
registerCustom(transformer, name) {
|
|
803
|
+
this.customTransformerRegistry.register({
|
|
804
|
+
name,
|
|
805
|
+
...transformer
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
allowErrorProps(...props) {
|
|
809
|
+
this.allowedErrorProps.push(...props);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
__name(SuperJSON, "SuperJSON");
|
|
813
|
+
SuperJSON.defaultInstance = new SuperJSON();
|
|
814
|
+
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
815
|
+
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
816
|
+
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
817
|
+
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
818
|
+
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
819
|
+
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
820
|
+
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
821
|
+
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
822
|
+
var serialize = SuperJSON.serialize;
|
|
823
|
+
var deserialize = SuperJSON.deserialize;
|
|
824
|
+
var stringify = SuperJSON.stringify;
|
|
825
|
+
var parse = SuperJSON.parse;
|
|
826
|
+
var registerClass = SuperJSON.registerClass;
|
|
827
|
+
var registerCustom = SuperJSON.registerCustom;
|
|
828
|
+
var registerSymbol = SuperJSON.registerSymbol;
|
|
829
|
+
var allowErrorProps = SuperJSON.allowErrorProps;
|
|
830
|
+
|
|
29
831
|
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
|
|
30
832
|
function identity(x) {
|
|
31
833
|
return x;
|
|
@@ -1017,7 +1819,7 @@ function getTextDecoder(customTextDecoder) {
|
|
|
1017
1819
|
}
|
|
1018
1820
|
__name(getTextDecoder, "getTextDecoder");
|
|
1019
1821
|
async function parseJSONStream(opts) {
|
|
1020
|
-
const
|
|
1822
|
+
const parse2 = opts.parse ?? JSON.parse;
|
|
1021
1823
|
const onLine = /* @__PURE__ */ __name((line) => {
|
|
1022
1824
|
if (opts.signal?.aborted)
|
|
1023
1825
|
return;
|
|
@@ -1027,7 +1829,7 @@ async function parseJSONStream(opts) {
|
|
|
1027
1829
|
const indexOfColon = line.indexOf(":");
|
|
1028
1830
|
const indexAsStr = line.substring(2, indexOfColon - 1);
|
|
1029
1831
|
const text = line.substring(indexOfColon + 1);
|
|
1030
|
-
opts.onSingle(Number(indexAsStr),
|
|
1832
|
+
opts.onSingle(Number(indexAsStr), parse2(text));
|
|
1031
1833
|
}, "onLine");
|
|
1032
1834
|
await readLines(opts.readableStream, onLine, opts.textDecoder);
|
|
1033
1835
|
}
|
|
@@ -1199,6 +2001,7 @@ var callbackLink = /* @__PURE__ */ __name2((callback) => {
|
|
|
1199
2001
|
var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
1200
2002
|
let challenges = [];
|
|
1201
2003
|
const challengeRequester = createTRPCProxyClient({
|
|
2004
|
+
transformer: SuperJSON,
|
|
1202
2005
|
links: [
|
|
1203
2006
|
httpBatchLink({
|
|
1204
2007
|
url,
|
|
@@ -1212,6 +2015,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
1212
2015
|
}, "getChallenges");
|
|
1213
2016
|
challenges = await getChallenges();
|
|
1214
2017
|
const trpc = createTRPCProxyClient({
|
|
2018
|
+
transformer: SuperJSON,
|
|
1215
2019
|
links: [
|
|
1216
2020
|
callbackLink(async () => {
|
|
1217
2021
|
challenges = await getChallenges();
|
|
@@ -4553,6 +5357,8 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4553
5357
|
});
|
|
4554
5358
|
|
|
4555
5359
|
// ../../learn-card-types/dist/types.esm.js
|
|
5360
|
+
var __defProp3 = Object.defineProperty;
|
|
5361
|
+
var __name3 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", { value, configurable: true }), "__name");
|
|
4556
5362
|
var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
|
|
4557
5363
|
var AchievementCriteriaValidator = mod.object({
|
|
4558
5364
|
type: mod.string().optional(),
|
|
@@ -4956,6 +5762,35 @@ var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
|
4956
5762
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
4957
5763
|
records: EncryptedCredentialRecordValidator.array()
|
|
4958
5764
|
});
|
|
5765
|
+
var parseRegexString = /* @__PURE__ */ __name3((regexStr) => {
|
|
5766
|
+
const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
|
|
5767
|
+
if (!match)
|
|
5768
|
+
throw new Error("Invalid RegExp string format");
|
|
5769
|
+
return { pattern: match[1], flags: match[2] };
|
|
5770
|
+
}, "parseRegexString");
|
|
5771
|
+
var RegExpValidator = mod.instanceof(RegExp).or(
|
|
5772
|
+
mod.string().refine(
|
|
5773
|
+
(str) => {
|
|
5774
|
+
try {
|
|
5775
|
+
parseRegexString(str);
|
|
5776
|
+
return true;
|
|
5777
|
+
} catch {
|
|
5778
|
+
return false;
|
|
5779
|
+
}
|
|
5780
|
+
},
|
|
5781
|
+
{
|
|
5782
|
+
message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
|
|
5783
|
+
}
|
|
5784
|
+
).transform((str) => {
|
|
5785
|
+
const { pattern, flags } = parseRegexString(str);
|
|
5786
|
+
try {
|
|
5787
|
+
return new RegExp(pattern, flags);
|
|
5788
|
+
} catch (error) {
|
|
5789
|
+
throw new Error(`Invalid RegExp: ${error.message}`);
|
|
5790
|
+
}
|
|
5791
|
+
})
|
|
5792
|
+
);
|
|
5793
|
+
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
|
4959
5794
|
var LCNProfileValidator = mod.object({
|
|
4960
5795
|
profileId: mod.string().min(3).max(40),
|
|
4961
5796
|
displayName: mod.string().default(""),
|
|
@@ -4970,6 +5805,16 @@ var LCNProfileValidator = mod.object({
|
|
|
4970
5805
|
type: mod.string().optional(),
|
|
4971
5806
|
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
|
4972
5807
|
});
|
|
5808
|
+
var LCNProfileQueryValidator = mod.object({
|
|
5809
|
+
profileId: StringQuery,
|
|
5810
|
+
displayName: StringQuery,
|
|
5811
|
+
shortBio: StringQuery,
|
|
5812
|
+
bio: StringQuery,
|
|
5813
|
+
email: StringQuery,
|
|
5814
|
+
websiteLink: StringQuery,
|
|
5815
|
+
isServiceProfile: mod.boolean(),
|
|
5816
|
+
type: StringQuery
|
|
5817
|
+
}).partial();
|
|
4973
5818
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
4974
5819
|
records: LCNProfileValidator.array()
|
|
4975
5820
|
});
|
|
@@ -5010,7 +5855,6 @@ var BoostValidator = mod.object({
|
|
|
5010
5855
|
meta: mod.record(mod.any()).optional(),
|
|
5011
5856
|
claimPermissions: BoostPermissionsValidator.optional()
|
|
5012
5857
|
});
|
|
5013
|
-
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: mod.instanceof(RegExp) }));
|
|
5014
5858
|
var BoostQueryValidator = mod.object({
|
|
5015
5859
|
uri: StringQuery,
|
|
5016
5860
|
name: StringQuery,
|
|
@@ -5600,14 +6444,15 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
5600
6444
|
includeUnacceptedBoosts
|
|
5601
6445
|
});
|
|
5602
6446
|
},
|
|
5603
|
-
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true) => {
|
|
6447
|
+
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true, query) => {
|
|
5604
6448
|
if (!userData)
|
|
5605
6449
|
throw new Error("Please make an account first!");
|
|
5606
6450
|
return client.boost.getPaginatedBoostRecipients.query({
|
|
5607
6451
|
uri,
|
|
5608
6452
|
limit,
|
|
5609
6453
|
cursor,
|
|
5610
|
-
includeUnacceptedBoosts
|
|
6454
|
+
includeUnacceptedBoosts,
|
|
6455
|
+
query
|
|
5611
6456
|
});
|
|
5612
6457
|
},
|
|
5613
6458
|
countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
|