@tsed/objection 6.132.1 → 6.133.1
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/cjs/components/createIdColumn.js +10 -5
- package/lib/cjs/components/createIdColumn.js.map +1 -1
- package/lib/cjs/decorators/idColumn.js +2 -2
- package/lib/cjs/decorators/idColumn.js.map +1 -1
- package/lib/esm/components/createIdColumn.js +10 -5
- package/lib/esm/components/createIdColumn.js.map +1 -1
- package/lib/esm/decorators/idColumn.js +2 -2
- package/lib/esm/decorators/idColumn.js.map +1 -1
- package/lib/types/components/createIdColumn.d.ts +1 -1
- package/lib/types/decorators/idColumn.d.ts +1 -1
- package/package.json +11 -11
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createIdColumn = void 0;
|
|
4
4
|
const ColumnTypesContainer_1 = require("../services/ColumnTypesContainer");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
5
6
|
/**
|
|
6
7
|
* @ignore
|
|
7
8
|
*/
|
|
8
9
|
function createIdColumn(table, { entity, options }) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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)());
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
exports.createIdColumn = createIdColumn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIdColumn.js","sourceRoot":"","sources":["../../../src/components/createIdColumn.ts"],"names":[],"mappings":";;;AACA,2EAAsE;
|
|
1
|
+
{"version":3,"file":"createIdColumn.js","sourceRoot":"","sources":["../../../src/components/createIdColumn.ts"],"names":[],"mappings":";;;AACA,2EAAsE;AAEtE,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,2CAAoB,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {ColumnCtx} from \"../utils/getColumnCtx\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport type {Knex} from \"knex\";\nimport {randomUUID} from \"crypto\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n switch (options.type) {\n case \"bigIncrements\":\n table.bigIncrements(entity.propertyName).primary();\n break;\n case \"increments\":\n table.increments(entity.propertyName).primary();\n break;\n case \"uuid\":\n table.uuid(entity.propertyName).primary().defaultTo(randomUUID());\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdColumn = void 0;
|
|
4
|
-
const
|
|
4
|
+
const columnOptions_1 = require("./columnOptions");
|
|
5
5
|
const schema_1 = require("@tsed/schema");
|
|
6
6
|
const defineStaticGetter_1 = require("../utils/defineStaticGetter");
|
|
7
|
-
const
|
|
7
|
+
const core_1 = require("@tsed/core");
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
10
|
* @param type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idColumn.js","sourceRoot":"","sources":["../../../src/decorators/idColumn.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"idColumn.js","sourceRoot":"","sources":["../../../src/decorators/idColumn.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,yCAAsC;AACtC,oEAA+D;AAC/D,qCAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,OAAgD,YAAY;IACnF,OAAO,IAAA,oBAAa,EAClB,IAAA,iBAAQ,GAAE,EACV,IAAA,6BAAa,EAAC;QACZ,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE;YACP,IAAI;SACL;KACF,CAAC,EACF,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACnC,IAAA,uCAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC;AAbD,4BAaC","sourcesContent":["import {ColumnOptions} from \"./columnOptions\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {useDecorators} from \"@tsed/core\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"uuid\" | \"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"]}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { ColumnTypesContainer } from "../services/ColumnTypesContainer.js";
|
|
2
|
+
import { randomUUID } from "crypto";
|
|
2
3
|
/**
|
|
3
4
|
* @ignore
|
|
4
5
|
*/
|
|
5
6
|
export function createIdColumn(table, { entity, options }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
switch (options.type) {
|
|
8
|
+
case "bigIncrements":
|
|
9
|
+
table.bigIncrements(entity.propertyName).primary();
|
|
10
|
+
break;
|
|
11
|
+
case "increments":
|
|
12
|
+
table.increments(entity.propertyName).primary();
|
|
13
|
+
break;
|
|
14
|
+
case "uuid":
|
|
15
|
+
table.uuid(entity.propertyName).primary().defaultTo(randomUUID());
|
|
11
16
|
}
|
|
12
17
|
}
|
|
13
18
|
ColumnTypesContainer.set("idColumn", createIdColumn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIdColumn.js","sourceRoot":"","sources":["../../../src/components/createIdColumn.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"createIdColumn.js","sourceRoot":"","sources":["../../../src/components/createIdColumn.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,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,UAAU,EAAE,CAAC,CAAC;KACrE;AACH,CAAC;AAED,oBAAoB,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {ColumnCtx} from \"../utils/getColumnCtx\";\nimport {ColumnTypesContainer} from \"../services/ColumnTypesContainer\";\nimport type {Knex} from \"knex\";\nimport {randomUUID} from \"crypto\";\n\n/**\n * @ignore\n */\nexport function createIdColumn(table: Knex.TableBuilder, {entity, options}: ColumnCtx) {\n switch (options.type) {\n case \"bigIncrements\":\n table.bigIncrements(entity.propertyName).primary();\n break;\n case \"increments\":\n table.increments(entity.propertyName).primary();\n break;\n case \"uuid\":\n table.uuid(entity.propertyName).primary().defaultTo(randomUUID());\n }\n}\n\nColumnTypesContainer.set(\"idColumn\", createIdColumn);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnOptions } from "./columnOptions.js";
|
|
2
2
|
import { Property } from "@tsed/schema";
|
|
3
3
|
import { defineStaticGetter } from "../utils/defineStaticGetter.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useDecorators } from "@tsed/core";
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idColumn.js","sourceRoot":"","sources":["../../../src/decorators/idColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"idColumn.js","sourceRoot":"","sources":["../../../src/decorators/idColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAgD,YAAY;IACnF,OAAO,aAAa,CAClB,QAAQ,EAAE,EACV,aAAa,CAAC;QACZ,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE;YACP,IAAI;SACL;KACF,CAAC,EACF,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACnC,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import {ColumnOptions} from \"./columnOptions\";\nimport {Property} from \"@tsed/schema\";\nimport {defineStaticGetter} from \"../utils/defineStaticGetter\";\nimport {useDecorators} from \"@tsed/core\";\n\n/**\n *\n * @param type\n * @decorator\n * @objection\n */\nexport function IdColumn(type: \"uuid\" | \"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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/objection",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.133.1",
|
|
4
4
|
"description": "Objection.js package for Ts.ED framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"tslib": "2.4.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsed/ajv": "6.
|
|
28
|
-
"@tsed/core": "6.
|
|
29
|
-
"@tsed/di": "6.
|
|
30
|
-
"@tsed/json-mapper": "6.
|
|
31
|
-
"@tsed/schema": "6.
|
|
27
|
+
"@tsed/ajv": "6.133.1",
|
|
28
|
+
"@tsed/core": "6.133.1",
|
|
29
|
+
"@tsed/di": "6.133.1",
|
|
30
|
+
"@tsed/json-mapper": "6.133.1",
|
|
31
|
+
"@tsed/schema": "6.133.1",
|
|
32
32
|
"knex": "^0.95.11",
|
|
33
33
|
"objection": "^2.2.15",
|
|
34
34
|
"sqlite3": "^5.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@tsed/ajv": "^6.
|
|
38
|
-
"@tsed/core": "^6.
|
|
39
|
-
"@tsed/di": "^6.
|
|
40
|
-
"@tsed/json-mapper": "^6.
|
|
41
|
-
"@tsed/schema": "^6.
|
|
37
|
+
"@tsed/ajv": "^6.133.1",
|
|
38
|
+
"@tsed/core": "^6.133.1",
|
|
39
|
+
"@tsed/di": "^6.133.1",
|
|
40
|
+
"@tsed/json-mapper": "^6.133.1",
|
|
41
|
+
"@tsed/schema": "^6.133.1",
|
|
42
42
|
"knex": ">=0.94.0",
|
|
43
43
|
"objection": ">=2.0.0"
|
|
44
44
|
},
|