@wisemen/nestjs-typeorm 1.1.2 → 1.2.0
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/dist/example/test.entity.d.ts +1 -0
- package/dist/example/test.entity.js +77 -0
- package/dist/example/test.entity.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/types/embedded.type.d.ts +6 -0
- package/dist/types/embedded.type.js +2 -0
- package/dist/types/embedded.type.js.map +1 -0
- package/dist/types/entity-insert.type.d.ts +16 -0
- package/dist/types/entity-insert.type.js +2 -0
- package/dist/types/entity-insert.type.js.map +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/relation.d.ts +6 -0
- package/dist/types/relation.js +2 -0
- package/dist/types/relation.js.map +1 -0
- package/package.json +2 -2
- package/dist/types/insert.type.d.ts +0 -11
- package/dist/types/insert.type.js +0 -2
- package/dist/types/insert.type.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Column, Entity } from "typeorm";
|
|
11
|
+
let TestEntity = class TestEntity {
|
|
12
|
+
requiredColumn;
|
|
13
|
+
optionalColumn;
|
|
14
|
+
defaultColumn;
|
|
15
|
+
embeddedColumn;
|
|
16
|
+
relation;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
Column({ type: 'varchar' }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], TestEntity.prototype, "requiredColumn", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Column({ type: 'varchar', nullable: true }),
|
|
24
|
+
__metadata("design:type", Object)
|
|
25
|
+
], TestEntity.prototype, "optionalColumn", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({ type: 'varchar', default: 'default value' }),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], TestEntity.prototype, "defaultColumn", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column(() => TestEmbedded),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], TestEntity.prototype, "embeddedColumn", void 0);
|
|
34
|
+
TestEntity = __decorate([
|
|
35
|
+
Entity()
|
|
36
|
+
], TestEntity);
|
|
37
|
+
class TestEmbedded {
|
|
38
|
+
requiredColumn;
|
|
39
|
+
optionalColumn;
|
|
40
|
+
defaultColumn;
|
|
41
|
+
}
|
|
42
|
+
__decorate([
|
|
43
|
+
Column({ type: 'varchar' }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], TestEmbedded.prototype, "requiredColumn", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({ type: 'varchar', nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], TestEmbedded.prototype, "optionalColumn", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({ type: 'varchar', default: 'default value' }),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], TestEmbedded.prototype, "defaultColumn", void 0);
|
|
54
|
+
const _insertOnlyRequired = {
|
|
55
|
+
requiredColumn: 'required value',
|
|
56
|
+
embeddedColumn: {
|
|
57
|
+
requiredColumn: 'required value',
|
|
58
|
+
},
|
|
59
|
+
// relation: 'relation value' <-- not allowed
|
|
60
|
+
};
|
|
61
|
+
const _insertWithOptionals = {
|
|
62
|
+
requiredColumn: 'required value',
|
|
63
|
+
optionalColumn: 'optional value',
|
|
64
|
+
embeddedColumn: {
|
|
65
|
+
requiredColumn: 'required value',
|
|
66
|
+
optionalColumn: 'optional value',
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const _insertOverwriteDefaults = {
|
|
70
|
+
requiredColumn: 'required value',
|
|
71
|
+
defaultColumn: 'optional value',
|
|
72
|
+
embeddedColumn: {
|
|
73
|
+
requiredColumn: 'required value',
|
|
74
|
+
defaultColumn: 'optional value',
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=test.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.entity.js","sourceRoot":"","sources":["../../lib/example/test.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOxC,IAAM,UAAU,GAAhB,MAAM,UAAU;IAEd,cAAc,CAAQ;IAGtB,cAAc,CAAe;IAG7B,aAAa,CAAiB;IAG9B,cAAc,CAAwB;IAEtC,QAAQ,CAAkB;CAC3B,CAAA;AAZC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;kDACN;AAGtB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACf;AAG7B;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;;iDACxB;AAG9B;IADC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC;;kDACW;AAXlC,UAAU;IADf,MAAM,EAAE;GACH,UAAU,CAcf;AAGD,MAAM,YAAY;IAEhB,cAAc,CAAQ;IAGtB,cAAc,CAAe;IAG7B,aAAa,CAAiB;CAC/B;AAPC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;oDACN;AAGtB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACf;AAG7B;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;;mDACxB;AAKhC,MAAM,mBAAmB,GAAe;IACtC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE;QACd,cAAc,EAAE,gBAAgB;KACjC;IACD,6CAA6C;CAC9C,CAAA;AAED,MAAM,oBAAoB,GAAe;IACvC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE;QACd,cAAc,EAAE,gBAAgB;QAChC,cAAc,EAAE,gBAAgB;KACjC;CACF,CAAA;AAED,MAAM,wBAAwB,GAAe;IAC3C,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE;QACd,cAAc,EAAE,gBAAgB;QAChC,aAAa,EAAE,gBAAgB;KAChC;CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { createTypeOrmProviders, NestjsTypeOrmModuleAsyncOptions, TypeOrmModule,
|
|
|
3
3
|
export { AnyOrIgnore, AndOrIgnore } from './operators/index.js';
|
|
4
4
|
export { SnakeNamingStrategy } from './naming/index.js';
|
|
5
5
|
export { migrate, sslHelper } from './helpers/index.js';
|
|
6
|
-
export { Default,
|
|
6
|
+
export { Default, EntityInsert } from './types/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded.type.js","sourceRoot":"","sources":["../../lib/types/embedded.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HasDefault } from './default.type.js';
|
|
2
|
+
import { IsEmbedded } from './embedded.type.js';
|
|
3
|
+
import { IsRelation } from './relation.js';
|
|
4
|
+
type OptionalKeys<T> = {
|
|
5
|
+
[K in keyof T]: null extends T[K] ? K : HasDefault<T[K]> extends true ? K : never;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
type RelationKeys<T> = {
|
|
8
|
+
[K in keyof T]: IsRelation<T[K]> extends true ? K : never;
|
|
9
|
+
}[keyof T];
|
|
10
|
+
type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T> | RelationKeys<T>>;
|
|
11
|
+
export type EntityInsert<T> = {
|
|
12
|
+
[K in RequiredKeys<T>]: IsEmbedded<T[K]> extends true ? EntityInsert<Omit<T[K], '_embedded'>> : T[K];
|
|
13
|
+
} & {
|
|
14
|
+
[K in OptionalKeys<T>]?: IsEmbedded<T[K]> extends true ? EntityInsert<Omit<T[K], '_embedded'>> : T[K];
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-insert.type.js","sourceRoot":"","sources":["../../lib/types/entity-insert.type.ts"],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../lib/types/relation.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wisemen/nestjs-typeorm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"eslint": "10.2.1",
|
|
29
29
|
"oxlint": "1.59.0",
|
|
30
30
|
"oxlint-tsgolint": "0.20.0",
|
|
31
|
-
"expect": "30.
|
|
31
|
+
"expect": "30.4.1",
|
|
32
32
|
"typescript": "^5.9.3",
|
|
33
33
|
"@wisemen/eslint-config-nestjs": "1.1.1"
|
|
34
34
|
},
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HasDefault } from './default.type.js';
|
|
2
|
-
type OptionalKeys<T> = {
|
|
3
|
-
[K in keyof T]: null extends T[K] ? K : HasDefault<T[K]> extends true ? K : never;
|
|
4
|
-
}[keyof T];
|
|
5
|
-
type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;
|
|
6
|
-
export type Insert<T> = {
|
|
7
|
-
[K in RequiredKeys<T>]: T[K];
|
|
8
|
-
} & {
|
|
9
|
-
[K in OptionalKeys<T>]?: T[K];
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insert.type.js","sourceRoot":"","sources":["../../lib/types/insert.type.ts"],"names":[],"mappings":""}
|