@tsed/objection 8.0.0-alpha.1 → 8.0.0-alpha.10

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.
Files changed (114) hide show
  1. package/lib/esm/components/createBooleanColumn.js.map +1 -1
  2. package/lib/esm/components/createIdColumn.js +1 -1
  3. package/lib/esm/components/createIdColumn.js.map +1 -1
  4. package/lib/esm/components/createNumberColumn.js.map +1 -1
  5. package/lib/esm/components/createStringColumn.js.map +1 -1
  6. package/lib/esm/decorators/belongsToOne.js.map +1 -1
  7. package/lib/esm/decorators/columnOptions.js.map +1 -1
  8. package/lib/esm/decorators/decimal.js.map +1 -1
  9. package/lib/esm/decorators/entity.js +1 -1
  10. package/lib/esm/decorators/entity.js.map +1 -1
  11. package/lib/esm/decorators/hasMany.js.map +1 -1
  12. package/lib/esm/decorators/hasOne.js.map +1 -1
  13. package/lib/esm/decorators/hasOneThroughRelation.js.map +1 -1
  14. package/lib/esm/decorators/idColumn.js +2 -2
  15. package/lib/esm/decorators/idColumn.js.map +1 -1
  16. package/lib/esm/decorators/manyToMany.js.map +1 -1
  17. package/lib/esm/decorators/relatesTo.js +2 -2
  18. package/lib/esm/decorators/relatesTo.js.map +1 -1
  19. package/lib/esm/services/ColumnTypesContainer.js.map +1 -1
  20. package/lib/esm/services/ObjectionConnection.js.map +1 -1
  21. package/lib/esm/utils/createColumns.js +1 -1
  22. package/lib/esm/utils/createColumns.js.map +1 -1
  23. package/lib/esm/utils/createJoinKeys.js +1 -1
  24. package/lib/esm/utils/createJoinKeys.js.map +1 -1
  25. package/lib/esm/utils/createRelationshipMapping.js.map +1 -1
  26. package/lib/esm/utils/getColumnCtx.js.map +1 -1
  27. package/lib/types/components/createIdColumn.d.ts +1 -1
  28. package/lib/types/decorators/relatesTo.d.ts +1 -1
  29. package/lib/types/utils/createColumns.d.ts +4 -4
  30. package/package.json +20 -21
  31. package/vitest.config.mts +5 -5
  32. package/lib/cjs/components/createBooleanColumn.js +0 -13
  33. package/lib/cjs/components/createBooleanColumn.js.map +0 -1
  34. package/lib/cjs/components/createIdColumn.js +0 -23
  35. package/lib/cjs/components/createIdColumn.js.map +0 -1
  36. package/lib/cjs/components/createNumberColumn.js +0 -13
  37. package/lib/cjs/components/createNumberColumn.js.map +0 -1
  38. package/lib/cjs/components/createStringColumn.js +0 -13
  39. package/lib/cjs/components/createStringColumn.js.map +0 -1
  40. package/lib/cjs/decorators/belongsToOne.js +0 -16
  41. package/lib/cjs/decorators/belongsToOne.js.map +0 -1
  42. package/lib/cjs/decorators/columnOptions.js +0 -15
  43. package/lib/cjs/decorators/columnOptions.js.map +0 -1
  44. package/lib/cjs/decorators/decimal.js +0 -29
  45. package/lib/cjs/decorators/decimal.js.map +0 -1
  46. package/lib/cjs/decorators/entity.js +0 -26
  47. package/lib/cjs/decorators/entity.js.map +0 -1
  48. package/lib/cjs/decorators/hasMany.js +0 -16
  49. package/lib/cjs/decorators/hasMany.js.map +0 -1
  50. package/lib/cjs/decorators/hasOne.js +0 -16
  51. package/lib/cjs/decorators/hasOne.js.map +0 -1
  52. package/lib/cjs/decorators/hasOneThroughRelation.js +0 -16
  53. package/lib/cjs/decorators/hasOneThroughRelation.js.map +0 -1
  54. package/lib/cjs/decorators/idColumn.js +0 -25
  55. package/lib/cjs/decorators/idColumn.js.map +0 -1
  56. package/lib/cjs/decorators/manyToMany.js +0 -16
  57. package/lib/cjs/decorators/manyToMany.js.map +0 -1
  58. package/lib/cjs/decorators/relatesTo.js +0 -25
  59. package/lib/cjs/decorators/relatesTo.js.map +0 -1
  60. package/lib/cjs/domain/ColumnOpts.js +0 -3
  61. package/lib/cjs/domain/ColumnOpts.js.map +0 -1
  62. package/lib/cjs/domain/RelationshipOpts.js +0 -9
  63. package/lib/cjs/domain/RelationshipOpts.js.map +0 -1
  64. package/lib/cjs/domain/interfaces.js +0 -3
  65. package/lib/cjs/domain/interfaces.js.map +0 -1
  66. package/lib/cjs/index.js +0 -33
  67. package/lib/cjs/index.js.map +0 -1
  68. package/lib/cjs/package.json +0 -3
  69. package/lib/cjs/services/ColumnTypesContainer.js +0 -8
  70. package/lib/cjs/services/ColumnTypesContainer.js.map +0 -1
  71. package/lib/cjs/services/ObjectionConnection.js +0 -24
  72. package/lib/cjs/services/ObjectionConnection.js.map +0 -1
  73. package/lib/cjs/utils/connect.js +0 -13
  74. package/lib/cjs/utils/connect.js.map +0 -1
  75. package/lib/cjs/utils/createColumns.js +0 -38
  76. package/lib/cjs/utils/createColumns.js.map +0 -1
  77. package/lib/cjs/utils/createJoinKeys.js +0 -40
  78. package/lib/cjs/utils/createJoinKeys.js.map +0 -1
  79. package/lib/cjs/utils/createRelationshipMapping.js +0 -22
  80. package/lib/cjs/utils/createRelationshipMapping.js.map +0 -1
  81. package/lib/cjs/utils/defineStaticGetter.js +0 -14
  82. package/lib/cjs/utils/defineStaticGetter.js.map +0 -1
  83. package/lib/cjs/utils/getColumnCtx.js +0 -13
  84. package/lib/cjs/utils/getColumnCtx.js.map +0 -1
  85. package/lib/cjs/utils/getJsonEntityRelationships.js +0 -19
  86. package/lib/cjs/utils/getJsonEntityRelationships.js.map +0 -1
  87. package/lib/esm/package.json +0 -3
  88. package/lib/types-esm/components/createBooleanColumn.d.ts +0 -6
  89. package/lib/types-esm/components/createIdColumn.d.ts +0 -6
  90. package/lib/types-esm/components/createNumberColumn.d.ts +0 -6
  91. package/lib/types-esm/components/createStringColumn.d.ts +0 -6
  92. package/lib/types-esm/decorators/belongsToOne.d.ts +0 -8
  93. package/lib/types-esm/decorators/columnOptions.d.ts +0 -8
  94. package/lib/types-esm/decorators/decimal.d.ts +0 -11
  95. package/lib/types-esm/decorators/entity.d.ts +0 -11
  96. package/lib/types-esm/decorators/hasMany.d.ts +0 -9
  97. package/lib/types-esm/decorators/hasOne.d.ts +0 -8
  98. package/lib/types-esm/decorators/hasOneThroughRelation.d.ts +0 -8
  99. package/lib/types-esm/decorators/idColumn.d.ts +0 -7
  100. package/lib/types-esm/decorators/manyToMany.d.ts +0 -9
  101. package/lib/types-esm/decorators/relatesTo.d.ts +0 -10
  102. package/lib/types-esm/domain/ColumnOpts.d.ts +0 -4
  103. package/lib/types-esm/domain/RelationshipOpts.d.ts +0 -8
  104. package/lib/types-esm/domain/interfaces.d.ts +0 -8
  105. package/lib/types-esm/index.d.ts +0 -29
  106. package/lib/types-esm/services/ColumnTypesContainer.d.ts +0 -6
  107. package/lib/types-esm/services/ObjectionConnection.d.ts +0 -3
  108. package/lib/types-esm/utils/connect.d.ts +0 -2
  109. package/lib/types-esm/utils/createColumns.d.ts +0 -18
  110. package/lib/types-esm/utils/createJoinKeys.d.ts +0 -14
  111. package/lib/types-esm/utils/createRelationshipMapping.d.ts +0 -24
  112. package/lib/types-esm/utils/defineStaticGetter.d.ts +0 -4
  113. package/lib/types-esm/utils/getColumnCtx.d.ts +0 -13
  114. package/lib/types-esm/utils/getJsonEntityRelationships.d.ts +0 -8
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ManyToMany = void 0;
4
- const objection_1 = require("objection");
5
- const relatesTo_js_1 = require("./relatesTo.js");
6
- /**
7
- *
8
- * @param opts
9
- * @decorator
10
- * @objection
11
- */
12
- function ManyToMany(type, opts) {
13
- return (0, relatesTo_js_1.RelatesTo)(objection_1.Model.ManyToManyRelation, { ...opts, type });
14
- }
15
- exports.ManyToMany = ManyToMany;
16
- //# sourceMappingURL=manyToMany.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manyToMany.js","sourceRoot":"","sources":["../../../src/decorators/manyToMany.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAErD,iDAAyC;AAGzC;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAyB,EAAE,IAAkC;IACtF,OAAO,IAAA,wBAAS,EAAC,iBAAK,CAAC,kBAAkB,EAAE,EAAC,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AAC9D,CAAC;AAFD,gCAEC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelatesTo = void 0;
4
- const schema_1 = require("@tsed/schema");
5
- const RelationshipOpts_js_1 = require("../domain/RelationshipOpts.js");
6
- const core_1 = require("@tsed/core");
7
- const getJsonEntityRelationships_js_1 = require("../utils/getJsonEntityRelationships.js");
8
- const createRelationshipMapping_js_1 = require("../utils/createRelationshipMapping.js");
9
- /**
10
- *
11
- * @param relation
12
- * @param opts
13
- * @decorator
14
- * @objection
15
- */
16
- function RelatesTo(relation, opts) {
17
- return (0, core_1.useDecorators)(opts?.type ? (0, schema_1.CollectionOf)(opts.type) : (0, schema_1.Property)(), (0, core_1.StoreFn)((store, params) => {
18
- if (opts && (0, RelationshipOpts_js_1.isModelClassFactory)(opts.type)) {
19
- opts.type = opts.type();
20
- }
21
- store.set(getJsonEntityRelationships_js_1.OBJECTION_RELATIONSHIP_KEY, (0, createRelationshipMapping_js_1.createRelationshipMapping)(params, relation, opts));
22
- }));
23
- }
24
- exports.RelatesTo = RelatesTo;
25
- //# sourceMappingURL=relatesTo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relatesTo.js","sourceRoot":"","sources":["../../../src/decorators/relatesTo.ts"],"names":[],"mappings":";;;AAAA,yCAAoD;AACpD,uEAAoF;AACpF,qCAAkD;AAElD,0FAAkF;AAElF,wFAAgF;AAEhF;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,QAAsB,EAAE,IAAuB;IACvE,OAAO,IAAA,oBAAa,EAClB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAA,qBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAQ,GAAE,EACjD,IAAA,cAAO,EAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,IAAI,IAAI,IAAI,IAAA,yCAAmB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;SACzB;QACD,KAAK,CAAC,GAAG,CAAC,0DAA0B,EAAE,IAAA,wDAAyB,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAVD,8BAUC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ColumnOpts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColumnOpts.js","sourceRoot":"","sources":["../../../src/domain/ColumnOpts.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isModelClassFactory = exports.isRelationshipOptsWithThrough = void 0;
4
- const core_1 = require("@tsed/core");
5
- const isRelationshipOptsWithThrough = (opts) => opts !== undefined && opts.through !== undefined;
6
- exports.isRelationshipOptsWithThrough = isRelationshipOptsWithThrough;
7
- const isModelClassFactory = (type) => type !== undefined && !(0, core_1.isString)(type) && (0, core_1.isFunction)(type) && !("prototype" in type);
8
- exports.isModelClassFactory = isModelClassFactory;
9
- //# sourceMappingURL=RelationshipOpts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RelationshipOpts.js","sourceRoot":"","sources":["../../../src/domain/RelationshipOpts.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AASzC,MAAM,6BAA6B,GAAG,CAAC,IAAuB,EAAuC,EAAE,CAC5G,IAAI,KAAK,SAAS,IAAkC,IAAK,CAAC,OAAO,KAAK,SAAS,CAAC;AADrE,QAAA,6BAA6B,iCACwC;AAE3E,MAAM,mBAAmB,GAAG,CAAC,IAA0B,EAA6B,EAAE,CAC3F,IAAI,KAAK,SAAS,IAAI,CAAC,IAAA,eAAQ,EAAC,IAAI,CAAC,IAAI,IAAA,iBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC;AADzE,QAAA,mBAAmB,uBACsD"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/domain/interfaces.ts"],"names":[],"mappings":""}
package/lib/cjs/index.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @file Automatically generated by @tsed/barrels.
6
- */
7
- tslib_1.__exportStar(require("./components/createBooleanColumn.js"), exports);
8
- tslib_1.__exportStar(require("./components/createIdColumn.js"), exports);
9
- tslib_1.__exportStar(require("./components/createNumberColumn.js"), exports);
10
- tslib_1.__exportStar(require("./components/createStringColumn.js"), exports);
11
- tslib_1.__exportStar(require("./decorators/belongsToOne.js"), exports);
12
- tslib_1.__exportStar(require("./decorators/columnOptions.js"), exports);
13
- tslib_1.__exportStar(require("./decorators/decimal.js"), exports);
14
- tslib_1.__exportStar(require("./decorators/entity.js"), exports);
15
- tslib_1.__exportStar(require("./decorators/hasMany.js"), exports);
16
- tslib_1.__exportStar(require("./decorators/hasOne.js"), exports);
17
- tslib_1.__exportStar(require("./decorators/hasOneThroughRelation.js"), exports);
18
- tslib_1.__exportStar(require("./decorators/idColumn.js"), exports);
19
- tslib_1.__exportStar(require("./decorators/manyToMany.js"), exports);
20
- tslib_1.__exportStar(require("./decorators/relatesTo.js"), exports);
21
- tslib_1.__exportStar(require("./domain/ColumnOpts.js"), exports);
22
- tslib_1.__exportStar(require("./domain/interfaces.js"), exports);
23
- tslib_1.__exportStar(require("./domain/RelationshipOpts.js"), exports);
24
- tslib_1.__exportStar(require("./services/ColumnTypesContainer.js"), exports);
25
- tslib_1.__exportStar(require("./services/ObjectionConnection.js"), exports);
26
- tslib_1.__exportStar(require("./utils/connect.js"), exports);
27
- tslib_1.__exportStar(require("./utils/createColumns.js"), exports);
28
- tslib_1.__exportStar(require("./utils/createJoinKeys.js"), exports);
29
- tslib_1.__exportStar(require("./utils/createRelationshipMapping.js"), exports);
30
- tslib_1.__exportStar(require("./utils/defineStaticGetter.js"), exports);
31
- tslib_1.__exportStar(require("./utils/getColumnCtx.js"), exports);
32
- tslib_1.__exportStar(require("./utils/getJsonEntityRelationships.js"), exports);
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,8EAAoD;AACpD,yEAA+C;AAC/C,6EAAmD;AACnD,6EAAmD;AACnD,uEAA6C;AAC7C,wEAA8C;AAC9C,kEAAwC;AACxC,iEAAuC;AACvC,kEAAwC;AACxC,iEAAuC;AACvC,gFAAsD;AACtD,mEAAyC;AACzC,qEAA2C;AAC3C,oEAA0C;AAC1C,iEAAuC;AACvC,iEAAuC;AACvC,uEAA6C;AAC7C,6EAAmD;AACnD,4EAAkD;AAClD,6DAAmC;AACnC,mEAAyC;AACzC,oEAA0C;AAC1C,+EAAqD;AACrD,wEAA8C;AAC9C,kEAAwC;AACxC,gFAAsD"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColumnTypesContainer = void 0;
4
- /**
5
- * @ignore
6
- */
7
- exports.ColumnTypesContainer = new Map();
8
- //# sourceMappingURL=ColumnTypesContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColumnTypesContainer.js","sourceRoot":"","sources":["../../../src/services/ColumnTypesContainer.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACU,QAAA,oBAAoB,GAAoE,IAAI,GAAG,EAAE,CAAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OBJECTION_CONNECTION = void 0;
4
- const di_1 = require("@tsed/di");
5
- const connect_js_1 = require("../utils/connect.js");
6
- exports.OBJECTION_CONNECTION = Symbol.for("DEFAULT_CONNECTION");
7
- (0, di_1.registerProvider)({
8
- provide: exports.OBJECTION_CONNECTION,
9
- deps: [di_1.Configuration],
10
- useAsyncFactory(configuration) {
11
- const connectionOptions = configuration.get("knex");
12
- if (connectionOptions) {
13
- try {
14
- return (0, connect_js_1.createConnection)(connectionOptions);
15
- }
16
- catch (er) {
17
- // istanbul ignore next
18
- console.error(er);
19
- }
20
- }
21
- return Promise.resolve({});
22
- }
23
- });
24
- //# sourceMappingURL=ObjectionConnection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObjectionConnection.js","sourceRoot":"","sources":["../../../src/services/ObjectionConnection.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AAEzD,oDAAqD;AAExC,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAGrE,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,4BAAoB;IAC7B,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,eAAe,CAAC,aAA4B;QAC1C,MAAM,iBAAiB,GAAG,aAAa,CAAC,GAAG,CAAc,MAAM,CAAE,CAAC;QAElE,IAAI,iBAAiB,EAAE;YACrB,IAAI;gBACF,OAAO,IAAA,6BAAgB,EAAC,iBAAiB,CAAC,CAAC;aAC5C;YAAC,OAAO,EAAE,EAAE;gBACX,uBAAuB;gBACvB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACnB;SACF;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConnection = void 0;
4
- const tslib_1 = require("tslib");
5
- const knex_1 = tslib_1.__importDefault(require("knex"));
6
- const objection_1 = require("objection");
7
- function createConnection(connectionOptions) {
8
- const connection = (0, knex_1.default)(connectionOptions);
9
- objection_1.Model.knex(connection);
10
- return connection;
11
- }
12
- exports.createConnection = createConnection;
13
- //# sourceMappingURL=connect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../src/utils/connect.ts"],"names":[],"mappings":";;;;AAAA,wDAAgC;AAChC,yCAAgC;AAEhC,SAAgB,gBAAgB,CAAC,iBAA8B;IAC7D,MAAM,UAAU,GAAG,IAAA,cAAI,EAAC,iBAAiB,CAAC,CAAC;IAC3C,iBAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEvB,OAAO,UAAU,CAAC;AACpB,CAAC;AALD,4CAKC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createColumns = exports.getColumns = exports.createColumn = void 0;
4
- const schema_1 = require("@tsed/schema");
5
- require("../components/createBooleanColumn");
6
- require("../components/createIdColumn");
7
- require("../components/createNumberColumn");
8
- require("../components/createStringColumn");
9
- const ColumnTypesContainer_js_1 = require("../services/ColumnTypesContainer.js");
10
- const getColumnCtx_js_1 = require("./getColumnCtx.js");
11
- /**
12
- * @ignore
13
- */
14
- function createColumn(table, entity) {
15
- const ctx = (0, getColumnCtx_js_1.getColumnCtx)(entity);
16
- if (!ColumnTypesContainer_js_1.ColumnTypesContainer.has(ctx.columnType)) {
17
- throw `Column type ${ctx.columnType} isn't supported. Add function to ColumnTypesContainer to map the column with Knex`;
18
- }
19
- ColumnTypesContainer_js_1.ColumnTypesContainer.get(ctx.columnType)(table, ctx);
20
- }
21
- exports.createColumn = createColumn;
22
- /**
23
- * @ignore
24
- */
25
- function getColumns(model) {
26
- return [...(0, schema_1.getProperties)(model, { withIgnoredProps: true, objection: true, groups: false }).values()];
27
- }
28
- exports.getColumns = getColumns;
29
- /**
30
- * @ignore
31
- */
32
- function createColumns(table, model) {
33
- getColumns(model).map((entity) => {
34
- createColumn(table, entity);
35
- });
36
- }
37
- exports.createColumns = createColumns;
38
- //# sourceMappingURL=createColumns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createColumns.js","sourceRoot":"","sources":["../../../src/utils/createColumns.ts"],"names":[],"mappings":";;;AAAA,yCAA4D;AAE5D,6CAA2C;AAC3C,wCAAsC;AACtC,4CAA0C;AAC1C,4CAA0C;AAC1C,iFAAyE;AACzE,uDAA+C;AAE/C;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAwB,EAAE,MAAuB;IAC5E,MAAM,GAAG,GAAG,IAAA,8BAAY,EAAC,MAAM,CAAC,CAAC;IAEjC,IAAI,CAAC,8CAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC7C,MAAM,eAAe,GAAG,CAAC,UAAU,oFAAoF,CAAC;KACzH;IAED,8CAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AARD,oCAQC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,CAAC,GAAG,IAAA,sBAAa,EAAC,KAAK,EAAE,EAAC,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACtG,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAwB,EAAE,KAAU;IAChE,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC/B,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,sCAIC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createJoinKeys = void 0;
4
- const objection_1 = require("objection");
5
- const RelationshipOpts_js_1 = require("../domain/RelationshipOpts.js");
6
- const core_1 = require("@tsed/core");
7
- /**
8
- * @ignore
9
- */
10
- function createJoinKeys(targetClass, targetSuper, propertyKey, relation, opts) {
11
- const FOREIGN_MODEL = opts?.type || core_1.Metadata.getType(targetSuper, propertyKey);
12
- const SOURCE_MODEL_KEY = `${targetClass.tableName}.${opts?.from || targetClass.idColumn}`;
13
- const FOREIGN_MODEL_KEY = `${FOREIGN_MODEL.tableName}.${opts?.to || FOREIGN_MODEL.idColumn}`;
14
- switch (relation) {
15
- case objection_1.Model.HasManyRelation:
16
- case objection_1.Model.HasOneRelation:
17
- return {
18
- from: SOURCE_MODEL_KEY,
19
- to: `${FOREIGN_MODEL.tableName}.${opts?.to || targetClass.tableName + "Id"}`
20
- };
21
- case objection_1.Model.ManyToManyRelation:
22
- case objection_1.Model.HasOneThroughRelation:
23
- return {
24
- from: SOURCE_MODEL_KEY,
25
- through: ((0, RelationshipOpts_js_1.isRelationshipOptsWithThrough)(opts) && opts.through) || {
26
- from: `${targetClass.tableName}_${FOREIGN_MODEL.tableName}.${targetClass.tableName}Id`,
27
- to: `${targetClass.tableName}_${FOREIGN_MODEL.tableName}.${FOREIGN_MODEL.tableName}Id`
28
- },
29
- to: FOREIGN_MODEL_KEY
30
- };
31
- case objection_1.Model.BelongsToOneRelation:
32
- default:
33
- return {
34
- from: `${targetClass.tableName}.${opts?.from || propertyKey + "Id"}`,
35
- to: FOREIGN_MODEL_KEY
36
- };
37
- }
38
- }
39
- exports.createJoinKeys = createJoinKeys;
40
- //# sourceMappingURL=createJoinKeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createJoinKeys.js","sourceRoot":"","sources":["../../../src/utils/createJoinKeys.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,uEAA8F;AAE9F,qCAAoC;AAEpC;;GAEG;AACH,SAAgB,cAAc,CAAC,WAAgB,EAAE,WAAgB,EAAE,WAAmB,EAAE,QAAsB,EAAE,IAAuB;IACrI,MAAM,aAAa,GAAG,IAAI,EAAE,IAAI,IAAI,eAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC/E,MAAM,gBAAgB,GAAG,GAAG,WAAW,CAAC,SAAS,IAAI,IAAI,EAAE,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC1F,MAAM,iBAAiB,GAAG,GAAG,aAAa,CAAC,SAAS,IAAI,IAAI,EAAE,EAAE,IAAI,aAAa,CAAC,QAAQ,EAAE,CAAC;IAE7F,QAAQ,QAAQ,EAAE;QAChB,KAAK,iBAAK,CAAC,eAAe,CAAC;QAC3B,KAAK,iBAAK,CAAC,cAAc;YACvB,OAAO;gBACL,IAAI,EAAE,gBAAgB;gBACtB,EAAE,EAAE,GAAG,aAAa,CAAC,SAAS,IAAI,IAAI,EAAE,EAAE,IAAI,WAAW,CAAC,SAAS,GAAG,IAAI,EAAE;aAC7E,CAAC;QACJ,KAAK,iBAAK,CAAC,kBAAkB,CAAC;QAC9B,KAAK,iBAAK,CAAC,qBAAqB;YAC9B,OAAO;gBACL,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,CAAC,IAAA,mDAA6B,EAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;oBAChE,IAAI,EAAE,GAAG,WAAW,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,IAAI;oBACtF,EAAE,EAAE,GAAG,WAAW,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,IAAI;iBACvF;gBACD,EAAE,EAAE,iBAAiB;aACtB,CAAC;QACJ,KAAK,iBAAK,CAAC,oBAAoB,CAAC;QAChC;YACE,OAAO;gBACL,IAAI,EAAE,GAAG,WAAW,CAAC,SAAS,IAAI,IAAI,EAAE,IAAI,IAAI,WAAW,GAAG,IAAI,EAAE;gBACpE,EAAE,EAAE,iBAAiB;aACtB,CAAC;KACL;AACH,CAAC;AA7BD,wCA6BC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRelationshipMapping = void 0;
4
- const core_1 = require("@tsed/core");
5
- const createJoinKeys_js_1 = require("./createJoinKeys.js");
6
- /**
7
- * @ignore
8
- */
9
- function createRelationshipMapping([target, propertyKey], relation, opts) {
10
- return (targetClass) => ({
11
- [propertyKey]: {
12
- relation,
13
- modelClass: opts?.type || core_1.Metadata.getType(target, propertyKey),
14
- join: (0, createJoinKeys_js_1.createJoinKeys)(targetClass, target, String(propertyKey), relation, opts),
15
- modify: opts?.modify,
16
- filter: opts?.filter,
17
- beforeInsert: opts?.beforeInsert
18
- }
19
- });
20
- }
21
- exports.createRelationshipMapping = createRelationshipMapping;
22
- //# sourceMappingURL=createRelationshipMapping.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRelationshipMapping.js","sourceRoot":"","sources":["../../../src/utils/createRelationshipMapping.ts"],"names":[],"mappings":";;;AAAA,qCAAmE;AAInE,2DAAmD;AAEnD;;GAEG;AACH,SAAgB,yBAAyB,CAAC,CAAC,MAAM,EAAE,WAAW,CAAsB,EAAE,QAAsB,EAAE,IAAuB;IACnI,OAAO,CAAC,WAAgB,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC,WAAW,CAAC,EAAE;YACb,QAAQ;YACR,UAAU,EAAE,IAAI,EAAE,IAAI,IAAI,eAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC;YAC/D,IAAI,EAAE,IAAA,kCAAc,EAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC;YAC9E,MAAM,EAAE,IAAI,EAAE,MAAM;YACpB,MAAM,EAAE,IAAI,EAAE,MAAM;YACpB,YAAY,EAAE,IAAI,EAAE,YAAY;SACjC;KACF,CAAC,CAAC;AACL,CAAC;AAXD,8DAWC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineStaticGetter = void 0;
4
- const core_1 = require("@tsed/core");
5
- /**
6
- * @ignore
7
- */
8
- function defineStaticGetter(target, propertyKey, fn) {
9
- return Object.defineProperty((0, core_1.classOf)(target), propertyKey, {
10
- get: fn
11
- });
12
- }
13
- exports.defineStaticGetter = defineStaticGetter;
14
- //# sourceMappingURL=defineStaticGetter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defineStaticGetter.js","sourceRoot":"","sources":["../../../src/utils/defineStaticGetter.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAEnC;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAO;IAC1E,OAAO,MAAM,CAAC,cAAc,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,WAAW,EAAE;QACzD,GAAG,EAAE,EAAE;KACR,CAAC,CAAC;AACL,CAAC;AAJD,gDAIC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getColumnCtx = void 0;
4
- /**
5
- * @ignore
6
- */
7
- function getColumnCtx(entity) {
8
- const schema = entity.schema.toJSON();
9
- const { columnType = schema.type, options = {} } = entity.store.get("objection", {});
10
- return { entity, columnType, options, schema };
11
- }
12
- exports.getColumnCtx = getColumnCtx;
13
- //# sourceMappingURL=getColumnCtx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getColumnCtx.js","sourceRoot":"","sources":["../../../src/utils/getColumnCtx.ts"],"names":[],"mappings":";;;AAWA;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAuB;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,EAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,EAAE,EAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAsB,WAAW,EAAE,EAAE,CAAC,CAAC;IAExG,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AAC/C,CAAC;AALD,oCAKC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getJsonEntityRelationships = exports.OBJECTION_RELATIONSHIP_KEY = void 0;
4
- const createColumns_js_1 = require("./createColumns.js");
5
- /**
6
- * @ignore
7
- */
8
- exports.OBJECTION_RELATIONSHIP_KEY = "objectionRelationship";
9
- /**
10
- * @ignore
11
- */
12
- function getJsonEntityRelationships(target) {
13
- return (0, createColumns_js_1.getColumns)(target)
14
- .filter((col) => col.store.get(exports.OBJECTION_RELATIONSHIP_KEY))
15
- .map((col) => col.store.get(exports.OBJECTION_RELATIONSHIP_KEY)(target))
16
- .reduce((dict, col) => ({ ...dict, ...col }), {});
17
- }
18
- exports.getJsonEntityRelationships = getJsonEntityRelationships;
19
- //# sourceMappingURL=getJsonEntityRelationships.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getJsonEntityRelationships.js","sourceRoot":"","sources":["../../../src/utils/getJsonEntityRelationships.ts"],"names":[],"mappings":";;;AAAA,yDAA8C;AAE9C;;GAEG;AACU,QAAA,0BAA0B,GAAG,uBAAuB,CAAC;AAElE;;GAEG;AACH,SAAgB,0BAA0B,CAAC,MAAW;IACpD,OAAO,IAAA,6BAAU,EAAC,MAAM,CAAC;SACtB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kCAA0B,CAAC,CAAC;SAC1D,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kCAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;SAC/D,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,GAAG,GAAG,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AALD,gEAKC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,6 +0,0 @@
1
- import type { Knex } from "knex";
2
- import { ColumnCtx } from "../utils/getColumnCtx.js";
3
- /**
4
- * @ignore
5
- */
6
- export declare function createBooleanColumn(table: Knex.TableBuilder, { entity }: ColumnCtx): void;
@@ -1,6 +0,0 @@
1
- import { ColumnCtx } from "../utils/getColumnCtx.js";
2
- import type { Knex } from "knex";
3
- /**
4
- * @ignore
5
- */
6
- export declare function createIdColumn(table: Knex.TableBuilder, { entity, options }: ColumnCtx): void;
@@ -1,6 +0,0 @@
1
- import type { Knex } from "knex";
2
- import { ColumnCtx } from "../utils/getColumnCtx.js";
3
- /**
4
- * @ignore
5
- */
6
- export declare function createNumberColumn(table: Knex.TableBuilder, { entity, options }: ColumnCtx): void;
@@ -1,6 +0,0 @@
1
- import type { Knex } from "knex";
2
- import { ColumnCtx } from "../utils/getColumnCtx.js";
3
- /**
4
- * @ignore
5
- */
6
- export declare function createStringColumn(table: Knex.TableBuilder, { entity, schema }: ColumnCtx): void;
@@ -1,8 +0,0 @@
1
- import { RelationshipOptsWithoutThrough } from "../domain/RelationshipOpts.js";
2
- /**
3
- *
4
- * @param opts
5
- * @decorator
6
- * @objection
7
- */
8
- export declare function BelongsToOne(opts?: RelationshipOptsWithoutThrough): PropertyDecorator;
@@ -1,8 +0,0 @@
1
- import type { ColumnOpts } from "../domain/ColumnOpts.js";
2
- /**
3
- *
4
- * @param options
5
- * @decorator
6
- * @objection
7
- */
8
- export declare function ColumnOptions(options: Partial<ColumnOpts>): PropertyDecorator;
@@ -1,11 +0,0 @@
1
- export interface DecimalOptions {
2
- precision?: number | null;
3
- scale?: number;
4
- }
5
- /**
6
- *
7
- * @param options
8
- * @decorator
9
- * @objection
10
- */
11
- export declare function Decimal(options?: DecimalOptions): any;
@@ -1,11 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- /**
3
- *
4
- * @param tableName
5
- * @decorator
6
- * @objection
7
- */
8
- export declare function Entity(tableName: string): ClassDecorator;
9
- export interface EntityMethods<T> extends Type<T> {
10
- readonly tableName: string;
11
- }
@@ -1,9 +0,0 @@
1
- import { ModelClassSpecifier } from "objection";
2
- import { RelationshipOptsWithThrough } from "../domain/RelationshipOpts.js";
3
- /**
4
- *
5
- * @param opts
6
- * @decorator
7
- * @objection
8
- */
9
- export declare function HasMany(type: ModelClassSpecifier, opts?: RelationshipOptsWithThrough): PropertyDecorator;
@@ -1,8 +0,0 @@
1
- import { RelationshipOptsWithoutThrough } from "../domain/RelationshipOpts.js";
2
- /**
3
- *
4
- * @param opts
5
- * @decorator
6
- * @objection
7
- */
8
- export declare function HasOne(opts?: RelationshipOptsWithoutThrough): PropertyDecorator;
@@ -1,8 +0,0 @@
1
- import { RelationshipOptsWithThrough } from "../domain/RelationshipOpts.js";
2
- /**
3
- *
4
- * @param opts
5
- * @decorator
6
- * @objection
7
- */
8
- export declare function HasOneThroughRelation(opts?: RelationshipOptsWithThrough): PropertyDecorator;
@@ -1,7 +0,0 @@
1
- /**
2
- *
3
- * @param type
4
- * @decorator
5
- * @objection
6
- */
7
- export declare function IdColumn(type?: "uuid" | "increments" | "bigIncrements"): PropertyDecorator;
@@ -1,9 +0,0 @@
1
- import { ModelClassSpecifier } from "objection";
2
- import { RelationshipOptsWithThrough } from "../domain/RelationshipOpts.js";
3
- /**
4
- *
5
- * @param opts
6
- * @decorator
7
- * @objection
8
- */
9
- export declare function ManyToMany(type: ModelClassSpecifier, opts?: RelationshipOptsWithThrough): PropertyDecorator;
@@ -1,10 +0,0 @@
1
- import { RelationshipOpts } from "../domain/RelationshipOpts.js";
2
- import { RelationType } from "objection";
3
- /**
4
- *
5
- * @param relation
6
- * @param opts
7
- * @decorator
8
- * @objection
9
- */
10
- export declare function RelatesTo(relation: RelationType, opts?: RelationshipOpts): PropertyDecorator;
@@ -1,4 +0,0 @@
1
- export interface ColumnOpts {
2
- columnType: "idColumn" | "string" | "number" | "boolean";
3
- options: any;
4
- }
@@ -1,8 +0,0 @@
1
- import { ModelClassFactory, ModelClassSpecifier, RelationJoin, RelationMapping } from "objection";
2
- export type RelationshipOptsWithThrough = Partial<RelationJoin> & Omit<RelationMapping<any>, "relation" | "join" | "modelClass">;
3
- export type RelationshipOptsWithoutThrough = Omit<RelationshipOptsWithThrough, "through">;
4
- export type RelationshipOpts = (RelationshipOptsWithThrough | RelationshipOptsWithoutThrough) & {
5
- type?: ModelClassSpecifier;
6
- };
7
- export declare const isRelationshipOptsWithThrough: (opts?: RelationshipOpts) => opts is RelationshipOptsWithThrough;
8
- export declare const isModelClassFactory: (type?: ModelClassSpecifier) => type is ModelClassFactory;
@@ -1,8 +0,0 @@
1
- import { Knex } from "knex";
2
- declare global {
3
- namespace TsED {
4
- interface Configuration {
5
- knex: Knex.Config;
6
- }
7
- }
8
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./components/createBooleanColumn.js";
5
- export * from "./components/createIdColumn.js";
6
- export * from "./components/createNumberColumn.js";
7
- export * from "./components/createStringColumn.js";
8
- export * from "./decorators/belongsToOne.js";
9
- export * from "./decorators/columnOptions.js";
10
- export * from "./decorators/decimal.js";
11
- export * from "./decorators/entity.js";
12
- export * from "./decorators/hasMany.js";
13
- export * from "./decorators/hasOne.js";
14
- export * from "./decorators/hasOneThroughRelation.js";
15
- export * from "./decorators/idColumn.js";
16
- export * from "./decorators/manyToMany.js";
17
- export * from "./decorators/relatesTo.js";
18
- export * from "./domain/ColumnOpts.js";
19
- export * from "./domain/interfaces.js";
20
- export * from "./domain/RelationshipOpts.js";
21
- export * from "./services/ColumnTypesContainer.js";
22
- export * from "./services/ObjectionConnection.js";
23
- export * from "./utils/connect.js";
24
- export * from "./utils/createColumns.js";
25
- export * from "./utils/createJoinKeys.js";
26
- export * from "./utils/createRelationshipMapping.js";
27
- export * from "./utils/defineStaticGetter.js";
28
- export * from "./utils/getColumnCtx.js";
29
- export * from "./utils/getJsonEntityRelationships.js";
@@ -1,6 +0,0 @@
1
- import type { Knex } from "knex";
2
- import { ColumnCtx } from "../utils/getColumnCtx.js";
3
- /**
4
- * @ignore
5
- */
6
- export declare const ColumnTypesContainer: Map<string, (table: Knex.TableBuilder, ctx: ColumnCtx) => void>;
@@ -1,3 +0,0 @@
1
- import type { Knex } from "knex";
2
- export declare const OBJECTION_CONNECTION: unique symbol;
3
- export type OBJECTION_CONNECTION = Knex<any, unknown[]>;
@@ -1,2 +0,0 @@
1
- import { Knex } from "knex";
2
- export declare function createConnection(connectionOptions: Knex.Config): Knex;
@@ -1,18 +0,0 @@
1
- import { JsonEntityStore } from "@tsed/schema";
2
- import { Knex } from "knex";
3
- import "../components/createBooleanColumn";
4
- import "../components/createIdColumn";
5
- import "../components/createNumberColumn";
6
- import "../components/createStringColumn";
7
- /**
8
- * @ignore
9
- */
10
- export declare function createColumn(table: Knex.TableBuilder, entity: JsonEntityStore): void;
11
- /**
12
- * @ignore
13
- */
14
- export declare function getColumns(model: any): import("@tsed/schema").JsonPropertyStore[];
15
- /**
16
- * @ignore
17
- */
18
- export declare function createColumns(table: Knex.TableBuilder, model: any): void;
@@ -1,14 +0,0 @@
1
- import { RelationType } from "objection";
2
- import { RelationshipOpts } from "../domain/RelationshipOpts.js";
3
- /**
4
- * @ignore
5
- */
6
- export declare function createJoinKeys(targetClass: any, targetSuper: any, propertyKey: string, relation: RelationType, opts?: RelationshipOpts): {
7
- from: string;
8
- to: string;
9
- through?: undefined;
10
- } | {
11
- from: string;
12
- through: import("objection").RelationThrough<any>;
13
- to: string;
14
- };