8 lines
264 KiB
Plaintext
8 lines
264 KiB
Plaintext
|
{
|
||
|
"version": 3,
|
||
|
"sources": ["../src/model.js"],
|
||
|
"sourcesContent": ["'use strict';\n\nconst assert = require('assert');\nconst _ = require('lodash');\nconst Dottie = require('dottie');\n\nconst Utils = require('./utils');\nconst { logger } = require('./utils/logger');\nconst BelongsTo = require('./associations/belongs-to');\nconst BelongsToMany = require('./associations/belongs-to-many');\nconst InstanceValidator = require('./instance-validator');\nconst QueryTypes = require('./query-types');\nconst sequelizeErrors = require('./errors');\nconst Association = require('./associations/base');\nconst HasMany = require('./associations/has-many');\nconst DataTypes = require('./data-types');\nconst Hooks = require('./hooks');\nconst associationsMixin = require('./associations/mixin');\nconst Op = require('./operators');\nconst { noDoubleNestedGroup } = require('./utils/deprecations');\n\n\n// This list will quickly become dated, but failing to maintain this list just means\n// we won't throw a warning when we should. At least most common cases will forever be covered\n// so we stop throwing erroneous warnings when we shouldn't.\nconst validQueryKeywords = new Set(['where', 'attributes', 'paranoid', 'include', 'order', 'limit', 'offset',\n 'transaction', 'lock', 'raw', 'logging', 'benchmark', 'having', 'searchPath', 'rejectOnEmpty', 'plain',\n 'scope', 'group', 'through', 'defaults', 'distinct', 'primary', 'exception', 'type', 'hooks', 'force',\n 'name']);\n\n// List of attributes that should not be implicitly passed into subqueries/includes.\nconst nonCascadingOptions = ['include', 'attributes', 'originalAttributes', 'order', 'where', 'limit', 'offset', 'plain', 'group', 'having'];\n\n/**\n * A Model represents a table in the database. Instances of this class represent a database row.\n *\n * Model instances operate with the concept of a `dataValues` property, which stores the actual values represented by the instance.\n * By default, the values from dataValues can also be accessed directly from the Instance, that is:\n * ```js\n * instance.field\n * // is the same as\n * instance.get('field')\n * // is the same as\n * instance.getDataValue('field')\n * ```\n * However, if getters and/or setters are defined for `field` they will be invoked, instead of returning the value from `dataValues`.\n * Accessing properties directly or using `get` is preferred for regular use, `getDataValue` should only be used for custom getters.\n *\n * @see\n * {@link Sequelize#define} for more information about getters and setters\n * @mixes Hooks\n */\nclass Model {\n static get queryInterface() {\n return this.sequelize.getQueryInterface();\n }\n\n static get queryGenerator() {\n return this.queryInterface.queryGenerator;\n }\n\n /**\n * A reference to the sequelize instance\n *\n * @see\n * {@link Sequelize}\n *\n * @property sequelize\n *\n * @returns {Sequelize}\n */\n get sequelize() {\n return this.constructor.sequelize;\n }\n\n /**\n * Builds a new model instance.\n *\n * @param {object} [values={}] an object of key value pairs\n * @param {object} [options] instance construction options\n * @param {boolean} [options.raw=false] If set to true, values will ignore field and virtual setters.\n * @param {boolean} [options.isNewRecord=true] Is this a new record\n * @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set`\n */\n constructor(values = {}, options = {}) {\n if (!this.constructor._overwrittenAttributesChecked) {\n this.constructor._overwrittenAttributesChecked = true;\n\n // setTimeout is hacky but necessary.\n // Public Class Fields declared by descendants of this class\n // will not be available until after their call to super, so after\n // this constructor is done running.\n setTimeout(() => {\n const overwrittenAttributes = [];\n for (const key of Object.keys(this.constructor._attributeManipulation)) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n overwrittenAttributes.pus
|
||
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAEA,MAAM,SAAS,QAAQ;AACvB,MAAM,IAAI,QAAQ;AAClB,MAAM,SAAS,QAAQ;AAEvB,MAAM,QAAQ,QAAQ;AACtB,MAAM,EAAE,WAAW,QAAQ;AAC3B,MAAM,YAAY,QAAQ;AAC1B,MAAM,gBAAgB,QAAQ;AAC9B,MAAM,oBAAoB,QAAQ;AAClC,MAAM,aAAa,QAAQ;AAC3B,MAAM,kBAAkB,QAAQ;AAChC,MAAM,cAAc,QAAQ;AAC5B,MAAM,UAAU,QAAQ;AACxB,MAAM,YAAY,QAAQ;AAC1B,MAAM,QAAQ,QAAQ;AACtB,MAAM,oBAAoB,QAAQ;AAClC,MAAM,KAAK,QAAQ;AACnB,MAAM,EAAE,wBAAwB,QAAQ;AAMxC,MAAM,qBAAqB,oBAAI,IAAI;AAA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