@truvity/sdk 0.35.1 → 0.36.2

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.
Files changed (116) hide show
  1. package/api/resources/apiKeys/client/Client.js +9 -9
  2. package/api/resources/apiKeys/client/Client.js.map +1 -1
  3. package/api/resources/credentials/client/Client.js +12 -12
  4. package/api/resources/credentials/client/Client.js.map +1 -1
  5. package/api/resources/credentials/client/requests/CredentialInput.d.ts +1 -2
  6. package/api/resources/credentials/client/requests/CredentialInput.d.ts.map +1 -1
  7. package/api/resources/credentials/client/requests/CredentialInput.js.map +1 -1
  8. package/api/resources/desk/client/Client.js +2 -2
  9. package/api/resources/desk/client/Client.js.map +1 -1
  10. package/api/resources/didcommMessages/client/Client.js +9 -9
  11. package/api/resources/didcommMessages/client/Client.js.map +1 -1
  12. package/api/resources/dids/client/Client.js +1 -1
  13. package/api/resources/dids/client/Client.js.map +1 -1
  14. package/api/resources/drafts/client/Client.d.ts +49 -11
  15. package/api/resources/drafts/client/Client.d.ts.map +1 -1
  16. package/api/resources/drafts/client/Client.js +61 -23
  17. package/api/resources/drafts/client/Client.js.map +1 -1
  18. package/api/resources/files/client/Client.js +11 -11
  19. package/api/resources/files/client/Client.js.map +1 -1
  20. package/api/resources/files/client/requests/FileInput.d.ts +1 -2
  21. package/api/resources/files/client/requests/FileInput.d.ts.map +1 -1
  22. package/api/resources/files/client/requests/FileInput.js.map +1 -1
  23. package/api/resources/gdpr/client/Client.js +1 -1
  24. package/api/resources/gdpr/client/Client.js.map +1 -1
  25. package/api/resources/keys/client/Client.js +13 -13
  26. package/api/resources/keys/client/Client.js.map +1 -1
  27. package/api/resources/presentations/client/Client.js +14 -14
  28. package/api/resources/presentations/client/Client.js.map +1 -1
  29. package/api/resources/presentations/client/requests/PresentationInput.d.ts +1 -2
  30. package/api/resources/presentations/client/requests/PresentationInput.d.ts.map +1 -1
  31. package/api/resources/presentations/client/requests/PresentationInput.js.map +1 -1
  32. package/api/types/Credential.d.ts +4 -0
  33. package/api/types/Credential.d.ts.map +1 -1
  34. package/api/types/Credential.js.map +1 -1
  35. package/api/types/CredentialFilter.d.ts +4 -1
  36. package/api/types/CredentialFilter.d.ts.map +1 -1
  37. package/api/types/CredentialFilter.js.map +1 -1
  38. package/api/types/Draft.d.ts +4 -0
  39. package/api/types/Draft.d.ts.map +1 -1
  40. package/api/types/Draft.js.map +1 -1
  41. package/api/types/DraftFilter.d.ts +4 -1
  42. package/api/types/DraftFilter.d.ts.map +1 -1
  43. package/api/types/DraftFilter.js.map +1 -1
  44. package/api/types/LinkedRef.d.ts +22 -0
  45. package/api/types/LinkedRef.d.ts.map +1 -0
  46. package/api/types/LinkedRef.js +6 -0
  47. package/api/types/LinkedRef.js.map +1 -0
  48. package/api/types/LinkedResourceRef.d.ts +14 -0
  49. package/api/types/LinkedResourceRef.d.ts.map +1 -0
  50. package/api/types/LinkedResourceRef.js +6 -0
  51. package/api/types/LinkedResourceRef.js.map +1 -0
  52. package/api/types/Presentation.d.ts +3 -0
  53. package/api/types/Presentation.d.ts.map +1 -1
  54. package/api/types/Presentation.js.map +1 -1
  55. package/api/types/PresentationFilter.d.ts +3 -1
  56. package/api/types/PresentationFilter.d.ts.map +1 -1
  57. package/api/types/PresentationFilter.js.map +1 -1
  58. package/api/types/UploadResponse.d.ts +1 -4
  59. package/api/types/UploadResponse.d.ts.map +1 -1
  60. package/api/types/UploadResponse.js.map +1 -1
  61. package/api/types/index.d.ts +2 -0
  62. package/api/types/index.d.ts.map +1 -1
  63. package/api/types/index.js +2 -0
  64. package/api/types/index.js.map +1 -1
  65. package/documents/credential/claims.d.ts.map +1 -1
  66. package/documents/credential/claims.js +10 -9
  67. package/documents/credential/claims.js.map +1 -1
  68. package/documents/credential.d.ts.map +1 -1
  69. package/documents/credential.js +3 -2
  70. package/documents/credential.js.map +1 -1
  71. package/documents/utils/error.d.ts +9 -0
  72. package/documents/utils/error.d.ts.map +1 -0
  73. package/documents/utils/error.js +14 -0
  74. package/documents/utils/error.js.map +1 -0
  75. package/documents/utils/error.spec.d.ts +2 -0
  76. package/documents/utils/error.spec.d.ts.map +1 -0
  77. package/documents/utils/error.spec.js +9 -0
  78. package/documents/utils/error.spec.js.map +1 -0
  79. package/package.json +1 -1
  80. package/reference.md +48 -10
  81. package/serialization/types/Credential.d.ts +3 -0
  82. package/serialization/types/Credential.d.ts.map +1 -1
  83. package/serialization/types/Credential.js +3 -0
  84. package/serialization/types/Credential.js.map +1 -1
  85. package/serialization/types/CredentialFilter.d.ts +5 -1
  86. package/serialization/types/CredentialFilter.d.ts.map +1 -1
  87. package/serialization/types/CredentialFilter.js +41 -1
  88. package/serialization/types/CredentialFilter.js.map +1 -1
  89. package/serialization/types/Draft.d.ts +4 -0
  90. package/serialization/types/Draft.d.ts.map +1 -1
  91. package/serialization/types/Draft.js +4 -0
  92. package/serialization/types/Draft.js.map +1 -1
  93. package/serialization/types/DraftFilter.d.ts +5 -1
  94. package/serialization/types/DraftFilter.d.ts.map +1 -1
  95. package/serialization/types/DraftFilter.js +41 -1
  96. package/serialization/types/DraftFilter.js.map +1 -1
  97. package/serialization/types/LinkedRef.d.ts +15 -0
  98. package/serialization/types/LinkedRef.d.ts.map +1 -0
  99. package/serialization/types/LinkedRef.js +46 -0
  100. package/serialization/types/LinkedRef.js.map +1 -0
  101. package/serialization/types/LinkedResourceRef.d.ts +13 -0
  102. package/serialization/types/LinkedResourceRef.d.ts.map +1 -0
  103. package/serialization/types/LinkedResourceRef.js +44 -0
  104. package/serialization/types/LinkedResourceRef.js.map +1 -0
  105. package/serialization/types/Presentation.d.ts +2 -0
  106. package/serialization/types/Presentation.d.ts.map +1 -1
  107. package/serialization/types/Presentation.js +2 -0
  108. package/serialization/types/Presentation.js.map +1 -1
  109. package/serialization/types/PresentationFilter.d.ts +4 -1
  110. package/serialization/types/PresentationFilter.d.ts.map +1 -1
  111. package/serialization/types/PresentationFilter.js +40 -1
  112. package/serialization/types/PresentationFilter.js.map +1 -1
  113. package/serialization/types/index.d.ts +2 -0
  114. package/serialization/types/index.d.ts.map +1 -1
  115. package/serialization/types/index.js +2 -0
  116. package/serialization/types/index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"claims.js","sourceRoot":"","sources":["../../../src/documents/credential/claims.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCASkB;AAClB,8CAMuB;AACvB,sCAAuF;AAEvF,oDAA8E;AAC9E,mEAAqD;AAErD,6CAAoD;AAEpD,MAAa,SAAS;IAClB,YACc,MAAiB,EACjB,WAAoB;QADpB,WAAM,GAAN,MAAM,CAAW;QACjB,gBAAW,GAAX,WAAW,CAAS;IAC/B,CAAC;IAEI,aAAa,CACjB,KAAgB,EAChB,KAAW,EACX,YAAsE,EACtE,YAAe;QAEf,OAAO,IAAA,oCAAuB,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;YAChE,IAAI,UAAU,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC3B,MAAM,KAAK,GAAY,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAC9C,IAAI,cAAuB,CAAC;gBAE5B,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACrB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;wBAChB,cAAc,GAAG,IAAI,CAAC;oBAC1B,CAAC;yBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC9B,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;4BAChC,OAAO,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;wBAC1C,CAAC,CAAC,CAAC;oBACP,CAAC;yBAAM,CAAC;wBACJ,MAAM,IAAI,KAAK,CACX,gJAAgJ,CACnJ,CAAC;oBACN,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACJ,cA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,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAC9C;YACD,cAAc,EAAE,iBAAiB,CAAC,SAAS;YAC3C,SAAS,EAAE,iBAAiB,CAAC,IAAI;YACjC,MAAM,EAAE,iBAAiB,CAAC,MAAM;SACnC,CAAC,CAAC;IACP,CAAC;CACJ;AAvTD,8BAuTC","sourcesContent":["import {\n ApiClient,\n Claims,\n Ctor,\n isLinkedEntityDescriptor,\n isValueWithId,\n UserUpdateClaims,\n ReadDraftClaims,\n ReadClaims,\n} from '../types';\nimport {\n ClaimDescriptor,\n getClaimJsonLdTypeMetadata,\n getContextJsonLdMetadata,\n getRegisteredClaimsList,\n getTsDataTypeMetadata,\n} from '../decorators';\nimport { Rfc3339Date, LinkedCredential, LinkedFile, Rfc3339DateTime } from '../models';\nimport { DraftSchema, DraftSchemaFieldsItem } from '../../api';\nimport { strictlyConvertToApiType, StrictPartial } from '../utils/converters';\nimport * as serialization from '../../serialization';\nimport { CredentialClaims, DraftFieldValue, Json } from './types';\nimport { VerifiableCredential } from './verifiable';\n\nexport class UdtClaims<T extends Claims> {\n constructor(\n protected client: ApiClient,\n protected claimsModel: Ctor<T>,\n ) {}\n\n private processValues<K extends Claims>(\n model: Ctor<any>,\n input: Json,\n processValue: (descriptor: ClaimDescriptor, value: unknown) => unknown,\n initialValue: K,\n ): K {\n return getRegisteredClaimsList(model).reduce((result, descriptor) => {\n if (descriptor.name in input) {\n const value: unknown = input[descriptor.name];\n let processedValue: unknown;\n\n if (descriptor.isArray) {\n if (value == null) {\n processedValue = null;\n } else if (Array.isArray(value)) {\n processedValue = value.map((item) => {\n return processValue(descriptor, item);\n });\n } else {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Array\". Please reach out to support for assistance.`,\n );\n }\n } else {\n processedValue = processValue(descriptor, value);\n }\n Reflect.set(result, descriptor.name, processedValue);\n }\n\n return result;\n }, initialValue);\n }\n\n private getClaimTypeInfo(model: Ctor<any>, descriptor: ClaimDescriptor): Ctor<any> {\n const typeInfo = descriptor.nestedType ? descriptor.nestedType : getTsDataTypeMetadata(model, descriptor.name);\n\n if (typeInfo == null) {\n throw new Error(\n `Can't convert received value. Inconsistent data definition. Please reach out to support for assistance.`,\n );\n }\n\n return typeInfo;\n }\n\n /** convertApiValuesToUdt maps and converts the API received claims values to the UDT claims model */\n protected convertApiValuesToUdt<K extends Claims>(model: Ctor<any>, input: Json): K {\n const processValue = (descriptor: ClaimDescriptor, value: unknown): unknown => {\n if (value == null) {\n return null;\n }\n\n const typeInfo = this.getClaimTypeInfo(model, descriptor);\n\n if (isLinkedEntityDescriptor(value)) {\n if (typeInfo == LinkedCredential) {\n return new LinkedCredential(this.client, value.id, value.digestMultibase);\n }\n\n if (typeInfo === LinkedFile) {\n return new LinkedFile(this.client, value.id, value.digestMultibase);\n }\n }\n\n if (typeInfo === Date) {\n if (typeof value !== 'string') {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Date\". Please reach out to support for assistance.`,\n );\n }\n return new Date(value);\n }\n\n if (typeInfo === Rfc3339DateTime) {\n if (typeof value !== 'string') {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Rfc3339DateTime\". Please reach out to support for assistance.`,\n );\n }\n return new Rfc3339DateTime(value);\n }\n\n if (typeInfo === Rfc3339Date) {\n if (typeof value !== 'string') {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Rfc3339Date\". Please reach out to support for assistance.`,\n );\n }\n return new Rfc3339Date(value);\n }\n\n // Primitive values should be returned as-is\n if (Array.of<Ctor<any>>(String, Number, Boolean, Object).includes(typeInfo)) {\n return value;\n }\n\n if (!(value instanceof Object)) {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"${typeInfo.name}\". Please reach out to support for assistance.`,\n );\n }\n return this.convertApiValuesToUdt(typeInfo, value);\n };\n\n return this.processValues<K>(model, input, processValue, new model());\n }\n\n /** convertUdtToApiValues maps and converts the user received claims values onto UDT claims model */\n protected convertUdtToApiValues<K extends Claims>(model: Ctor<any>, input: K): CredentialClaims {\n const processValue = (descriptor: ClaimDescriptor, value: unknown): unknown => {\n if (value == null) {\n return null;\n }\n\n const typeInfo = this.getClaimTypeInfo(model, descriptor);\n\n if (typeInfo == LinkedCredential) {\n if (value instanceof LinkedCredential) {\n return value.toJSON();\n }\n\n if (value instanceof VerifiableCredential) {\n return value.toLinkedCredential().toJSON();\n }\n\n if (isValueWithId(value)) {\n return LinkedCredential.createClaimValue(value.id, value.digestMultibase);\n }\n }\n\n if (typeInfo === LinkedFile) {\n if (value instanceof LinkedFile) {\n return value.toJSON();\n }\n\n if (isValueWithId(value)) {\n return LinkedFile.createClaimValue(value.id, value.digestMultibase);\n }\n }\n\n if (\n Array.of<Ctor<any>>(\n String,\n Number,\n Date,\n Rfc3339DateTime,\n Rfc3339Date,\n Boolean,\n Object,\n Function,\n ).includes(typeInfo)\n ) {\n return value;\n }\n\n if (!(value instanceof Object)) {\n throw new Error(\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"${typeInfo.name}\". Please reach out to support for assistance.`,\n );\n }\n return this.convertUdtToApiValues(typeInfo, value);\n };\n\n return this.processValues(model, input, processValue, {});\n }\n\n protected mapClaimToApi(claim: ClaimDescriptor, claimsModel: Ctor<any>): DraftSchemaFieldsItem {\n const claimJsonLdType = getClaimJsonLdTypeMetadata(claimsModel, claim.name);\n const draftBaseFieldValue: StrictPartial<DraftFieldValue> = {\n name: claim.name,\n title: claim.title,\n notEmpty: claim.notEmpty,\n isArray: claim.isArray || undefined,\n };\n\n if (\n claim.nestedType &&\n !Array.of<Ctor<any>>(\n String,\n Number,\n Date,\n Rfc3339DateTime,\n Rfc3339Date,\n Boolean,\n LinkedFile,\n LinkedCredential,\n ).includes(claim.nestedType)\n ) {\n const claimNestedType = claim.nestedType;\n const nestedContextInfo = getContextJsonLdMetadata(claimNestedType);\n\n if (!nestedContextInfo) {\n throw new Error(\n `The information about the VC context was not found in the \"${claimNestedType.name}\" model. Please use the \"@VcContext\" decorator to define the necessary information.`,\n );\n }\n\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'STRUCT',\n fields: getRegisteredClaimsList(claimNestedType).map((nestedClaim) => {\n return this.mapClaimToApi(nestedClaim, claimNestedType);\n }),\n vocabNamespace: nestedContextInfo.namespace,\n vocabName: nestedContextInfo.name,\n });\n }\n\n const tsDataType = claim.nestedType || getTsDataTypeMetadata(claimsModel, claim.name);\n\n if (!tsDataType) {\n throw new Error(\n `The information about the VC claim data type was not found for the \"${claim.name}\" property. Ensure that \"emitDecoratorMetadata\" is enabled in your \"tsconfig.json\".`,\n );\n }\n\n switch (tsDataType) {\n case String:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'STRING',\n type: claimJsonLdType,\n enum: claim.enumValuesDescriptor,\n });\n case Number:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'NUMBER',\n type: claimJsonLdType,\n });\n case Boolean:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'BOOLEAN',\n type: claimJsonLdType,\n });\n case Rfc3339Date:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'DATE',\n type: claimJsonLdType,\n });\n case Rfc3339DateTime:\n case Date:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'DATETIME',\n type: claimJsonLdType,\n });\n case LinkedFile:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'FILE',\n });\n case LinkedCredential:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'LINK',\n linkType: undefined,\n });\n default:\n throw new Error(\n `Unsupported primitive data type: ${tsDataType.name}. Please use one of the supported types. You can find more information in the documentation.`,\n );\n }\n }\n\n /**\n * Marshalling is the process of transforming the internal representation of values to a data format suitable\n * for transmission.\n */\n marshalValues(input: UserUpdateClaims<T>): Json {\n return this.convertUdtToApiValues(this.claimsModel, input);\n }\n\n /**\n * Unmarshalling is the reverse process of marshalling. It involves converting data from a serialized format back\n * into an internal representation.\n */\n unmarshalValuesToDraft(input: Json): ReadDraftClaims<T> {\n return this.convertApiValuesToUdt(this.claimsModel, input);\n }\n\n unmarshalValuesToCredential(input: Json): ReadClaims<T> {\n return this.convertApiValuesToUdt(this.claimsModel, input);\n }\n\n getDraftSchema(): DraftSchema {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata) {\n throw new Error(\n `Unable to find JSON-LD metadata. Make sure you have defined the claims model with the @VcContext decorator`,\n );\n }\n\n return strictlyConvertToApiType(serialization.DraftSchema, {\n fields: getRegisteredClaimsList(this.claimsModel).map((claim) =>\n this.mapClaimToApi(claim, this.claimsModel),\n ),\n vocabNamespace: vcContextMetadata.namespace,\n vocabName: vcContextMetadata.name,\n vcType: vcContextMetadata.vcType,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"claims.js","sourceRoot":"","sources":["../../../src/documents/credential/claims.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCASkB;AAClB,8CAMuB;AACvB,sCAAuF;AAEvF,oDAA8E;AAC9E,mEAAqD;AAErD,6CAAoD;AACpD,0CAA4D;AAE5D,MAAa,SAAS;IAClB,YACc,MAAiB,EACjB,WAAoB;QADpB,WAAM,GAAN,MAAM,CAAW;QACjB,gBAAW,GAAX,WAAW,CAAS;IAC/B,CAAC;IAEI,aAAa,CACjB,KAAgB,EAChB,KAAW,EACX,YAAsE,EACtE,YAAe;QAEf,OAAO,IAAA,oCAAuB,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CA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adDraftClaims,\n ReadClaims,\n} from '../types';\nimport {\n ClaimDescriptor,\n getClaimJsonLdTypeMetadata,\n getContextJsonLdMetadata,\n getRegisteredClaimsList,\n getTsDataTypeMetadata,\n} from '../decorators';\nimport { Rfc3339Date, LinkedCredential, LinkedFile, Rfc3339DateTime } from '../models';\nimport { DraftSchema, DraftSchemaFieldsItem } from '../../api';\nimport { strictlyConvertToApiType, StrictPartial } from '../utils/converters';\nimport * as serialization from '../../serialization';\nimport { CredentialClaims, DraftFieldValue, Json } from './types';\nimport { VerifiableCredential } from './verifiable';\nimport { DocumentedError, ErrorCode } from '../utils/error';\n\nexport class UdtClaims<T extends Claims> {\n constructor(\n protected client: ApiClient,\n protected claimsModel: Ctor<T>,\n ) {}\n\n private processValues<K extends Claims>(\n model: Ctor<any>,\n input: Json,\n processValue: (descriptor: ClaimDescriptor, value: unknown) => unknown,\n initialValue: K,\n ): K {\n return getRegisteredClaimsList(model).reduce((result, descriptor) => {\n if (descriptor.name in input) {\n const value: unknown = input[descriptor.name];\n let processedValue: unknown;\n\n if (descriptor.isArray) {\n if (value == null) {\n processedValue = null;\n } else if (Array.isArray(value)) {\n processedValue = value.map((item) => {\n return processValue(descriptor, item);\n });\n } else {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Array\".`,\n );\n }\n } else {\n processedValue = processValue(descriptor, value);\n }\n Reflect.set(result, descriptor.name, processedValue);\n }\n\n return result;\n }, initialValue);\n }\n\n private getClaimTypeInfo(model: Ctor<any>, descriptor: ClaimDescriptor): Ctor<any> {\n const typeInfo = descriptor.nestedType ? descriptor.nestedType : getTsDataTypeMetadata(model, descriptor.name);\n\n if (typeInfo == null) {\n throw new Error(\n `Can't convert received value. Inconsistent data definition. Please reach out to support for assistance.`,\n );\n }\n\n return typeInfo;\n }\n\n /** convertApiValuesToUdt maps and converts the API received claims values to the UDT claims model */\n protected convertApiValuesToUdt<K extends Claims>(model: Ctor<any>, input: Json): K {\n const processValue = (descriptor: ClaimDescriptor, value: unknown): unknown => {\n if (value == null) {\n return null;\n }\n\n const typeInfo = this.getClaimTypeInfo(model, descriptor);\n\n if (isLinkedEntityDescriptor(value)) {\n if (typeInfo == LinkedCredential) {\n return new LinkedCredential(this.client, value.id, value.digestMultibase);\n }\n\n if (typeInfo === LinkedFile) {\n return new LinkedFile(this.client, value.id, value.digestMultibase);\n }\n }\n\n if (typeInfo === Date) {\n if (typeof value !== 'string') {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Date\".`,\n );\n }\n return new Date(value);\n }\n\n if (typeInfo === Rfc3339DateTime) {\n if (typeof value !== 'string') {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Rfc3339DateTime\".`,\n );\n }\n return new Rfc3339DateTime(value);\n }\n\n if (typeInfo === Rfc3339Date) {\n if (typeof value !== 'string') {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"Rfc3339Date\".`,\n );\n }\n return new Rfc3339Date(value);\n }\n\n // Primitive values should be returned as-is\n if (Array.of<Ctor<any>>(String, Number, Boolean, Object).includes(typeInfo)) {\n return value;\n }\n\n if (!(value instanceof Object)) {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"${typeInfo.name}\".`,\n );\n }\n return this.convertApiValuesToUdt(typeInfo, value);\n };\n\n return this.processValues<K>(model, input, processValue, new model());\n }\n\n /** convertUdtToApiValues maps and converts the user received claims values onto UDT claims model */\n protected convertUdtToApiValues<K extends Claims>(model: Ctor<any>, input: K): CredentialClaims {\n const processValue = (descriptor: ClaimDescriptor, value: unknown): unknown => {\n if (value == null) {\n return null;\n }\n\n const typeInfo = this.getClaimTypeInfo(model, descriptor);\n\n if (typeInfo == LinkedCredential) {\n if (value instanceof LinkedCredential) {\n return value.toJSON();\n }\n\n if (value instanceof VerifiableCredential) {\n return value.toLinkedCredential().toJSON();\n }\n\n if (isValueWithId(value)) {\n return LinkedCredential.createClaimValue(value.id, value.digestMultibase);\n }\n }\n\n if (typeInfo === LinkedFile) {\n if (value instanceof LinkedFile) {\n return value.toJSON();\n }\n\n if (isValueWithId(value)) {\n return LinkedFile.createClaimValue(value.id, value.digestMultibase);\n }\n }\n\n if (\n Array.of<Ctor<any>>(\n String,\n Number,\n Date,\n Rfc3339DateTime,\n Rfc3339Date,\n Boolean,\n Object,\n Function,\n ).includes(typeInfo)\n ) {\n return value;\n }\n\n if (!(value instanceof Object)) {\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Can't convert received value as it has an unexpected type. The value is defined in UDT as \"${typeInfo.name}\".`,\n );\n }\n return this.convertUdtToApiValues(typeInfo, value);\n };\n\n return this.processValues(model, input, processValue, {});\n }\n\n protected mapClaimToApi(claim: ClaimDescriptor, claimsModel: Ctor<any>): DraftSchemaFieldsItem {\n const claimJsonLdType = getClaimJsonLdTypeMetadata(claimsModel, claim.name);\n const draftBaseFieldValue: StrictPartial<DraftFieldValue> = {\n name: claim.name,\n title: claim.title,\n notEmpty: claim.notEmpty,\n isArray: claim.isArray || undefined,\n };\n\n if (\n claim.nestedType &&\n !Array.of<Ctor<any>>(\n String,\n Number,\n Date,\n Rfc3339DateTime,\n Rfc3339Date,\n Boolean,\n LinkedFile,\n LinkedCredential,\n ).includes(claim.nestedType)\n ) {\n const claimNestedType = claim.nestedType;\n const nestedContextInfo = getContextJsonLdMetadata(claimNestedType);\n\n if (!nestedContextInfo) {\n throw new DocumentedError(\n ErrorCode.VcContextAnnotationMissing,\n `The information about the VC context was not found in the \"${claimNestedType.name}\" model. Please use the \"@VcContext\" decorator to define the necessary information.`,\n );\n }\n\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'STRUCT',\n fields: getRegisteredClaimsList(claimNestedType).map((nestedClaim) => {\n return this.mapClaimToApi(nestedClaim, claimNestedType);\n }),\n vocabNamespace: nestedContextInfo.namespace,\n vocabName: nestedContextInfo.name,\n });\n }\n\n const tsDataType = claim.nestedType || getTsDataTypeMetadata(claimsModel, claim.name);\n\n if (!tsDataType) {\n throw new Error(\n `The information about the VC claim data type was not found for the \"${claim.name}\" property. Ensure that \"emitDecoratorMetadata\" is enabled in your \"tsconfig.json\".`,\n );\n }\n\n switch (tsDataType) {\n case String:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'STRING',\n type: claimJsonLdType,\n enum: claim.enumValuesDescriptor,\n });\n case Number:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'NUMBER',\n type: claimJsonLdType,\n });\n case Boolean:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'BOOLEAN',\n type: claimJsonLdType,\n });\n case Rfc3339Date:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'DATE',\n type: claimJsonLdType,\n });\n case Rfc3339DateTime:\n case Date:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'DATETIME',\n type: claimJsonLdType,\n });\n case LinkedFile:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'FILE',\n });\n case LinkedCredential:\n return strictlyConvertToApiType(serialization.DraftSchemaFieldsItem, {\n ...draftBaseFieldValue,\n kind: 'LINK',\n linkType: undefined,\n });\n default:\n throw new DocumentedError(\n ErrorCode.UnexpectedTypeInSerialization,\n `Unsupported primitive data type: ${tsDataType.name}. Please use one of the supported types.`,\n );\n }\n }\n\n /**\n * Marshalling is the process of transforming the internal representation of values to a data format suitable\n * for transmission.\n */\n marshalValues(input: UserUpdateClaims<T>): Json {\n return this.convertUdtToApiValues(this.claimsModel, input);\n }\n\n /**\n * Unmarshalling is the reverse process of marshalling. It involves converting data from a serialized format back\n * into an internal representation.\n */\n unmarshalValuesToDraft(input: Json): ReadDraftClaims<T> {\n return this.convertApiValuesToUdt(this.claimsModel, input);\n }\n\n unmarshalValuesToCredential(input: Json): ReadClaims<T> {\n return this.convertApiValuesToUdt(this.claimsModel, input);\n }\n\n getDraftSchema(): DraftSchema {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata) {\n throw new DocumentedError(\n ErrorCode.VcContextAnnotationMissing,\n `Unable to find JSON-LD metadata. Make sure you have defined the claims model with the @VcContext decorator`,\n );\n }\n\n return strictlyConvertToApiType(serialization.DraftSchema, {\n fields: getRegisteredClaimsList(this.claimsModel).map((claim) =>\n this.mapClaimToApi(claim, this.claimsModel),\n ),\n vocabNamespace: vcContextMetadata.namespace,\n vocabName: vcContextMetadata.name,\n vcType: vcContextMetadata.vcType,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../src/documents/credential.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,SAAS,EAET,IAAI,EACJ,SAAS,EAET,4BAA4B,EAC5B,aAAa,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAiB,kBAAkB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAI1E,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAG1E,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI;IAC/C,YAAY,EAAE,KAAK,CAAC;I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AG,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC;CAK/G"}
@@ -24,6 +24,7 @@ const draft_1 = require("./credential/draft");
24
24
  const flavor_1 = require("./credential/flavor");
25
25
  const with_claims_1 = require("./credential/with-claims");
26
26
  const schemas_1 = require("./schemas");
27
+ const error_1 = require("./utils/error");
27
28
  class VcDecorator {
28
29
  constructor(client, claimsModel) {
29
30
  this.client = client;
@@ -37,13 +38,13 @@ class VcDecorator {
37
38
  getIri() {
38
39
  const vcContextMetadata = (0, decorators_1.getContextJsonLdMetadata)(this.claimsModel);
39
40
  if (!vcContextMetadata)
40
- throw new Error(`Can't find IRI information. Make sure you have defined the claims model with the @VcContext decorator`);
41
+ throw new error_1.DocumentedError(error_1.ErrorCode.VcContextAnnotationMissing, "Can't find IRI information. Make sure you have defined the claims model with the @VcContext decorator.");
41
42
  return `${vcContextMetadata.namespace}#${vcContextMetadata.name}`;
42
43
  }
43
44
  getCredentialTerm() {
44
45
  const vcContextMetadata = (0, decorators_1.getContextJsonLdMetadata)(this.claimsModel);
45
46
  if (!vcContextMetadata)
46
- throw new Error(`Can't find credential term information. Make sure you have defined the claims model with the @VcContext decorator`);
47
+ throw new error_1.DocumentedError(error_1.ErrorCode.VcContextAnnotationMissing, "Can't find credential term information. Make sure you have defined the claims model with the @VcContext decorator");
47
48
  return `${vcContextMetadata.name}Credential`;
48
49
  }
49
50
  canMap(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"credential.js","sourceRoot":"","sources":["../../src/documents/credential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAA+B;AAE/B,mCAQiB;AACjB,gCAA0E;AAC1E,6CAAwD;AACxD,qDAAkD;AAClD,mDAA2F;AAE3F,gDAAgD;AAChD,8CAAqD;AACrD,gDAAuD;AACvD,0DAA0E;AAC1E,uCAA2D;AAc3D,MAAa,WAAW;IAIpB,YACY,MAAiB,EACjB,WAAoB;QADpB,WAAM,GAAN,MAAM,CAAW;QACjB,gBAAW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B,UAAU,EAAE,eAAe;iBAC9B,CAAC;YACN,CAAC;QACL,CAAC;KAAA;IAEK,gBAAgB,CAAC,IAAe,EAAE,OAAuB;;YAC3D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAExD,OAAO,IAAI,4CAA8B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACtG,CAAC;KAAA;CACJ;AArKD,kCAqKC","sourcesContent":["import fetch from 'node-fetch';\n\nimport {\n ApiClient,\n CredentialDescriptor,\n Ctor,\n BlobInput,\n isResourceCredential,\n UpdatePayloadWithIssueClaims,\n UpdatePayload,\n} from './types';\nimport { NotFoundError, ResourceCredential, ResourceDraft } from '../api';\nimport { getContextJsonLdMetadata } from './decorators';\nimport { generateKey } from './utils/idempotency';\nimport { draftMetadataToApiDraftMeta, strictlyConvertToApiType } from './utils/converters';\nimport { Claims, UpdatePayloadWithClaims } from './credential/types';\nimport { UdtClaims } from './credential/claims';\nimport { DraftCredential } from './credential/draft';\nimport { CredentialFlavor } from './credential/flavor';\nimport { VerifiableCredentialWithClaims } from './credential/with-claims';\nimport { verifiableCredentialDataSchema } from './schemas';\n\nexport type CredentialEnvelope<T extends Claims> = {\n isVerifiable: false;\n credential: DraftCredential<T>;\n};\n\nexport type VerifiableCredentialEnvelope<T extends Claims> = {\n isVerifiable: true;\n credential: VerifiableCredentialWithClaims<T>;\n};\n\nexport type LoadedCredential<T extends Claims> = CredentialEnvelope<T> | VerifiableCredentialEnvelope<T>;\n\nexport class VcDecorator<T extends Claims> {\n readonly flavor = this.createCredentialFlavor();\n private claims = new UdtClaims(this.client, this.claimsModel);\n\n constructor(\n private client: ApiClient,\n private claimsModel: Ctor<T>,\n ) {}\n\n protected createCredentialFlavor(): CredentialFlavor {\n return new CredentialFlavor();\n }\n\n getIri(): string {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata)\n throw new Error(\n `Can't find IRI information. Make sure you have defined the claims model with the @VcContext decorator`,\n );\n\n return `${vcContextMetadata.namespace}#${vcContextMetadata.name}`;\n }\n\n getCredentialTerm(): string {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata)\n throw new Error(\n `Can't find credential term information. Make sure you have defined the claims model with the @VcContext decorator`,\n );\n\n return `${vcContextMetadata.name}Credential`;\n }\n\n canMap(input: ResourceDraft | ResourceCredential): boolean {\n return input.data.type.includes(this.getCredentialTerm());\n }\n\n map(input: ResourceDraft): DraftCredential<T>;\n map(input: ResourceCredential): VerifiableCredentialWithClaims<T>;\n map(input: ResourceDraft | ResourceCredential): VerifiableCredentialWithClaims<T> | DraftCredential<T> {\n if (isResourceCredential(input)) {\n // ResourceCredential\n if (!this.canMap(input)) {\n throw new Error(\n `The received ResourceCredential is incompatible with the current VcDecorator instance claims model`,\n );\n }\n\n return new VerifiableCredentialWithClaims(this.client, this.flavor, this.claimsModel, input);\n } else {\n // ResourceDraft\n if (!this.canMap(input)) {\n throw new Error(\n `The received ResourceDraft is incompatible with the current VcDecorator instance claims model`,\n );\n }\n\n return new DraftCredential(this.client, this.flavor, this.claimsModel, input.data, input);\n }\n }\n\n private async importBlob(blob: BlobInput, request?: UpdatePayload): Promise<CredentialDescriptor> {\n const idempotencyKey = generateKey('importBlob');\n const { blobId, uploadUri } = await this.client.credentials.credentialUpload({\n idempotencyKey,\n });\n\n await fetch(uploadUri, {\n method: 'PUT',\n body: blob,\n });\n\n const resourceCredential = await this.client.credentials.credentialImport({\n annotations: request?.annotations,\n labels: request?.labels,\n blobId,\n idempotencyKey,\n });\n\n return {\n data: strictlyConvertToApiType(verifiableCredentialDataSchema, {\n id: resourceCredential.data.id,\n digestMultibase: resourceCredential.data.digestMultibase,\n }),\n id: resourceCredential.id,\n etag: resourceCredential.etag,\n revision: resourceCredential.revision,\n };\n }\n\n async create(request?: UpdatePayloadWithClaims<T>): Promise<DraftCredential<T>> {\n const values = request?.claims ? this.claims.marshalValues(request.claims) : undefined;\n const schema = this.claims.getDraftSchema();\n\n const { id, etag, revision, data } = await this.client.drafts.draftCreate({\n data: {\n schema,\n values,\n meta: draftMetadataToApiDraftMeta(request?.metadata),\n },\n annotations: request?.annotations,\n labels: request?.labels,\n idempotencyKey: generateKey('create'),\n });\n\n return new DraftCredential(this.client, this.flavor, this.claimsModel, data, { id, etag, revision });\n }\n\n async issue(\n privateKeyId: string,\n request: UpdatePayloadWithIssueClaims<T>,\n ): Promise<VerifiableCredentialWithClaims<T>> {\n return (await this.create(request)).issue(privateKeyId);\n }\n\n async loadAsDraft(id: string, revision?: number): Promise<DraftCredential<T>> {\n const resourceDraft = revision\n ? await this.client.drafts.draftRevision(id, revision)\n : await this.client.drafts.draftLatest(id);\n\n return this.map(resourceDraft);\n }\n\n async loadAsCredential(id: string, revision?: number): Promise<VerifiableCredentialWithClaims<T>> {\n const resourceCredential = revision\n ? await this.client.credentials.credentialRevision(id, revision)\n : await this.client.credentials.credentialLatest(id);\n\n return this.map(resourceCredential);\n }\n\n async load(id: string, revision?: number): Promise<LoadedCredential<T>> {\n let verifiableCredential: VerifiableCredentialWithClaims<T> | undefined;\n let draftCredential: DraftCredential<T> | undefined;\n\n try {\n verifiableCredential = await this.loadAsCredential(id, revision);\n } catch (error) {\n if (error instanceof NotFoundError) {\n draftCredential = await this.loadAsDraft(id, revision);\n } else throw error;\n }\n\n if (!draftCredential) {\n if (!verifiableCredential) throw new Error(`Resource with id '${id}' could not be found.`);\n\n return {\n isVerifiable: true,\n credential: verifiableCredential,\n };\n } else {\n return {\n isVerifiable: false,\n credential: draftCredential,\n };\n }\n }\n\n async importCredential(blob: BlobInput, request?: UpdatePayload): Promise<VerifiableCredentialWithClaims<T>> {\n const credential = await this.importBlob(blob, request);\n\n return new VerifiableCredentialWithClaims(this.client, this.flavor, this.claimsModel, credential);\n }\n}\n"]}
1
+ {"version":3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oBACjC,eAAe,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBAC3D,CAAC;;oBAAM,MAAM,KAAK,CAAC;YACvB,CAAC;YAED,IAAI,CAAC,eAAe,EAAE,CAAC;gBACnB,IAAI,CAAC,oBAAoB;oBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;gBAE3F,OAAO;oBACH,YAAY,EAAE,IAAI;oBAClB,UAAU,EAAE,oBAAoB;iBACnC,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO;oBACH,YAAY,EAAE,KAAK;oBACnB,UAAU,EAAE,eAAe;iBAC9B,CAAC;YACN,CAAC;QACL,CAAC;KAAA;IAEK,gBAAgB,CAAC,IAAe,EAAE,OAAuB;;YAC3D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAExD,OAAO,IAAI,4CAA8B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACtG,CAAC;KAAA;CACJ;AAvKD,kCAuKC","sourcesContent":["import fetch from 'node-fetch';\n\nimport {\n ApiClient,\n CredentialDescriptor,\n Ctor,\n BlobInput,\n isResourceCredential,\n UpdatePayloadWithIssueClaims,\n UpdatePayload,\n} from './types';\nimport { NotFoundError, ResourceCredential, ResourceDraft } from '../api';\nimport { getContextJsonLdMetadata } from './decorators';\nimport { generateKey } from './utils/idempotency';\nimport { draftMetadataToApiDraftMeta, strictlyConvertToApiType } from './utils/converters';\nimport { Claims, UpdatePayloadWithClaims } from './credential/types';\nimport { UdtClaims } from './credential/claims';\nimport { DraftCredential } from './credential/draft';\nimport { CredentialFlavor } from './credential/flavor';\nimport { VerifiableCredentialWithClaims } from './credential/with-claims';\nimport { verifiableCredentialDataSchema } from './schemas';\nimport { DocumentedError, ErrorCode } from './utils/error';\n\nexport type CredentialEnvelope<T extends Claims> = {\n isVerifiable: false;\n credential: DraftCredential<T>;\n};\n\nexport type VerifiableCredentialEnvelope<T extends Claims> = {\n isVerifiable: true;\n credential: VerifiableCredentialWithClaims<T>;\n};\n\nexport type LoadedCredential<T extends Claims> = CredentialEnvelope<T> | VerifiableCredentialEnvelope<T>;\n\nexport class VcDecorator<T extends Claims> {\n readonly flavor = this.createCredentialFlavor();\n private claims = new UdtClaims(this.client, this.claimsModel);\n\n constructor(\n private client: ApiClient,\n private claimsModel: Ctor<T>,\n ) {}\n\n protected createCredentialFlavor(): CredentialFlavor {\n return new CredentialFlavor();\n }\n\n getIri(): string {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata)\n throw new DocumentedError(\n ErrorCode.VcContextAnnotationMissing,\n \"Can't find IRI information. Make sure you have defined the claims model with the @VcContext decorator.\",\n );\n\n return `${vcContextMetadata.namespace}#${vcContextMetadata.name}`;\n }\n\n getCredentialTerm(): string {\n const vcContextMetadata = getContextJsonLdMetadata(this.claimsModel);\n\n if (!vcContextMetadata)\n throw new DocumentedError(\n ErrorCode.VcContextAnnotationMissing,\n \"Can't find credential term information. Make sure you have defined the claims model with the @VcContext decorator\",\n );\n\n return `${vcContextMetadata.name}Credential`;\n }\n\n canMap(input: ResourceDraft | ResourceCredential): boolean {\n return input.data.type.includes(this.getCredentialTerm());\n }\n\n map(input: ResourceDraft): DraftCredential<T>;\n map(input: ResourceCredential): VerifiableCredentialWithClaims<T>;\n map(input: ResourceDraft | ResourceCredential): VerifiableCredentialWithClaims<T> | DraftCredential<T> {\n if (isResourceCredential(input)) {\n // ResourceCredential\n if (!this.canMap(input)) {\n throw new Error(\n `The received ResourceCredential is incompatible with the current VcDecorator instance claims model`,\n );\n }\n\n return new VerifiableCredentialWithClaims(this.client, this.flavor, this.claimsModel, input);\n } else {\n // ResourceDraft\n if (!this.canMap(input)) {\n throw new Error(\n `The received ResourceDraft is incompatible with the current VcDecorator instance claims model`,\n );\n }\n\n return new DraftCredential(this.client, this.flavor, this.claimsModel, input.data, input);\n }\n }\n\n private async importBlob(blob: BlobInput, request?: UpdatePayload): Promise<CredentialDescriptor> {\n const idempotencyKey = generateKey('importBlob');\n const { blobId, uploadUri } = await this.client.credentials.credentialUpload({\n idempotencyKey,\n });\n\n await fetch(uploadUri, {\n method: 'PUT',\n body: blob,\n });\n\n const resourceCredential = await this.client.credentials.credentialImport({\n annotations: request?.annotations,\n labels: request?.labels,\n blobId,\n idempotencyKey,\n });\n\n return {\n data: strictlyConvertToApiType(verifiableCredentialDataSchema, {\n id: resourceCredential.data.id,\n digestMultibase: resourceCredential.data.digestMultibase,\n }),\n id: resourceCredential.id,\n etag: resourceCredential.etag,\n revision: resourceCredential.revision,\n };\n }\n\n async create(request?: UpdatePayloadWithClaims<T>): Promise<DraftCredential<T>> {\n const values = request?.claims ? this.claims.marshalValues(request.claims) : undefined;\n const schema = this.claims.getDraftSchema();\n\n const { id, etag, revision, data } = await this.client.drafts.draftCreate({\n data: {\n schema,\n values,\n meta: draftMetadataToApiDraftMeta(request?.metadata),\n },\n annotations: request?.annotations,\n labels: request?.labels,\n idempotencyKey: generateKey('create'),\n });\n\n return new DraftCredential(this.client, this.flavor, this.claimsModel, data, { id, etag, revision });\n }\n\n async issue(\n privateKeyId: string,\n request: UpdatePayloadWithIssueClaims<T>,\n ): Promise<VerifiableCredentialWithClaims<T>> {\n return (await this.create(request)).issue(privateKeyId);\n }\n\n async loadAsDraft(id: string, revision?: number): Promise<DraftCredential<T>> {\n const resourceDraft = revision\n ? await this.client.drafts.draftRevision(id, revision)\n : await this.client.drafts.draftLatest(id);\n\n return this.map(resourceDraft);\n }\n\n async loadAsCredential(id: string, revision?: number): Promise<VerifiableCredentialWithClaims<T>> {\n const resourceCredential = revision\n ? await this.client.credentials.credentialRevision(id, revision)\n : await this.client.credentials.credentialLatest(id);\n\n return this.map(resourceCredential);\n }\n\n async load(id: string, revision?: number): Promise<LoadedCredential<T>> {\n let verifiableCredential: VerifiableCredentialWithClaims<T> | undefined;\n let draftCredential: DraftCredential<T> | undefined;\n\n try {\n verifiableCredential = await this.loadAsCredential(id, revision);\n } catch (error) {\n if (error instanceof NotFoundError) {\n draftCredential = await this.loadAsDraft(id, revision);\n } else throw error;\n }\n\n if (!draftCredential) {\n if (!verifiableCredential) throw new Error(`Resource with id '${id}' could not be found.`);\n\n return {\n isVerifiable: true,\n credential: verifiableCredential,\n };\n } else {\n return {\n isVerifiable: false,\n credential: draftCredential,\n };\n }\n }\n\n async importCredential(blob: BlobInput, request?: UpdatePayload): Promise<VerifiableCredentialWithClaims<T>> {\n const credential = await this.importBlob(blob, request);\n\n return new VerifiableCredentialWithClaims(this.client, this.flavor, this.claimsModel, credential);\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ export declare const ErrorCode: {
2
+ readonly VcContextAnnotationMissing: "T001";
3
+ readonly UnexpectedTypeInSerialization: "T002";
4
+ };
5
+ export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
6
+ export declare class DocumentedError extends Error {
7
+ constructor(errorCode: ErrorCode, msg: string);
8
+ }
9
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/documents/utils/error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM;CAKhD"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentedError = exports.ErrorCode = void 0;
4
+ exports.ErrorCode = {
5
+ VcContextAnnotationMissing: 'T001',
6
+ UnexpectedTypeInSerialization: 'T002',
7
+ };
8
+ class DocumentedError extends Error {
9
+ constructor(errorCode, msg) {
10
+ super(`${msg}\nFor more information about this error, check https://docs.truvity.com/sdk/error-codes#${errorCode}`);
11
+ }
12
+ }
13
+ exports.DocumentedError = DocumentedError;
14
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/documents/utils/error.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACrB,0BAA0B,EAAE,MAAM;IAClC,6BAA6B,EAAE,MAAM;CAC/B,CAAC;AAIX,MAAa,eAAgB,SAAQ,KAAK;IACtC,YAAY,SAAoB,EAAE,GAAW;QACzC,KAAK,CACD,GAAG,GAAG,2FAA2F,SAAS,EAAE,CAC/G,CAAC;IACN,CAAC;CACJ;AAND,0CAMC","sourcesContent":["export const ErrorCode = {\n VcContextAnnotationMissing: 'T001',\n UnexpectedTypeInSerialization: 'T002',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n\nexport class DocumentedError extends Error {\n constructor(errorCode: ErrorCode, msg: string) {\n super(\n `${msg}\\nFor more information about this error, check https://docs.truvity.com/sdk/error-codes#${errorCode}`,\n );\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=error.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.spec.d.ts","sourceRoot":"","sources":["../../../src/documents/utils/error.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const error_1 = require("./error");
4
+ describe('DocumentedError', () => {
5
+ it('serializes correctly', () => {
6
+ expect(new error_1.DocumentedError(error_1.ErrorCode.VcContextAnnotationMissing, 'Specific error message').message).toEqual('Specific error message\nFor more information about this error, check https://docs.truvity.com/sdk/error-codes#T001');
7
+ });
8
+ });
9
+ //# sourceMappingURL=error.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.spec.js","sourceRoot":"","sources":["../../../src/documents/utils/error.spec.ts"],"names":[],"mappings":";;AAAA,mCAAqD;AAErD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,IAAI,uBAAe,CAAC,iBAAS,CAAC,0BAA0B,EAAE,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvG,oHAAoH,CACvH,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { DocumentedError, ErrorCode } from './error';\n\ndescribe('DocumentedError', () => {\n it('serializes correctly', () => {\n expect(new DocumentedError(ErrorCode.VcContextAnnotationMissing, 'Specific error message').message).toEqual(\n 'Specific error message\\nFor more information about this error, check https://docs.truvity.com/sdk/error-codes#T001',\n );\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truvity/sdk",
3
- "version": "0.35.1",
3
+ "version": "0.36.2",
4
4
  "repository": "https://github.com/truvity/sdk-typescript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/reference.md CHANGED
@@ -2632,12 +2632,31 @@ according to [RFC 4122](https://www.rfc-editor.org/info/rfc4122).
2632
2632
  <dl>
2633
2633
  <dd>
2634
2634
 
2635
- It's a handy call that wraps the following:
2636
- 1) [Exporting](#tag/drafts/operation/DraftExport) Draft.
2637
- 2) [Signing](#tag/keys/operation/CredentialSign) the exported Draft.
2638
- 3) [Importing](#tag/credentials/operation/CredentialImport) the signed Credential.
2635
+ This operation issues a Verifiable Credential from a Draft resource. Operational Lifecycle:
2636
+ 1) [Exporting](#tag/drafts/operation/DraftExport) Draft.
2637
+ 2) [Signing](#tag/keys/operation/CredentialSign) the exported Draft.
2638
+ 3) [Importing](#tag/credentials/operation/CredentialImport) the signed Credential.
2639
+
2640
+ Cascade Issuance: If the Draft references other drafts the system automatically builds a dependency graph and issues all required drafts in the correct order.
2641
+ The correct order is a topological order of the dependency graph, where each draft is issued only after all its prerequisite drafts have been issued.
2642
+
2643
+ Strict Mode:
2644
+ - The `strict_mode` option allows clients to control how prerequisite drafts are handled during cascade issuance.
2645
+ - Use `strict_mode` to enforce that only the explicitly specified drafts in `prerequisite_drafts` (with matching ETags) are accepted as prerequisites.
2646
+ - When disabled (default), the system will automatically discover and include all linked drafts as prerequisites, building the full dependency graph for cascade issuance.
2647
+
2648
+ Performance Considerations:
2649
+ - The process may take longer than typical API calls due to:
2650
+ - Building and traversing the dependency graph for cascade issuance, which determines the correct issuance order for all linked drafts.
2651
+ - Fetching and resolving external resources required for generating cryptographic proofs, which may involve network requests.
2652
+ - Generating cryptographic proofs for each credential in the dependency graph.
2653
+
2654
+ Concurrency and Consistency:
2655
+ - If the `If-Match` header is provided, strict version control is enforced. The operation will fail if the ETag does not match the current Draft version.
2656
+ - The endpoint is idempotent with respect to the Draft resource and ETag.
2639
2657
 
2640
- If If-Match header is passed, then the strict version control is applied.
2658
+ Recovery:
2659
+ - If the issuance process fails at any stage, the operation can be safely retried. The endpoint is idempotent with respect to the Draft resource and ETag, so repeated calls will not result in duplicate credentials or inconsistent state.
2641
2660
  </dd>
2642
2661
  </dl>
2643
2662
  </dd>
@@ -3015,12 +3034,31 @@ await client.drafts.draftRevision("id", 1);
3015
3034
  <dl>
3016
3035
  <dd>
3017
3036
 
3018
- Deprecated: please use new endpoint [DraftIssue](#tag/drafts/operation/DraftIssueWithoutRevision).It's a handy call that wraps the following:
3019
- 1) [Exporting](#tag/drafts/operation/DraftExport) Draft.
3020
- 2) [Signing](#tag/keys/operation/CredentialSign) the exported Draft.
3021
- 3) [Importing](#tag/credentials/operation/CredentialImport) the signed Credential.
3037
+ Deprecated: please use new endpoint [DraftIssue](#tag/drafts/operation/DraftIssueWithoutRevision).This operation issues a Verifiable Credential from a Draft resource. Operational Lifecycle:
3038
+ 1) [Exporting](#tag/drafts/operation/DraftExport) Draft.
3039
+ 2) [Signing](#tag/keys/operation/CredentialSign) the exported Draft.
3040
+ 3) [Importing](#tag/credentials/operation/CredentialImport) the signed Credential.
3041
+
3042
+ Cascade Issuance: If the Draft references other drafts the system automatically builds a dependency graph and issues all required drafts in the correct order.
3043
+ The correct order is a topological order of the dependency graph, where each draft is issued only after all its prerequisite drafts have been issued.
3044
+
3045
+ Strict Mode:
3046
+ - The `strict_mode` option allows clients to control how prerequisite drafts are handled during cascade issuance.
3047
+ - Use `strict_mode` to enforce that only the explicitly specified drafts in `prerequisite_drafts` (with matching ETags) are accepted as prerequisites.
3048
+ - When disabled (default), the system will automatically discover and include all linked drafts as prerequisites, building the full dependency graph for cascade issuance.
3049
+
3050
+ Performance Considerations:
3051
+ - The process may take longer than typical API calls due to:
3052
+ - Building and traversing the dependency graph for cascade issuance, which determines the correct issuance order for all linked drafts.
3053
+ - Fetching and resolving external resources required for generating cryptographic proofs, which may involve network requests.
3054
+ - Generating cryptographic proofs for each credential in the dependency graph.
3055
+
3056
+ Concurrency and Consistency:
3057
+ - If the `If-Match` header is provided, strict version control is enforced. The operation will fail if the ETag does not match the current Draft version.
3058
+ - The endpoint is idempotent with respect to the Draft resource and ETag.
3022
3059
 
3023
- If If-Match header is passed, then the strict version control is applied.
3060
+ Recovery:
3061
+ - If the issuance process fails at any stage, the operation can be safely retried. The endpoint is idempotent with respect to the Draft resource and ETag, so repeated calls will not result in duplicate credentials or inconsistent state.
3024
3062
  </dd>
3025
3063
  </dl>
3026
3064
  </dd>
@@ -5,6 +5,7 @@ import * as serializers from '../index';
5
5
  import * as Truvity from '../../api/index';
6
6
  import * as core from '../../core';
7
7
  import { CredentialDataModel } from './CredentialDataModel';
8
+ import { LinkedRef } from './LinkedRef';
8
9
  export declare const Credential: core.serialization.ObjectSchema<serializers.Credential.Raw, Truvity.Credential>;
9
10
  export declare namespace Credential {
10
11
  interface Raw {
@@ -13,7 +14,9 @@ export declare namespace Credential {
13
14
  holder?: string | null;
14
15
  id: string;
15
16
  issuer: string;
17
+ linked_credential_refs?: LinkedRef.Raw[] | null;
16
18
  linked_credentials?: string[] | null;
19
+ linked_file_refs?: LinkedRef.Raw[] | null;
17
20
  linked_files?: string[] | null;
18
21
  type: string[];
19
22
  valid_from: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/Credential.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,eAAO,MAAM,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAkBjG,CAAC;AAEP,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAChC,UAAiB,GAAG;QAChB,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACpC,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACrC,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B;CACJ"}
1
+ {"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/Credential.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAuBjG,CAAC;AAEP,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAChC,UAAiB,GAAG;QAChB,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACpC,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,sBAAsB,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAChD,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACrC,gBAAgB,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1C,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B;CACJ"}
@@ -39,13 +39,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Credential = void 0;
40
40
  const core = __importStar(require("../../core"));
41
41
  const CredentialDataModel_1 = require("./CredentialDataModel");
42
+ const LinkedRef_1 = require("./LinkedRef");
42
43
  exports.Credential = core.serialization.object({
43
44
  dataModel: core.serialization.property('data_model', CredentialDataModel_1.CredentialDataModel),
44
45
  digestMultibase: core.serialization.property('digest_multibase', core.serialization.string()),
45
46
  holder: core.serialization.string().optional(),
46
47
  id: core.serialization.string(),
47
48
  issuer: core.serialization.string(),
49
+ linkedCredentialRefs: core.serialization.property('linked_credential_refs', core.serialization.list(LinkedRef_1.LinkedRef).optional()),
48
50
  linkedCredentials: core.serialization.property('linked_credentials', core.serialization.list(core.serialization.string()).optional()),
51
+ linkedFileRefs: core.serialization.property('linked_file_refs', core.serialization.list(LinkedRef_1.LinkedRef).optional()),
49
52
  linkedFiles: core.serialization.property('linked_files', core.serialization.list(core.serialization.string()).optional()),
50
53
  type: core.serialization.list(core.serialization.string()),
51
54
  validFrom: core.serialization.property('valid_from', core.serialization.date()),
@@ -1 +1 @@
1
- {"version":3,"file":"Credential.js","sourceRoot":"","sources":["../../../src/serialization/types/Credential.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,iDAAmC;AACnC,+DAA4D;AAE/C,QAAA,UAAU,GACnB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,yCAAmB,CAAC;IACzE,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC7F,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IAC/B,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IACnC,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAC1C,oBAAoB,EACpB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CACpC,cAAc,EACd,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1D,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC/E,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC/F,CAAC,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { CredentialDataModel } from './CredentialDataModel';\n\nexport const Credential: core.serialization.ObjectSchema<serializers.Credential.Raw, Truvity.Credential> =\n core.serialization.object({\n dataModel: core.serialization.property('data_model', CredentialDataModel),\n digestMultibase: core.serialization.property('digest_multibase', core.serialization.string()),\n holder: core.serialization.string().optional(),\n id: core.serialization.string(),\n issuer: core.serialization.string(),\n linkedCredentials: core.serialization.property(\n 'linked_credentials',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n linkedFiles: core.serialization.property(\n 'linked_files',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n type: core.serialization.list(core.serialization.string()),\n validFrom: core.serialization.property('valid_from', core.serialization.date()),\n validUntil: core.serialization.property('valid_until', core.serialization.date().optional()),\n });\n\nexport declare namespace Credential {\n export interface Raw {\n data_model: CredentialDataModel.Raw;\n digest_multibase: string;\n holder?: string | null;\n id: string;\n issuer: string;\n linked_credentials?: string[] | null;\n linked_files?: string[] | null;\n type: string[];\n valid_from: string;\n valid_until?: string | null;\n }\n}\n"]}
1
+ {"version":3,"file":"Credential.js","sourceRoot":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EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1D,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC/E,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC/F,CAAC,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { CredentialDataModel } from './CredentialDataModel';\nimport { LinkedRef } from './LinkedRef';\n\nexport const Credential: core.serialization.ObjectSchema<serializers.Credential.Raw, Truvity.Credential> =\n core.serialization.object({\n dataModel: core.serialization.property('data_model', CredentialDataModel),\n digestMultibase: core.serialization.property('digest_multibase', core.serialization.string()),\n holder: core.serialization.string().optional(),\n id: core.serialization.string(),\n issuer: core.serialization.string(),\n linkedCredentialRefs: core.serialization.property(\n 'linked_credential_refs',\n core.serialization.list(LinkedRef).optional(),\n ),\n linkedCredentials: core.serialization.property(\n 'linked_credentials',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n linkedFileRefs: core.serialization.property('linked_file_refs', core.serialization.list(LinkedRef).optional()),\n linkedFiles: core.serialization.property(\n 'linked_files',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n type: core.serialization.list(core.serialization.string()),\n validFrom: core.serialization.property('valid_from', core.serialization.date()),\n validUntil: core.serialization.property('valid_until', core.serialization.date().optional()),\n });\n\nexport declare namespace Credential {\n export interface Raw {\n data_model: CredentialDataModel.Raw;\n digest_multibase: string;\n holder?: string | null;\n id: string;\n issuer: string;\n linked_credential_refs?: LinkedRef.Raw[] | null;\n linked_credentials?: string[] | null;\n linked_file_refs?: LinkedRef.Raw[] | null;\n linked_files?: string[] | null;\n type: string[];\n valid_from: string;\n valid_until?: string | null;\n }\n}\n"]}
@@ -5,8 +5,12 @@ import * as serializers from '../index';
5
5
  import * as Truvity from '../../api/index';
6
6
  import * as core from '../../core';
7
7
  import { CredentialBaseFilter } from './CredentialBaseFilter';
8
+ import { FileBaseFilter } from './FileBaseFilter';
8
9
  export declare const CredentialFilter: core.serialization.ObjectSchema<serializers.CredentialFilter.Raw, Truvity.CredentialFilter>;
9
10
  export declare namespace CredentialFilter {
10
- type Raw = CredentialBaseFilter.Raw;
11
+ interface Raw extends CredentialBaseFilter.Raw {
12
+ linked_credentials?: CredentialBaseFilter.Raw | null;
13
+ linked_files?: FileBaseFilter.Raw | null;
14
+ }
11
15
  }
12
16
  //# sourceMappingURL=CredentialFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialFilter.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/CredentialFilter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAChC,OAAO,CAAC,gBAAgB,CACJ,CAAC;AAEzB,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACtC,KAAY,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC;CAC9C"}
1
+ {"version":3,"file":"CredentialFilter.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/CredentialFilter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAChC,OAAO,CAAC,gBAAgB,CAMK,CAAC;AAElC,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACtC,UAAiB,GAAI,SAAQ,oBAAoB,CAAC,GAAG;QACjD,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,GAAG,GAAG,IAAI,CAAC;QACrD,YAAY,CAAC,EAAE,cAAc,CAAC,GAAG,GAAG,IAAI,CAAC;KAC5C;CACJ"}
@@ -2,8 +2,48 @@
2
2
  /**
3
3
  * This file was auto-generated by Fern from our API Definition.
4
4
  */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.CredentialFilter = void 0;
40
+ const core = __importStar(require("../../core"));
7
41
  const CredentialBaseFilter_1 = require("./CredentialBaseFilter");
8
- exports.CredentialFilter = CredentialBaseFilter_1.CredentialBaseFilter;
42
+ const FileBaseFilter_1 = require("./FileBaseFilter");
43
+ exports.CredentialFilter = core.serialization
44
+ .object({
45
+ linkedCredentials: core.serialization.property('linked_credentials', CredentialBaseFilter_1.CredentialBaseFilter.optional()),
46
+ linkedFiles: core.serialization.property('linked_files', FileBaseFilter_1.FileBaseFilter.optional()),
47
+ })
48
+ .extend(CredentialBaseFilter_1.CredentialBaseFilter);
9
49
  //# sourceMappingURL=CredentialFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialFilter.js","sourceRoot":"","sources":["../../../src/serialization/types/CredentialFilter.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAKH,iEAA8D;AAEjD,QAAA,gBAAgB,GAGzB,2CAAoB,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { CredentialBaseFilter } from './CredentialBaseFilter';\n\nexport const CredentialFilter: core.serialization.ObjectSchema<\n serializers.CredentialFilter.Raw,\n Truvity.CredentialFilter\n> = CredentialBaseFilter;\n\nexport declare namespace CredentialFilter {\n export type Raw = CredentialBaseFilter.Raw;\n}\n"]}
1
+ {"version":3,"file":"CredentialFilter.js","sourceRoot":"","sources":["../../../src/serialization/types/CredentialFilter.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,iDAAmC;AACnC,iEAA8D;AAC9D,qDAAkD;AAErC,QAAA,gBAAgB,GAGzB,IAAI,CAAC,aAAa;KACjB,MAAM,CAAC;IACJ,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,QAAQ,EAAE,CAAC;IACrG,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,EAAE,+BAAc,CAAC,QAAQ,EAAE,CAAC;CACtF,CAAC;KACD,MAAM,CAAC,2CAAoB,CAAC,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { CredentialBaseFilter } from './CredentialBaseFilter';\nimport { FileBaseFilter } from './FileBaseFilter';\n\nexport const CredentialFilter: core.serialization.ObjectSchema<\n serializers.CredentialFilter.Raw,\n Truvity.CredentialFilter\n> = core.serialization\n .object({\n linkedCredentials: core.serialization.property('linked_credentials', CredentialBaseFilter.optional()),\n linkedFiles: core.serialization.property('linked_files', FileBaseFilter.optional()),\n })\n .extend(CredentialBaseFilter);\n\nexport declare namespace CredentialFilter {\n export interface Raw extends CredentialBaseFilter.Raw {\n linked_credentials?: CredentialBaseFilter.Raw | null;\n linked_files?: FileBaseFilter.Raw | null;\n }\n}\n"]}
@@ -4,12 +4,16 @@
4
4
  import * as serializers from '../index';
5
5
  import * as Truvity from '../../api/index';
6
6
  import * as core from '../../core';
7
+ import { LinkedRef } from './LinkedRef';
8
+ import { LinkedResourceRef } from './LinkedResourceRef';
7
9
  import { DraftMeta } from './DraftMeta';
8
10
  import { DraftSchema } from './DraftSchema';
9
11
  export declare const Draft: core.serialization.ObjectSchema<serializers.Draft.Raw, Truvity.Draft>;
10
12
  export declare namespace Draft {
11
13
  interface Raw {
14
+ linked_credential_refs?: LinkedRef.Raw[] | null;
12
15
  linked_credentials?: string[] | null;
16
+ linked_draft_refs?: LinkedResourceRef.Raw[] | null;
13
17
  linked_drafts?: string[] | null;
14
18
  meta?: DraftMeta.Raw | null;
15
19
  schema: DraftSchema.Raw;
@@ -1 +1 @@
1
- {"version":3,"file":"Draft.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/Draft.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAatF,CAAC;AAEH,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC3B,UAAiB,GAAG;QAChB,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACrC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,EAAE,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC;QAC5B,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC;QACxB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;KAC3C;CACJ"}
1
+ {"version":3,"file":"Draft.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/Draft.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAqBtF,CAAC;AAEH,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC3B,UAAiB,GAAG;QAChB,sBAAsB,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAChD,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QACnD,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,EAAE,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC;QAC5B,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC;QACxB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;KAC3C;CACJ"}
@@ -38,10 +38,14 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Draft = void 0;
40
40
  const core = __importStar(require("../../core"));
41
+ const LinkedRef_1 = require("./LinkedRef");
42
+ const LinkedResourceRef_1 = require("./LinkedResourceRef");
41
43
  const DraftMeta_1 = require("./DraftMeta");
42
44
  const DraftSchema_1 = require("./DraftSchema");
43
45
  exports.Draft = core.serialization.object({
46
+ linkedCredentialRefs: core.serialization.property('linked_credential_refs', core.serialization.list(LinkedRef_1.LinkedRef).optional()),
44
47
  linkedCredentials: core.serialization.property('linked_credentials', core.serialization.list(core.serialization.string()).optional()),
48
+ linkedDraftRefs: core.serialization.property('linked_draft_refs', core.serialization.list(LinkedResourceRef_1.LinkedResourceRef).optional()),
45
49
  linkedDrafts: core.serialization.property('linked_drafts', core.serialization.list(core.serialization.string()).optional()),
46
50
  meta: DraftMeta_1.DraftMeta.optional(),
47
51
  schema: DraftSchema_1.DraftSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"Draft.js","sourceRoot":"","sources":["../../../src/serialization/types/Draft.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,iDAAmC;AACnC,2CAAwC;AACxC,+CAA4C;AAE/B,QAAA,KAAK,GAA0E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClH,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAC1C,oBAAoB,EACpB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CACrC,eAAe,EACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,IAAI,EAAE,qBAAS,CAAC,QAAQ,EAAE;IAC1B,MAAM,EAAE,yBAAW;IACnB,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1G,CAAC,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { DraftMeta } from './DraftMeta';\nimport { DraftSchema } from './DraftSchema';\n\nexport const Draft: core.serialization.ObjectSchema<serializers.Draft.Raw, Truvity.Draft> = core.serialization.object({\n linkedCredentials: core.serialization.property(\n 'linked_credentials',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n linkedDrafts: core.serialization.property(\n 'linked_drafts',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n meta: DraftMeta.optional(),\n schema: DraftSchema,\n type: core.serialization.list(core.serialization.string()),\n values: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),\n});\n\nexport declare namespace Draft {\n export interface Raw {\n linked_credentials?: string[] | null;\n linked_drafts?: string[] | null;\n meta?: DraftMeta.Raw | null;\n schema: DraftSchema.Raw;\n type: string[];\n values?: Record<string, unknown> | null;\n }\n}\n"]}
1
+ {"version":3,"file":"Draft.js","sourceRoot":"","sources":["../../../src/serialization/types/Draft.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,iDAAmC;AACnC,2CAAwC;AACxC,2DAAwD;AACxD,2CAAwC;AACxC,+CAA4C;AAE/B,QAAA,KAAK,GAA0E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClH,oBAAoB,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAC7C,wBAAwB,EACxB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAS,CAAC,CAAC,QAAQ,EAAE,CAChD;IACD,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAC1C,oBAAoB,EACpB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CACxC,mBAAmB,EACnB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qCAAiB,CAAC,CAAC,QAAQ,EAAE,CACxD;IACD,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CACrC,eAAe,EACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAClE;IACD,IAAI,EAAE,qBAAS,CAAC,QAAQ,EAAE;IAC1B,MAAM,EAAE,yBAAW;IACnB,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1G,CAAC,CAAC","sourcesContent":["/**\n * This file was auto-generated by Fern from our API Definition.\n */\n\nimport * as serializers from '../index';\nimport * as Truvity from '../../api/index';\nimport * as core from '../../core';\nimport { LinkedRef } from './LinkedRef';\nimport { LinkedResourceRef } from './LinkedResourceRef';\nimport { DraftMeta } from './DraftMeta';\nimport { DraftSchema } from './DraftSchema';\n\nexport const Draft: core.serialization.ObjectSchema<serializers.Draft.Raw, Truvity.Draft> = core.serialization.object({\n linkedCredentialRefs: core.serialization.property(\n 'linked_credential_refs',\n core.serialization.list(LinkedRef).optional(),\n ),\n linkedCredentials: core.serialization.property(\n 'linked_credentials',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n linkedDraftRefs: core.serialization.property(\n 'linked_draft_refs',\n core.serialization.list(LinkedResourceRef).optional(),\n ),\n linkedDrafts: core.serialization.property(\n 'linked_drafts',\n core.serialization.list(core.serialization.string()).optional(),\n ),\n meta: DraftMeta.optional(),\n schema: DraftSchema,\n type: core.serialization.list(core.serialization.string()),\n values: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),\n});\n\nexport declare namespace Draft {\n export interface Raw {\n linked_credential_refs?: LinkedRef.Raw[] | null;\n linked_credentials?: string[] | null;\n linked_draft_refs?: LinkedResourceRef.Raw[] | null;\n linked_drafts?: string[] | null;\n meta?: DraftMeta.Raw | null;\n schema: DraftSchema.Raw;\n type: string[];\n values?: Record<string, unknown> | null;\n }\n}\n"]}
@@ -4,9 +4,13 @@
4
4
  import * as serializers from '../index';
5
5
  import * as Truvity from '../../api/index';
6
6
  import * as core from '../../core';
7
+ import { CredentialBaseFilter } from './CredentialBaseFilter';
7
8
  import { DraftBaseFilter } from './DraftBaseFilter';
8
9
  export declare const DraftFilter: core.serialization.ObjectSchema<serializers.DraftFilter.Raw, Truvity.DraftFilter>;
9
10
  export declare namespace DraftFilter {
10
- type Raw = DraftBaseFilter.Raw;
11
+ interface Raw extends DraftBaseFilter.Raw {
12
+ linked_credentials?: CredentialBaseFilter.Raw | null;
13
+ linked_drafts?: DraftBaseFilter.Raw | null;
14
+ }
11
15
  }
12
16
  //# sourceMappingURL=DraftFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DraftFilter.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/DraftFilter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CACvF,CAAC;AAEpB,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACjC,KAAY,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;CACzC"}
1
+ {"version":3,"file":"DraftFilter.d.ts","sourceRoot":"","sources":["../../../src/serialization/types/DraftFilter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,WAAW,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAM1E,CAAC;AAEjC,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACjC,UAAiB,GAAI,SAAQ,eAAe,CAAC,GAAG;QAC5C,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,GAAG,GAAG,IAAI,CAAC;QACrD,aAAa,CAAC,EAAE,eAAe,CAAC,GAAG,GAAG,IAAI,CAAC;KAC9C;CACJ"}