@learncard/network-plugin 2.10.12 → 2.10.14
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 +46 -5
- package/dist/lcn-plugin.cjs.development.js.map +2 -2
- package/dist/lcn-plugin.cjs.production.min.js +9 -9
- package/dist/lcn-plugin.cjs.production.min.js.map +3 -3
- package/dist/lcn-plugin.esm.js +46 -5
- package/dist/lcn-plugin.esm.js.map +2 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +16 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -13586,6 +13586,8 @@ var LCNProfileDisplayValidator = external_exports.object({
|
|
|
13586
13586
|
idBackgroundColor: external_exports.string().optional(),
|
|
13587
13587
|
repeatIdBackgroundImage: external_exports.boolean().optional()
|
|
13588
13588
|
});
|
|
13589
|
+
var ProfileVisibilityEnum = external_exports.enum(["public", "connections_only", "private"]);
|
|
13590
|
+
var AllowConnectionRequestsEnum = external_exports.enum(["anyone", "invite_only"]);
|
|
13589
13591
|
var LCNProfileValidator = external_exports.object({
|
|
13590
13592
|
profileId: external_exports.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
|
13591
13593
|
displayName: external_exports.string().default("").describe("Human-readable display name for the profile."),
|
|
@@ -13593,6 +13595,9 @@ var LCNProfileValidator = external_exports.object({
|
|
|
13593
13595
|
bio: external_exports.string().default("").describe("Longer bio for the profile."),
|
|
13594
13596
|
did: external_exports.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
|
13595
13597
|
isPrivate: external_exports.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
|
13598
|
+
profileVisibility: ProfileVisibilityEnum.default("public").optional().describe("Profile visibility: 'public', 'connections_only', or 'private'."),
|
|
13599
|
+
showEmail: external_exports.boolean().default(false).optional().describe("Whether to show email to connections."),
|
|
13600
|
+
allowConnectionRequests: AllowConnectionRequestsEnum.default("anyone").optional().describe("Who can send connection requests: 'anyone' or 'invite_only'."),
|
|
13596
13601
|
email: external_exports.string().optional().describe("Contact email address for the profile. (deprecated)"),
|
|
13597
13602
|
image: external_exports.string().optional().describe("Profile image URL for the profile."),
|
|
13598
13603
|
heroImage: external_exports.string().optional().describe("Hero image URL for the profile."),
|
|
@@ -13607,6 +13612,32 @@ var LCNProfileValidator = external_exports.object({
|
|
|
13607
13612
|
country: external_exports.string().optional().describe("Country for the profile."),
|
|
13608
13613
|
approved: external_exports.boolean().optional().describe("Approval status for the profile.")
|
|
13609
13614
|
});
|
|
13615
|
+
var LCNPublicProfileValidator = LCNProfileValidator.pick({
|
|
13616
|
+
profileId: true,
|
|
13617
|
+
displayName: true,
|
|
13618
|
+
shortBio: true,
|
|
13619
|
+
image: true,
|
|
13620
|
+
heroImage: true,
|
|
13621
|
+
type: true,
|
|
13622
|
+
isServiceProfile: true,
|
|
13623
|
+
display: true
|
|
13624
|
+
});
|
|
13625
|
+
var LCNAuthedProfileValidator = LCNPublicProfileValidator.extend({
|
|
13626
|
+
bio: LCNProfileValidator.shape.bio,
|
|
13627
|
+
websiteLink: LCNProfileValidator.shape.websiteLink,
|
|
13628
|
+
role: LCNProfileValidator.shape.role,
|
|
13629
|
+
highlightedCredentials: LCNProfileValidator.shape.highlightedCredentials,
|
|
13630
|
+
did: LCNProfileValidator.shape.did
|
|
13631
|
+
});
|
|
13632
|
+
var LCNConnectionProfileValidator = LCNAuthedProfileValidator.extend({
|
|
13633
|
+
email: LCNProfileValidator.shape.email
|
|
13634
|
+
});
|
|
13635
|
+
var LCNVisibleProfileValidator = external_exports.union([
|
|
13636
|
+
LCNConnectionProfileValidator.strict(),
|
|
13637
|
+
LCNAuthedProfileValidator.strict(),
|
|
13638
|
+
LCNPublicProfileValidator.strict(),
|
|
13639
|
+
LCNProfileValidator
|
|
13640
|
+
]);
|
|
13610
13641
|
var LCNProfileQueryValidator = external_exports.object({
|
|
13611
13642
|
profileId: StringQuery,
|
|
13612
13643
|
displayName: StringQuery,
|
|
@@ -13620,6 +13651,9 @@ var LCNProfileQueryValidator = external_exports.object({
|
|
|
13620
13651
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
13621
13652
|
records: LCNProfileValidator.array()
|
|
13622
13653
|
});
|
|
13654
|
+
var PaginatedVisibleLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
13655
|
+
records: LCNVisibleProfileValidator.array()
|
|
13656
|
+
});
|
|
13623
13657
|
var LCNProfileConnectionStatusEnum = external_exports.enum([
|
|
13624
13658
|
"CONNECTED",
|
|
13625
13659
|
"PENDING_REQUEST_SENT",
|
|
@@ -13753,7 +13787,7 @@ var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
|
|
13753
13787
|
records: BoostValidator.array()
|
|
13754
13788
|
});
|
|
13755
13789
|
var BoostRecipientValidator = external_exports.object({
|
|
13756
|
-
to:
|
|
13790
|
+
to: LCNVisibleProfileValidator,
|
|
13757
13791
|
from: external_exports.string(),
|
|
13758
13792
|
received: external_exports.string().optional(),
|
|
13759
13793
|
uri: external_exports.string().optional()
|
|
@@ -13762,7 +13796,7 @@ var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
|
13762
13796
|
records: BoostRecipientValidator.array()
|
|
13763
13797
|
});
|
|
13764
13798
|
var BoostRecipientWithChildrenValidator = external_exports.object({
|
|
13765
|
-
to:
|
|
13799
|
+
to: LCNVisibleProfileValidator,
|
|
13766
13800
|
from: external_exports.string(),
|
|
13767
13801
|
received: external_exports.string().optional(),
|
|
13768
13802
|
boostUris: external_exports.array(external_exports.string()),
|
|
@@ -13834,8 +13868,8 @@ var SendBoostInputValidator = external_exports.object({
|
|
|
13834
13868
|
),
|
|
13835
13869
|
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
13836
13870
|
integrationId: external_exports.string().optional().describe("Integration ID for activity tracking")
|
|
13837
|
-
}).refine((data) => data.templateUri || data.template, {
|
|
13838
|
-
message: "Either templateUri
|
|
13871
|
+
}).refine((data) => data.templateUri || data.template || data.signedCredential, {
|
|
13872
|
+
message: "Either templateUri, template, or signedCredential must be provided.",
|
|
13839
13873
|
path: ["templateUri"]
|
|
13840
13874
|
});
|
|
13841
13875
|
var SendInboxResponseValidator = external_exports.object({
|
|
@@ -15257,6 +15291,9 @@ var renderTemplateJson = /* @__PURE__ */ __name((jsonString, templateData) => {
|
|
|
15257
15291
|
const unescapedTemplate = jsonString.replace(/\{\{([^{}]+)\}\}/g, "{{{$1}}}");
|
|
15258
15292
|
return mustache_default.render(unescapedTemplate, preparedData);
|
|
15259
15293
|
}, "renderTemplateJson");
|
|
15294
|
+
var hasDid = /* @__PURE__ */ __name((profile) => {
|
|
15295
|
+
return !!profile && "did" in profile && typeof profile.did === "string" && profile.did.length > 0;
|
|
15296
|
+
}, "hasDid");
|
|
15260
15297
|
async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, options) {
|
|
15261
15298
|
const apiToken = typeof apiTokenOrOptions === "string" ? apiTokenOrOptions : void 0;
|
|
15262
15299
|
const guardianApprovalGetter = (typeof apiTokenOrOptions === "object" ? apiTokenOrOptions?.guardianApprovalGetter : void 0) ?? options?.guardianApprovalGetter;
|
|
@@ -15587,6 +15624,7 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15587
15624
|
}
|
|
15588
15625
|
const target = await _learnCard.invoke.getProfile(profileId);
|
|
15589
15626
|
if (!target) throw new Error("Could not find target account");
|
|
15627
|
+
if (!hasDid(target)) throw new Error("Could not find target DID");
|
|
15590
15628
|
const credential = await _learnCard.invoke.createDagJwe(vc, [
|
|
15591
15629
|
_learnCard.id.did(),
|
|
15592
15630
|
target.did
|
|
@@ -15631,6 +15669,7 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15631
15669
|
}
|
|
15632
15670
|
const target = await _learnCard.invoke.getProfile(profileId);
|
|
15633
15671
|
if (!target) throw new Error("Could not find target account");
|
|
15672
|
+
if (!hasDid(target)) throw new Error("Could not find target DID");
|
|
15634
15673
|
const presentation = await _learnCard.invoke.createDagJwe(vp, [
|
|
15635
15674
|
_learnCard.id.did(),
|
|
15636
15675
|
target.did
|
|
@@ -15885,6 +15924,7 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15885
15924
|
if (!data.success) throw new Error("Did not get a valid boost from URI");
|
|
15886
15925
|
const targetProfile = await _learnCard.invoke.getProfile(profileId);
|
|
15887
15926
|
if (!targetProfile) throw new Error("Target profile not found");
|
|
15927
|
+
if (!hasDid(targetProfile)) throw new Error("Target profile has no DID");
|
|
15888
15928
|
let boost = data.data;
|
|
15889
15929
|
if ((0, import_helpers.isVC2Format)(boost)) {
|
|
15890
15930
|
boost.validFrom = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -15999,7 +16039,8 @@ async function getLearnCardNetworkPlugin(learnCard, url2, apiTokenOrOptions, opt
|
|
|
15999
16039
|
targetDid = recipient;
|
|
16000
16040
|
} else {
|
|
16001
16041
|
const targetProfile = await _learnCard.invoke.getProfile(recipient);
|
|
16002
|
-
if (!targetProfile)
|
|
16042
|
+
if (!hasDid(targetProfile))
|
|
16043
|
+
return client.boost.send.mutate(input);
|
|
16003
16044
|
targetDid = targetProfile.did;
|
|
16004
16045
|
}
|
|
16005
16046
|
let boost = data.data;
|