New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ballerine/common

Package Overview
Dependencies
Maintainers
3
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ballerine/common - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

dist/cjs/schemas/documents/default-context-schema.js

2

./dist/cjs/index.js

@@ -27,2 +27,3 @@ /**

var zodErrorToReadable = require('./utils/zod-error-to-readable/zod-error-to-readable.js');
var defaultContextSchema = require('./schemas/documents/default-context-schema.js');
var GH = require('./schemas/documents/workflow/documents/schemas/GH.js');

@@ -45,2 +46,3 @@ var index = require('./schemas/documents/workflow/documents/schemas/index.js');

exports.zodErrorToReadable = zodErrorToReadable.zodErrorToReadable;
exports.defaultContextSchema = defaultContextSchema.defaultContextSchema;
exports.certificateOfResidenceGH = GH.certificateOfResidenceGH;

@@ -47,0 +49,0 @@ exports.ghanaDocuments = GH.ghanaDocuments;

2

./dist/umd/index.production.js

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WorkflowCore={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",p=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new G(n||[]);return i(s,"_invoke",{value:w(t,r,a)}),s}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=y;var g={};function f(){}function l(){}function d(){}var m={};u(m,s,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(S([])));v&&v!==r&&n.call(v,s)&&(m=v);var b=d.prototype=f.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(i,o,s,a){var p=c(t[i],t,o);if("throw"!==p.type){var u=p.arg,y=u.value;return y&&"object"==typeof y&&n.call(y,"__await")?e.resolve(y.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(y).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(p.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return L()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===g)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var p=c(t,e,r);if("normal"===p.type){if(n=r.done?"completed":"suspendedYield",p.arg===g)continue;return{value:p.arg,done:r.done}}"throw"===p.type&&(n="completed",r.method="throw",r.arg=p.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return l.prototype=d,i(b,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:l,configurable:!0}),l.displayName=u(d,p,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,p,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},_(N.prototype),u(N.prototype,a,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new N(y(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},_(b),u(b,p,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),p=n.call(o,"finallyLoc");if(a&&p){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),g}},t}function r(t,e,r,n,i,o,s){try{var a=t[o](s),p=a.value}catch(t){return void r(t)}a.done?e(p):Promise.resolve(p).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,p,"next",t)}function p(t){r(s,i,o,a,p,"throw",t)}a(void 0)}))}}var i=function(){var t=n(e().mark((function t(r){var n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:return n=t.sent,t.abrupt("return",[n,void 0]);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",[void 0,t.t0]);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),o=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},s=function(){var t=n(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){return setTimeout(t,r)})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a="^$|^GHA-\\d{9}-\\d{1}$",p="^[a-zA-Z0-9]*$",u={category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",city:"Accra",name:"Accra Metropolitan Assembly",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},y=[{category:"financial_information",type:"mtn_statement",issuer:{country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{accountNameHolder:{type:"string"},msisdn:{type:"string",pattern:"^233[0-9]{9}$"},from:{type:"string",format:"date"},to:{type:"string",format:"date"},timeRun:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"electricity_bill",issuer:{type:"local_authority",city:"Accra",name:"Electricity Company of Ghana",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"tenancy_agreement",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},rentalAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"payslip",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},salaryAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"appointment_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"bank_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"mortgage_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"property_rate",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"birth_certificate",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},birthPlace:{type:"string"},dateOfBirth:{type:"string",format:"date"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"ssnit_pension_statement",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"introductory_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_a",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_a",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_3",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_3",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_4",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_4",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}}],c={GH:y,CA:[{category:"incorporation",type:"pdf",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{businessName:{type:"string"},website:{type:"string"},phone:{type:"string"},email:{type:"string"},owner:{type:"string"},tin:{type:"string"}}}},{category:"id",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}},{category:"selfie",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}}]};t.certificateOfResidenceGH=u,t.getDocumentId=function(t,e){var r;if(void 0===e&&(e=!0),e&&null!=t&&t.id)return t.id;var n=(null==t?void 0:t.category)+"-"+(null==t?void 0:t.type)+"-"+(null==t||null==(r=t.issuer)?void 0:r.country);return t.version&&(n=n+"-v"+t.version),n.toLowerCase()},t.getDocumentsByCountry=function(t){return c[t]||[]},t.ghanaDocuments=y,t.handlePromise=i,t.isEmptyObject=function(t){return o(t)&&0===Object.keys(t).length},t.isErrorWithCode=function(t){return o(t)&&"code"in t&&"number"==typeof t.code},t.isErrorWithMessage=function(t){return o(t)&&"message"in t&&"string"==typeof t.message},t.isErrorWithName=function(t){return o(t)&&"name"in t&&"string"==typeof t.name},t.isFunction=function(t){return"function"==typeof t},t.isNullish=function(t){return null==t},t.isObject=o,t.noNullish=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return t.reduce((function(t,e,n){var i,o=null!=(i=r[n])?i:"";return t+e+String(o)}),"").replace(/\s+/g," ")},t.sleep=s,t.uniqueArray=function(t){return Array.from(new Set(t))},t.zodErrorToReadable=function(t){return t.issues.map((function(t){var e;return(null==(e=t.path)?void 0:e.join("."))+": "+t.message})).join("\n")},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WorkflowCore={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",p=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,s=Object.create(o.prototype),a=new S(n||[]);return i(s,"_invoke",{value:w(t,r,a)}),s}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=y;var g={};function d(){}function l(){}function m(){}var f={};u(f,s,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(O([])));v&&v!==r&&n.call(v,s)&&(f=v);var b=m.prototype=d.prototype=Object.create(f);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(i,o,s,a){var p=c(t[i],t,o);if("throw"!==p.type){var u=p.arg,y=u.value;return y&&"object"==typeof y&&n.call(y,"__await")?e.resolve(y.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(y).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(p.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===g)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var p=c(t,e,r);if("normal"===p.type){if(n=r.done?"completed":"suspendedYield",p.arg===g)continue;return{value:p.arg,done:r.done}}"throw"===p.type&&(n="completed",r.method="throw",r.arg=p.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=m,i(b,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:l,configurable:!0}),l.displayName=u(m,p,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,p,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},_(N.prototype),u(N.prototype,a,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new N(y(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},_(b),u(b,p,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),p=n.call(o,"finallyLoc");if(a&&p){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),g}},t}function r(t,e,r,n,i,o,s){try{var a=t[o](s),p=a.value}catch(t){return void r(t)}a.done?e(p):Promise.resolve(p).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,p,"next",t)}function p(t){r(s,i,o,a,p,"throw",t)}a(void 0)}))}}var i=function(){var t=n(e().mark((function t(r){var n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:return n=t.sent,t.abrupt("return",[n,void 0]);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",[void 0,t.t0]);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),o=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},s=function(){var t=n(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){return setTimeout(t,r)})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a="^$|^GHA-\\d{9}-\\d{1}$",p="^[a-zA-Z0-9]*$",u={category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",city:"Accra",name:"Accra Metropolitan Assembly",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},y=[{category:"financial_information",type:"mtn_statement",issuer:{country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{accountNameHolder:{type:"string"},msisdn:{type:"string",pattern:"^233[0-9]{9}$"},from:{type:"string",format:"date"},to:{type:"string",format:"date"},timeRun:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"electricity_bill",issuer:{type:"local_authority",city:"Accra",name:"Electricity Company of Ghana",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"tenancy_agreement",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},rentalAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"payslip",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},salaryAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"appointment_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"bank_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"mortgage_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"property_rate",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"birth_certificate",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},birthPlace:{type:"string"},dateOfBirth:{type:"string",format:"date"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"ssnit_pension_statement",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"introductory_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_a",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_a",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_3",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_3",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_4",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_4",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}}],c={GH:y,CA:[{category:"incorporation",type:"pdf",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{businessName:{type:"string"},website:{type:"string"},phone:{type:"string"},email:{type:"string"},owner:{type:"string"},tin:{type:"string"}}}},{category:"id",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}},{category:"selfie",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}}]};t.certificateOfResidenceGH=u,t.defaultContextSchema={$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{entity:{type:"object",properties:{type:{enum:["individual","business"]},data:{type:"object",properties:{additionalInfo:{type:"object"}},additionalProperties:!0},ballerineEntityId:{type:"string"},id:{type:"string"}},required:["type"],anyOf:[{required:["id"]},{required:["ballerineEntityId"]}],additionalProperties:!1},documents:{type:"array",items:{type:"object",properties:{id:{type:"string"},category:{type:"string",transform:["trim","toLowerCase"]},type:{type:"string",transform:["trim","toLowerCase"]},issuer:{type:"object",properties:{type:{type:"string"},name:{type:"string"},country:{type:"string",transform:["trim","toUpperCase"]},city:{type:"string"},additionalInfo:{type:"object"}},required:["country"],additionalProperties:!1},issuingVersion:{type:"integer"},decision:{type:"object",properties:{status:{type:"string",enum:["new","pending","revision","approved","rejected"]},rejectionReason:{anyOf:[{type:"string"},{type:"string",enum:["Suspicious document","Document does not match customer profile","Potential identity theft","Fake or altered document","Document on watchlist or blacklist"]}]},revisionReason:{anyOf:[{type:"string"},{type:"string",enum:["Wrong document","Fake document","Spam","Ownership mismatch - Name","Ownership mismatch - National ID","Unknown document type","Bad image quality","Missing page","Invalid document","Expired document","Unreadable document","Blurry image","Other"]}]}},additionalProperties:!1},version:{type:"integer"},pages:{type:"array",items:{type:"object",properties:{ballerineFileId:{type:"string"},provider:{type:"string",enum:["gcs","http","stream","base64","ftp"]},uri:{type:"string",format:"uri"},type:{enum:["pdf","png","jpg"]},data:{type:"string"},metadata:{type:"object",properties:{side:{type:"string"},pageNumber:{type:"string"}},additionalProperties:!1}},required:["provider","uri","type"],additionalProperties:!1}},properties:{type:"object",properties:{email:{type:"string",format:"email"},expiryDate:{type:"string",format:"date"},idNumber:{type:"string",format:"regex"}}}},required:["category","type","issuer","pages","properties"],additionalProperties:!1}}},required:["entity","documents"]},t.getDocumentId=function(t,e){var r;if(void 0===e&&(e=!0),e&&null!=t&&t.id)return t.id;var n=(null==t?void 0:t.category)+"-"+(null==t?void 0:t.type)+"-"+(null==t||null==(r=t.issuer)?void 0:r.country);return t.version&&(n=n+"-v"+t.version),n.toLowerCase()},t.getDocumentsByCountry=function(t){return c[t]||[]},t.ghanaDocuments=y,t.handlePromise=i,t.isEmptyObject=function(t){return o(t)&&0===Object.keys(t).length},t.isErrorWithCode=function(t){return o(t)&&"code"in t&&"number"==typeof t.code},t.isErrorWithMessage=function(t){return o(t)&&"message"in t&&"string"==typeof t.message},t.isErrorWithName=function(t){return o(t)&&"name"in t&&"string"==typeof t.name},t.isFunction=function(t){return"function"==typeof t},t.isNullish=function(t){return null==t},t.isObject=o,t.noNullish=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return t.reduce((function(t,e,n){var i,o=null!=(i=r[n])?i:"";return t+e+String(o)}),"").replace(/\s+/g," ")},t.sleep=s,t.uniqueArray=function(t){return Array.from(new Set(t))},t.zodErrorToReadable=function(t){return t.issues.map((function(t){var e;return(null==(e=t.path)?void 0:e.join("."))+": "+t.message})).join("\n")},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map

@@ -27,2 +27,3 @@ /**

var zodErrorToReadable = require('./utils/zod-error-to-readable/zod-error-to-readable.js');
var defaultContextSchema = require('./schemas/documents/default-context-schema.js');
var GH = require('./schemas/documents/workflow/documents/schemas/GH.js');

@@ -45,2 +46,3 @@ var index = require('./schemas/documents/workflow/documents/schemas/index.js');

exports.zodErrorToReadable = zodErrorToReadable.zodErrorToReadable;
exports.defaultContextSchema = defaultContextSchema.defaultContextSchema;
exports.certificateOfResidenceGH = GH.certificateOfResidenceGH;

@@ -47,0 +49,0 @@ exports.ghanaDocuments = GH.ghanaDocuments;

@@ -23,4 +23,5 @@ /**

export { zodErrorToReadable } from './utils/zod-error-to-readable/zod-error-to-readable.js';
export { defaultContextSchema } from './schemas/documents/default-context-schema.js';
export { certificateOfResidenceGH, ghanaDocuments } from './schemas/documents/workflow/documents/schemas/GH.js';
export { getDocumentId, getDocumentsByCountry } from './schemas/documents/workflow/documents/schemas/index.js';
//# sourceMappingURL=index.js.map

@@ -108,2 +108,172 @@ /**

declare const defaultContextSchema: {
$schema: string;
type: string;
properties: {
entity: {
type: string;
properties: {
type: {
enum: string[];
};
data: {
type: string;
properties: {
additionalInfo: {
type: string;
};
};
additionalProperties: boolean;
};
ballerineEntityId: {
type: string;
};
id: {
type: string;
};
};
required: string[];
anyOf: {
required: string[];
}[];
additionalProperties: boolean;
};
documents: {
type: string;
items: {
type: string;
properties: {
id: {
type: string;
};
category: {
type: string;
transform: string[];
};
type: {
type: string;
transform: string[];
};
issuer: {
type: string;
properties: {
type: {
type: string;
};
name: {
type: string;
};
country: {
type: string;
transform: string[];
};
city: {
type: string;
};
additionalInfo: {
type: string;
};
};
required: string[];
additionalProperties: boolean;
};
issuingVersion: {
type: string;
};
decision: {
type: string;
properties: {
status: {
type: string;
enum: string[];
};
rejectionReason: {
anyOf: ({
type: string;
enum?: undefined;
} | {
type: string;
enum: string[];
})[];
};
revisionReason: {
anyOf: ({
type: string;
enum?: undefined;
} | {
type: string;
enum: string[];
})[];
};
};
additionalProperties: boolean;
};
version: {
type: string;
};
pages: {
type: string;
items: {
type: string;
properties: {
ballerineFileId: {
type: string;
};
provider: {
type: string;
enum: string[];
};
uri: {
type: string;
format: string;
};
type: {
enum: string[];
};
data: {
type: string;
};
metadata: {
type: string;
properties: {
side: {
type: string;
};
pageNumber: {
type: string;
};
};
additionalProperties: boolean;
};
};
required: string[];
additionalProperties: boolean;
};
};
properties: {
type: string;
properties: {
email: {
type: string;
format: string;
};
expiryDate: {
type: string;
format: string;
};
idNumber: {
type: string;
format: string;
};
};
};
};
required: string[];
additionalProperties: boolean;
};
};
};
required: string[];
};
type TDocument = Omit<DefaultContextSchema['documents'][number], 'pages' | 'properties'> & {

@@ -119,2 +289,2 @@ propertiesSchema: any;

export { AnyRecord, DefaultContextSchema, IErrorWithMessage, TDefaultSchemaDocumentPage, TDocument, certificateOfResidenceGH, getDocumentId, getDocumentsByCountry, ghanaDocuments, handlePromise, isEmptyObject, isErrorWithCode, isErrorWithMessage, isErrorWithName, isFunction, isNullish, isObject, noNullish, sleep, uniqueArray, zodErrorToReadable };
export { AnyRecord, DefaultContextSchema, IErrorWithMessage, TDefaultSchemaDocumentPage, TDocument, certificateOfResidenceGH, defaultContextSchema, getDocumentId, getDocumentsByCountry, ghanaDocuments, handlePromise, isEmptyObject, isErrorWithCode, isErrorWithMessage, isErrorWithName, isFunction, isNullish, isObject, noNullish, sleep, uniqueArray, zodErrorToReadable };

@@ -451,2 +451,172 @@ /**

var defaultContextSchema = {
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: {
entity: {
type: 'object',
properties: {
type: {
"enum": ['individual', 'business']
},
data: {
type: 'object',
properties: {
additionalInfo: {
type: 'object'
}
},
additionalProperties: true
},
ballerineEntityId: {
type: 'string'
},
id: {
type: 'string'
}
},
required: ['type'],
anyOf: [{
required: ['id']
}, {
required: ['ballerineEntityId']
}],
additionalProperties: false
},
documents: {
type: 'array',
items: {
type: 'object',
properties: {
id: {
type: 'string'
},
category: {
type: 'string',
transform: ['trim', 'toLowerCase']
},
type: {
type: 'string',
transform: ['trim', 'toLowerCase']
},
issuer: {
type: 'object',
properties: {
type: {
type: 'string'
},
name: {
type: 'string'
},
country: {
type: 'string',
transform: ['trim', 'toUpperCase']
},
city: {
type: 'string'
},
additionalInfo: {
type: 'object'
}
},
required: ['country'],
additionalProperties: false
},
issuingVersion: {
type: 'integer'
},
decision: {
type: 'object',
properties: {
status: {
type: 'string',
"enum": ['new', 'pending', 'revision', 'approved', 'rejected']
},
rejectionReason: {
anyOf: [{
type: 'string'
}, {
type: 'string',
"enum": ['Suspicious document', 'Document does not match customer profile', 'Potential identity theft', 'Fake or altered document', 'Document on watchlist or blacklist']
}]
},
revisionReason: {
anyOf: [{
type: 'string'
}, {
type: 'string',
"enum": ['Wrong document', 'Fake document', 'Spam', 'Ownership mismatch - Name', 'Ownership mismatch - National ID', 'Unknown document type', 'Bad image quality', 'Missing page', 'Invalid document', 'Expired document', 'Unreadable document', 'Blurry image', 'Other']
}]
}
},
additionalProperties: false
},
version: {
type: 'integer'
},
pages: {
type: 'array',
items: {
type: 'object',
properties: {
ballerineFileId: {
type: 'string'
},
provider: {
type: 'string',
"enum": ['gcs', 'http', 'stream', 'base64', 'ftp']
},
uri: {
type: 'string',
format: 'uri'
},
type: {
"enum": ['pdf', 'png', 'jpg']
},
data: {
type: 'string'
},
metadata: {
type: 'object',
properties: {
side: {
type: 'string'
},
pageNumber: {
type: 'string'
}
},
additionalProperties: false
}
},
required: ['provider', 'uri', 'type'],
additionalProperties: false
}
},
properties: {
type: 'object',
properties: {
email: {
type: 'string',
format: 'email'
},
expiryDate: {
type: 'string',
format: 'date'
},
idNumber: {
type: 'string',
format: 'regex'
}
}
}
},
required: ['category', 'type', 'issuer', 'pages', 'properties'],
additionalProperties: false
}
}
},
required: ['entity', 'documents']
};
var ghNationalIdNumber = '^$|^GHA-\\d{9}-\\d{1}$';

@@ -1243,2 +1413,3 @@ var alphaNumeric = '^[a-zA-Z0-9]*$';

exports.certificateOfResidenceGH = certificateOfResidenceGH;
exports.defaultContextSchema = defaultContextSchema;
exports.getDocumentId = getDocumentId;

@@ -1245,0 +1416,0 @@ exports.getDocumentsByCountry = getDocumentsByCountry;

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WorkflowCore={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",p=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new G(n||[]);return i(s,"_invoke",{value:w(t,r,a)}),s}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=y;var g={};function f(){}function l(){}function d(){}var m={};u(m,s,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(S([])));v&&v!==r&&n.call(v,s)&&(m=v);var b=d.prototype=f.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(i,o,s,a){var p=c(t[i],t,o);if("throw"!==p.type){var u=p.arg,y=u.value;return y&&"object"==typeof y&&n.call(y,"__await")?e.resolve(y.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(y).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(p.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return L()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===g)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var p=c(t,e,r);if("normal"===p.type){if(n=r.done?"completed":"suspendedYield",p.arg===g)continue;return{value:p.arg,done:r.done}}"throw"===p.type&&(n="completed",r.method="throw",r.arg=p.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return l.prototype=d,i(b,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:l,configurable:!0}),l.displayName=u(d,p,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,p,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},_(N.prototype),u(N.prototype,a,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new N(y(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},_(b),u(b,p,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),p=n.call(o,"finallyLoc");if(a&&p){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),g}},t}function r(t,e,r,n,i,o,s){try{var a=t[o](s),p=a.value}catch(t){return void r(t)}a.done?e(p):Promise.resolve(p).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,p,"next",t)}function p(t){r(s,i,o,a,p,"throw",t)}a(void 0)}))}}var i=function(){var t=n(e().mark((function t(r){var n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:return n=t.sent,t.abrupt("return",[n,void 0]);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",[void 0,t.t0]);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),o=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},s=function(){var t=n(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){return setTimeout(t,r)})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a="^$|^GHA-\\d{9}-\\d{1}$",p="^[a-zA-Z0-9]*$",u={category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",city:"Accra",name:"Accra Metropolitan Assembly",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},y=[{category:"financial_information",type:"mtn_statement",issuer:{country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{accountNameHolder:{type:"string"},msisdn:{type:"string",pattern:"^233[0-9]{9}$"},from:{type:"string",format:"date"},to:{type:"string",format:"date"},timeRun:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"electricity_bill",issuer:{type:"local_authority",city:"Accra",name:"Electricity Company of Ghana",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"tenancy_agreement",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},rentalAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"payslip",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},salaryAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"appointment_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"bank_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"mortgage_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"property_rate",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"birth_certificate",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},birthPlace:{type:"string"},dateOfBirth:{type:"string",format:"date"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"ssnit_pension_statement",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"introductory_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_a",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_a",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_3",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_3",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_4",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_4",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}}],c={GH:y,CA:[{category:"incorporation",type:"pdf",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{businessName:{type:"string"},website:{type:"string"},phone:{type:"string"},email:{type:"string"},owner:{type:"string"},tin:{type:"string"}}}},{category:"id",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}},{category:"selfie",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}}]};t.certificateOfResidenceGH=u,t.getDocumentId=function(t,e){var r;if(void 0===e&&(e=!0),e&&null!=t&&t.id)return t.id;var n=(null==t?void 0:t.category)+"-"+(null==t?void 0:t.type)+"-"+(null==t||null==(r=t.issuer)?void 0:r.country);return t.version&&(n=n+"-v"+t.version),n.toLowerCase()},t.getDocumentsByCountry=function(t){return c[t]||[]},t.ghanaDocuments=y,t.handlePromise=i,t.isEmptyObject=function(t){return o(t)&&0===Object.keys(t).length},t.isErrorWithCode=function(t){return o(t)&&"code"in t&&"number"==typeof t.code},t.isErrorWithMessage=function(t){return o(t)&&"message"in t&&"string"==typeof t.message},t.isErrorWithName=function(t){return o(t)&&"name"in t&&"string"==typeof t.name},t.isFunction=function(t){return"function"==typeof t},t.isNullish=function(t){return null==t},t.isObject=o,t.noNullish=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return t.reduce((function(t,e,n){var i,o=null!=(i=r[n])?i:"";return t+e+String(o)}),"").replace(/\s+/g," ")},t.sleep=s,t.uniqueArray=function(t){return Array.from(new Set(t))},t.zodErrorToReadable=function(t){return t.issues.map((function(t){var e;return(null==(e=t.path)?void 0:e.join("."))+": "+t.message})).join("\n")},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WorkflowCore={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",p=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,s=Object.create(o.prototype),a=new S(n||[]);return i(s,"_invoke",{value:w(t,r,a)}),s}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=y;var g={};function d(){}function l(){}function m(){}var f={};u(f,s,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(O([])));v&&v!==r&&n.call(v,s)&&(f=v);var b=m.prototype=d.prototype=Object.create(f);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(i,o,s,a){var p=c(t[i],t,o);if("throw"!==p.type){var u=p.arg,y=u.value;return y&&"object"==typeof y&&n.call(y,"__await")?e.resolve(y.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(y).then((function(t){u.value=t,s(u)}),(function(t){return r("throw",t,s,a)}))}a(p.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===g)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var p=c(t,e,r);if("normal"===p.type){if(n=r.done?"completed":"suspendedYield",p.arg===g)continue;return{value:p.arg,done:r.done}}"throw"===p.type&&(n="completed",r.method="throw",r.arg=p.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=m,i(b,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:l,configurable:!0}),l.displayName=u(m,p,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,p,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},_(N.prototype),u(N.prototype,a,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new N(y(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},_(b),u(b,p,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),p=n.call(o,"finallyLoc");if(a&&p){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),g}},t}function r(t,e,r,n,i,o,s){try{var a=t[o](s),p=a.value}catch(t){return void r(t)}a.done?e(p):Promise.resolve(p).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,p,"next",t)}function p(t){r(s,i,o,a,p,"throw",t)}a(void 0)}))}}var i=function(){var t=n(e().mark((function t(r){var n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r;case 3:return n=t.sent,t.abrupt("return",[n,void 0]);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",[void 0,t.t0]);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),o=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},s=function(){var t=n(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){return setTimeout(t,r)})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a="^$|^GHA-\\d{9}-\\d{1}$",p="^[a-zA-Z0-9]*$",u={category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",city:"Accra",name:"Accra Metropolitan Assembly",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},y=[{category:"financial_information",type:"mtn_statement",issuer:{country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{accountNameHolder:{type:"string"},msisdn:{type:"string",pattern:"^233[0-9]{9}$"},from:{type:"string",format:"date"},to:{type:"string",format:"date"},timeRun:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"water_bill",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"electricity_bill",issuer:{type:"local_authority",city:"Accra",name:"Electricity Company of Ghana",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},amountDue:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"tenancy_agreement",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},rentalAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"payslip",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},salaryAmount:{type:"number"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"appointment_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"bank_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"mortgage_statement",issuer:{type:"bank",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"property_rate",issuer:{type:"local_authority",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"birth_certificate",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},birthPlace:{type:"string"},dateOfBirth:{type:"string",format:"date"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"ssnit_pension_statement",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"introductory_letter",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_a",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_a",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_3",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_3",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_address",type:"form_4",issuer:{type:"government",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},userAddress:{type:"string"},physicalAddress:{type:"string"},issuingDate:{type:"string",format:"date"}}}},{category:"proof_of_employment",type:"form_4",issuer:{type:"private",country:"GH"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{nationalIdNumber:{type:"string",pattern:a},docNumber:{type:"string",pattern:p},employeeName:{type:"string"},position:{type:"string"},employerName:{type:"string"},issuingDate:{type:"string",format:"date"}}}}],c={GH:y,CA:[{category:"incorporation",type:"pdf",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{businessName:{type:"string"},website:{type:"string"},phone:{type:"string"},email:{type:"string"},owner:{type:"string"},tin:{type:"string"}}}},{category:"id",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}},{category:"selfie",type:"photo",issuer:{type:"local_authority",country:"CA"},issuingVersion:1,version:1,propertiesSchema:{type:"object",properties:{firstName:{type:"string"},middleName:{type:"string"},lastName:{type:"string"},authority:{type:"string"},placeOfIssue:{type:"string"},issueDate:{type:"string"},expires:{type:"string"},dateOfBirth:{type:"string"},placeOfBirth:{type:"string"},sex:{type:"string"}}}}]};t.certificateOfResidenceGH=u,t.defaultContextSchema={$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{entity:{type:"object",properties:{type:{enum:["individual","business"]},data:{type:"object",properties:{additionalInfo:{type:"object"}},additionalProperties:!0},ballerineEntityId:{type:"string"},id:{type:"string"}},required:["type"],anyOf:[{required:["id"]},{required:["ballerineEntityId"]}],additionalProperties:!1},documents:{type:"array",items:{type:"object",properties:{id:{type:"string"},category:{type:"string",transform:["trim","toLowerCase"]},type:{type:"string",transform:["trim","toLowerCase"]},issuer:{type:"object",properties:{type:{type:"string"},name:{type:"string"},country:{type:"string",transform:["trim","toUpperCase"]},city:{type:"string"},additionalInfo:{type:"object"}},required:["country"],additionalProperties:!1},issuingVersion:{type:"integer"},decision:{type:"object",properties:{status:{type:"string",enum:["new","pending","revision","approved","rejected"]},rejectionReason:{anyOf:[{type:"string"},{type:"string",enum:["Suspicious document","Document does not match customer profile","Potential identity theft","Fake or altered document","Document on watchlist or blacklist"]}]},revisionReason:{anyOf:[{type:"string"},{type:"string",enum:["Wrong document","Fake document","Spam","Ownership mismatch - Name","Ownership mismatch - National ID","Unknown document type","Bad image quality","Missing page","Invalid document","Expired document","Unreadable document","Blurry image","Other"]}]}},additionalProperties:!1},version:{type:"integer"},pages:{type:"array",items:{type:"object",properties:{ballerineFileId:{type:"string"},provider:{type:"string",enum:["gcs","http","stream","base64","ftp"]},uri:{type:"string",format:"uri"},type:{enum:["pdf","png","jpg"]},data:{type:"string"},metadata:{type:"object",properties:{side:{type:"string"},pageNumber:{type:"string"}},additionalProperties:!1}},required:["provider","uri","type"],additionalProperties:!1}},properties:{type:"object",properties:{email:{type:"string",format:"email"},expiryDate:{type:"string",format:"date"},idNumber:{type:"string",format:"regex"}}}},required:["category","type","issuer","pages","properties"],additionalProperties:!1}}},required:["entity","documents"]},t.getDocumentId=function(t,e){var r;if(void 0===e&&(e=!0),e&&null!=t&&t.id)return t.id;var n=(null==t?void 0:t.category)+"-"+(null==t?void 0:t.type)+"-"+(null==t||null==(r=t.issuer)?void 0:r.country);return t.version&&(n=n+"-v"+t.version),n.toLowerCase()},t.getDocumentsByCountry=function(t){return c[t]||[]},t.ghanaDocuments=y,t.handlePromise=i,t.isEmptyObject=function(t){return o(t)&&0===Object.keys(t).length},t.isErrorWithCode=function(t){return o(t)&&"code"in t&&"number"==typeof t.code},t.isErrorWithMessage=function(t){return o(t)&&"message"in t&&"string"==typeof t.message},t.isErrorWithName=function(t){return o(t)&&"name"in t&&"string"==typeof t.name},t.isFunction=function(t){return"function"==typeof t},t.isNullish=function(t){return null==t},t.isObject=o,t.noNullish=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return t.reduce((function(t,e,n){var i,o=null!=(i=r[n])?i:"";return t+e+String(o)}),"").replace(/\s+/g," ")},t.sleep=s,t.uniqueArray=function(t){return Array.from(new Set(t))},t.zodErrorToReadable=function(t){return t.issues.map((function(t){var e;return(null==(e=t.path)?void 0:e.join("."))+": "+t.message})).join("\n")},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map

@@ -5,3 +5,3 @@ {

"author": "Ballerine <dev@ballerine.com>",
"version": "0.5.5",
"version": "0.5.6",
"description": "common",

@@ -8,0 +8,0 @@ "module": "./dist/esm/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc