@nexeraprotocol/nexera-id-schemas
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -7,3 +7,13 @@ 'use strict'; | ||
var ID3_6CredentialSubjectSchema = zod.z.object({ | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
var ID3_7CredentialSubjectSchema = zod.z.object({ | ||
journeyId: zod.z.string(), | ||
@@ -17,4 +27,4 @@ amendmentsData: zod.z.object({ | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
@@ -31,88 +41,88 @@ placeOfBirth: zod.z.string().optional(), | ||
middleName: zod.z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: zod.z.object({ | ||
AuthenticationID: zod.z.string(), | ||
Timestamp: zod.z.string(), | ||
CustomerRef: zod.z.string(), | ||
ProfileID: zod.z.string(), | ||
ProfileName: zod.z.string(), | ||
ProfileVersion: zod.z.number()["int"](), | ||
ProfileRevision: zod.z.number()["int"](), | ||
ProfileState: zod.z.string(), | ||
AuthenticationID: zod.z.string().optional(), | ||
Timestamp: zod.z.string().optional(), | ||
CustomerRef: zod.z.string().optional(), | ||
ProfileID: zod.z.string().optional(), | ||
ProfileName: zod.z.string().optional(), | ||
ProfileVersion: zod.z.number()["int"]().optional(), | ||
ProfileRevision: zod.z.number()["int"]().optional(), | ||
ProfileState: zod.z.string().optional(), | ||
ResultCodes: zod.z.object({ | ||
GlobalItemCheckResultCodes: zod.z.array(zod.z.object({ | ||
Name: zod.z.string(), | ||
Description: zod.z.string(), | ||
Name: zod.z.string().optional(), | ||
Description: zod.z.string().optional(), | ||
Comment: zod.z.record(zod.z.any()).optional(), | ||
Match: zod.z.record(zod.z.any()).optional(), | ||
Warning: zod.z.record(zod.z.any()).optional(), | ||
ID: zod.z.number()["int"](), | ||
Pass: zod.z.string(), | ||
Address: zod.z.string(), | ||
Forename: zod.z.string(), | ||
Surname: zod.z.string(), | ||
DOB: zod.z.string(), | ||
Alert: zod.z.string(), | ||
ID: zod.z.number()["int"]().optional(), | ||
Pass: zod.z.string().optional(), | ||
Address: zod.z.string().optional(), | ||
Forename: zod.z.string().optional(), | ||
Surname: zod.z.string().optional(), | ||
DOB: zod.z.string().optional(), | ||
Alert: zod.z.string().optional(), | ||
SanctionsMatches: zod.z.union([zod.z.record(zod.z.any()), zod.z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: zod.z.number()["int"](), | ||
BandText: zod.z.string(), | ||
Country: zod.z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: zod.z.number()["int"]().optional(), | ||
BandText: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional(), | ||
SanctionsPositions: zod.z.object({ | ||
GlobalSanctionsPosition: zod.z.array(zod.z.object({ | ||
Position: zod.z.string(), | ||
Country: zod.z.string() | ||
})) | ||
}) | ||
})), | ||
Position: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
SanctionsBodies: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.number()["int"]()) | ||
}), | ||
"a:string": zod.z.array(zod.z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
@@ -126,105 +136,105 @@ originalData: zod.z.object({ | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
age: zod.z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: zod.z.object({ | ||
AuthenticationID: zod.z.string(), | ||
Timestamp: zod.z.string(), | ||
CustomerRef: zod.z.string(), | ||
ProfileID: zod.z.string(), | ||
ProfileName: zod.z.string(), | ||
ProfileVersion: zod.z.number()["int"](), | ||
ProfileRevision: zod.z.number()["int"](), | ||
ProfileState: zod.z.string(), | ||
AuthenticationID: zod.z.string().optional(), | ||
Timestamp: zod.z.string().optional(), | ||
CustomerRef: zod.z.string().optional(), | ||
ProfileID: zod.z.string().optional(), | ||
ProfileName: zod.z.string().optional(), | ||
ProfileVersion: zod.z.number()["int"]().optional(), | ||
ProfileRevision: zod.z.number()["int"]().optional(), | ||
ProfileState: zod.z.string().optional(), | ||
ResultCodes: zod.z.object({ | ||
GlobalItemCheckResultCodes: zod.z.array(zod.z.object({ | ||
Name: zod.z.string(), | ||
Description: zod.z.string(), | ||
Name: zod.z.string().optional(), | ||
Description: zod.z.string().optional(), | ||
Comment: zod.z.record(zod.z.any()).optional(), | ||
Match: zod.z.record(zod.z.any()).optional(), | ||
Warning: zod.z.record(zod.z.any()).optional(), | ||
ID: zod.z.number()["int"](), | ||
Pass: zod.z.string(), | ||
Address: zod.z.string(), | ||
Forename: zod.z.string(), | ||
Surname: zod.z.string(), | ||
DOB: zod.z.string(), | ||
Alert: zod.z.string(), | ||
ID: zod.z.number()["int"]().optional(), | ||
Pass: zod.z.string().optional(), | ||
Address: zod.z.string().optional(), | ||
Forename: zod.z.string().optional(), | ||
Surname: zod.z.string().optional(), | ||
DOB: zod.z.string().optional(), | ||
Alert: zod.z.string().optional(), | ||
SanctionsMatches: zod.z.union([zod.z.record(zod.z.any()), zod.z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: zod.z.number()["int"](), | ||
BandText: zod.z.string(), | ||
Country: zod.z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: zod.z.number()["int"]().optional(), | ||
BandText: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional(), | ||
SanctionsPositions: zod.z.object({ | ||
GlobalSanctionsPosition: zod.z.array(zod.z.object({ | ||
Position: zod.z.string(), | ||
Country: zod.z.string() | ||
})) | ||
}) | ||
})), | ||
Position: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
SanctionsBodies: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.number()["int"]()) | ||
}), | ||
"a:string": zod.z.array(zod.z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
personalDetails: zod.z.object({ | ||
citizenship: zod.z.string(), | ||
documentType: zod.z.string(), | ||
firstName: zod.z.string(), | ||
lastName: zod.z.string(), | ||
gender: zod.z.string(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
birthday: zod.z.string(), | ||
placeOfBirth: zod.z.string(), | ||
countryOfResidence: zod.z.string(), | ||
age: zod.z.string(), | ||
citizenship: zod.z.string().optional(), | ||
documentType: zod.z.string().optional(), | ||
firstName: zod.z.string().optional(), | ||
lastName: zod.z.string().optional(), | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
placeOfBirth: zod.z.string().optional(), | ||
countryOfResidence: zod.z.string().optional(), | ||
age: zod.z.string().optional(), | ||
city: zod.z.string().optional(), | ||
@@ -354,3 +364,3 @@ province: zod.z.string().optional(), | ||
var CredentialTypes = ["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypes = ["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypesSchema = zod.z.string().transform(function (x) { | ||
@@ -366,3 +376,32 @@ return x.replace("_", "-"); | ||
}).catchall(zod.z.any()); | ||
var CredentialZodSchemas = zod.z.union([IDScanCredentialSubjectSchema, ID3_6CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
var CredentialZodSchemas = zod.z.union([IDScanCredentialSubjectSchema, ID3_7CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
/** | ||
* Recursively remove empty strings from object | ||
* @param obj | ||
*/ | ||
function removeEmptyStringAttributes(obj) { | ||
if (_typeof(obj) !== "object" || obj === null) { | ||
return obj; | ||
} | ||
for (var key in obj) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (obj[key] === "") { | ||
// remove key if value is empty string | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
delete obj[key]; | ||
} else { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (_typeof(obj[key]) === "object") { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
obj[key] = removeEmptyStringAttributes(obj[key]); | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
var CredentialSchemas = { | ||
@@ -373,5 +412,5 @@ IDScan: { | ||
}, | ||
"ID3-v6": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v6/id3.json", | ||
zod: ID3_6CredentialSubjectSchema | ||
"ID3-v7": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v7/id3.json", | ||
zod: ID3_7CredentialSubjectSchema | ||
}, | ||
@@ -392,3 +431,6 @@ ProofOfResidenceV6: { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/idscan/v2/idscan.json", | ||
zod: IDScanV2CredentialSubjectSchema | ||
// check attributes for emptry strings and convert to null | ||
zod: IDScanV2CredentialSubjectSchema.transform(function (obj) { | ||
return removeEmptyStringAttributes(obj); | ||
}) | ||
} | ||
@@ -395,0 +437,0 @@ }; |
@@ -7,3 +7,13 @@ 'use strict'; | ||
var ID3_6CredentialSubjectSchema = zod.z.object({ | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
var ID3_7CredentialSubjectSchema = zod.z.object({ | ||
journeyId: zod.z.string(), | ||
@@ -17,4 +27,4 @@ amendmentsData: zod.z.object({ | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
@@ -31,88 +41,88 @@ placeOfBirth: zod.z.string().optional(), | ||
middleName: zod.z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: zod.z.object({ | ||
AuthenticationID: zod.z.string(), | ||
Timestamp: zod.z.string(), | ||
CustomerRef: zod.z.string(), | ||
ProfileID: zod.z.string(), | ||
ProfileName: zod.z.string(), | ||
ProfileVersion: zod.z.number()["int"](), | ||
ProfileRevision: zod.z.number()["int"](), | ||
ProfileState: zod.z.string(), | ||
AuthenticationID: zod.z.string().optional(), | ||
Timestamp: zod.z.string().optional(), | ||
CustomerRef: zod.z.string().optional(), | ||
ProfileID: zod.z.string().optional(), | ||
ProfileName: zod.z.string().optional(), | ||
ProfileVersion: zod.z.number()["int"]().optional(), | ||
ProfileRevision: zod.z.number()["int"]().optional(), | ||
ProfileState: zod.z.string().optional(), | ||
ResultCodes: zod.z.object({ | ||
GlobalItemCheckResultCodes: zod.z.array(zod.z.object({ | ||
Name: zod.z.string(), | ||
Description: zod.z.string(), | ||
Name: zod.z.string().optional(), | ||
Description: zod.z.string().optional(), | ||
Comment: zod.z.record(zod.z.any()).optional(), | ||
Match: zod.z.record(zod.z.any()).optional(), | ||
Warning: zod.z.record(zod.z.any()).optional(), | ||
ID: zod.z.number()["int"](), | ||
Pass: zod.z.string(), | ||
Address: zod.z.string(), | ||
Forename: zod.z.string(), | ||
Surname: zod.z.string(), | ||
DOB: zod.z.string(), | ||
Alert: zod.z.string(), | ||
ID: zod.z.number()["int"]().optional(), | ||
Pass: zod.z.string().optional(), | ||
Address: zod.z.string().optional(), | ||
Forename: zod.z.string().optional(), | ||
Surname: zod.z.string().optional(), | ||
DOB: zod.z.string().optional(), | ||
Alert: zod.z.string().optional(), | ||
SanctionsMatches: zod.z.union([zod.z.record(zod.z.any()), zod.z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: zod.z.number()["int"](), | ||
BandText: zod.z.string(), | ||
Country: zod.z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: zod.z.number()["int"]().optional(), | ||
BandText: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional(), | ||
SanctionsPositions: zod.z.object({ | ||
GlobalSanctionsPosition: zod.z.array(zod.z.object({ | ||
Position: zod.z.string(), | ||
Country: zod.z.string() | ||
})) | ||
}) | ||
})), | ||
Position: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
SanctionsBodies: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.number()["int"]()) | ||
}), | ||
"a:string": zod.z.array(zod.z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
@@ -126,105 +136,105 @@ originalData: zod.z.object({ | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
age: zod.z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: zod.z.object({ | ||
AuthenticationID: zod.z.string(), | ||
Timestamp: zod.z.string(), | ||
CustomerRef: zod.z.string(), | ||
ProfileID: zod.z.string(), | ||
ProfileName: zod.z.string(), | ||
ProfileVersion: zod.z.number()["int"](), | ||
ProfileRevision: zod.z.number()["int"](), | ||
ProfileState: zod.z.string(), | ||
AuthenticationID: zod.z.string().optional(), | ||
Timestamp: zod.z.string().optional(), | ||
CustomerRef: zod.z.string().optional(), | ||
ProfileID: zod.z.string().optional(), | ||
ProfileName: zod.z.string().optional(), | ||
ProfileVersion: zod.z.number()["int"]().optional(), | ||
ProfileRevision: zod.z.number()["int"]().optional(), | ||
ProfileState: zod.z.string().optional(), | ||
ResultCodes: zod.z.object({ | ||
GlobalItemCheckResultCodes: zod.z.array(zod.z.object({ | ||
Name: zod.z.string(), | ||
Description: zod.z.string(), | ||
Name: zod.z.string().optional(), | ||
Description: zod.z.string().optional(), | ||
Comment: zod.z.record(zod.z.any()).optional(), | ||
Match: zod.z.record(zod.z.any()).optional(), | ||
Warning: zod.z.record(zod.z.any()).optional(), | ||
ID: zod.z.number()["int"](), | ||
Pass: zod.z.string(), | ||
Address: zod.z.string(), | ||
Forename: zod.z.string(), | ||
Surname: zod.z.string(), | ||
DOB: zod.z.string(), | ||
Alert: zod.z.string(), | ||
ID: zod.z.number()["int"]().optional(), | ||
Pass: zod.z.string().optional(), | ||
Address: zod.z.string().optional(), | ||
Forename: zod.z.string().optional(), | ||
Surname: zod.z.string().optional(), | ||
DOB: zod.z.string().optional(), | ||
Alert: zod.z.string().optional(), | ||
SanctionsMatches: zod.z.union([zod.z.record(zod.z.any()), zod.z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: zod.z.number()["int"](), | ||
BandText: zod.z.string(), | ||
Country: zod.z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: zod.z.number()["int"]().optional(), | ||
BandText: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional(), | ||
SanctionsPositions: zod.z.object({ | ||
GlobalSanctionsPosition: zod.z.array(zod.z.object({ | ||
Position: zod.z.string(), | ||
Country: zod.z.string() | ||
})) | ||
}) | ||
})), | ||
Position: zod.z.string().optional(), | ||
Country: zod.z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: zod.z.array(zod.z.object({ | ||
Fullname: zod.z.string(), | ||
Fullname: zod.z.string().optional(), | ||
SanctionsBodies: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.number()["int"]()) | ||
}), | ||
"a:string": zod.z.array(zod.z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: zod.z.object({ | ||
"a:string": zod.z.array(zod.z.string()) | ||
}), | ||
"a:string": zod.z.array(zod.z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: zod.z.object({ | ||
GlobalSanctionsAddress: zod.z.array(zod.z.object({ | ||
AddressLine: zod.z.string(), | ||
City: zod.z.string(), | ||
Country: zod.z.string(), | ||
Region: zod.z.string() | ||
})) | ||
}), | ||
AddressLine: zod.z.string().optional(), | ||
City: zod.z.string().optional(), | ||
Country: zod.z.string().optional(), | ||
Region: zod.z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: zod.z.object({ | ||
GlobalSanctionsDate: zod.z.object({ | ||
DateType: zod.z.string(), | ||
DateType: zod.z.string().optional(), | ||
Day: zod.z.number()["int"]().optional(), | ||
Month: zod.z.number()["int"]().optional(), | ||
Year: zod.z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: zod.z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: zod.z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
personalDetails: zod.z.object({ | ||
citizenship: zod.z.string(), | ||
documentType: zod.z.string(), | ||
firstName: zod.z.string(), | ||
lastName: zod.z.string(), | ||
gender: zod.z.string(), | ||
addressLine1: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
addressLine2: zod.z.union([zod.z.string(), zod.z["null"]()]).optional(), | ||
birthday: zod.z.string(), | ||
placeOfBirth: zod.z.string(), | ||
countryOfResidence: zod.z.string(), | ||
age: zod.z.string(), | ||
citizenship: zod.z.string().optional(), | ||
documentType: zod.z.string().optional(), | ||
firstName: zod.z.string().optional(), | ||
lastName: zod.z.string().optional(), | ||
gender: zod.z.string().optional(), | ||
addressLine1: zod.z.string().nullable().optional(), | ||
addressLine2: zod.z.string().nullable().optional(), | ||
birthday: zod.z.string().optional(), | ||
placeOfBirth: zod.z.string().optional(), | ||
countryOfResidence: zod.z.string().optional(), | ||
age: zod.z.string().optional(), | ||
city: zod.z.string().optional(), | ||
@@ -354,3 +364,3 @@ province: zod.z.string().optional(), | ||
var CredentialTypes = ["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypes = ["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypesSchema = zod.z.string().transform(function (x) { | ||
@@ -366,3 +376,32 @@ return x.replace("_", "-"); | ||
}).catchall(zod.z.any()); | ||
var CredentialZodSchemas = zod.z.union([IDScanCredentialSubjectSchema, ID3_6CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
var CredentialZodSchemas = zod.z.union([IDScanCredentialSubjectSchema, ID3_7CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
/** | ||
* Recursively remove empty strings from object | ||
* @param obj | ||
*/ | ||
function removeEmptyStringAttributes(obj) { | ||
if (_typeof(obj) !== "object" || obj === null) { | ||
return obj; | ||
} | ||
for (var key in obj) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (obj[key] === "") { | ||
// remove key if value is empty string | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
delete obj[key]; | ||
} else { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (_typeof(obj[key]) === "object") { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
obj[key] = removeEmptyStringAttributes(obj[key]); | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
var CredentialSchemas = { | ||
@@ -373,5 +412,5 @@ IDScan: { | ||
}, | ||
"ID3-v6": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v6/id3.json", | ||
zod: ID3_6CredentialSubjectSchema | ||
"ID3-v7": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v7/id3.json", | ||
zod: ID3_7CredentialSubjectSchema | ||
}, | ||
@@ -392,3 +431,6 @@ ProofOfResidenceV6: { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/idscan/v2/idscan.json", | ||
zod: IDScanV2CredentialSubjectSchema | ||
// check attributes for emptry strings and convert to null | ||
zod: IDScanV2CredentialSubjectSchema.transform(function (obj) { | ||
return removeEmptyStringAttributes(obj); | ||
}) | ||
} | ||
@@ -395,0 +437,0 @@ }; |
import { z } from 'zod'; | ||
var ID3_6CredentialSubjectSchema = z.object({ | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
var ID3_7CredentialSubjectSchema = z.object({ | ||
journeyId: z.string(), | ||
@@ -12,4 +22,4 @@ amendmentsData: z.object({ | ||
gender: z.string().optional(), | ||
addressLine1: z.union([z.string(), z["null"]()]).optional(), | ||
addressLine2: z.union([z.string(), z["null"]()]).optional(), | ||
addressLine1: z.string().nullable().optional(), | ||
addressLine2: z.string().nullable().optional(), | ||
birthday: z.string().optional(), | ||
@@ -26,88 +36,88 @@ placeOfBirth: z.string().optional(), | ||
middleName: z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: z.object({ | ||
AuthenticationID: z.string(), | ||
Timestamp: z.string(), | ||
CustomerRef: z.string(), | ||
ProfileID: z.string(), | ||
ProfileName: z.string(), | ||
ProfileVersion: z.number()["int"](), | ||
ProfileRevision: z.number()["int"](), | ||
ProfileState: z.string(), | ||
AuthenticationID: z.string().optional(), | ||
Timestamp: z.string().optional(), | ||
CustomerRef: z.string().optional(), | ||
ProfileID: z.string().optional(), | ||
ProfileName: z.string().optional(), | ||
ProfileVersion: z.number()["int"]().optional(), | ||
ProfileRevision: z.number()["int"]().optional(), | ||
ProfileState: z.string().optional(), | ||
ResultCodes: z.object({ | ||
GlobalItemCheckResultCodes: z.array(z.object({ | ||
Name: z.string(), | ||
Description: z.string(), | ||
Name: z.string().optional(), | ||
Description: z.string().optional(), | ||
Comment: z.record(z.any()).optional(), | ||
Match: z.record(z.any()).optional(), | ||
Warning: z.record(z.any()).optional(), | ||
ID: z.number()["int"](), | ||
Pass: z.string(), | ||
Address: z.string(), | ||
Forename: z.string(), | ||
Surname: z.string(), | ||
DOB: z.string(), | ||
Alert: z.string(), | ||
ID: z.number()["int"]().optional(), | ||
Pass: z.string().optional(), | ||
Address: z.string().optional(), | ||
Forename: z.string().optional(), | ||
Surname: z.string().optional(), | ||
DOB: z.string().optional(), | ||
Alert: z.string().optional(), | ||
SanctionsMatches: z.union([z.record(z.any()), z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: z.number()["int"](), | ||
BandText: z.string(), | ||
Country: z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: z.number()["int"]().optional(), | ||
BandText: z.string().optional(), | ||
Country: z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: z.array(z.object({ | ||
Fullname: z.string(), | ||
Fullname: z.string().optional(), | ||
Aliases: z.object({ | ||
"a:string": z.array(z.string()) | ||
}), | ||
"a:string": z.array(z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: z.object({ | ||
GlobalSanctionsAddress: z.array(z.object({ | ||
AddressLine: z.string(), | ||
City: z.string(), | ||
Country: z.string(), | ||
Region: z.string() | ||
})) | ||
}), | ||
AddressLine: z.string().optional(), | ||
City: z.string().optional(), | ||
Country: z.string().optional(), | ||
Region: z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: z.object({ | ||
GlobalSanctionsDate: z.object({ | ||
DateType: z.string(), | ||
DateType: z.string().optional(), | ||
Day: z.number()["int"]().optional(), | ||
Month: z.number()["int"]().optional(), | ||
Year: z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: z.string().optional(), | ||
SanctionsPositions: z.object({ | ||
GlobalSanctionsPosition: z.array(z.object({ | ||
Position: z.string(), | ||
Country: z.string() | ||
})) | ||
}) | ||
})), | ||
Position: z.string().optional(), | ||
Country: z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: z.array(z.object({ | ||
Fullname: z.string(), | ||
Fullname: z.string().optional(), | ||
SanctionsBodies: z.object({ | ||
"a:string": z.array(z.number()["int"]()) | ||
}), | ||
"a:string": z.array(z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: z.object({ | ||
"a:string": z.array(z.string()) | ||
}), | ||
"a:string": z.array(z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: z.object({ | ||
GlobalSanctionsAddress: z.array(z.object({ | ||
AddressLine: z.string(), | ||
City: z.string(), | ||
Country: z.string(), | ||
Region: z.string() | ||
})) | ||
}), | ||
AddressLine: z.string().optional(), | ||
City: z.string().optional(), | ||
Country: z.string().optional(), | ||
Region: z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: z.object({ | ||
GlobalSanctionsDate: z.object({ | ||
DateType: z.string(), | ||
DateType: z.string().optional(), | ||
Day: z.number()["int"]().optional(), | ||
Month: z.number()["int"]().optional(), | ||
Year: z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
@@ -121,105 +131,105 @@ originalData: z.object({ | ||
gender: z.string().optional(), | ||
addressLine1: z.union([z.string(), z["null"]()]).optional(), | ||
addressLine2: z.union([z.string(), z["null"]()]).optional(), | ||
addressLine1: z.string().nullable().optional(), | ||
addressLine2: z.string().nullable().optional(), | ||
birthday: z.string().optional(), | ||
age: z.string().optional() | ||
}), | ||
}).optional(), | ||
authenticateSPResult: z.object({ | ||
AuthenticationID: z.string(), | ||
Timestamp: z.string(), | ||
CustomerRef: z.string(), | ||
ProfileID: z.string(), | ||
ProfileName: z.string(), | ||
ProfileVersion: z.number()["int"](), | ||
ProfileRevision: z.number()["int"](), | ||
ProfileState: z.string(), | ||
AuthenticationID: z.string().optional(), | ||
Timestamp: z.string().optional(), | ||
CustomerRef: z.string().optional(), | ||
ProfileID: z.string().optional(), | ||
ProfileName: z.string().optional(), | ||
ProfileVersion: z.number()["int"]().optional(), | ||
ProfileRevision: z.number()["int"]().optional(), | ||
ProfileState: z.string().optional(), | ||
ResultCodes: z.object({ | ||
GlobalItemCheckResultCodes: z.array(z.object({ | ||
Name: z.string(), | ||
Description: z.string(), | ||
Name: z.string().optional(), | ||
Description: z.string().optional(), | ||
Comment: z.record(z.any()).optional(), | ||
Match: z.record(z.any()).optional(), | ||
Warning: z.record(z.any()).optional(), | ||
ID: z.number()["int"](), | ||
Pass: z.string(), | ||
Address: z.string(), | ||
Forename: z.string(), | ||
Surname: z.string(), | ||
DOB: z.string(), | ||
Alert: z.string(), | ||
ID: z.number()["int"]().optional(), | ||
Pass: z.string().optional(), | ||
Address: z.string().optional(), | ||
Forename: z.string().optional(), | ||
Surname: z.string().optional(), | ||
DOB: z.string().optional(), | ||
Alert: z.string().optional(), | ||
SanctionsMatches: z.union([z.record(z.any()), z.string()]).optional() | ||
})) | ||
}).strict(), | ||
Score: z.number()["int"](), | ||
BandText: z.string(), | ||
Country: z.string() | ||
}), | ||
})).optional() | ||
}).strict().optional(), | ||
Score: z.number()["int"]().optional(), | ||
BandText: z.string().optional(), | ||
Country: z.string().optional() | ||
}).optional(), | ||
pepIntelligenceResult: z.array(z.object({ | ||
Fullname: z.string(), | ||
Fullname: z.string().optional(), | ||
Aliases: z.object({ | ||
"a:string": z.array(z.string()) | ||
}), | ||
"a:string": z.array(z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: z.object({ | ||
GlobalSanctionsAddress: z.array(z.object({ | ||
AddressLine: z.string(), | ||
City: z.string(), | ||
Country: z.string(), | ||
Region: z.string() | ||
})) | ||
}), | ||
AddressLine: z.string().optional(), | ||
City: z.string().optional(), | ||
Country: z.string().optional(), | ||
Region: z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: z.object({ | ||
GlobalSanctionsDate: z.object({ | ||
DateType: z.string(), | ||
DateType: z.string().optional(), | ||
Day: z.number()["int"]().optional(), | ||
Month: z.number()["int"]().optional(), | ||
Year: z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: z.string(), | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: z.string().optional(), | ||
SanctionsPositions: z.object({ | ||
GlobalSanctionsPosition: z.array(z.object({ | ||
Position: z.string(), | ||
Country: z.string() | ||
})) | ||
}) | ||
})), | ||
Position: z.string().optional(), | ||
Country: z.string().optional() | ||
})).optional() | ||
}).optional() | ||
})).optional(), | ||
sanctionsEnforcementsResult: z.array(z.object({ | ||
Fullname: z.string(), | ||
Fullname: z.string().optional(), | ||
SanctionsBodies: z.object({ | ||
"a:string": z.array(z.number()["int"]()) | ||
}), | ||
"a:string": z.array(z.number()["int"]()).optional() | ||
}).optional(), | ||
Aliases: z.object({ | ||
"a:string": z.array(z.string()) | ||
}), | ||
"a:string": z.array(z.string()).optional() | ||
}).optional(), | ||
SanctionsAddresses: z.object({ | ||
GlobalSanctionsAddress: z.array(z.object({ | ||
AddressLine: z.string(), | ||
City: z.string(), | ||
Country: z.string(), | ||
Region: z.string() | ||
})) | ||
}), | ||
AddressLine: z.string().optional(), | ||
City: z.string().optional(), | ||
Country: z.string().optional(), | ||
Region: z.string().optional() | ||
})).optional() | ||
}).optional(), | ||
SanctionsDates: z.object({ | ||
GlobalSanctionsDate: z.object({ | ||
DateType: z.string(), | ||
DateType: z.string().optional(), | ||
Day: z.number()["int"]().optional(), | ||
Month: z.number()["int"]().optional(), | ||
Year: z.number()["int"]().optional() | ||
}) | ||
}), | ||
IdentityInformation: z.string() | ||
})) | ||
}).optional() | ||
}).optional(), | ||
IdentityInformation: z.string().optional() | ||
})).optional() | ||
}).strict(), | ||
personalDetails: z.object({ | ||
citizenship: z.string(), | ||
documentType: z.string(), | ||
firstName: z.string(), | ||
lastName: z.string(), | ||
gender: z.string(), | ||
addressLine1: z.union([z.string(), z["null"]()]).optional(), | ||
addressLine2: z.union([z.string(), z["null"]()]).optional(), | ||
birthday: z.string(), | ||
placeOfBirth: z.string(), | ||
countryOfResidence: z.string(), | ||
age: z.string(), | ||
citizenship: z.string().optional(), | ||
documentType: z.string().optional(), | ||
firstName: z.string().optional(), | ||
lastName: z.string().optional(), | ||
gender: z.string().optional(), | ||
addressLine1: z.string().nullable().optional(), | ||
addressLine2: z.string().nullable().optional(), | ||
birthday: z.string().optional(), | ||
placeOfBirth: z.string().optional(), | ||
countryOfResidence: z.string().optional(), | ||
age: z.string().optional(), | ||
city: z.string().optional(), | ||
@@ -349,3 +359,3 @@ province: z.string().optional(), | ||
var CredentialTypes = ["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypes = ["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]; | ||
var CredentialTypesSchema = z.string().transform(function (x) { | ||
@@ -361,3 +371,32 @@ return x.replace("_", "-"); | ||
}).catchall(z.any()); | ||
var CredentialZodSchemas = z.union([IDScanCredentialSubjectSchema, ID3_6CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
var CredentialZodSchemas = z.union([IDScanCredentialSubjectSchema, ID3_7CredentialSubjectSchema, ProofOfResidenceV6CredentialSubjectSchema, IDScanSelfieV1CredentialSubjectSchema, IDScanPassportV1CredentialSubjectSchema, IDScanV2CredentialSubjectSchema]); | ||
/** | ||
* Recursively remove empty strings from object | ||
* @param obj | ||
*/ | ||
function removeEmptyStringAttributes(obj) { | ||
if (_typeof(obj) !== "object" || obj === null) { | ||
return obj; | ||
} | ||
for (var key in obj) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (obj[key] === "") { | ||
// remove key if value is empty string | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
delete obj[key]; | ||
} else { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (_typeof(obj[key]) === "object") { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
obj[key] = removeEmptyStringAttributes(obj[key]); | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
var CredentialSchemas = { | ||
@@ -368,5 +407,5 @@ IDScan: { | ||
}, | ||
"ID3-v6": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v6/id3.json", | ||
zod: ID3_6CredentialSubjectSchema | ||
"ID3-v7": { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v7/id3.json", | ||
zod: ID3_7CredentialSubjectSchema | ||
}, | ||
@@ -387,3 +426,6 @@ ProofOfResidenceV6: { | ||
url: "https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/idscan/v2/idscan.json", | ||
zod: IDScanV2CredentialSubjectSchema | ||
// check attributes for emptry strings and convert to null | ||
zod: IDScanV2CredentialSubjectSchema.transform(function (obj) { | ||
return removeEmptyStringAttributes(obj); | ||
}) | ||
} | ||
@@ -390,0 +432,0 @@ }; |
@@ -83,6 +83,6 @@ import { z } from "zod"; | ||
id: z.ZodString; | ||
requiredCredential: z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>; | ||
requiredCredential: z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
requiredCredential: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
requiredCredential: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
}, { | ||
@@ -96,3 +96,3 @@ id: string; | ||
id: string; | ||
requiredCredential: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
requiredCredential: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
}[] | undefined; | ||
@@ -112,3 +112,3 @@ }, { | ||
id: string; | ||
requiredCredential: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
requiredCredential: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
}[] | undefined; | ||
@@ -163,3 +163,3 @@ } | undefined; | ||
id: string; | ||
requiredCredential: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
requiredCredential: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
}[] | undefined; | ||
@@ -216,3 +216,3 @@ } | undefined; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -227,3 +227,3 @@ journeyId: z.ZodString; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -238,3 +238,3 @@ journeyId: z.ZodString; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -251,3 +251,3 @@ journeyId: z.ZodString; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -262,3 +262,3 @@ journeyId: z.ZodString; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -273,3 +273,3 @@ journeyId: z.ZodString; | ||
issuer: z.ZodString; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
type: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>>]>, "many">; | ||
credentialSubject: z.ZodObject<{ | ||
@@ -276,0 +276,0 @@ journeyId: z.ZodString; |
@@ -42,3 +42,3 @@ import { z } from "zod"; | ||
journeyId: z.ZodOptional<z.ZodString>; | ||
type: z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>; | ||
type: z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>; | ||
datetime: z.ZodDate; | ||
@@ -63,3 +63,3 @@ credential: z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -77,3 +77,3 @@ datetime: Date; | ||
}, { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -97,3 +97,3 @@ datetime: Date; | ||
journeyId: z.ZodOptional<z.ZodString>; | ||
type: z.ZodEnum<["IDScan", "ID3-v6", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>; | ||
type: z.ZodEnum<["IDScan", "ID3-v7", "ProofOfResidenceV6", "IDScanSelfieV1", "IDScanPassportV1", "IDScanV2"]>; | ||
datetime: z.ZodDate; | ||
@@ -118,3 +118,3 @@ credential: z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -132,3 +132,3 @@ datetime: Date; | ||
}, { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -167,3 +167,3 @@ datetime: Date; | ||
vcs: { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -190,3 +190,3 @@ datetime: Date; | ||
vcs: { | ||
type: "IDScan" | "ID3-v6" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
type: "IDScan" | "ID3-v7" | "ProofOfResidenceV6" | "IDScanSelfieV1" | "IDScanPassportV1" | "IDScanV2"; | ||
did: string; | ||
@@ -193,0 +193,0 @@ datetime: Date; |
{ | ||
"name": "@nexeraprotocol/nexera-id-schemas", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "", | ||
@@ -18,4 +18,4 @@ "main": "dist/nexeraprotocol-nexera-id-schemas.cjs.js", | ||
"generate-zod:IDScanV2": "cat schemas/IDScanV2.json | jq '.properties.credentialSubject' > schemas/IDScanV2-credentialSubject.json && json-schema-to-zod -s ./schemas/IDScanV2-credentialSubject.json -t ./src/compliance/vc-schemas/IDScanV2CredentialSubjectSchema.ts --name IDScanV2CredentialSubjectSchema", | ||
"download-schema:ID3_6": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v6/id3.json -o ./schemas/ID3_6.json", | ||
"generate-zod:ID3_6": "cat schemas/ID3_6.json | jq '.properties.credentialSubject' > schemas/ID3_6-credentialSubject.json && json-schema-to-zod -s ./schemas/ID3_6-credentialSubject.json -t ./src/compliance/vc-schemas/ID3_6CredentialSubjectSchema.ts --name ID3_6CredentialSubjectSchema", | ||
"download-schema:ID3_7": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v7/id3.json -o ./schemas/ID3_7.json", | ||
"generate-zod:ID3_7": "cat schemas/ID3_7.json | jq '.properties.credentialSubject' > schemas/ID3_7-credentialSubject.json && json-schema-to-zod -s ./schemas/ID3_7-credentialSubject.json -t ./src/compliance/vc-schemas/ID3_7CredentialSubjectSchema.ts --name ID3_7CredentialSubjectSchema", | ||
"download-schema:ProofOfResidenceV6": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/proofOfResidence/v6/proofOfResidence.json -o ./schemas/ProofOfResidenceV6.json", | ||
@@ -22,0 +22,0 @@ "generate-zod:ProofOfResidenceV6": "cat schemas/ProofOfResidenceV6.json | jq '.properties.credentialSubject' > schemas/ProofOfResidenceV6-credentialSubject.json && json-schema-to-zod -s ./schemas/ProofOfResidenceV6-credentialSubject.json -t ./src/compliance/vc-schemas/ProofOfResidenceV6CredentialSubjectSchema.ts --name ProofOfResidenceV6CredentialSubjectSchema", |
{ | ||
"name": "@nexeraprotocol/nexera-id-schemas", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "", | ||
@@ -42,4 +42,4 @@ "main": "dist/nexeraprotocol-nexera-id-schemas.cjs.js", | ||
"generate-zod:IDScanV2": "cat schemas/IDScanV2.json | jq '.properties.credentialSubject' > schemas/IDScanV2-credentialSubject.json && json-schema-to-zod -s ./schemas/IDScanV2-credentialSubject.json -t ./src/compliance/vc-schemas/IDScanV2CredentialSubjectSchema.ts --name IDScanV2CredentialSubjectSchema", | ||
"download-schema:ID3_6": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v6/id3.json -o ./schemas/ID3_6.json", | ||
"generate-zod:ID3_6": "cat schemas/ID3_6.json | jq '.properties.credentialSubject' > schemas/ID3_6-credentialSubject.json && json-schema-to-zod -s ./schemas/ID3_6-credentialSubject.json -t ./src/compliance/vc-schemas/ID3_6CredentialSubjectSchema.ts --name ID3_6CredentialSubjectSchema", | ||
"download-schema:ID3_7": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/id3/v7/id3.json -o ./schemas/ID3_7.json", | ||
"generate-zod:ID3_7": "cat schemas/ID3_7.json | jq '.properties.credentialSubject' > schemas/ID3_7-credentialSubject.json && json-schema-to-zod -s ./schemas/ID3_7-credentialSubject.json -t ./src/compliance/vc-schemas/ID3_7CredentialSubjectSchema.ts --name ID3_7CredentialSubjectSchema", | ||
"download-schema:ProofOfResidenceV6": "curl https://raw.githubusercontent.com/NexeraProtocol/vc-schemas/main/examples/proofOfResidence/v6/proofOfResidence.json -o ./schemas/ProofOfResidenceV6.json", | ||
@@ -46,0 +46,0 @@ "generate-zod:ProofOfResidenceV6": "cat schemas/ProofOfResidenceV6.json | jq '.properties.credentialSubject' > schemas/ProofOfResidenceV6-credentialSubject.json && json-schema-to-zod -s ./schemas/ProofOfResidenceV6-credentialSubject.json -t ./src/compliance/vc-schemas/ProofOfResidenceV6CredentialSubjectSchema.ts --name ProofOfResidenceV6CredentialSubjectSchema", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
575042
12827