@tsed/objection 8.0.0-alpha.4 → 8.0.0-alpha.6
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/esm/utils/createColumns.js.map +1 -1
- package/lib/types/utils/createColumns.d.ts +4 -4
- package/package.json +15 -16
- package/lib/cjs/components/createBooleanColumn.js +0 -13
- package/lib/cjs/components/createBooleanColumn.js.map +0 -1
- package/lib/cjs/components/createIdColumn.js +0 -23
- package/lib/cjs/components/createIdColumn.js.map +0 -1
- package/lib/cjs/components/createNumberColumn.js +0 -13
- package/lib/cjs/components/createNumberColumn.js.map +0 -1
- package/lib/cjs/components/createStringColumn.js +0 -13
- package/lib/cjs/components/createStringColumn.js.map +0 -1
- package/lib/cjs/decorators/belongsToOne.js +0 -16
- package/lib/cjs/decorators/belongsToOne.js.map +0 -1
- package/lib/cjs/decorators/columnOptions.js +0 -15
- package/lib/cjs/decorators/columnOptions.js.map +0 -1
- package/lib/cjs/decorators/decimal.js +0 -29
- package/lib/cjs/decorators/decimal.js.map +0 -1
- package/lib/cjs/decorators/entity.js +0 -26
- package/lib/cjs/decorators/entity.js.map +0 -1
- package/lib/cjs/decorators/hasMany.js +0 -16
- package/lib/cjs/decorators/hasMany.js.map +0 -1
- package/lib/cjs/decorators/hasOne.js +0 -16
- package/lib/cjs/decorators/hasOne.js.map +0 -1
- package/lib/cjs/decorators/hasOneThroughRelation.js +0 -16
- package/lib/cjs/decorators/hasOneThroughRelation.js.map +0 -1
- package/lib/cjs/decorators/idColumn.js +0 -25
- package/lib/cjs/decorators/idColumn.js.map +0 -1
- package/lib/cjs/decorators/manyToMany.js +0 -16
- package/lib/cjs/decorators/manyToMany.js.map +0 -1
- package/lib/cjs/decorators/relatesTo.js +0 -25
- package/lib/cjs/decorators/relatesTo.js.map +0 -1
- package/lib/cjs/domain/ColumnOpts.js +0 -3
- package/lib/cjs/domain/ColumnOpts.js.map +0 -1
- package/lib/cjs/domain/RelationshipOpts.js +0 -9
- package/lib/cjs/domain/RelationshipOpts.js.map +0 -1
- package/lib/cjs/domain/interfaces.js +0 -3
- package/lib/cjs/domain/interfaces.js.map +0 -1
- package/lib/cjs/index.js +0 -33
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/services/ColumnTypesContainer.js +0 -8
- package/lib/cjs/services/ColumnTypesContainer.js.map +0 -1
- package/lib/cjs/services/ObjectionConnection.js +0 -24
- package/lib/cjs/services/ObjectionConnection.js.map +0 -1
- package/lib/cjs/utils/connect.js +0 -13
- package/lib/cjs/utils/connect.js.map +0 -1
- package/lib/cjs/utils/createColumns.js +0 -38
- package/lib/cjs/utils/createColumns.js.map +0 -1
- package/lib/cjs/utils/createJoinKeys.js +0 -40
- package/lib/cjs/utils/createJoinKeys.js.map +0 -1
- package/lib/cjs/utils/createRelationshipMapping.js +0 -22
- package/lib/cjs/utils/createRelationshipMapping.js.map +0 -1
- package/lib/cjs/utils/defineStaticGetter.js +0 -14
- package/lib/cjs/utils/defineStaticGetter.js.map +0 -1
- package/lib/cjs/utils/getColumnCtx.js +0 -13
- package/lib/cjs/utils/getColumnCtx.js.map +0 -1
- package/lib/cjs/utils/getJsonEntityRelationships.js +0 -19
- package/lib/cjs/utils/getJsonEntityRelationships.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/components/createBooleanColumn.d.ts +0 -6
- package/lib/types-esm/components/createIdColumn.d.ts +0 -6
- package/lib/types-esm/components/createNumberColumn.d.ts +0 -6
- package/lib/types-esm/components/createStringColumn.d.ts +0 -6
- package/lib/types-esm/decorators/belongsToOne.d.ts +0 -8
- package/lib/types-esm/decorators/columnOptions.d.ts +0 -8
- package/lib/types-esm/decorators/decimal.d.ts +0 -11
- package/lib/types-esm/decorators/entity.d.ts +0 -11
- package/lib/types-esm/decorators/hasMany.d.ts +0 -9
- package/lib/types-esm/decorators/hasOne.d.ts +0 -8
- package/lib/types-esm/decorators/hasOneThroughRelation.d.ts +0 -8
- package/lib/types-esm/decorators/idColumn.d.ts +0 -7
- package/lib/types-esm/decorators/manyToMany.d.ts +0 -9
- package/lib/types-esm/decorators/relatesTo.d.ts +0 -10
- package/lib/types-esm/domain/ColumnOpts.d.ts +0 -4
- package/lib/types-esm/domain/RelationshipOpts.d.ts +0 -8
- package/lib/types-esm/domain/interfaces.d.ts +0 -8
- package/lib/types-esm/index.d.ts +0 -29
- package/lib/types-esm/services/ColumnTypesContainer.d.ts +0 -6
- package/lib/types-esm/services/ObjectionConnection.d.ts +0 -3
- package/lib/types-esm/utils/connect.d.ts +0 -2
- package/lib/types-esm/utils/createColumns.d.ts +0 -18
- package/lib/types-esm/utils/createJoinKeys.d.ts +0 -14
- package/lib/types-esm/utils/createRelationshipMapping.d.ts +0 -24
- package/lib/types-esm/utils/defineStaticGetter.d.ts +0 -4
- package/lib/types-esm/utils/getColumnCtx.d.ts +0 -13
- package/lib/types-esm/utils/getJsonEntityRelationships.d.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createColumns.js","sourceRoot":"","sources":["../../../src/utils/createColumns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAkB,MAAM,cAAc,CAAC;AAE5D,OAAO,
|
|
1
|
+
{"version":3,"file":"createColumns.js","sourceRoot":"","sources":["../../../src/utils/createColumns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAkB,MAAM,cAAc,CAAC;AAE5D,OAAO,sCAAsC,CAAC;AAC9C,OAAO,iCAAiC,CAAC;AACzC,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB,EAAE,MAAuB;IAC5E,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAEjC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC7C,MAAM,eAAe,GAAG,CAAC,UAAU,oFAAoF,CAAC;KACzH;IAED,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAU;IACnC,OAAO,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,EAAC,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACtG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { JsonEntityStore } from "@tsed/schema";
|
|
2
2
|
import { Knex } from "knex";
|
|
3
|
-
import "../components/createBooleanColumn";
|
|
4
|
-
import "../components/createIdColumn";
|
|
5
|
-
import "../components/createNumberColumn";
|
|
6
|
-
import "../components/createStringColumn";
|
|
3
|
+
import "../components/createBooleanColumn.js";
|
|
4
|
+
import "../components/createIdColumn.js";
|
|
5
|
+
import "../components/createNumberColumn.js";
|
|
6
|
+
import "../components/createStringColumn.js";
|
|
7
7
|
/**
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/objection",
|
|
3
3
|
"description": "Objection.js package for Ts.ED framework",
|
|
4
|
-
"type": "
|
|
5
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "8.0.0-alpha.6",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/
|
|
7
|
+
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./lib/types/index.d.ts",
|
|
13
13
|
"import": "./lib/esm/index.js",
|
|
14
|
-
"require": "./lib/cjs/index.js",
|
|
15
14
|
"default": "./lib/cjs/index.js"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
@@ -26,13 +25,13 @@
|
|
|
26
25
|
"tslib": "2.6.1"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@tsed/ajv": "8.0.0-alpha.
|
|
30
|
-
"@tsed/barrels": "8.0.0-alpha.
|
|
31
|
-
"@tsed/core": "8.0.0-alpha.
|
|
32
|
-
"@tsed/di": "8.0.0-alpha.
|
|
33
|
-
"@tsed/json-mapper": "8.0.0-alpha.
|
|
34
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
35
|
-
"@tsed/typescript": "8.0.0-alpha.
|
|
28
|
+
"@tsed/ajv": "8.0.0-alpha.6",
|
|
29
|
+
"@tsed/barrels": "8.0.0-alpha.6",
|
|
30
|
+
"@tsed/core": "8.0.0-alpha.6",
|
|
31
|
+
"@tsed/di": "8.0.0-alpha.6",
|
|
32
|
+
"@tsed/json-mapper": "8.0.0-alpha.6",
|
|
33
|
+
"@tsed/schema": "8.0.0-alpha.6",
|
|
34
|
+
"@tsed/typescript": "8.0.0-alpha.6",
|
|
36
35
|
"eslint": "^8.57.0",
|
|
37
36
|
"knex": "^3.1.0",
|
|
38
37
|
"objection": "^2.2.18",
|
|
@@ -41,11 +40,11 @@
|
|
|
41
40
|
"vitest": "2.0.4"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
|
-
"@tsed/ajv": "8.0.0-alpha.
|
|
45
|
-
"@tsed/core": "8.0.0-alpha.
|
|
46
|
-
"@tsed/di": "8.0.0-alpha.
|
|
47
|
-
"@tsed/json-mapper": "8.0.0-alpha.
|
|
48
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
43
|
+
"@tsed/ajv": "8.0.0-alpha.6",
|
|
44
|
+
"@tsed/core": "8.0.0-alpha.6",
|
|
45
|
+
"@tsed/di": "8.0.0-alpha.6",
|
|
46
|
+
"@tsed/json-mapper": "8.0.0-alpha.6",
|
|
47
|
+
"@tsed/schema": "8.0.0-alpha.6",
|
|
49
48
|
"knex": ">=0.94.0",
|
|
50
49
|
"objection": ">=2.0.0"
|
|
51
50
|
},
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBooleanColumn = void 0;
|
|
4
|
-
const ColumnTypesContainer_js_1 = require("../services/ColumnTypesContainer.js");
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
function createBooleanColumn(table, { entity }) {
|
|
9
|
-
table.boolean(entity.propertyName);
|
|
10
|
-
}
|
|
11
|
-
exports.createBooleanColumn = createBooleanColumn;
|
|
12
|
-
ColumnTypesContainer_js_1.ColumnTypesContainer.set("boolean", createBooleanColumn);
|
|
13
|
-
//# sourceMappingURL=createBooleanColumn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBooleanColumn.js","sourceRoot":"","sources":["../../../src/components/createBooleanColumn.ts"],"names":[],"mappings":";;;AACA,iFAAyE;AAEzE;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAwB,EAAE,EAAC,MAAM,EAAY;IAC/E,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAFD,kDAEC;AAED,8CAAoB,CAAC,GAAG,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createIdColumn = void 0;
|
|
4
|
-
const ColumnTypesContainer_js_1 = require("../services/ColumnTypesContainer.js");
|
|
5
|
-
const crypto_1 = require("crypto");
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
function createIdColumn(table, { entity, options }) {
|
|
10
|
-
switch (options.type) {
|
|
11
|
-
case "bigIncrements":
|
|
12
|
-
table.bigIncrements(entity.propertyName).primary();
|
|
13
|
-
break;
|
|
14
|
-
case "increments":
|
|
15
|
-
table.increments(entity.propertyName).primary();
|
|
16
|
-
break;
|
|
17
|
-
case "uuid":
|
|
18
|
-
table.uuid(entity.propertyName).primary().defaultTo((0, crypto_1.randomUUID)());
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.createIdColumn = createIdColumn;
|
|
22
|
-
ColumnTypesContainer_js_1.ColumnTypesContainer.set("idColumn", createIdColumn);
|
|
23
|
-
//# sourceMappingURL=createIdColumn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createIdColumn.js","sourceRoot":"","sources":["../../../src/components/createIdColumn.ts"],"names":[],"mappings":";;;AACA,iFAAyE;AAEzE,mCAAkC;AAElC;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAwB,EAAE,EAAC,MAAM,EAAE,OAAO,EAAY;IACnF,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,eAAe;YAClB,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;YACnD,MAAM;QACR,KAAK,YAAY;YACf,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;YAChD,MAAM;QACR,KAAK,MAAM;YACT,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAA,mBAAU,GAAE,CAAC,CAAC;KACrE;AACH,CAAC;AAXD,wCAWC;AAED,8CAAoB,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNumberColumn = void 0;
|
|
4
|
-
const ColumnTypesContainer_js_1 = require("../services/ColumnTypesContainer.js");
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
function createNumberColumn(table, { entity, options }) {
|
|
9
|
-
table.decimal(entity.propertyName, options.precision, options.scale);
|
|
10
|
-
}
|
|
11
|
-
exports.createNumberColumn = createNumberColumn;
|
|
12
|
-
ColumnTypesContainer_js_1.ColumnTypesContainer.set("number", createNumberColumn);
|
|
13
|
-
//# sourceMappingURL=createNumberColumn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNumberColumn.js","sourceRoot":"","sources":["../../../src/components/createNumberColumn.ts"],"names":[],"mappings":";;;AACA,iFAAyE;AAGzE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,EAAC,MAAM,EAAE,OAAO,EAAY;IACvF,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAFD,gDAEC;AAED,8CAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStringColumn = void 0;
|
|
4
|
-
const ColumnTypesContainer_js_1 = require("../services/ColumnTypesContainer.js");
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
function createStringColumn(table, { entity, schema }) {
|
|
9
|
-
table.string(entity.propertyName, schema.maxLength);
|
|
10
|
-
}
|
|
11
|
-
exports.createStringColumn = createStringColumn;
|
|
12
|
-
ColumnTypesContainer_js_1.ColumnTypesContainer.set("string", createStringColumn);
|
|
13
|
-
//# sourceMappingURL=createStringColumn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStringColumn.js","sourceRoot":"","sources":["../../../src/components/createStringColumn.ts"],"names":[],"mappings":";;;AACA,iFAAyE;AAGzE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,EAAC,MAAM,EAAE,MAAM,EAAY;IACtF,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACtD,CAAC;AAFD,gDAEC;AAED,8CAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BelongsToOne = 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 BelongsToOne(opts) {
|
|
13
|
-
return (0, relatesTo_js_1.RelatesTo)(objection_1.Model.BelongsToOneRelation, opts);
|
|
14
|
-
}
|
|
15
|
-
exports.BelongsToOne = BelongsToOne;
|
|
16
|
-
//# sourceMappingURL=belongsToOne.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"belongsToOne.js","sourceRoot":"","sources":["../../../src/decorators/belongsToOne.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAChC,iDAAyC;AAGzC;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,IAAqC;IAChE,OAAO,IAAA,wBAAS,EAAC,iBAAK,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAFD,oCAEC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ColumnOptions = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param options
|
|
8
|
-
* @decorator
|
|
9
|
-
* @objection
|
|
10
|
-
*/
|
|
11
|
-
function ColumnOptions(options) {
|
|
12
|
-
return (0, core_1.StoreSet)("objection", options);
|
|
13
|
-
}
|
|
14
|
-
exports.ColumnOptions = ColumnOptions;
|
|
15
|
-
//# sourceMappingURL=columnOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"columnOptions.js","sourceRoot":"","sources":["../../../src/decorators/columnOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAGpC;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAA4B;IACxD,OAAO,IAAA,eAAQ,EAAC,WAAW,EAAE,OAAO,CAAQ,CAAC;AAC/C,CAAC;AAFD,sCAEC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Decimal = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const schema_1 = require("@tsed/schema");
|
|
6
|
-
const columnOptions_js_1 = require("./columnOptions.js");
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param options
|
|
10
|
-
* @decorator
|
|
11
|
-
* @objection
|
|
12
|
-
*/
|
|
13
|
-
function Decimal(options = {}) {
|
|
14
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(), (0, columnOptions_js_1.ColumnOptions)({
|
|
15
|
-
columnType: "number",
|
|
16
|
-
options: {
|
|
17
|
-
type: "decimal",
|
|
18
|
-
...options
|
|
19
|
-
}
|
|
20
|
-
}), (0, core_1.StoreSet)("objection", {
|
|
21
|
-
columnType: "number",
|
|
22
|
-
options: {
|
|
23
|
-
type: "decimal",
|
|
24
|
-
...options
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
exports.Decimal = Decimal;
|
|
29
|
-
//# sourceMappingURL=decimal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.js","sourceRoot":"","sources":["../../../src/decorators/decimal.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAsC;AACtC,yDAAiD;AAOjD;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,UAA0B,EAAE;IAClD,OAAO,IAAA,oBAAa,EAClB,IAAA,iBAAQ,GAAE,EACV,IAAA,gCAAa,EAAC;QACZ,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,GAAG,OAAO;SACX;KACF,CAAC,EACF,IAAA,eAAQ,EAAC,WAAW,EAAE;QACpB,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,GAAG,OAAO;SACX;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAlBD,0BAkBC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Entity = void 0;
|
|
4
|
-
const defineStaticGetter_js_1 = require("../utils/defineStaticGetter.js");
|
|
5
|
-
const getJsonEntityRelationships_js_1 = require("../utils/getJsonEntityRelationships.js");
|
|
6
|
-
const schema_1 = require("@tsed/schema");
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param tableName
|
|
10
|
-
* @decorator
|
|
11
|
-
* @objection
|
|
12
|
-
*/
|
|
13
|
-
function Entity(tableName) {
|
|
14
|
-
if (!tableName) {
|
|
15
|
-
throw new Error("Please provide a table name");
|
|
16
|
-
}
|
|
17
|
-
return (target) => {
|
|
18
|
-
const originalRelationMappings = target["relationMappings"];
|
|
19
|
-
(0, defineStaticGetter_js_1.defineStaticGetter)(target, "tableName", () => tableName);
|
|
20
|
-
(0, defineStaticGetter_js_1.defineStaticGetter)(target, "jsonSchema", () => (0, schema_1.getJsonSchema)(target));
|
|
21
|
-
(0, defineStaticGetter_js_1.defineStaticGetter)(target, "relationMappings", () => originalRelationMappings || (0, getJsonEntityRelationships_js_1.getJsonEntityRelationships)(target));
|
|
22
|
-
return target;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
exports.Entity = Entity;
|
|
26
|
-
//# sourceMappingURL=entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":";;;AACA,0EAAkE;AAClE,0FAAkF;AAClF,yCAA2C;AAE3C;;;;;GAKG;AACH,SAAgB,MAAM,CAAC,SAAiB;IACtC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAChD;IAED,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,MAAM,wBAAwB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC5D,IAAA,0CAAkB,EAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACzD,IAAA,0CAAkB,EAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,IAAA,sBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;QACtE,IAAA,0CAAkB,EAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE,CAAC,wBAAwB,IAAI,IAAA,0DAA0B,EAAC,MAAM,CAAC,CAAC,CAAC;QACrH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAZD,wBAYC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HasMany = 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 HasMany(type, opts) {
|
|
13
|
-
return (0, relatesTo_js_1.RelatesTo)(objection_1.Model.HasManyRelation, { ...opts, type });
|
|
14
|
-
}
|
|
15
|
-
exports.HasMany = HasMany;
|
|
16
|
-
//# sourceMappingURL=hasMany.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasMany.js","sourceRoot":"","sources":["../../../src/decorators/hasMany.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAErD,iDAAyC;AAGzC;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,IAAyB,EAAE,IAAkC;IACnF,OAAO,IAAA,wBAAS,EAAC,iBAAK,CAAC,eAAe,EAAE,EAAC,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AAC3D,CAAC;AAFD,0BAEC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HasOne = 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 HasOne(opts) {
|
|
13
|
-
return (0, relatesTo_js_1.RelatesTo)(objection_1.Model.HasOneRelation, opts);
|
|
14
|
-
}
|
|
15
|
-
exports.HasOne = HasOne;
|
|
16
|
-
//# sourceMappingURL=hasOne.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasOne.js","sourceRoot":"","sources":["../../../src/decorators/hasOne.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAChC,iDAAyC;AAGzC;;;;;GAKG;AACH,SAAgB,MAAM,CAAC,IAAqC;IAC1D,OAAO,IAAA,wBAAS,EAAC,iBAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAFD,wBAEC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HasOneThroughRelation = 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 HasOneThroughRelation(opts) {
|
|
13
|
-
return (0, relatesTo_js_1.RelatesTo)(objection_1.Model.HasOneThroughRelation, opts);
|
|
14
|
-
}
|
|
15
|
-
exports.HasOneThroughRelation = HasOneThroughRelation;
|
|
16
|
-
//# sourceMappingURL=hasOneThroughRelation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasOneThroughRelation.js","sourceRoot":"","sources":["../../../src/decorators/hasOneThroughRelation.ts"],"names":[],"mappings":";;;AAEA,yCAAgC;AAChC,iDAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,IAAkC;IACtE,OAAO,IAAA,wBAAS,EAAC,iBAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAFD,sDAEC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IdColumn = void 0;
|
|
4
|
-
const columnOptions_js_1 = require("./columnOptions.js");
|
|
5
|
-
const schema_1 = require("@tsed/schema");
|
|
6
|
-
const defineStaticGetter_js_1 = require("../utils/defineStaticGetter.js");
|
|
7
|
-
const core_1 = require("@tsed/core");
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param type
|
|
11
|
-
* @decorator
|
|
12
|
-
* @objection
|
|
13
|
-
*/
|
|
14
|
-
function IdColumn(type = "increments") {
|
|
15
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(), (0, columnOptions_js_1.ColumnOptions)({
|
|
16
|
-
columnType: "idColumn",
|
|
17
|
-
options: {
|
|
18
|
-
type
|
|
19
|
-
}
|
|
20
|
-
}), (target, propertyKey) => {
|
|
21
|
-
(0, defineStaticGetter_js_1.defineStaticGetter)(target, "idColumn", () => propertyKey);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.IdColumn = IdColumn;
|
|
25
|
-
//# sourceMappingURL=idColumn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idColumn.js","sourceRoot":"","sources":["../../../src/decorators/idColumn.ts"],"names":[],"mappings":";;;AAAA,yDAAiD;AACjD,yCAAsC;AACtC,0EAAkE;AAClE,qCAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,OAAgD,YAAY;IACnF,OAAO,IAAA,oBAAa,EAClB,IAAA,iBAAQ,GAAE,EACV,IAAA,gCAAa,EAAC;QACZ,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE;YACP,IAAI;SACL;KACF,CAAC,EACF,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACnC,IAAA,0CAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC;AAbD,4BAaC"}
|
|
@@ -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 +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 +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
|
package/lib/cjs/index.js.map
DELETED
|
@@ -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"}
|
package/lib/cjs/package.json
DELETED
|
@@ -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"}
|
package/lib/cjs/utils/connect.js
DELETED
|
@@ -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"}
|
package/lib/esm/package.json
DELETED
|
@@ -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,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,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;
|
package/lib/types-esm/index.d.ts
DELETED
|
@@ -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,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
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DecoratorParameters } from "@tsed/core";
|
|
2
|
-
import { RelationType } from "objection";
|
|
3
|
-
import { RelationshipOpts } from "../domain/RelationshipOpts.js";
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
export declare function createRelationshipMapping([target, propertyKey]: DecoratorParameters, relation: RelationType, opts?: RelationshipOpts): (targetClass: any) => {
|
|
8
|
-
[x: string]: {
|
|
9
|
-
relation: RelationType;
|
|
10
|
-
modelClass: any;
|
|
11
|
-
join: {
|
|
12
|
-
from: string;
|
|
13
|
-
to: string;
|
|
14
|
-
through?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
from: string;
|
|
17
|
-
through: import("objection").RelationThrough<any>;
|
|
18
|
-
to: string;
|
|
19
|
-
};
|
|
20
|
-
modify: import("objection").Modifier<any> | undefined;
|
|
21
|
-
filter: import("objection").Modifier<any> | undefined;
|
|
22
|
-
beforeInsert: import("objection").RelationMappingHook<any> | undefined;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JsonEntityStore } from "@tsed/schema";
|
|
2
|
-
import { ColumnOpts } from "../domain/ColumnOpts.js";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export interface ColumnCtx extends ColumnOpts {
|
|
7
|
-
entity: JsonEntityStore;
|
|
8
|
-
schema: any;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @ignore
|
|
12
|
-
*/
|
|
13
|
-
export declare function getColumnCtx(entity: JsonEntityStore): ColumnCtx;
|