@learncard/helpers 1.3.13 → 1.4.1
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/Utilities.d.ts +59 -0
- package/dist/Utilities.d.ts.map +1 -0
- package/dist/app-install/index.d.ts +62 -0
- package/dist/app-install/index.d.ts.map +1 -0
- package/dist/arrays/index.d.ts +3 -0
- package/dist/arrays/index.d.ts.map +1 -0
- package/dist/bitstring-status-list/index.d.ts +8 -0
- package/dist/bitstring-status-list/index.d.ts.map +1 -0
- package/dist/credential-format.d.ts +96 -0
- package/dist/credential-format.d.ts.map +1 -0
- package/dist/did.d.ts +3 -0
- package/dist/did.d.ts.map +1 -0
- package/dist/environment.d.ts +32 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/helpers.cjs.development.cjs +229 -127
- package/dist/helpers.cjs.development.cjs.map +4 -4
- package/dist/helpers.cjs.production.min.cjs +15 -11
- package/dist/helpers.cjs.production.min.cjs.map +4 -4
- package/dist/helpers.esm.js +175 -83
- package/dist/helpers.esm.js.map +4 -4
- package/dist/images/discord.helpers.d.ts +65 -0
- package/dist/images/discord.helpers.d.ts.map +1 -0
- package/dist/images/filestack.helpers.d.ts +92 -0
- package/dist/images/filestack.helpers.d.ts.map +1 -0
- package/dist/images/images.helpers.d.ts +32 -0
- package/dist/images/images.helpers.d.ts.map +1 -0
- package/dist/images/index.d.ts +3 -0
- package/dist/images/index.d.ts.map +1 -0
- package/dist/images/sanitize.helpers.d.ts +28 -0
- package/dist/images/sanitize.helpers.d.ts.map +1 -0
- package/dist/images/unsplash.helpers.d.ts +64 -0
- package/dist/images/unsplash.helpers.d.ts.map +1 -0
- package/dist/images/url.helpers.d.ts +14 -0
- package/dist/images/url.helpers.d.ts.map +1 -0
- package/dist/index.d.cts +43 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/numbers/index.d.ts +5 -0
- package/dist/numbers/index.d.ts.map +1 -0
- package/dist/state.d.ts +130 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/strings/index.d.ts +2 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/credential-format.ts +5 -4
- package/src/environment.ts +75 -0
- package/src/images/images.helpers.ts +24 -7
- package/src/images/index.ts +1 -0
- package/src/images/sanitize.helpers.ts +59 -0
- package/src/index.ts +11 -10
- package/dist/helpers.d.cts +0 -979
- package/dist/helpers.d.ts +0 -979
package/dist/helpers.esm.js
CHANGED
|
@@ -15079,7 +15079,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15079
15079
|
var ZodFirstPartyTypeKind;
|
|
15080
15080
|
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
15081
15081
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
15082
|
-
var
|
|
15082
|
+
var z3 = {
|
|
15083
15083
|
...schemas_exports2,
|
|
15084
15084
|
...checks_exports2,
|
|
15085
15085
|
iso: iso_exports
|
|
@@ -15193,7 +15193,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15193
15193
|
function convertBaseSchema(schema, ctx) {
|
|
15194
15194
|
if (schema.not !== void 0) {
|
|
15195
15195
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
15196
|
-
return
|
|
15196
|
+
return z3.never();
|
|
15197
15197
|
}
|
|
15198
15198
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
15199
15199
|
}
|
|
@@ -15215,7 +15215,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15215
15215
|
return ctx.refs.get(refPath);
|
|
15216
15216
|
}
|
|
15217
15217
|
if (ctx.processing.has(refPath)) {
|
|
15218
|
-
return
|
|
15218
|
+
return z3.lazy(() => {
|
|
15219
15219
|
if (!ctx.refs.has(refPath)) {
|
|
15220
15220
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
15221
15221
|
}
|
|
@@ -15232,25 +15232,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15232
15232
|
if (schema.enum !== void 0) {
|
|
15233
15233
|
const enumValues = schema.enum;
|
|
15234
15234
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
15235
|
-
return
|
|
15235
|
+
return z3.null();
|
|
15236
15236
|
}
|
|
15237
15237
|
if (enumValues.length === 0) {
|
|
15238
|
-
return
|
|
15238
|
+
return z3.never();
|
|
15239
15239
|
}
|
|
15240
15240
|
if (enumValues.length === 1) {
|
|
15241
|
-
return
|
|
15241
|
+
return z3.literal(enumValues[0]);
|
|
15242
15242
|
}
|
|
15243
15243
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
15244
|
-
return
|
|
15244
|
+
return z3.enum(enumValues);
|
|
15245
15245
|
}
|
|
15246
|
-
const literalSchemas = enumValues.map((v) =>
|
|
15246
|
+
const literalSchemas = enumValues.map((v) => z3.literal(v));
|
|
15247
15247
|
if (literalSchemas.length < 2) {
|
|
15248
15248
|
return literalSchemas[0];
|
|
15249
15249
|
}
|
|
15250
|
-
return
|
|
15250
|
+
return z3.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
15251
15251
|
}
|
|
15252
15252
|
if (schema.const !== void 0) {
|
|
15253
|
-
return
|
|
15253
|
+
return z3.literal(schema.const);
|
|
15254
15254
|
}
|
|
15255
15255
|
const type = schema.type;
|
|
15256
15256
|
if (Array.isArray(type)) {
|
|
@@ -15259,68 +15259,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15259
15259
|
return convertBaseSchema(typeSchema, ctx);
|
|
15260
15260
|
});
|
|
15261
15261
|
if (typeSchemas.length === 0) {
|
|
15262
|
-
return
|
|
15262
|
+
return z3.never();
|
|
15263
15263
|
}
|
|
15264
15264
|
if (typeSchemas.length === 1) {
|
|
15265
15265
|
return typeSchemas[0];
|
|
15266
15266
|
}
|
|
15267
|
-
return
|
|
15267
|
+
return z3.union(typeSchemas);
|
|
15268
15268
|
}
|
|
15269
15269
|
if (!type) {
|
|
15270
|
-
return
|
|
15270
|
+
return z3.any();
|
|
15271
15271
|
}
|
|
15272
15272
|
let zodSchema;
|
|
15273
15273
|
switch (type) {
|
|
15274
15274
|
case "string": {
|
|
15275
|
-
let stringSchema =
|
|
15275
|
+
let stringSchema = z3.string();
|
|
15276
15276
|
if (schema.format) {
|
|
15277
15277
|
const format = schema.format;
|
|
15278
15278
|
if (format === "email") {
|
|
15279
|
-
stringSchema = stringSchema.check(
|
|
15279
|
+
stringSchema = stringSchema.check(z3.email());
|
|
15280
15280
|
} else if (format === "uri" || format === "uri-reference") {
|
|
15281
|
-
stringSchema = stringSchema.check(
|
|
15281
|
+
stringSchema = stringSchema.check(z3.url());
|
|
15282
15282
|
} else if (format === "uuid" || format === "guid") {
|
|
15283
|
-
stringSchema = stringSchema.check(
|
|
15283
|
+
stringSchema = stringSchema.check(z3.uuid());
|
|
15284
15284
|
} else if (format === "date-time") {
|
|
15285
|
-
stringSchema = stringSchema.check(
|
|
15285
|
+
stringSchema = stringSchema.check(z3.iso.datetime());
|
|
15286
15286
|
} else if (format === "date") {
|
|
15287
|
-
stringSchema = stringSchema.check(
|
|
15287
|
+
stringSchema = stringSchema.check(z3.iso.date());
|
|
15288
15288
|
} else if (format === "time") {
|
|
15289
|
-
stringSchema = stringSchema.check(
|
|
15289
|
+
stringSchema = stringSchema.check(z3.iso.time());
|
|
15290
15290
|
} else if (format === "duration") {
|
|
15291
|
-
stringSchema = stringSchema.check(
|
|
15291
|
+
stringSchema = stringSchema.check(z3.iso.duration());
|
|
15292
15292
|
} else if (format === "ipv4") {
|
|
15293
|
-
stringSchema = stringSchema.check(
|
|
15293
|
+
stringSchema = stringSchema.check(z3.ipv4());
|
|
15294
15294
|
} else if (format === "ipv6") {
|
|
15295
|
-
stringSchema = stringSchema.check(
|
|
15295
|
+
stringSchema = stringSchema.check(z3.ipv6());
|
|
15296
15296
|
} else if (format === "mac") {
|
|
15297
|
-
stringSchema = stringSchema.check(
|
|
15297
|
+
stringSchema = stringSchema.check(z3.mac());
|
|
15298
15298
|
} else if (format === "cidr") {
|
|
15299
|
-
stringSchema = stringSchema.check(
|
|
15299
|
+
stringSchema = stringSchema.check(z3.cidrv4());
|
|
15300
15300
|
} else if (format === "cidr-v6") {
|
|
15301
|
-
stringSchema = stringSchema.check(
|
|
15301
|
+
stringSchema = stringSchema.check(z3.cidrv6());
|
|
15302
15302
|
} else if (format === "base64") {
|
|
15303
|
-
stringSchema = stringSchema.check(
|
|
15303
|
+
stringSchema = stringSchema.check(z3.base64());
|
|
15304
15304
|
} else if (format === "base64url") {
|
|
15305
|
-
stringSchema = stringSchema.check(
|
|
15305
|
+
stringSchema = stringSchema.check(z3.base64url());
|
|
15306
15306
|
} else if (format === "e164") {
|
|
15307
|
-
stringSchema = stringSchema.check(
|
|
15307
|
+
stringSchema = stringSchema.check(z3.e164());
|
|
15308
15308
|
} else if (format === "jwt") {
|
|
15309
|
-
stringSchema = stringSchema.check(
|
|
15309
|
+
stringSchema = stringSchema.check(z3.jwt());
|
|
15310
15310
|
} else if (format === "emoji") {
|
|
15311
|
-
stringSchema = stringSchema.check(
|
|
15311
|
+
stringSchema = stringSchema.check(z3.emoji());
|
|
15312
15312
|
} else if (format === "nanoid") {
|
|
15313
|
-
stringSchema = stringSchema.check(
|
|
15313
|
+
stringSchema = stringSchema.check(z3.nanoid());
|
|
15314
15314
|
} else if (format === "cuid") {
|
|
15315
|
-
stringSchema = stringSchema.check(
|
|
15315
|
+
stringSchema = stringSchema.check(z3.cuid());
|
|
15316
15316
|
} else if (format === "cuid2") {
|
|
15317
|
-
stringSchema = stringSchema.check(
|
|
15317
|
+
stringSchema = stringSchema.check(z3.cuid2());
|
|
15318
15318
|
} else if (format === "ulid") {
|
|
15319
|
-
stringSchema = stringSchema.check(
|
|
15319
|
+
stringSchema = stringSchema.check(z3.ulid());
|
|
15320
15320
|
} else if (format === "xid") {
|
|
15321
|
-
stringSchema = stringSchema.check(
|
|
15321
|
+
stringSchema = stringSchema.check(z3.xid());
|
|
15322
15322
|
} else if (format === "ksuid") {
|
|
15323
|
-
stringSchema = stringSchema.check(
|
|
15323
|
+
stringSchema = stringSchema.check(z3.ksuid());
|
|
15324
15324
|
}
|
|
15325
15325
|
}
|
|
15326
15326
|
if (typeof schema.minLength === "number") {
|
|
@@ -15337,7 +15337,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15337
15337
|
}
|
|
15338
15338
|
case "number":
|
|
15339
15339
|
case "integer": {
|
|
15340
|
-
let numberSchema = type === "integer" ?
|
|
15340
|
+
let numberSchema = type === "integer" ? z3.number().int() : z3.number();
|
|
15341
15341
|
if (typeof schema.minimum === "number") {
|
|
15342
15342
|
numberSchema = numberSchema.min(schema.minimum);
|
|
15343
15343
|
}
|
|
@@ -15361,11 +15361,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15361
15361
|
break;
|
|
15362
15362
|
}
|
|
15363
15363
|
case "boolean": {
|
|
15364
|
-
zodSchema =
|
|
15364
|
+
zodSchema = z3.boolean();
|
|
15365
15365
|
break;
|
|
15366
15366
|
}
|
|
15367
15367
|
case "null": {
|
|
15368
|
-
zodSchema =
|
|
15368
|
+
zodSchema = z3.null();
|
|
15369
15369
|
break;
|
|
15370
15370
|
}
|
|
15371
15371
|
case "object": {
|
|
@@ -15378,14 +15378,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15378
15378
|
}
|
|
15379
15379
|
if (schema.propertyNames) {
|
|
15380
15380
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
15381
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
15381
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z3.any();
|
|
15382
15382
|
if (Object.keys(shape).length === 0) {
|
|
15383
|
-
zodSchema =
|
|
15383
|
+
zodSchema = z3.record(keySchema, valueSchema);
|
|
15384
15384
|
break;
|
|
15385
15385
|
}
|
|
15386
|
-
const objectSchema2 =
|
|
15387
|
-
const recordSchema =
|
|
15388
|
-
zodSchema =
|
|
15386
|
+
const objectSchema2 = z3.object(shape).passthrough();
|
|
15387
|
+
const recordSchema = z3.looseRecord(keySchema, valueSchema);
|
|
15388
|
+
zodSchema = z3.intersection(objectSchema2, recordSchema);
|
|
15389
15389
|
break;
|
|
15390
15390
|
}
|
|
15391
15391
|
if (schema.patternProperties) {
|
|
@@ -15394,28 +15394,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15394
15394
|
const looseRecords = [];
|
|
15395
15395
|
for (const pattern of patternKeys) {
|
|
15396
15396
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
15397
|
-
const keySchema =
|
|
15398
|
-
looseRecords.push(
|
|
15397
|
+
const keySchema = z3.string().regex(new RegExp(pattern));
|
|
15398
|
+
looseRecords.push(z3.looseRecord(keySchema, patternValue));
|
|
15399
15399
|
}
|
|
15400
15400
|
const schemasToIntersect = [];
|
|
15401
15401
|
if (Object.keys(shape).length > 0) {
|
|
15402
|
-
schemasToIntersect.push(
|
|
15402
|
+
schemasToIntersect.push(z3.object(shape).passthrough());
|
|
15403
15403
|
}
|
|
15404
15404
|
schemasToIntersect.push(...looseRecords);
|
|
15405
15405
|
if (schemasToIntersect.length === 0) {
|
|
15406
|
-
zodSchema =
|
|
15406
|
+
zodSchema = z3.object({}).passthrough();
|
|
15407
15407
|
} else if (schemasToIntersect.length === 1) {
|
|
15408
15408
|
zodSchema = schemasToIntersect[0];
|
|
15409
15409
|
} else {
|
|
15410
|
-
let result =
|
|
15410
|
+
let result = z3.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
15411
15411
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
15412
|
-
result =
|
|
15412
|
+
result = z3.intersection(result, schemasToIntersect[i]);
|
|
15413
15413
|
}
|
|
15414
15414
|
zodSchema = result;
|
|
15415
15415
|
}
|
|
15416
15416
|
break;
|
|
15417
15417
|
}
|
|
15418
|
-
const objectSchema =
|
|
15418
|
+
const objectSchema = z3.object(shape);
|
|
15419
15419
|
if (schema.additionalProperties === false) {
|
|
15420
15420
|
zodSchema = objectSchema.strict();
|
|
15421
15421
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -15432,33 +15432,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15432
15432
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
15433
15433
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
15434
15434
|
if (rest) {
|
|
15435
|
-
zodSchema =
|
|
15435
|
+
zodSchema = z3.tuple(tupleItems).rest(rest);
|
|
15436
15436
|
} else {
|
|
15437
|
-
zodSchema =
|
|
15437
|
+
zodSchema = z3.tuple(tupleItems);
|
|
15438
15438
|
}
|
|
15439
15439
|
if (typeof schema.minItems === "number") {
|
|
15440
|
-
zodSchema = zodSchema.check(
|
|
15440
|
+
zodSchema = zodSchema.check(z3.minLength(schema.minItems));
|
|
15441
15441
|
}
|
|
15442
15442
|
if (typeof schema.maxItems === "number") {
|
|
15443
|
-
zodSchema = zodSchema.check(
|
|
15443
|
+
zodSchema = zodSchema.check(z3.maxLength(schema.maxItems));
|
|
15444
15444
|
}
|
|
15445
15445
|
} else if (Array.isArray(items)) {
|
|
15446
15446
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
15447
15447
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
15448
15448
|
if (rest) {
|
|
15449
|
-
zodSchema =
|
|
15449
|
+
zodSchema = z3.tuple(tupleItems).rest(rest);
|
|
15450
15450
|
} else {
|
|
15451
|
-
zodSchema =
|
|
15451
|
+
zodSchema = z3.tuple(tupleItems);
|
|
15452
15452
|
}
|
|
15453
15453
|
if (typeof schema.minItems === "number") {
|
|
15454
|
-
zodSchema = zodSchema.check(
|
|
15454
|
+
zodSchema = zodSchema.check(z3.minLength(schema.minItems));
|
|
15455
15455
|
}
|
|
15456
15456
|
if (typeof schema.maxItems === "number") {
|
|
15457
|
-
zodSchema = zodSchema.check(
|
|
15457
|
+
zodSchema = zodSchema.check(z3.maxLength(schema.maxItems));
|
|
15458
15458
|
}
|
|
15459
15459
|
} else if (items !== void 0) {
|
|
15460
15460
|
const element = convertSchema(items, ctx);
|
|
15461
|
-
let arraySchema =
|
|
15461
|
+
let arraySchema = z3.array(element);
|
|
15462
15462
|
if (typeof schema.minItems === "number") {
|
|
15463
15463
|
arraySchema = arraySchema.min(schema.minItems);
|
|
15464
15464
|
}
|
|
@@ -15467,7 +15467,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15467
15467
|
}
|
|
15468
15468
|
zodSchema = arraySchema;
|
|
15469
15469
|
} else {
|
|
15470
|
-
zodSchema =
|
|
15470
|
+
zodSchema = z3.array(z3.any());
|
|
15471
15471
|
}
|
|
15472
15472
|
break;
|
|
15473
15473
|
}
|
|
@@ -15480,37 +15480,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15480
15480
|
__name2(convertBaseSchema, "convertBaseSchema");
|
|
15481
15481
|
function convertSchema(schema, ctx) {
|
|
15482
15482
|
if (typeof schema === "boolean") {
|
|
15483
|
-
return schema ?
|
|
15483
|
+
return schema ? z3.any() : z3.never();
|
|
15484
15484
|
}
|
|
15485
15485
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
15486
15486
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
15487
15487
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
15488
15488
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
15489
|
-
const anyOfUnion =
|
|
15490
|
-
baseSchema = hasExplicitType ?
|
|
15489
|
+
const anyOfUnion = z3.union(options);
|
|
15490
|
+
baseSchema = hasExplicitType ? z3.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
15491
15491
|
}
|
|
15492
15492
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
15493
15493
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
15494
|
-
const oneOfUnion =
|
|
15495
|
-
baseSchema = hasExplicitType ?
|
|
15494
|
+
const oneOfUnion = z3.xor(options);
|
|
15495
|
+
baseSchema = hasExplicitType ? z3.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
15496
15496
|
}
|
|
15497
15497
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
15498
15498
|
if (schema.allOf.length === 0) {
|
|
15499
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
15499
|
+
baseSchema = hasExplicitType ? baseSchema : z3.any();
|
|
15500
15500
|
} else {
|
|
15501
15501
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
15502
15502
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
15503
15503
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
15504
|
-
result =
|
|
15504
|
+
result = z3.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
15505
15505
|
}
|
|
15506
15506
|
baseSchema = result;
|
|
15507
15507
|
}
|
|
15508
15508
|
}
|
|
15509
15509
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
15510
|
-
baseSchema =
|
|
15510
|
+
baseSchema = z3.nullable(baseSchema);
|
|
15511
15511
|
}
|
|
15512
15512
|
if (schema.readOnly === true) {
|
|
15513
|
-
baseSchema =
|
|
15513
|
+
baseSchema = z3.readonly(baseSchema);
|
|
15514
15514
|
}
|
|
15515
15515
|
if (schema.default !== void 0) {
|
|
15516
15516
|
baseSchema = baseSchema.default(schema.default);
|
|
@@ -15545,7 +15545,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15545
15545
|
__name2(convertSchema, "convertSchema");
|
|
15546
15546
|
function fromJSONSchema(schema, params) {
|
|
15547
15547
|
if (typeof schema === "boolean") {
|
|
15548
|
-
return schema ?
|
|
15548
|
+
return schema ? z3.any() : z3.never();
|
|
15549
15549
|
}
|
|
15550
15550
|
let normalized;
|
|
15551
15551
|
try {
|
|
@@ -16270,7 +16270,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16270
16270
|
did: LCNProfileValidator.shape.did
|
|
16271
16271
|
});
|
|
16272
16272
|
var LCNConnectionProfileValidator = LCNAuthedProfileValidator.extend({
|
|
16273
|
-
email: LCNProfileValidator.shape.email
|
|
16273
|
+
email: LCNProfileValidator.shape.email,
|
|
16274
|
+
connectedAt: external_exports.iso.datetime().optional().describe("When the viewer and this profile became connected.")
|
|
16274
16275
|
});
|
|
16275
16276
|
var LCNVisibleProfileValidator = external_exports.union([
|
|
16276
16277
|
LCNConnectionProfileValidator.strict(),
|
|
@@ -17914,11 +17915,21 @@ var generateSrcSet3 = /* @__PURE__ */ __name((url, resolutions, { fix = false }
|
|
|
17914
17915
|
|
|
17915
17916
|
// src/images/images.helpers.ts
|
|
17916
17917
|
var Providers = { filestack: filestack_helpers_exports, unsplash: unsplash_helpers_exports, discord: discord_helpers_exports };
|
|
17918
|
+
var isHostnameMatch = /* @__PURE__ */ __name((hostname, target) => {
|
|
17919
|
+
return hostname === target || hostname.endsWith(`.${target}`);
|
|
17920
|
+
}, "isHostnameMatch");
|
|
17917
17921
|
var getProvider = /* @__PURE__ */ __name((url) => {
|
|
17918
|
-
if (url
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
+
if (!url) return null;
|
|
17923
|
+
try {
|
|
17924
|
+
const normalizedUrl = url.startsWith("//") ? `https:${url}` : url;
|
|
17925
|
+
const { hostname } = new URL(normalizedUrl);
|
|
17926
|
+
if (isHostnameMatch(hostname, "cdn.filestackcontent.com")) return "filestack";
|
|
17927
|
+
if (isHostnameMatch(hostname, "images.unsplash.com")) return "unsplash";
|
|
17928
|
+
if (isHostnameMatch(hostname, "cdn.discordapp.com")) return "discord";
|
|
17929
|
+
return null;
|
|
17930
|
+
} catch {
|
|
17931
|
+
return null;
|
|
17932
|
+
}
|
|
17922
17933
|
}, "getProvider");
|
|
17923
17934
|
var changeQuality4 = /* @__PURE__ */ __name((url, quality) => {
|
|
17924
17935
|
const provider = getProvider(url);
|
|
@@ -17949,6 +17960,30 @@ var getUrlsFromSrcSet = /* @__PURE__ */ __name((srcSet) => {
|
|
|
17949
17960
|
}, []);
|
|
17950
17961
|
}, "getUrlsFromSrcSet");
|
|
17951
17962
|
|
|
17963
|
+
// src/images/sanitize.helpers.ts
|
|
17964
|
+
var sanitizeImageUrl = /* @__PURE__ */ __name((url, options = {}) => {
|
|
17965
|
+
if (!url) return void 0;
|
|
17966
|
+
const { allowBlobUrls = false, allowDataUrls = false } = options;
|
|
17967
|
+
try {
|
|
17968
|
+
const parsed = new URL(url);
|
|
17969
|
+
if (parsed.protocol === "https:" || parsed.protocol === "http:") {
|
|
17970
|
+
return parsed.href;
|
|
17971
|
+
}
|
|
17972
|
+
if (allowBlobUrls && parsed.protocol === "blob:") {
|
|
17973
|
+
return parsed.href;
|
|
17974
|
+
}
|
|
17975
|
+
if (allowDataUrls && parsed.protocol === "data:") {
|
|
17976
|
+
if (url.startsWith("data:image/")) {
|
|
17977
|
+
return url;
|
|
17978
|
+
}
|
|
17979
|
+
return void 0;
|
|
17980
|
+
}
|
|
17981
|
+
return void 0;
|
|
17982
|
+
} catch {
|
|
17983
|
+
return void 0;
|
|
17984
|
+
}
|
|
17985
|
+
}, "sanitizeImageUrl");
|
|
17986
|
+
|
|
17952
17987
|
// src/types/index.ts
|
|
17953
17988
|
var isNotMaybe = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null, "isNotMaybe");
|
|
17954
17989
|
var filterMaybes = /* @__PURE__ */ __name((array) => array?.filter(isNotMaybe) ?? [], "filterMaybes");
|
|
@@ -18527,6 +18562,56 @@ var getDidWeb = /* @__PURE__ */ __name((domain, profileId) => {
|
|
|
18527
18562
|
return `did:web:${encodeURIComponent(decodedDomain)}:users:${profileId}`;
|
|
18528
18563
|
}, "getDidWeb");
|
|
18529
18564
|
|
|
18565
|
+
// src/environment.ts
|
|
18566
|
+
import { z as z2 } from "zod";
|
|
18567
|
+
var EnvironmentConfigurationError = class extends Error {
|
|
18568
|
+
static {
|
|
18569
|
+
__name(this, "EnvironmentConfigurationError");
|
|
18570
|
+
}
|
|
18571
|
+
constructor(message) {
|
|
18572
|
+
super(message);
|
|
18573
|
+
this.name = "EnvironmentConfigurationError";
|
|
18574
|
+
}
|
|
18575
|
+
};
|
|
18576
|
+
var requiredEnvironmentString = z2.string().trim().min(1, "Required but missing");
|
|
18577
|
+
var optionalEnvironmentString = z2.preprocess(
|
|
18578
|
+
(value) => value === "" ? void 0 : value,
|
|
18579
|
+
requiredEnvironmentString.optional()
|
|
18580
|
+
);
|
|
18581
|
+
var optionalEnvironmentUrl = z2.preprocess(
|
|
18582
|
+
(value) => value === "" ? void 0 : value,
|
|
18583
|
+
z2.url("Expected a valid URL").optional()
|
|
18584
|
+
);
|
|
18585
|
+
var environmentBoolean = z2.enum(["true", "false", "1", "0"]).transform((value) => value === "true" || value === "1");
|
|
18586
|
+
var optionalEnvironmentBoolean = z2.preprocess(
|
|
18587
|
+
(value) => value === "" || value === void 0 ? void 0 : value,
|
|
18588
|
+
environmentBoolean.optional()
|
|
18589
|
+
);
|
|
18590
|
+
var environmentPort = z2.coerce.number().int().min(1).max(65535);
|
|
18591
|
+
var optionalEnvironmentPort = z2.preprocess(
|
|
18592
|
+
(value) => value === "" || value === void 0 ? void 0 : value,
|
|
18593
|
+
environmentPort.optional()
|
|
18594
|
+
);
|
|
18595
|
+
var parseEnvironment = /* @__PURE__ */ __name((schema, raw, context) => {
|
|
18596
|
+
const result = schema.safeParse(raw);
|
|
18597
|
+
if (result.success) return result.data;
|
|
18598
|
+
const issues = result.error.issues.map((issue) => {
|
|
18599
|
+
const key = issue.path.length ? issue.path.map(String).join(".") : "(environment)";
|
|
18600
|
+
return `${key}
|
|
18601
|
+
${issue.message}`;
|
|
18602
|
+
}).join("\n\n");
|
|
18603
|
+
throw new EnvironmentConfigurationError(
|
|
18604
|
+
[
|
|
18605
|
+
`Invalid ${context.project} configuration`,
|
|
18606
|
+
"",
|
|
18607
|
+
issues,
|
|
18608
|
+
"",
|
|
18609
|
+
`Configuration source: ${context.source}`,
|
|
18610
|
+
`Copy ${context.examplePath} to .env and correct the values above.`
|
|
18611
|
+
].join("\n")
|
|
18612
|
+
);
|
|
18613
|
+
}, "parseEnvironment");
|
|
18614
|
+
|
|
18530
18615
|
// src/index.ts
|
|
18531
18616
|
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
18532
18617
|
var isEncrypted = /* @__PURE__ */ __name((item) => {
|
|
@@ -18558,12 +18643,9 @@ var RegExpTransformer = {
|
|
|
18558
18643
|
}
|
|
18559
18644
|
};
|
|
18560
18645
|
var isVC2Format = /* @__PURE__ */ __name((credential) => {
|
|
18561
|
-
if (!credential
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
return credential["@context"].some(
|
|
18565
|
-
(context) => context === "https://www.w3.org/ns/credentials/v2"
|
|
18566
|
-
);
|
|
18646
|
+
if (!credential || typeof credential !== "object" || !("@context" in credential)) return false;
|
|
18647
|
+
const context = credential["@context"];
|
|
18648
|
+
return Array.isArray(context) ? context.some((value) => value === "https://www.w3.org/ns/credentials/v2") : context === "https://www.w3.org/ns/credentials/v2";
|
|
18567
18649
|
}, "isVC2Format");
|
|
18568
18650
|
var unwrapBoostCredential = /* @__PURE__ */ __name((vc) => {
|
|
18569
18651
|
if (vc?.type?.includes("CertifiedBoostCredential") && vc?.boostCredential) {
|
|
@@ -18580,6 +18662,7 @@ var isAppDidWeb = /* @__PURE__ */ __name((did) => {
|
|
|
18580
18662
|
export {
|
|
18581
18663
|
AGE_RATING_TO_MIN_AGE,
|
|
18582
18664
|
DEFAULT_RESOLUTIONS,
|
|
18665
|
+
EnvironmentConfigurationError,
|
|
18583
18666
|
ImageResizingValidator,
|
|
18584
18667
|
ImageUploadingValidator,
|
|
18585
18668
|
ImageWithLoadingStateValdator,
|
|
@@ -18597,6 +18680,8 @@ export {
|
|
|
18597
18680
|
deriveNameFromVct,
|
|
18598
18681
|
deriveSdJwtIssuedAtIso,
|
|
18599
18682
|
deriveTypeFromVct,
|
|
18683
|
+
environmentBoolean,
|
|
18684
|
+
environmentPort,
|
|
18600
18685
|
extractVctSegment,
|
|
18601
18686
|
filterMaybes,
|
|
18602
18687
|
filterUndefined,
|
|
@@ -18622,10 +18707,17 @@ export {
|
|
|
18622
18707
|
isNotMaybe,
|
|
18623
18708
|
isNotUndefined,
|
|
18624
18709
|
isVC2Format,
|
|
18710
|
+
optionalEnvironmentBoolean,
|
|
18711
|
+
optionalEnvironmentPort,
|
|
18712
|
+
optionalEnvironmentString,
|
|
18713
|
+
optionalEnvironmentUrl,
|
|
18714
|
+
parseEnvironment,
|
|
18625
18715
|
projectEnvelopeToDisplayVc,
|
|
18626
18716
|
quantizeValue,
|
|
18717
|
+
requiredEnvironmentString,
|
|
18627
18718
|
resizeAndChangeQuality4 as resizeAndChangeQuality,
|
|
18628
18719
|
resolveStorageReadResult,
|
|
18720
|
+
sanitizeImageUrl,
|
|
18629
18721
|
setBitstringStatusListBit,
|
|
18630
18722
|
stripSdJwtReservedClaims,
|
|
18631
18723
|
synthesizeDidJwk,
|