@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
73 lines • 3.68 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.API_ERRORS_CATALOG = exports.API_ERROR_CODES = void 0;
const zod_1 = require("zod");
const catalog_types_1 = require("./catalog_types");
/**
* ERP domain-specific error codes. Add here any code that does not fit
* the generic HTTP categories in `BASE_ERROR_CODES`.
*/
var API_ERROR_CODES;
(function (API_ERROR_CODES) {
API_ERROR_CODES["FORBIDDEN_CONTACT"] = "FORBIDDEN_CONTACT";
API_ERROR_CODES["HORIZONTAL_BULK_MESSAGING_ATTACHMENTS_TOO_LARGE"] = "HORIZONTAL_BULK_MESSAGING_ATTACHMENTS_TOO_LARGE";
API_ERROR_CODES["HORIZONTAL_CLAIM_POLICY_COMMUNITY_MISMATCH"] = "HORIZONTAL_CLAIM_POLICY_COMMUNITY_MISMATCH";
API_ERROR_CODES["HORIZONTAL_CLAIM_CONTACT_ALREADY_LINKED"] = "HORIZONTAL_CLAIM_CONTACT_ALREADY_LINKED";
API_ERROR_CODES["HORIZONTAL_CLAIM_CLOSED_BEFORE_OPENED"] = "HORIZONTAL_CLAIM_CLOSED_BEFORE_OPENED";
API_ERROR_CODES["TICKETING_TASK_CLAIM_SUBREF_NOT_ALLOWED"] = "TICKETING_TASK_CLAIM_SUBREF_NOT_ALLOWED";
API_ERROR_CODES["TICKETING_TASK_CLAIM_ALREADY_ASSOCIATED"] = "TICKETING_TASK_CLAIM_ALREADY_ASSOCIATED";
})(API_ERROR_CODES || (exports.API_ERROR_CODES = API_ERROR_CODES = {}));
/** Maps every `API_ERROR_CODES` member to its catalog entry. */
exports.API_ERRORS_CATALOG = {
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 403,
details: zod_1.z.object({
/** UUID of the contact person the caller was denied access to. */
contactId: zod_1.z.string(),
}),
message: 'You are not authorized to access this contact person',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 413,
details: zod_1.z.object({
/** Maximum total size allowed for all attachments, in bytes. */
maxBytes: zod_1.z.number(),
/** Total size of the submitted attachments, in bytes. */
totalBytes: zod_1.z.number(),
}),
message: 'The total size of the attachments exceeds the maximum allowed',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 422,
details: zod_1.z.object({ policyId: zod_1.z.string(), communityId: zod_1.z.string() }),
message: 'Policy does not belong to the given community',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 409,
details: zod_1.z.object({ claimId: zod_1.z.string(), contactId: zod_1.z.string() }),
message: 'Contact is already linked to this claim',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 422,
details: zod_1.z.object({ openedAt: zod_1.z.string(), closedAt: zod_1.z.string() }),
message: 'closedAt cannot be before openedAt',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 422,
details: zod_1.z.object({ taskId: zod_1.z.string(), refId: zod_1.z.string() }),
message: 'Claim resources do not accept subType or subRef',
},
[]: {
kind: catalog_types_1.ErrorKind.DOMAIN,
status: 409,
details: zod_1.z.object({ taskId: zod_1.z.string(), refId: zod_1.z.string() }),
message: 'Task already has a claim associated',
},
};
//# sourceMappingURL=catalog_api.js.map