@klerick/json-api-nestjs-shared 1.0.0-beta.2 → 1.0.0-beta.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 1.0.0-beta.4 (2025-11-13)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **json-api-nestjs-shared:** fix after update nx ([e4ef59f](https://github.com/klerick/nestjs-json-api/commit/e4ef59f))
6
+ - **json-api-nestjs-shared:** fix after update nx ([4c7a42d](https://github.com/klerick/nestjs-json-api/commit/4c7a42d))
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - **json-api-nestjs-shared:** refine `RelationCheck` type logic to handle nested promises and exclude undefined types ([d5c1ea7](https://github.com/klerick/nestjs-json-api/commit/d5c1ea7))
11
+
12
+ ### ❤️ Thank You
13
+
14
+ - Alex H
15
+
16
+ ## 1.0.0-beta.3 (2025-05-23)
17
+
18
+ ### 🚀 Features
19
+
20
+ - **json-api-nestjs,json-api-nestjs-microorm,json-api-nestjs-sdk,json-api-nestjs-shared,json-api-nestjs-typeorm:** up nestjs ([42b6b82](https://github.com/klerick/nestjs-json-api/commit/42b6b82))
21
+
22
+ ### ❤️ Thank You
23
+
24
+ - Alex H
25
+
1
26
  ## 1.0.0-beta.0 (2025-05-21)
2
27
 
3
28
  ### 🚀 Features
@@ -3,7 +3,7 @@ export type HasId<T, IdKey extends string> = Any.At<T, IdKey> extends undefined
3
3
  export type CastIteratorType<T> = T extends {
4
4
  [Symbol.iterator](): Iterator<infer U>;
5
5
  } ? U : T;
6
- type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? HasId<U, IdKey> : HasId<CastIteratorType<T>, IdKey>;
6
+ type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? RelationCheck<U, IdKey> : HasId<Exclude<CastIteratorType<T>, undefined>, IdKey>;
7
7
  export type RelationKeys<E, IdKey extends string = 'id'> = {
8
8
  [K in keyof E]: Exclude<E[K], null> extends never ? never : RelationCheck<Exclude<E[K], null>, IdKey> extends 1 ? K : never;
9
9
  }[keyof E];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tsd_1 = require("tsd");
4
+ (0, tsd_1.expectType)(1);
5
+ (0, tsd_1.expectType)(1);
6
+ (0, tsd_1.expectType)(0);
7
+ (0, tsd_1.expectType)(1);
8
+ (0, tsd_1.expectType)(1);
9
+ (0, tsd_1.expectType)(0);
10
+ (0, tsd_1.expectType)(1);
11
+ (0, tsd_1.expectType)(1);
12
+ (0, tsd_1.expectType)(0);
13
+ //# sourceMappingURL=entity-type.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-type.test-d.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/entity-type.test-d.ts"],"names":[],"mappings":";;AAAA,6BAAiC;AAsDjC,IAAA,gBAAU,EAAqB,CAAC,CAAC,CAAC;AAClC,IAAA,gBAAU,EAAuB,CAAC,CAAC,CAAC;AACpC,IAAA,gBAAU,EAAyB,CAAC,CAAC,CAAC;AAEtC,IAAA,gBAAU,EAAqB,CAAC,CAAC,CAAC;AAClC,IAAA,gBAAU,EAAuB,CAAC,CAAC,CAAC;AACpC,IAAA,gBAAU,EAAyB,CAAC,CAAC,CAAC;AAKtC,IAAA,gBAAU,EAAyB,CAAC,CAAC,CAAC;AACtC,IAAA,gBAAU,EAA8B,CAAC,CAAC,CAAC;AAC3C,IAAA,gBAAU,EAAoB,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tsd_1 = require("tsd");
4
+ const CheckBaseMeta = {
5
+ meta: { time: 1 },
6
+ };
7
+ const CheckBaseMetaExtend = {
8
+ meta: { time: 1, someData: '' },
9
+ };
10
+ const CheckBaseMetaForArray = {
11
+ meta: { time: 1, pageSize: 0, pageNumber: 0, totalItems: 0 },
12
+ };
13
+ (0, tsd_1.expectAssignable)(CheckBaseMeta);
14
+ (0, tsd_1.expectAssignable)(CheckBaseMetaExtend);
15
+ (0, tsd_1.expectAssignable)(CheckBaseMetaForArray);
16
+ const CheckAttributes = {
17
+ firstName: '',
18
+ lastName: '',
19
+ login: '',
20
+ isActive: null,
21
+ testDate: new Date(),
22
+ testArrayNull: null,
23
+ testReal: [1],
24
+ createdAt: new Date(),
25
+ updatedAt: new Date(),
26
+ };
27
+ (0, tsd_1.expectAssignable)(CheckAttributes);
28
+ const CheckInclude = {
29
+ id: '1',
30
+ type: 'users',
31
+ attributes: CheckAttributes,
32
+ relationships: {
33
+ addresses: {
34
+ links: {
35
+ self: 'selflinks',
36
+ },
37
+ },
38
+ manager: {
39
+ links: {
40
+ self: 'selflinks',
41
+ },
42
+ data: {
43
+ type: 'users',
44
+ id: 'dssd',
45
+ },
46
+ },
47
+ comments: {
48
+ links: {
49
+ self: 'selfLinks',
50
+ },
51
+ data: [{ id: '1', type: 'comments' }],
52
+ },
53
+ roles: {
54
+ links: {
55
+ self: 'selfLinks',
56
+ },
57
+ data: [{ id: '1', type: 'roles' }],
58
+ },
59
+ userGroup: {
60
+ links: { self: 'selfLinks' },
61
+ data: null,
62
+ },
63
+ },
64
+ links: { self: 'selfLinks' },
65
+ };
66
+ (0, tsd_1.expectAssignable)(CheckInclude);
67
+ const CheckResourceObject = {
68
+ meta: CheckBaseMeta.meta,
69
+ data: {
70
+ id: '1',
71
+ type: 'users',
72
+ attributes: CheckAttributes,
73
+ links: { self: 'selfLinks' },
74
+ },
75
+ };
76
+ const CheckResourceObjectArray = {
77
+ meta: CheckBaseMetaForArray.meta,
78
+ data: [
79
+ {
80
+ id: '1',
81
+ type: 'users',
82
+ attributes: CheckAttributes,
83
+ relationships: {
84
+ addresses: {
85
+ links: {
86
+ self: 'selflinks',
87
+ },
88
+ },
89
+ manager: {
90
+ links: {
91
+ self: 'selflinks',
92
+ },
93
+ data: {
94
+ type: 'users',
95
+ id: 'dssd',
96
+ },
97
+ },
98
+ comments: {
99
+ links: {
100
+ self: 'selfLinks',
101
+ },
102
+ data: [{ id: '1', type: 'comments' }],
103
+ },
104
+ roles: {
105
+ links: {
106
+ self: 'selfLinks',
107
+ },
108
+ data: [{ id: '1', type: 'roles' }],
109
+ },
110
+ userGroup: {
111
+ links: { self: 'selfLinks' },
112
+ data: null,
113
+ },
114
+ },
115
+ links: { self: 'selfLinks' },
116
+ },
117
+ ],
118
+ };
119
+ (0, tsd_1.expectAssignable)(CheckResourceObject);
120
+ (0, tsd_1.expectAssignable)(CheckResourceObjectArray);
121
+ const CheckResourceObjectRelationships = {
122
+ meta: {
123
+ time: 1,
124
+ },
125
+ data: {
126
+ id: '1',
127
+ type: 'users-groups',
128
+ },
129
+ };
130
+ const CheckResourceObjectRelationshipsArray = {
131
+ meta: {
132
+ time: 1,
133
+ },
134
+ data: [
135
+ {
136
+ id: '1',
137
+ type: 'users-groups',
138
+ },
139
+ ],
140
+ };
141
+ (0, tsd_1.expectAssignable)(CheckResourceObjectRelationships);
142
+ (0, tsd_1.expectAssignable)(CheckResourceObjectRelationshipsArray);
143
+ //# sourceMappingURL=response-body.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-body.test-d.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/response-body.test-d.ts"],"names":[],"mappings":";;AAAA,6BAAuC;AAWvC,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;CACC,CAAC;AAErB,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;CACmB,CAAC;AAErD,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,EAAE,IAAI,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ACF;YACD,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;SAC7B;KACF;CACuC,CAAC;AAE3C,IAAA,sBAAgB,EAAwB,mBAAmB,CAAC,CAAC;AAC7D,IAAA,sBAAgB,EAAiC,wBAAwB,CAAC,CAAC;AAE3E,MAAM,gCAAgC,GAAG;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;IACD,IAAI,EAAE;QACJ,EAAE,EAAE,GAAG;QACP,IAAI,EAAE,cAAc;KACrB;CAC8D,CAAC;AAElE,MAAM,qCAAqC,GAAG;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;IACD,IAAI,EAAE;QACJ;YACE,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,cAAc;SACrB;KACF;CAC0D,CAAC;AAE9D,IAAA,sBAAgB,EACd,gCAAgC,CACjC,CAAC;AACF,IAAA,sBAAgB,EACd,qCAAqC,CACtC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Collection } from '@mikro-orm/core';
2
+ type IUsers = Users;
3
+ export declare class Users {
4
+ id: number;
5
+ login: string;
6
+ firstName: string;
7
+ testReal: number[];
8
+ testArrayNull: number[] | null;
9
+ lastName: string | null;
10
+ isActive: null;
11
+ testDate: Date;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ addresses: IAddresses;
15
+ manager: IUsers;
16
+ roles: Collection<Roles, object>;
17
+ comments: Comments[];
18
+ userGroup: UserGroups | null;
19
+ }
20
+ export declare class Roles {
21
+ id: number;
22
+ name: string;
23
+ key: string;
24
+ isDefault: boolean;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
28
+ export declare class UserGroups {
29
+ id: number;
30
+ label: string;
31
+ }
32
+ type IAddresses = Addresses;
33
+ export declare class Addresses {
34
+ id: number;
35
+ city: string;
36
+ state: string;
37
+ country: string;
38
+ arrayField: string[];
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
42
+ export declare class Comments {
43
+ id: number;
44
+ kind: CommentKind;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }
48
+ export declare enum CommentKind {
49
+ Comment = "COMMENT",
50
+ Message = "MESSAGE",
51
+ Note = "NOTE"
52
+ }
53
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentKind = exports.Comments = exports.Addresses = exports.UserGroups = exports.Roles = exports.Users = void 0;
4
+ const core_1 = require("@mikro-orm/core");
5
+ class Users {
6
+ constructor() {
7
+ this.testReal = [];
8
+ this.createdAt = new Date();
9
+ this.updatedAt = new Date();
10
+ this.roles = new core_1.Collection(this);
11
+ }
12
+ }
13
+ exports.Users = Users;
14
+ class Roles {
15
+ constructor() {
16
+ this.createdAt = new Date();
17
+ this.updatedAt = new Date();
18
+ }
19
+ }
20
+ exports.Roles = Roles;
21
+ class UserGroups {
22
+ }
23
+ exports.UserGroups = UserGroups;
24
+ class Addresses {
25
+ constructor() {
26
+ this.createdAt = new Date();
27
+ this.updatedAt = new Date();
28
+ }
29
+ }
30
+ exports.Addresses = Addresses;
31
+ class Comments {
32
+ constructor() {
33
+ this.createdAt = new Date();
34
+ this.updatedAt = new Date();
35
+ }
36
+ }
37
+ exports.Comments = Comments;
38
+ var CommentKind;
39
+ (function (CommentKind) {
40
+ CommentKind["Comment"] = "COMMENT";
41
+ CommentKind["Message"] = "MESSAGE";
42
+ CommentKind["Note"] = "NOTE";
43
+ })(CommentKind || (exports.CommentKind = CommentKind = {}));
44
+ //# sourceMappingURL=test-classes.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-classes.helper.js","sourceRoot":"","sources":["../../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/___test___/test-classes.helper.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAE7C,MAAa,KAAK;IAAlB;QAIS,aAAQ,GAAa,EAAE,CAAC;QAKxB,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAI7B,UAAK,GAAG,IAAI,iBAAU,CAAQ,IAAI,CAAC,CAAC;IAG7C,CAAC;CAAA;AAjBD,sBAiBC;AAED,MAAa,KAAK;IAAlB;QAKE,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;CAAA;AAPD,sBAOC;AAED,MAAa,UAAU;CAGtB;AAHD,gCAGC;AAED,MAAa,SAAS;IAAtB;QAME,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;CAAA;AARD,8BAQC;AAED,MAAa,QAAQ;IAArB;QAGE,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;CAAA;AALD,4BAKC;AACD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;AACf,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB"}
@@ -3,7 +3,7 @@ export type HasId<T, IdKey extends string> = Any.At<T, IdKey> extends undefined
3
3
  export type CastIteratorType<T> = T extends {
4
4
  [Symbol.iterator](): Iterator<infer U>;
5
5
  } ? U : T;
6
- type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? HasId<U, IdKey> : HasId<CastIteratorType<T>, IdKey>;
6
+ type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? RelationCheck<U, IdKey> : HasId<Exclude<CastIteratorType<T>, undefined>, IdKey>;
7
7
  export type RelationKeys<E, IdKey extends string = 'id'> = {
8
8
  [K in keyof E]: Exclude<E[K], null> extends never ? never : RelationCheck<Exclude<E[K], null>, IdKey> extends 1 ? K : never;
9
9
  }[keyof E];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { expectType } from 'tsd';
2
+ expectType(1);
3
+ expectType(1);
4
+ expectType(0);
5
+ expectType(1);
6
+ expectType(1);
7
+ expectType(0);
8
+ expectType(1);
9
+ expectType(1);
10
+ expectType(0);
11
+ //# sourceMappingURL=entity-type.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-type.test-d.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/entity-type.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAsDjC,UAAU,CAAqB,CAAC,CAAC,CAAC;AAClC,UAAU,CAAuB,CAAC,CAAC,CAAC;AACpC,UAAU,CAAyB,CAAC,CAAC,CAAC;AAEtC,UAAU,CAAqB,CAAC,CAAC,CAAC;AAClC,UAAU,CAAuB,CAAC,CAAC,CAAC;AACpC,UAAU,CAAyB,CAAC,CAAC,CAAC;AAKtC,UAAU,CAAyB,CAAC,CAAC,CAAC;AACtC,UAAU,CAA8B,CAAC,CAAC,CAAC;AAC3C,UAAU,CAAoB,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,141 @@
1
+ import { expectAssignable } from 'tsd';
2
+ const CheckBaseMeta = {
3
+ meta: { time: 1 },
4
+ };
5
+ const CheckBaseMetaExtend = {
6
+ meta: { time: 1, someData: '' },
7
+ };
8
+ const CheckBaseMetaForArray = {
9
+ meta: { time: 1, pageSize: 0, pageNumber: 0, totalItems: 0 },
10
+ };
11
+ expectAssignable(CheckBaseMeta);
12
+ expectAssignable(CheckBaseMetaExtend);
13
+ expectAssignable(CheckBaseMetaForArray);
14
+ const CheckAttributes = {
15
+ firstName: '',
16
+ lastName: '',
17
+ login: '',
18
+ isActive: null,
19
+ testDate: new Date(),
20
+ testArrayNull: null,
21
+ testReal: [1],
22
+ createdAt: new Date(),
23
+ updatedAt: new Date(),
24
+ };
25
+ expectAssignable(CheckAttributes);
26
+ const CheckInclude = {
27
+ id: '1',
28
+ type: 'users',
29
+ attributes: CheckAttributes,
30
+ relationships: {
31
+ addresses: {
32
+ links: {
33
+ self: 'selflinks',
34
+ },
35
+ },
36
+ manager: {
37
+ links: {
38
+ self: 'selflinks',
39
+ },
40
+ data: {
41
+ type: 'users',
42
+ id: 'dssd',
43
+ },
44
+ },
45
+ comments: {
46
+ links: {
47
+ self: 'selfLinks',
48
+ },
49
+ data: [{ id: '1', type: 'comments' }],
50
+ },
51
+ roles: {
52
+ links: {
53
+ self: 'selfLinks',
54
+ },
55
+ data: [{ id: '1', type: 'roles' }],
56
+ },
57
+ userGroup: {
58
+ links: { self: 'selfLinks' },
59
+ data: null,
60
+ },
61
+ },
62
+ links: { self: 'selfLinks' },
63
+ };
64
+ expectAssignable(CheckInclude);
65
+ const CheckResourceObject = {
66
+ meta: CheckBaseMeta.meta,
67
+ data: {
68
+ id: '1',
69
+ type: 'users',
70
+ attributes: CheckAttributes,
71
+ links: { self: 'selfLinks' },
72
+ },
73
+ };
74
+ const CheckResourceObjectArray = {
75
+ meta: CheckBaseMetaForArray.meta,
76
+ data: [
77
+ {
78
+ id: '1',
79
+ type: 'users',
80
+ attributes: CheckAttributes,
81
+ relationships: {
82
+ addresses: {
83
+ links: {
84
+ self: 'selflinks',
85
+ },
86
+ },
87
+ manager: {
88
+ links: {
89
+ self: 'selflinks',
90
+ },
91
+ data: {
92
+ type: 'users',
93
+ id: 'dssd',
94
+ },
95
+ },
96
+ comments: {
97
+ links: {
98
+ self: 'selfLinks',
99
+ },
100
+ data: [{ id: '1', type: 'comments' }],
101
+ },
102
+ roles: {
103
+ links: {
104
+ self: 'selfLinks',
105
+ },
106
+ data: [{ id: '1', type: 'roles' }],
107
+ },
108
+ userGroup: {
109
+ links: { self: 'selfLinks' },
110
+ data: null,
111
+ },
112
+ },
113
+ links: { self: 'selfLinks' },
114
+ },
115
+ ],
116
+ };
117
+ expectAssignable(CheckResourceObject);
118
+ expectAssignable(CheckResourceObjectArray);
119
+ const CheckResourceObjectRelationships = {
120
+ meta: {
121
+ time: 1,
122
+ },
123
+ data: {
124
+ id: '1',
125
+ type: 'users-groups',
126
+ },
127
+ };
128
+ const CheckResourceObjectRelationshipsArray = {
129
+ meta: {
130
+ time: 1,
131
+ },
132
+ data: [
133
+ {
134
+ id: '1',
135
+ type: 'users-groups',
136
+ },
137
+ ],
138
+ };
139
+ expectAssignable(CheckResourceObjectRelationships);
140
+ expectAssignable(CheckResourceObjectRelationshipsArray);
141
+ //# sourceMappingURL=response-body.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-body.test-d.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/response-body.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAWvC,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;CACC,CAAC;AAErB,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;CACmB,CAAC;AAErD,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;CACjC,CAAC;AAE9B,gBAAgB,CAAW,aAAa,CAAC,CAAC;AAC1C,gBAAgB,CAA2C,mBAAmB,CAAC,CAAC;AAChF,gBAAgB,CAAoB,qBAAqB,CAAC,CAAC;AAE3D,MAAM,eAAe,GAAG;IACtB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI,IAAI,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,CAAC,C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;KACF;CAC0D,CAAC;AAE9D,gBAAgB,CACd,gCAAgC,CACjC,CAAC;AACF,gBAAgB,CACd,qCAAqC,CACtC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Collection } from '@mikro-orm/core';
2
+ type IUsers = Users;
3
+ export declare class Users {
4
+ id: number;
5
+ login: string;
6
+ firstName: string;
7
+ testReal: number[];
8
+ testArrayNull: number[] | null;
9
+ lastName: string | null;
10
+ isActive: null;
11
+ testDate: Date;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ addresses: IAddresses;
15
+ manager: IUsers;
16
+ roles: Collection<Roles, object>;
17
+ comments: Comments[];
18
+ userGroup: UserGroups | null;
19
+ }
20
+ export declare class Roles {
21
+ id: number;
22
+ name: string;
23
+ key: string;
24
+ isDefault: boolean;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
28
+ export declare class UserGroups {
29
+ id: number;
30
+ label: string;
31
+ }
32
+ type IAddresses = Addresses;
33
+ export declare class Addresses {
34
+ id: number;
35
+ city: string;
36
+ state: string;
37
+ country: string;
38
+ arrayField: string[];
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
42
+ export declare class Comments {
43
+ id: number;
44
+ kind: CommentKind;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }
48
+ export declare enum CommentKind {
49
+ Comment = "COMMENT",
50
+ Message = "MESSAGE",
51
+ Note = "NOTE"
52
+ }
53
+ export {};
@@ -0,0 +1,52 @@
1
+ import { Collection } from '@mikro-orm/core';
2
+ export class Users {
3
+ id;
4
+ login;
5
+ firstName;
6
+ testReal = [];
7
+ testArrayNull;
8
+ lastName;
9
+ isActive;
10
+ testDate;
11
+ createdAt = new Date();
12
+ updatedAt = new Date();
13
+ addresses;
14
+ manager;
15
+ roles = new Collection(this);
16
+ comments;
17
+ userGroup;
18
+ }
19
+ export class Roles {
20
+ id;
21
+ name;
22
+ key;
23
+ isDefault;
24
+ createdAt = new Date();
25
+ updatedAt = new Date();
26
+ }
27
+ export class UserGroups {
28
+ id;
29
+ label;
30
+ }
31
+ export class Addresses {
32
+ id;
33
+ city;
34
+ state;
35
+ country;
36
+ arrayField;
37
+ createdAt = new Date();
38
+ updatedAt = new Date();
39
+ }
40
+ export class Comments {
41
+ id;
42
+ kind;
43
+ createdAt = new Date();
44
+ updatedAt = new Date();
45
+ }
46
+ export var CommentKind;
47
+ (function (CommentKind) {
48
+ CommentKind["Comment"] = "COMMENT";
49
+ CommentKind["Message"] = "MESSAGE";
50
+ CommentKind["Note"] = "NOTE";
51
+ })(CommentKind || (CommentKind = {}));
52
+ //# sourceMappingURL=test-classes.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-classes.helper.js","sourceRoot":"","sources":["../../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/___test___/test-classes.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,OAAO,KAAK;IACT,EAAE,CAAU;IACZ,KAAK,CAAU;IACf,SAAS,CAAU;IACnB,QAAQ,GAAa,EAAE,CAAC;IACxB,aAAa,CAAmB;IAChC,QAAQ,CAAiB;IACzB,QAAQ,CAAQ;IAChB,QAAQ,CAAQ;IAChB,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAE7B,SAAS,CAAc;IACvB,OAAO,CAAU;IACjB,KAAK,GAAG,IAAI,UAAU,CAAQ,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAc;IACtB,SAAS,CAAqB;CACtC;AAED,MAAM,OAAO,KAAK;IACT,EAAE,CAAU;IACZ,IAAI,CAAU;IACd,GAAG,CAAU;IACb,SAAS,CAAW;IAC3B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B;AAED,MAAM,OAAO,UAAU;IACd,EAAE,CAAU;IACZ,KAAK,CAAU;CACvB;AAED,MAAM,OAAO,SAAS;IACb,EAAE,CAAU;IACZ,IAAI,CAAU;IACd,KAAK,CAAU;IACf,OAAO,CAAU;IACjB,UAAU,CAAY;IAC7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B;AAED,MAAM,OAAO,QAAQ;IACZ,EAAE,CAAU;IACZ,IAAI,CAAe;IAC1B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B;AACD,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;AACf,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klerick/json-api-nestjs-shared",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Shared Helper for JsonApi Plugin for NestJs",
5
5
  "keywords": [
6
6
  "nestjs",
@@ -13,15 +13,20 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "change-case-commonjs": "^5.4.4",
16
- "reflect-metadata": "^0.1.12 || ^0.2.0",
17
- "rxjs": "^7.1.0",
18
- "ts-toolbelt": "^9.6.0",
16
+ "ts-toolbelt": "^9.6.0"
17
+ },
18
+ "peerDependencies": {
19
19
  "tslib": ">2.3.0"
20
20
  },
21
21
  "type": "commonjs",
22
22
  "main": "./cjs/src/index.js",
23
23
  "types": "./cjs/src/index.d.ts",
24
24
  "module": "./mjs/src/index.js",
25
+ "overrides": {
26
+ "mikro-orm-pglite": {
27
+ "@mikro-orm/postgresql": "^6.4.0"
28
+ }
29
+ },
25
30
  "license": "MIT",
26
31
  "contributors": [
27
32
  {
package/cjs/package.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "name": "@klerick/json-api-nestjs-shared",
3
- "version": "1.0.0-beta.2",
4
- "description": "Shared Helper for JsonApi Plugin for NestJs",
5
- "keywords": [
6
- "nestjs",
7
- "nest",
8
- "jsonapi",
9
- "json-api",
10
- "typeorm",
11
- "microorm",
12
- "CRUD"
13
- ],
14
- "dependencies": {
15
- "change-case-commonjs": "^5.4.4",
16
- "reflect-metadata": "^0.1.12 || ^0.2.0",
17
- "rxjs": "^7.1.0",
18
- "ts-toolbelt": "^9.6.0",
19
- "tslib": ">2.3.0"
20
- },
21
- "type": "commonjs",
22
- "main": "./cjs/src/index.js",
23
- "types": "./cjs/src/index.d.ts",
24
- "module": "./mjs/src/index.js"
25
- }
package/mjs/package.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "name": "@klerick/json-api-nestjs-shared",
3
- "version": "1.0.0-beta.2",
4
- "description": "Shared Helper for JsonApi Plugin for NestJs",
5
- "keywords": [
6
- "nestjs",
7
- "nest",
8
- "jsonapi",
9
- "json-api",
10
- "typeorm",
11
- "microorm",
12
- "CRUD"
13
- ],
14
- "dependencies": {
15
- "tslib": ">2.3.0",
16
- "reflect-metadata": "^0.1.12 || ^0.2.0",
17
- "rxjs": "^7.1.0"
18
- },
19
- "type": "commonjs",
20
- "main": "./cjs/src/index.js",
21
- "types": "./cjs/src/index.d.ts",
22
- "module": "./mjs/src/index.js"
23
- }