@learncard/helpers 1.0.14 → 1.0.16
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/helpers.cjs.development.js +78 -46
- package/dist/helpers.cjs.development.js.map +3 -3
- package/dist/helpers.cjs.production.min.js +1 -1
- package/dist/helpers.cjs.production.min.js.map +3 -3
- package/dist/helpers.d.ts +142 -10
- package/dist/helpers.esm.js +78 -46
- package/dist/helpers.esm.js.map +3 -3
- package/package.json +2 -2
package/dist/helpers.d.ts
CHANGED
@@ -1,13 +1,136 @@
|
|
1
|
-
// Generated by dts-bundle-generator v6.
|
1
|
+
// Generated by dts-bundle-generator v6.13.0
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
declare const JWEValidator: z.ZodObject<{
|
4
|
+
protected: z.ZodString;
|
5
|
+
iv: z.ZodString;
|
6
|
+
ciphertext: z.ZodString;
|
7
|
+
tag: z.ZodString;
|
8
|
+
aad: z.ZodOptional<z.ZodString>;
|
9
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
10
|
+
header: z.ZodObject<{
|
11
|
+
alg: z.ZodString;
|
12
|
+
iv: z.ZodString;
|
13
|
+
tag: z.ZodString;
|
14
|
+
epk: z.ZodOptional<z.ZodObject<{
|
15
|
+
kty: z.ZodOptional<z.ZodString>;
|
16
|
+
crv: z.ZodOptional<z.ZodString>;
|
17
|
+
x: z.ZodOptional<z.ZodString>;
|
18
|
+
y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
19
|
+
n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
20
|
+
d: z.ZodOptional<z.ZodString>;
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
22
|
+
kty?: string | undefined;
|
23
|
+
crv?: string | undefined;
|
24
|
+
x?: string | undefined;
|
25
|
+
y?: string | undefined;
|
26
|
+
n?: string | undefined;
|
27
|
+
d?: string | undefined;
|
28
|
+
}, {
|
29
|
+
kty?: string | undefined;
|
30
|
+
crv?: string | undefined;
|
31
|
+
x?: string | undefined;
|
32
|
+
y?: string | undefined;
|
33
|
+
n?: string | undefined;
|
34
|
+
d?: string | undefined;
|
35
|
+
}>>;
|
36
|
+
kid: z.ZodOptional<z.ZodString>;
|
37
|
+
apv: z.ZodOptional<z.ZodString>;
|
38
|
+
apu: z.ZodOptional<z.ZodString>;
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
40
|
+
epk?: {
|
41
|
+
kty?: string | undefined;
|
42
|
+
crv?: string | undefined;
|
43
|
+
x?: string | undefined;
|
44
|
+
y?: string | undefined;
|
45
|
+
n?: string | undefined;
|
46
|
+
d?: string | undefined;
|
47
|
+
} | undefined;
|
48
|
+
kid?: string | undefined;
|
49
|
+
apv?: string | undefined;
|
50
|
+
apu?: string | undefined;
|
51
|
+
alg: string;
|
52
|
+
iv: string;
|
53
|
+
tag: string;
|
54
|
+
}, {
|
55
|
+
epk?: {
|
56
|
+
kty?: string | undefined;
|
57
|
+
crv?: string | undefined;
|
58
|
+
x?: string | undefined;
|
59
|
+
y?: string | undefined;
|
60
|
+
n?: string | undefined;
|
61
|
+
d?: string | undefined;
|
62
|
+
} | undefined;
|
63
|
+
kid?: string | undefined;
|
64
|
+
apv?: string | undefined;
|
65
|
+
apu?: string | undefined;
|
66
|
+
alg: string;
|
67
|
+
iv: string;
|
68
|
+
tag: string;
|
69
|
+
}>;
|
70
|
+
encrypted_key: z.ZodString;
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
72
|
+
header: {
|
73
|
+
epk?: {
|
74
|
+
kty?: string | undefined;
|
75
|
+
crv?: string | undefined;
|
76
|
+
x?: string | undefined;
|
77
|
+
y?: string | undefined;
|
78
|
+
n?: string | undefined;
|
79
|
+
d?: string | undefined;
|
80
|
+
} | undefined;
|
81
|
+
kid?: string | undefined;
|
82
|
+
apv?: string | undefined;
|
83
|
+
apu?: string | undefined;
|
84
|
+
alg: string;
|
85
|
+
iv: string;
|
86
|
+
tag: string;
|
87
|
+
};
|
88
|
+
encrypted_key: string;
|
89
|
+
}, {
|
90
|
+
header: {
|
91
|
+
epk?: {
|
92
|
+
kty?: string | undefined;
|
93
|
+
crv?: string | undefined;
|
94
|
+
x?: string | undefined;
|
95
|
+
y?: string | undefined;
|
96
|
+
n?: string | undefined;
|
97
|
+
d?: string | undefined;
|
98
|
+
} | undefined;
|
99
|
+
kid?: string | undefined;
|
100
|
+
apv?: string | undefined;
|
101
|
+
apu?: string | undefined;
|
102
|
+
alg: string;
|
103
|
+
iv: string;
|
104
|
+
tag: string;
|
105
|
+
};
|
106
|
+
encrypted_key: string;
|
107
|
+
}>, "many">>;
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
109
|
+
aad?: string | undefined;
|
110
|
+
recipients?: {
|
111
|
+
header: {
|
112
|
+
epk?: {
|
113
|
+
kty?: string | undefined;
|
114
|
+
crv?: string | undefined;
|
115
|
+
x?: string | undefined;
|
116
|
+
y?: string | undefined;
|
117
|
+
n?: string | undefined;
|
118
|
+
d?: string | undefined;
|
119
|
+
} | undefined;
|
120
|
+
kid?: string | undefined;
|
121
|
+
apv?: string | undefined;
|
122
|
+
apu?: string | undefined;
|
123
|
+
alg: string;
|
124
|
+
iv: string;
|
125
|
+
tag: string;
|
126
|
+
};
|
127
|
+
encrypted_key: string;
|
128
|
+
}[] | undefined;
|
129
|
+
iv: string;
|
130
|
+
tag: string;
|
131
|
+
protected: string;
|
132
|
+
ciphertext: string;
|
133
|
+
}, {
|
11
134
|
aad?: string | undefined;
|
12
135
|
recipients?: {
|
13
136
|
header: {
|
@@ -32,6 +155,15 @@ export declare const isEncrypted: (item: Record<string, any>) => item is {
|
|
32
155
|
tag: string;
|
33
156
|
protected: string;
|
34
157
|
ciphertext: string;
|
35
|
-
}
|
158
|
+
}>;
|
159
|
+
export type JWE = z.infer<typeof JWEValidator>;
|
160
|
+
/**
|
161
|
+
* Determines whether or not a string is a valid hexadecimal string
|
162
|
+
*
|
163
|
+
* E.g. 'abc123' is valid hex, 'zzz' is not
|
164
|
+
*/
|
165
|
+
export declare const isHex: (str: string) => boolean;
|
166
|
+
/** Determines whether or not an object is an encrypted JWE */
|
167
|
+
export declare const isEncrypted: (item: Record<string, any>) => item is JWE;
|
36
168
|
|
37
169
|
export {};
|
package/dist/helpers.esm.js
CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
}
|
17
17
|
return to;
|
18
18
|
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
20
23
|
|
21
24
|
// ../learn-card-types/dist/types.cjs.development.js
|
22
25
|
var require_types_cjs_development = __commonJS({
|
@@ -50,6 +53,7 @@ var require_types_cjs_development = __commonJS({
|
|
50
53
|
AddressValidator: () => AddressValidator,
|
51
54
|
AlignmentTargetTypeValidator: () => AlignmentTargetTypeValidator,
|
52
55
|
AlignmentValidator: () => AlignmentValidator,
|
56
|
+
BoostPermissionsValidator: () => BoostPermissionsValidator,
|
53
57
|
BoostRecipientValidator: () => BoostRecipientValidator,
|
54
58
|
BoostValidator: () => BoostValidator,
|
55
59
|
ConsentFlowContractDataValidator: () => ConsentFlowContractDataValidator,
|
@@ -900,11 +904,14 @@ var require_types_cjs_development = __commonJS({
|
|
900
904
|
const parsedType = this._getType(input);
|
901
905
|
if (parsedType !== ZodParsedType.string) {
|
902
906
|
const ctx2 = this._getOrReturnCtx(input);
|
903
|
-
addIssueToContext(
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
907
|
+
addIssueToContext(
|
908
|
+
ctx2,
|
909
|
+
{
|
910
|
+
code: ZodIssueCode.invalid_type,
|
911
|
+
expected: ZodParsedType.string,
|
912
|
+
received: ctx2.parsedType
|
913
|
+
}
|
914
|
+
);
|
908
915
|
return INVALID;
|
909
916
|
}
|
910
917
|
const status = new ParseStatus();
|
@@ -1912,7 +1919,9 @@ var require_types_cjs_development = __commonJS({
|
|
1912
1919
|
const value = ctx.data[key];
|
1913
1920
|
pairs.push({
|
1914
1921
|
key: { status: "valid", value: key },
|
1915
|
-
value: catchall._parse(
|
1922
|
+
value: catchall._parse(
|
1923
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1924
|
+
),
|
1916
1925
|
alwaysSet: key in ctx.data
|
1917
1926
|
});
|
1918
1927
|
}
|
@@ -3467,11 +3476,13 @@ var require_types_cjs_development = __commonJS({
|
|
3467
3476
|
type: mod.string().optional(),
|
3468
3477
|
narrative: mod.string().optional()
|
3469
3478
|
});
|
3470
|
-
var ImageValidator = mod.string().or(
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3479
|
+
var ImageValidator = mod.string().or(
|
3480
|
+
mod.object({
|
3481
|
+
id: mod.string(),
|
3482
|
+
type: mod.string(),
|
3483
|
+
caption: mod.string().optional()
|
3484
|
+
})
|
3485
|
+
);
|
3475
3486
|
var GeoCoordinatesValidator = mod.object({
|
3476
3487
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3477
3488
|
latitude: mod.number(),
|
@@ -3513,29 +3524,31 @@ var require_types_cjs_development = __commonJS({
|
|
3513
3524
|
identifier: mod.string(),
|
3514
3525
|
identifierType: IdentifierTypeValidator
|
3515
3526
|
});
|
3516
|
-
var ProfileValidator = mod.string().or(
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
|
3525
|
-
|
3526
|
-
|
3527
|
-
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3527
|
+
var ProfileValidator = mod.string().or(
|
3528
|
+
mod.object({
|
3529
|
+
id: mod.string().optional(),
|
3530
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3531
|
+
name: mod.string().optional(),
|
3532
|
+
url: mod.string().optional(),
|
3533
|
+
phone: mod.string().optional(),
|
3534
|
+
description: mod.string().optional(),
|
3535
|
+
endorsement: mod.any().array().optional(),
|
3536
|
+
image: ImageValidator.optional(),
|
3537
|
+
email: mod.string().email().optional(),
|
3538
|
+
address: AddressValidator.optional(),
|
3539
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3540
|
+
official: mod.string().optional(),
|
3541
|
+
parentOrg: mod.any().optional(),
|
3542
|
+
familyName: mod.string().optional(),
|
3543
|
+
givenName: mod.string().optional(),
|
3544
|
+
additionalName: mod.string().optional(),
|
3545
|
+
patronymicName: mod.string().optional(),
|
3546
|
+
honorificPrefix: mod.string().optional(),
|
3547
|
+
honorificSuffix: mod.string().optional(),
|
3548
|
+
familyNamePrefix: mod.string().optional(),
|
3549
|
+
dateOfBirth: mod.string().optional()
|
3550
|
+
}).catchall(mod.any())
|
3551
|
+
);
|
3539
3552
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3540
3553
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
3541
3554
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
@@ -3604,15 +3617,17 @@ var require_types_cjs_development = __commonJS({
|
|
3604
3617
|
aad: mod.string().optional(),
|
3605
3618
|
recipients: JWERecipientValidator.array().optional()
|
3606
3619
|
});
|
3607
|
-
var VerificationMethodValidator = mod.string().or(
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3620
|
+
var VerificationMethodValidator = mod.string().or(
|
3621
|
+
mod.object({
|
3622
|
+
"@context": ContextValidator.optional(),
|
3623
|
+
id: mod.string(),
|
3624
|
+
type: mod.string(),
|
3625
|
+
controller: mod.string(),
|
3626
|
+
publicKeyJwk: JWKValidator.optional(),
|
3627
|
+
publicKeyBase58: mod.string().optional(),
|
3628
|
+
blockChainAccountId: mod.string().optional()
|
3629
|
+
}).catchall(mod.any())
|
3630
|
+
);
|
3616
3631
|
var ServiceValidator = mod.object({
|
3617
3632
|
id: mod.string(),
|
3618
3633
|
type: mod.string().or(mod.string().array().nonempty()),
|
@@ -3810,7 +3825,9 @@ var require_types_cjs_development = __commonJS({
|
|
3810
3825
|
name: mod.string().optional(),
|
3811
3826
|
description: mod.string().optional(),
|
3812
3827
|
image: ImageValidator.optional(),
|
3813
|
-
credentialSubject: AchievementSubjectValidator.or(
|
3828
|
+
credentialSubject: AchievementSubjectValidator.or(
|
3829
|
+
AchievementSubjectValidator.array()
|
3830
|
+
),
|
3814
3831
|
endorsement: UnsignedVCValidator.array().optional(),
|
3815
3832
|
evidence: EvidenceValidator.array().optional()
|
3816
3833
|
});
|
@@ -3916,6 +3933,19 @@ var require_types_cjs_development = __commonJS({
|
|
3916
3933
|
ttlSeconds: mod.number().optional(),
|
3917
3934
|
totalUses: mod.number().optional()
|
3918
3935
|
});
|
3936
|
+
var BoostPermissionsValidator = mod.object({
|
3937
|
+
role: mod.string(),
|
3938
|
+
canEdit: mod.boolean(),
|
3939
|
+
canIssue: mod.boolean(),
|
3940
|
+
canRevoke: mod.boolean(),
|
3941
|
+
canManagePermissions: mod.boolean(),
|
3942
|
+
canIssueChildren: mod.string(),
|
3943
|
+
canCreateChildren: mod.string(),
|
3944
|
+
canEditChildren: mod.string(),
|
3945
|
+
canRevokeChildren: mod.string(),
|
3946
|
+
canManageChildrenPermissions: mod.string(),
|
3947
|
+
canViewAnalytics: mod.boolean()
|
3948
|
+
});
|
3919
3949
|
var LCNSigningAuthorityValidator = mod.object({
|
3920
3950
|
endpoint: mod.string()
|
3921
3951
|
});
|
@@ -4039,7 +4069,9 @@ var require_types_cjs_development = __commonJS({
|
|
4039
4069
|
]);
|
4040
4070
|
var ConsentFlowTransactionsQueryValidator = mod.object({
|
4041
4071
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
4042
|
-
action: ConsentFlowTransactionActionValidator.or(
|
4072
|
+
action: ConsentFlowTransactionActionValidator.or(
|
4073
|
+
ConsentFlowTransactionActionValidator.array()
|
4074
|
+
).optional(),
|
4043
4075
|
date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
4044
4076
|
expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
4045
4077
|
oneTime: mod.boolean().optional()
|