@learncard/network-plugin 1.8.8 → 2.0.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.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1991,11 +1992,14 @@ var ZodString = class extends ZodType {
1991
1992
  const parsedType = this._getType(input);
1992
1993
  if (parsedType !== ZodParsedType.string) {
1993
1994
  const ctx2 = this._getOrReturnCtx(input);
1994
- addIssueToContext(ctx2, {
1995
- code: ZodIssueCode.invalid_type,
1996
- expected: ZodParsedType.string,
1997
- received: ctx2.parsedType
1998
- });
1995
+ addIssueToContext(
1996
+ ctx2,
1997
+ {
1998
+ code: ZodIssueCode.invalid_type,
1999
+ expected: ZodParsedType.string,
2000
+ received: ctx2.parsedType
2001
+ }
2002
+ );
1999
2003
  return INVALID;
2000
2004
  }
2001
2005
  const status = new ParseStatus();
@@ -3001,7 +3005,9 @@ var ZodObject = class extends ZodType {
3001
3005
  const value = ctx.data[key];
3002
3006
  pairs.push({
3003
3007
  key: { status: "valid", value: key },
3004
- value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
3008
+ value: catchall._parse(
3009
+ new ParseInputLazyPath(ctx, value, ctx.path, key)
3010
+ ),
3005
3011
  alwaysSet: key in ctx.data
3006
3012
  });
3007
3013
  }
@@ -4552,11 +4558,13 @@ var AchievementCriteriaValidator = mod.object({
4552
4558
  type: mod.string().optional(),
4553
4559
  narrative: mod.string().optional()
4554
4560
  });
4555
- var ImageValidator = mod.string().or(mod.object({
4556
- id: mod.string(),
4557
- type: mod.string(),
4558
- caption: mod.string().optional()
4559
- }));
4561
+ var ImageValidator = mod.string().or(
4562
+ mod.object({
4563
+ id: mod.string(),
4564
+ type: mod.string(),
4565
+ caption: mod.string().optional()
4566
+ })
4567
+ );
4560
4568
  var GeoCoordinatesValidator = mod.object({
4561
4569
  type: mod.string().min(1).or(mod.string().array().nonempty()),
4562
4570
  latitude: mod.number(),
@@ -4598,29 +4606,31 @@ var IdentifierEntryValidator = mod.object({
4598
4606
  identifier: mod.string(),
4599
4607
  identifierType: IdentifierTypeValidator
4600
4608
  });
4601
- var ProfileValidator = mod.string().or(mod.object({
4602
- id: mod.string().optional(),
4603
- type: mod.string().or(mod.string().array().nonempty().optional()),
4604
- name: mod.string().optional(),
4605
- url: mod.string().optional(),
4606
- phone: mod.string().optional(),
4607
- description: mod.string().optional(),
4608
- endorsement: mod.any().array().optional(),
4609
- image: ImageValidator.optional(),
4610
- email: mod.string().email().optional(),
4611
- address: AddressValidator.optional(),
4612
- otherIdentifier: IdentifierEntryValidator.array().optional(),
4613
- official: mod.string().optional(),
4614
- parentOrg: mod.any().optional(),
4615
- familyName: mod.string().optional(),
4616
- givenName: mod.string().optional(),
4617
- additionalName: mod.string().optional(),
4618
- patronymicName: mod.string().optional(),
4619
- honorificPrefix: mod.string().optional(),
4620
- honorificSuffix: mod.string().optional(),
4621
- familyNamePrefix: mod.string().optional(),
4622
- dateOfBirth: mod.string().optional()
4623
- }).catchall(mod.any()));
4609
+ var ProfileValidator = mod.string().or(
4610
+ mod.object({
4611
+ id: mod.string().optional(),
4612
+ type: mod.string().or(mod.string().array().nonempty().optional()),
4613
+ name: mod.string().optional(),
4614
+ url: mod.string().optional(),
4615
+ phone: mod.string().optional(),
4616
+ description: mod.string().optional(),
4617
+ endorsement: mod.any().array().optional(),
4618
+ image: ImageValidator.optional(),
4619
+ email: mod.string().email().optional(),
4620
+ address: AddressValidator.optional(),
4621
+ otherIdentifier: IdentifierEntryValidator.array().optional(),
4622
+ official: mod.string().optional(),
4623
+ parentOrg: mod.any().optional(),
4624
+ familyName: mod.string().optional(),
4625
+ givenName: mod.string().optional(),
4626
+ additionalName: mod.string().optional(),
4627
+ patronymicName: mod.string().optional(),
4628
+ honorificPrefix: mod.string().optional(),
4629
+ honorificSuffix: mod.string().optional(),
4630
+ familyNamePrefix: mod.string().optional(),
4631
+ dateOfBirth: mod.string().optional()
4632
+ }).catchall(mod.any())
4633
+ );
4624
4634
  var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
4625
4635
  var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
4626
4636
  var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
@@ -4689,15 +4699,17 @@ var JWEValidator = mod.object({
4689
4699
  aad: mod.string().optional(),
4690
4700
  recipients: JWERecipientValidator.array().optional()
4691
4701
  });
4692
- var VerificationMethodValidator = mod.string().or(mod.object({
4693
- "@context": ContextValidator.optional(),
4694
- id: mod.string(),
4695
- type: mod.string(),
4696
- controller: mod.string(),
4697
- publicKeyJwk: JWKValidator.optional(),
4698
- publicKeyBase58: mod.string().optional(),
4699
- blockChainAccountId: mod.string().optional()
4700
- }).catchall(mod.any()));
4702
+ var VerificationMethodValidator = mod.string().or(
4703
+ mod.object({
4704
+ "@context": ContextValidator.optional(),
4705
+ id: mod.string(),
4706
+ type: mod.string(),
4707
+ controller: mod.string(),
4708
+ publicKeyJwk: JWKValidator.optional(),
4709
+ publicKeyBase58: mod.string().optional(),
4710
+ blockChainAccountId: mod.string().optional()
4711
+ }).catchall(mod.any())
4712
+ );
4701
4713
  var ServiceValidator = mod.object({
4702
4714
  id: mod.string(),
4703
4715
  type: mod.string().or(mod.string().array().nonempty()),
@@ -4895,7 +4907,9 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
4895
4907
  name: mod.string().optional(),
4896
4908
  description: mod.string().optional(),
4897
4909
  image: ImageValidator.optional(),
4898
- credentialSubject: AchievementSubjectValidator.or(AchievementSubjectValidator.array()),
4910
+ credentialSubject: AchievementSubjectValidator.or(
4911
+ AchievementSubjectValidator.array()
4912
+ ),
4899
4913
  endorsement: UnsignedVCValidator.array().optional(),
4900
4914
  evidence: EvidenceValidator.array().optional()
4901
4915
  });
@@ -5124,7 +5138,9 @@ var ConsentFlowTransactionActionValidator = mod.enum([
5124
5138
  ]);
5125
5139
  var ConsentFlowTransactionsQueryValidator = mod.object({
5126
5140
  terms: ConsentFlowTermsQueryValidator.optional(),
5127
- action: ConsentFlowTransactionActionValidator.or(ConsentFlowTransactionActionValidator.array()).optional(),
5141
+ action: ConsentFlowTransactionActionValidator.or(
5142
+ ConsentFlowTransactionActionValidator.array()
5143
+ ).optional(),
5128
5144
  date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
5129
5145
  expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
5130
5146
  oneTime: mod.boolean().optional()
@@ -5325,7 +5341,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5325
5341
  return client.profile.acceptConnectionRequest.mutate({ profileId });
5326
5342
  },
5327
5343
  getConnections: async (_learnCard) => {
5328
- console.warn("The getConnections method is deprecated! Please use getPaginatedConnections instead!");
5344
+ console.warn(
5345
+ "The getConnections method is deprecated! Please use getPaginatedConnections instead!"
5346
+ );
5329
5347
  if (!userData)
5330
5348
  throw new Error("Please make an account first!");
5331
5349
  return client.profile.connections.query();
@@ -5336,7 +5354,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5336
5354
  return client.profile.paginatedConnections.query(options);
5337
5355
  },
5338
5356
  getPendingConnections: async (_learnCard) => {
5339
- console.warn("The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!");
5357
+ console.warn(
5358
+ "The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!"
5359
+ );
5340
5360
  if (!userData)
5341
5361
  throw new Error("Please make an account first!");
5342
5362
  return client.profile.pendingConnections.query();
@@ -5347,7 +5367,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5347
5367
  return client.profile.paginatedPendingConnections.query(options);
5348
5368
  },
5349
5369
  getConnectionRequests: async (_learnCard) => {
5350
- console.warn("The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!");
5370
+ console.warn(
5371
+ "The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!"
5372
+ );
5351
5373
  if (!userData)
5352
5374
  throw new Error("Please make an account first!");
5353
5375
  return client.profile.connectionRequests.query();
@@ -5465,7 +5487,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5465
5487
  return client.boost.getBoost.query({ uri });
5466
5488
  },
5467
5489
  getBoosts: async (_learnCard, query) => {
5468
- console.warn("The getBoosts method is deprecated! Please use getPaginatedBoosts instead!");
5490
+ console.warn(
5491
+ "The getBoosts method is deprecated! Please use getPaginatedBoosts instead!"
5492
+ );
5469
5493
  if (!userData)
5470
5494
  throw new Error("Please make an account first!");
5471
5495
  return client.boost.getBoosts.query({ query });
@@ -5481,7 +5505,9 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5481
5505
  return client.boost.getPaginatedBoosts.query(options);
5482
5506
  },
5483
5507
  getBoostRecipients: async (_learnCard, uri, limit = 25, skip = void 0, includeUnacceptedBoosts = true) => {
5484
- console.warn("The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!");
5508
+ console.warn(
5509
+ "The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!"
5510
+ );
5485
5511
  if (!userData)
5486
5512
  throw new Error("Please make an account first!");
5487
5513
  return client.boost.getBoostRecipients.query({
@@ -5722,13 +5748,20 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
5722
5748
  description: "Adds a check for validating Boost Credentials.",
5723
5749
  methods: {
5724
5750
  verifyCredential: async (_learnCard, credential, options) => {
5725
- const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);
5751
+ const verificationCheck = await learnCard.invoke.verifyCredential(
5752
+ credential,
5753
+ options
5754
+ );
5726
5755
  const boostCredential = credential?.boostCredential;
5727
5756
  try {
5728
5757
  if (boostCredential) {
5729
- const verifyBoostCredential = await learnCard.invoke.verifyCredential(boostCredential);
5758
+ const verifyBoostCredential = await learnCard.invoke.verifyCredential(
5759
+ boostCredential
5760
+ );
5730
5761
  if (!boostCredential?.boostId && !credential?.boostId) {
5731
- verificationCheck.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing.");
5762
+ verificationCheck.warnings.push(
5763
+ "Boost Authenticity could not be verified: Boost ID metadata is missing."
5764
+ );
5732
5765
  }
5733
5766
  if (verifyBoostCredential.errors?.length > 0) {
5734
5767
  verificationCheck.errors = [
@@ -5737,13 +5770,21 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
5737
5770
  "Boost Credential could not be verified."
5738
5771
  ];
5739
5772
  } else if (boostCredential?.boostId !== credential?.boostId) {
5740
- verificationCheck.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");
5773
+ verificationCheck.errors.push(
5774
+ "Boost Authenticity could not be verified: Boost ID metadata is mismatched."
5775
+ );
5741
5776
  } else {
5742
5777
  const trustedBoostIssuer = getTrustedBoostVerifier(credential?.issuer);
5743
5778
  if (trustedBoostIssuer) {
5744
- verificationCheck.checks.push(`Boost is Authentic. Verified by ${trustedBoostIssuer.id}.`);
5779
+ verificationCheck.checks.push(
5780
+ `Boost is Authentic. Verified by ${trustedBoostIssuer.id}.`
5781
+ );
5745
5782
  } else {
5746
- verificationCheck.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(credential?.issuer)}`);
5783
+ verificationCheck.warnings.push(
5784
+ `Boost Authenticity could not be verified. Issuer is outside of trust network: ${getIssuerDID(
5785
+ credential?.issuer
5786
+ )}`
5787
+ );
5747
5788
  }
5748
5789
  }
5749
5790
  }