@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
70 lines • 3.28 kB
JavaScript
import { z } from 'zod';
import { ErrorKind } from './catalog_types';
/**
* ERP domain-specific error codes. Add here any code that does not fit
* the generic HTTP categories in `BASE_ERROR_CODES`.
*/
export 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 || (API_ERROR_CODES = {}));
/** Maps every `API_ERROR_CODES` member to its catalog entry. */
export const API_ERRORS_CATALOG = {
[]: {
kind: ErrorKind.DOMAIN,
status: 403,
details: z.object({
/** UUID of the contact person the caller was denied access to. */
contactId: z.string(),
}),
message: 'You are not authorized to access this contact person',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 413,
details: z.object({
/** Maximum total size allowed for all attachments, in bytes. */
maxBytes: z.number(),
/** Total size of the submitted attachments, in bytes. */
totalBytes: z.number(),
}),
message: 'The total size of the attachments exceeds the maximum allowed',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 422,
details: z.object({ policyId: z.string(), communityId: z.string() }),
message: 'Policy does not belong to the given community',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 409,
details: z.object({ claimId: z.string(), contactId: z.string() }),
message: 'Contact is already linked to this claim',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 422,
details: z.object({ openedAt: z.string(), closedAt: z.string() }),
message: 'closedAt cannot be before openedAt',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 422,
details: z.object({ taskId: z.string(), refId: z.string() }),
message: 'Claim resources do not accept subType or subRef',
},
[]: {
kind: ErrorKind.DOMAIN,
status: 409,
details: z.object({ taskId: z.string(), refId: z.string() }),
message: 'Task already has a claim associated',
},
};
//# sourceMappingURL=catalog_api.js.map