@h3ravel/arquebus 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js","../src/migrations/migration-repository.js","../src/migrations/migrator.js","../src/utils.js","../src/casts/attribute.js","../src/arquebus.js","../src/relations/relation.js","../src/relations/concerns/supports-default-models.js","../src/relations/belongs-to.js","../src/relations/belongs-to-many.js","../src/collection.js","../src/relations/concerns/interacts-with-pivot-table.js","../src/errors.js","../src/builder.js","../src/paginator.js","../src/scope.js","../src/concerns/has-attributes.js","../src/casts-attributes.js","../src/concerns/has-global-scopes.js","../src/hooks.js","../src/concerns/has-hooks.js","../src/relations/has-one-or-many.js","../src/relations/has-many.js","../src/relations/has-one.js","../src/relations/has-many-through.js","../src/relations/has-one-through.js","../src/concerns/has-relations.js","../src/concerns/has-timestamps.js","../src/concerns/hides-attributes.js","../src/concerns/unique-ids.js","../src/model.js","../src/query-builder.js","../bin/utils.js","../src/migrate.js","../src/concerns/has-unique-ids.js","../src/migrations/migration.js","../src/pivot.js","../src/soft-deleting-scope.js","../src/soft-deletes.js"],"sourcesContent":["import { migrateRollback, migrateRun, migrateStatus } from './migrate'\n\nimport Attribute from './casts/attribute'\nimport Builder from './builder'\nimport CastsAttributes from './casts-attributes'\nimport Collection from './collection'\nimport HasUniqueIds from './concerns/has-unique-ids'\nimport Migration from './migrations/migration'\nimport Model from './model'\nimport Paginator from './paginator'\nimport Pivot from './pivot'\nimport QueryBuilder from './query-builder'\nimport Scope from './scope'\nimport SoftDeletes from './soft-deletes'\nimport arquebus from './arquebus'\n\nconst make = (model, data, options = {}) => {\n const { paginated } = options\n if (paginated) {\n return new Paginator(\n data.data.map(item => model.make(item)),\n data.total,\n data.per_page,\n data.current_page\n )\n }\n if (Array.isArray(data)) {\n return new Collection(data.map(item => model.make(item)))\n }\n return model.make(data)\n}\n\nconst makeCollection = (model, data) =>\n new Collection(data.map(item => model.make(item)))\n\nconst makePaginator = (model, data) =>\n new Paginator(\n data.data.map(item => model.make(item)),\n data.total,\n data.per_page,\n data.current_page\n )\n\nexport * from './errors'\nexport * from './utils'\n\n// named exports\nexport {\n arquebus,\n Paginator,\n Collection,\n QueryBuilder,\n Model,\n Pivot,\n Builder,\n Attribute,\n CastsAttributes,\n Migration,\n Scope,\n SoftDeletes,\n HasUniqueIds,\n make,\n makeCollection,\n makePaginator,\n migrateRun,\n migrateRollback,\n migrateStatus,\n} \n","class MigrationRepository {\n resolver\n table\n connection = null\n constructor(resolver, table) {\n this.resolver = resolver\n this.table = table\n }\n async getRan() {\n return await this.getTable()\n .orderBy('batch', 'asc')\n .orderBy('migration', 'asc')\n .pluck('migration')\n }\n async getMigrations(steps) {\n const query = this.getTable().where('batch', '>=', '1')\n return (await query.orderBy('batch', 'desc')\n .orderBy('migration', 'desc')\n .take(steps).get())\n }\n async getMigrationsByBatch(batch) {\n return (await this.getTable()\n .where('batch', batch)\n .orderBy('migration', 'desc')\n .get())\n }\n async getLast() {\n const query = this.getTable().where('batch', await this.getLastBatchNumber())\n return (await query.orderBy('migration', 'desc').get())\n }\n async getMigrationBatches() {\n const migrations = await this.getTable()\n .select('batch', 'migration')\n .orderBy('batch', 'asc')\n .orderBy('migration', 'asc')\n .get()\n const migrationBatches = {}\n migrations.map(migration => {\n migrationBatches[migration.migration] = migration.batch\n })\n return migrationBatches\n }\n async log(file, batch) {\n await this.getTable().insert({\n migration: file,\n batch: batch\n })\n }\n async delete(migration) {\n await this.getTable().where('migration', migration.migration).delete()\n }\n async getNextBatchNumber() {\n return (await this.getLastBatchNumber()) + 1\n }\n async getLastBatchNumber() {\n return await this.getTable().max('batch')\n }\n async createRepository() {\n const schema = this.getConnection().schema\n await schema.createTable(this.table, function (table) {\n table.increments('id')\n table.string('migration')\n table.integer('batch')\n })\n }\n repositoryExists() {\n const schema = this.getConnection().schema\n return schema.hasTable(this.table)\n }\n async deleteRepository() {\n const schema = this.getConnection().schema\n await schema.drop(this.table)\n }\n getTable() {\n return this.getConnection().table(this.table)\n }\n getConnection() {\n return this.resolver.connection(this.connection)\n }\n setSource(name) {\n this.connection = name\n }\n}\nexport default MigrationRepository\n","import * as color from 'colorette'\n\nimport fs from 'fs'\nimport path from 'path'\nimport { promisify } from 'util'\nasync function glob (folderPath) {\n const files = await promisify(fs.readdir)(folderPath)\n const allFiles = []\n for (const file of files) {\n const filePath = `${folderPath}/${file}`\n const stats = await promisify(fs.stat)(filePath)\n if (stats.isFile()) {\n allFiles.push(filePath)\n }\n else if (stats.isDirectory()) {\n const subFiles = await glob(filePath)\n allFiles.push(...subFiles)\n }\n }\n return allFiles\n}\nclass Migrator {\n events = null\n repository\n files\n resolver\n connection = null\n paths = []\n output = null\n constructor(repository, resolver = null, files = null, dispatcher = null) {\n this.repository = repository\n this.files = files\n this.resolver = resolver\n this.events = dispatcher\n }\n async run (paths = [], options = {}) {\n const files = await this.getMigrationFiles(paths)\n const ran = await this.repository.getRan()\n const migrations = this.pendingMigrations(files, ran)\n await this.runPending(migrations, options)\n return migrations\n }\n pendingMigrations (files, ran) {\n return Object.values(files).filter(file => !ran.includes(this.getMigrationName(file)))\n }\n async runPending (migrations, options = {}) {\n if (migrations.length === 0) {\n this.write('Nothing to migrate')\n return\n }\n let batch = await this.repository.getNextBatchNumber()\n const pretend = options.pretend || false\n const step = options.step || false\n this.write('Running migrations.')\n for (const file of migrations) {\n await this.runUp(file, batch, pretend)\n if (step) {\n batch++\n }\n }\n }\n async runUp (file, batch, pretend) {\n const migration = this.resolvePath(file)\n const name = this.getMigrationName(file)\n await this.writeTask(name, () => this.runMigration(migration, 'up'))\n await this.repository.log(name, batch)\n }\n async rollback (paths = [], options = {}) {\n const migrations = await this.getMigrationsForRollback(options)\n if (migrations.length === 0) {\n this.write('Nothing to rollback.')\n return []\n }\n return await this.rollbackMigrations(migrations, paths, options)\n }\n async getMigrationsForRollback (options) {\n if (options.step > 0) {\n return await this.repository.getMigrations(options.step)\n }\n if (options.batch > 0) {\n return await this.repository.getMigrationsByBatch(options.batch)\n }\n return await this.repository.getLast()\n }\n async rollbackMigrations (migrations, paths, options) {\n const rolledBack = []\n const files = await this.getMigrationFiles(paths)\n this.write('Rolling back migrations.')\n for (const migration of migrations) {\n const file = files[migration.migration]\n if (!file) {\n this.writeTwoColumns(migration.migration, color.yellow('Migration not found'))\n continue\n }\n rolledBack.push(file)\n await this.runDown(file, migration, options.pretend || false)\n }\n return rolledBack\n }\n async runDown (file, migration, pretend) {\n const instance = this.resolvePath(file)\n const name = this.getMigrationName(file)\n await this.writeTask(name, () => this.runMigration(instance, 'down'))\n await this.repository.delete(migration)\n }\n reset (paths = [], pretend = false) {\n const migrations = this.repository.getRan().reverse()\n if (migrations.length === 0) {\n this.write(Info, 'Nothing to rollback.')\n return []\n }\n return this.resetMigrations(migrations, paths, pretend)\n }\n resetMigrations (migrations, paths, pretend = false) {\n migrations = migrations.map(m => ({ migration: m }))\n return this.rollbackMigrations(migrations, paths, { pretend })\n }\n async runMigration (migration, method) {\n const connection = this.resolveConnection(migration.getConnection())\n const callback = async (trx) => {\n if (typeof migration[method] === 'function') {\n await this.runMethod(trx, migration, method)\n }\n }\n if (migration.withinTransaction) {\n await connection.transaction(callback)\n }\n else {\n await callback(connection)\n }\n }\n async runMethod (connection, migration, method) {\n try {\n await migration[method](connection.schema, connection)\n }\n finally {\n //\n }\n }\n resolvePath (path) {\n return new migrationClass\n }\n getMigrationClass (migrationName) {\n return migrationName.split('_').slice(4).map(str => str.charAt(0).toUpperCase() + str.slice(1)).join('')\n }\n async getMigrationFiles (paths) {\n const files = []\n for (const path of paths) {\n if (path.endsWith('.js')) {\n files.push(path)\n continue\n }\n files.push(...await glob(path))\n }\n return files.filter(Boolean).reduce((result, file) => {\n result[this.getMigrationName(file)] = file\n return result\n }, {})\n }\n getMigrationName (filePath) {\n return path.basename(filePath).replace('.js', '')\n }\n path (path) {\n this.paths = Array.from(new Set([...this.paths, path]))\n }\n getPaths () {\n return this.paths\n }\n getConnection () {\n return this.connection\n }\n resolveConnection (connection) {\n return this.resolver.connection(connection || this.connection)\n }\n getRepository () {\n return this.repository\n }\n repositoryExists () {\n return this.repository.repositoryExists()\n }\n async hasRunAnyMigrations () {\n const ran = await this.repository.getRan()\n const exists = await this.repositoryExists()\n return exists && ran.length > 0\n }\n deleteRepository () {\n this.repository.deleteRepository()\n }\n setOutput (output) {\n this.output = output\n return this\n }\n write (...args) {\n if (this.output) {\n console.log(...args)\n }\n }\n writeTwoColumns (name, ...args) {\n const value = args.join(' ')\n const regex = /\\x1b\\[\\d+m/g\n const width = Math.min(process.stdout.columns, 100)\n const dots = Math.max(width - name.replace(regex, '').length - value.replace(regex, '').length - 10, 0)\n return this.write(name, color.gray('.'.repeat(dots)), value)\n }\n async writeTask (description, task) {\n const startTime = process.hrtime()\n let result = false\n try {\n result = await (task || (() => true))()\n }\n catch (e) {\n throw e\n }\n finally {\n const endTime = process.hrtime(startTime)\n const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6\n this.writeTwoColumns(color.green(description), color.gray(`${Math.floor(duration)}ms`), result !== false ? color.green('✔') : color.red('✘'))\n }\n }\n}\nexport default Migrator\n","import { camel, dash, snake, trim } from 'radashi'\n\nimport advancedFormat from 'dayjs/plugin/advancedFormat'\nimport dayjs from 'dayjs'\n\ndayjs.extend(advancedFormat)\n\nexport const now = (format = 'YYYY-MM-DD HH:mm:ss') => dayjs().format(format)\n\nexport const getRelationName = (relationMethod) => {\n // 'relation' length 8\n return snake(relationMethod.substring(8))\n}\n\nexport const getScopeName = (scopeMethod) => {\n // 'scope' length 5\n return snake(scopeMethod.substring(5))\n}\n\nexport const getRelationMethod = (relation) => {\n return camel(`relation_${relation}`)\n}\n\nexport const getScopeMethod = (scope) => {\n return camel(`scope_${scope}`)\n}\n\nexport const getAttrMethod = (attr) => {\n return camel(`attribute_${attr}`)\n}\n\nexport const getGetterMethod = (attr) => {\n return camel(`get_${attr}_attribute`)\n}\n\nexport const getSetterMethod = (attr) => {\n return camel(`set_${attr}_attribute`)\n}\n\nexport const getAttrName = (attrMethod) => {\n return attrMethod.substring(3, attrMethod.length - 9).toLowerCase()\n}\n\n/**\n * Tap into a model a collection instance\n * \n * @param instance \n * @param callback \n * @returns \n */\nexport const tap = (instance, callback) => {\n const result = callback(instance)\n return result instanceof Promise ? result.then(() => instance) : instance\n}\n\n/**\n * Compose functional mixins\n * \n * @param Base \n * @param mixins \n * @returns \n */\nexport function compose (\n Base,\n ...mixins\n) {\n /**\n * Apply each mixin in sequence\n */\n return mixins.reduce(\n (cls, mixin) => mixin(cls),\n Base)\n}\n\nexport const flattenDeep = (arr) => Array.isArray(arr)\n ? arr.reduce((a, b) => a.concat(flattenDeep(b)), [])\n : [arr]\n\nexport const kebabCase = (str) => trim(dash(str.replace(/[^a-zA-Z0-9_-]/g, '-')), '_-')\nexport const snakeCase = (str) => trim(snake(str.replace(/[^a-zA-Z0-9_-]/g, '-')), '_-')\n\nexport default {\n now,\n getRelationName,\n getScopeName,\n getRelationMethod,\n getScopeMethod,\n getAttrMethod,\n getGetterMethod,\n getSetterMethod,\n getAttrName,\n compose,\n tap\n}\n","class Attribute {\n get;\n set;\n withCaching = false\n withObjectCaching = true\n constructor({ get = null, set = null }) {\n this.get = get\n this.set = set\n }\n static make(get = null, set = null) {\n return new Attribute(get, set)\n }\n static get(get) {\n return new Attribute(get)\n }\n static set(set) {\n return new Attribute(null, set)\n }\n withoutObjectCaching() {\n this.withObjectCaching = false\n return this\n }\n shouldCache() {\n this.withCaching = true\n return this\n }\n}\nexport default Attribute\n","import { compose, getAttrMethod, getRelationMethod, getScopeMethod } from './utils'\n\nimport Attribute from './casts/attribute'\nimport Knex from 'knex'\nimport { Model } from './model'\nimport QueryBuilder from './query-builder'\n\nclass arquebus {\n static connectorFactory = null\n static instance = null\n constructor() {\n this.manager = {}\n this.connections = {}\n this.models = {}\n }\n static getInstance () {\n if (this.instance === null) {\n this.instance = new arquebus()\n }\n return this.instance\n }\n static connection (connection = null) {\n return this.getInstance().getConnection(connection)\n }\n static setConnectorFactory (connectorFactory) {\n this.connectorFactory = connectorFactory\n }\n static getConnectorFactory () {\n return this.connectorFactory || Knex\n }\n static addConnection (config, name = 'default') {\n return this.getInstance().addConnection(config, name)\n }\n static beginTransaction (connection = null) {\n return this.getInstance().beginTransaction(connection)\n }\n static transaction (callback, connection = null) {\n return this.getInstance().transaction(callback, connection)\n }\n static table (name, connection = null) {\n return this.getInstance().table(name, connection)\n }\n static schema (connection = null) {\n return this.getInstance().schema(connection)\n }\n static async destroyAll () {\n await this.getInstance().destroyAll()\n }\n static createModel (name, options) {\n return this.getInstance().createModel(name, options)\n }\n connection (connection = null) {\n return this.getConnection(connection)\n }\n getConnection (name = null) {\n name = name || 'default'\n if (this.manager[name] === undefined) {\n const queryBuilder = new QueryBuilder(this.connections[name], this.constructor.getConnectorFactory())\n this.manager[name] = queryBuilder\n }\n return this.manager[name]\n }\n addConnection (config, name = 'default') {\n this.connections[name] = {\n ...config,\n connection: {\n ...config.connection,\n dateStrings: true,\n typeCast: function (field, next) {\n if (field.type === 'JSON') {\n return field.string('utf8')\n }\n return next()\n }\n }\n }\n }\n beginTransaction (connection = null) {\n return this.connection(connection).transaction()\n }\n transaction (callback, connection = null) {\n return this.connection(connection).transaction(callback)\n }\n table (name, connection = null) {\n return this.connection(connection).table(name)\n }\n schema (connection = null) {\n return this.connection(connection).schema\n }\n async destroyAll () {\n await Promise.all(Object.values(this.manager).map((connection) => {\n return connection?.destroy()\n }))\n }\n createModel (name, options = {}) {\n let BaseModel = Model\n if ('plugins' in options) {\n BaseModel = compose(BaseModel, ...options.plugins)\n }\n this.models = {\n ...this.models,\n [name]: class extends BaseModel {\n table = options?.table ?? null\n connection = options?.connection ?? null\n timestamps = options?.timestamps ?? true\n primaryKey = options?.primaryKey ?? 'id'\n keyType = options?.keyType ?? 'int'\n incrementing = options?.incrementing ?? true\n with = options?.with ?? []\n casts = options?.casts ?? {}\n static CREATED_AT = options?.CREATED_AT ?? 'created_at'\n static UPDATED_AT = options?.UPDATED_AT ?? 'updated_at'\n static DELETED_AT = options?.DELETED_AT ?? 'deleted_at'\n }\n }\n if ('attributes' in options) {\n for (const attribute in options.attributes) {\n if (options.attributes[attribute] instanceof Attribute === false) {\n throw new Error('Attribute must be an instance of \"Attribute\"')\n }\n this.models[name].prototype[getAttrMethod(attribute)] = () => options.attributes[attribute]\n }\n }\n if ('relations' in options) {\n for (const relation in options.relations) {\n this.models[name].prototype[getRelationMethod(relation)] = function () {\n return options.relations[relation](this)\n }\n }\n }\n if ('scopes' in options) {\n for (const scope in options.scopes) {\n this.models[name].prototype[getScopeMethod(scope)] = options.scopes[scope]\n }\n }\n this.models[name].setConnectionResolver(this)\n return this.models[name]\n }\n}\nconst isBrowser = false\nexport { isBrowser }\nexport default arquebus\n","class Relation {\n query\n parent\n related\n eagerKeysWereEmpty = false\n static constraints = true\n constructor(query, parent) {\n this.query = query\n this.parent = parent\n this.related = this.query.model\n }\n static extend (trait) {\n for (const methodName in trait) {\n this.prototype[methodName] = trait[methodName]\n }\n }\n static noConstraints (callback) {\n const previous = this.constraints\n this.constraints = false\n try {\n return callback()\n }\n finally {\n this.constraints = previous\n }\n }\n asProxy () {\n const handler = {\n get: function (target, prop) {\n if (typeof target[prop] !== 'undefined') {\n return target[prop]\n }\n if (typeof prop === 'string') {\n // if ([\n // 'avg', 'max', 'min', 'sum', 'count',\n // ].includes(prop)) {\n // return (column) => {\n // const instance = target.asProxy();\n // instance.applyScopes();\n // column = !column && prop === 'count' ? '*' : column;\n // return instance.query[prop]({\n // aggregate: column\n // }).then(data => data?.[0]?.aggregate);\n // }\n // }\n if (typeof target.query[prop] === 'function') {\n return (...args) => {\n target.query[prop](...args)\n return target.asProxy()\n }\n }\n }\n },\n }\n return new Proxy(this, handler)\n }\n getRelated () {\n return this.related\n }\n getKeys (models, key) {\n return models.map(model => key ? model.attributes[key] : model.getKey()).sort()\n }\n getRelationQuery () {\n return this.query\n }\n whereInEager (whereIn, key, modelKeys, query = null) {\n (query || this.query)[whereIn](key, modelKeys)\n if (modelKeys.length === 0) {\n this.eagerKeysWereEmpty = true\n }\n }\n whereInMethod (model, key) {\n return 'whereIn'\n const segments = key.split('.')\n return model.getKeyName() === segments.pop()\n && ['int', 'integer'].includes(model.getKeyType())\n ? 'whereIntegerInRaw'\n : 'whereIn'\n }\n getEager () {\n return this.eagerKeysWereEmpty\n ? this.query.getModel().newCollection()\n : this.get()\n }\n async get (columns = '*') {\n return await this.query.get(columns)\n }\n async first (columns = '*') {\n return await this.query.first(columns)\n }\n async paginate (...args) {\n return await this.query.paginate(...args)\n }\n async count (...args) {\n return await this.query.clearSelect().count(...args)\n }\n toSql () {\n return this.query.toSql()\n }\n addConstraints () { }\n getRelationCountHash (incrementJoinCount = true) {\n return 'arquebus_reserved_' + (incrementJoinCount ? this.constructor.selfJoinCount++ : this.constructor.selfJoinCount)\n }\n getRelationExistenceQuery (query, parentQuery, columns = ['*']) {\n return query.select(columns).whereColumn(this.getQualifiedParentKeyName(), '=', this.getExistenceCompareKey())\n }\n getRelationExistenceCountQuery (query, parentQuery) {\n const db = this.related.getConnection()\n return this.getRelationExistenceQuery(query, parentQuery, db.raw('count(*)'))\n }\n getQualifiedParentKeyName () {\n return this.parent.getQualifiedKeyName()\n }\n}\nexport default Relation\n","const SupportsDefaultModels = (Relation) => {\n return class extends Relation {\n _withDefault\n withDefault(callback = true) {\n this._withDefault = callback\n return this\n }\n getDefaultFor(parent) {\n if (!this._withDefault) {\n return null\n }\n const instance = this.newRelatedInstanceFor(parent)\n if (typeof this._withDefault === 'function') {\n return this._withDefault(instance, parent) || instance\n }\n if (typeof this._withDefault === 'object') {\n for (const key in this._withDefault) {\n instance.setAttribute(key, this._withDefault[key])\n }\n }\n return instance\n }\n }\n}\nexport default SupportsDefaultModels\n","import { Model } from '../model'\nimport Relation from './relation'\nimport SupportsDefaultModels from './concerns/supports-default-models'\nimport { compose } from '../utils'\n\nclass BelongsTo extends compose(Relation, SupportsDefaultModels) {\n foreignKey\n ownerKey\n child\n relationName\n constructor(query, child, foreignKey, ownerKey, relationName) {\n super(query, child)\n this.foreignKey = foreignKey\n this.ownerKey = ownerKey\n this.child = child\n this.relationName = relationName\n this.addConstraints()\n return this.asProxy()\n }\n async getResults () {\n if (this.child[this.foreignKey] === null) {\n return this.getDefaultFor(this.parent)\n }\n const result = await this.query.first()\n return result || this.getDefaultFor(this.parent)\n }\n match (models, results, relation) {\n const foreign = this.foreignKey\n const owner = this.ownerKey\n const dictionary = {}\n results.map(result => {\n const attribute = result.attributes[owner]\n dictionary[attribute] = result\n })\n models.map(model => {\n const attribute = model[foreign]\n if (dictionary[attribute] !== undefined) {\n model.setRelation(relation, dictionary[attribute])\n }\n })\n return models\n }\n getQualifiedForeignKeyName () {\n return this.child.qualifyColumn(this.foreignKey)\n }\n getRelationExistenceQuery (query, parentQuery, columns = ['*']) {\n if (parentQuery.getQuery()._single.table == query.getQuery()._single.table) {\n return this.getRelationExistenceQueryForSelfRelation(query, parentQuery, columns)\n }\n return query.select(columns).whereColumn(this.getQualifiedForeignKeyName(), '=', query.qualifyColumn(this.ownerKey))\n }\n getRelationExistenceQueryForSelfRelation (query, parentQuery, columns = ['*']) {\n const hash = this.getRelationCountHash()\n query.select(columns).from(query.getModel().getTable() + ' as ' + hash)\n query.getModel().setTable(hash)\n return query.whereColumn(hash + '.' + this.ownerKey, '=', this.getQualifiedForeignKeyName())\n }\n initRelation (models, relation) {\n models.map(model => {\n model.setRelation(relation, this.getDefaultFor(model))\n })\n return models\n }\n addEagerConstraints (models) {\n const key = `${this.related.getTable()}.${this.ownerKey}`\n // const whereIn = this.whereIn(this.related, this.ownerKey);\n this.query.whereIn(key, this.getEagerModelKeys(models))\n }\n getEagerModelKeys (models) {\n const keys = []\n models.map(model => {\n const value = model[this.foreignKey]\n if (value !== null && value !== undefined) {\n keys.push(value)\n }\n })\n keys.sort()\n return [...new Set(keys)]\n }\n associate (model) {\n const ownerKey = model instanceof Model ? model.attributes[this.ownerKey] : model\n this.child[this.foreignKey] = ownerKey\n if (model instanceof Model) {\n this.child.setRelation(this.relationName, model)\n }\n else {\n this.child.unsetRelation(this.relationName)\n }\n return this.child\n }\n dissociate () {\n this.child[this.foreignKey] = null\n return this.child.setRelation(this.relationName, null)\n }\n addConstraints () {\n if (this.constructor.constraints) {\n const table = this.related.getTable()\n this.query.where(table + '.' + this.ownerKey, '=', this.child[this.foreignKey])\n }\n }\n newRelatedInstanceFor (parent) {\n return this.related.newInstance()\n }\n}\nexport default BelongsTo\n","import { compose, tap } from '../utils'\nimport { isEqual, omit } from 'radashi'\n\nimport Collection from '../collection'\nimport InteractsWithPivotTable from './concerns/interacts-with-pivot-table'\nimport Relation from './relation'\nimport { collect } from 'collect.js'\n\nclass BelongsToMany extends compose(Relation, InteractsWithPivotTable) {\n table\n foreignPivotKey\n relatedPivotKey\n parentKey\n relatedKey\n pivotColumns = []\n pivotValues = []\n pivotWheres = []\n pivotWhereIns = []\n pivotWhereNulls = []\n accessor = 'pivot'\n // withTimestamps = false;\n using\n pivotCreatedAt\n pivotUpdatedAt\n constructor(query, parent, table, foreignPivotKey, relatedPivotKey, parentKey, relatedKey) {\n super(query, parent)\n this.table = table\n this.foreignPivotKey = foreignPivotKey\n this.relatedPivotKey = relatedPivotKey\n this.parentKey = parentKey\n this.relatedKey = relatedKey\n this.addConstraints()\n return this.asProxy()\n }\n initRelation (models, relation) {\n models.map(model => {\n model.setRelation(relation, new Collection([]))\n })\n return models\n }\n addConstraints () {\n this.performJoin()\n if (this.constructor.constraints) {\n this.addWhereConstraints()\n }\n }\n performJoin (query = null) {\n query = query || this.query\n query.join(this.getTable(), this.getQualifiedRelatedKeyName(), '=', this.qualifyPivotColumn(this.relatedPivotKey))\n return this\n }\n getTable () {\n return this.table\n }\n getQualifiedRelatedKeyName () {\n return this.related.qualifyColumn(this.relatedKey)\n }\n async getResults () {\n return this.parent[this.parentKey] !== null\n ? await this.get()\n : new Collection([])\n }\n addWhereConstraints () {\n this.query.where(this.getQualifiedForeignPivotKeyName(), '=', this.parent[this.parentKey])\n return this\n }\n async get (columns = ['*']) {\n const builder = this.query.applyScopes()\n columns = builder.query?._statements?.find(item => item.grouping == 'columns') ? [] : columns\n let models = await builder.select(this.shouldSelect(columns)).getModels()\n this.hydratePivotRelation(models)\n if (models.length > 0) {\n models = await builder.eagerLoadRelations(models)\n }\n return new Collection(models)\n }\n async first (columns = ['*']) {\n const results = await this.take(1).get(columns)\n return results.count() > 0 ? results.first() : null\n }\n async firstOrFail (columns = ['*']) {\n const model = await this.first(columns)\n if (model !== null) {\n return model\n }\n throw (new ModelNotFoundError).setModel(this.related.constructor)\n }\n async paginate (page = 1, perPage = 15, columns = ['*']) {\n this.query.select(this.shouldSelect(columns))\n return tap(await this.query.paginate(page, perPage), (paginator) => {\n this.hydratePivotRelation(paginator.items())\n })\n }\n async chunk (count, callback) {\n return await this.prepareQueryBuilder().chunk(count, async (results, page) => {\n this.hydratePivotRelation(results.all())\n return await callback(results, page)\n })\n }\n setUsing (model) {\n this.using = model\n return this\n }\n as (accessor) {\n this.accessor = accessor\n return this\n }\n prepareQueryBuilder () {\n return this.query.select(this.shouldSelect())\n }\n hydratePivotRelation (models) {\n models.map(model => {\n model.setRelation(this.accessor, this.newExistingPivot(this.migratePivotAttributes(model)))\n })\n }\n migratePivotAttributes (model) {\n const values = {}\n for (const key in model.attributes) {\n const value = model.attributes[key]\n if (key.startsWith('pivot_')) {\n values[key.substring(6)] = value\n model.attributes = omit(model.attributes, [key])\n\n }\n }\n return values\n }\n withTimestamps (createdAt = null, updatedAt = null) {\n this.pivotCreatedAt = createdAt\n this.pivotUpdatedAt = updatedAt\n return this.withPivot(this.createdAt(), this.updatedAt())\n }\n shouldSelect (columns = ['*']) {\n if (isEqual(columns, ['*'])) {\n columns = [this.related.getTable() + '.*']\n }\n return columns.concat(this.aliasedPivotColumns())\n }\n aliasedPivotColumns () {\n const defaults = [this.foreignPivotKey, this.relatedPivotKey]\n return collect(defaults.concat(this.pivotColumns)).map((column) => {\n return this.qualifyPivotColumn(column) + ' as pivot_' + column\n }).unique().all()\n }\n qualifyPivotColumn (column) {\n return column.includes('.')\n ? column\n : this.getTable() + '.' + column\n }\n match (models, results, relation) {\n const dictionary = this.buildDictionary(results)\n models.map(model => {\n const key = model.getKey()\n if (dictionary[key] !== undefined) {\n model.setRelation(relation, dictionary[key])\n }\n })\n return models\n }\n buildDictionary (results) {\n const dictionary = {}\n results.map(result => {\n const value = result[this.accessor][this.foreignPivotKey]\n if (dictionary[value] === undefined) {\n dictionary[value] = new Collection([])\n }\n dictionary[value].push(result)\n })\n return dictionary\n }\n addEagerConstraints (models) {\n this.query.whereIn(this.getQualifiedForeignPivotKeyName(), this.getKeys(models, this.parentKey))\n }\n getQualifiedForeignPivotKeyName () {\n return this.qualifyPivotColumn(this.foreignPivotKey)\n }\n getQualifiedRelatedPivotKeyName () {\n return this.qualifyPivotColumn(this.relatedPivotKey)\n }\n wherePivot (column, operator = null, value = null, boolean = 'and') {\n this.pivotWheres.push(Array.prototype.slice.call(arguments))\n return this.where(this.qualifyPivotColumn(column), operator, value, boolean)\n }\n wherePivotBetween (column, values, boolean = 'and', not = false) {\n return this.whereBetween(this.qualifyPivotColumn(column), values, boolean, not)\n }\n orWherePivotBetween (column, values) {\n return this.wherePivotBetween(column, values, 'or')\n }\n wherePivotNotBetween (column, values, boolean = 'and') {\n return this.wherePivotBetween(column, values, boolean, true)\n }\n orWherePivotNotBetween (column, values) {\n return this.wherePivotBetween(column, values, 'or', true)\n }\n wherePivotIn (column, values, boolean = 'and', not = false) {\n return this.whereIn(this.qualifyPivotColumn(column), values, boolean, not)\n }\n orWherePivot (column, operator = null, value = null) {\n return this.wherePivot(column, operator, value, 'or')\n }\n orWherePivotIn (column, values) {\n return this.wherePivotIn(column, values, 'or')\n }\n wherePivotNotIn (column, values, boolean = 'and') {\n return this.wherePivotIn(column, values, boolean, true)\n }\n orWherePivotNotIn (column, values) {\n return this.wherePivotNotIn(column, values, 'or')\n }\n wherePivotNull (column, boolean = 'and', not = false) {\n return this.whereNull(this.qualifyPivotColumn(column), boolean, not)\n }\n wherePivotNotNull (column, boolean = 'and') {\n return this.wherePivotNull(column, boolean, true)\n }\n orWherePivotNull (column, not = false) {\n return this.wherePivotNull(column, 'or', not)\n }\n orWherePivotNotNull (column) {\n return this.orWherePivotNull(column, true)\n }\n orderByPivot (column, direction = 'asc') {\n return this.orderBy(this.qualifyPivotColumn(column), direction)\n }\n createdAt () {\n return this.pivotCreatedAt || this.parent.getCreatedAtColumn()\n }\n updatedAt () {\n return this.pivotUpdatedAt || this.parent.getUpdatedAtColumn()\n }\n getExistenceCompareKey () {\n return this.getQualifiedForeignPivotKeyName()\n }\n // touchIfTouching() {\n // if (this.touchingParent()) {\n // this.getParent().touch();\n // }\n // if (this.getParent().touches(this.relationName)) {\n // this.touch();\n // }\n // }\n getRelationExistenceQuery (query, parentQuery, columns = ['*']) {\n if (parentQuery.getQuery()._single.table == query.getQuery()._single.table) {\n return this.getRelationExistenceQueryForSelfJoin(query, parentQuery, columns)\n }\n this.performJoin(query)\n return super.getRelationExistenceQuery(query, parentQuery, columns)\n }\n getRelationExistenceQueryForSelfJoin (query, parentQuery, columns = ['*']) {\n const hash = this.getRelationCountHash()\n query.select(columns).from(this.related.getTable() + ' as ' + hash)\n this.related.setTable(hash)\n this.performJoin(query)\n return super.getRelationExistenceQuery(query, parentQuery, columns)\n }\n}\nexport default BelongsToMany\n","import { Collection as BaseCollection, collect } from 'collect.js'\nimport { diff as difference, isArray, isEmpty, omit, pick } from 'radashi'\n\nimport Model from './model'\n\nclass Collection extends BaseCollection {\n async load (...relations) {\n if (this.isNotEmpty()) {\n const query = this.first().constructor.query().with(...relations)\n const items = await query.eagerLoadRelations(this.items)\n return new this.constructor(items)\n }\n return this\n }\n async loadAggregate (relations, column, action = null) {\n if (this.isEmpty()) {\n return this\n }\n const models = (await this.first().newModelQuery()\n .whereIn(this.first().getKeyName(), this.modelKeys())\n .select(this.first().getKeyName())\n .withAggregate(relations, column, action)\n .get())\n .keyBy(this.first().getKeyName())\n const attributes = difference(Object.keys(models.first().getAttributes()), [models.first().getKeyName()])\n this.each((model) => {\n const extraAttributes = pick(models.get(model.getKey()).getAttributes(), attributes)\n model.fill(extraAttributes)\n .syncOriginalAttributes(attributes)\n })\n return this\n }\n loadCount (relations) {\n return this.loadAggregate(relations, '*', 'count')\n }\n loadMax (relation, column) {\n return this.loadAggregate(relation, column, 'max')\n }\n loadMin (relation, column) {\n return this.loadAggregate(relation, column, 'min')\n }\n loadSum (relation, column) {\n return this.loadAggregate(relation, column, 'sum')\n }\n loadAvg (relation, column) {\n return this.loadAggregate(relation, column, 'avg')\n }\n mapThen (callback) {\n return Promise.all(this.map(callback))\n }\n modelKeys () {\n return this.all().map(item => item.getKey())\n }\n contains (key, operator = null, value = null) {\n if (arguments.length > 1) {\n return super.contains(key, operator, value)\n }\n if (key instanceof Model) {\n return super.contains(model => {\n return model.is(key)\n })\n }\n return super.contains(model => {\n return model.getKey() == key\n })\n }\n diff (items) {\n const diff = new this.constructor\n const dictionary = this.getDictionary(items)\n this.items.map(item => {\n if (dictionary[item.getKey()] === undefined) {\n diff.add(item)\n }\n })\n return diff\n }\n except (keys) {\n const dictionary = omit(this.getDictionary(), keys)\n return new this.constructor(Object.values(dictionary))\n }\n intersect (items) {\n const intersect = new this.constructor\n if (isEmpty(items)) {\n return intersect\n }\n const dictionary = this.getDictionary(items)\n for (let item of this.items) {\n if (dictionary[item.getKey()] !== undefined) {\n intersect.add(item)\n }\n }\n return intersect\n }\n unique (key = null, strict = false) {\n if (key !== null) {\n return super.unique(key, strict)\n }\n return new this.constructor(Object.values(this.getDictionary()))\n }\n find (key, defaultValue = null) {\n // const Model = Model\n if (key instanceof Model) {\n key = key.getKey()\n }\n if (isArray(key)) {\n if (this.isEmpty()) {\n return new this.constructor\n }\n return this.whereIn(this.first().getKeyName(), key)\n }\n collect(this.items).first(model => {\n return model.getKey() == key\n })\n return this.items.filter(model => {\n return model.getKey() == key\n })[0] || defaultValue\n }\n async fresh (...args) {\n if (this.isEmpty()) {\n return new this.constructor\n }\n const model = this.first()\n const freshModels = (await model.newQuery()\n .with(...args)\n .whereIn(model.getKeyName(), this.modelKeys())\n .get())\n .getDictionary()\n return this.filter(model => {\n return model.exists && freshModels[model.getKey()] !== undefined\n }).map(model => {\n return freshModels[model.getKey()]\n })\n }\n makeVisible (attributes) {\n return this.each(item => {\n item.makeVisible(attributes)\n })\n }\n makeHidden (attributes) {\n return this.each(item => {\n item.makeHidden(attributes)\n })\n }\n append (attributes) {\n return this.each(item => {\n item.append(attributes)\n })\n }\n only (keys) {\n if (keys === null) {\n return new Collection(this.items)\n }\n const dictionary = pick(this.getDictionary(), keys)\n return new this.constructor(Object.values(dictionary))\n }\n getDictionary (items = null) {\n items = items === null ? this.items : items\n const dictionary = {}\n items.map(value => {\n dictionary[value.getKey()] = value\n })\n return dictionary\n }\n toQuery () {\n const model = this.first()\n if (!model) {\n throw new Error('Unable to create query for empty collection.')\n }\n const modelName = model.constructor.name\n if (this.filter(model => {\n return !(model instanceof modelName)\n }).isNotEmpty()) {\n throw new Error('Unable to create query for collection with mixed types.')\n }\n return model.newModelQuery().whereKey(this.modelKeys())\n }\n toData () {\n return this.all().map(item => typeof item.toData == 'function' ? item.toData() : item)\n }\n toJSON () {\n return this.toData()\n }\n toJson (...args) {\n return JSON.stringify(this.toData(), ...args)\n }\n [Symbol.iterator] () {\n const items = this.items\n let length = this.items.length\n let n = 0\n return {\n next () {\n return n < length ? {\n value: items[n++],\n done: false\n } : {\n done: true\n }\n }\n }\n }\n}\nexport default Collection\n","import { Model, Pivot } from '../../model'\nimport { diff as difference, isArray, merge } from 'radashi'\n\nimport Collection from '../../collection'\nimport { collect } from 'collect.js'\n\nconst InteractsWithPivotTable = (Relation) => {\n return class extends Relation {\n newExistingPivot (attributes = []) {\n return this.newPivot(attributes, true)\n }\n newPivot (attributes = [], exists = false) {\n const pivot = this.related.newPivot(this.parent, attributes, this.getTable(), exists, this.using)\n return pivot.setPivotKeys(this.foreignPivotKey, this.relatedPivotKey)\n }\n async attach (id, attributes = {}, touch = true) {\n if (this.using) {\n await this.attachUsingCustomClass(id, attributes)\n }\n else {\n await this.newPivotStatement().insert(this.formatAttachRecords(this.parseIds(id), attributes))\n }\n // if (touch) {\n // this.touchIfTouching();\n // }\n }\n async detach (ids = null, touch = true) {\n let results\n if (this.using &&\n ids !== null &&\n this.pivotWheres.length == 0 &&\n this.pivotWhereIns.length == 0 &&\n this.pivotWhereNulls.length == 0) {\n results = await this.detachUsingCustomClass(ids)\n }\n else {\n const query = this.newPivotQuery()\n if (ids !== null) {\n ids = this.parseIds(ids)\n if (ids.length == 0) {\n return 0\n }\n query.whereIn(this.getQualifiedRelatedPivotKeyName(), ids)\n }\n results = await query.delete()\n }\n // if (touch) {\n // this.touchIfTouching();\n // }\n return results\n }\n async sync (ids, detaching = true) {\n let changes = {\n attached: [],\n detached: [],\n updated: [],\n }\n let records\n const results = await this.getCurrentlyAttachedPivots()\n const current = results.length === 0 ? [] : results.map(result => result.toData()).pluck(this.relatedPivotKey).all().map(i => String(i))\n const detach = difference(current, Object.keys(records = this.formatRecordsList(this.parseIds(ids))))\n if (detaching && detach.length > 0) {\n await this.detach(detach)\n changes.detached = this.castKeys(detach)\n }\n changes = merge(changes, await this.attachNew(records, current, false))\n return changes\n }\n syncWithoutDetaching (ids) {\n return this.sync(ids, false)\n }\n syncWithPivotValues (ids, values, detaching = true) {\n return this.sync(collect(this.parseIds(ids)).mapWithKeys(id => {\n return [id, values]\n }), detaching)\n }\n withPivot (columns) {\n this.pivotColumns = this.pivotColumns.concat(isArray(columns) ? columns : Array.prototype.slice.call(arguments))\n return this\n }\n async attachNew (records, current, touch = true) {\n const changes = {\n attached: [],\n updated: []\n }\n for (const id in records) {\n const attributes = records[id]\n if (!current.includes(id)) {\n await this.attach(id, attributes, touch)\n changes.attached.push(this.castKey(id))\n }\n else if (Object.keys(attributes).length > 0 && await this.updateExistingPivot(id, attributes, touch)) {\n changes.updated.push(this.castKey(id))\n }\n }\n return changes\n }\n async updateExistingPivot (id, attributes, touch = true) {\n if (this.using &&\n this.pivotWheres.length > 0 &&\n this.pivotWhereInspivotWheres.length > 0 &&\n this.pivotWhereNullspivotWheres.length > 0) {\n return await this.updateExistingPivotUsingCustomClass(id, attributes, touch)\n }\n if (this.hasPivotColumn(this.updatedAt())) {\n attributes = this.addTimestampsToAttachment(attributes, true)\n }\n const updated = this.newPivotStatementForId(this.parseId(id)).update(this.castAttributes(attributes))\n // if (touch) {\n // this.touchIfTouching();\n // }\n return updated\n }\n addTimestampsToAttachment (record, exists = false) {\n let fresh = this.parent.freshTimestamp()\n if (this.using) {\n const pivotModel = new this.using\n fresh = pivotModel.fromDateTime(fresh)\n }\n if (!exists && this.hasPivotColumn(this.createdAt())) {\n record[this.createdAt()] = fresh\n }\n if (this.hasPivotColumn(this.updatedAt())) {\n record[this.updatedAt()] = fresh\n }\n return record\n }\n async updateExistingPivotUsingCustomClass (id, attributes, touch) {\n const pivot = await this.getCurrentlyAttachedPivots()\n .where(this.foreignPivotKey, this.parent[this.parentKey])\n .where(this.relatedPivotKey, this.parseId(id))\n .first()\n const updated = pivot ? pivot.fill(attributes).isDirty() : false\n if (updated) {\n await pivot.save()\n }\n // if (touch) {\n // this.touchIfTouching();\n // }\n return parseInt(updated)\n }\n formatRecordsList (records) {\n return collect(records).mapWithKeys((attributes, id) => {\n if (!isArray(attributes)) {\n [id, attributes] = [attributes, {}]\n }\n return [id, attributes]\n }).all()\n }\n async getCurrentlyAttachedPivots () {\n const query = this.newPivotQuery()\n const results = await query.get()\n return results.map(record => {\n const modelClass = this.using || Pivot\n const pivot = modelClass.fromRawAttributes(this.parent, record, this.getTable(), true)\n return pivot.setPivotKeys(this.foreignPivotKey, this.relatedPivotKey)\n })\n }\n castKeys (keys) {\n return keys.map(v => {\n return this.castKey(v)\n })\n }\n castKey (key) {\n return this.getTypeSwapValue(this.related.getKeyType(), key)\n }\n getTypeSwapValue (type, value) {\n switch (type.toLowerCase()) {\n case 'int':\n case 'integer':\n return parseInt(value)\n case 'real':\n case 'float':\n case 'double':\n return parseFloat(value)\n case 'string':\n return String(value)\n default:\n return value\n }\n }\n newPivotQuery () {\n const query = this.newPivotStatement()\n this.pivotWheres.map(args => {\n query.where(...args)\n })\n this.pivotWhereIns.map(args => {\n query.whereIn(...args)\n })\n this.pivotWhereNulls.map(args => {\n query.whereNull(...args)\n })\n return query.where(this.getQualifiedForeignPivotKeyName(), this.parent[this.parentKey])\n }\n async detachUsingCustomClass (ids) {\n let results = 0\n for (const id in this.parseIds(ids)) {\n results += await this.newPivot({\n [this.foreignPivotKey]: this.parent[this.parentKey],\n [this.relatedPivotKey]: id,\n }, true).delete()\n }\n ;\n return results\n }\n newPivotStatement () {\n const builder = this.parent.newQuery()\n builder.setTable(this.table)\n return builder\n }\n async attachUsingCustomClass (id, attributes) {\n const records = this.formatAttachRecords(this.parseIds(id), attributes)\n await Promise.all(records.map(async (record) => {\n await this.newPivot(record, false).save()\n }))\n }\n formatAttachRecords (ids, attributes) {\n const records = []\n const hasTimestamps = (this.hasPivotColumn(this.createdAt()) || this.hasPivotColumn(this.updatedAt()))\n for (const key in ids) {\n const value = ids[key]\n records.push(this.formatAttachRecord(key, value, attributes, hasTimestamps))\n }\n return records\n }\n formatAttachRecord (key, value, attributes, hasTimestamps) {\n const [id, newAttributes] = this.extractAttachIdAndAttributes(key, value, attributes)\n return merge(this.baseAttachRecord(id, hasTimestamps), newAttributes)\n }\n baseAttachRecord (id, timed) {\n let record = {}\n record[this.relatedPivotKey] = id\n record[this.foreignPivotKey] = this.parent[this.parentKey]\n if (timed) {\n record = this.addTimestampsToAttachment(record)\n }\n this.pivotValues.map(value => {\n record[value.column] = value.value\n })\n return record\n }\n extractAttachIdAndAttributes (key, value, newAttributes) {\n return isArray(value)\n ? [key, { ...value, ...newAttributes }]\n : [value, newAttributes]\n }\n hasPivotColumn = function (column) {\n return this.pivotColumns.includes(column)\n }\n parseIds (value) {\n if (value instanceof Model) {\n return [value[this.relatedKey]]\n }\n if (value instanceof Collection) {\n return value.pluck(this.relatedKey).all()\n }\n return isArray(value) ? value : [value]\n }\n }\n}\nexport default InteractsWithPivotTable\n","import { isArray } from 'radashi'\nclass BaseError extends Error {\n constructor(message, entity) {\n super(message)\n Error.captureStackTrace(this, this.constructor)\n this.name = this.constructor.name\n this.message = message\n }\n}\nclass ModelNotFoundError extends BaseError {\n model\n ids\n setModel (model, ids = []) {\n this.model = model\n this.ids = isArray(ids) ? ids : [ids]\n this.message = `No query results for model [${model}]`\n if (this.ids.length > 0) {\n this.message += ' ' + this.ids.join(', ')\n }\n else {\n this.message += '.'\n }\n return this\n }\n getModel () {\n return this.model\n }\n getIds () {\n return this.ids\n }\n}\nclass RelationNotFoundError extends BaseError {\n}\nclass InvalidArgumentError extends BaseError {\n}\nexport { ModelNotFoundError }\nexport { RelationNotFoundError }\nexport { InvalidArgumentError }\nexport default {\n ModelNotFoundError,\n RelationNotFoundError,\n InvalidArgumentError\n}\n","import { ModelNotFoundError, RelationNotFoundError } from './errors'\nimport { diff as difference, flat as flatten, isArray, isString, assign as merge, omit, snake } from 'radashi'\nimport { flattenDeep, getRelationMethod, getScopeMethod, tap } from './utils'\n\nimport { Collection as BaseCollection } from 'collect.js'\nimport BelongsToMany from './relations/belongs-to-many'\nimport Collection from './collection'\nimport Paginator from './paginator'\nimport Relation from './relations/relation'\nimport Scope from './scope'\n\nclass Builder {\n query\n connection\n model\n actions\n localMacros = {}\n eagerLoad = {}\n globalScopes = {}\n constructor(query) {\n this.query = query\n return this.asProxy()\n }\n asProxy () {\n const handler = {\n get: function (target, prop) {\n if (typeof target[prop] !== 'undefined') {\n return target[prop]\n }\n if ([\n 'select', 'from', 'where', 'orWhere', 'whereColumn', 'whereRaw',\n 'whereNot', 'orWhereNot', 'whereIn', 'orWhereIn', 'whereNotIn', 'orWhereNotIn', 'whereNull', 'orWhereNull', 'whereNotNull', 'orWhereNotNull', 'whereExists', 'orWhereExists',\n 'whereNotExists', 'orWhereNotExists', 'whereBetween', 'orWhereBetween', 'whereNotBetween', 'orWhereNotBetween',\n 'whereLike', 'orWhereLike', 'whereILike', 'orWhereILike',\n 'whereJsonObject', 'whereJsonPath', 'whereJsonSupersetOf', 'whereJsonSubsetOf',\n 'join', 'joinRaw', 'leftJoin', 'leftOuterJoin', 'rightJoin', 'rightOuterJoin', 'crossJoin',\n 'transacting', 'groupBy', 'groupByRaw', 'returning',\n 'having', 'havingRaw', 'havingBetween',\n 'limit', 'offset', 'orderBy', 'orderByRaw', // 'inRandomOrder',\n 'union', 'insert', 'forUpdate', 'forShare', 'distinct',\n 'clearOrder', 'clear', 'clearSelect', 'clearWhere', 'clearHaving', 'clearGroup',\n ].includes(prop)) {\n return (...args) => {\n target.query[prop](...args)\n return target.asProxy()\n }\n }\n if ([\n 'avg', 'max', 'min', 'sum', 'count',\n ].includes(prop)) {\n return (column) => {\n const instance = target.asProxy()\n instance.applyScopes()\n column = !column && prop === 'count' ? '*' : column\n return instance.query[prop](column)\n }\n }\n if (typeof prop === 'string') {\n if (target.hasMacro(prop)) {\n const instance = target.asProxy()\n return (...args) => {\n return instance.localMacros[prop](instance, ...args)\n }\n }\n if (target.hasNamedScope(prop)) {\n const instance = target.asProxy()\n return (...args) => {\n instance.callNamedScope(prop, args)\n return instance\n }\n }\n if (prop.startsWith('where')) {\n const column = snake(prop.substring(5))\n return (...args) => {\n target.query.where(column, ...args)\n return target.asProxy()\n }\n }\n }\n },\n }\n return new Proxy(this, handler)\n }\n orWhere (...args) {\n if (typeof args[0] === 'function') {\n const callback = args[0]\n this.query.orWhere((query) => {\n this.query = query\n callback(this)\n })\n return this\n }\n this.query.orWhere(...args)\n return this\n }\n async chunk (count, callback) {\n let page = 1\n let countResults\n do {\n this.enforceOrderBy()\n const builder = this.clone()\n const results = await builder.forPage(page, count).get()\n countResults = results.count()\n if (countResults == 0) {\n break\n }\n const bool = await callback(results, page)\n if (bool === false) {\n return false\n }\n page++\n } while (countResults === count)\n return true\n }\n enforceOrderBy () {\n if (this.query._statements.filter(item => item.grouping === 'order').length === 0) {\n this.orderBy(this.model.getQualifiedKeyName(), 'asc')\n }\n }\n clone () {\n const query = this.query.clone()\n const builder = new this.constructor(query)\n builder.connection = this.connection\n builder.setModel(this.model)\n builder.globalScopes = { ...this.globalScopes }\n builder.localMacros = { ...this.localMacros }\n builder.eagerLoad = { ...this.eagerLoad }\n return builder\n }\n forPage (page, perPage = 15) {\n return this.offset((page - 1) * perPage).limit(perPage)\n }\n insert (...args) {\n return this.query.insert(...args)\n }\n update (values) {\n this.applyScopes()\n return this.query.update(this.addUpdatedAtColumn(values))\n }\n increment (column, amount = 1, extra = {}) {\n this.applyScopes()\n const db = this.model.getConnection()\n return this.query.update(this.addUpdatedAtColumn({\n ...extra,\n [column]: db.raw(`${column} + ${amount}`),\n }))\n }\n decrement (column, amount = 1, extra = {}) {\n this.applyScopes()\n const db = this.model.getConnection()\n return this.query.update(this.addUpdatedAtColumn({\n ...extra,\n [column]: db.raw(`${column} - ${amount}`),\n }))\n }\n addUpdatedAtColumn (values) {\n if (!this.model.usesTimestamps()\n || this.model.getUpdatedAtColumn() === null) {\n return values\n }\n const column = this.model.getUpdatedAtColumn()\n values = merge({ [column]: this.model.freshTimestampString() }, values)\n return values\n }\n delete () {\n if (this.onDeleteCallback) {\n return this.onDeleteCallback(this)\n }\n return this.query.delete()\n }\n onDelete (callback) {\n this.onDeleteCallback = callback\n }\n forceDelete () {\n return this.query.delete()\n }\n async create (attributes = {}) {\n return await tap(this.newModelInstance(attributes), async (instance) => {\n await instance.save({\n client: this.query\n })\n })\n }\n newModelInstance (attributes = {}) {\n return this.model.newInstance(attributes).setConnection(this.model.getConnectionName())\n }\n getQuery () {\n return this.query\n }\n getModel () {\n return this.model\n }\n setModel (model) {\n this.model = model\n if (typeof this.query?.client?.table == 'function') {\n this.query = this.query.client.table(this.model.getTable())\n }\n else {\n this.query = this.query?.table(this.model.getTable())\n }\n return this\n }\n qualifyColumn (column) {\n return this.model.qualifyColumn(column)\n }\n setTable (table) {\n this.query = this.query.table(table)\n return this\n }\n applyScopes () {\n if (!this.globalScopes) {\n return this\n }\n const builder = this\n for (const identifier in builder.globalScopes) {\n const scope = builder.globalScopes[identifier]\n if (scope instanceof Scope) {\n scope.apply(builder, builder.getModel())\n }\n else {\n scope(builder)\n }\n }\n return builder\n }\n hasNamedScope (name) {\n return this.model && this.model.hasNamedScope(name)\n }\n callNamedScope (scope, parameters) {\n return this.model.callNamedScope(scope, [this, ...parameters])\n }\n callScope (scope, parameters = []) {\n const result = scope(this, ...parameters) || this\n return result\n }\n scopes (scopes) {\n scopes.map(scopeName => {\n const scopeMethod = getScopeMethod(scopeName)\n if (typeof this.model[scopeMethod] === 'function') {\n this.globalScopes[scopeName] = this.model[scopeMethod]\n }\n })\n return this\n }\n withGlobalScope (identifier, scope) {\n this.globalScopes[identifier] = scope\n if (typeof scope.extend === 'function') {\n scope.extend(this)\n }\n return this\n }\n withoutGlobalScope (scope) {\n if (typeof scope !== 'string') {\n scope = scope.constructor.name\n }\n this.globalScopes = omit(this.globalScopes, [scope])\n return this\n }\n macro (name, callback) {\n this.localMacros[name] = callback\n return\n }\n hasMacro (name) {\n return name in this.localMacros\n }\n getMacro (name) {\n return this.localMacros[name]\n }\n with (...args) {\n let eagerLoads = {}\n if (typeof args[1] === 'function') {\n let eagerLoad = this.parseWithRelations({\n [args[0]]: args[1]\n })\n this.eagerLoad = merge(this.eagerLoad, eagerLoad)\n return this\n }\n const relations = flattenDeep(args)\n if (relations.length === 0) {\n return this\n }\n for (const relation of relations) {\n let eagerLoad\n if (typeof relation === 'string') {\n eagerLoad = {\n [relation]: q => q,\n }\n }\n else if (typeof relation === 'object') {\n eagerLoad = relation\n }\n eagerLoads = merge(eagerLoads, eagerLoad)\n }\n this.eagerLoad = merge(this.eagerLoad, this.parseWithRelations(eagerLoads))\n return this\n }\n has (relation, operator = '>=', count = 1, boolean = 'and', callback = null) {\n if (isString(relation)) {\n if (relation.includes('.')) {\n return this.hasNested(relation, operator, count, boolean, callback)\n }\n relation = this.getRelationWithoutConstraints(getRelationMethod(relation))\n }\n const method = this.canUseExistsForExistenceCheck(operator, count)\n ? 'getRelationExistenceQuery'\n : 'getRelationExistenceCountQuery'\n const hasQuery = relation[method](relation.getRelated().newModelQuery(), this)\n if (callback) {\n callback(hasQuery)\n }\n return this.addHasWhere(hasQuery, relation, operator, count, boolean)\n }\n orHas (relation, operator = '>=', count = 1) {\n return this.has(relation, operator, count, 'or')\n }\n doesntHave (relation, boolean = 'and', callback = null) {\n return this.has(relation, '<', 1, boolean, callback)\n }\n orDoesntHave (relation) {\n return this.doesntHave(relation, 'or')\n }\n whereHas (relation, callback = null, operator = '>=', count = 1) {\n return this.has(relation, operator, count, 'and', callback)\n }\n orWhereHas (relation, callback = null, operator = '>=', count = 1) {\n return this.has(relation, operator, count, 'or', callback)\n }\n whereRelation (relation, ...args) {\n const column = args.shift()\n return this.whereHas(relation, (query) => {\n if (typeof column === 'function') {\n column(query)\n }\n else {\n query.where(column, ...args)\n }\n })\n }\n orWhereRelation (relation, ...args) {\n const column = args.shift()\n return this.orWhereHas(relation, function (query) {\n if (typeof column === 'function') {\n column(query)\n }\n else {\n query.where(column, ...args)\n }\n })\n }\n hasNested (relations, operator = '>=', count = 1, boolean = 'and', callback = null) {\n relations = relations.split('.')\n const doesntHave = operator === '<' && count === 1\n if (doesntHave) {\n operator = '>='\n count = 1\n }\n const closure = (q) => {\n relations.length > 1\n ? q.whereHas(relations.shift(), closure)\n : q.has(relations.shift(), operator, count, 'and', callback)\n }\n return this.has(relations.shift(), doesntHave ? '<' : '>=', 1, boolean, closure)\n }\n canUseExistsForExistenceCheck (operator, count) {\n return (operator === '>=' || operator === '<') && count === 1\n }\n addHasWhere (hasQuery, relation, operator, count, boolean) {\n hasQuery.mergeConstraintsFrom(relation.getQuery())\n return this.canUseExistsForExistenceCheck(operator, count)\n ? this.addWhereExistsQuery(hasQuery.getQuery(), boolean, operator === '<' && count === 1)\n : this.addWhereCountQuery(hasQuery.getQuery(), operator, count, boolean)\n }\n addWhereExistsQuery (query, boolean = 'and', not = false) {\n const type = not ? 'NotExists' : 'Exists'\n const method = boolean === 'and' ? 'where' + type : 'orWhere' + type\n this[method](query.connector)\n return this\n }\n addWhereCountQuery (query, operator = '>=', count = 1, boolean = 'and') {\n // this.query.addBinding(query.getBindings(), 'where');\n const db = this.model.getConnection()\n return this.where(db.raw('(' + query.toSQL().sql + ')'), operator, typeof count === 'number' ? db.raw(count) : count, boolean)\n }\n withAggregate (relations, column, action = null) {\n if (relations.length === 0) {\n return this\n }\n relations = flattenDeep([relations])\n let eagerLoads = {}\n for (const relation of relations) {\n let eagerLoad\n if (typeof relation === 'string') {\n eagerLoad = {\n [relation]: q => q,\n }\n }\n else if (typeof relation === 'object') {\n eagerLoad = relation\n }\n eagerLoads = merge(eagerLoads, eagerLoad)\n }\n relations = eagerLoads\n const db = this.model.getConnection()\n const columns = this.query._statements.filter(item => item.grouping == 'columns').map(item => item.value).flat()\n if (columns.length === 0) {\n this.query.select([this.query._single.table + '.*'])\n }\n const parses = this.parseWithRelations(relations)\n for (let name in parses) {\n const constraints = parses[name]\n const segments = name.split(' ')\n let alias, expression\n if (segments.length === 3 && segments[1].toLocaleLowerCase() === 'as') {\n [name, alias] = [segments[0], segments[2]]\n }\n const relation = this.getRelationWithoutConstraints(getRelationMethod(name))\n if (action) {\n const hashedColumn = this.query._single.table === relation.query.query._single.table\n ? `${relation.getRelationCountHash(false)}.${column}`\n : column\n const wrappedColumn = column === '*' ? column : relation.getRelated().qualifyColumn(hashedColumn)\n expression = action === 'exists' ? wrappedColumn : `${action}(${wrappedColumn})`\n }\n else {\n expression = column\n }\n const query = relation.getRelationExistenceQuery(relation.getRelated().newModelQuery(), this, db.raw(expression))\n constraints(query)\n alias = alias || snake(`${name} ${action} ${column}`.replace('/[^[:alnum:][:space:]_]/u', ''))\n if (action === 'exists') {\n this.select(db.raw(`exists(${query.toSql().sql}) as ${alias}`))\n }\n else {\n this.selectSub(action ? query : query.limit(1), alias)\n }\n }\n return this\n }\n toSql () {\n const query = this.clone()\n query.applyScopes()\n return query.query.toSQL()\n }\n mergeConstraintsFrom (from) {\n return this\n const whereBindings = from.getQuery().getRawBindings()['where'] || []\n const wheres = from.getQuery()._single.table !== this.getQuery()._single.table\n ? this.requalifyWhereTables(from.getQuery().wheres, from.getQuery().from, this.getModel().getTable()) : from.getQuery().wheres\n return this.where([], [])\n }\n selectSub (query, as) {\n const [querySub, bindings] = this.createSub(query)\n const db = this.model.getConnection()\n return this.select(db.raw('(' + querySub + ') as ' + as, bindings))\n }\n createSub (query) {\n return this.parseSub(query)\n }\n parseSub (query) {\n if (query instanceof Builder || query instanceof Relation) {\n return [query.toSql().sql, query.toSql().bindings]\n }\n else if (isString(query)) {\n return [query, []]\n }\n else {\n throw new Error('A subquery must be a query builder instance, a Closure, or a string.')\n }\n }\n prependDatabaseNameIfCrossDatabaseQuery (query) {\n if (query.query._single.table !== this.query._single.table) {\n const databaseName = query.query._single.table\n if (!query.query._single.table.startsWith(databaseName) && !query.query._single.table.contains('.')) {\n query.from(databaseName + '.' + query.from)\n }\n }\n return query\n }\n getRelationWithoutConstraints (relation) {\n return Relation.noConstraints(() => {\n return this.getModel()[relation]()\n })\n }\n withCount (...args) {\n return this.withAggregate(flattenDeep(args), '*', 'count')\n }\n withMax (relation, column) {\n return this.withAggregate(relation, column, 'max')\n }\n withMin (relation, column) {\n return this.withAggregate(relation, column, 'min')\n }\n withAvg (relation, column) {\n return this.withAggregate(relation, column, 'avg')\n }\n withSum (relation, column) {\n return this.withAggregate(relation, column, 'sum')\n }\n withExists (relation) {\n return this.withAggregate(relation, '*', 'exists')\n }\n parseWithRelations (relations) {\n if (relations.length === 0) {\n return []\n }\n let results = {}\n const constraintsMap = this.prepareNestedWithRelationships(relations)\n for (const name in constraintsMap) {\n results = this.addNestedWiths(name, results)\n results[name] = constraintsMap[name]\n }\n return results\n }\n addNestedWiths (name, results) {\n const progress = []\n name.split('.').map(segment => {\n progress.push(segment)\n const last = progress.join('.')\n if (results[last] === undefined) {\n results[last] = () => { }\n }\n })\n return results\n }\n prepareNestedWithRelationships (relations, prefix = '') {\n let preparedRelationships = {}\n if (prefix !== '') {\n prefix += '.'\n }\n for (const key in relations) {\n const value = relations[key]\n if (isString(value) || Number.isFinite(parseInt(value))) {\n continue\n }\n const [attribute, attributeSelectConstraint] = this.parseNameAndAttributeSelectionConstraint(key, value)\n preparedRelationships = merge(preparedRelationships, {\n [`${prefix}${attribute}`]: attributeSelectConstraint\n }, this.prepareNestedWithRelationships(value, `${prefix}${attribute}`))\n relations = omit(relations, [key])\n }\n for (const key in relations) {\n const value = relations[key]\n let attribute = key, attributeSelectConstraint = value\n if (isString(value)) {\n [attribute, attributeSelectConstraint] = this.parseNameAndAttributeSelectionConstraint(value)\n }\n preparedRelationships[`${prefix}${attribute}`] = this.combineConstraints([\n attributeSelectConstraint,\n preparedRelationships[`${prefix}${attribute}`] || (() => { }),\n ])\n }\n return preparedRelationships\n }\n combineConstraints (constraints) {\n return (builder) => {\n constraints.map(constraint => {\n builder = constraint(builder) || builder\n })\n return builder\n }\n }\n parseNameAndAttributeSelectionConstraint (name, value) {\n return name.includes(':')\n ? this.createSelectWithConstraint(name)\n : [name, value]\n }\n createSelectWithConstraint (name) {\n return [name.split(':')[0], (query) => {\n query.select(name.split(':')[1].split(',').map((column) => {\n if (column.includes('.')) {\n return column\n }\n return query instanceof BelongsToMany\n ? query.related.getTable() + '.' + column\n : column\n }))\n }]\n }\n related (relation) {\n if (typeof this.model[getRelationMethod(relation)] !== 'function') {\n const message = `Model [${this.model.constructor.name}]'s relation [${relation}] doesn't exist.`\n throw new RelationNotFoundError(message)\n }\n return this.model[getRelationMethod(relation)]()\n }\n take (...args) {\n return this.limit(...args)\n }\n skip (...args) {\n return this.offset(...args)\n }\n async first (...columns) {\n this.applyScopes()\n this.limit(1)\n let models = await this.getModels(columns)\n if (models.length > 0) {\n models = await this.eagerLoadRelations(models)\n }\n return models[0] || null\n }\n async firstOrFail (...columns) {\n const data = await this.first(...columns)\n if (data === null) {\n throw (new ModelNotFoundError).setModel(this.model.constructor.name)\n }\n return data\n }\n async findOrFail (ids, columns = '*') {\n const data = await this.find(ids, columns)\n if (isArray(ids)) {\n if (data.count() !== ids.length) {\n throw (new ModelNotFoundError).setModel(this.model.constructor.name, difference(ids, data.modelKeys()))\n }\n return data\n }\n if (data === null) {\n throw (new ModelNotFoundError).setModel(this.model.constructor.name, ids)\n }\n return data\n }\n async findOrNew (id, columns = ['*']) {\n const model = await this.find(id, columns)\n if (model !== null) {\n return model\n }\n return this.newModelInstance()\n }\n async firstOrNew (attributes = {}, values = {}) {\n const instance = await this.where(attributes).first()\n if (instance !== null) {\n return instance\n }\n return this.newModelInstance(merge(attributes, values))\n }\n async firstOrCreate (attributes = {}, values = {}) {\n const instance = await this.where(attributes).first()\n if (instance !== null) {\n return instance\n }\n return tap(this.newModelInstance(merge(attributes, values)), async (instance) => {\n await instance.save({\n client: this.query\n })\n })\n }\n async updateOrCreate (attributes, values = {}) {\n return await tap(await this.firstOrNew(attributes), async (instance) => {\n await instance.fill(values).save({\n client: this.query\n })\n })\n }\n latest (column = null) {\n if (column === null) {\n column = this.model.getCreatedAtColumn() || 'created_at'\n }\n this.query.orderBy(column, 'desc')\n return this\n }\n oldest (column = null) {\n if (column === null) {\n column = this.model.getCreatedAtColumn() || 'created_at'\n }\n this.query.orderBy(column, 'asc')\n return this\n }\n async find (id, columns = '*') {\n if (isArray(id) || id instanceof Collection) {\n return await this.findMany(id, columns)\n }\n return await this.where(this.model.getKeyName(), id).first(columns)\n }\n async findMany (ids, columns = '*') {\n if (ids instanceof Collection) {\n ids = ids.modelKeys()\n }\n ids = isArray(ids) ? ids : [ids]\n if (ids.length === 0) {\n return new Collection([])\n }\n return await this.whereIn(this.model.getKeyName(), ids).get(columns)\n }\n async pluck (column) {\n const data = await this.query.pluck(column)\n return new Collection(data)\n }\n async destroy (ids) {\n if (ids instanceof Collection) {\n ids = ids.modelKeys()\n }\n if (ids instanceof BaseCollection) {\n ids = ids.all()\n }\n ids = isArray(ids) ? ids : Array.prototype.slice.call(arguments)\n if (ids.length === 0) {\n return 0\n }\n const instance = this.model.newInstance()\n const key = instance.getKeyName()\n let count = 0\n const models = await this.model.newModelQuery().whereIn(key, ids).get()\n for (const model of models) {\n if (await model.delete()) {\n count++\n }\n }\n return count\n }\n async get (columns = '*') {\n this.applyScopes()\n let models = await this.getModels(columns)\n if (models.length > 0) {\n models = await this.eagerLoadRelations(models)\n }\n return new Collection(models)\n }\n async all (columns = '*') {\n return await this.model.newModelQuery().get(columns)\n }\n async paginate (page, perPage) {\n page = page || 1\n perPage = perPage || this?.model?.perPage || 15\n this.applyScopes()\n const query = this.query.clone()\n const total = await query.clearOrder().clearSelect().count(this.primaryKey)\n let results\n if (total > 0) {\n const skip = (page - 1) * perPage\n this.take(perPage).skip(skip)\n results = await this.getModels()\n if (results.length > 0) {\n results = await this.eagerLoadRelations(results)\n }\n }\n else {\n results = []\n }\n return new Paginator(results, parseInt(total), perPage, page)\n }\n async getModels (...columns) {\n columns = flatten(columns)\n if (columns.length > 0) {\n if (this.query._statements.filter(item => item.grouping == 'columns').length == 0 && columns[0] !== '*') {\n this.query.select(...columns)\n }\n }\n return this.hydrate(await this.query.get()).all()\n }\n getRelation (name) {\n if (typeof this.model[getRelationMethod(name)] !== 'function') {\n const message = `Model [${this.model.constructor.name}]'s relation [${name}] doesn't exist.`\n throw new RelationNotFoundError(message)\n }\n const relation = Relation.noConstraints(() => (this.model.newInstance(this.model.attributes))[getRelationMethod(name)]())\n const nested = this.relationsNestedUnder(name)\n if (Object.keys(nested).length > 0) {\n relation.query.with(nested)\n }\n return relation.asProxy()\n }\n relationsNestedUnder (relation) {\n const nested = {}\n for (const name in this.eagerLoad) {\n const constraints = this.eagerLoad[name]\n if (this.isNestedUnder(relation, name)) {\n nested[name.substring((relation + '.').length)] = constraints\n }\n }\n return nested\n }\n isNestedUnder (relation, name) {\n return name.includes('.') && name.startsWith(relation + '.')\n }\n async eagerLoadRelation (models, name, constraints) {\n const relation = this.getRelation(name)\n relation.addEagerConstraints(models)\n constraints(relation)\n return relation.match(relation.initRelation(models, name), await relation.get(), name)\n }\n async eagerLoadRelations (models) {\n for (const name in this.eagerLoad) {\n const constraints = this.eagerLoad[name]\n if (!name.includes('.')) {\n models = await this.eagerLoadRelation(models, name, constraints)\n }\n }\n return models\n }\n hydrate (items) {\n return new Collection(items.map(item => {\n if (!this.model) {\n return item\n }\n const model = this.model.newFromBuilder(item)\n return model\n }))\n }\n}\nexport default Builder\n","import Collection from './collection'\nclass Paginator {\n static formatter = null\n _items\n _total\n _perPage\n _lastPage\n _currentPage\n static setFormatter(formatter) {\n if (typeof formatter !== 'function' && formatter !== null && formatter !== undefined) {\n throw new Error('Paginator formatter must be a function or null')\n }\n this.formatter = formatter\n }\n constructor(items, total, perPage, currentPage = null, options = {}) {\n this.options = options\n for (const key in options) {\n const value = options[key]\n this[key] = value\n }\n this._total = total\n this._perPage = parseInt(perPage)\n this._lastPage = Math.max(Math.ceil(total / perPage), 1)\n this._currentPage = currentPage\n this.setItems(items)\n }\n setItems(items) {\n this._items = items instanceof Collection ? items : new Collection(items)\n this.hasMore = this._items.count() > this._perPage\n this._items = this._items.slice(0, this._perPage)\n }\n firstItem() {\n return this.count() > 0 ? (this._currentPage - 1) * this._perPage + 1 : null\n }\n lastItem() {\n return this.count() > 0 ? this.firstItem() + this.count() - 1 : null\n }\n hasMorePages() {\n return this._currentPage < this._lastPage\n }\n get(index) {\n return this._items.get(index)\n }\n count() {\n return this._items.count()\n }\n items() {\n return this._items\n }\n map(callback) {\n return this._items.map(callback)\n }\n currentPage() {\n return this._currentPage\n }\n onFirstPage() {\n return this._currentPage === 1\n }\n perPage() {\n return this._perPage\n }\n lastPage() {\n return this._lastPage\n }\n total() {\n return this._total\n }\n toData() {\n if (this.constructor.formatter && typeof this.constructor.formatter === 'function') {\n return this.constructor.formatter(this)\n }\n return {\n current_page: this._currentPage,\n data: this._items.toData(),\n per_page: this._perPage,\n total: this._total,\n last_page: this._lastPage,\n count: this.count(),\n }\n }\n toJSON() {\n return this.toData()\n }\n toJson(...args) {\n return JSON.stringify(this.toData(), ...args)\n }\n}\nexport default Paginator\n","class Scope {\n constructor() {\n if (this.constructor === Scope) {\n throw new Error('Scope cannot be instantiated')\n }\n }\n apply(builder, model) {\n throw new Error('apply not implemented')\n }\n}\nexport default Scope\n","import { flat as flatten, omit } from 'radashi'\nimport { flattenDeep, getAttrMethod, getGetterMethod, getSetterMethod } from '../utils'\n\nimport CastsAttributes from '../casts-attributes'\nimport collect from 'collect.js'\nimport dayjs from 'dayjs'\n\nconst HasAttributes = (Model) => {\n return class extends Model {\n static castTypeCache = {}\n attributes = {}\n original = {}\n casts = {}\n changes = {}\n appends = []\n setAppends (appends) {\n this.appends = appends\n return this\n }\n append (...keys) {\n const appends = flattenDeep(keys)\n this.appends = [...this.appends, ...appends]\n return this\n }\n normalizeCastClassResponse (key, value) {\n return value?.constructor?.name === 'Object'\n ? value\n : {\n [key]: value\n }\n }\n syncOriginal () {\n this.original = this.getAttributes()\n return this\n }\n syncChanges () {\n this.changes = this.getDirty()\n return this\n }\n syncOriginalAttribute (attribute) {\n this.syncOriginalAttributes(attribute)\n }\n syncOriginalAttributes (...attributes) {\n attributes = flattenDeep(attributes)\n const modelAttributes = this.getAttributes()\n for (const attribute of attributes) {\n this.original[attribute] = modelAttributes[attribute]\n }\n return this\n }\n isDirty (...attributes) {\n const changes = this.getDirty()\n attributes = flattenDeep(attributes)\n if (attributes.length === 0) {\n return Object.keys(changes).length > 0\n }\n for (const attribute of attributes) {\n if (attribute in changes) {\n return true\n }\n }\n return false\n }\n getDirty () {\n const dirty = {}\n const attributes = this.getAttributes()\n for (const key in attributes) {\n const value = attributes[key]\n if (!this.originalIsEquivalent(key)) {\n dirty[key] = value\n }\n }\n return dirty\n }\n originalIsEquivalent (key) {\n if (this.original[key] === undefined) {\n return false\n }\n const attribute = this.attributes[key]\n const original = this.original[key]\n if (attribute === original) {\n return true\n }\n else {\n return false\n }\n }\n setAttributes (attributes) {\n this.attributes = { ...attributes }\n }\n setRawAttributes (attributes, sync = false) {\n this.attributes = attributes\n if (sync) {\n this.syncOriginal()\n }\n return this\n }\n getAttributes () {\n return { ...this.attributes }\n }\n setAttribute (key, value) {\n const setterMethod = getSetterMethod(key)\n if (typeof this[setterMethod] === 'function') {\n this[setterMethod](value)\n return this\n }\n const attrMethod = getAttrMethod(key)\n if (typeof this[attrMethod] === 'function') {\n const attribute = this[attrMethod]()\n const callback = attribute.set || ((value) => {\n this.attributes[key] = value\n })\n this.attributes = {\n ...this.attributes,\n ...this.normalizeCastClassResponse(key, callback(value, this.attributes))\n }\n return this\n }\n const casts = this.getCasts()\n const castType = casts[key]\n if (this.isCustomCast(castType)) {\n value = castType.set(this, key, value, this.attributes)\n }\n if (castType === 'json') {\n value = JSON.stringify(value)\n }\n if (castType === 'collection') {\n value = JSON.stringify(value)\n }\n if (value !== null && this.isDateAttribute(key)) {\n value = this.fromDateTime(value)\n }\n this.attributes[key] = value\n return this\n }\n getAttribute (key) {\n if (!key) {\n return\n }\n const getterMethod = getGetterMethod(key)\n if (typeof this[getterMethod] === 'function') {\n return this[getterMethod](this.attributes[key], this.attributes)\n }\n const attrMethod = getAttrMethod(key)\n if (typeof this[attrMethod] === 'function') {\n const caster = this[attrMethod]()\n return caster.get(this.attributes[key], this.attributes)\n }\n if (key in this.attributes) {\n if (this.hasCast(key)) {\n return this.castAttribute(key, this.attributes[key])\n }\n if (this.getDates().includes(key)) {\n return this.asDateTime(this.attributes[key])\n }\n return this.attributes[key]\n }\n if (key in this.relations) {\n return this.relations[key]\n }\n return\n }\n castAttribute (key, value) {\n const castType = this.getCastType(key)\n if (!castType) {\n return value\n }\n if (value === null) {\n return value\n }\n switch (castType) {\n case 'int':\n case 'integer':\n return parseInt(value)\n case 'real':\n case 'float':\n case 'double':\n return parseFloat(value)\n case 'decimal':\n return this.asDecimal(value, castType.split(':')[1])\n case 'string':\n return String(value)\n case 'bool':\n case 'boolean':\n return Boolean(value)\n case 'object':\n case 'json':\n try {\n return JSON.parse(value)\n }\n catch (e) {\n return null\n }\n case 'collection':\n try {\n return collect(JSON.parse(value))\n }\n catch (e) {\n return collect([])\n }\n case 'date':\n return this.asDate(value)\n case 'datetime':\n case 'custom_datetime':\n return this.asDateTime(value)\n case 'timestamp':\n return this.asTimestamp(value)\n }\n if (this.isCustomCast(castType)) {\n return castType.get(this, key, value, this.attributes)\n }\n return value\n }\n attributesToData () {\n let attributes = { ...this.attributes }\n for (const key in attributes) {\n if (this.hidden.includes(key)) {\n attributes = omit(attributes, [key])\n }\n if (this.visible.length > 0 && this.visible.includes(key) === false) {\n attributes = omit(attributes, [key])\n }\n }\n for (const key of this.getDates()) {\n if (attributes[key] === undefined) {\n continue\n }\n attributes[key] = this.serializeDate(this.asDateTime(attributes[key]))\n }\n const casts = this.getCasts()\n for (const key in casts) {\n const value = casts[key]\n if ((key in attributes) === false) {\n continue\n }\n attributes[key] = this.castAttribute(key, attributes[key])\n if (key in attributes && ['date', 'datetime'].includes(value)) {\n attributes[key] = this.serializeDate(attributes[key])\n }\n if (key in attributes && this.isCustomDateTimeCast(value)) {\n attributes[key] = dayjs(attributes[key]).format(value.split(':')[1])\n }\n }\n for (const key of this.appends) {\n attributes[key] = this.mutateAttribute(key, null)\n }\n return attributes\n }\n mutateAttribute (key, value) {\n if (typeof this[getGetterMethod(key)] === 'function') {\n return this[getGetterMethod(key)](value)\n }\n else if (typeof this[getAttrMethod(key)] === 'function') {\n const caster = this[getAttrMethod(key)]()\n return caster.get(key, this.attributes)\n }\n else if (key in this) {\n return this[key]\n }\n return value\n }\n mutateAttributeForArray (key, value) {\n }\n isDateAttribute (key) {\n return this.getDates().includes(key) || this.isDateCastable(key)\n }\n serializeDate (date) {\n return date ? dayjs(date).toISOString() : null\n }\n getDates () {\n return this.usesTimestamps() ? [\n this.getCreatedAtColumn(),\n this.getUpdatedAtColumn(),\n ] : []\n }\n getCasts () {\n if (this.getIncrementing()) {\n return {\n [this.getKeyName()]: this.getKeyType(),\n ...this.casts\n }\n }\n return this.casts\n }\n getCastType (key) {\n const castType = this.getCasts()[key]\n let castTypeCacheKey\n if (typeof castType === 'string') {\n castTypeCacheKey = castType\n }\n else if ((new castType) instanceof CastsAttributes) {\n castTypeCacheKey = castType.name\n }\n if (castTypeCacheKey && this.constructor.castTypeCache[castTypeCacheKey] !== undefined) {\n return this.constructor.castTypeCache[castTypeCacheKey]\n }\n let convertedCastType\n if (this.isCustomDateTimeCast(castType)) {\n convertedCastType = 'custom_datetime'\n }\n else if (this.isDecimalCast(castType)) {\n convertedCastType = 'decimal'\n }\n else if (this.isCustomCast(castType)) {\n convertedCastType = castType\n }\n else {\n convertedCastType = castType.toLocaleLowerCase().trim()\n }\n return this.constructor.castTypeCache[castTypeCacheKey] = convertedCastType\n }\n hasCast (key, types = []) {\n if (key in this.casts) {\n types = flatten(types)\n return types.length > 0 ? types.includes(this.getCastType(key)) : true\n }\n return false\n }\n withDayjs (date) {\n return dayjs(date)\n }\n isCustomCast (cast) {\n return typeof cast === 'function' && (new cast) instanceof CastsAttributes\n }\n isCustomDateTimeCast (cast) {\n if (typeof cast !== 'string') {\n return false\n }\n return cast.startsWith('date:') || cast.startsWith('datetime:')\n }\n isDecimalCast (cast) {\n if (typeof cast !== 'string') {\n return false\n }\n return cast.startsWith('decimal:')\n }\n isDateCastable (key) {\n return this.hasCast(key, ['date', 'datetime'])\n }\n fromDateTime (value) {\n return dayjs(this.asDateTime(value)).format(this.getDateFormat())\n }\n getDateFormat () {\n return this.dateFormat || 'YYYY-MM-DD HH:mm:ss'\n }\n asDecimal (value, decimals) {\n return parseFloat(value).toFixed(decimals)\n }\n asDateTime (value) {\n if (value === null) {\n return null\n }\n if (value instanceof Date) {\n return value\n }\n if (typeof value === 'number') {\n return new Date(value * 1000)\n }\n return new Date(value)\n }\n asDate (value) {\n const date = this.asDateTime(value)\n return dayjs(date).startOf('day').toDate()\n }\n }\n}\nexport default HasAttributes\n","class CastsAttributes {\n constructor() {\n if (this.constructor === CastsAttributes) {\n throw new Error('CastsAttributes cannot be instantiated')\n }\n }\n static get() {\n throw new Error('get not implemented')\n }\n static set() {\n throw new Error('set not implemented')\n }\n}\nexport default CastsAttributes\n","import { get, set } from 'radashi'\n\nimport { InvalidArgumentError } from '../errors'\nimport Scope from '../scope'\n\nconst HasGlobalScopes = (Model) => {\n return class extends Model {\n static addGlobalScope (scope, implementation = null) {\n if (typeof scope === 'string' && implementation instanceof Scope) {\n this.globalScopes = set(this.globalScopes, this.name + '.' + scope, implementation)\n return implementation\n }\n else if (scope instanceof Scope) {\n this.globalScopes = set(this.globalScopes, this.name + '.' + scope.constructor.name, scope)\n return scope\n }\n throw new InvalidArgumentError('Global scope must be an instance of Scope.')\n }\n static hasGlobalScope (scope) {\n return this.getGlobalScope(scope) !== null\n }\n static getGlobalScope (scope) {\n if (typeof scope === 'string') {\n return get(this.globalScopes, this.name + '.' + scope)\n }\n return get(this.globalScopes, this.name + '.' + scope.constructor.name)\n }\n static getAllGlobalScopes () {\n return this.globalScopes\n }\n static setAllGlobalScopes (scopes) {\n this.globalScopes = scopes\n }\n getGlobalScopes () {\n return get(this.constructor.globalScopes, this.constructor.name, {})\n }\n }\n}\nexport default HasGlobalScopes\n","class Hooks {\n hooks = {\n creating: [],\n created: [],\n updating: [],\n updated: [],\n saving: [],\n saved: [],\n deleting: [],\n deleted: [],\n restoring: [],\n restored: [],\n trashed: [],\n forceDeleting: [],\n forceDeleted: [],\n }\n add(hook, callback) {\n if (typeof this.hooks[hook] === 'undefined') {\n this.hooks[hook] = []\n }\n this.hooks[hook].push(callback)\n }\n async exec(hook, data) {\n if (typeof this.hooks[hook] === 'undefined') {\n return true\n }\n for (const callback of this.hooks[hook]) {\n await callback(...data)\n }\n return true\n }\n}\nexport default Hooks\n","import Hooks from '../hooks'\n\nconst HasHooks = (Model) => {\n return class extends Model {\n static hooks = null\n static addHook (hook, callback) {\n if (this.hooks instanceof Hooks === false) {\n this.hooks = new Hooks\n }\n this.hooks.add(hook, callback)\n }\n static creating (callback) {\n this.addHook('creating', callback)\n }\n static created (callback) {\n this.addHook('created', callback)\n }\n static updating (callback) {\n this.addHook('updating', callback)\n }\n static updated (callback) {\n this.addHook('updated', callback)\n }\n static saving (callback) {\n this.addHook('saving', callback)\n }\n static saved (callback) {\n this.addHook('saved', callback)\n }\n static deleting (callback) {\n this.addHook('deleting', callback)\n }\n static deleted (callback) {\n this.addHook('deleted', callback)\n }\n static restoring (callback) {\n this.addHook('restoring', callback)\n }\n static restored (callback) {\n this.addHook('restored', callback)\n }\n static trashed (callback) {\n this.addHook('trashed', callback)\n }\n static forceDeleted (callback) {\n this.addHook('forceDeleted', callback)\n }\n async execHooks (hook, options) {\n if (this.constructor.hooks instanceof Hooks === false) {\n return\n }\n return await this.constructor.hooks.exec(hook, [this, options])\n }\n }\n}\nexport default HasHooks\n","import Collection from '../collection'\nimport collect from 'collect.js'\nimport { tap } from '../utils'\nconst HasOneOrMany = (Relation) => {\n return class extends Relation {\n getRelationValue (dictionary, key, type) {\n const value = dictionary[key]\n return type === 'one' ? value[0] : new Collection(value)\n }\n matchOneOrMany (models, results, relation, type) {\n const dictionary = this.buildDictionary(results)\n models.map(model => {\n const key = model.attributes[this.localKey]\n if (dictionary[key] !== undefined) {\n model.setRelation(relation, this.getRelationValue(dictionary, key, type))\n }\n })\n return models\n }\n buildDictionary (results) {\n const foreign = this.getForeignKeyName()\n return collect(results).mapToDictionary(result => [\n result[foreign], result\n ]).all()\n }\n async save (model) {\n this.setForeignAttributesForCreate(model)\n return await model.save() ? model : false\n }\n async saveMany (models) {\n await Promise.all(models.map(async (model) => {\n await this.save(model)\n }))\n return models instanceof Collection ? models : new Collection(models)\n }\n async create (attributes = {}) {\n return await tap(this.related.constructor.init(attributes), async (instance) => {\n this.setForeignAttributesForCreate(instance)\n await instance.save()\n })\n }\n async createMany (records) {\n const instances = await Promise.all(records.map(async (record) => {\n return await this.create(record)\n }))\n return instances instanceof Collection ? instances : new Collection(instances)\n }\n setForeignAttributesForCreate (model) {\n model[this.getForeignKeyName()] = this.getParentKey()\n }\n getForeignKeyName () {\n const segments = this.getQualifiedForeignKeyName().split('.')\n return segments[segments.length - 1]\n }\n getParentKey () {\n return this.parent.attributes[this.localKey]\n }\n getQualifiedForeignKeyName () {\n return this.foreignKey\n }\n getExistenceCompareKey () {\n return this.getQualifiedForeignKeyName()\n }\n addConstraints () {\n if (this.constructor.constraints) {\n const query = this.getRelationQuery()\n query.where(this.foreignKey, '=', this.getParentKey())\n query.whereNotNull(this.foreignKey)\n }\n }\n }\n}\nexport default HasOneOrMany\n","import Collection from '../collection'\nimport HasOneOrMany from './has-one-or-many'\nimport Relation from './relation'\nimport { collect } from 'collect.js'\nimport { compose } from '../utils'\nclass HasMany extends compose(Relation, HasOneOrMany) {\n foreignKey\n localKey\n constructor(query, parent, foreignKey, localKey) {\n super(query, parent)\n this.foreignKey = foreignKey\n this.localKey = localKey\n this.addConstraints()\n return this.asProxy()\n }\n initRelation (models, relation) {\n models.map(model => {\n model.setRelation(relation, new Collection([]))\n })\n return models\n }\n async getResults () {\n return this.getParentKey() !== null\n ? await this.query.get()\n : new Collection([])\n }\n getForeignKeyName () {\n const segments = this.foreignKey.split('.')\n return segments.pop()\n }\n buildDictionary (results) {\n const foreign = this.getForeignKeyName()\n return collect(results).mapToDictionary(result => [\n result[foreign], result\n ]).all()\n }\n match (models, results, relation) {\n return this.matchOneOrMany(models, results, relation, 'many')\n }\n addEagerConstraints (models) {\n this.query.whereIn(this.foreignKey, this.getKeys(models, this.localKey))\n }\n}\nexport default HasMany\n","import HasOneOrMany from './has-one-or-many'\nimport Relation from './relation'\nimport SupportsDefaultModels from './concerns/supports-default-models'\nimport { compose } from '../utils'\nclass HasOne extends compose(Relation, HasOneOrMany, SupportsDefaultModels) {\n foreignKey\n localKey\n constructor(query, parent, foreignKey, localKey) {\n super(query, parent)\n this.foreignKey = foreignKey\n this.localKey = localKey\n this.addConstraints()\n return this.asProxy()\n }\n initRelation (models, relation) {\n models.map(model => {\n model.setRelation(relation, this.getDefaultFor(model))\n })\n return models\n }\n matchOne (models, results, relation) {\n return this.matchOneOrMany(models, results, relation, 'one')\n }\n getForeignKeyName () {\n const segments = this.foreignKey.split('.')\n return segments.pop()\n }\n async getResults () {\n if (this.getParentKey() === null) {\n return this.getDefaultFor(this.parent)\n }\n const results = await this.query.first()\n return results || this.getDefaultFor(this.parent)\n }\n match (models, results, relation) {\n return this.matchOneOrMany(models, results, relation, 'one')\n }\n addEagerConstraints (models) {\n this.query.whereIn(this.foreignKey, this.getKeys(models, this.localKey))\n }\n newRelatedInstanceFor (parent) {\n return this.related.newInstance().setAttribute(this.getForeignKeyName(), parent[this.localKey])\n }\n}\nexport default HasOne\n","import { ModelNotFoundError } from '../errors'\nimport Relation from './relation'\nimport { isArray } from 'radashi'\nimport { tap } from '../utils'\nclass HasManyThrough extends Relation {\n throughParent\n farParent\n firstKey\n secondKey\n localKey\n secondLocalKey\n constructor(query, farParent, throughParent, firstKey, secondKey, localKey, secondLocalKey) {\n super(query, throughParent)\n this.localKey = localKey\n this.firstKey = firstKey\n this.secondKey = secondKey\n this.farParent = farParent\n this.throughParent = throughParent\n this.secondLocalKey = secondLocalKey\n return this.asProxy()\n }\n addConstraints () {\n const localValue = this.farParent[this.localKey]\n this.performJoin()\n if (this.constructor.constraints) {\n this.query.where(this.getQualifiedFirstKeyName(), '=', localValue)\n }\n }\n performJoin (query = null) {\n query = query || this.query\n const farKey = this.getQualifiedFarKeyName()\n query.join(this.throughParent.getTable(), this.getQualifiedParentKeyName(), '=', farKey)\n if (this.throughParentSoftDeletes()) {\n query.withGlobalScope('SoftDeletableHasManyThrough', (query) => {\n query.whereNull(this.throughParent.getQualifiedDeletedAtColumn())\n })\n }\n }\n getQualifiedParentKeyName () {\n return this.parent.qualifyColumn(this.secondLocalKey)\n }\n throughParentSoftDeletes () {\n return this.throughParent.pluginInitializers['SoftDeletes'] !== undefined\n }\n withTrashedParents () {\n this.query.withoutGlobalScope('SoftDeletableHasManyThrough')\n return this\n }\n addEagerConstraints (models) {\n const whereIn = this.whereInMethod(this.farParent, this.localKey)\n this.whereInEager(whereIn, this.getQualifiedFirstKeyName(), this.getKeys(models, this.localKey))\n }\n initRelation (models, relation) {\n for (const model of models) {\n model.setRelation(relation, this.related.newCollection())\n }\n return models\n }\n match (models, results, relation) {\n const dictionary = this.buildDictionary(results)\n for (const model of models) {\n if (dictionary[key = this.getDictionaryKey(model.getAttribute(this.localKey))] !== undefined) {\n model.setRelation(relation, this.related.newCollection(dictionary[key]))\n }\n }\n return models\n }\n buildDictionary (results) {\n const dictionary = {}\n for (const result of results) {\n if (dictionary[result.laravel_through_key] === undefined) {\n dictionary[result.laravel_through_key] = []\n }\n dictionary[result.laravel_through_key].push(result)\n }\n return dictionary\n }\n async firstOrNew (attributes) {\n let instance = await this.where(attributes).first()\n return instance || this.related.newInstance(attributes)\n }\n async updateOrCreate (attributes, values = {}) {\n return tap(await this.firstOrCreate(attributes, values), async (instance) => {\n if (!instance.wasRecentlyCreated) {\n await instance.fill(values).save()\n }\n })\n }\n async firstWhere (column, operator = null, value = null, boolean = 'and') {\n return await this.where(column, operator, value, boolean).first()\n }\n async first (columns = ['*']) {\n const results = await this.take(1).get(columns)\n return results.count() > 0 ? results.first() : null\n }\n async firstOrFail (columns = ['*']) {\n const model = await this.first(columns)\n if (model) {\n return model\n }\n throw (new ModelNotFoundError).setModel(this.related.constructor)\n }\n async firstOr (columns = ['*'], callback = null) {\n if (typeof columns === 'function') {\n callback = columns\n columns = ['*']\n }\n const model = await this.first(columns)\n if (model) {\n return model\n }\n return callback()\n }\n async find (id, columns = ['*']) {\n if (isArray(id)) {\n return await this.findMany(id, columns)\n }\n return await this.where(this.getRelated().getQualifiedKeyName(), '=', id).first(columns)\n }\n async findMany (ids, columns = ['*']) {\n if (ids.length === 0) {\n return this.getRelated().newCollection()\n }\n return await this.whereIn(this.getRelated().getQualifiedKeyName(), ids).get(columns)\n }\n async findOrFail (id, columns = ['*']) {\n const result = await this.find(id, columns)\n if (isArray(id)) {\n if (result.count() === id.length) {\n return result\n }\n }\n else if (result) {\n return result\n }\n throw (new ModelNotFoundError).setModel(this.related.constructor, id)\n }\n async getResults () {\n return this.farParent[this.localKey]\n ? await this.get()\n : this.related.newCollection()\n }\n async get (columns = ['*']) {\n const builder = this.prepareQueryBuilder(columns)\n let models = await builder.getModels()\n if (models.count() > 0) {\n models = await builder.eagerLoadRelations(models)\n }\n return this.related.newCollection(models)\n }\n async paginate (perPage = null, columns = ['*'], pageName = 'page', page = null) {\n this.query.addSelect(this.shouldSelect(columns))\n return await this.query.paginate(perPage, columns, pageName, page)\n }\n shouldSelect (columns = ['*']) {\n if (columns == ['*']) {\n columns = [this.related.getTable() + '.*']\n }\n return [...columns, this.getQualifiedFirstKeyName() + ' as laravel_through_key']\n }\n async chunk (count, callback) {\n return await this.prepareQueryBuilder().chunk(count, callback)\n }\n prepareQueryBuilder (columns = ['*']) {\n const builder = this.query.applyScopes()\n return builder.addSelect(this.shouldSelect(builder.getQuery().columns ? [] : columns))\n }\n getRelationExistenceQuery (query, parentQuery, columns = ['*']) {\n if (parentQuery.getQuery().from === query.getQuery().from) {\n return this.getRelationExistenceQueryForSelfRelation(query, parentQuery, columns)\n }\n if (parentQuery.getQuery().from === this.throughParent.getTable()) {\n return this.getRelationExistenceQueryForThroughSelfRelation(query, parentQuery, columns)\n }\n this.performJoin(query)\n return query.select(columns).where(this.getQualifiedLocalKeyName(), '=', this.getQualifiedFirstKeyName())\n }\n getRelationExistenceQueryForSelfRelation (query, parentQuery, columns = ['*']) {\n const hash = this.getRelationCountHash()\n query.from(query.getModel().getTable() + ' as ' + hash)\n query.join(this.throughParent.getTable(), this.getQualifiedParentKeyName(), '=', hash + '.' + this.secondKey)\n if (this.throughParentSoftDeletes()) {\n query.whereNull(this.throughParent.getQualifiedDeletedAtColumn())\n }\n query.getModel().setTable(hash)\n return query.select(columns).whereColumn(parentQuery.getQuery().from + '.' + this.localKey, '=', this.getQualifiedFirstKeyName())\n }\n getRelationExistenceQueryForThroughSelfRelation (query, parentQuery, columns = ['*']) {\n const hash = this.getRelationCountHash()\n const table = this.throughParent.getTable() + ' as ' + hash\n query.join(table, hash + '.' + this.secondLocalKey, '=', this.getQualifiedFarKeyName())\n if (this.throughParentSoftDeletes()) {\n query.whereNull(hash + '.' + this.throughParent.getDeletedAtColumn())\n }\n return query.select(columns).where(parentQuery.getQuery().from + '.' + this.localKey, '=', hash + '.' + this.firstKey)\n }\n getQualifiedFarKeyName () {\n return this.getQualifiedForeignKeyName()\n }\n getFirstKeyName () {\n return this.firstKey\n }\n getQualifiedFirstKeyName () {\n return this.throughParent.qualifyColumn(this.firstKey)\n }\n getForeignKeyName () {\n return this.secondKey\n }\n getQualifiedForeignKeyName () {\n return this.related.qualifyColumn(this.secondKey)\n }\n getLocalKeyName () {\n return this.localKey\n }\n getQualifiedLocalKeyName () {\n return this.farParent.qualifyColumn(this.localKey)\n }\n getSecondLocalKeyName () {\n return this.secondLocalKey\n }\n}\nexport default HasManyThrough\n","import HasManyThrough from './has-many-through'\nimport SupportsDefaultModels from './concerns/supports-default-models'\nimport { compose } from '../utils'\nclass HasOneThrough extends compose(HasManyThrough, SupportsDefaultModels) {\n async getResults () {\n return (await this.first()) || this.getDefaultFor(this.farParent)\n }\n initRelation (models, relation) {\n for (const model of models) {\n model.setRelation(relation, this.getDefaultFor(model))\n }\n return models\n }\n match (models, results, relation) {\n const dictionary = this.buildDictionary(results)\n for (const model of models) {\n const key = this.getDictionaryKey(model.getAttribute(this.localKey))\n if (dictionary[key] !== undefined) {\n const value = dictionary[key]\n model.setRelation(relation, value[0])\n }\n }\n return models\n }\n newRelatedInstanceFor (parent) {\n return this.related.newInstance()\n }\n}\nexport default HasOneThrough\n","import { getRelationMethod, getRelationName, snakeCase } from '../utils'\n\nimport BelongsTo from '../relations/belongs-to'\nimport BelongsToMany from '../relations/belongs-to-many'\nimport HasMany from '../relations/has-many'\nimport HasManyThrough from '../relations/has-many-through'\nimport HasOne from '../relations/has-one'\nimport HasOneThrough from '../relations/has-one-through'\nimport { RelationNotFoundError } from '../errors'\nimport { omit } from 'radashi'\n\nconst HasRelations = (Model) => {\n return class extends Model {\n relations = {}\n getRelation (relation) {\n return this.relations[relation]\n }\n setRelation (relation, value) {\n this.relations[relation] = value\n return this\n }\n unsetRelation (relation) {\n this.relations = omit(this.relations, [relation])\n return this\n }\n relationLoaded (relation) {\n return this.relations[relation] !== undefined\n }\n related (relation) {\n if (typeof this[getRelationMethod(relation)] !== 'function') {\n const message = `Model [${this.constructor.name}]'s relation [${relation}] doesn't exist.`\n throw new RelationNotFoundError(message)\n }\n return this[getRelationMethod(relation)]()\n }\n async getRelated (relation) {\n return await this.related(relation).getResults()\n }\n relationsToData () {\n const data = {}\n for (const key in this.relations) {\n if (this.hidden.includes(key)) {\n continue\n }\n if (this.visible.length > 0 && this.visible.includes(key) === false) {\n continue\n }\n data[key] = this.relations[key] instanceof Array\n ? this.relations[key].map(item => item.toData())\n : this.relations[key] === null\n ? null\n : this.relations[key].toData()\n }\n return data\n }\n guessBelongsToRelation () {\n let e = new Error()\n let frame = e.stack.split('\\n')[2]\n // let lineNumber = frame.split(\":\").reverse()[1];\n let functionName = frame.split(' ')[5]\n return getRelationName(functionName)\n }\n joiningTable (related, instance = null) {\n const segments = [\n instance ? instance.joiningTableSegment() : snakeCase(related.name),\n this.joiningTableSegment(),\n ]\n return segments.sort().join('_').toLocaleLowerCase()\n }\n joiningTableSegment () {\n return snakeCase(this.constructor.name)\n }\n hasOne (related, foreignKey = null, localKey = null) {\n const query = related.query()\n const instance = new related\n foreignKey = foreignKey || this.getForeignKey()\n localKey = localKey || this.getKeyName()\n return (new HasOne(query, this, instance.getTable() + '.' + foreignKey, localKey))\n }\n hasMany (related, foreignKey = null, localKey = null) {\n const query = related.query()\n const instance = new related\n foreignKey = foreignKey || this.getForeignKey()\n localKey = localKey || this.getKeyName()\n return (new HasMany(query, this, instance.getTable() + '.' + foreignKey, localKey))\n }\n belongsTo (related, foreignKey = null, ownerKey = null, relation = null) {\n const query = related.query()\n const instance = new related\n foreignKey = foreignKey || instance.getForeignKey()\n ownerKey = ownerKey || instance.getKeyName()\n relation = relation || this.guessBelongsToRelation()\n return (new BelongsTo(query, this, foreignKey, ownerKey, relation))\n }\n belongsToMany (related, table = null, foreignPivotKey = null, relatedPivotKey = null, parentKey = null, relatedKey = null) {\n const query = related.query()\n const instance = new related\n table = table || this.joiningTable(related, instance)\n foreignPivotKey = foreignPivotKey || this.getForeignKey()\n relatedPivotKey = relatedPivotKey || instance.getForeignKey()\n parentKey = parentKey || this.getKeyName()\n relatedKey = relatedKey || instance.getKeyName()\n return (new BelongsToMany(query, this, table, foreignPivotKey, relatedPivotKey, parentKey, relatedKey))\n }\n hasOneThrough (related, through, firstKey = null, secondKey = null, localKey = null, secondLocalKey = null) {\n through = new through\n const query = related.query()\n firstKey = firstKey || this.getForeignKey()\n secondKey = secondKey || through.getForeignKey()\n return (new HasOneThrough(query, this, through, firstKey, secondKey, localKey || this.getKeyName(), secondLocalKey || through.getKeyName()))\n }\n hasManyThrough (related, through, firstKey = null, secondKey = null, localKey = null, secondLocalKey = null) {\n through = new through\n const query = related.query()\n firstKey = firstKey || this.getForeignKey()\n secondKey = secondKey || through.getForeignKey()\n return (new HasManyThrough(query, this, through, firstKey, secondKey, localKey || this.getKeyName(), secondLocalKey || through.getKeyName()))\n }\n }\n}\nexport default HasRelations\n","const HasTimestamps = (Model) => {\n return class extends Model {\n static CREATED_AT = 'created_at'\n static UPDATED_AT = 'updated_at'\n static DELETED_AT = 'deleted_at'\n timestamps = true\n dateFormat = 'YYYY-MM-DD HH:mm:ss'\n usesTimestamps() {\n return this.timestamps\n }\n updateTimestamps() {\n const time = this.freshTimestampString()\n const updatedAtColumn = this.getUpdatedAtColumn()\n if (updatedAtColumn && !this.isDirty(updatedAtColumn)) {\n this.setUpdatedAt(time)\n }\n const createdAtColumn = this.getCreatedAtColumn()\n if (!this.exists && createdAtColumn && !this.isDirty(createdAtColumn)) {\n this.setCreatedAt(time)\n }\n return this\n }\n getCreatedAtColumn() {\n return this.constructor.CREATED_AT\n }\n getUpdatedAtColumn() {\n return this.constructor.UPDATED_AT\n }\n setCreatedAt(value) {\n this.attributes[this.getCreatedAtColumn()] = value\n return this\n }\n setUpdatedAt(value) {\n this.attributes[this.getUpdatedAtColumn()] = value\n return this\n }\n freshTimestamp() {\n const time = new Date\n time.setMilliseconds(0)\n return time\n }\n freshTimestampString() {\n return this.fromDateTime(this.freshTimestamp())\n }\n }\n}\nexport default HasTimestamps\n","import { diff as difference } from 'radashi'\nimport { flattenDeep } from '../utils'\n\nconst HidesAttributes = (Model) => {\n return class extends Model {\n hidden = []\n visible = []\n makeVisible (...keys) {\n const visible = flattenDeep(keys)\n if (this.visible.length > 0) {\n this.visible = [...this.visible, ...visible]\n }\n this.hidden = difference(this.hidden, visible)\n return this\n }\n makeHidden (...keys) {\n const hidden = flattenDeep(keys)\n if (this.hidden.length > 0) {\n this.hidden = [...this.hidden, ...hidden]\n }\n return this\n }\n getHidden () {\n return this.hidden\n }\n getVisible () {\n return this.visible\n }\n setHidden (hidden) {\n this.hidden = hidden\n return this\n }\n setVisible (visible) {\n this.visible = visible\n return this\n }\n }\n}\nexport default HidesAttributes\n","const UniqueIds = (Model) => {\n return class extends Model {\n useUniqueIds = false\n usesUniqueIds() {\n return this.useUniqueIds\n }\n uniqueIds() {\n return []\n }\n newUniqueId() {\n return null\n }\n setUniqueIds() {\n const uniqueIds = this.uniqueIds()\n for (const column of uniqueIds) {\n if (this[column] === null || this[column] === undefined) {\n this[column] = this.newUniqueId()\n }\n }\n }\n }\n}\nexport default UniqueIds\n","import { compose, flattenDeep, getRelationMethod, getScopeMethod, snakeCase, tap } from './utils'\n\nimport BelongsTo from './relations/belongs-to'\nimport BelongsToMany from './relations/belongs-to-many'\nimport Builder from './builder'\nimport Collection from './collection'\nimport HasAttributes from './concerns/has-attributes'\nimport HasGlobalScopes from './concerns/has-global-scopes'\nimport HasHooks from './concerns/has-hooks'\nimport HasMany from './relations/has-many'\nimport HasOne from './relations/has-one'\nimport HasRelations from './concerns/has-relations'\nimport HasTimestamps from './concerns/has-timestamps'\nimport HidesAttributes from './concerns/hides-attributes'\nimport UniqueIds from './concerns/unique-ids'\nimport arquebus from './arquebus'\nimport collect from 'collect.js'\nimport { assign as merge } from 'radashi'\nimport pluralize from 'pluralize'\n\nconst BaseModel = compose(class {\n}, HasAttributes, HidesAttributes, HasRelations, HasTimestamps, HasHooks, HasGlobalScopes, UniqueIds)\nexport class Model extends BaseModel {\n primaryKey = 'id' // protected\n builder = null // protected\n table = null // protected\n connection = null // protected\n keyType = 'int' // protected\n incrementing = true // protected\n perPage = 15 // protected\n exists = false\n eagerLoad = {}\n with = []\n withCount = [] // protected\n trx = null\n static globalScopes = {}\n static pluginInitializers = {}\n static _booted = {}\n static resolver = null\n static query (trx = null) {\n const instance = new this()\n return instance.newQuery(trx)\n }\n static on (connection = null) {\n const instance = new this\n instance.setConnection(connection)\n return instance.newQuery()\n }\n static init (attributes = {}) {\n return new this(attributes)\n }\n static extend (plugin, options) {\n plugin(this, options)\n }\n static make (attributes = {}) {\n const instance = new this()\n for (let attribute in attributes) {\n if (typeof instance[getRelationMethod(attribute)] !== 'function') {\n instance.setAttribute(attribute, attributes[attribute])\n }\n else {\n const relation = instance[getRelationMethod(attribute)]()\n const related = relation.getRelated().constructor\n if (relation instanceof HasOne\n || relation instanceof BelongsTo) {\n instance.setRelation(attribute, related.make(attributes[attribute]))\n }\n else if ((relation instanceof HasMany || relation instanceof BelongsToMany)\n && Array.isArray(attributes[attribute])) {\n instance.setRelation(attribute, new Collection(attributes[attribute].map(item => related.make(item))))\n }\n }\n }\n return instance\n }\n constructor(attributes = {}) {\n super()\n this.bootIfNotBooted()\n this.initializePlugins()\n this.syncOriginal()\n this.fill(attributes)\n return this.asProxy()\n }\n bootIfNotBooted () {\n if (this.constructor._booted[this.constructor.name] === undefined) {\n this.constructor._booted[this.constructor.name] = true\n this.constructor.booting()\n this.initialize()\n this.constructor.boot()\n this.constructor.booted()\n }\n }\n static booting () {\n }\n static boot () {\n }\n static booted () {\n }\n static setConnectionResolver (resolver) {\n this.resolver = resolver\n }\n initialize () {\n }\n initializePlugins () {\n if (typeof this.constructor.pluginInitializers[this.constructor.name] === 'undefined') {\n return\n }\n for (const method of this.constructor.pluginInitializers[this.constructor.name]) {\n this[method]()\n }\n }\n addPluginInitializer (method) {\n if (!this.constructor.pluginInitializers[this.constructor.name]) {\n this.constructor.pluginInitializers[this.constructor.name] = []\n }\n this.constructor.pluginInitializers[this.constructor.name].push(method)\n }\n newInstance (attributes = {}, exists = false) {\n const model = new this.constructor\n model.exists = exists\n model.setConnection(this.getConnectionName())\n model.setTable(this.getTable())\n model.fill(attributes)\n return model\n }\n newFromBuilder (attributes = {}, connection = null) {\n const model = this.newInstance({}, true)\n model.setRawAttributes(attributes, true)\n model.setConnection(connection || this.getConnectionName())\n return model\n }\n asProxy () {\n const handler = {\n get: function (target, prop) {\n if (target[prop] !== undefined) {\n return target[prop]\n }\n // get model column\n if (typeof prop === 'string') {\n // get custom attribute\n return target.getAttribute(prop)\n }\n },\n set: function (target, prop, value) {\n if (target[prop] !== undefined && typeof target !== 'function') {\n target[prop] = value\n return target\n }\n if (typeof prop === 'string') {\n return target.setAttribute(prop, value)\n }\n return target\n }\n }\n return new Proxy(this, handler)\n }\n getKey () {\n return this.getAttribute(this.getKeyName())\n }\n getKeyName () {\n return this.primaryKey\n }\n getForeignKey () {\n return snakeCase(this.constructor.name) + '_' + this.getKeyName()\n }\n getConnectionName () {\n return this.connection\n }\n getTable () {\n return this.table || pluralize(snakeCase(this.constructor.name))\n }\n getConnection () {\n if (this.constructor.resolver) {\n return this.constructor.resolver.getConnection(this.connection)\n }\n return arquebus.connection(this.connection)\n }\n setConnection (connection) {\n this.connection = connection\n return this\n }\n getKeyType () {\n return this.keyType\n }\n newQuery (trx = null) {\n return this.addGlobalScopes(this.newQueryWithoutScopes(trx))\n }\n newQueryWithoutScopes (trx = null) {\n return this.newModelQuery(trx)\n .with(this.with)\n .withCount(this.withCount)\n }\n newModelQuery (trx = null) {\n const builder = new Builder(trx || this.getConnection())\n return builder.setModel(this)\n }\n addGlobalScopes (builder) {\n const globalScopes = this.getGlobalScopes()\n for (const identifier in globalScopes) {\n const scope = globalScopes[identifier]\n builder.withGlobalScope(identifier, scope)\n }\n return builder\n }\n hasNamedScope (name) {\n const scope = getScopeMethod(name)\n return typeof this[scope] === 'function'\n }\n callNamedScope (scope, parameters) {\n const scopeMethod = getScopeMethod(scope)\n return this[scopeMethod](...parameters)\n }\n setTable (table) {\n this.table = table\n return this\n }\n newCollection (models = []) {\n return new Collection(models)\n }\n async load (...relations) {\n const query = this.constructor.query().with(...relations)\n await query.eagerLoadRelations([this])\n return this\n }\n async loadAggregate (relations, column, callback = null) {\n await new Collection([this]).loadAggregate(relations, column, callback)\n return this\n }\n async loadCount (...relations) {\n relations = flattenDeep(relations)\n return await this.loadAggregate(relations, '*', 'count')\n }\n async loadMax (relations, column) {\n return await this.loadAggregate(relations, column, 'max')\n }\n async loadMin (relations, column) {\n return await this.loadAggregate(relations, column, 'min')\n }\n async loadSum (relations, column) {\n return await this.loadAggregate(relations, column, 'sum')\n }\n async increment (column, amount = 1, extra = {}, options = {}) {\n return await this.incrementOrDecrement(column, amount, extra, 'increment', options)\n }\n async decrement (column, amount = 1, extra = {}, options = {}) {\n return await this.incrementOrDecrement(column, amount, extra, 'decrement', options)\n }\n async incrementOrDecrement (column, amount, extra, method, options) {\n const query = this.newModelQuery(options.client)\n if (!this.exists) {\n return await query[method](column, amount, extra)\n }\n this.attributes[column] = this[column] + (method === 'increment' ? amount : amount * -1)\n for (let key in extra) {\n this.attributes[key] = extra[key]\n }\n await this.execHooks('updating', options)\n return await tap(await query.where(this.getKeyName(), this.getKey())[method](column, amount, extra), async () => {\n this.syncChanges()\n await this.execHooks('updated', options)\n this.syncOriginalAttribute(column)\n })\n }\n toData () {\n return merge(this.attributesToData(), this.relationsToData())\n }\n toJSON () {\n return this.toData()\n }\n toJson (...args) {\n return JSON.stringify(this.toData(), ...args)\n }\n toString () {\n return this.toJson()\n }\n fill (attributes) {\n for (const key in attributes) {\n this.setAttribute(key, attributes[key])\n }\n return this\n }\n transacting (trx) {\n this.trx = trx\n return this\n }\n trashed () {\n return this[this.getDeletedAtColumn()] !== null\n }\n getIncrementing () {\n return this.incrementing\n }\n setIncrementing (value) {\n this.incrementing = value\n return this\n }\n async save (options = {}) {\n // const query = this.newQuery(options.client).setModel(this);\n const query = this.newModelQuery(options.client)\n let saved\n await this.execHooks('saving', options)\n if (this.exists) {\n if (this.isDirty() === false) {\n saved = true\n }\n else {\n await this.execHooks('updating', options)\n if (this.usesTimestamps()) {\n this.updateTimestamps()\n }\n const dirty = this.getDirty()\n if (Object.keys(dirty).length > 0) {\n await query.where(this.getKeyName(), this.getKey()).query.update(dirty)\n this.syncChanges()\n await this.execHooks('updated', options)\n }\n saved = true\n }\n }\n else {\n if (this.usesUniqueIds()) {\n this.setUniqueIds()\n }\n await this.execHooks('creating', options)\n if (this.usesTimestamps()) {\n this.updateTimestamps()\n }\n const attributes = this.getAttributes()\n if (this.getIncrementing()) {\n const keyName = this.getKeyName()\n const data = await query.insert([attributes], [keyName])\n this.setAttribute(keyName, data[0]?.[keyName] || data[0])\n }\n else {\n if (Object.keys(attributes).length > 0) {\n await query.insert(attributes)\n }\n }\n this.exists = true\n await this.execHooks('created', options)\n saved = true\n }\n if (saved) {\n await this.execHooks('saved', options)\n this.syncOriginal()\n }\n return saved\n }\n async update (attributes = {}, options = {}) {\n if (!this.exists) {\n return false\n }\n for (let key in attributes) {\n this[key] = attributes[key]\n }\n return await this.save(options)\n }\n async delete (options = {}) {\n await this.execHooks('deleting', options)\n await this.performDeleteOnModel(options)\n await this.execHooks('deleted', options)\n return true\n }\n async performDeleteOnModel (options = {}) {\n await this.setKeysForSaveQuery(this.newModelQuery(options.client)).delete()\n this.exists = false\n }\n setKeysForSaveQuery (query) {\n query.where(this.getKeyName(), '=', this.getKey())\n return query\n }\n async forceDelete (options = {}) {\n return await this.delete(options)\n }\n fresh () {\n if (!this.exists) {\n return\n }\n return this.constructor.query().where(this.getKeyName(), this.getKey()).first()\n }\n async refresh () {\n if (!this.exists) {\n return\n }\n const model = await this.constructor.query().where(this.getKeyName(), this.getKey()).first()\n this.attributes = { ...model.attributes }\n await this.load(collect(this.relations).reject((relation) => {\n return relation instanceof Pivot\n }).keys().all())\n this.syncOriginal()\n return this\n }\n newPivot (parent, attributes, table, exists, using = null) {\n return using ? using.fromRawAttributes(parent, attributes, table, exists)\n : Pivot.fromAttributes(parent, attributes, table, exists)\n }\n qualifyColumn (column) {\n if (column.includes('.')) {\n return column\n }\n return `${this.getTable()}.${column}`\n }\n getQualifiedKeyName () {\n return this.qualifyColumn(this.getKeyName())\n }\n async push (options = {}) {\n const saved = await this.save(options)\n if (!saved) {\n return false\n }\n for (const relation in this.relations) {\n let models = this.relations[relation]\n models = models instanceof Collection ? models.all() : [models]\n for (const model of models) {\n if (!await model.push(options)) {\n return false\n }\n }\n ;\n }\n return true\n }\n is (model) {\n return model && model instanceof Model &&\n this.getKey() === model.getKey() &&\n this.getTable() === model.getTable() &&\n this.getConnectionName() === model.getConnectionName()\n }\n isNot (model) {\n return !this.is(model)\n }\n}\n\nexport class Pivot extends Model {\n incrementing = false\n guarded = []\n pivotParent = null\n foreignKey = null\n relatedKey = null\n setPivotKeys (foreignKey, relatedKey) {\n this.foreignKey = foreignKey\n this.relatedKey = relatedKey\n return this\n }\n static fromRawAttributes (parent, attributes, table, exists = false) {\n const instance = this.fromAttributes(parent, {}, table, exists)\n instance.timestamps = instance.hasTimestampAttributes(attributes)\n instance.attributes = attributes\n instance.exists = exists\n return instance\n }\n static fromAttributes (parent, attributes, table, exists = false) {\n const instance = new this\n instance.timestamps = instance.hasTimestampAttributes(attributes)\n instance.setConnection(parent.connection)\n .setTable(table)\n .fill(attributes)\n .syncOriginal()\n instance.pivotParent = parent\n instance.exists = exists\n return instance\n }\n hasTimestampAttributes (attributes = null) {\n return (attributes || this.attributes)[this.constructor.CREATED_AT] !== undefined\n }\n}\n\nexport default Model\n","import Paginator from './paginator'\nclass QueryBuilder {\n connector = null\n constructor(config, connector) {\n this.connector = connector(config)\n return this.asProxy()\n }\n asProxy() {\n const handler = {\n get: function (target, prop) {\n if (typeof target[prop] !== 'undefined') {\n return target[prop]\n }\n if (['destroy', 'schema'].includes(prop)) {\n return target.connector.schema\n }\n if ([\n 'select', 'from', 'where', 'orWhere', 'whereColumn', 'whereRaw',\n 'whereNot', 'orWhereNot', 'whereIn', 'orWhereIn', 'whereNotIn', 'orWhereNotIn', 'whereNull', 'orWhereNull', 'whereNotNull', 'orWhereNotNull', 'whereExists', 'orWhereExists',\n 'whereNotExists', 'orWhereNotExists', 'whereBetween', 'orWhereBetween', 'whereNotBetween', 'orWhereNotBetween',\n 'whereLike', 'orWhereLike', 'whereILike', 'orWhereILike',\n 'whereJsonObject', 'whereJsonPath', 'whereJsonSupersetOf', 'whereJsonSubsetOf',\n 'join', 'joinRaw', 'leftJoin', 'leftOuterJoin', 'rightJoin', 'rightOuterJoin', 'crossJoin',\n 'transacting', 'groupBy', 'groupByRaw', 'returning',\n 'having', 'havingRaw', 'havingBetween',\n 'limit', 'offset', 'orderBy', 'orderByRaw', // 'inRandomOrder',\n 'union', 'insert', 'forUpdate', 'forShare', 'distinct',\n 'clearOrder', 'clear', 'clearSelect', 'clearWhere', 'clearHaving', 'clearGroup',\n ].includes(prop)) {\n return (...args) => {\n target.connector[prop](...args)\n return target.asProxy()\n }\n }\n return target.connector[prop]\n },\n set: function (target, prop, value) {\n if (typeof target[prop] !== 'undefined') {\n target[prop] = value\n return target\n }\n target.connector[prop] = value\n return target\n }\n }\n return new Proxy(this, handler)\n }\n async beginTransaction() {\n const trx = await this.connector.transaction()\n return new QueryBuilder(null, () => trx)\n }\n table(table) {\n const c = this.connector.table(table)\n return new QueryBuilder(null, () => c)\n }\n transaction(callback) {\n if (callback) {\n return this.connector.transaction((trx) => {\n return callback(new QueryBuilder(null, () => trx))\n })\n }\n return callback\n }\n async find(id, columns = ['*']) {\n return await this.connector.where('id', id).first(...columns)\n }\n async get(columns = ['*']) {\n return await this.connector\n }\n async exists() {\n return await this.connector.first() !== null\n }\n skip(...args) {\n return this.offset(...args)\n }\n take(...args) {\n return this.limit(...args)\n }\n async chunk(count, callback) {\n if (this.connector._statements.filter(item => item.grouping === 'order').length === 0) {\n throw new Error('You must specify an orderBy clause when using this function.')\n }\n let page = 1\n let countResults\n do {\n const builder = this.clone()\n const results = await builder.forPage(page, count).get()\n countResults = results.length\n if (countResults == 0) {\n break\n }\n const bool = await callback(results, page)\n if (bool === false) {\n return false\n }\n page++\n } while (countResults === count)\n return true\n }\n async paginate(page = 1, perPage = 15) {\n const query = this.clone()\n const total = await query.clearOrder().count('*')\n let results\n if (total > 0) {\n const skip = (page - 1) * perPage\n this.take(perPage).skip(skip)\n results = await this.get()\n }\n else {\n results = []\n }\n return new Paginator(results, parseInt(total), perPage, page)\n }\n forPage(page = 1, perPage = 15) {\n return this.offset((page - 1) * perPage).limit(perPage)\n }\n toSQL(...args) {\n return this.connector.toSQL(...args)\n }\n async count(column) {\n const [{ aggregate }] = await this.connector.count(column, { as: 'aggregate' })\n return Number(aggregate)\n }\n async min(column) {\n const [{ aggregate }] = await this.connector.min(column, { as: 'aggregate' })\n return Number(aggregate)\n }\n async max(column) {\n const [{ aggregate }] = await this.connector.max(column, { as: 'aggregate' })\n return Number(aggregate)\n }\n async sum(column) {\n const [{ aggregate }] = await this.connector.sum(column, { as: 'aggregate' })\n return Number(aggregate)\n }\n async avg(column) {\n const [{ aggregate }] = await this.connector.avg(column, { as: 'aggregate' })\n return Number(aggregate)\n }\n clone() {\n const c = this.connector.clone()\n return new QueryBuilder(null, () => c)\n }\n async delete() {\n return await this.connector.delete()\n }\n async insert(...args) {\n return await this.connector.insert(...args)\n }\n async update(...args) {\n return await this.connector.update(...args)\n }\n destroy(...args) {\n return this.connector.destroy(...args)\n }\n get _statements() {\n return this.connector._statements\n }\n get _single() {\n return this.connector._single\n }\n get from() {\n return this.connector.from\n }\n}\nexport default QueryBuilder\n","import * as color from 'colorette'\n\nimport escalade from 'escalade/sync'\nimport path from 'path'\nimport resolveFrom from 'resolve-from'\n\nfunction success (text) {\n console.log(text)\n process.exit(0)\n}\n\nfunction exit (text) {\n if (text instanceof Error) {\n if (text.message) {\n console.error(color.red(text.message))\n }\n console.error(color.red(`${text.detail ? `${text.detail}\\n` : ''}${text.stack}`))\n }\n else {\n console.error(color.red(text))\n }\n process.exit(1)\n}\n\nfunction twoColumnDetail (name, value) {\n const regex = /\\x1b\\[\\d+m/g\n const width = Math.min(process.stdout.columns, 100)\n const dots = Math.max(width - name.replace(regex, '').length - value.replace(regex, '').length - 10, 0)\n return console.log(name, color.gray('.'.repeat(dots)), value)\n}\n\nfunction findUpConfig (cwd, name, extensions) {\n return escalade(cwd, (dir, names) => {\n for (const ext of extensions) {\n const filename = `${name}.${ext}`\n if (names.includes(filename)) {\n return filename\n }\n }\n return false\n })\n}\n\nfunction findUpModulePath (cwd, packageName) {\n const modulePackagePath = escalade(cwd, (dir, names) => {\n if (names.includes('package.json')) {\n return 'package.json'\n }\n return false\n })\n try {\n if (modulePackage.name === packageName) {\n return path.join(path.dirname(modulePackagePath), modulePackage.main || 'index.js')\n }\n }\n catch (e) {\n /* empty */\n }\n}\n\nfunction findModulePkg (moduleId, options = {}) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n const packageJson = path.join(packageName, 'package.json')\n const resolved = resolveFrom.silent(options.cwd || process.cwd(), packageJson)\n if (!resolved) {\n return\n }\n return path.join(path.dirname(resolved), parts.join('/'))\n}\n\nconst join = path.join\n\nasync function getMigrationPaths (cwd, migrator, defaultPath, path) {\n if (path) {\n return [join(cwd, path)]\n }\n return [\n ...migrator.getPaths(),\n join(cwd, defaultPath),\n ]\n}\n\nfunction localModuleCheck (env) {\n if (!env.modulePath) {\n console.log(color.red('No local arquebus install found.'))\n exit('Try running: npm install arquebus --save')\n }\n}\nclass TableGuesser {\n static CREATE_PATTERNS = [\n /^create_(\\w+)_table$/,\n /^create_(\\w+)$/\n ]\n static CHANGE_PATTERNS = [\n /.+_(to|from|in)_(\\w+)_table$/,\n /.+_(to|from|in)_(\\w+)$/\n ]\n static guess (migration) {\n for (const pattern of TableGuesser.CREATE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[1], true]\n }\n }\n for (const pattern of TableGuesser.CHANGE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[2], false]\n }\n }\n return []\n }\n}\n\nexport { exit }\nexport { success }\nexport { twoColumnDetail }\nexport { findUpModulePath }\nexport { findModulePkg }\nexport { findUpConfig }\nexport { localModuleCheck }\nexport { getMigrationPaths }\nexport { TableGuesser }\n\nexport default {\n exit,\n success,\n twoColumnDetail,\n findUpModulePath,\n findModulePkg,\n findUpConfig,\n localModuleCheck,\n getMigrationPaths,\n TableGuesser\n}\n","import MigrationRepository from './migrations/migration-repository'\nimport Migrator from './migrations/migrator'\nimport arquebus from './arquebus'\nimport { getMigrationPaths } from '../bin/utils'\nasync function prepareDatabase (migrator) {\n const exists = await migrator.repositoryExists()\n if (!exists) {\n console.log('Preparing database.')\n console.log('Creating migration table...')\n await migrator.repository.createRepository()\n console.log('Migration table created successfully.')\n }\n}\nasync function setupConnection (config) {\n const table = config?.migration?.table || 'migrations'\n arquebus.addConnection(config, 'default')\n Object.entries(config.connections || {}).forEach(([name, connection]) => {\n arquebus.addConnection(connection, name)\n })\n const repository = new MigrationRepository(arquebus, table)\n const migrator = new Migrator(repository, arquebus)\n return { arquebus, migrator }\n}\nasync function migrateRun (config, options = {}, destroyAll = false) {\n const { arquebus, migrator } = await setupConnection(config)\n await prepareDatabase(migrator)\n const paths = await getMigrationPaths(process.cwd(), migrator, config?.migrations?.path, options.path)\n await migrator.setOutput(true).run(paths, {\n step: options.step,\n pretend: options.pretend,\n })\n if (destroyAll) {\n await arquebus.destroyAll()\n }\n}\nasync function migrateRollback (config, options = {}, destroyAll = false) {\n const { arquebus, migrator } = await setupConnection(config)\n const paths = await getMigrationPaths(process.cwd(), migrator, config?.migrations?.path, options.path)\n await migrator.setOutput(true).rollback(paths, {\n step: options.step || 0,\n pretend: options.pretend,\n batch: options.batch || 0,\n })\n if (destroyAll) {\n await arquebus.destroyAll()\n }\n}\nasync function migrateStatus (config, options = {}, destroyAll = false) {\n const { arquebus, migrator } = await setupConnection(config)\n async function getAllMigrationFiles () {\n return await migrator.getMigrationFiles(await getMigrationPaths(process.cwd(), migrator, config?.migrations?.path, options.path))\n }\n async function getStatusFor (ran, batches) {\n const files = await getAllMigrationFiles()\n return Object.values(files).map(function (migration) {\n const migrationName = migrator.getMigrationName(migration)\n const status = {\n name: migrationName,\n ran: ran.includes(migrationName),\n batch: ran.includes(migrationName) ? batches[migrationName] : null\n }\n return status\n })\n }\n const exists = await migrator.repositoryExists()\n if (!exists) {\n throw new Error('Migration table does not exist.')\n }\n const ran = await migrator.repository.getRan()\n const batches = await migrator.getRepository().getMigrationBatches()\n const migrations = await getStatusFor(ran, batches)\n if (destroyAll) {\n await arquebus.destroyAll()\n }\n return migrations\n}\nexport { migrateRun }\nexport { migrateRollback }\nexport { migrateStatus }\nexport default {\n migrateRun,\n migrateRollback,\n migrateStatus\n}\n","const HasUniqueIds = (Model) => {\n return class extends Model {\n useUniqueIds = true\n uniqueIds() {\n return [this.getKeyName()]\n }\n getKeyType() {\n if (this.uniqueIds().includes(this.getKeyName())) {\n return 'string'\n }\n return this.keyType\n }\n getIncrementing() {\n if (this.uniqueIds().includes(this.getKeyName())) {\n return false\n }\n return this.incrementing\n }\n }\n}\nexport default HasUniqueIds\n","class Migration {\n connection\n withinTransaction = true\n getConnection() {\n return this.connection\n }\n}\nexport default Migration\n","import { Pivot } from './model'\nexport { Pivot } from './model'\n\nexport default Pivot\n","import Scope from './scope'\nimport { tap } from './utils'\nconst hasJoins = (statements) => {\n for (const statement of statements) {\n if (statement?.grouping === 'join') {\n return true\n }\n }\n return false\n}\nclass SoftDeletingScope extends Scope {\n extensions = ['Restore', 'RestoreOrCreate', 'CreateOrRestore', 'WithTrashed', 'WithoutTrashed', 'OnlyTrashed']\n apply(builder, model) {\n builder.whereNull(model.getQualifiedDeletedAtColumn())\n }\n extend(builder) {\n for (const extension of this.extensions) {\n this[`add${extension}`](builder)\n }\n builder.onDelete(async (builder) => {\n const column = this.getDeletedAtColumn(builder)\n return await builder.update({\n [column]: builder.getModel().freshTimestampString(),\n })\n })\n }\n getDeletedAtColumn(builder) {\n if (hasJoins(builder.getQuery()._statements)) {\n return builder.getModel().getQualifiedDeletedAtColumn()\n }\n return builder.getModel().getDeletedAtColumn()\n }\n addRestore(builder) {\n builder.macro('restore', (builder) => {\n builder.withTrashed()\n return builder.update({\n [builder.getModel().getDeletedAtColumn()]: null\n })\n })\n }\n addRestoreOrCreate(builder) {\n builder.macro('restoreOrCreate', async (builder, attributes = {}, values = {}) => {\n builder.withTrashed()\n return tap(await builder.firstOrCreate(attributes, values), async (instance) => {\n await instance.restore()\n })\n })\n }\n addCreateOrRestore(builder) {\n builder.macro('createOrRestore', async (builder, attributes = {}, values = {}) => {\n builder.withTrashed()\n return tap(await builder.createOrFirst(attributes, values), async (instance) => {\n await instance.restore()\n })\n })\n }\n addWithTrashed(builder) {\n builder.macro('withTrashed', (builder, withTrashed = true) => {\n if (!withTrashed) {\n return builder.withoutTrashed()\n }\n return builder.withoutGlobalScope(this)\n })\n }\n addWithoutTrashed(builder) {\n builder.macro('withoutTrashed', (builder) => {\n const model = builder.getModel()\n builder.withoutGlobalScope(this).whereNull(model.getQualifiedDeletedAtColumn())\n return builder\n })\n }\n addOnlyTrashed(builder) {\n builder.macro('onlyTrashed', (builder) => {\n const model = builder.getModel()\n builder.withoutGlobalScope(this).whereNotNull(model.getQualifiedDeletedAtColumn())\n return builder\n })\n }\n}\nexport default SoftDeletingScope\n","import SoftDeletingScope from './soft-deleting-scope'\nimport { isNullish } from 'radashi'\nimport { tap } from './utils'\nconst softDeletes = (Model) => {\n return class extends Model {\n forceDeleting = false\n static bootSoftDeletes () {\n this.addGlobalScope(new SoftDeletingScope)\n }\n initialize () {\n super.initialize()\n this.constructor.bootSoftDeletes()\n this.addPluginInitializer('initializeSoftDeletes')\n }\n initializeSoftDeletes () {\n if (this.casts[this.getDeletedAtColumn()] === undefined) {\n this.casts[this.getDeletedAtColumn()] = 'datetime'\n }\n }\n async forceDelete () {\n if (this.execHooks('forceDeleting') === false) {\n return false\n }\n this.forceDeleting = true\n return tap(await this.delete(), (deleted) => {\n this.forceDeleting = false\n if (deleted) {\n this.execHooks('forceDeleted', false)\n }\n })\n }\n forceDeleteQuietly () {\n return this.withoutEvents(() => this.forceDelete())\n }\n async performDeleteOnModel (options = {}) {\n if (this.forceDeleting) {\n return tap(await this.setKeysForSaveQuery(this.newModelQuery()).forceDelete(), () => {\n this.exists = false\n })\n }\n return await this.runSoftDelete(options)\n }\n async runSoftDelete (options = {}) {\n const query = this.setKeysForSaveQuery(this.newModelQuery())\n const time = this.freshTimestamp()\n const columns = {\n [this.getDeletedAtColumn()]: this.fromDateTime(time)\n }\n this[this.getDeletedAtColumn()] = time\n if (this.usesTimestamps() && this.getUpdatedAtColumn()) {\n this[this.getUpdatedAtColumn()] = time\n columns[this.getUpdatedAtColumn()] = this.fromDateTime(time)\n }\n await query.update(columns)\n this.syncOriginalAttributes(Object.keys(columns))\n this.execHooks('trashed', options)\n }\n async restore (options = {}) {\n if (this.execHooks('restoring', options) === false) {\n return false\n }\n this[this.getDeletedAtColumn()] = null\n this.exists = true\n const result = await this.save()\n this.execHooks('restored', options)\n return result\n }\n restoreQuietly () {\n return this.withoutEvents(() => this.restore())\n }\n trashed () {\n return !isNullish(this[this.getDeletedAtColumn()])\n }\n static softDeleted (callback) {\n this.addHook('trashed', callback)\n }\n static restoring (callback) {\n this.addHook('restoring', callback)\n }\n static restored (callback) {\n this.addHook('restored', callback)\n }\n static forceDeleting (callback) {\n this.addHook('forceDeleting', callback)\n }\n static forceDeleted (callback) {\n this.addHook('forceDeleted', callback)\n }\n isForceDeleting () {\n return this.forceDeleting\n }\n getDeletedAtColumn () {\n return this.constructor.DELETED_AT || 'deleted_at'\n }\n getQualifiedDeletedAtColumn () {\n return this.qualifyColumn(this.getDeletedAtColumn())\n }\n }\n}\nexport default softDeletes\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,sBAAN,MAA0B;AAAA,EACtB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,YAAY,UAAU,OAAO;AACzB,SAAK,WAAW;AAChB,SAAK,QAAQ;AAAA,EACjB;AAAA,EACA,MAAM,SAAS;AACX,WAAO,MAAM,KAAK,SAAS,EACtB,QAAQ,SAAS,KAAK,EACtB,QAAQ,aAAa,KAAK,EAC1B,MAAM,WAAW;AAAA,EAC1B;AAAA,EACA,MAAM,cAAc,OAAO;AACvB,UAAM,QAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,MAAM,GAAG;AACtD,WAAQ,MAAM,MAAM,QAAQ,SAAS,MAAM,EACtC,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AAAA,IACvC;AAAA,IACA,kBAAmB;AACjB,aAAO,KAAK;AAAA,IACd;AAAA,IACA,qBAAsB;AACpB,aAAO,KAAK,YAAY,cAAc;AAAA,IACxC;AAAA,IACA,8BAA+B;AAC7B,aAAO,KAAK,cAAc,KAAK,mBAAmB,CAAC;AAAA,IACrD;AAAA,EACF;AACF;AACA,IAAO,uBAAQ;;;AtCnFf,IAAM,OAAO,CAAC,OAAO,MAAM,UAAU,CAAC,MAAM;AAC1C,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,WAAW;AACb,WAAO,IAAI;AAAA,MACT,KAAK,KAAK,IAAI,UAAQ,MAAM,KAAK,IAAI,CAAC;AAAA,MACtC,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AACA,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,WAAO,IAAI,mBAAW,KAAK,IAAI,UAAQ,MAAM,KAAK,IAAI,CAAC,CAAC;AAAA,EAC1D;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEA,IAAM,iBAAiB,CAAC,OAAO,SAC7B,IAAI,mBAAW,KAAK,IAAI,UAAQ,MAAM,KAAK,IAAI,CAAC,CAAC;AAEnD,IAAM,gBAAgB,CAAC,OAAO,SAC5B,IAAI;AAAA,EACF,KAAK,KAAK,IAAI,UAAQ,MAAM,KAAK,IAAI,CAAC;AAAA,EACtC,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;","names":["ModelNotFoundError","fs","path","dayjs","advancedFormat","get","set","key","Relation","key","key","import_radashi","import_radashi","BaseCollection","difference","key","model","import_radashi","import_collect","Relation","difference","key","import_collect","key","import_radashi","ModelNotFoundError","import_radashi","import_collect","key","merge","key","ModelNotFoundError","difference","instance","BaseCollection","flatten","import_radashi","import_collect","import_dayjs","Model","key","value","collect","dayjs","flatten","import_radashi","Model","Model","import_collect","Relation","key","collect","import_collect","import_radashi","query","ModelNotFoundError","key","import_radashi","Model","key","Model","import_radashi","Model","difference","Model","import_collect","import_radashi","pluralize","key","merge","collect","Knex","BaseModel","color","import_path","path","arquebus","ran","batches","Model","builder","import_radashi","Model"]}