@learncard/learn-cloud-plugin 2.0.7 → 2.0.10
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
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
21
|
+
mod2
|
|
22
|
+
));
|
|
20
23
|
|
|
21
24
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
|
|
22
25
|
var require_lodash = __commonJS({
|
|
@@ -773,7 +776,9 @@ var require_lodash = __commonJS({
|
|
|
773
776
|
var nativeObjectToString = objectProto.toString;
|
|
774
777
|
var objectCtorString = funcToString.call(Object2);
|
|
775
778
|
var oldDash = root._;
|
|
776
|
-
var reIsNative = RegExp2(
|
|
779
|
+
var reIsNative = RegExp2(
|
|
780
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
781
|
+
);
|
|
777
782
|
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;
|
|
778
783
|
var defineProperty = function() {
|
|
779
784
|
try {
|
|
@@ -2402,7 +2407,18 @@ var require_lodash = __commonJS({
|
|
|
2402
2407
|
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
|
|
2403
2408
|
length -= holders.length;
|
|
2404
2409
|
if (length < arity) {
|
|
2405
|
-
return createRecurry(
|
|
2410
|
+
return createRecurry(
|
|
2411
|
+
func,
|
|
2412
|
+
bitmask,
|
|
2413
|
+
createHybrid,
|
|
2414
|
+
wrapper.placeholder,
|
|
2415
|
+
undefined2,
|
|
2416
|
+
args,
|
|
2417
|
+
holders,
|
|
2418
|
+
undefined2,
|
|
2419
|
+
undefined2,
|
|
2420
|
+
arity - length
|
|
2421
|
+
);
|
|
2406
2422
|
}
|
|
2407
2423
|
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
2408
2424
|
return apply(fn, this, args);
|
|
@@ -2484,7 +2500,18 @@ var require_lodash = __commonJS({
|
|
|
2484
2500
|
length -= holdersCount;
|
|
2485
2501
|
if (isCurried && length < arity) {
|
|
2486
2502
|
var newHolders = replaceHolders(args, placeholder);
|
|
2487
|
-
return createRecurry(
|
|
2503
|
+
return createRecurry(
|
|
2504
|
+
func,
|
|
2505
|
+
bitmask,
|
|
2506
|
+
createHybrid,
|
|
2507
|
+
wrapper.placeholder,
|
|
2508
|
+
thisArg,
|
|
2509
|
+
args,
|
|
2510
|
+
newHolders,
|
|
2511
|
+
argPos,
|
|
2512
|
+
ary2,
|
|
2513
|
+
arity - length
|
|
2514
|
+
);
|
|
2488
2515
|
}
|
|
2489
2516
|
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
|
|
2490
2517
|
length = args.length;
|
|
@@ -5051,7 +5078,10 @@ var require_lodash = __commonJS({
|
|
|
5051
5078
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
5052
5079
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
5053
5080
|
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
5054
|
-
var reDelimiters = RegExp2(
|
|
5081
|
+
var reDelimiters = RegExp2(
|
|
5082
|
+
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
|
|
5083
|
+
"g"
|
|
5084
|
+
);
|
|
5055
5085
|
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
5056
5086
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
5057
5087
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
@@ -5919,9 +5949,9 @@ var require_lodash = __commonJS({
|
|
|
5919
5949
|
}
|
|
5920
5950
|
});
|
|
5921
5951
|
|
|
5922
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5952
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/defaults.js
|
|
5923
5953
|
var require_defaults = __commonJS({
|
|
5924
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5954
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/defaults.js"(exports, module) {
|
|
5925
5955
|
module.exports = {
|
|
5926
5956
|
space: "",
|
|
5927
5957
|
cycles: false,
|
|
@@ -5931,9 +5961,9 @@ var require_defaults = __commonJS({
|
|
|
5931
5961
|
}
|
|
5932
5962
|
});
|
|
5933
5963
|
|
|
5934
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5964
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/util.js
|
|
5935
5965
|
var require_util = __commonJS({
|
|
5936
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5966
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/util.js"(exports, module) {
|
|
5937
5967
|
"use strict";
|
|
5938
5968
|
module.exports = {
|
|
5939
5969
|
isArray: Array.isArray,
|
|
@@ -5947,9 +5977,9 @@ var require_util = __commonJS({
|
|
|
5947
5977
|
}
|
|
5948
5978
|
});
|
|
5949
5979
|
|
|
5950
|
-
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5980
|
+
// ../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/index.js
|
|
5951
5981
|
var require_lib = __commonJS({
|
|
5952
|
-
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.
|
|
5982
|
+
"../../../node_modules/.pnpm/json-stringify-deterministic@1.0.12/node_modules/json-stringify-deterministic/lib/index.js"(exports, module) {
|
|
5953
5983
|
"use strict";
|
|
5954
5984
|
var DEFAULTS = require_defaults();
|
|
5955
5985
|
var isFunction2 = require_util().isFunction;
|
|
@@ -7257,7 +7287,10 @@ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
|
7257
7287
|
}
|
|
7258
7288
|
return to;
|
|
7259
7289
|
}, "__copyProps");
|
|
7260
|
-
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
7290
|
+
var __toESM2 = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps2(
|
|
7291
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp3(target, "default", { value: mod2, enumerable: true }) : target,
|
|
7292
|
+
mod2
|
|
7293
|
+
)), "__toESM");
|
|
7261
7294
|
var require_types_cjs_development = __commonJS2({
|
|
7262
7295
|
"../learn-card-types/dist/types.cjs.development.js"(exports, module) {
|
|
7263
7296
|
"use strict";
|
|
@@ -8146,11 +8179,14 @@ var require_types_cjs_development = __commonJS2({
|
|
|
8146
8179
|
const parsedType = this._getType(input);
|
|
8147
8180
|
if (parsedType !== ZodParsedType2.string) {
|
|
8148
8181
|
const ctx2 = this._getOrReturnCtx(input);
|
|
8149
|
-
addIssueToContext2(
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8182
|
+
addIssueToContext2(
|
|
8183
|
+
ctx2,
|
|
8184
|
+
{
|
|
8185
|
+
code: ZodIssueCode2.invalid_type,
|
|
8186
|
+
expected: ZodParsedType2.string,
|
|
8187
|
+
received: ctx2.parsedType
|
|
8188
|
+
}
|
|
8189
|
+
);
|
|
8154
8190
|
return INVALID2;
|
|
8155
8191
|
}
|
|
8156
8192
|
const status = new ParseStatus2();
|
|
@@ -9160,7 +9196,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
9160
9196
|
const value = ctx.data[key];
|
|
9161
9197
|
pairs.push({
|
|
9162
9198
|
key: { status: "valid", value: key },
|
|
9163
|
-
value: catchall._parse(
|
|
9199
|
+
value: catchall._parse(
|
|
9200
|
+
new ParseInputLazyPath2(ctx, value, ctx.path, key)
|
|
9201
|
+
),
|
|
9164
9202
|
alwaysSet: key in ctx.data
|
|
9165
9203
|
});
|
|
9166
9204
|
}
|
|
@@ -10721,11 +10759,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10721
10759
|
type: mod2.string().optional(),
|
|
10722
10760
|
narrative: mod2.string().optional()
|
|
10723
10761
|
});
|
|
10724
|
-
var ImageValidator2 = mod2.string().or(
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10762
|
+
var ImageValidator2 = mod2.string().or(
|
|
10763
|
+
mod2.object({
|
|
10764
|
+
id: mod2.string(),
|
|
10765
|
+
type: mod2.string(),
|
|
10766
|
+
caption: mod2.string().optional()
|
|
10767
|
+
})
|
|
10768
|
+
);
|
|
10729
10769
|
var GeoCoordinatesValidator2 = mod2.object({
|
|
10730
10770
|
type: mod2.string().min(1).or(mod2.string().array().nonempty()),
|
|
10731
10771
|
latitude: mod2.number(),
|
|
@@ -10767,29 +10807,31 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10767
10807
|
identifier: mod2.string(),
|
|
10768
10808
|
identifierType: IdentifierTypeValidator2
|
|
10769
10809
|
});
|
|
10770
|
-
var ProfileValidator2 = mod2.string().or(
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10810
|
+
var ProfileValidator2 = mod2.string().or(
|
|
10811
|
+
mod2.object({
|
|
10812
|
+
id: mod2.string().optional(),
|
|
10813
|
+
type: mod2.string().or(mod2.string().array().nonempty().optional()),
|
|
10814
|
+
name: mod2.string().optional(),
|
|
10815
|
+
url: mod2.string().optional(),
|
|
10816
|
+
phone: mod2.string().optional(),
|
|
10817
|
+
description: mod2.string().optional(),
|
|
10818
|
+
endorsement: mod2.any().array().optional(),
|
|
10819
|
+
image: ImageValidator2.optional(),
|
|
10820
|
+
email: mod2.string().email().optional(),
|
|
10821
|
+
address: AddressValidator2.optional(),
|
|
10822
|
+
otherIdentifier: IdentifierEntryValidator2.array().optional(),
|
|
10823
|
+
official: mod2.string().optional(),
|
|
10824
|
+
parentOrg: mod2.any().optional(),
|
|
10825
|
+
familyName: mod2.string().optional(),
|
|
10826
|
+
givenName: mod2.string().optional(),
|
|
10827
|
+
additionalName: mod2.string().optional(),
|
|
10828
|
+
patronymicName: mod2.string().optional(),
|
|
10829
|
+
honorificPrefix: mod2.string().optional(),
|
|
10830
|
+
honorificSuffix: mod2.string().optional(),
|
|
10831
|
+
familyNamePrefix: mod2.string().optional(),
|
|
10832
|
+
dateOfBirth: mod2.string().optional()
|
|
10833
|
+
}).catchall(mod2.any())
|
|
10834
|
+
);
|
|
10793
10835
|
var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
|
|
10794
10836
|
var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() }).catchall(mod2.any());
|
|
10795
10837
|
var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() }).catchall(mod2.any());
|
|
@@ -10858,15 +10900,17 @@ var require_types_cjs_development = __commonJS2({
|
|
|
10858
10900
|
aad: mod2.string().optional(),
|
|
10859
10901
|
recipients: JWERecipientValidator2.array().optional()
|
|
10860
10902
|
});
|
|
10861
|
-
var VerificationMethodValidator2 = mod2.string().or(
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10903
|
+
var VerificationMethodValidator2 = mod2.string().or(
|
|
10904
|
+
mod2.object({
|
|
10905
|
+
"@context": ContextValidator2.optional(),
|
|
10906
|
+
id: mod2.string(),
|
|
10907
|
+
type: mod2.string(),
|
|
10908
|
+
controller: mod2.string(),
|
|
10909
|
+
publicKeyJwk: JWKValidator2.optional(),
|
|
10910
|
+
publicKeyBase58: mod2.string().optional(),
|
|
10911
|
+
blockChainAccountId: mod2.string().optional()
|
|
10912
|
+
}).catchall(mod2.any())
|
|
10913
|
+
);
|
|
10870
10914
|
var ServiceValidator2 = mod2.object({
|
|
10871
10915
|
id: mod2.string(),
|
|
10872
10916
|
type: mod2.string().or(mod2.string().array().nonempty()),
|
|
@@ -11064,7 +11108,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11064
11108
|
name: mod2.string().optional(),
|
|
11065
11109
|
description: mod2.string().optional(),
|
|
11066
11110
|
image: ImageValidator2.optional(),
|
|
11067
|
-
credentialSubject: AchievementSubjectValidator2.or(
|
|
11111
|
+
credentialSubject: AchievementSubjectValidator2.or(
|
|
11112
|
+
AchievementSubjectValidator2.array()
|
|
11113
|
+
),
|
|
11068
11114
|
endorsement: UnsignedVCValidator2.array().optional(),
|
|
11069
11115
|
evidence: EvidenceValidator2.array().optional()
|
|
11070
11116
|
});
|
|
@@ -11293,7 +11339,9 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11293
11339
|
]);
|
|
11294
11340
|
var ConsentFlowTransactionsQueryValidator2 = mod2.object({
|
|
11295
11341
|
terms: ConsentFlowTermsQueryValidator2.optional(),
|
|
11296
|
-
action: ConsentFlowTransactionActionValidator2.or(
|
|
11342
|
+
action: ConsentFlowTransactionActionValidator2.or(
|
|
11343
|
+
ConsentFlowTransactionActionValidator2.array()
|
|
11344
|
+
).optional(),
|
|
11297
11345
|
date: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
|
|
11298
11346
|
expiresAt: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
|
|
11299
11347
|
oneTime: mod2.boolean().optional()
|
|
@@ -12116,11 +12164,14 @@ var ZodString = class extends ZodType {
|
|
|
12116
12164
|
const parsedType = this._getType(input);
|
|
12117
12165
|
if (parsedType !== ZodParsedType.string) {
|
|
12118
12166
|
const ctx2 = this._getOrReturnCtx(input);
|
|
12119
|
-
addIssueToContext(
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12167
|
+
addIssueToContext(
|
|
12168
|
+
ctx2,
|
|
12169
|
+
{
|
|
12170
|
+
code: ZodIssueCode.invalid_type,
|
|
12171
|
+
expected: ZodParsedType.string,
|
|
12172
|
+
received: ctx2.parsedType
|
|
12173
|
+
}
|
|
12174
|
+
);
|
|
12124
12175
|
return INVALID;
|
|
12125
12176
|
}
|
|
12126
12177
|
const status = new ParseStatus();
|
|
@@ -13126,7 +13177,9 @@ var ZodObject = class extends ZodType {
|
|
|
13126
13177
|
const value = ctx.data[key];
|
|
13127
13178
|
pairs.push({
|
|
13128
13179
|
key: { status: "valid", value: key },
|
|
13129
|
-
value: catchall._parse(
|
|
13180
|
+
value: catchall._parse(
|
|
13181
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
13182
|
+
),
|
|
13130
13183
|
alwaysSet: key in ctx.data
|
|
13131
13184
|
});
|
|
13132
13185
|
}
|
|
@@ -14677,11 +14730,13 @@ var AchievementCriteriaValidator = mod.object({
|
|
|
14677
14730
|
type: mod.string().optional(),
|
|
14678
14731
|
narrative: mod.string().optional()
|
|
14679
14732
|
});
|
|
14680
|
-
var ImageValidator = mod.string().or(
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14733
|
+
var ImageValidator = mod.string().or(
|
|
14734
|
+
mod.object({
|
|
14735
|
+
id: mod.string(),
|
|
14736
|
+
type: mod.string(),
|
|
14737
|
+
caption: mod.string().optional()
|
|
14738
|
+
})
|
|
14739
|
+
);
|
|
14685
14740
|
var GeoCoordinatesValidator = mod.object({
|
|
14686
14741
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
|
14687
14742
|
latitude: mod.number(),
|
|
@@ -14723,29 +14778,31 @@ var IdentifierEntryValidator = mod.object({
|
|
|
14723
14778
|
identifier: mod.string(),
|
|
14724
14779
|
identifierType: IdentifierTypeValidator
|
|
14725
14780
|
});
|
|
14726
|
-
var ProfileValidator = mod.string().or(
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14781
|
+
var ProfileValidator = mod.string().or(
|
|
14782
|
+
mod.object({
|
|
14783
|
+
id: mod.string().optional(),
|
|
14784
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
|
14785
|
+
name: mod.string().optional(),
|
|
14786
|
+
url: mod.string().optional(),
|
|
14787
|
+
phone: mod.string().optional(),
|
|
14788
|
+
description: mod.string().optional(),
|
|
14789
|
+
endorsement: mod.any().array().optional(),
|
|
14790
|
+
image: ImageValidator.optional(),
|
|
14791
|
+
email: mod.string().email().optional(),
|
|
14792
|
+
address: AddressValidator.optional(),
|
|
14793
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
14794
|
+
official: mod.string().optional(),
|
|
14795
|
+
parentOrg: mod.any().optional(),
|
|
14796
|
+
familyName: mod.string().optional(),
|
|
14797
|
+
givenName: mod.string().optional(),
|
|
14798
|
+
additionalName: mod.string().optional(),
|
|
14799
|
+
patronymicName: mod.string().optional(),
|
|
14800
|
+
honorificPrefix: mod.string().optional(),
|
|
14801
|
+
honorificSuffix: mod.string().optional(),
|
|
14802
|
+
familyNamePrefix: mod.string().optional(),
|
|
14803
|
+
dateOfBirth: mod.string().optional()
|
|
14804
|
+
}).catchall(mod.any())
|
|
14805
|
+
);
|
|
14749
14806
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
|
14750
14807
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
|
14751
14808
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
|
@@ -14814,15 +14871,17 @@ var JWEValidator = mod.object({
|
|
|
14814
14871
|
aad: mod.string().optional(),
|
|
14815
14872
|
recipients: JWERecipientValidator.array().optional()
|
|
14816
14873
|
});
|
|
14817
|
-
var VerificationMethodValidator = mod.string().or(
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14874
|
+
var VerificationMethodValidator = mod.string().or(
|
|
14875
|
+
mod.object({
|
|
14876
|
+
"@context": ContextValidator.optional(),
|
|
14877
|
+
id: mod.string(),
|
|
14878
|
+
type: mod.string(),
|
|
14879
|
+
controller: mod.string(),
|
|
14880
|
+
publicKeyJwk: JWKValidator.optional(),
|
|
14881
|
+
publicKeyBase58: mod.string().optional(),
|
|
14882
|
+
blockChainAccountId: mod.string().optional()
|
|
14883
|
+
}).catchall(mod.any())
|
|
14884
|
+
);
|
|
14826
14885
|
var ServiceValidator = mod.object({
|
|
14827
14886
|
id: mod.string(),
|
|
14828
14887
|
type: mod.string().or(mod.string().array().nonempty()),
|
|
@@ -15020,7 +15079,9 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
|
15020
15079
|
name: mod.string().optional(),
|
|
15021
15080
|
description: mod.string().optional(),
|
|
15022
15081
|
image: ImageValidator.optional(),
|
|
15023
|
-
credentialSubject: AchievementSubjectValidator.or(
|
|
15082
|
+
credentialSubject: AchievementSubjectValidator.or(
|
|
15083
|
+
AchievementSubjectValidator.array()
|
|
15084
|
+
),
|
|
15024
15085
|
endorsement: UnsignedVCValidator.array().optional(),
|
|
15025
15086
|
evidence: EvidenceValidator.array().optional()
|
|
15026
15087
|
});
|
|
@@ -15249,7 +15310,9 @@ var ConsentFlowTransactionActionValidator = mod.enum([
|
|
|
15249
15310
|
]);
|
|
15250
15311
|
var ConsentFlowTransactionsQueryValidator = mod.object({
|
|
15251
15312
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
|
15252
|
-
action: ConsentFlowTransactionActionValidator.or(
|
|
15313
|
+
action: ConsentFlowTransactionActionValidator.or(
|
|
15314
|
+
ConsentFlowTransactionActionValidator.array()
|
|
15315
|
+
).optional(),
|
|
15253
15316
|
date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
|
15254
15317
|
expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
|
15255
15318
|
oneTime: mod.boolean().optional()
|
|
@@ -15301,7 +15364,7 @@ var import_json_stringify_deterministic = __toESM(require_lib());
|
|
|
15301
15364
|
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 } };
|
|
15302
15365
|
function t(t2, a, o, i, s = "SHA-256") {
|
|
15303
15366
|
return new Promise((u, c) => {
|
|
15304
|
-
s in e || c(new RangeError(`Valid hash algorithm values are any of ${Object.keys(e).toString()}`)), typeof t2
|
|
15367
|
+
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) => {
|
|
15305
15368
|
const y = { name: "PBKDF2", hash: s, salt: a, iterations: o };
|
|
15306
15369
|
crypto.subtle.deriveBits(y, f, 8 * i).then((e2) => u(e2), (f2) => {
|
|
15307
15370
|
(async function(t3, a2, o2, i2, s2) {
|
|
@@ -15313,7 +15376,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
15313
15376
|
if (!Number.isInteger(i2) || i2 <= 0 || i2 >= (2 ** 32 - 1) * u2)
|
|
15314
15377
|
throw new RangeError("dkLen must be a positive integer < (2 ** 32 - 1) * hLen");
|
|
15315
15378
|
const c2 = Math.ceil(i2 / u2), f3 = i2 - (c2 - 1) * u2, y2 = new Array(c2);
|
|
15316
|
-
t3.byteLength
|
|
15379
|
+
0 === t3.byteLength && (t3 = new Uint8Array(e[s2].blockSize));
|
|
15317
15380
|
const w = await crypto.subtle.importKey("raw", t3, { name: "HMAC", hash: { name: s2 } }, true, ["sign"]), g = /* @__PURE__ */ __name(async function(e2, t4) {
|
|
15318
15381
|
const r2 = await crypto.subtle.sign("HMAC", e2, t4);
|
|
15319
15382
|
return new Uint8Array(r2);
|
|
@@ -15342,7 +15405,7 @@ function t(t2, a, o, i, s = "SHA-256") {
|
|
|
15342
15405
|
__name(t, "t");
|
|
15343
15406
|
function r(...e2) {
|
|
15344
15407
|
const t2 = e2.reduce((e3, t3) => e3 + t3.length, 0);
|
|
15345
|
-
if (e2.length
|
|
15408
|
+
if (0 === e2.length)
|
|
15346
15409
|
throw new RangeError("Cannot concat no arrays");
|
|
15347
15410
|
const r2 = new Uint8Array(t2);
|
|
15348
15411
|
let n2 = 0;
|
|
@@ -15363,7 +15426,13 @@ var hash = /* @__PURE__ */ __name(async (learnCard, message) => {
|
|
|
15363
15426
|
const uint8Message = new TextEncoder().encode(message);
|
|
15364
15427
|
const pk = learnCard.id.keypair("secp256k1").d;
|
|
15365
15428
|
const hmacKey = await t(pk, "salt", 1e3, 32);
|
|
15366
|
-
const cryptoKey = await crypto2.subtle.importKey(
|
|
15429
|
+
const cryptoKey = await crypto2.subtle.importKey(
|
|
15430
|
+
"raw",
|
|
15431
|
+
hmacKey,
|
|
15432
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
15433
|
+
false,
|
|
15434
|
+
["sign"]
|
|
15435
|
+
);
|
|
15367
15436
|
const digestBuffer = await crypto2.subtle.sign("HMAC", cryptoKey, uint8Message);
|
|
15368
15437
|
const digestArray = Array.from(new Uint8Array(digestBuffer));
|
|
15369
15438
|
return digestArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -15376,18 +15445,22 @@ var decryptJWE = /* @__PURE__ */ __name(async (learnCard, jwe) => {
|
|
|
15376
15445
|
}, "decryptJWE");
|
|
15377
15446
|
var generateEncryptedFieldsArray = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
15378
15447
|
const entries = Object.entries(record);
|
|
15379
|
-
return (await Promise.all(
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15448
|
+
return (await Promise.all(
|
|
15449
|
+
entries.map(async ([key, value]) => {
|
|
15450
|
+
if (!unencryptedFields.includes(key)) {
|
|
15451
|
+
const result = await hash(learnCard, `${key}:${(0, import_json_stringify_deterministic.default)(value)}`);
|
|
15452
|
+
return result;
|
|
15453
|
+
}
|
|
15454
|
+
return "";
|
|
15455
|
+
})
|
|
15456
|
+
)).filter(Boolean);
|
|
15386
15457
|
}, "generateEncryptedFieldsArray");
|
|
15387
15458
|
var generateEncryptedRecord = /* @__PURE__ */ __name(async (learnCard, record, unencryptedFields = []) => {
|
|
15388
15459
|
const encryptedRecord = await learnCard.invoke.getDIDObject().createDagJWE(record, [learnCard.id.did()]);
|
|
15389
15460
|
const fields = await generateEncryptedFieldsArray(learnCard, record, unencryptedFields);
|
|
15390
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15461
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15462
|
+
Object.entries(record).filter(([key]) => unencryptedFields.includes(key))
|
|
15463
|
+
);
|
|
15391
15464
|
return { ...unencryptedEntries, encryptedRecord, fields };
|
|
15392
15465
|
}, "generateEncryptedRecord");
|
|
15393
15466
|
|
|
@@ -15405,7 +15478,13 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15405
15478
|
learnCard.debug?.("Adding LearnCloud Plugin");
|
|
15406
15479
|
let client = await getLearnCloudClient(url, learnCard);
|
|
15407
15480
|
let dids = await client.user.getDids.query();
|
|
15481
|
+
let otherClients = {};
|
|
15408
15482
|
const learnCloudDid = await client.utilities.getDid.query();
|
|
15483
|
+
const getOtherClient = /* @__PURE__ */ __name(async (url2) => {
|
|
15484
|
+
if (!otherClients[url2])
|
|
15485
|
+
otherClients[url2] = await getLearnCloudClient(url2, learnCard);
|
|
15486
|
+
return otherClients[url2];
|
|
15487
|
+
}, "getOtherClient");
|
|
15409
15488
|
const updateLearnCard = /* @__PURE__ */ __name(async (_learnCard) => {
|
|
15410
15489
|
const oldDid = learnCard.id.did();
|
|
15411
15490
|
const newDid = _learnCard.id.did();
|
|
@@ -15429,14 +15508,22 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15429
15508
|
methods: {
|
|
15430
15509
|
learnCloudCreate: async (_learnCard, document) => {
|
|
15431
15510
|
await updateLearnCard(_learnCard);
|
|
15432
|
-
const item = await generateEncryptedRecord(
|
|
15511
|
+
const item = await generateEncryptedRecord(
|
|
15512
|
+
_learnCard,
|
|
15513
|
+
document,
|
|
15514
|
+
unencryptedCustomFields
|
|
15515
|
+
);
|
|
15433
15516
|
return client.customStorage.create.mutate({
|
|
15434
15517
|
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
15435
15518
|
});
|
|
15436
15519
|
},
|
|
15437
15520
|
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
15438
15521
|
await updateLearnCard(_learnCard);
|
|
15439
|
-
const items = await Promise.all(
|
|
15522
|
+
const items = await Promise.all(
|
|
15523
|
+
documents.map(
|
|
15524
|
+
async (document) => generateEncryptedRecord(_learnCard, document, unencryptedCustomFields)
|
|
15525
|
+
)
|
|
15526
|
+
);
|
|
15440
15527
|
return client.customStorage.createMany.mutate({
|
|
15441
15528
|
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
15442
15529
|
});
|
|
@@ -15444,10 +15531,18 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15444
15531
|
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
15445
15532
|
await updateLearnCard(_learnCard);
|
|
15446
15533
|
const documents = [];
|
|
15447
|
-
let result = await _learnCard.invoke.learnCloudReadPage(
|
|
15534
|
+
let result = await _learnCard.invoke.learnCloudReadPage(
|
|
15535
|
+
query,
|
|
15536
|
+
{},
|
|
15537
|
+
includeAssociatedDids
|
|
15538
|
+
);
|
|
15448
15539
|
documents.push(...result.records);
|
|
15449
15540
|
while (result.hasMore) {
|
|
15450
|
-
result = await _learnCard.invoke.learnCloudReadPage(
|
|
15541
|
+
result = await _learnCard.invoke.learnCloudReadPage(
|
|
15542
|
+
query,
|
|
15543
|
+
{},
|
|
15544
|
+
includeAssociatedDids
|
|
15545
|
+
);
|
|
15451
15546
|
documents.push(...result.records);
|
|
15452
15547
|
}
|
|
15453
15548
|
return documents;
|
|
@@ -15462,17 +15557,26 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15462
15557
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
15463
15558
|
return {
|
|
15464
15559
|
...encryptedRecords2,
|
|
15465
|
-
records: await Promise.all(
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15560
|
+
records: await Promise.all(
|
|
15561
|
+
encryptedRecords2.records.map(async (record) => ({
|
|
15562
|
+
...await decryptJWE(
|
|
15563
|
+
_learnCard,
|
|
15564
|
+
record.encryptedRecord
|
|
15565
|
+
),
|
|
15566
|
+
_id: record._id
|
|
15567
|
+
}))
|
|
15568
|
+
)
|
|
15469
15569
|
};
|
|
15470
15570
|
}
|
|
15471
15571
|
const fields = await generateEncryptedFieldsArray(_learnCard, query, [
|
|
15472
15572
|
...unencryptedCustomFields,
|
|
15473
15573
|
"_id"
|
|
15474
15574
|
]);
|
|
15475
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15575
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15576
|
+
Object.entries(query).filter(
|
|
15577
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15578
|
+
)
|
|
15579
|
+
);
|
|
15476
15580
|
const jwe = await client.customStorage.read.query({
|
|
15477
15581
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15478
15582
|
...unencryptedEntries,
|
|
@@ -15484,10 +15588,15 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15484
15588
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
15485
15589
|
return {
|
|
15486
15590
|
...encryptedRecords,
|
|
15487
|
-
records: await Promise.all(
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15591
|
+
records: await Promise.all(
|
|
15592
|
+
encryptedRecords.records.map(async (record) => ({
|
|
15593
|
+
...await decryptJWE(
|
|
15594
|
+
_learnCard,
|
|
15595
|
+
record.encryptedRecord
|
|
15596
|
+
),
|
|
15597
|
+
_id: record._id
|
|
15598
|
+
}))
|
|
15599
|
+
)
|
|
15491
15600
|
};
|
|
15492
15601
|
},
|
|
15493
15602
|
learnCloudCount: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15498,7 +15607,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15498
15607
|
...unencryptedCustomFields,
|
|
15499
15608
|
"_id"
|
|
15500
15609
|
]);
|
|
15501
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15610
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15611
|
+
Object.entries(query).filter(
|
|
15612
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15613
|
+
)
|
|
15614
|
+
);
|
|
15502
15615
|
return client.customStorage.count.query({
|
|
15503
15616
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15504
15617
|
...unencryptedEntries,
|
|
@@ -15510,12 +15623,24 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15510
15623
|
learnCloudUpdate: async (_learnCard, query, update) => {
|
|
15511
15624
|
await updateLearnCard(_learnCard);
|
|
15512
15625
|
const documents = await _learnCard.invoke.learnCloudRead(query);
|
|
15513
|
-
const updates = await Promise.all(
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15626
|
+
const updates = await Promise.all(
|
|
15627
|
+
documents.map(
|
|
15628
|
+
async (document) => client.customStorage.update.mutate({
|
|
15629
|
+
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15630
|
+
_id: document._id
|
|
15631
|
+
}),
|
|
15632
|
+
update: await generateJWE(
|
|
15633
|
+
_learnCard,
|
|
15634
|
+
learnCloudDid,
|
|
15635
|
+
await generateEncryptedRecord(
|
|
15636
|
+
_learnCard,
|
|
15637
|
+
{ ...document, ...update },
|
|
15638
|
+
unencryptedCustomFields
|
|
15639
|
+
)
|
|
15640
|
+
)
|
|
15641
|
+
})
|
|
15642
|
+
)
|
|
15643
|
+
);
|
|
15519
15644
|
return updates.reduce((sum, current) => current + sum, 0);
|
|
15520
15645
|
},
|
|
15521
15646
|
learnCloudDelete: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15526,7 +15651,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15526
15651
|
...unencryptedCustomFields,
|
|
15527
15652
|
"_id"
|
|
15528
15653
|
]);
|
|
15529
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15654
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15655
|
+
Object.entries(query).filter(
|
|
15656
|
+
([key]) => [...unencryptedCustomFields, "_id"].includes(key)
|
|
15657
|
+
)
|
|
15658
|
+
);
|
|
15530
15659
|
return client.customStorage.delete.mutate({
|
|
15531
15660
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15532
15661
|
...unencryptedEntries,
|
|
@@ -15537,17 +15666,19 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15537
15666
|
},
|
|
15538
15667
|
learnCloudBatchResolve: async (_learnCard, uris) => {
|
|
15539
15668
|
const results = await client.storage.batchResolve.query({ uris });
|
|
15540
|
-
return Promise.all(
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15669
|
+
return Promise.all(
|
|
15670
|
+
results.map(async (result) => {
|
|
15671
|
+
if (!result)
|
|
15672
|
+
return null;
|
|
15673
|
+
try {
|
|
15674
|
+
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
15675
|
+
return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
|
|
15676
|
+
} catch (error) {
|
|
15677
|
+
_learnCard.debug?.(error);
|
|
15678
|
+
return null;
|
|
15679
|
+
}
|
|
15680
|
+
})
|
|
15681
|
+
);
|
|
15551
15682
|
}
|
|
15552
15683
|
},
|
|
15553
15684
|
read: {
|
|
@@ -15557,9 +15688,21 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15557
15688
|
const parts = uri.split(":");
|
|
15558
15689
|
if (parts.length !== 5)
|
|
15559
15690
|
return void 0;
|
|
15560
|
-
const [lc, method] = parts;
|
|
15691
|
+
const [lc, method, uriUrl] = parts;
|
|
15561
15692
|
if (lc !== "lc" || method !== "cloud")
|
|
15562
15693
|
return void 0;
|
|
15694
|
+
if (uriUrl !== url) {
|
|
15695
|
+
const fullUrl = uriUrl.startsWith("http") ? uriUrl : `http${uriUrl.includes("http") ? "" : "s"}://${uriUrl}`;
|
|
15696
|
+
const otherClient = await getOtherClient(fullUrl);
|
|
15697
|
+
try {
|
|
15698
|
+
const result = await otherClient.storage.resolve.query({ uri });
|
|
15699
|
+
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
15700
|
+
return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
|
|
15701
|
+
} catch (error) {
|
|
15702
|
+
_learnCard.debug?.(error);
|
|
15703
|
+
return void 0;
|
|
15704
|
+
}
|
|
15705
|
+
}
|
|
15563
15706
|
try {
|
|
15564
15707
|
const result = await client.storage.resolve.query({ uri });
|
|
15565
15708
|
const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
|
|
@@ -15607,17 +15750,33 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15607
15750
|
const jwe2 = await client.index.get.query(options);
|
|
15608
15751
|
_learnCard.debug?.("LearnCloud index.get (no query response)", jwe2);
|
|
15609
15752
|
const encryptedRecords2 = isEncrypted(jwe2) ? await decryptJWE(_learnCard, jwe2) : jwe2;
|
|
15610
|
-
_learnCard.debug?.(
|
|
15753
|
+
_learnCard.debug?.(
|
|
15754
|
+
"LearnCloud index.get (no query encryptedRecords)",
|
|
15755
|
+
encryptedRecords2
|
|
15756
|
+
);
|
|
15611
15757
|
return {
|
|
15612
15758
|
...encryptedRecords2,
|
|
15613
|
-
records: await Promise.all(
|
|
15759
|
+
records: await Promise.all(
|
|
15760
|
+
encryptedRecords2.records.map(
|
|
15761
|
+
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15762
|
+
)
|
|
15763
|
+
)
|
|
15614
15764
|
};
|
|
15615
15765
|
}
|
|
15616
15766
|
_learnCard.debug?.("LearnCloud index.get (query)");
|
|
15617
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15767
|
+
const fields = await generateEncryptedFieldsArray(
|
|
15768
|
+
_learnCard,
|
|
15769
|
+
query,
|
|
15770
|
+
unencryptedFields
|
|
15771
|
+
);
|
|
15618
15772
|
_learnCard.debug?.("LearnCloud index.get (query fields)", fields);
|
|
15619
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15620
|
-
|
|
15773
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15774
|
+
Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
|
|
15775
|
+
);
|
|
15776
|
+
_learnCard.debug?.(
|
|
15777
|
+
"LearnCloud index.get (query unencryptedEntries)",
|
|
15778
|
+
unencryptedEntries
|
|
15779
|
+
);
|
|
15621
15780
|
const jwe = await client.index.get.query({
|
|
15622
15781
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15623
15782
|
...unencryptedEntries,
|
|
@@ -15627,10 +15786,17 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15627
15786
|
});
|
|
15628
15787
|
_learnCard.debug?.("LearnCloud index.get (query jwe)", jwe);
|
|
15629
15788
|
const encryptedRecords = isEncrypted(jwe) ? await decryptJWE(_learnCard, jwe) : jwe;
|
|
15630
|
-
_learnCard.debug?.(
|
|
15789
|
+
_learnCard.debug?.(
|
|
15790
|
+
"LearnCloud index.get (query encryptedRecords)",
|
|
15791
|
+
encryptedRecords
|
|
15792
|
+
);
|
|
15631
15793
|
return {
|
|
15632
15794
|
...encryptedRecords,
|
|
15633
|
-
records: await Promise.all(
|
|
15795
|
+
records: await Promise.all(
|
|
15796
|
+
encryptedRecords.records.map(
|
|
15797
|
+
async (record) => decryptJWE(_learnCard, record.encryptedRecord)
|
|
15798
|
+
)
|
|
15799
|
+
)
|
|
15634
15800
|
};
|
|
15635
15801
|
},
|
|
15636
15802
|
getCount: async (_learnCard, query) => {
|
|
@@ -15644,10 +15810,19 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15644
15810
|
return count2;
|
|
15645
15811
|
}
|
|
15646
15812
|
_learnCard.debug?.("LearnCloud index.getCount (query)");
|
|
15647
|
-
const fields = await generateEncryptedFieldsArray(
|
|
15813
|
+
const fields = await generateEncryptedFieldsArray(
|
|
15814
|
+
_learnCard,
|
|
15815
|
+
query,
|
|
15816
|
+
unencryptedFields
|
|
15817
|
+
);
|
|
15648
15818
|
_learnCard.debug?.("LearnCloud index.getCount (query fields)", fields);
|
|
15649
|
-
const unencryptedEntries = Object.fromEntries(
|
|
15650
|
-
|
|
15819
|
+
const unencryptedEntries = Object.fromEntries(
|
|
15820
|
+
Object.entries(query).filter(([key]) => unencryptedFields.includes(key))
|
|
15821
|
+
);
|
|
15822
|
+
_learnCard.debug?.(
|
|
15823
|
+
"LearnCloud index.getCount (query unencryptedEntries)",
|
|
15824
|
+
unencryptedEntries
|
|
15825
|
+
);
|
|
15651
15826
|
const jwe = await client.index.count.query({
|
|
15652
15827
|
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15653
15828
|
...unencryptedEntries,
|
|
@@ -15664,25 +15839,37 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15664
15839
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15665
15840
|
return client.index.add.mutate({
|
|
15666
15841
|
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
15667
|
-
...await generateEncryptedRecord(
|
|
15842
|
+
...await generateEncryptedRecord(
|
|
15843
|
+
_learnCard,
|
|
15844
|
+
{ ...record, id },
|
|
15845
|
+
unencryptedFields
|
|
15846
|
+
),
|
|
15668
15847
|
id: await hash(_learnCard, id)
|
|
15669
15848
|
})
|
|
15670
15849
|
});
|
|
15671
15850
|
},
|
|
15672
15851
|
addMany: async (_learnCard, _records) => {
|
|
15673
15852
|
await updateLearnCard(_learnCard);
|
|
15674
|
-
const results = await Promise.all(
|
|
15675
|
-
|
|
15676
|
-
const
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15853
|
+
const results = await Promise.all(
|
|
15854
|
+
(0, import_lodash.chunk)(_records, 25).map(async (batch) => {
|
|
15855
|
+
const records = await Promise.all(
|
|
15856
|
+
batch.map(async (record) => {
|
|
15857
|
+
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15858
|
+
return {
|
|
15859
|
+
...await generateEncryptedRecord(
|
|
15860
|
+
_learnCard,
|
|
15861
|
+
{ ...record, id },
|
|
15862
|
+
unencryptedFields
|
|
15863
|
+
),
|
|
15864
|
+
id: await hash(_learnCard, id)
|
|
15865
|
+
};
|
|
15866
|
+
})
|
|
15867
|
+
);
|
|
15868
|
+
return client.index.addMany.mutate({
|
|
15869
|
+
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
15870
|
+
});
|
|
15871
|
+
})
|
|
15872
|
+
);
|
|
15686
15873
|
return results.every(Boolean);
|
|
15687
15874
|
},
|
|
15688
15875
|
update: async (_learnCard, id, updates) => {
|
|
@@ -15694,7 +15881,11 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15694
15881
|
const newRecord = { ...record, ...updates };
|
|
15695
15882
|
return client.index.update.mutate({
|
|
15696
15883
|
id: await hash(_learnCard, id),
|
|
15697
|
-
updates: await generateJWE(
|
|
15884
|
+
updates: await generateJWE(
|
|
15885
|
+
_learnCard,
|
|
15886
|
+
learnCloudDid,
|
|
15887
|
+
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
15888
|
+
)
|
|
15698
15889
|
});
|
|
15699
15890
|
},
|
|
15700
15891
|
remove: async (_learnCard, id) => {
|