@learncard/learn-cloud-plugin 2.0.7 → 2.0.9
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/learn-cloud-plugin.cjs.development.js +363 -171
- package/dist/learn-cloud-plugin.cjs.development.js.map +4 -4
- package/dist/learn-cloud-plugin.cjs.production.min.js +16 -16
- package/dist/learn-cloud-plugin.cjs.production.min.js.map +4 -4
- package/dist/learn-cloud-plugin.esm.js +362 -171
- package/dist/learn-cloud-plugin.esm.js.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,7 +21,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
21
|
}
|
|
21
22
|
return to;
|
|
22
23
|
};
|
|
23
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
24
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
25
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
26
|
+
mod2
|
|
27
|
+
));
|
|
24
28
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
25
29
|
|
|
26
30
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
|
|
@@ -778,7 +782,9 @@ var require_lodash = __commonJS({
|
|
|
778
782
|
var nativeObjectToString = objectProto.toString;
|
|
779
783
|
var objectCtorString = funcToString.call(Object2);
|
|
780
784
|
var oldDash = root._;
|
|
781
|
-
var reIsNative = RegExp2(
|
|
785
|
+
var reIsNative = RegExp2(
|
|
786
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
787
|
+
);
|
|
782
788
|
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
|
|
783
789
|
var defineProperty = function() {
|
|
784
790
|
try {
|
|
@@ -2407,7 +2413,18 @@ var require_lodash = __commonJS({
|
|
|
2407
2413
|
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
|
|
2408
2414
|
length -= holders.length;
|
|
2409
2415
|
if (length < arity) {
|
|
2410
|
-
return createRecurry(
|
|
2416
|
+
return createRecurry(
|
|
2417
|
+
func,
|
|
2418
|
+
bitmask,
|
|
2419
|
+
createHybrid,
|
|
2420
|
+
wrapper.placeholder,
|
|
2421
|
+
undefined2,
|
|
2422
|
+
args,
|
|
2423
|
+
holders,
|
|
2424
|
+
undefined2,
|
|
2425
|
+
undefined2,
|
|
2426
|
+
arity - length
|
|
2427
|
+
);
|
|
2411
2428
|
}
|
|
2412
2429
|
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
2413
2430
|
return apply(fn, this, args);
|
|
@@ -2489,7 +2506,18 @@ var require_lodash = __commonJS({
|
|
|
2489
2506
|
length -= holdersCount;
|
|
2490
2507
|
if (isCurried && length < arity) {
|
|
2491
2508
|
var newHolders = replaceHolders(args, placeholder);
|
|
2492
|
-
return createRecurry(
|
|
2509
|
+
return createRecurry(
|
|
2510
|
+
func,
|
|
2511
|
+
bitmask,
|
|
2512
|
+
createHybrid,
|
|
2513
|
+
wrapper.placeholder,
|
|
2514
|
+
thisArg,
|
|
2515
|
+
args,
|
|
2516
|
+
newHolders,
|
|
2517
|
+
argPos,
|
|
2518
|
+
ary2,
|
|
2519
|
+
arity - length
|
|
2520
|
+
);
|
|
2493
2521
|
}
|
|
2494
2522
|
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
|
|
2495
2523
|
length = args.length;
|
|
@@ -5056,7 +5084,10 @@ var require_lodash = __commonJS({
|
|
|
5056
5084
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
5057
5085
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
5058
5086
|
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
5059
|
-
var reDelimiters = RegExp2(
|
|
5087
|
+
var reDelimiters = RegExp2(
|
|
5088
|
+
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
|
|
5089
|
+
"g"
|
|
5090
|
+
);
|
|
5060
5091
|
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
5061
5092
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
5062
5093
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
@@ -5924,9 +5955,9 @@ var require_lodash = __commonJS({
|
|
|
5924
5955
|
}
|
|
5925
5956
|
});
|
|
5926
5957
|
|
|
5927
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5958
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/defaults.js
|
|
5928
5959
|
var require_defaults = __commonJS({
|
|
5929
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5960
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/defaults.js"(exports, module2) {
|
|
5930
5961
|
module2.exports = {
|
|
5931
5962
|
space: "",
|
|
5932
5963
|
cycles: false,
|
|
@@ -5936,9 +5967,9 @@ var require_defaults = __commonJS({
|
|
|
5936
5967
|
}
|
|
5937
5968
|
});
|
|
5938
5969
|
|
|
5939
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5970
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/util.js
|
|
5940
5971
|
var require_util = __commonJS({
|
|
5941
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5972
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/util.js"(exports, module2) {
|
|
5942
5973
|
"use strict";
|
|
5943
5974
|
module2.exports = {
|
|
5944
5975
|
isArray: Array.isArray,
|
|
@@ -5952,9 +5983,9 @@ var require_util = __commonJS({
|
|
|
5952
5983
|
}
|
|
5953
5984
|
});
|
|
5954
5985
|
|
|
5955
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5986
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/index.js
|
|
5956
5987
|
var require_lib = __commonJS({
|
|
5957
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5988
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/index.js"(exports, module2) {
|
|
5958
5989
|
"use strict";
|
|
5959
5990
|
var DEFAULTS = require_defaults();
|
|
5960
5991
|
var isFunction2 = require_util().isFunction;
|
|
@@ -7269,7 +7300,10 @@ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
|
7269
7300
|
}
|
|
7270
7301
|
return to;
|
|
7271
7302
|
}, "__copyProps");
|
|
7272
|
-
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
7303
|
+
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
7304
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp3(target, "default", { value: mod2, enumerable: true }) : target,
|
|
7305
|
+
mod2
|
|
7306
|
+
)), "__toESM");
|
|
7273
7307
|
var require_types_cjs_development = __commonJS2({
|
|
7274
7308
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module2) {
|
|
7275
7309
|
"use strict";
|
|
@@ -8158,11 +8192,14 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8158
8192
|
const parsedType = this._getType(input);
|
|
8159
8193
|
if (parsedType !== ZodParsedType2.string) {
|
|
8160
8194
|
const ctx2 = this._getOrReturnCtx(input);
|
|
8161
|
-
addIssueToContext2(
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8195
|
+
addIssueToContext2(
|
|
8196
|
+
ctx2,
|
|
8197
|
+
{
|
|
8198
|
+
code: ZodIssueCode2.invalid_type,
|
|
8199
|
+
expected: ZodParsedType2.string,
|
|
8200
|
+
received: ctx2.parsedType
|
|
8201
|
+
}
|
|
8202
|
+
);
|
|
8166
8203
|
return INVALID2;
|
|
8167
8204
|
}
|
|
8168
8205
|
const status = new ParseStatus2();
|
|
@@ -9172,7 +9209,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9172
9209
|
const value = ctx.data[key];
|
|
9173
9210
|
pairs.push({
|
|
9174
9211
|
key: { status: "valid", value: key },
|
|
9175
|
-
value: catchall._parse(
|
|
9212
|
+
value: catchall._parse(
|
|
9213
|
+
new ParseInputLazyPath2(ctx, value, ctx.path, key)
|
|
9214
|
+
),
|
|
9176
9215
|
alwaysSet: key in ctx.data
|
|
9177
9216
|
});
|
|
9178
9217
|
}
|
|
@@ -10733,11 +10772,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10733
10772
|
type: mod2.string().optional(),
|
|
10734
10773
|
narrative: mod2.string().optional()
|
|
10735
10774
|
});
|
|
10736
|
-
var ImageValidator2 = mod2.string().or(
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10775
|
+
var ImageValidator2 = mod2.string().or(
|
|
10776
|
+
mod2.object({
|
|
10777
|
+
id: mod2.string(),
|
|
10778
|
+
type: mod2.string(),
|
|
10779
|
+
caption: mod2.string().optional()
|
|
10780
|
+
})
|
|
10781
|
+
);
|
|
10741
10782
|
var GeoCoordinatesValidator2 = mod2.object({
|
|
10742
10783
|
type: mod2.string().min(1).or(mod2.string().array().nonempty()),
|
|
10743
10784
|
latitude: mod2.number(),
|
|
@@ -10779,29 +10820,31 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10779
10820
|
identifier: mod2.string(),
|
|
10780
10821
|
identifierType: IdentifierTypeValidator2
|
|
10781
10822
|
});
|
|
10782
|
-
var ProfileValidator2 = mod2.string().or(
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10823
|
+
var ProfileValidator2 = mod2.string().or(
|
|
10824
|
+
mod2.object({
|
|
10825
|
+
id: mod2.string().optional(),
|
|
10826
|
+
type: mod2.string().or(mod2.string().array().nonempty().optional()),
|
|
10827
|
+
name: mod2.string().optional(),
|
|
10828
|
+
url: mod2.string().optional(),
|
|
10829
|
+
phone: mod2.string().optional(),
|
|
10830
|
+
description: mod2.string().optional(),
|
|
10831
|
+
endorsement: mod2.any().array().optional(),
|
|
10832
|
+
image: ImageValidator2.optional(),
|
|
10833
|
+
email: mod2.string().email().optional(),
|
|
10834
|
+
address: AddressValidator2.optional(),
|
|
10835
|
+
otherIdentifier: IdentifierEntryValidator2.array().optional(),
|
|
10836
|
+
official: mod2.string().optional(),
|
|
10837
|
+
parentOrg: mod2.any().optional(),
|
|
10838
|
+
familyName: mod2.string().optional(),
|
|
10839
|
+
givenName: mod2.string().optional(),
|
|
10840
|
+
additionalName: mod2.string().optional(),
|
|
10841
|
+
patronymicName: mod2.string().optional(),
|
|
10842
|
+
honorificPrefix: mod2.string().optional(),
|
|
10843
|
+
honorificSuffix: mod2.string().optional(),
|
|
10844
|
+
familyNamePrefix: mod2.string().optional(),
|
|
10845
|
+
dateOfBirth: mod2.string().optional()
|
|
10846
|
+
}).catchall(mod2.any())
|
|
10847
|
+
);
|
|
10805
10848
|
var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
|
|
10806
10849
|
var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() }).catchall(mod2.any());
|
|
10807
10850
|
var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() }).catchall(mod2.any());
|
|
@@ -10870,15 +10913,17 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10870
10913
|
aad: mod2.string().optional(),
|
|
10871
10914
|
recipients: JWERecipientValidator2.array().optional()
|
|
10872
10915
|
});
|
|
10873
|
-
var VerificationMethodValidator2 = mod2.string().or(
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10916
|
+
var VerificationMethodValidator2 = mod2.string().or(
|
|
10917
|
+
mod2.object({
|
|
10918
|
+
"@context": ContextValidator2.optional(),
|
|
10919
|
+
id: mod2.string(),
|
|
10920
|
+
type: mod2.string(),
|
|
10921
|
+
controller: mod2.string(),
|
|
10922
|
+
publicKeyJwk: JWKValidator2.optional(),
|
|
10923
|
+
publicKeyBase58: mod2.string().optional(),
|
|
10924
|
+
blockChainAccountId: mod2.string().optional()
|
|
10925
|
+
}).catchall(mod2.any())
|
|
10926
|
+
);
|
|
10882
10927
|
var ServiceValidator2 = mod2.object({
|
|
10883
10928
|
id: mod2.string(),
|
|
10884
10929
|
type: mod2.string().or(mod2.string().array().nonempty()),
|
|
@@ -11076,7 +11121,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11076
11121
|
name: mod2.string().optional(),
|
|
11077
11122
|
description: mod2.string().optional(),
|
|
11078
11123
|
image: ImageValidator2.optional(),
|
|
11079
|
-
credentialSubject: AchievementSubjectValidator2.or(
|
|
11124
|
+
credentialSubject: AchievementSubjectValidator2.or(
|
|
11125
|
+
AchievementSubjectValidator2.array()
|
|
11126
|
+
),
|
|
11080
11127
|
endorsement: UnsignedVCValidator2.array().optional(),
|
|
11081
11128
|
evidence: EvidenceValidator2.array().optional()
|
|
11082
11129
|
});
|
|
@@ -11305,7 +11352,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11305
11352
|
]);
|
|
11306
11353
|
var ConsentFlowTransactionsQueryValidator2 = mod2.object({
|
|
11307
11354
|
terms: ConsentFlowTermsQueryValidator2.optional(),
|
|
11308
|
-
action: ConsentFlowTransactionActionValidator2.or(
|
|
11355
|
+
action: ConsentFlowTransactionActionValidator2.or(
|
|
11356
|
+
ConsentFlowTransactionActionValidator2.array()
|
|
11357
|
+
).optional(),
|
|
11309
11358
|
date: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
|
|
11310
11359
|
expiresAt: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
|
|
11311
11360
|
oneTime: mod2.boolean().optional()
|
|
@@ -12128,11 +12177,14 @@ var ZodString = class extends ZodType {
|
|
|
12128
12177
|
const parsedType = this._getType(input);
|
|
12129
12178
|
if (parsedType !== ZodParsedType.string) {
|
|
12130
12179
|
const ctx2 = this._getOrReturnCtx(input);
|
|
12131
|
-
addIssueToContext(
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12180
|
+
addIssueToContext(
|
|
12181
|
+
ctx2,
|
|
12182
|
+
{
|
|
12183
|
+
code: ZodIssueCode.invalid_type,
|
|
12184
|
+
expected: ZodParsedType.string,
|
|
12185
|
+
received: ctx2.parsedType
|
|
12186
|
+
}
|
|
12187
|
+
);
|
|
12136
12188
|
return INVALID;
|
|
12137
12189
|
}
|
|
12138
12190
|
const status = new ParseStatus();
|
|
@@ -13138,7 +13190,9 @@ var ZodObject = class extends ZodType {
|
|
|
13138
13190
|
const value = ctx.data[key];
|
|
13139
13191
|
pairs.push({
|
|
13140
13192
|
key: { status: "valid", value: key },
|
|
13141
|
-
value: catchall._parse(
|
|
13193
|
+
value: catchall._parse(
|
|
13194
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
13195
|
+
),
|
|
13142
13196
|
alwaysSet: key in ctx.data
|
|
13143
13197
|
});
|
|
13144
13198
|
}
|
|
@@ -14689,11 +14743,13 @@ var AchievementCriteriaValidator = mod.object({
|
|
|
14689
14743
|
type: mod.string().optional(),
|
|
14690
14744
|
narrative: mod.string().optional()
|
|
14691
14745
|
});
|
|
14692
|
-
var ImageValidator = mod.string().or(
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14746
|
+
var ImageValidator = mod.string().or(
|
|
14747
|
+
mod.object({
|
|
14748
|
+
id: mod.string(),
|
|
14749
|
+
type: mod.string(),
|
|
14750
|
+
caption: mod.string().optional()
|
|
14751
|
+
})
|
|
14752
|
+
);
|
|
14697
14753
|
var GeoCoordinatesValidator = mod.object({
|
|
14698
14754
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
|
14699
14755
|
latitude: mod.number(),
|
|
@@ -14735,29 +14791,31 @@ var IdentifierEntryValidator = mod.object({
|
|
|
14735
14791
|
identifier: mod.string(),
|
|
14736
14792
|
identifierType: IdentifierTypeValidator
|
|
14737
14793
|
});
|
|
14738
|
-
var ProfileValidator = mod.string().or(
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14794
|
+
var ProfileValidator = mod.string().or(
|
|
14795
|
+
mod.object({
|
|
14796
|
+
id: mod.string().optional(),
|
|
14797
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
|
14798
|
+
name: mod.string().optional(),
|
|
14799
|
+
url: mod.string().optional(),
|
|
14800
|
+
phone: mod.string().optional(),
|
|
14801
|
+
description: mod.string().optional(),
|
|
14802
|
+
endorsement: mod.any().array().optional(),
|
|
14803
|
+
image: ImageValidator.optional(),
|
|
14804
|
+
email: mod.string().email().optional(),
|
|
14805
|
+
address: AddressValidator.optional(),
|
|
14806
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
14807
|
+
official: mod.string().optional(),
|
|
14808
|
+
parentOrg: mod.any().optional(),
|
|
14809
|
+
familyName: mod.string().optional(),
|
|
14810
|
+
givenName: mod.string().optional(),
|
|
14811
|
+
additionalName: mod.string().optional(),
|
|
14812
|
+
patronymicName: mod.string().optional(),
|
|
14813
|
+
honorificPrefix: mod.string().optional(),
|
|
14814
|
+
honorificSuffix: mod.string().optional(),
|
|
14815
|
+
familyNamePrefix: mod.string().optional(),
|
|
14816
|
+
dateOfBirth: mod.string().optional()
|
|
14817
|
+
}).catchall(mod.any())
|
|
14818
|
+
);
|
|
14761
14819
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
|
14762
14820
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
|
14763
14821
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
|
@@ -14826,15 +14884,17 @@ var JWEValidator = mod.object({
|
|
|
14826
14884
|
aad: mod.string().optional(),
|
|
14827
14885
|
recipients: JWERecipientValidator.array().optional()
|
|
14828
14886
|
});
|
|
14829
|
-
var VerificationMethodValidator = mod.string().or(
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14887
|
+
var VerificationMethodValidator = mod.string().or(
|
|
14888
|
+
mod.object({
|
|
14889
|
+
"@context": ContextValidator.optional(),
|
|
14890
|
+
id: mod.string(),
|
|
14891
|
+
type: mod.string(),
|
|
14892
|
+
controller: mod.string(),
|
|
14893
|
+
publicKeyJwk: JWKValidator.optional(),
|
|
14894
|
+
publicKeyBase58: mod.string().optional(),
|
|
14895
|
+
blockChainAccountId: mod.string().optional()
|
|
14896
|
+
}).catchall(mod.any())
|
|
14897
|
+
);
|
|
14838
14898
|
var ServiceValidator = mod.object({
|
|
14839
14899
|
id: mod.string(),
|
|
14840
14900
|
type: mod.string().or(mod.string().array().nonempty()),
|
|
@@ -15032,7 +15092,9 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
|
15032
15092
|
name: mod.string().optional(),
|
|
15033
15093
|
description: mod.string().optional(),
|
|
15034
15094
|
image: ImageValidator.optional(),
|
|
15035
|
-
credentialSubject: AchievementSubjectValidator.or(
|
|
15095
|
+
credentialSubject: AchievementSubjectValidator.or(
|
|
15096
|
+
AchievementSubjectValidator.array()
|
|
15097
|
+
),
|
|
15036
15098
|
endorsement: UnsignedVCValidator.array().optional(),
|
|
15037
15099
|
evidence: EvidenceValidator.array().optional()
|
|
15038
15100
|
});
|
|
@@ -15261,7 +15323,9 @@ var ConsentFlowTransactionActionValidator = mod.enum([
|
|
|
15261
15323
|
]);
|
|
15262
15324
|
var ConsentFlowTransactionsQueryValidator = mod.object({
|
|
15263
15325
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
|
15264
|
-
action: ConsentFlowTransactionActionValidator.or(
|
|
15326
|
+
action: ConsentFlowTransactionActionValidator.or(
|
|
15327
|
+
ConsentFlowTransactionActionValidator.array()
|
|
15328
|
+
).optional(),
|
|
15265
15329
|
date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
|
15266
15330
|
expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
|
15267
15331
|
oneTime: mod.boolean().optional()
|
|
@@ -15313,7 +15377,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
|
|
|
15313
15377
|
var e = { "SHA-1": { outputLength: 20, blockSize: 64 }, "SHA-256": { outputLength: 32, blockSize: 64 }, "SHA-384": { outputLength: 48, blockSize: 128 }, "SHA-512": { outputLength: 64, blockSize: 128 } };
|
|
15314
15378
|
function t(t2, a, o, i, s = "SHA-256") {
|
|
15315
15379
|
return new Promise((u, c) => {
|
|
15316
|
-
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), typeof t2
|
|
15380
|
+
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), "string" == typeof t2 ? t2 = new TextEncoder().encode(t2) : t2 instanceof ArrayBuffer ? t2 = new Uint8Array(t2) : ArrayBuffer.isView(t2) || c(RangeError("P should be string, ArrayBuffer, TypedArray, DataView")), "string" == typeof a ? a = new TextEncoder().encode(a) : a instanceof ArrayBuffer ? a = new Uint8Array(a) : ArrayBuffer.isView(a) ? a = new Uint8Array(a.buffer, a.byteOffset, a.byteLength) : c(RangeError("S should be string, ArrayBuffer, TypedArray, DataView")), crypto.subtle.importKey("raw", t2, "PBKDF2", false, ["deriveBits"]).then((f) => {
|
|
15317
15381
|
const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
|
|
15318
15382
|
crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
|
|
15319
15383
|
(async function(t3, a2, o2, i2, s2) {
|
|
@@ -15325,7 +15389,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
15325
15389
|
if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
|
|
15326
15390
|
throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
|
|
15327
15391
|
const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
|
|
15328
|
-
t3.byteLength
|
|
15392
|
+
0 === t3.byteLength && (t3 = new Uint8Array(e[s2].blockSize));
|
|
15329
15393
|
const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
|
|
15330
15394
|
const r2 = await crypto.subtle.sign("HMAC", e2, t4);
|
|
15331
15395
|
return new Uint8Array(r2);
|
|
@@ -15354,7 +15418,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
15354
15418
|
__name(t, "t");
|
|
15355
15419
|
function r(...e2) {
|
|
15356
15420
|
const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
|
|
15357
|
-
if (e2.length
|
|
15421
|
+
if (0 === e2.length)
|
|
15358
15422
|
throw new RangeError("Cannot concat no arrays");
|
|
15359
15423
|
const r2 = new Uint8Array(t2);
|
|
15360
15424
|
let n2 = 0;
|
|
@@ -15375,7 +15439,13 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
|
|
|
15375
15439
|
const uint8Message = new TextEncoder().encode(message);
|
|
15376
15440
|
const pk = learnCard.id.keypair("secp256k1").d;
|
|
15377
15441
|
const hmacKey = await t(pk, "salt", 1e3, 32);
|
|
15378
|
-
const cryptoKey = await crypto2.subtle.importKey(
|
|
15442
|
+
const cryptoKey = await crypto2.subtle.importKey(
|
|
15443
|
+
"raw",
|
|
15444
|
+
hmacKey,
|
|
15445
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
15446
|
+
false,
|
|
15447
|
+
["sign"]
|
|
15448
|
+
);
|
|
15379
15449
|
const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
|
|
15380
15450
|
const digestArray = Array.from(new Uint8Array(digestBuffer));
|
|
15381
15451
|
return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -15388,18 +15458,22 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
|
|
|
15388
15458
|
}, "decryptJWE");
|
|
15389
15459
|
var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
15390
15460
|
const entries = Object.entries(record);
|
|
15391
|
-
return (await Promise.all(
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15461
|
+
return (await Promise.all(
|
|
15462
|
+
entries.map(async ([key, value]) => {
|
|
15463
|
+
if (!unencryptedFields.includes(key)) {
|
|
15464
|
+
const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
|
|
15465
|
+
return result;
|
|
15466
|
+
}
|
|
15467
|
+
return "";
|
|
15468
|
+
})
|
|
15469
|
+
)).filter(Boolean);
|
|
15398
15470
|
}, "generateEncryptedFieldsArray");
|
|
15399
15471
|
var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
15400
15472
|
const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
|
|
15401
15473
|
const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
|
|
15402
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15474
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15475
|
+
Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
|
|
15476
|
+
);
|
|
15403
15477
|
return { ...unencryptedEntries, encryptedRecord, fields };
|
|
15404
15478
|
}, "generateEncryptedRecord");
|
|
15405
15479
|
|
|
@@ -15417,7 +15491,13 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15417
15491
|
learnCard.debug?.("Adding LearnCloud Plugin");
|
|
15418
15492
|
let client = await getLearnCloudClient(url, learnCard);
|
|
15419
15493
|
let dids = await client.user.getDids.query();
|
|
15494
|
+
let otherClients = {};
|
|
15420
15495
|
const learnCloudDid = await client.utilities.getDid.query();
|
|
15496
|
+
const getOtherClient = /* @__PURE__ */ __name(async (url2) => {
|
|
15497
|
+
if (!otherClients[url2])
|
|
15498
|
+
otherClients[url2] = await getLearnCloudClient(url2, learnCard);
|
|
15499
|
+
return otherClients[url2];
|
|
15500
|
+
}, "getOtherClient");
|
|
15421
15501
|
const updateLearnCard = /* @__PURE__ */ __name(async (_learnCard) => {
|
|
15422
15502
|
const oldDid = learnCard.id.did();
|
|
15423
15503
|
const newDid = _learnCard.id.did();
|
|
@@ -15441,14 +15521,22 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15441
15521
|
methods: {
|
|
15442
15522
|
learnCloudCreate: async (_learnCard, document) => {
|
|
15443
15523
|
await updateLearnCard(_learnCard);
|
|
15444
|
-
const item = await generateEncryptedRecord(
|
|
15524
|
+
const item = await generateEncryptedRecord(
|
|
15525
|
+
_learnCard,
|
|
15526
|
+
document,
|
|
15527
|
+
unencryptedCustomFields
|
|
15528
|
+
);
|
|
15445
15529
|
return client.customStorage.create.mutate({
|
|
15446
15530
|
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
15447
15531
|
});
|
|
15448
15532
|
},
|
|
15449
15533
|
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
15450
15534
|
await updateLearnCard(_learnCard);
|
|
15451
|
-
const items = await Promise.all(
|
|
15535
|
+
const items = await Promise.all(
|
|
15536
|
+
documents.map(
|
|
15537
|
+
async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)
|
|
15538
|
+
)
|
|
15539
|
+
);
|
|
15452
15540
|
return client.customStorage.createMany.mutate({
|
|
15453
15541
|
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
15454
15542
|
});
|
|
@@ -15456,10 +15544,18 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15456
15544
|
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
15457
15545
|
await updateLearnCard(_learnCard);
|
|
15458
15546
|
const documents = [];
|
|
15459
|
-
let result = await _learnCard.invoke.learnCloudReadPage(
|
|
15547
|
+
let result = await _learnCard.invoke.learnCloudReadPage(
|
|
15548
|
+
query,
|
|
15549
|
+
{},
|
|
15550
|
+
includeAssociatedDids
|
|
15551
|
+
);
|
|
15460
15552
|
documents.push(...result.records);
|
|
15461
15553
|
while (result.hasMore) {
|
|
15462
|
-
result = await _learnCard.invoke.learnCloudReadPage(
|
|
15554
|
+
result = await _learnCard.invoke.learnCloudReadPage(
|
|
15555
|
+
query,
|
|
15556
|
+
{},
|
|
15557
|
+
includeAssociatedDids
|
|
15558
|
+
);
|
|
15463
15559
|
documents.push(...result.records);
|
|
15464
15560
|
}
|
|
15465
15561
|
return documents;
|
|
@@ -15474,17 +15570,26 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15474
15570
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
15475
15571
|
return {
|
|
15476
15572
|
...encryptedRecords2,
|
|
15477
|
-
records: await Promise.all(
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15573
|
+
records: await Promise.all(
|
|
15574
|
+
encryptedRecords2.records.map(async (record) => ({
|
|
15575
|
+
...await decryptJWE(
|
|
15576
|
+
_learnCard,
|
|
15577
|
+
record.encryptedRecord
|
|
15578
|
+
),
|
|
15579
|
+
_id: record._id
|
|
15580
|
+
}))
|
|
15581
|
+
)
|
|
15481
15582
|
};
|
|
15482
15583
|
}
|
|
15483
15584
|
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
15484
15585
|
...unencryptedCustomFields,
|
|
15485
15586
|
"_id"
|
|
15486
15587
|
]);
|
|
15487
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15588
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15589
|
+
Object.entries(query).filter(
|
|
15590
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15591
|
+
)
|
|
15592
|
+
);
|
|
15488
15593
|
const jwe = await client.customStorage.read.query({
|
|
15489
15594
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15490
15595
|
...unencryptedEntries,
|
|
@@ -15496,10 +15601,15 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15496
15601
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
15497
15602
|
return {
|
|
15498
15603
|
...encryptedRecords,
|
|
15499
|
-
records: await Promise.all(
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15604
|
+
records: await Promise.all(
|
|
15605
|
+
encryptedRecords.records.map(async (record) => ({
|
|
15606
|
+
...await decryptJWE(
|
|
15607
|
+
_learnCard,
|
|
15608
|
+
record.encryptedRecord
|
|
15609
|
+
),
|
|
15610
|
+
_id: record._id
|
|
15611
|
+
}))
|
|
15612
|
+
)
|
|
15503
15613
|
};
|
|
15504
15614
|
},
|
|
15505
15615
|
learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15510,7 +15620,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15510
15620
|
...unencryptedCustomFields,
|
|
15511
15621
|
"_id"
|
|
15512
15622
|
]);
|
|
15513
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15623
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15624
|
+
Object.entries(query).filter(
|
|
15625
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15626
|
+
)
|
|
15627
|
+
);
|
|
15514
15628
|
return client.customStorage.count.query({
|
|
15515
15629
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15516
15630
|
...unencryptedEntries,
|
|
@@ -15522,12 +15636,24 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15522
15636
|
learnCloudUpdate: async (_learnCard, query, update) => {
|
|
15523
15637
|
await updateLearnCard(_learnCard);
|
|
15524
15638
|
const documents = await _learnCard.invoke.learnCloudRead(query);
|
|
15525
|
-
const updates = await Promise.all(
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15639
|
+
const updates = await Promise.all(
|
|
15640
|
+
documents.map(
|
|
15641
|
+
async (document) => client.customStorage.update.mutate({
|
|
15642
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15643
|
+
_id: document._id
|
|
15644
|
+
}),
|
|
15645
|
+
update: await generateJWE(
|
|
15646
|
+
_learnCard,
|
|
15647
|
+
learnCloudDid,
|
|
15648
|
+
await generateEncryptedRecord(
|
|
15649
|
+
_learnCard,
|
|
15650
|
+
{ ...document, ...update },
|
|
15651
|
+
unencryptedCustomFields
|
|
15652
|
+
)
|
|
15653
|
+
)
|
|
15654
|
+
})
|
|
15655
|
+
)
|
|
15656
|
+
);
|
|
15531
15657
|
return updates.reduce((sum, current) => current + sum, 0);
|
|
15532
15658
|
},
|
|
15533
15659
|
learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15538,7 +15664,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15538
15664
|
...unencryptedCustomFields,
|
|
15539
15665
|
"_id"
|
|
15540
15666
|
]);
|
|
15541
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15667
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15668
|
+
Object.entries(query).filter(
|
|
15669
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15670
|
+
)
|
|
15671
|
+
);
|
|
15542
15672
|
return client.customStorage.delete.mutate({
|
|
15543
15673
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15544
15674
|
...unencryptedEntries,
|
|
@@ -15549,17 +15679,19 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15549
15679
|
},
|
|
15550
15680
|
learnCloudBatchResolve: async (_learnCard, uris) => {
|
|
15551
15681
|
const results = await client.storage.batchResolve.query({ uris });
|
|
15552
|
-
return Promise.all(
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15682
|
+
return Promise.all(
|
|
15683
|
+
results.map(async (result) => {
|
|
15684
|
+
if (!result)
|
|
15685
|
+
return null;
|
|
15686
|
+
try {
|
|
15687
|
+
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
15688
|
+
return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
|
|
15689
|
+
} catch (error) {
|
|
15690
|
+
_learnCard.debug?.(error);
|
|
15691
|
+
return null;
|
|
15692
|
+
}
|
|
15693
|
+
})
|
|
15694
|
+
);
|
|
15563
15695
|
}
|
|
15564
15696
|
},
|
|
15565
15697
|
read: {
|
|
@@ -15569,9 +15701,21 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15569
15701
|
const parts = uri.split(":");
|
|
15570
15702
|
if (parts.length !== 5)
|
|
15571
15703
|
return void 0;
|
|
15572
|
-
const [lc, method] = parts;
|
|
15704
|
+
const [lc, method, uriUrl] = parts;
|
|
15573
15705
|
if (lc !== "lc" || method !== "cloud")
|
|
15574
15706
|
return void 0;
|
|
15707
|
+
if (uriUrl !== url) {
|
|
15708
|
+
const fullUrl = uriUrl.startsWith("http") ? uriUrl : `http${uriUrl.includes("http") ? "" : "s"}://${uriUrl}`;
|
|
15709
|
+
const otherClient = await getOtherClient(fullUrl);
|
|
15710
|
+
try {
|
|
15711
|
+
const result = await otherClient.storage.resolve.query({ uri });
|
|
15712
|
+
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
15713
|
+
return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
|
|
15714
|
+
} catch (error) {
|
|
15715
|
+
_learnCard.debug?.(error);
|
|
15716
|
+
return void 0;
|
|
15717
|
+
}
|
|
15718
|
+
}
|
|
15575
15719
|
try {
|
|
15576
15720
|
const result = await client.storage.resolve.query({ uri });
|
|
15577
15721
|
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
@@ -15619,17 +15763,33 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15619
15763
|
const jwe2 = await client.index.get.query(options);
|
|
15620
15764
|
_learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
|
|
15621
15765
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
15622
|
-
_learnCard.debug?.(
|
|
15766
|
+
_learnCard.debug?.(
|
|
15767
|
+
"LearnCloud index.get (no query encryptedRecords)",
|
|
15768
|
+
encryptedRecords2
|
|
15769
|
+
);
|
|
15623
15770
|
return {
|
|
15624
15771
|
...encryptedRecords2,
|
|
15625
|
-
records: await Promise.all(
|
|
15772
|
+
records: await Promise.all(
|
|
15773
|
+
encryptedRecords2.records.map(
|
|
15774
|
+
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15775
|
+
)
|
|
15776
|
+
)
|
|
15626
15777
|
};
|
|
15627
15778
|
}
|
|
15628
15779
|
_learnCard.debug?.("LearnCloud index.get (query)");
|
|
15629
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15780
|
+
const fields = await generateEncryptedFieldsArray(
|
|
15781
|
+
_learnCard,
|
|
15782
|
+
query,
|
|
15783
|
+
unencryptedFields
|
|
15784
|
+
);
|
|
15630
15785
|
_learnCard.debug?.("LearnCloud index.get (query fields)", fields);
|
|
15631
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15632
|
-
|
|
15786
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15787
|
+
Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
|
|
15788
|
+
);
|
|
15789
|
+
_learnCard.debug?.(
|
|
15790
|
+
"LearnCloud index.get (query unencryptedEntries)",
|
|
15791
|
+
unencryptedEntries
|
|
15792
|
+
);
|
|
15633
15793
|
const jwe = await client.index.get.query({
|
|
15634
15794
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15635
15795
|
...unencryptedEntries,
|
|
@@ -15639,10 +15799,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15639
15799
|
});
|
|
15640
15800
|
_learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
|
|
15641
15801
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
15642
|
-
_learnCard.debug?.(
|
|
15802
|
+
_learnCard.debug?.(
|
|
15803
|
+
"LearnCloud index.get (query encryptedRecords)",
|
|
15804
|
+
encryptedRecords
|
|
15805
|
+
);
|
|
15643
15806
|
return {
|
|
15644
15807
|
...encryptedRecords,
|
|
15645
|
-
records: await Promise.all(
|
|
15808
|
+
records: await Promise.all(
|
|
15809
|
+
encryptedRecords.records.map(
|
|
15810
|
+
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15811
|
+
)
|
|
15812
|
+
)
|
|
15646
15813
|
};
|
|
15647
15814
|
},
|
|
15648
15815
|
getCount: async (_learnCard, query) => {
|
|
@@ -15656,10 +15823,19 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15656
15823
|
return count2;
|
|
15657
15824
|
}
|
|
15658
15825
|
_learnCard.debug?.("LearnCloud index.getCount (query)");
|
|
15659
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15826
|
+
const fields = await generateEncryptedFieldsArray(
|
|
15827
|
+
_learnCard,
|
|
15828
|
+
query,
|
|
15829
|
+
unencryptedFields
|
|
15830
|
+
);
|
|
15660
15831
|
_learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
|
|
15661
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15662
|
-
|
|
15832
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15833
|
+
Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
|
|
15834
|
+
);
|
|
15835
|
+
_learnCard.debug?.(
|
|
15836
|
+
"LearnCloud index.getCount (query unencryptedEntries)",
|
|
15837
|
+
unencryptedEntries
|
|
15838
|
+
);
|
|
15663
15839
|
const jwe = await client.index.count.query({
|
|
15664
15840
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15665
15841
|
...unencryptedEntries,
|
|
@@ -15676,25 +15852,37 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15676
15852
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15677
15853
|
return client.index.add.mutate({
|
|
15678
15854
|
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
15679
|
-
...await generateEncryptedRecord(
|
|
15855
|
+
...await generateEncryptedRecord(
|
|
15856
|
+
_learnCard,
|
|
15857
|
+
{ ...record, id },
|
|
15858
|
+
unencryptedFields
|
|
15859
|
+
),
|
|
15680
15860
|
id: await hash(_learnCard, id)
|
|
15681
15861
|
})
|
|
15682
15862
|
});
|
|
15683
15863
|
},
|
|
15684
15864
|
addMany: async (_learnCard, _records) => {
|
|
15685
15865
|
await updateLearnCard(_learnCard);
|
|
15686
|
-
const results = await Promise.all(
|
|
15687
|
-
|
|
15688
|
-
const
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15866
|
+
const results = await Promise.all(
|
|
15867
|
+
(0, import_lodash.chunk)(_records, 25).map(async (batch) => {
|
|
15868
|
+
const records = await Promise.all(
|
|
15869
|
+
batch.map(async (record) => {
|
|
15870
|
+
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15871
|
+
return {
|
|
15872
|
+
...await generateEncryptedRecord(
|
|
15873
|
+
_learnCard,
|
|
15874
|
+
{ ...record, id },
|
|
15875
|
+
unencryptedFields
|
|
15876
|
+
),
|
|
15877
|
+
id: await hash(_learnCard, id)
|
|
15878
|
+
};
|
|
15879
|
+
})
|
|
15880
|
+
);
|
|
15881
|
+
return client.index.addMany.mutate({
|
|
15882
|
+
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
15883
|
+
});
|
|
15884
|
+
})
|
|
15885
|
+
);
|
|
15698
15886
|
return results.every(Boolean);
|
|
15699
15887
|
},
|
|
15700
15888
|
update: async (_learnCard, id, updates) => {
|
|
@@ -15706,7 +15894,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15706
15894
|
const newRecord = { ...record, ...updates };
|
|
15707
15895
|
return client.index.update.mutate({
|
|
15708
15896
|
id: await hash(_learnCard, id),
|
|
15709
|
-
updates: await generateJWE(
|
|
15897
|
+
updates: await generateJWE(
|
|
15898
|
+
_learnCard,
|
|
15899
|
+
learnCloudDid,
|
|
15900
|
+
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
15901
|
+
)
|
|
15710
15902
|
});
|
|
15711
15903
|
},
|
|
15712
15904
|
remove: async (_learnCard, id) => {
|