@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
|
@@ -7261,7 +7261,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
7261
7261
|
const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
|
|
7262
7262
|
return challengeRequester.utilities.getChallenges.query({ amount });
|
|
7263
7263
|
}, "getChallenges");
|
|
7264
|
-
challenges =
|
|
7264
|
+
getChallenges().then((result) => challenges = result);
|
|
7265
7265
|
const trpc = createTRPCProxyClient({
|
|
7266
7266
|
links: [
|
|
7267
7267
|
callbackLink(async () => {
|
|
@@ -7382,6 +7382,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
7382
7382
|
LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator2,
|
|
7383
7383
|
LCNNotificationValidator: () => LCNNotificationValidator2,
|
|
7384
7384
|
LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum2,
|
|
7385
|
+
LCNProfileDisplayValidator: () => LCNProfileDisplayValidator2,
|
|
7385
7386
|
LCNProfileQueryValidator: () => LCNProfileQueryValidator2,
|
|
7386
7387
|
LCNProfileValidator: () => LCNProfileValidator2,
|
|
7387
7388
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
|
|
@@ -11202,6 +11203,19 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11202
11203
|
})
|
|
11203
11204
|
);
|
|
11204
11205
|
var StringQuery2 = mod2.string().or(mod2.object({ $in: mod2.string().array() })).or(mod2.object({ $regex: RegExpValidator2 }));
|
|
11206
|
+
var LCNProfileDisplayValidator2 = mod2.object({
|
|
11207
|
+
backgroundColor: mod2.string().optional(),
|
|
11208
|
+
backgroundImage: mod2.string().optional(),
|
|
11209
|
+
fadeBackgroundImage: mod2.boolean().optional(),
|
|
11210
|
+
repeatBackgroundImage: mod2.boolean().optional(),
|
|
11211
|
+
fontColor: mod2.string().optional(),
|
|
11212
|
+
accentColor: mod2.string().optional(),
|
|
11213
|
+
accentFontColor: mod2.string().optional(),
|
|
11214
|
+
idBackgroundImage: mod2.string().optional(),
|
|
11215
|
+
fadeIdBackgroundImage: mod2.boolean().optional(),
|
|
11216
|
+
idBackgroundColor: mod2.string().optional(),
|
|
11217
|
+
repeatIdBackgroundImage: mod2.boolean().optional()
|
|
11218
|
+
});
|
|
11205
11219
|
var LCNProfileValidator2 = mod2.object({
|
|
11206
11220
|
profileId: mod2.string().min(3).max(40),
|
|
11207
11221
|
displayName: mod2.string().default(""),
|
|
@@ -11214,7 +11228,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
11214
11228
|
websiteLink: mod2.string().optional(),
|
|
11215
11229
|
isServiceProfile: mod2.boolean().default(false).optional(),
|
|
11216
11230
|
type: mod2.string().optional(),
|
|
11217
|
-
notificationsWebhook: mod2.string().url().startsWith("http").optional()
|
|
11231
|
+
notificationsWebhook: mod2.string().url().startsWith("http").optional(),
|
|
11232
|
+
display: LCNProfileDisplayValidator2.optional()
|
|
11218
11233
|
});
|
|
11219
11234
|
var LCNProfileQueryValidator2 = mod2.object({
|
|
11220
11235
|
profileId: StringQuery2,
|
|
@@ -15239,6 +15254,19 @@ var RegExpValidator = mod.instanceof(RegExp).or(
|
|
|
15239
15254
|
})
|
|
15240
15255
|
);
|
|
15241
15256
|
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
|
15257
|
+
var LCNProfileDisplayValidator = mod.object({
|
|
15258
|
+
backgroundColor: mod.string().optional(),
|
|
15259
|
+
backgroundImage: mod.string().optional(),
|
|
15260
|
+
fadeBackgroundImage: mod.boolean().optional(),
|
|
15261
|
+
repeatBackgroundImage: mod.boolean().optional(),
|
|
15262
|
+
fontColor: mod.string().optional(),
|
|
15263
|
+
accentColor: mod.string().optional(),
|
|
15264
|
+
accentFontColor: mod.string().optional(),
|
|
15265
|
+
idBackgroundImage: mod.string().optional(),
|
|
15266
|
+
fadeIdBackgroundImage: mod.boolean().optional(),
|
|
15267
|
+
idBackgroundColor: mod.string().optional(),
|
|
15268
|
+
repeatIdBackgroundImage: mod.boolean().optional()
|
|
15269
|
+
});
|
|
15242
15270
|
var LCNProfileValidator = mod.object({
|
|
15243
15271
|
profileId: mod.string().min(3).max(40),
|
|
15244
15272
|
displayName: mod.string().default(""),
|
|
@@ -15251,7 +15279,8 @@ var LCNProfileValidator = mod.object({
|
|
|
15251
15279
|
websiteLink: mod.string().optional(),
|
|
15252
15280
|
isServiceProfile: mod.boolean().default(false).optional(),
|
|
15253
15281
|
type: mod.string().optional(),
|
|
15254
|
-
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
|
15282
|
+
notificationsWebhook: mod.string().url().startsWith("http").optional(),
|
|
15283
|
+
display: LCNProfileDisplayValidator.optional()
|
|
15255
15284
|
});
|
|
15256
15285
|
var LCNProfileQueryValidator = mod.object({
|
|
15257
15286
|
profileId: StringQuery,
|
|
@@ -15623,9 +15652,10 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15623
15652
|
let learnCard = initialLearnCard;
|
|
15624
15653
|
learnCard.debug?.("Adding LearnCloud Plugin");
|
|
15625
15654
|
let client = await getLearnCloudClient(url, learnCard);
|
|
15626
|
-
let dids =
|
|
15655
|
+
let dids = [learnCard.id.did()];
|
|
15656
|
+
client.user.getDids.query().then((result) => dids = result);
|
|
15627
15657
|
let otherClients = {};
|
|
15628
|
-
const learnCloudDid =
|
|
15658
|
+
const learnCloudDid = client.utilities.getDid.query();
|
|
15629
15659
|
const getOtherClient = /* @__PURE__ */ __name(async (url2) => {
|
|
15630
15660
|
if (!otherClients[url2])
|
|
15631
15661
|
otherClients[url2] = await getLearnCloudClient(url2, learnCard);
|
|
@@ -15660,7 +15690,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15660
15690
|
unencryptedCustomFields
|
|
15661
15691
|
);
|
|
15662
15692
|
return client.customStorage.create.mutate({
|
|
15663
|
-
item: await generateJWE(_learnCard, learnCloudDid, item)
|
|
15693
|
+
item: await generateJWE(_learnCard, await learnCloudDid, item)
|
|
15664
15694
|
});
|
|
15665
15695
|
},
|
|
15666
15696
|
learnCloudCreateMany: async (_learnCard, documents) => {
|
|
@@ -15671,7 +15701,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15671
15701
|
)
|
|
15672
15702
|
);
|
|
15673
15703
|
return client.customStorage.createMany.mutate({
|
|
15674
|
-
items: await generateJWE(_learnCard, learnCloudDid, items)
|
|
15704
|
+
items: await generateJWE(_learnCard, await learnCloudDid, items)
|
|
15675
15705
|
});
|
|
15676
15706
|
},
|
|
15677
15707
|
learnCloudRead: async (_learnCard, query, includeAssociatedDids) => {
|
|
@@ -15724,7 +15754,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15724
15754
|
)
|
|
15725
15755
|
);
|
|
15726
15756
|
const jwe = await client.customStorage.read.query({
|
|
15727
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15757
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15728
15758
|
...unencryptedEntries,
|
|
15729
15759
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15730
15760
|
}),
|
|
@@ -15759,7 +15789,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15759
15789
|
)
|
|
15760
15790
|
);
|
|
15761
15791
|
return client.customStorage.count.query({
|
|
15762
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15792
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15763
15793
|
...unencryptedEntries,
|
|
15764
15794
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15765
15795
|
}),
|
|
@@ -15772,12 +15802,12 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15772
15802
|
const updates = await Promise.all(
|
|
15773
15803
|
documents.map(
|
|
15774
15804
|
async (document) => client.customStorage.update.mutate({
|
|
15775
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15805
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15776
15806
|
_id: document._id
|
|
15777
15807
|
}),
|
|
15778
15808
|
update: await generateJWE(
|
|
15779
15809
|
_learnCard,
|
|
15780
|
-
learnCloudDid,
|
|
15810
|
+
await learnCloudDid,
|
|
15781
15811
|
await generateEncryptedRecord(
|
|
15782
15812
|
_learnCard,
|
|
15783
15813
|
{ ...document, ...update },
|
|
@@ -15803,7 +15833,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15803
15833
|
)
|
|
15804
15834
|
);
|
|
15805
15835
|
return client.customStorage.delete.mutate({
|
|
15806
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15836
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15807
15837
|
...unencryptedEntries,
|
|
15808
15838
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15809
15839
|
}),
|
|
@@ -15941,7 +15971,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15941
15971
|
unencryptedEntries
|
|
15942
15972
|
);
|
|
15943
15973
|
const jwe = await client.index.get.query({
|
|
15944
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
15974
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15945
15975
|
...unencryptedEntries,
|
|
15946
15976
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15947
15977
|
}),
|
|
@@ -15987,7 +16017,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
15987
16017
|
unencryptedEntries
|
|
15988
16018
|
);
|
|
15989
16019
|
const jwe = await client.index.count.query({
|
|
15990
|
-
query: await generateJWE(_learnCard, learnCloudDid, {
|
|
16020
|
+
query: await generateJWE(_learnCard, await learnCloudDid, {
|
|
15991
16021
|
...unencryptedEntries,
|
|
15992
16022
|
...fields.length > 0 ? { fields: { $in: fields } } : {}
|
|
15993
16023
|
})
|
|
@@ -16001,7 +16031,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
16001
16031
|
await updateLearnCard(_learnCard);
|
|
16002
16032
|
const id = record.id || _learnCard.invoke.crypto().randomUUID();
|
|
16003
16033
|
return client.index.add.mutate({
|
|
16004
|
-
record: await generateJWE(_learnCard, learnCloudDid, {
|
|
16034
|
+
record: await generateJWE(_learnCard, await learnCloudDid, {
|
|
16005
16035
|
...await generateEncryptedRecord(
|
|
16006
16036
|
_learnCard,
|
|
16007
16037
|
{ ...record, id },
|
|
@@ -16029,7 +16059,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
16029
16059
|
})
|
|
16030
16060
|
);
|
|
16031
16061
|
return client.index.addMany.mutate({
|
|
16032
|
-
records: await generateJWE(_learnCard, learnCloudDid, records)
|
|
16062
|
+
records: await generateJWE(_learnCard, await learnCloudDid, records)
|
|
16033
16063
|
});
|
|
16034
16064
|
})
|
|
16035
16065
|
);
|
|
@@ -16046,7 +16076,7 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
|
|
|
16046
16076
|
id: await hash(_learnCard, id),
|
|
16047
16077
|
updates: await generateJWE(
|
|
16048
16078
|
_learnCard,
|
|
16049
|
-
learnCloudDid,
|
|
16079
|
+
await learnCloudDid,
|
|
16050
16080
|
await generateEncryptedRecord(_learnCard, newRecord, unencryptedFields)
|
|
16051
16081
|
)
|
|
16052
16082
|
});
|