@wisemen/nestjs-typeorm 0.1.4 → 0.2.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/LICENSE.md +59 -0
- package/dist/extensions/readonly.js +3 -1
- package/dist/extensions/readonly.js.map +1 -1
- package/dist/extensions/repository.js +1 -1
- package/dist/extensions/repository.js.map +1 -1
- package/dist/extensions/tests/repository-find-in-batches.test.js +33 -33
- package/dist/extensions/tests/repository-find-in-batches.test.js.map +1 -1
- package/dist/extensions/tests/sql/datasource.js +2 -2
- package/dist/extensions/tests/sql/datasource.js.map +1 -1
- package/dist/extensions/tests/sql/entities/message.entity.js +1 -1
- package/dist/extensions/tests/sql/entities/message.entity.js.map +1 -1
- package/dist/extensions/tests/sql/entities/user.entity.js +1 -1
- package/dist/extensions/tests/sql/entities/user.entity.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/types/default.type.d.ts +3 -5
- package/dist/types/insert.type.d.ts +1 -1
- package/package.json +31 -26
- package/dist/columns/coordinates-column.d.ts +0 -3
- package/dist/columns/coordinates-column.js +0 -33
- package/dist/columns/coordinates-column.js.map +0 -1
- package/dist/columns/index.d.ts +0 -2
- package/dist/columns/index.js +0 -3
- package/dist/columns/index.js.map +0 -1
- package/dist/columns/time-column.d.ts +0 -3
- package/dist/columns/time-column.js +0 -20
- package/dist/columns/time-column.js.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# PolyForm Strict License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/strict/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose, other than distributing the software or making changes or new works based on the software.
|
|
12
|
+
|
|
13
|
+
## Patent License
|
|
14
|
+
|
|
15
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
16
|
+
|
|
17
|
+
## Noncommercial Purposes
|
|
18
|
+
|
|
19
|
+
Any noncommercial purpose is a permitted purpose.
|
|
20
|
+
|
|
21
|
+
## Personal Uses
|
|
22
|
+
|
|
23
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
24
|
+
|
|
25
|
+
## Noncommercial Organizations
|
|
26
|
+
|
|
27
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
28
|
+
|
|
29
|
+
## Fair Use
|
|
30
|
+
|
|
31
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
32
|
+
|
|
33
|
+
## No Other Rights
|
|
34
|
+
|
|
35
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
36
|
+
|
|
37
|
+
## Patent Defense
|
|
38
|
+
|
|
39
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
40
|
+
|
|
41
|
+
## Violations
|
|
42
|
+
|
|
43
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
44
|
+
|
|
45
|
+
## No Liability
|
|
46
|
+
|
|
47
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
48
|
+
|
|
49
|
+
## Definitions
|
|
50
|
+
|
|
51
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
52
|
+
|
|
53
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
54
|
+
|
|
55
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
56
|
+
|
|
57
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
58
|
+
|
|
59
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
|
@@ -26,7 +26,9 @@ export function createReadonlyManagerProxy(defaultManager) {
|
|
|
26
26
|
const manager = readonlyStorage.getStore();
|
|
27
27
|
if (manager != null) {
|
|
28
28
|
if (prop === 'transaction') {
|
|
29
|
-
return (
|
|
29
|
+
return (() => {
|
|
30
|
+
throw new Error('Cannot call EntityManager.transaction inside a readonly context');
|
|
31
|
+
});
|
|
30
32
|
}
|
|
31
33
|
return manager[prop];
|
|
32
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["../../lib/extensions/readonly.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uCAAuC,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE/D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,UAAsB,EACtB,EAAoB;IAEpB,4DAA4D;IAC5D,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IACD,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["../../lib/extensions/readonly.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AAC;gBAED,OAAO,OAAO,CAAC,IAAI,CAAY,CAAA;YACjC,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAY,CAAA;QAChC,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -34,7 +34,7 @@ export class TypeOrmRepository extends Repository {
|
|
|
34
34
|
return this.findInBatches({ where }, batchSize);
|
|
35
35
|
}
|
|
36
36
|
addBatchingToOrder(order, keys) {
|
|
37
|
-
const batchOrder = Object.fromEntries(keys.map(
|
|
37
|
+
const batchOrder = Object.fromEntries(keys.map(key => [key, order?.[key] ?? 'ASC']));
|
|
38
38
|
return {
|
|
39
39
|
...order,
|
|
40
40
|
...batchOrder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../lib/extensions/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAyC,KAAK,EAAkB,YAAY,EAAoF,QAAQ,EAAE,QAAQ,EAAiB,UAAU,EAAE,MAAM,SAAS,CAAA;AAC1O,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,OAAO,iBAA2C,SAAQ,UAAc;IAC5E,YAAa,MAAuB,EAAE,OAAsB;QAC1D,MAAM,KAAK,GAAG,6BAA6B,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../lib/extensions/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAyC,KAAK,EAAkB,YAAY,EAAoF,QAAQ,EAAE,QAAQ,EAAiB,UAAU,EAAE,MAAM,SAAS,CAAA;AAC1O,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,OAAO,iBAA2C,SAA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1
|
-
import { after, before, describe, it } from
|
|
1
|
+
import { after, before, describe, it } from 'node:test';
|
|
2
2
|
import { expect } from 'expect';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { LessThan, MoreThanOrEqual } from 'typeorm';
|
|
4
|
+
import { dataSource } from './sql/datasource.js';
|
|
5
|
+
import { UserEntity } from './sql/entities/user.entity.js';
|
|
6
|
+
import { MessageEntity } from './sql/entities/message.entity.js';
|
|
7
|
+
import { TypeOrmRepository } from '#src/extensions/repository.js';
|
|
8
8
|
describe('Repository find in batches test', () => {
|
|
9
9
|
before(async () => {
|
|
10
10
|
await dataSource.initialize();
|
|
@@ -18,16 +18,16 @@ describe('Repository find in batches test', () => {
|
|
|
18
18
|
before(async () => {
|
|
19
19
|
repository = new TypeOrmRepository(UserEntity, dataSource.manager);
|
|
20
20
|
await repository.insert([
|
|
21
|
-
{ id: 1, name:
|
|
22
|
-
{ id: 2, name:
|
|
23
|
-
{ id: 3, name:
|
|
24
|
-
{ id: 4, name:
|
|
25
|
-
{ id: 5, name:
|
|
21
|
+
{ id: 1, name: 'Alice', age: 25 },
|
|
22
|
+
{ id: 2, name: 'Bob', age: 30 },
|
|
23
|
+
{ id: 3, name: 'Charlie', age: 28 },
|
|
24
|
+
{ id: 4, name: 'Diana', age: 22 },
|
|
25
|
+
{ id: 5, name: 'Eve', age: 35 }
|
|
26
26
|
]);
|
|
27
27
|
});
|
|
28
28
|
it('finds in batches without filters or sorting', async () => {
|
|
29
29
|
const result = repository.findInBatches({}, 2);
|
|
30
|
-
|
|
30
|
+
const batches = [];
|
|
31
31
|
for await (const batch of result) {
|
|
32
32
|
batches.push(batch);
|
|
33
33
|
}
|
|
@@ -35,17 +35,17 @@ describe('Repository find in batches test', () => {
|
|
|
35
35
|
expect(batches[0]).toHaveLength(2);
|
|
36
36
|
expect(batches[1]).toHaveLength(2);
|
|
37
37
|
expect(batches[2]).toHaveLength(1);
|
|
38
|
-
expect(batches[0][0].name).toBe(
|
|
39
|
-
expect(batches[0][1].name).toBe(
|
|
40
|
-
expect(batches[1][0].name).toBe(
|
|
41
|
-
expect(batches[1][1].name).toBe(
|
|
42
|
-
expect(batches[2][0].name).toBe(
|
|
38
|
+
expect(batches[0][0].name).toBe('Alice');
|
|
39
|
+
expect(batches[0][1].name).toBe('Bob');
|
|
40
|
+
expect(batches[1][0].name).toBe('Charlie');
|
|
41
|
+
expect(batches[1][1].name).toBe('Diana');
|
|
42
|
+
expect(batches[2][0].name).toBe('Eve');
|
|
43
43
|
});
|
|
44
44
|
it('finds in batches without filters with sorting', async () => {
|
|
45
45
|
const result = repository.findInBatches({
|
|
46
46
|
order: { name: 'DESC' }
|
|
47
47
|
}, 2);
|
|
48
|
-
|
|
48
|
+
const batches = [];
|
|
49
49
|
for await (const batch of result) {
|
|
50
50
|
batches.push(batch);
|
|
51
51
|
}
|
|
@@ -53,17 +53,17 @@ describe('Repository find in batches test', () => {
|
|
|
53
53
|
expect(batches[0]).toHaveLength(2);
|
|
54
54
|
expect(batches[1]).toHaveLength(2);
|
|
55
55
|
expect(batches[2]).toHaveLength(1);
|
|
56
|
-
expect(batches[0][0].name).toBe(
|
|
57
|
-
expect(batches[0][1].name).toBe(
|
|
58
|
-
expect(batches[1][0].name).toBe(
|
|
59
|
-
expect(batches[1][1].name).toBe(
|
|
60
|
-
expect(batches[2][0].name).toBe(
|
|
56
|
+
expect(batches[0][0].name).toBe('Eve');
|
|
57
|
+
expect(batches[0][1].name).toBe('Diana');
|
|
58
|
+
expect(batches[1][0].name).toBe('Charlie');
|
|
59
|
+
expect(batches[1][1].name).toBe('Bob');
|
|
60
|
+
expect(batches[2][0].name).toBe('Alice');
|
|
61
61
|
});
|
|
62
62
|
it('finds in batches with filters without sorting', async () => {
|
|
63
63
|
const result = repository.findInBatches({
|
|
64
64
|
where: { age: LessThan(30) }
|
|
65
65
|
}, 2);
|
|
66
|
-
|
|
66
|
+
const batches = [];
|
|
67
67
|
for await (const batch of result) {
|
|
68
68
|
batches.push(batch);
|
|
69
69
|
}
|
|
@@ -79,7 +79,7 @@ describe('Repository find in batches test', () => {
|
|
|
79
79
|
where: { age: LessThan(30) },
|
|
80
80
|
order: { age: 'ASC' }
|
|
81
81
|
}, 2);
|
|
82
|
-
|
|
82
|
+
const batches = [];
|
|
83
83
|
for await (const batch of result) {
|
|
84
84
|
batches.push(batch);
|
|
85
85
|
}
|
|
@@ -95,7 +95,7 @@ describe('Repository find in batches test', () => {
|
|
|
95
95
|
where: [{ age: LessThan(25) }, { age: MoreThanOrEqual(30) }],
|
|
96
96
|
order: { age: 'DESC' }
|
|
97
97
|
}, 2);
|
|
98
|
-
|
|
98
|
+
const batches = [];
|
|
99
99
|
for await (const batch of result) {
|
|
100
100
|
batches.push(batch);
|
|
101
101
|
}
|
|
@@ -115,18 +115,18 @@ describe('Repository find in batches test', () => {
|
|
|
115
115
|
const past = new Date(now.getTime() - 1000);
|
|
116
116
|
const future = new Date(now.getTime() + 1000);
|
|
117
117
|
await repository.insert([
|
|
118
|
-
{ id: 1, createdAt: now, message:
|
|
119
|
-
{ id: 2, createdAt: past, message:
|
|
120
|
-
{ id: 3, createdAt: future, message:
|
|
121
|
-
{ id: 4, createdAt: now, message:
|
|
122
|
-
{ id: 5, createdAt: past, message:
|
|
118
|
+
{ id: 1, createdAt: now, message: 'Message 1' },
|
|
119
|
+
{ id: 2, createdAt: past, message: 'Message 2' },
|
|
120
|
+
{ id: 3, createdAt: future, message: 'Message 3' },
|
|
121
|
+
{ id: 4, createdAt: now, message: 'Message 4' },
|
|
122
|
+
{ id: 5, createdAt: past, message: 'Message 5' }
|
|
123
123
|
]);
|
|
124
124
|
});
|
|
125
125
|
it('finds in batches with implicit secondary sorting', async () => {
|
|
126
126
|
const result = repository.findInBatches({
|
|
127
127
|
order: { createdAt: 'DESC' }
|
|
128
128
|
}, 2);
|
|
129
|
-
|
|
129
|
+
const batches = [];
|
|
130
130
|
for await (const batch of result) {
|
|
131
131
|
batches.push(batch);
|
|
132
132
|
}
|
|
@@ -144,7 +144,7 @@ describe('Repository find in batches test', () => {
|
|
|
144
144
|
const result = repository.findInBatches({
|
|
145
145
|
order: { createdAt: 'DESC', id: 'DESC' }
|
|
146
146
|
}, 2);
|
|
147
|
-
|
|
147
|
+
const batches = [];
|
|
148
148
|
for await (const batch of result) {
|
|
149
149
|
batches.push(batch);
|
|
150
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-find-in-batches.test.js","sourceRoot":"","sources":["../../../lib/extensions/tests/repository-find-in-batches.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"repository-find-in-batches.test.js","sourceRoot":"","sources":["../../../lib/extensions/tests/repository-find-in-batches.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,MAAM,UAAU,CAAC,UAAU,EAAE,CAAA;QAC7B,MAAM,UAAU,CAAC,WAAW,CAAC,IA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CAAC,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataSource } from 'typeorm';
|
|
2
|
-
import { SnakeNamingStrategy } from '
|
|
3
|
-
import { sslHelper } from '
|
|
2
|
+
import { SnakeNamingStrategy } from '#src/naming/snake-case.naming-strategy.js';
|
|
3
|
+
import { sslHelper } from '#src/helpers/ssl.js';
|
|
4
4
|
export const dataSource = new DataSource({
|
|
5
5
|
name: 'default',
|
|
6
6
|
type: 'postgres',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../../../lib/extensions/tests/sql/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../../../lib/extensions/tests/sql/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;IACvC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;IAC7B,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACxC,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IAClB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,CAAC,qBAAqB,CAAC;IACjC,cAAc,EAAE,IAAI,mBAAmB,EAAE;CAC1C,CAAC,CAAA"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { Column, Entity, PrimaryGeneratedColumn } from
|
|
10
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
11
11
|
let MessageEntity = class MessageEntity {
|
|
12
12
|
id;
|
|
13
13
|
createdAt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../../../../lib/extensions/tests/sql/entities/message.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../../../../lib/extensions/tests/sql/entities/message.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGzD,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,EAAE,CAAQ;IAGV,SAAS,CAAM;IAGf,OAAO,CAAQ;CAChB,CAAA;AAPC;IADC,sBAAsB,EAAE;;yCACf;AAGV;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BACnB,IAAI;gDAAA;AAGf;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;8CACb;AARJ,aAAa;IADzB,MAAM,EAAE;GACI,aAAa,CASzB"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { Column, Entity, PrimaryGeneratedColumn } from
|
|
10
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
11
11
|
let UserEntity = class UserEntity {
|
|
12
12
|
id;
|
|
13
13
|
name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../lib/extensions/tests/sql/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../lib/extensions/tests/sql/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGzD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB,EAAE,CAAQ;IAGV,IAAI,CAAQ;IAGZ,GAAG,CAAQ;CACZ,CAAA;AAPC;IADC,sBAAsB,EAAE;;sCACf;AAGV;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;wCAChB;AAGZ;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;uCACb;AARA,UAAU;IADtB,MAAM,EAAE;GACI,UAAU,CAStB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { InjectRepository, InjectEntityManager, InjectDataSource, getDataSourceToken } from '@nestjs/typeorm';
|
|
2
2
|
export * from './extensions/index.js';
|
|
3
|
-
export * from './columns/index.js';
|
|
4
3
|
export * from './operators/index.js';
|
|
5
4
|
export * from './naming/index.js';
|
|
6
5
|
export * from './helpers/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { InjectRepository, InjectEntityManager, InjectDataSource, getDataSourceToken } from '@nestjs/typeorm';
|
|
2
2
|
export * from './extensions/index.js';
|
|
3
|
-
export * from './columns/index.js';
|
|
4
3
|
export * from './operators/index.js';
|
|
5
4
|
export * from './naming/index.js';
|
|
6
5
|
export * from './helpers/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAExB,cAAc,uBAAuB,CAAA;AACrC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAExB,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export type Default<T> = T & {
|
|
2
2
|
readonly __default?: true;
|
|
3
3
|
};
|
|
4
|
-
export type HasDefault<K> = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}>
|
|
8
|
-
] extends [never] ? false : true;
|
|
4
|
+
export type HasDefault<K> = [Extract<K, {
|
|
5
|
+
readonly __default?: true;
|
|
6
|
+
}>] extends [never] ? false : true;
|
package/package.json
CHANGED
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wisemen/nestjs-typeorm",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"imports": {
|
|
8
|
+
"#src/*": "./dist/*"
|
|
9
|
+
},
|
|
4
10
|
"main": "./dist/index.js",
|
|
5
11
|
"types": "./dist/index.d.ts",
|
|
6
12
|
"type": "module",
|
|
7
13
|
"files": [
|
|
8
14
|
"dist/"
|
|
9
15
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"release": "pnpx release-it"
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@nestjs/common": ">=11.1.17",
|
|
18
|
+
"@nestjs/config": ">=4.0.3",
|
|
19
|
+
"@nestjs/typeorm": ">=11.0.0",
|
|
20
|
+
"change-case": ">=5.4.4",
|
|
21
|
+
"class-validator": ">=0.15.1",
|
|
22
|
+
"pg": ">=8.20.0",
|
|
23
|
+
"typeorm": ">=0.3.28"
|
|
19
24
|
},
|
|
20
25
|
"devDependencies": {
|
|
21
|
-
"@types/node": "
|
|
22
|
-
"eslint": "
|
|
23
|
-
"expect": "
|
|
24
|
-
"typescript": "
|
|
26
|
+
"@types/node": "25.3.0",
|
|
27
|
+
"eslint": "9.39.4",
|
|
28
|
+
"expect": "30.2.0",
|
|
29
|
+
"typescript": ">=4.8.4 <=5.9.3",
|
|
30
|
+
"@wisemen/eslint-config-nestjs": "0.2.13"
|
|
25
31
|
},
|
|
26
32
|
"author": "Joren Vandeweyer",
|
|
27
33
|
"license": "GPL",
|
|
28
34
|
"repository": {
|
|
29
35
|
"type": "git",
|
|
30
|
-
"url": "
|
|
36
|
+
"url": "https://github.com/wisemen-digital/wisemen-core",
|
|
37
|
+
"directory": "packages/nestjs-typeorm"
|
|
31
38
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"pg": "8.18.0",
|
|
41
|
-
"typeorm": "^0.3.28"
|
|
39
|
+
"scripts": {
|
|
40
|
+
"lint": "eslint lib",
|
|
41
|
+
"clean": "rm -rf ./dist",
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"pretest": "pnpm run build",
|
|
44
|
+
"test": "node --env-file=.env --test ./**/*.test.js",
|
|
45
|
+
"prerelease": "npm run build",
|
|
46
|
+
"release": "pnpx release-it"
|
|
42
47
|
}
|
|
43
|
-
}
|
|
48
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { applyDecorators } from '@nestjs/common';
|
|
2
|
-
import { Coordinates } from '@wisemen/coordinates';
|
|
3
|
-
import { Column } from 'typeorm';
|
|
4
|
-
export function CoordinatesColumn(options) {
|
|
5
|
-
return applyDecorators(Column({
|
|
6
|
-
...options,
|
|
7
|
-
type: 'geometry',
|
|
8
|
-
spatialFeatureType: 'Point',
|
|
9
|
-
srid: 4326,
|
|
10
|
-
transformer: CoordinatesTransformer.getInstance()
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
class CoordinatesTransformer {
|
|
14
|
-
static instance;
|
|
15
|
-
static getInstance() {
|
|
16
|
-
if (CoordinatesTransformer.instance === undefined) {
|
|
17
|
-
CoordinatesTransformer.instance = new CoordinatesTransformer();
|
|
18
|
-
}
|
|
19
|
-
return CoordinatesTransformer.instance;
|
|
20
|
-
}
|
|
21
|
-
from(value) {
|
|
22
|
-
if (value === null) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return new Coordinates(value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
to(value) {
|
|
30
|
-
return value?.toPoint() ?? null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=coordinates-column.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coordinates-column.js","sourceRoot":"","sources":["../../lib/columns/coordinates-column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAwB,MAAM,SAAS,CAAA;AAItD,MAAM,UAAU,iBAAiB,CAAE,OAAkC;IACnE,OAAO,eAAe,CACpB,MAAM,CAAC;QACL,GAAG,OAAO;QACV,IAAI,EAAE,UAAU;QAChB,kBAAkB,EAAE,OAAO;QAC3B,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,sBAAsB,CAAC,WAAW,EAAE;KAClD,CAAC,CACH,CAAA;AACH,CAAC;AAED,MAAM,sBAAsB;IAClB,MAAM,CAAC,QAAQ,CAAoC;IAEpD,MAAM,CAAC,WAAW;QACvB,IAAI,sBAAsB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClD,sBAAsB,CAAC,QAAQ,GAAG,IAAI,sBAAsB,EAAE,CAAA;QAChE,CAAC;QAED,OAAO,sBAAsB,CAAC,QAAQ,CAAA;IACxC,CAAC;IAED,IAAI,CAAE,KAAmB;QACvB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,IAAI,CAAA;QACb,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,EAAE,CAAE,KAAyB;QAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,IAAI,CAAA;IACjC,CAAC;CACF"}
|
package/dist/columns/index.d.ts
DELETED
package/dist/columns/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/columns/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { applyDecorators } from '@nestjs/common';
|
|
2
|
-
import { Column } from 'typeorm';
|
|
3
|
-
import { TypeormTimeTransformer } from '@wisemen/time';
|
|
4
|
-
export function PlainTimeColumn(options) {
|
|
5
|
-
return applyDecorators(Column({
|
|
6
|
-
...options,
|
|
7
|
-
type: 'time',
|
|
8
|
-
transformer: TimeTransformer.getInstance()
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
class TimeTransformer {
|
|
12
|
-
static instance;
|
|
13
|
-
static getInstance() {
|
|
14
|
-
if (TimeTransformer.instance === undefined) {
|
|
15
|
-
TimeTransformer.instance = new TypeormTimeTransformer();
|
|
16
|
-
}
|
|
17
|
-
return TimeTransformer.instance;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=time-column.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time-column.js","sourceRoot":"","sources":["../../lib/columns/time-column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAItD,MAAM,UAAU,eAAe,CAAE,OAA2B;IAC1D,OAAO,eAAe,CACpB,MAAM,CAAC;QACL,GAAG,OAAO;QACV,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,eAAe,CAAC,WAAW,EAAE;KAC3C,CAAC,CACH,CAAA;AACH,CAAC;AAED,MAAM,eAAe;IACX,MAAM,CAAC,QAAQ,CAAoC;IAEpD,MAAM,CAAC,WAAW;QACvB,IAAI,eAAe,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3C,eAAe,CAAC,QAAQ,GAAG,IAAI,sBAAsB,EAAE,CAAA;QACzD,CAAC;QAED,OAAO,eAAe,CAAC,QAAQ,CAAA;IACjC,CAAC;CACF"}
|