UNPKG

@palmares/databases

Version:

Add support for working with databases with palmares framework

74 lines (72 loc) 3.45 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/models/fields/exceptions.ts var exceptions_exports = {}; __export(exceptions_exports, { ForeignKeyFieldInvalidRelatedToError: () => ForeignKeyFieldInvalidRelatedToError, ForeignKeyFieldRelatedOrRelationNameAlreadyExistsError: () => ForeignKeyFieldRelatedOrRelationNameAlreadyExistsError, ForeignKeyFieldRequiredParamsMissingError: () => ForeignKeyFieldRequiredParamsMissingError, InvalidDefaultValueForFieldType: () => InvalidDefaultValueForFieldType }); module.exports = __toCommonJS(exceptions_exports); var InvalidDefaultValueForFieldType = class extends Error { static { __name(this, "InvalidDefaultValueForFieldType"); } constructor(fieldName, defaultValue, shouldBeOfType) { super(`Invalid default value for field ${fieldName}: ${defaultValue} Should be of type ${shouldBeOfType}`); this.name = "InvalidDefaultValueForFieldType"; } }; var ForeignKeyFieldRelatedOrRelationNameAlreadyExistsError = class extends Error { static { __name(this, "ForeignKeyFieldRelatedOrRelationNameAlreadyExistsError"); } constructor(modelName, fieldName, relatedOrRelationName, otherFieldName, otherModelName, isRelatedName) { super(`The ForeignKeyField with name '${fieldName}' on model '${modelName}' has a ${isRelatedName ? "relatedName" : "relationName"} '${relatedOrRelationName}' that already exists for the field '${otherFieldName}' on model '${otherModelName}'. Please, provide a different value.`); this.name = "ForeignKeyFieldRelatedNameAlreadyExistsError"; } }; var ForeignKeyFieldInvalidRelatedToError = class extends Error { static { __name(this, "ForeignKeyFieldInvalidRelatedToError"); } constructor(fieldName, modelName) { super(`Foreign key field ${fieldName} on model ${modelName} has invalid 'relatedTo' parameter. It should relate to a model, a function that returns a model or a string`); this.name = "ForeignKeyFieldInvalidRelatedToError"; } }; var ForeignKeyFieldRequiredParamsMissingError = class extends Error { static { __name(this, "ForeignKeyFieldRequiredParamsMissingError"); } constructor(fieldName) { super(`Foreign key field ${fieldName} requires a reference to a model with 'relatedTo' and 'onDelete' parameter`); this.name = "ForeignKeyFieldRequiredParamsMissingError"; } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ForeignKeyFieldInvalidRelatedToError, ForeignKeyFieldRelatedOrRelationNameAlreadyExistsError, ForeignKeyFieldRequiredParamsMissingError, InvalidDefaultValueForFieldType });