@ballerine/common
Advanced tools
Comparing version 0.7.29 to 0.7.30
@@ -62,2 +62,3 @@ /** | ||
exports.getGhanaDocuments = GH.getGhanaDocuments; | ||
exports.findDocumentSchemaByTypeAndCategory = index.findDocumentSchemaByTypeAndCategory; | ||
exports.getDocumentId = index.getDocumentId; | ||
@@ -64,0 +65,0 @@ exports.getDocumentSchemaByCountry = index.getDocumentSchemaByCountry; |
@@ -15,6 +15,6 @@ /** | ||
var UG = require('./UG.js'); | ||
var CA = require('./CA.js'); | ||
var GH = require('./GH.js'); | ||
var CA = require('./CA.js'); | ||
var ZZ = require('./ZZ.js'); | ||
var UG = require('./UG.js'); | ||
@@ -48,3 +48,17 @@ var documentIdsByCountry = { | ||
}; | ||
var findDocumentSchemaByTypeAndCategory = function findDocumentSchemaByTypeAndCategory(type, category) { | ||
var documentGetters = Object.values(documentIdsByCountry); | ||
for (var _i = 0, _documentGetters = documentGetters; _i < _documentGetters.length; _i++) { | ||
var getDocuments = _documentGetters[_i]; | ||
var documents = getDocuments(); | ||
var document = documents.find(function (doc) { | ||
return doc.type === type && doc.category === category; | ||
}); | ||
if (!document) continue; | ||
return document; | ||
} | ||
return null; | ||
}; | ||
exports.findDocumentSchemaByTypeAndCategory = findDocumentSchemaByTypeAndCategory; | ||
exports.getDocumentId = getDocumentId; | ||
@@ -51,0 +65,0 @@ exports.getDocumentSchemaByCountry = getDocumentSchemaByCountry; |
@@ -175,2 +175,67 @@ /** | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'passport', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: typebox.Type.Object({ | ||
documentNumber: typebox.Type.Optional(typebox.Type.String()), | ||
firstName: typebox.Type.Optional(typebox.Type.String()), | ||
lastName: typebox.Type.Optional(typebox.Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'national_id', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: typebox.Type.Object({ | ||
documentNumber: typebox.Type.Optional(typebox.Type.String()), | ||
firstName: typebox.Type.Optional(typebox.Type.String()), | ||
lastName: typebox.Type.Optional(typebox.Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'driver_licence', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: typebox.Type.Object({ | ||
documentNumber: typebox.Type.Optional(typebox.Type.String()), | ||
firstName: typebox.Type.Optional(typebox.Type.String()), | ||
lastName: typebox.Type.Optional(typebox.Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'resident_card', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: typebox.Type.Object({ | ||
documentNumber: typebox.Type.Optional(typebox.Type.String()), | ||
firstName: typebox.Type.Optional(typebox.Type.String()), | ||
lastName: typebox.Type.Optional(typebox.Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity_ownership', | ||
type: 'selfie', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: typebox.Type.Object({ | ||
documentNumber: typebox.Type.Optional(typebox.Type.String()), | ||
firstName: typebox.Type.Optional(typebox.Type.String()), | ||
lastName: typebox.Type.Optional(typebox.Type.String()) | ||
}) | ||
}]; | ||
@@ -177,0 +242,0 @@ }; |
@@ -32,4 +32,4 @@ /** | ||
export { getGhanaDocuments } from './schemas/documents/workflow/documents/schemas/GH.js'; | ||
export { getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry } from './schemas/documents/workflow/documents/schemas/index.js'; | ||
export { findDocumentSchemaByTypeAndCategory, getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry } from './schemas/documents/workflow/documents/schemas/index.js'; | ||
export { CommonWorkflowEvent, CommonWorkflowStates, StateTag, StateTags } from './consts/index.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,6 +11,6 @@ /** | ||
*/ | ||
import { getUgandaDocuments } from './UG.js'; | ||
import { getCanadaDocuments } from './CA.js'; | ||
import { getGhanaDocuments } from './GH.js'; | ||
import { getCanadaDocuments } from './CA.js'; | ||
import { getUniversalDocuments } from './ZZ.js'; | ||
import { getUgandaDocuments } from './UG.js'; | ||
@@ -44,4 +44,17 @@ var documentIdsByCountry = { | ||
}; | ||
var findDocumentSchemaByTypeAndCategory = function findDocumentSchemaByTypeAndCategory(type, category) { | ||
var documentGetters = Object.values(documentIdsByCountry); | ||
for (var _i = 0, _documentGetters = documentGetters; _i < _documentGetters.length; _i++) { | ||
var getDocuments = _documentGetters[_i]; | ||
var documents = getDocuments(); | ||
var document = documents.find(function (doc) { | ||
return doc.type === type && doc.category === category; | ||
}); | ||
if (!document) continue; | ||
return document; | ||
} | ||
return null; | ||
}; | ||
export { getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry }; | ||
export { findDocumentSchemaByTypeAndCategory, getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry }; | ||
//# sourceMappingURL=index.js.map |
@@ -171,2 +171,67 @@ /** | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'passport', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: Type.Object({ | ||
documentNumber: Type.Optional(Type.String()), | ||
firstName: Type.Optional(Type.String()), | ||
lastName: Type.Optional(Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'national_id', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: Type.Object({ | ||
documentNumber: Type.Optional(Type.String()), | ||
firstName: Type.Optional(Type.String()), | ||
lastName: Type.Optional(Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'driver_licence', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: Type.Object({ | ||
documentNumber: Type.Optional(Type.String()), | ||
firstName: Type.Optional(Type.String()), | ||
lastName: Type.Optional(Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity', | ||
type: 'resident_card', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: Type.Object({ | ||
documentNumber: Type.Optional(Type.String()), | ||
firstName: Type.Optional(Type.String()), | ||
lastName: Type.Optional(Type.String()) | ||
}) | ||
}, { | ||
category: 'proof_of_identity_ownership', | ||
type: 'selfie', | ||
issuer: { | ||
country: 'ZZ' | ||
}, | ||
issuingVersion: 1, | ||
version: 1, | ||
propertiesSchema: Type.Object({ | ||
documentNumber: Type.Optional(Type.String()), | ||
firstName: Type.Optional(Type.String()), | ||
lastName: Type.Optional(Type.String()) | ||
}) | ||
}]; | ||
@@ -173,0 +238,0 @@ }; |
@@ -209,2 +209,3 @@ /** | ||
declare const getDocumentId: (document: TDocument | DefaultContextSchema$1['documents'][number], useUuid?: boolean) => string; | ||
declare const findDocumentSchemaByTypeAndCategory: (type: string, category: string) => TDocument | null; | ||
@@ -239,2 +240,2 @@ declare const StateTag: { | ||
export { AnyRecord, CommonWorkflowEvent, CommonWorkflowStates, DefaultContextSchema, IErrorWithMessage, Serializable, StateTag, StateTags, TAvailableDocuments, TDefaultSchemaDocumentPage, TDocument, TStateTag, TStateTags, defaultContextSchema, dump, everyDocumentDecisionStatus, getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry, getGhanaDocuments, handlePromise, isEmptyObject, isErrorWithCode, isErrorWithMessage, isErrorWithName, isFunction, isNullish, isObject, log, noNullish, raise, safeEvery, sleep, someDocumentDecisionStatus, uniqueArray, zodErrorToReadable }; | ||
export { AnyRecord, CommonWorkflowEvent, CommonWorkflowStates, DefaultContextSchema, IErrorWithMessage, Serializable, StateTag, StateTags, TAvailableDocuments, TDefaultSchemaDocumentPage, TDocument, TStateTag, TStateTags, defaultContextSchema, dump, everyDocumentDecisionStatus, findDocumentSchemaByTypeAndCategory, getDocumentId, getDocumentSchemaByCountry, getDocumentsByCountry, getGhanaDocuments, handlePromise, isEmptyObject, isErrorWithCode, isErrorWithMessage, isErrorWithName, isFunction, isNullish, isObject, log, noNullish, raise, safeEvery, sleep, someDocumentDecisionStatus, uniqueArray, zodErrorToReadable }; |
@@ -5,3 +5,3 @@ { | ||
"author": "Ballerine <dev@ballerine.com>", | ||
"version": "0.7.29", | ||
"version": "0.7.30", | ||
"description": "common", | ||
@@ -28,4 +28,4 @@ "module": "./dist/esm/index.js", | ||
"@babel/preset-typescript": "7.16.7", | ||
"@ballerine/config": "^1.0.1", | ||
"@ballerine/eslint-config": "^1.0.0", | ||
"@ballerine/config": "^1.0.2", | ||
"@ballerine/eslint-config": "^1.0.2", | ||
"@cspell/cspell-types": "^6.31.1", | ||
@@ -32,0 +32,0 @@ "@rollup/plugin-babel": "5.3.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1301044
9709