@learncard/core 6.3.1 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/core.d.ts CHANGED
@@ -4645,23 +4645,18 @@ declare const VerificationItemValidator: z.ZodObject<{
4645
4645
  check: string;
4646
4646
  }>;
4647
4647
  export declare type VerificationItem = z.infer<typeof VerificationItemValidator>;
4648
- declare const IDXCredentialValidator: z.ZodObject<{
4649
- id: z.ZodString;
4650
- title: z.ZodString;
4651
- storageType: z.ZodOptional<z.ZodEnum<[
4652
- "ceramic"
4653
- ]>>;
4654
- }, "strip", z.ZodTypeAny, {
4655
- storageType?: "ceramic" | undefined;
4656
- id: string;
4657
- title: string;
4658
- }, {
4659
- storageType?: "ceramic" | undefined;
4648
+ declare const StorageTypeValidator: z.ZodEnum<[
4649
+ "ceramic"
4650
+ ]>;
4651
+ /** @group IDXPlugin */
4652
+ export declare type StorageType = z.infer<typeof StorageTypeValidator>;
4653
+ /** @group IDXPlugin */
4654
+ export declare type IDXCredential<Metadata extends Record<string, any> = Record<never, never>> = {
4660
4655
  id: string;
4661
4656
  title: string;
4662
- }>;
4663
- /** @group IDXPlugin */
4664
- export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4657
+ storageType?: StorageType;
4658
+ [key: string]: any;
4659
+ } & Metadata;
4665
4660
  declare const JWKValidator: z.ZodObject<{
4666
4661
  kty: z.ZodString;
4667
4662
  crv: z.ZodString;
@@ -4764,46 +4759,20 @@ export declare type CeramicIDXArgs = {
4764
4759
  };
4765
4760
  /** @group IDXPlugin */
4766
4761
  export declare type IDXPluginMethods = {
4767
- getCredentialsListFromIdx: (alias?: string) => Promise<CredentialsList>;
4762
+ getCredentialsListFromIdx: <Metadata extends Record<string, any> = Record<never, never>>(alias?: string) => Promise<CredentialsList<Metadata>>;
4768
4763
  publishContentToCeramic: (cred: any) => Promise<string>;
4769
4764
  readContentFromCeramic: (streamId: string) => Promise<any>;
4770
4765
  getVerifiableCredentialFromIdx: (title: string) => Promise<VC>;
4771
4766
  getVerifiableCredentialsFromIdx: () => Promise<VC[]>;
4772
- addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
4767
+ addVerifiableCredentialInIdx: <Metadata extends Record<string, any> = Record<never, never>>(cred: IDXCredential<Metadata>) => Promise<StreamID>;
4773
4768
  removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
4774
4769
  };
4775
4770
  /** @group IDXPlugin */
4776
- export declare const CredentialsListValidator: z.ZodObject<{
4777
- credentials: z.ZodArray<z.ZodObject<{
4778
- id: z.ZodString;
4779
- title: z.ZodString;
4780
- storageType: z.ZodOptional<z.ZodEnum<[
4781
- "ceramic"
4782
- ]>>;
4783
- }, "strip", z.ZodTypeAny, {
4784
- storageType?: "ceramic" | undefined;
4785
- id: string;
4786
- title: string;
4787
- }, {
4788
- storageType?: "ceramic" | undefined;
4789
- id: string;
4790
- title: string;
4791
- }>, "many">;
4792
- }, "strict", z.ZodTypeAny, {
4793
- credentials: {
4794
- storageType?: "ceramic" | undefined;
4795
- id: string;
4796
- title: string;
4797
- }[];
4798
- }, {
4799
- credentials: {
4800
- storageType?: "ceramic" | undefined;
4801
- id: string;
4802
- title: string;
4803
- }[];
4804
- }>;
4771
+ export declare type CredentialsList<Metadata extends Record<string, any> = Record<never, never>> = {
4772
+ credentials: Array<IDXCredential<Metadata>>;
4773
+ };
4805
4774
  /** @group IDXPlugin */
4806
- export declare type CredentialsList = z.infer<typeof CredentialsListValidator>;
4775
+ export declare const CredentialsListValidator: z.ZodType<CredentialsList>;
4807
4776
  export declare type Last<T extends any[]> = T extends [
4808
4777
  ...any[],
4809
4778
  infer R
@@ -5090,7 +5059,7 @@ export declare type GetCredentials = () => Promise<VC[]>;
5090
5059
  *
5091
5060
  * @group LearnCard Methods
5092
5061
  */
5093
- export declare type GetCredentialsList = () => Promise<IDXCredential[]>;
5062
+ export declare type GetCredentialsList = <Metadata extends Record<string, any> = Record<never, never>>() => Promise<IDXCredential<Metadata>[]>;
5094
5063
  /**
5095
5064
  * Publishes a credential to Ceramic, returning the credential's stream ID
5096
5065
  *
@@ -5110,7 +5079,7 @@ export declare type PublishCredential = (credential: VC) => Promise<string>;
5110
5079
  *
5111
5080
  * @group LearnCard Methods
5112
5081
  */
5113
- export declare type AddCredential = (credential: IDXCredential) => Promise<void>;
5082
+ export declare type AddCredential = <Metadata extends Record<string, any> = Record<never, never>>(credential: IDXCredential<Metadata>) => Promise<void>;
5114
5083
  /**
5115
5084
  * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
5116
5085
  * to IDX with a bespoke title
package/dist/core.esm.js CHANGED
@@ -42181,7 +42181,7 @@ var AlignmentValidator = mod.object({
42181
42181
  targetType: AlignmentTargetTypeValidator.optional(),
42182
42182
  targetUrl: mod.string()
42183
42183
  });
42184
- var AchievementTypeValidator = mod.enum([
42184
+ var KnownAchievementTypeValidator = mod.enum([
42185
42185
  "Achievement",
42186
42186
  "ApprenticeshipCertificate",
42187
42187
  "Assessment",
@@ -42213,7 +42213,8 @@ var AchievementTypeValidator = mod.enum([
42213
42213
  "MicroCredential",
42214
42214
  "ResearchDoctorate",
42215
42215
  "SecondarySchoolDiploma"
42216
- ]).or(mod.string());
42216
+ ]);
42217
+ var AchievementTypeValidator = KnownAchievementTypeValidator.or(mod.string());
42217
42218
  var CriteriaValidator = mod.object({ id: mod.string().optional(), narrative: mod.string().optional() }).catchall(mod.any());
42218
42219
  var EndorsementSubjectValidator = mod.object({
42219
42220
  id: mod.string(),
@@ -42372,7 +42373,7 @@ var IDXCredentialValidator = mod.object({
42372
42373
  id: mod.string(),
42373
42374
  title: mod.string(),
42374
42375
  storageType: StorageTypeValidator.optional()
42375
- });
42376
+ }).catchall(mod.any());
42376
42377
  var JWKValidator = mod.object({
42377
42378
  kty: mod.string(),
42378
42379
  crv: mod.string(),