@learncard/learn-cloud-plugin 2.0.24 → 2.1.0
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 +47 -17
- package/dist/learn-cloud-plugin.cjs.development.js.map +3 -3
- package/dist/learn-cloud-plugin.cjs.production.min.js +7 -7
- package/dist/learn-cloud-plugin.cjs.production.min.js.map +3 -3
- package/dist/learn-cloud-plugin.esm.js +47 -17
- package/dist/learn-cloud-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -7248,7 +7248,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
7248
7248
|
const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
|
|
7249
7249
|
return challengeRequester.utilities.getChallenges.query({ amount });
|
|
7250
7250
|
}, "getChallenges");
|
|
7251
|
-
challenges =
|
|
7251
|
+
getChallenges().then((result) => challenges = result);
|
|
7252
7252
|
const trpc = createTRPCProxyClient({
|
|
7253
7253
|
links: [
|
|
7254
7254
|
callbackLink(async () => {
|
|
@@ -7369,6 +7369,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7369
7369
|
LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator2,
|
|
7370
7370
|
LCNNotificationValidator: () => LCNNotificationValidator2,
|
|
7371
7371
|
LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum2,
|
|
7372
|
+
LCNProfileDisplayValidator: () => LCNProfileDisplayValidator2,
|
|
7372
7373
|
LCNProfileQueryValidator: () => LCNProfileQueryValidator2,
|
|
7373
7374
|
LCNProfileValidator: () => LCNProfileValidator2,
|
|
7374
7375
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
|
|
@@ -11189,6 +11190,19 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11189
11190
|
})
|
|
11190
11191
|
);
|
|
11191
11192
|
var StringQuery2 = mod2.string().or(mod2.object({ $in: mod2.string().array() })).or(mod2.object({ $regex: RegExpValidator2 }));
|
|
11193
|
+
var LCNProfileDisplayValidator2 = mod2.object({
|
|
11194
|
+
backgroundColor: mod2.string().optional(),
|
|
11195
|
+
backgroundImage: mod2.string().optional(),
|
|
11196
|
+
fadeBackgroundImage: mod2.boolean().optional(),
|
|
11197
|
+
repeatBackgroundImage: mod2.boolean().optional(),
|
|
11198
|
+
fontColor: mod2.string().optional(),
|
|
11199
|
+
accentColor: mod2.string().optional(),
|
|
11200
|
+
accentFontColor: mod2.string().optional(),
|
|
11201
|
+
idBackgroundImage: mod2.string().optional(),
|
|
11202
|
+
fadeIdBackgroundImage: mod2.boolean().optional(),
|
|
11203
|
+
idBackgroundColor: mod2.string().optional(),
|
|
11204
|
+
repeatIdBackgroundImage: mod2.boolean().optional()
|
|
11205
|
+
});
|
|
11192
11206
|
var LCNProfileValidator2 = mod2.object({
|
|
11193
11207
|
profileId: mod2.string().min(3).max(40),
|
|
11194
11208
|
displayName: mod2.string().default(""),
|
|
@@ -11201,7 +11215,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11201
11215
|
websiteLink: mod2.string().optional(),
|
|
11202
11216
|
isServiceProfile: mod2.boolean().default(false).optional(),
|
|
11203
11217
|
type: mod2.string().optional(),
|
|
11204
|
-
notificationsWebhook: mod2.string().url().startsWith("http").optional()
|
|
11218
|
+
notificationsWebhook: mod2.string().url().startsWith("http").optional(),
|
|
11219
|
+
display: LCNProfileDisplayValidator2.optional()
|
|
11205
11220
|
});
|
|
11206
11221
|
var LCNProfileQueryValidator2 = mod2.object({
|
|
11207
11222
|
profileId: StringQuery2,
|
|
@@ -15226,6 +15241,19 @@ var RegExpValidator = mod.instanceof(RegExp).or(
|
|
|
15226
15241
|
})
|
|
15227
15242
|
);
|
|
15228
15243
|
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
|
15244
|
+
var LCNProfileDisplayValidator = mod.object({
|
|
15245
|
+
backgroundColor: mod.string().optional(),
|
|
15246
|
+
backgroundImage: mod.string().optional(),
|
|
15247
|
+
fadeBackgroundImage: mod.boolean().optional(),
|
|
15248
|
+
repeatBackgroundImage: mod.boolean().optional(),
|
|
15249
|
+
fontColor: mod.string().optional(),
|
|
15250
|
+
accentColor: mod.string().optional(),
|
|
15251
|
+
accentFontColor: mod.string().optional(),
|
|
15252
|
+
idBackgroundImage: mod.string().optional(),
|
|
15253
|
+
fadeIdBackgroundImage: mod.boolean().optional(),
|
|
15254
|
+
idBackgroundColor: mod.string().optional(),
|
|
15255
|
+
repeatIdBackgroundImage: mod.boolean().optional()
|
|
15256
|
+
});
|
|
15229
15257
|
var LCNProfileValidator = mod.object({
|
|
15230
15258
|
profileId: mod.string().min(3).max(40),
|
|
15231
15259
|
displayName: mod.string().default(""),
|
|
@@ -15238,7 +15266,8 @@ var LCNProfileValidator = mod.object({
|
|
|
15238
15266
|
websiteLink: mod.string().optional(),
|
|
15239
15267
|
isServiceProfile: mod.boolean().default(false).optional(),
|
|
15240
15268
|
type: mod.string().optional(),
|
|
15241
|
-
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
|
15269
|
+
notificationsWebhook: mod.string().url().startsWith("http").optional(),
|
|
15270
|
+
display: LCNProfileDisplayValidator.optional()
|
|
15242
15271
|
});
|
|
15243
15272
|
var LCNProfileQueryValidator = mod.object({
|
|
15244
15273
|
profileId: StringQuery,
|
|
@@ -15610,9 +15639,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15610
15639
|
let learnCard = initialLearnCard;
|
|
15611
15640
|
learnCard.debug?.("Adding LearnCloud Plugin");
|
|
15612
15641
|
let client = await getLearnCloudClient(url, learnCard);
|
|
15613
|
-
let dids =
|
|
15642
|
+
let dids = [learnCard.id.did()];
|
|
15643
|
+
client.user.getDids.query().then((result) => dids = result);
|
|
15614
15644
|
let otherClients = {};
|
|
15615
|
-
const learnCloudDid =
|
|
15645
|
+
const learnCloudDid = client.utilities.getDid.query();
|
|
15616
15646
|
const getOtherClient = /* @__PURE__ */ __name(async (url2) => {
|
|
15617
15647
|
if (!otherClients[url2])
|
|
15618
15648
|
otherClients[url2] = await getLearnCloudClient(url2, learnCard);
|
|
@@ -15647,7 +15677,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15647
15677
|
unencryptedCustomFields
|
|
15648
15678
|
);
|
|
15649
15679
|
return client.customStorage.create.mutate({
|
|
15650
|
-
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
15680
|
+
item: await generateJWE(_learnCard, await learnCloudDid, item)
|
|
15651
15681
|
});
|
|
15652
15682
|
},
|
|
15653
15683
|
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
@@ -15658,7 +15688,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15658
15688
|
)
|
|
15659
15689
|
);
|
|
15660
15690
|
return client.customStorage.createMany.mutate({
|
|
15661
|
-
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
15691
|
+
items: await generateJWE(_learnCard, await learnCloudDid, items)
|
|
15662
15692
|
});
|
|
15663
15693
|
},
|
|
15664
15694
|
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15711,7 +15741,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15711
15741
|
)
|
|
15712
15742
|
);
|
|
15713
15743
|
const jwe = await client.customStorage.read.query({
|
|
15714
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15744
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15715
15745
|
...unencryptedEntries,
|
|
15716
15746
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15717
15747
|
}),
|
|
@@ -15746,7 +15776,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15746
15776
|
)
|
|
15747
15777
|
);
|
|
15748
15778
|
return client.customStorage.count.query({
|
|
15749
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15779
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15750
15780
|
...unencryptedEntries,
|
|
15751
15781
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15752
15782
|
}),
|
|
@@ -15759,12 +15789,12 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15759
15789
|
const updates = await Promise.all(
|
|
15760
15790
|
documents.map(
|
|
15761
15791
|
async (document) => client.customStorage.update.mutate({
|
|
15762
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15792
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15763
15793
|
_id: document._id
|
|
15764
15794
|
}),
|
|
15765
15795
|
update: await generateJWE(
|
|
15766
15796
|
_learnCard,
|
|
15767
|
-
learnCloudDid,
|
|
15797
|
+
await learnCloudDid,
|
|
15768
15798
|
await generateEncryptedRecord(
|
|
15769
15799
|
_learnCard,
|
|
15770
15800
|
{ ...document, ...update },
|
|
@@ -15790,7 +15820,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15790
15820
|
)
|
|
15791
15821
|
);
|
|
15792
15822
|
return client.customStorage.delete.mutate({
|
|
15793
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15823
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15794
15824
|
...unencryptedEntries,
|
|
15795
15825
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15796
15826
|
}),
|
|
@@ -15928,7 +15958,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15928
15958
|
unencryptedEntries
|
|
15929
15959
|
);
|
|
15930
15960
|
const jwe = await client.index.get.query({
|
|
15931
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15961
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15932
15962
|
...unencryptedEntries,
|
|
15933
15963
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15934
15964
|
}),
|
|
@@ -15974,7 +16004,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15974
16004
|
unencryptedEntries
|
|
15975
16005
|
);
|
|
15976
16006
|
const jwe = await client.index.count.query({
|
|
15977
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
16007
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15978
16008
|
...unencryptedEntries,
|
|
15979
16009
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15980
16010
|
})
|
|
@@ -15988,7 +16018,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15988
16018
|
await updateLearnCard(_learnCard);
|
|
15989
16019
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
15990
16020
|
return client.index.add.mutate({
|
|
15991
|
-
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
16021
|
+
record: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15992
16022
|
...await generateEncryptedRecord(
|
|
15993
16023
|
_learnCard,
|
|
15994
16024
|
{ ...record, id },
|
|
@@ -16016,7 +16046,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
16016
16046
|
})
|
|
16017
16047
|
);
|
|
16018
16048
|
return client.index.addMany.mutate({
|
|
16019
|
-
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
16049
|
+
records: await generateJWE(_learnCard, await learnCloudDid, records)
|
|
16020
16050
|
});
|
|
16021
16051
|
})
|
|
16022
16052
|
);
|
|
@@ -16033,7 +16063,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
16033
16063
|
id: await hash(_learnCard, id),
|
|
16034
16064
|
updates: await generateJWE(
|
|
16035
16065
|
_learnCard,
|
|
16036
|
-
learnCloudDid,
|
|
16066
|
+
await learnCloudDid,
|
|
16037
16067
|
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
16038
16068
|
)
|
|
16039
16069
|
});
|