@learncard/network-plugin 2.2.3 → 2.4.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/lcn-plugin.cjs.development.js +118 -11
- package/dist/lcn-plugin.cjs.development.js.map +3 -3
- package/dist/lcn-plugin.cjs.production.min.js +2 -2
- package/dist/lcn-plugin.cjs.production.min.js.map +3 -3
- package/dist/lcn-plugin.esm.js +118 -11
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +17 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -1265,6 +1265,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1265
1265
|
LCNNotificationValidator: () => LCNNotificationValidator2,
|
|
1266
1266
|
LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum2,
|
|
1267
1267
|
LCNProfileDisplayValidator: () => LCNProfileDisplayValidator2,
|
|
1268
|
+
LCNProfileManagerQueryValidator: () => LCNProfileManagerQueryValidator2,
|
|
1269
|
+
LCNProfileManagerValidator: () => LCNProfileManagerValidator2,
|
|
1268
1270
|
LCNProfileQueryValidator: () => LCNProfileQueryValidator2,
|
|
1269
1271
|
LCNProfileValidator: () => LCNProfileValidator2,
|
|
1270
1272
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
|
|
@@ -1277,6 +1279,8 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
1277
1279
|
PaginatedConsentFlowTransactionsValidator: () => PaginatedConsentFlowTransactionsValidator2,
|
|
1278
1280
|
PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator2,
|
|
1279
1281
|
PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator2,
|
|
1282
|
+
PaginatedLCNProfileManagersValidator: () => PaginatedLCNProfileManagersValidator2,
|
|
1283
|
+
PaginatedLCNProfilesAndManagersValidator: () => PaginatedLCNProfilesAndManagersValidator2,
|
|
1280
1284
|
PaginatedLCNProfilesValidator: () => PaginatedLCNProfilesValidator2,
|
|
1281
1285
|
PaginationOptionsValidator: () => PaginationOptionsValidator2,
|
|
1282
1286
|
PaginationResponseValidator: () => PaginationResponseValidator2,
|
|
@@ -5147,6 +5151,32 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
5147
5151
|
"PENDING_REQUEST_RECEIVED",
|
|
5148
5152
|
"NOT_CONNECTED"
|
|
5149
5153
|
]);
|
|
5154
|
+
var LCNProfileManagerValidator2 = mod2.object({
|
|
5155
|
+
id: mod2.string(),
|
|
5156
|
+
created: mod2.string(),
|
|
5157
|
+
displayName: mod2.string().default("").optional(),
|
|
5158
|
+
shortBio: mod2.string().default("").optional(),
|
|
5159
|
+
bio: mod2.string().default("").optional(),
|
|
5160
|
+
email: mod2.string().optional(),
|
|
5161
|
+
image: mod2.string().optional(),
|
|
5162
|
+
heroImage: mod2.string().optional()
|
|
5163
|
+
});
|
|
5164
|
+
var PaginatedLCNProfileManagersValidator2 = PaginationResponseValidator2.extend({
|
|
5165
|
+
records: LCNProfileManagerValidator2.extend({ did: mod2.string() }).array()
|
|
5166
|
+
});
|
|
5167
|
+
var LCNProfileManagerQueryValidator2 = mod2.object({
|
|
5168
|
+
id: StringQuery2,
|
|
5169
|
+
displayName: StringQuery2,
|
|
5170
|
+
shortBio: StringQuery2,
|
|
5171
|
+
bio: StringQuery2,
|
|
5172
|
+
email: StringQuery2
|
|
5173
|
+
}).partial();
|
|
5174
|
+
var PaginatedLCNProfilesAndManagersValidator2 = PaginationResponseValidator2.extend({
|
|
5175
|
+
records: mod2.object({
|
|
5176
|
+
profile: LCNProfileValidator2,
|
|
5177
|
+
manager: LCNProfileManagerValidator2.extend({ did: mod2.string() }).optional()
|
|
5178
|
+
}).array()
|
|
5179
|
+
});
|
|
5150
5180
|
var SentCredentialInfoValidator2 = mod2.object({
|
|
5151
5181
|
uri: mod2.string(),
|
|
5152
5182
|
to: mod2.string(),
|
|
@@ -5165,6 +5195,7 @@ var require_helpers_cjs_development = __commonJS({
|
|
|
5165
5195
|
canEditChildren: mod2.string(),
|
|
5166
5196
|
canRevokeChildren: mod2.string(),
|
|
5167
5197
|
canManageChildrenPermissions: mod2.string(),
|
|
5198
|
+
canManageChildrenProfiles: mod2.boolean().default(false).optional(),
|
|
5168
5199
|
canViewAnalytics: mod2.boolean()
|
|
5169
5200
|
});
|
|
5170
5201
|
var LCNBoostStatus2 = mod2.enum(["DRAFT", "LIVE"]);
|
|
@@ -5493,7 +5524,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
5493
5524
|
const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
|
|
5494
5525
|
return challengeRequester.utilities.getChallenges.query({ amount });
|
|
5495
5526
|
}, "getChallenges");
|
|
5496
|
-
challenges =
|
|
5527
|
+
getChallenges().then((result) => challenges = result);
|
|
5497
5528
|
const trpc = createTRPCProxyClient({
|
|
5498
5529
|
transformer: {
|
|
5499
5530
|
input: import_helpers.RegExpTransformer,
|
|
@@ -9321,6 +9352,32 @@ var LCNProfileConnectionStatusEnum = mod.enum([
|
|
|
9321
9352
|
"PENDING_REQUEST_RECEIVED",
|
|
9322
9353
|
"NOT_CONNECTED"
|
|
9323
9354
|
]);
|
|
9355
|
+
var LCNProfileManagerValidator = mod.object({
|
|
9356
|
+
id: mod.string(),
|
|
9357
|
+
created: mod.string(),
|
|
9358
|
+
displayName: mod.string().default("").optional(),
|
|
9359
|
+
shortBio: mod.string().default("").optional(),
|
|
9360
|
+
bio: mod.string().default("").optional(),
|
|
9361
|
+
email: mod.string().optional(),
|
|
9362
|
+
image: mod.string().optional(),
|
|
9363
|
+
heroImage: mod.string().optional()
|
|
9364
|
+
});
|
|
9365
|
+
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
|
9366
|
+
records: LCNProfileManagerValidator.extend({ did: mod.string() }).array()
|
|
9367
|
+
});
|
|
9368
|
+
var LCNProfileManagerQueryValidator = mod.object({
|
|
9369
|
+
id: StringQuery,
|
|
9370
|
+
displayName: StringQuery,
|
|
9371
|
+
shortBio: StringQuery,
|
|
9372
|
+
bio: StringQuery,
|
|
9373
|
+
email: StringQuery
|
|
9374
|
+
}).partial();
|
|
9375
|
+
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
|
9376
|
+
records: mod.object({
|
|
9377
|
+
profile: LCNProfileValidator,
|
|
9378
|
+
manager: LCNProfileManagerValidator.extend({ did: mod.string() }).optional()
|
|
9379
|
+
}).array()
|
|
9380
|
+
});
|
|
9324
9381
|
var SentCredentialInfoValidator = mod.object({
|
|
9325
9382
|
uri: mod.string(),
|
|
9326
9383
|
to: mod.string(),
|
|
@@ -9339,6 +9396,7 @@ var BoostPermissionsValidator = mod.object({
|
|
|
9339
9396
|
canEditChildren: mod.string(),
|
|
9340
9397
|
canRevokeChildren: mod.string(),
|
|
9341
9398
|
canManageChildrenPermissions: mod.string(),
|
|
9399
|
+
canManageChildrenProfiles: mod.boolean().default(false).optional(),
|
|
9342
9400
|
canViewAnalytics: mod.boolean()
|
|
9343
9401
|
});
|
|
9344
9402
|
var LCNBoostStatus = mod.enum(["DRAFT", "LIVE"]);
|
|
@@ -9554,7 +9612,7 @@ var LCNNotificationValidator = mod.object({
|
|
|
9554
9612
|
|
|
9555
9613
|
// src/plugin.ts
|
|
9556
9614
|
var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) => {
|
|
9557
|
-
|
|
9615
|
+
let did = learnCard.id.did();
|
|
9558
9616
|
learnCard?.debug?.("Adding LearnCardNetwork Plugin");
|
|
9559
9617
|
const client = await getClient(url, async (challenge) => {
|
|
9560
9618
|
const jwt = await learnCard.invoke.getDidAuthVp({ proofFormat: "jwt", challenge });
|
|
@@ -9563,12 +9621,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9563
9621
|
return jwt;
|
|
9564
9622
|
});
|
|
9565
9623
|
let userData;
|
|
9566
|
-
|
|
9567
|
-
userData =
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
}
|
|
9571
|
-
let did = userData?.did || existingDid;
|
|
9624
|
+
const initialQuery = client.profile.getProfile.query().then((result) => {
|
|
9625
|
+
userData = result;
|
|
9626
|
+
if (userData?.did)
|
|
9627
|
+
did = userData.did;
|
|
9628
|
+
});
|
|
9572
9629
|
return {
|
|
9573
9630
|
name: "LearnCard Network",
|
|
9574
9631
|
displayName: "LearnCard Network",
|
|
@@ -9632,12 +9689,39 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9632
9689
|
did = newDid;
|
|
9633
9690
|
return newDid;
|
|
9634
9691
|
},
|
|
9692
|
+
createManagedProfile: async (_learnCard, profile) => {
|
|
9693
|
+
const newDid = await client.profileManager.createManagedProfile.mutate(profile);
|
|
9694
|
+
return newDid;
|
|
9695
|
+
},
|
|
9696
|
+
createProfileManager: async (_learnCard, profile) => {
|
|
9697
|
+
if (!userData)
|
|
9698
|
+
throw new Error("Please make an account first!");
|
|
9699
|
+
const newDid = await client.profileManager.createProfileManager.mutate(profile);
|
|
9700
|
+
return newDid;
|
|
9701
|
+
},
|
|
9702
|
+
createChildProfileManager: async (_learnCard, parentUri, profile) => {
|
|
9703
|
+
if (!userData)
|
|
9704
|
+
throw new Error("Please make an account first!");
|
|
9705
|
+
const newDid = await client.profileManager.createChildProfileManager.mutate({
|
|
9706
|
+
parentUri,
|
|
9707
|
+
profile
|
|
9708
|
+
});
|
|
9709
|
+
return newDid;
|
|
9710
|
+
},
|
|
9635
9711
|
createManagedServiceProfile: async (_learnCard, profile) => {
|
|
9636
9712
|
if (!userData)
|
|
9637
9713
|
throw new Error("Please make an account first!");
|
|
9638
9714
|
const newDid = await client.profile.createManagedServiceProfile.mutate(profile);
|
|
9639
9715
|
return newDid;
|
|
9640
9716
|
},
|
|
9717
|
+
getAvailableProfiles: async (_learnCard, options = {}) => {
|
|
9718
|
+
if (!userData)
|
|
9719
|
+
throw new Error("Please make an account first!");
|
|
9720
|
+
return client.profile.getAvailableProfiles.query(options);
|
|
9721
|
+
},
|
|
9722
|
+
getManagedProfiles: async (_learnCard, options = {}) => {
|
|
9723
|
+
return client.profileManager.getManagedProfiles.query(options);
|
|
9724
|
+
},
|
|
9641
9725
|
getManagedServiceProfiles: async (_learnCard, options = {}) => {
|
|
9642
9726
|
if (!userData)
|
|
9643
9727
|
throw new Error("Please make an account first!");
|
|
@@ -9653,6 +9737,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9653
9737
|
}
|
|
9654
9738
|
return false;
|
|
9655
9739
|
},
|
|
9740
|
+
updateProfileManagerProfile: async (_learnCard, manager) => {
|
|
9741
|
+
return client.profileManager.updateProfileManager.mutate(manager);
|
|
9742
|
+
},
|
|
9656
9743
|
deleteProfile: async () => {
|
|
9657
9744
|
if (!userData)
|
|
9658
9745
|
throw new Error("Account does not exist!");
|
|
@@ -9664,10 +9751,16 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9664
9751
|
return false;
|
|
9665
9752
|
},
|
|
9666
9753
|
getProfile: async (_learnCard, profileId) => {
|
|
9754
|
+
await initialQuery;
|
|
9667
9755
|
if (!profileId)
|
|
9668
9756
|
return client.profile.getProfile.query();
|
|
9669
9757
|
return client.profile.getOtherProfile.query({ profileId });
|
|
9670
9758
|
},
|
|
9759
|
+
getProfileManagerProfile: async (_learnCard, id) => {
|
|
9760
|
+
if (!id)
|
|
9761
|
+
return client.profileManager.getProfileManager.query();
|
|
9762
|
+
return client.profileManager.getOtherProfileManager.query({ id });
|
|
9763
|
+
},
|
|
9671
9764
|
searchProfiles: async (_learnCard, input = "", {
|
|
9672
9765
|
limit = 25,
|
|
9673
9766
|
includeSelf = false,
|
|
@@ -9958,6 +10051,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9958
10051
|
throw new Error("Please make an account first!");
|
|
9959
10052
|
return client.boost.getBoostRecipientCount.query({ uri, includeUnacceptedBoosts });
|
|
9960
10053
|
},
|
|
10054
|
+
getBoostChildrenProfileManagers: async (_learnCard, uri, options) => {
|
|
10055
|
+
if (!userData)
|
|
10056
|
+
throw new Error("Please make an account first!");
|
|
10057
|
+
return client.boost.getChildrenProfileManagers.query({ uri, ...options });
|
|
10058
|
+
},
|
|
9961
10059
|
updateBoost: async (_learnCard, uri, updates, credential) => {
|
|
9962
10060
|
if (!userData)
|
|
9963
10061
|
throw new Error("Please make an account first!");
|
|
@@ -9983,17 +10081,26 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
9983
10081
|
throw new Error("Please make an account first!");
|
|
9984
10082
|
if (!profileId)
|
|
9985
10083
|
return client.boost.updateBoostPermissions.query({ uri, updates });
|
|
9986
|
-
|
|
10084
|
+
const result = await client.boost.updateOtherBoostPermissions.query({ uri, profileId, updates });
|
|
10085
|
+
if (result)
|
|
10086
|
+
await _learnCard.invoke.clearDidWebCache?.();
|
|
10087
|
+
return result;
|
|
9987
10088
|
},
|
|
9988
10089
|
addBoostAdmin: async (_learnCard, uri, profileId) => {
|
|
9989
10090
|
if (!userData)
|
|
9990
10091
|
throw new Error("Please make an account first!");
|
|
9991
|
-
|
|
10092
|
+
const result = await client.boost.addBoostAdmin.mutate({ uri, profileId });
|
|
10093
|
+
if (result)
|
|
10094
|
+
await _learnCard.invoke.clearDidWebCache?.();
|
|
10095
|
+
return result;
|
|
9992
10096
|
},
|
|
9993
10097
|
removeBoostAdmin: async (_learnCard, uri, profileId) => {
|
|
9994
10098
|
if (!userData)
|
|
9995
10099
|
throw new Error("Please make an account first!");
|
|
9996
|
-
|
|
10100
|
+
const result = await client.boost.removeBoostAdmin.mutate({ uri, profileId });
|
|
10101
|
+
if (result)
|
|
10102
|
+
await _learnCard.invoke.clearDidWebCache?.();
|
|
10103
|
+
return result;
|
|
9997
10104
|
},
|
|
9998
10105
|
deleteBoost: async (_learnCard, uri) => {
|
|
9999
10106
|
if (!userData)
|