@tsed/objection 6.73.1 → 6.73.5

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.
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Knex } from "knex";
2
- import "./utils/patchModelJson";
3
2
  declare global {
4
3
  namespace TsED {
5
4
  interface Configuration {
package/lib/index.js CHANGED
@@ -1,44 +1,13 @@
1
- var core = require('@tsed/core');
2
- var jsonMapper = require('@tsed/json-mapper');
3
- var objection = require('objection');
4
1
  var schema = require('@tsed/schema');
2
+ var core = require('@tsed/core');
5
3
  var di = require('@tsed/di');
6
4
  var knex = require('knex');
5
+ var objection = require('objection');
7
6
 
8
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
8
 
10
9
  var knex__default = /*#__PURE__*/_interopDefaultLegacy(knex);
11
10
 
12
- function _extends() {
13
- _extends = Object.assign || function (target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
16
-
17
- for (var key in source) {
18
- if (Object.prototype.hasOwnProperty.call(source, key)) {
19
- target[key] = source[key];
20
- }
21
- }
22
- }
23
-
24
- return target;
25
- };
26
-
27
- return _extends.apply(this, arguments);
28
- }
29
-
30
- objection.Model.prototype.toJSON = function toJSON(opt) {
31
- const obj = this.$toJson(opt);
32
-
33
- if (opt && opt.endpoint) {
34
- return jsonMapper.serialize(obj, _extends({
35
- type: core.classOf(this)
36
- }, opt));
37
- }
38
-
39
- return obj;
40
- };
41
-
42
11
  /**
43
12
  * @ignore
44
13
  */
@@ -124,6 +93,24 @@ function Entity(tableName) {
124
93
  };
125
94
  }
126
95
 
96
+ function _extends() {
97
+ _extends = Object.assign || function (target) {
98
+ for (var i = 1; i < arguments.length; i++) {
99
+ var source = arguments[i];
100
+
101
+ for (var key in source) {
102
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
103
+ target[key] = source[key];
104
+ }
105
+ }
106
+ }
107
+
108
+ return target;
109
+ };
110
+
111
+ return _extends.apply(this, arguments);
112
+ }
113
+
127
114
  /**
128
115
  *
129
116
  * @param options
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/patchModelJson.ts","../src/services/ColumnTypesContainer.ts","../src/components/createStringColumn.ts","../src/components/createIdColumn.ts","../src/components/createBooleanColumn.ts","../src/components/createNumberColumn.ts","../src/utils/defineStaticGetter.ts","../src/decorators/entity.ts","../src/decorators/columnOptions.ts","../src/decorators/decimal.ts","../src/decorators/idColumn.ts","../src/utils/connect.ts","../src/services/ObjectionConnection.ts","../src/utils/getColumnCtx.ts","../src/utils/createColumns.ts"],"sourcesContent":["// patch model\nimport {classOf} from \"@tsed/core\";\nimport {serialize} from \"@tsed/json-mapper\";\nimport {Model} from \"objection\";\n\nModel.prototype.toJSON = function toJSON(opt: any) {\n const obj = this.$toJson(opt);\n\n if (opt && opt.endpoint) {\n return serialize(obj, {type: classOf(this), ...opt});\n }\n\n return obj;\n};\n","import type {Knex} from \"knex\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport const ColumnTypesContainer: Map<string, (table: Knex.TableBuilder, ctx: ColumnCtx) => void> = new Map();\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createStringColumn(table: Knex.TableBuilder, {entity, schema}: ColumnCtx) {\n table.string(entity.propertyName, schema.maxLength);\n}\n\nColumnTypesContainer.set(\"string\", createStringColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n if (options.type === \"bigIncrements\") {\n table.bigIncrements(entity.propertyName).primary();\n } else {\n table.increments(entity.propertyName).primary();\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n/**\n * @ignore\n */\nexport function createBooleanColumn(table: Knex.TableBuilder, {entity}: ColumnCtx) {\n table.boolean(entity.propertyName);\n}\n\nColumnTypesContainer.set(\"boolean\", createBooleanColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createNumberColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n table.decimal(entity.propertyName, options.precision, options.scale);\n}\n\nColumnTypesContainer.set(\"number\", createNumberColumn);\n","import {classOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport function defineStaticGetter(target: any, propertyKey: string, fn: any) {\n return Object.defineProperty(classOf(target), propertyKey, {\n get: fn\n });\n}\n","import {Type} from \"@tsed/core\";\nimport {getJsonSchema} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\n\n/**\n *\n * @param tableName\n * @decorator\n * @objection\n */\nexport function Entity(tableName: string): ClassDecorator {\n if (!tableName) {\n throw new Error(\"Please provide a table name\");\n }\n\n return (target: any) => {\n defineStaticGetter(target, \"tableName\", () => tableName);\n defineStaticGetter(target, \"jsonSchema\", () => getJsonSchema(target));\n\n return target;\n };\n}\n\nexport interface EntityMethods<T> extends Type<T> {\n readonly tableName: string;\n}\n","import {StoreSet} from \"@tsed/core\";\nimport type {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function ColumnOptions(options: Partial<ColumnOpts>): PropertyDecorator {\n return StoreSet(\"objection\", options) as any;\n}\n","import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {ColumnOptions} from \"./columnOptions\";\n\nexport interface DecimalOptions {\n precision?: number | null;\n scale?: number;\n}\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function Decimal(options: DecimalOptions = {}) {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n }),\n StoreSet(\"objection\", {\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n })\n );\n}\n","import {useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {ColumnOptions} from \"./columnOptions\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"increments\" | \"bigIncrements\" = \"increments\"): PropertyDecorator {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"idColumn\",\n options: {\n type\n }\n }),\n (target: any, propertyKey: string) => {\n defineStaticGetter(target, \"idColumn\", () => propertyKey);\n }\n );\n}\n","import knex, {Knex} from \"knex\";\nimport {Model} from \"objection\";\n\nexport function createConnection(connectionOptions: Knex.Config): Knex {\n const connection = knex(connectionOptions);\n Model.knex(connection);\n\n return connection;\n}\n","import {Configuration, registerProvider} from \"@tsed/di\";\nimport type {Knex} from \"knex\";\nimport {createConnection} from \"../utils/connect\";\n\nexport const OBJECTION_CONNECTION = Symbol.for(\"DEFAULT_CONNECTION\");\nexport type OBJECTION_CONNECTION = Knex<any, unknown[]>;\n\nregisterProvider({\n provide: OBJECTION_CONNECTION,\n deps: [Configuration],\n async useAsyncFactory(configuration: Configuration) {\n const connectionOptions = configuration.get<Knex.Config>(\"knex\")!;\n\n if (connectionOptions) {\n try {\n return createConnection(connectionOptions);\n } catch (er) {\n // istanbul ignore next\n console.error(er);\n }\n }\n\n return {};\n }\n});\n","import {JsonEntityStore} from \"@tsed/schema\";\nimport {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n * @ignore\n */\nexport interface ColumnCtx extends ColumnOpts {\n entity: JsonEntityStore;\n schema: any;\n}\n\n/**\n * @ignore\n */\nexport function getColumnCtx(entity: JsonEntityStore): ColumnCtx {\n const schema = entity.schema.toJSON();\n const {columnType = schema.type, options = {}} = entity.store.get<Partial<ColumnOpts>>(\"objection\", {});\n\n return {entity, columnType, options, schema};\n}\n","import {getProperties, JsonEntityStore} from \"@tsed/schema\";\nimport {Knex} from \"knex\";\nimport \"../components/createBooleanColumn\";\nimport \"../components/createIdColumn\";\nimport \"../components/createNumberColumn\";\nimport \"../components/createStringColumn\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {getColumnCtx} from \"./getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createColumn(table: Knex.TableBuilder, entity: JsonEntityStore) {\n const ctx = getColumnCtx(entity);\n\n if (!ColumnTypesContainer.has(ctx.columnType)) {\n throw `Column type ${ctx.columnType} isn't supported. Add function to ColumnTypesContainer to map the column with Knex`;\n }\n\n ColumnTypesContainer.get(ctx.columnType)!(table, ctx);\n}\n\n/**\n * @ignore\n */\nexport function getColumns(model: any) {\n return [...getProperties(model, {withIgnoredProps: true, objection: true, groups: false}).values()];\n}\n\n/**\n * @ignore\n */\nexport function createColumns(table: Knex.TableBuilder, model: any) {\n getColumns(model).map((entity) => {\n createColumn(table, entity);\n });\n}\n"],"names":["Model","prototype","toJSON","opt","obj","$toJson","endpoint","serialize","type","classOf","ColumnTypesContainer","Map","createStringColumn","table","entity","schema","string","propertyName","maxLength","set","createIdColumn","options","bigIncrements","primary","increments","createBooleanColumn","boolean","createNumberColumn","decimal","precision","scale","defineStaticGetter","target","propertyKey","fn","Object","defineProperty","get","Entity","tableName","Error","getJsonSchema","ColumnOptions","StoreSet","Decimal","useDecorators","Property","columnType","IdColumn","createConnection","connectionOptions","connection","knex","OBJECTION_CONNECTION","Symbol","for","registerProvider","provide","deps","Configuration","useAsyncFactory","configuration","er","console","error","getColumnCtx","store","createColumn","ctx","has","getColumns","model","getProperties","withIgnored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B,IAAAA,MAAD;AAASiC,IAAAA,UAAT;AAAqB1B,IAAAA,OAArB;AAA8BN,IAAAA;AAA9B,GAAP;AACD;;ACVD;;;;SAGgBoD,aAAatD,OAA0BC;AACrD,QAAMsD,GAAG,GAAGH,YAAY,CAACnD,MAAD,CAAxB;;AAEA,MAAI,CAACJ,oBAAoB,CAAC2D,GAArB,CAAyBD,GAAG,CAACrB,UAA7B,CAAL,EAA+C;AAC7C,yBAAqBqB,GAAG,CAACrB,8FAAzB;AACD;;AAEDrC,EAAAA,oBAAoB,CAAC2B,GAArB,CAAyB+B,GAAG,CAACrB,UAA7B,EAA0ClC,KAA1C,EAAiDuD,GAAjD;AACD;AAED;;;;SAGgBE,WAAWC;AACzB,SAAO,CAAC,GAAGC,oBAAa,CAACD,KAAD,EAAQ;AAACE,IAAAA,gBAAgB,EAAE,IAAnB;AAAyBC,IAAAA,SAAS,EAAE,IAApC;AAA0CC,IAAAA,MAAM,EAAE;AAAlD,GAAR,CAAb,CAA+EC,MAA/E,EAAJ,CAAP;AACD;AAED;;;;SAGgBC,cAAchE,OAA0B0D;AACtDD,EAAAA,UAAU,CAACC,KAAD,CAAV,CAAkBO,GAAlB,CAAuBhE,MAAD;AACpBqD,IAAAA,YAAY,CAACtD,KAAD,EAAQC,MAAR,CAAZ;AACD,GAFD;AAGD;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/services/ColumnTypesContainer.ts","../src/components/createStringColumn.ts","../src/components/createIdColumn.ts","../src/components/createBooleanColumn.ts","../src/components/createNumberColumn.ts","../src/utils/defineStaticGetter.ts","../src/decorators/entity.ts","../src/decorators/columnOptions.ts","../src/decorators/decimal.ts","../src/decorators/idColumn.ts","../src/utils/connect.ts","../src/services/ObjectionConnection.ts","../src/utils/getColumnCtx.ts","../src/utils/createColumns.ts"],"sourcesContent":["import type {Knex} from \"knex\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport const ColumnTypesContainer: Map<string, (table: Knex.TableBuilder, ctx: ColumnCtx) => void> = new Map();\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createStringColumn(table: Knex.TableBuilder, {entity, schema}: ColumnCtx) {\n table.string(entity.propertyName, schema.maxLength);\n}\n\nColumnTypesContainer.set(\"string\", createStringColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n if (options.type === \"bigIncrements\") {\n table.bigIncrements(entity.propertyName).primary();\n } else {\n table.increments(entity.propertyName).primary();\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n/**\n * @ignore\n */\nexport function createBooleanColumn(table: Knex.TableBuilder, {entity}: ColumnCtx) {\n table.boolean(entity.propertyName);\n}\n\nColumnTypesContainer.set(\"boolean\", createBooleanColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createNumberColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n table.decimal(entity.propertyName, options.precision, options.scale);\n}\n\nColumnTypesContainer.set(\"number\", createNumberColumn);\n","import {classOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport function defineStaticGetter(target: any, propertyKey: string, fn: any) {\n return Object.defineProperty(classOf(target), propertyKey, {\n get: fn\n });\n}\n","import {Type} from \"@tsed/core\";\nimport {getJsonSchema} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\n\n/**\n *\n * @param tableName\n * @decorator\n * @objection\n */\nexport function Entity(tableName: string): ClassDecorator {\n if (!tableName) {\n throw new Error(\"Please provide a table name\");\n }\n\n return (target: any) => {\n defineStaticGetter(target, \"tableName\", () => tableName);\n defineStaticGetter(target, \"jsonSchema\", () => getJsonSchema(target));\n\n return target;\n };\n}\n\nexport interface EntityMethods<T> extends Type<T> {\n readonly tableName: string;\n}\n","import {StoreSet} from \"@tsed/core\";\nimport type {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function ColumnOptions(options: Partial<ColumnOpts>): PropertyDecorator {\n return StoreSet(\"objection\", options) as any;\n}\n","import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {ColumnOptions} from \"./columnOptions\";\n\nexport interface DecimalOptions {\n precision?: number | null;\n scale?: number;\n}\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function Decimal(options: DecimalOptions = {}) {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n }),\n StoreSet(\"objection\", {\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n })\n );\n}\n","import {useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {ColumnOptions} from \"./columnOptions\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"increments\" | \"bigIncrements\" = \"increments\"): PropertyDecorator {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"idColumn\",\n options: {\n type\n }\n }),\n (target: any, propertyKey: string) => {\n defineStaticGetter(target, \"idColumn\", () => propertyKey);\n }\n );\n}\n","import knex, {Knex} from \"knex\";\nimport {Model} from \"objection\";\n\nexport function createConnection(connectionOptions: Knex.Config): Knex {\n const connection = knex(connectionOptions);\n Model.knex(connection);\n\n return connection;\n}\n","import {Configuration, registerProvider} from \"@tsed/di\";\nimport type {Knex} from \"knex\";\nimport {createConnection} from \"../utils/connect\";\n\nexport const OBJECTION_CONNECTION = Symbol.for(\"DEFAULT_CONNECTION\");\nexport type OBJECTION_CONNECTION = Knex<any, unknown[]>;\n\nregisterProvider({\n provide: OBJECTION_CONNECTION,\n deps: [Configuration],\n async useAsyncFactory(configuration: Configuration) {\n const connectionOptions = configuration.get<Knex.Config>(\"knex\")!;\n\n if (connectionOptions) {\n try {\n return createConnection(connectionOptions);\n } catch (er) {\n // istanbul ignore next\n console.error(er);\n }\n }\n\n return {};\n }\n});\n","import {JsonEntityStore} from \"@tsed/schema\";\nimport {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n * @ignore\n */\nexport interface ColumnCtx extends ColumnOpts {\n entity: JsonEntityStore;\n schema: any;\n}\n\n/**\n * @ignore\n */\nexport function getColumnCtx(entity: JsonEntityStore): ColumnCtx {\n const schema = entity.schema.toJSON();\n const {columnType = schema.type, options = {}} = entity.store.get<Partial<ColumnOpts>>(\"objection\", {});\n\n return {entity, columnType, options, schema};\n}\n","import {getProperties, JsonEntityStore} from \"@tsed/schema\";\nimport {Knex} from \"knex\";\nimport \"../components/createBooleanColumn\";\nimport \"../components/createIdColumn\";\nimport \"../components/createNumberColumn\";\nimport \"../components/createStringColumn\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {getColumnCtx} from \"./getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createColumn(table: Knex.TableBuilder, entity: JsonEntityStore) {\n const ctx = getColumnCtx(entity);\n\n if (!ColumnTypesContainer.has(ctx.columnType)) {\n throw `Column type ${ctx.columnType} isn't supported. Add function to ColumnTypesContainer to map the column with Knex`;\n }\n\n ColumnTypesContainer.get(ctx.columnType)!(table, ctx);\n}\n\n/**\n * @ignore\n */\nexport function getColumns(model: any) {\n return [...getProperties(model, {withIgnoredProps: true, objection: true, groups: false}).values()];\n}\n\n/**\n * @ignore\n */\nexport function createColumns(table: Knex.TableBuilder, model: any) {\n getColumns(model).map((entity) => {\n createColumn(table, entity);\n });\n}\n"],"names":["ColumnTypesContainer","Map","createStringColumn","table","entity","schema","string","propertyName","maxLength","set","createIdColumn","options","type","bigIncrements","primary","increments","createBooleanColumn","boolean","createNumberColumn","decimal","precision","scale","defineStaticGetter","target","propertyKey","fn","Object","defineProperty","classOf","get","Entity","tableName","Error","getJsonSchema","ColumnOptions","StoreSet","Decimal","useDecorators","Property","columnType","IdColumn","createConnection","connectionOptions","connection","knex","Model","OBJECTION_CONNECTION","Symbol","for","registerProvider","provide","deps","Configuration","useAsyncFactory","configuration","er","console","error","getColumnCtx","toJSON","store","createColumn","ctx","has","getColumns","model","getProperties","withIgnoredProps","objection","groups","values","createColumns","map"],"mappings":";;;;;;;;;;AAGA;;;AAGO,MAAMA,oBAAoB,GAAoE,IAAIC,GAAJ,EAA9F;;ACFP;;;;SAGgBC,mBAAmBC,OAA0B;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT;AAC3DF,EAAAA,KAAK,CAACG,MAAN,CAAaF,MAAM,CAACG,YAApB,EAAkCF,MAAM,CAACG,SAAzC;AACD;AAEDR,oBAAoB,CAACS,GAArB,CAAyB,QAAzB,EAAmCP,kBAAnC;;ACPA;;;;SAGgBQ,eAAeP,OAA0B;AAACC,EAAAA,MAAD;AAASO,EAAAA;AAAT;AACvD,MAAIA,OAAO,CAACC,IAAR,KAAiB,eAArB,EAAsC;AACpCT,IAAAA,KAAK,CAACU,aAAN,CAAoBT,MAAM,CAACG,YAA3B,EAAyCO,OAAzC;AACD,GAFD,MAEO;AACLX,IAAAA,KAAK,CAACY,UAAN,CAAiBX,MAAM,CAACG,YAAxB,EAAsCO,OAAtC;AACD;AACF;AAEDd,oBAAoB,CAACS,GAArB,CAAyB,UAAzB,EAAqCC,cAArC;;ACZA;;;;SAGgBM,oBAAoBb,OAA0B;AAACC,EAAAA;AAAD;AAC5DD,EAAAA,KA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CAACO,IAArB;AAA2BD,IAAAA,OAAO,GAAG;AAArC,MAA2CP,MAAM,CAACwD,KAAP,CAAa/B,GAAb,CAAsC,WAAtC,EAAmD,EAAnD,CAAjD;AAEA,SAAO;AAACzB,IAAAA,MAAD;AAASmC,IAAAA,UAAT;AAAqB5B,IAAAA,OAArB;AAA8BN,IAAAA;AAA9B,GAAP;AACD;;ACVD;;;;SAGgBwD,aAAa1D,OAA0BC;AACrD,QAAM0D,GAAG,GAAGJ,YAAY,CAACtD,MAAD,CAAxB;;AAEA,MAAI,CAACJ,oBAAoB,CAAC+D,GAArB,CAAyBD,GAAG,CAACvB,UAA7B,CAAL,EAA+C;AAC7C,yBAAqBuB,GAAG,CAACvB,8FAAzB;AACD;;AAEDvC,EAAAA,oBAAoB,CAAC6B,GAArB,CAAyBiC,GAAG,CAACvB,UAA7B,EAA0CpC,KAA1C,EAAiD2D,GAAjD;AACD;AAED;;;;SAGgBE,WAAWC;AACzB,SAAO,CAAC,GAAGC,oBAAa,CAACD,KAAD,EAAQ;AAACE,IAAAA,gBAAgB,EAAE,IAAnB;AAAyBC,IAAAA,SAAS,EAAE,IAApC;AAA0CC,IAAAA,MAAM,EAAE;AAAlD,GAAR,CAAb,CAA+EC,MAA/E,EAAJ,CAAP;AACD;AAED;;;;SAGgBC,cAAcpE,OAA0B8D;AACtDD,EAAAA,UAAU,CAACC,KAAD,CAAV,CAAkBO,GAAlB,CAAuBpE,MAAD;AACpByD,IAAAA,YAAY,CAAC1D,KAAD,EAAQC,MAAR,CAAZ;AACD,GAFD;AAGD;;;;;;;;;;;;;;;;;"}
@@ -1,39 +1,8 @@
1
- import { classOf, StoreSet, useDecorators } from '@tsed/core';
2
- import { serialize } from '@tsed/json-mapper';
3
- import { Model } from 'objection';
4
1
  import { getJsonSchema, Property, getProperties } from '@tsed/schema';
2
+ import { classOf, StoreSet, useDecorators } from '@tsed/core';
5
3
  import { registerProvider, Configuration } from '@tsed/di';
6
4
  import knex from 'knex';
7
-
8
- function _extends() {
9
- _extends = Object.assign || function (target) {
10
- for (var i = 1; i < arguments.length; i++) {
11
- var source = arguments[i];
12
-
13
- for (var key in source) {
14
- if (Object.prototype.hasOwnProperty.call(source, key)) {
15
- target[key] = source[key];
16
- }
17
- }
18
- }
19
-
20
- return target;
21
- };
22
-
23
- return _extends.apply(this, arguments);
24
- }
25
-
26
- Model.prototype.toJSON = function toJSON(opt) {
27
- const obj = this.$toJson(opt);
28
-
29
- if (opt && opt.endpoint) {
30
- return serialize(obj, _extends({
31
- type: classOf(this)
32
- }, opt));
33
- }
34
-
35
- return obj;
36
- };
5
+ import { Model } from 'objection';
37
6
 
38
7
  /**
39
8
  * @ignore
@@ -120,6 +89,24 @@ function Entity(tableName) {
120
89
  };
121
90
  }
122
91
 
92
+ function _extends() {
93
+ _extends = Object.assign || function (target) {
94
+ for (var i = 1; i < arguments.length; i++) {
95
+ var source = arguments[i];
96
+
97
+ for (var key in source) {
98
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
99
+ target[key] = source[key];
100
+ }
101
+ }
102
+ }
103
+
104
+ return target;
105
+ };
106
+
107
+ return _extends.apply(this, arguments);
108
+ }
109
+
123
110
  /**
124
111
  *
125
112
  * @param options
@@ -1 +1 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/utils/patchModelJson.ts","../src/services/ColumnTypesContainer.ts","../src/components/createStringColumn.ts","../src/components/createIdColumn.ts","../src/components/createBooleanColumn.ts","../src/components/createNumberColumn.ts","../src/utils/defineStaticGetter.ts","../src/decorators/entity.ts","../src/decorators/columnOptions.ts","../src/decorators/decimal.ts","../src/decorators/idColumn.ts","../src/utils/connect.ts","../src/services/ObjectionConnection.ts","../src/utils/getColumnCtx.ts","../src/utils/createColumns.ts"],"sourcesContent":["// patch model\nimport {classOf} from \"@tsed/core\";\nimport {serialize} from \"@tsed/json-mapper\";\nimport {Model} from \"objection\";\n\nModel.prototype.toJSON = function toJSON(opt: any) {\n const obj = this.$toJson(opt);\n\n if (opt && opt.endpoint) {\n return serialize(obj, {type: classOf(this), ...opt});\n }\n\n return obj;\n};\n","import type {Knex} from \"knex\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport const ColumnTypesContainer: Map<string, (table: Knex.TableBuilder, ctx: ColumnCtx) => void> = new Map();\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createStringColumn(table: Knex.TableBuilder, {entity, schema}: ColumnCtx) {\n table.string(entity.propertyName, schema.maxLength);\n}\n\nColumnTypesContainer.set(\"string\", createStringColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n if (options.type === \"bigIncrements\") {\n table.bigIncrements(entity.propertyName).primary();\n } else {\n table.increments(entity.propertyName).primary();\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n/**\n * @ignore\n */\nexport function createBooleanColumn(table: Knex.TableBuilder, {entity}: ColumnCtx) {\n table.boolean(entity.propertyName);\n}\n\nColumnTypesContainer.set(\"boolean\", createBooleanColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createNumberColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n table.decimal(entity.propertyName, options.precision, options.scale);\n}\n\nColumnTypesContainer.set(\"number\", createNumberColumn);\n","import {classOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport function defineStaticGetter(target: any, propertyKey: string, fn: any) {\n return Object.defineProperty(classOf(target), propertyKey, {\n get: fn\n });\n}\n","import {Type} from \"@tsed/core\";\nimport {getJsonSchema} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\n\n/**\n *\n * @param tableName\n * @decorator\n * @objection\n */\nexport function Entity(tableName: string): ClassDecorator {\n if (!tableName) {\n throw new Error(\"Please provide a table name\");\n }\n\n return (target: any) => {\n defineStaticGetter(target, \"tableName\", () => tableName);\n defineStaticGetter(target, \"jsonSchema\", () => getJsonSchema(target));\n\n return target;\n };\n}\n\nexport interface EntityMethods<T> extends Type<T> {\n readonly tableName: string;\n}\n","import {StoreSet} from \"@tsed/core\";\nimport type {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function ColumnOptions(options: Partial<ColumnOpts>): PropertyDecorator {\n return StoreSet(\"objection\", options) as any;\n}\n","import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {ColumnOptions} from \"./columnOptions\";\n\nexport interface DecimalOptions {\n precision?: number | null;\n scale?: number;\n}\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function Decimal(options: DecimalOptions = {}) {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n }),\n StoreSet(\"objection\", {\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n })\n );\n}\n","import {useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {ColumnOptions} from \"./columnOptions\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"increments\" | \"bigIncrements\" = \"increments\"): PropertyDecorator {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"idColumn\",\n options: {\n type\n }\n }),\n (target: any, propertyKey: string) => {\n defineStaticGetter(target, \"idColumn\", () => propertyKey);\n }\n );\n}\n","import knex, {Knex} from \"knex\";\nimport {Model} from \"objection\";\n\nexport function createConnection(connectionOptions: Knex.Config): Knex {\n const connection = knex(connectionOptions);\n Model.knex(connection);\n\n return connection;\n}\n","import {Configuration, registerProvider} from \"@tsed/di\";\nimport type {Knex} from \"knex\";\nimport {createConnection} from \"../utils/connect\";\n\nexport const OBJECTION_CONNECTION = Symbol.for(\"DEFAULT_CONNECTION\");\nexport type OBJECTION_CONNECTION = Knex<any, unknown[]>;\n\nregisterProvider({\n provide: OBJECTION_CONNECTION,\n deps: [Configuration],\n async useAsyncFactory(configuration: Configuration) {\n const connectionOptions = configuration.get<Knex.Config>(\"knex\")!;\n\n if (connectionOptions) {\n try {\n return createConnection(connectionOptions);\n } catch (er) {\n // istanbul ignore next\n console.error(er);\n }\n }\n\n return {};\n }\n});\n","import {JsonEntityStore} from \"@tsed/schema\";\nimport {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n * @ignore\n */\nexport interface ColumnCtx extends ColumnOpts {\n entity: JsonEntityStore;\n schema: any;\n}\n\n/**\n * @ignore\n */\nexport function getColumnCtx(entity: JsonEntityStore): ColumnCtx {\n const schema = entity.schema.toJSON();\n const {columnType = schema.type, options = {}} = entity.store.get<Partial<ColumnOpts>>(\"objection\", {});\n\n return {entity, columnType, options, schema};\n}\n","import {getProperties, JsonEntityStore} from \"@tsed/schema\";\nimport {Knex} from \"knex\";\nimport \"../components/createBooleanColumn\";\nimport \"../components/createIdColumn\";\nimport \"../components/createNumberColumn\";\nimport \"../components/createStringColumn\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {getColumnCtx} from \"./getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createColumn(table: Knex.TableBuilder, entity: JsonEntityStore) {\n const ctx = getColumnCtx(entity);\n\n if (!ColumnTypesContainer.has(ctx.columnType)) {\n throw `Column type ${ctx.columnType} isn't supported. Add function to ColumnTypesContainer to map the column with Knex`;\n }\n\n ColumnTypesContainer.get(ctx.columnType)!(table, ctx);\n}\n\n/**\n * @ignore\n */\nexport function getColumns(model: any) {\n return [...getProperties(model, {withIgnoredProps: true, objection: true, groups: false}).values()];\n}\n\n/**\n * @ignore\n */\nexport function createColumns(table: Knex.TableBuilder, model: any) {\n getColumns(model).map((entity) => {\n createColumn(table, entity);\n });\n}\n"],"names":["Model","prototype","toJSON","opt","obj","$toJson","endpoint","serialize","type","classOf","ColumnTypesContainer","Map","createStringColumn","table","entity","schema","string","propertyName","maxLength","set","createIdColumn","options","bigIncrements","primary","increments","createBooleanColumn","boolean","createNumberColumn","decimal","precision","scale","defineStaticGetter","target","propertyKey","fn","Object","defineProperty","get","Entity","tableName","Error","getJsonSchema","ColumnOptions","StoreSet","Decimal","useDecorators","Property","columnType","IdColumn","createConnection","connectionOptions","connection","knex","OBJECTION_CONNECTION","Symbol","for","registerProvider","provide","deps","Configuration","useAsyncFactory","configuration","er","console","error","getColumnCtx","store","createColumn","ctx","has","getColumns","model","getProperties","withIgnoredProps","objection","groups","values","createColumns","map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKAA,KAAK,CAACC,SAAN,CAAgBC,MAAhB,GAAyB,SAASA,MAAT,CAAgBC,GAAhB;AACvB,QAAMC,GAAG,GAAG,KAAKC,OAAL,CAAaF,GAAb,CAAZ;;AAEA,MAAIA,GAAG,IAAIA,GAAG,CAACG,QAAf,EAAyB;AACvB,WAAOC,SAAS,CAACH,GAAD;AAAOI,MAAAA,IAAI,EAAEC,OAAO,CAAC,IAAD;AAApB,OAA+BN,GAA/B,EAAhB;AACD;;AAED,SAAOC,GAAP;AACD,CARD;;ACFA;;;AAGO,MAAMM,oBAAoB,GAAoE,IAAIC,GAAJ,EAA9F;;ACFP;;;;SAGgBC,mBAAmBC,OAA0B;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT;AAC3DF,EAAAA,KAAK,CAACG,MAAN,CAAaF,MAAM,CAACG,YAApB,EAAkCF,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AAR,CAAb,CAA+EC,MAA/E,EAAJ,CAAP;AACD;AAED;;;;SAGgBC,cAAchE,OAA0B0D;AACtDD,EAAAA,UAAU,CAACC,KAAD,CAAV,CAAkBO,GAAlB,CAAuBhE,MAAD;AACpBqD,IAAAA,YAAY,CAACtD,KAAD,EAAQC,MAAR,CAAZ;AACD,GAFD;AAGD;;;;"}
1
+ {"version":3,"file":"index.modern.js","sources":["../src/services/ColumnTypesContainer.ts","../src/components/createStringColumn.ts","../src/components/createIdColumn.ts","../src/components/createBooleanColumn.ts","../src/components/createNumberColumn.ts","../src/utils/defineStaticGetter.ts","../src/decorators/entity.ts","../src/decorators/columnOptions.ts","../src/decorators/decimal.ts","../src/decorators/idColumn.ts","../src/utils/connect.ts","../src/services/ObjectionConnection.ts","../src/utils/getColumnCtx.ts","../src/utils/createColumns.ts"],"sourcesContent":["import type {Knex} from \"knex\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport const ColumnTypesContainer: Map<string, (table: Knex.TableBuilder, ctx: ColumnCtx) => void> = new Map();\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createStringColumn(table: Knex.TableBuilder, {entity, schema}: ColumnCtx) {\n table.string(entity.propertyName, schema.maxLength);\n}\n\nColumnTypesContainer.set(\"string\", createStringColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n if (options.type === \"bigIncrements\") {\n table.bigIncrements(entity.propertyName).primary();\n } else {\n table.increments(entity.propertyName).primary();\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n/**\n * @ignore\n */\nexport function createBooleanColumn(table: Knex.TableBuilder, {entity}: ColumnCtx) {\n table.boolean(entity.propertyName);\n}\n\nColumnTypesContainer.set(\"boolean\", createBooleanColumn);\n","import type {Knex} from \"knex\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {ColumnCtx} from \"../utils/getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createNumberColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n table.decimal(entity.propertyName, options.precision, options.scale);\n}\n\nColumnTypesContainer.set(\"number\", createNumberColumn);\n","import {classOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport function defineStaticGetter(target: any, propertyKey: string, fn: any) {\n return Object.defineProperty(classOf(target), propertyKey, {\n get: fn\n });\n}\n","import {Type} from \"@tsed/core\";\nimport {getJsonSchema} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\n\n/**\n *\n * @param tableName\n * @decorator\n * @objection\n */\nexport function Entity(tableName: string): ClassDecorator {\n if (!tableName) {\n throw new Error(\"Please provide a table name\");\n }\n\n return (target: any) => {\n defineStaticGetter(target, \"tableName\", () => tableName);\n defineStaticGetter(target, \"jsonSchema\", () => getJsonSchema(target));\n\n return target;\n };\n}\n\nexport interface EntityMethods<T> extends Type<T> {\n readonly tableName: string;\n}\n","import {StoreSet} from \"@tsed/core\";\nimport type {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function ColumnOptions(options: Partial<ColumnOpts>): PropertyDecorator {\n return StoreSet(\"objection\", options) as any;\n}\n","import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {ColumnOptions} from \"./columnOptions\";\n\nexport interface DecimalOptions {\n precision?: number | null;\n scale?: number;\n}\n\n/**\n *\n * @param options\n * @decorator\n * @objection\n */\nexport function Decimal(options: DecimalOptions = {}) {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n }),\n StoreSet(\"objection\", {\n columnType: \"number\",\n options: {\n type: \"decimal\",\n ...options\n }\n })\n );\n}\n","import {useDecorators} from \"@tsed/core\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {ColumnOptions} from \"./columnOptions\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"increments\" | \"bigIncrements\" = \"increments\"): PropertyDecorator {\n return useDecorators(\n Property(),\n ColumnOptions({\n columnType: \"idColumn\",\n options: {\n type\n }\n }),\n (target: any, propertyKey: string) => {\n defineStaticGetter(target, \"idColumn\", () => propertyKey);\n }\n );\n}\n","import knex, {Knex} from \"knex\";\nimport {Model} from \"objection\";\n\nexport function createConnection(connectionOptions: Knex.Config): Knex {\n const connection = knex(connectionOptions);\n Model.knex(connection);\n\n return connection;\n}\n","import {Configuration, registerProvider} from \"@tsed/di\";\nimport type {Knex} from \"knex\";\nimport {createConnection} from \"../utils/connect\";\n\nexport const OBJECTION_CONNECTION = Symbol.for(\"DEFAULT_CONNECTION\");\nexport type OBJECTION_CONNECTION = Knex<any, unknown[]>;\n\nregisterProvider({\n provide: OBJECTION_CONNECTION,\n deps: [Configuration],\n async useAsyncFactory(configuration: Configuration) {\n const connectionOptions = configuration.get<Knex.Config>(\"knex\")!;\n\n if (connectionOptions) {\n try {\n return createConnection(connectionOptions);\n } catch (er) {\n // istanbul ignore next\n console.error(er);\n }\n }\n\n return {};\n }\n});\n","import {JsonEntityStore} from \"@tsed/schema\";\nimport {ColumnOpts} from \"../domain/ColumnOpts\";\n\n/**\n * @ignore\n */\nexport interface ColumnCtx extends ColumnOpts {\n entity: JsonEntityStore;\n schema: any;\n}\n\n/**\n * @ignore\n */\nexport function getColumnCtx(entity: JsonEntityStore): ColumnCtx {\n const schema = entity.schema.toJSON();\n const {columnType = schema.type, options = {}} = entity.store.get<Partial<ColumnOpts>>(\"objection\", {});\n\n return {entity, columnType, options, schema};\n}\n","import {getProperties, JsonEntityStore} from \"@tsed/schema\";\nimport {Knex} from \"knex\";\nimport \"../components/createBooleanColumn\";\nimport \"../components/createIdColumn\";\nimport \"../components/createNumberColumn\";\nimport \"../components/createStringColumn\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport {getColumnCtx} from \"./getColumnCtx\";\n\n/**\n * @ignore\n */\nexport function createColumn(table: Knex.TableBuilder, entity: JsonEntityStore) {\n const ctx = getColumnCtx(entity);\n\n if (!ColumnTypesContainer.has(ctx.columnType)) {\n throw `Column type ${ctx.columnType} isn't supported. Add function to ColumnTypesContainer to map the column with Knex`;\n }\n\n ColumnTypesContainer.get(ctx.columnType)!(table, ctx);\n}\n\n/**\n * @ignore\n */\nexport function getColumns(model: any) {\n return [...getProperties(model, {withIgnoredProps: true, objection: true, groups: false}).values()];\n}\n\n/**\n * @ignore\n */\nexport function createColumns(table: Knex.TableBuilder, model: any) {\n getColumns(model).map((entity) => {\n createColumn(table, entity);\n });\n}\n"],"names":["ColumnTypesContainer","Map","createStringColumn","table","entity","schema","string","propertyName","maxLength","set","createIdColumn","options","type","bigIncrements","primary","increments","createBooleanColumn","boolean","createNumberColumn","decimal","precision","scale","defineStaticGetter","target","propertyKey","fn","Object","defineProperty","classOf","get","Entity","tableName","Error","getJsonSchema","ColumnOptions","StoreSet","Decimal","useDecorators","Property","columnType","IdColumn","createConnection","connectionOptions","connection","knex","Model","OBJECTION_CONNECTION","Symbol","for","registerProvider","provide","deps","Configuration","useAsyncFactory","configuration","er","console","error","getColumnCtx","toJSON","store","createColumn","ctx","has","getColumns","model","getProperties","withIgnoredProps","objection","groups","values","createColumns","map"],"mappings":";;;;;;AAGA;;;AAGO,MAAMA,oBAAoB,GAAoE,IAAIC,GAAJ,EAA9F;;ACFP;;;;SAGgBC,mBAAmBC,OAA0B;AAACC,E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,KAAD,EAAQ;AAACE,IAAAA,gBAAgB,EAAE,IAAnB;AAAyBC,IAAAA,SAAS,EAAE,IAApC;AAA0CC,IAAAA,MAAM,EAAE;AAAlD,GAAR,CAAb,CAA+EC,MAA/E,EAAJ,CAAP;AACD;AAED;;;;SAGgBC,cAAcpE,OAA0B8D;AACtDD,EAAAA,UAAU,CAACC,KAAD,CAAV,CAAkBO,GAAlB,CAAuBpE,MAAD;AACpByD,IAAAA,YAAY,CAAC1D,KAAD,EAAQC,MAAR,CAAZ;AACD,GAFD;AAGD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/objection",
3
- "version": "6.73.1",
3
+ "version": "6.73.5",
4
4
  "description": "Objection.js package for Ts.ED framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -18,11 +18,11 @@
18
18
  "tslib": "2.2.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@tsed/ajv": "6.73.1",
22
- "@tsed/core": "6.73.1",
23
- "@tsed/di": "6.73.1",
24
- "@tsed/json-mapper": "6.73.1",
25
- "@tsed/schema": "6.73.1",
21
+ "@tsed/ajv": "6.73.5",
22
+ "@tsed/core": "6.73.5",
23
+ "@tsed/di": "6.73.5",
24
+ "@tsed/json-mapper": "6.73.5",
25
+ "@tsed/schema": "6.73.5",
26
26
  "knex": "^0.95.11",
27
27
  "mssql": "^7.2.1",
28
28
  "mysql": "^2.18.1",
@@ -34,11 +34,11 @@
34
34
  "sqlite3": "^5.0.2"
35
35
  },
36
36
  "peerDependencies": {
37
- "@tsed/ajv": "^6.73.1",
38
- "@tsed/core": "^6.73.1",
39
- "@tsed/di": "^6.73.1",
40
- "@tsed/json-mapper": "^6.73.1",
41
- "@tsed/schema": "^6.73.1",
37
+ "@tsed/ajv": "^6.73.5",
38
+ "@tsed/core": "^6.73.5",
39
+ "@tsed/di": "^6.73.5",
40
+ "@tsed/json-mapper": "^6.73.5",
41
+ "@tsed/schema": "^6.73.5",
42
42
  "knex": "^0.95.11",
43
43
  "mssql": "^7.2.1",
44
44
  "mysql": "^2.18.1",
@@ -1 +0,0 @@
1
- export {};