@nathapp/nestjs-data 1.0.0-rc.9 → 1.0.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/dist/decorator/date-column.decorator.d.ts +7 -3
- package/dist/decorator/date-column.decorator.js +20 -11
- package/dist/decorator/date-column.decorator.js.map +1 -0
- package/dist/decorator/index.d.ts +2 -2
- package/dist/decorator/index.js +4 -1
- package/dist/decorator/index.js.map +1 -0
- package/dist/decorator/readonly-column.decorator.js +1 -0
- package/dist/decorator/readonly-column.decorator.js.map +1 -0
- package/dist/decorator/typeorm-ex.decorator.js +3 -2
- package/dist/decorator/typeorm-ex.decorator.js.map +1 -0
- package/dist/entities/base-entity.js +1 -0
- package/dist/entities/base-entity.js.map +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/pagination/index.js +1 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/page.d.ts +18 -6
- package/dist/pagination/page.js +22 -7
- package/dist/pagination/page.js.map +1 -0
- package/dist/repository/base.repository.d.ts +18 -0
- package/dist/repository/base.repository.js +140 -0
- package/dist/repository/base.repository.js.map +1 -0
- package/dist/repository/index.d.ts +2 -0
- package/dist/repository/index.js +7 -0
- package/dist/repository/index.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +11 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/testing-utils.d.ts +56 -0
- package/dist/testing/testing-utils.js +44 -0
- package/dist/testing/testing-utils.js.map +1 -0
- package/dist/typeorm/base-typeorm-options-factory.d.ts +7 -1
- package/dist/typeorm/base-typeorm-options-factory.js +10 -2
- package/dist/typeorm/base-typeorm-options-factory.js.map +1 -0
- package/dist/typeorm/constants.js +1 -0
- package/dist/typeorm/constants.js.map +1 -0
- package/dist/typeorm/index.d.ts +2 -2
- package/dist/typeorm/index.js +3 -1
- package/dist/typeorm/index.js.map +1 -0
- package/dist/typeorm/typeorm-ex.module.d.ts +3 -1
- package/dist/typeorm/typeorm-ex.module.js +11 -0
- package/dist/typeorm/typeorm-ex.module.js.map +1 -0
- package/dist/typeorm/typeorm-utils.d.ts +2 -2
- package/dist/typeorm/typeorm-utils.js +1 -0
- package/dist/typeorm/typeorm-utils.js.map +1 -0
- package/package.json +20 -27
- package/.eslintrc.js +0 -24
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import { ColumnOptions } from "typeorm";
|
|
2
|
+
import { TransformOptions } from "class-transformer";
|
|
3
|
+
export declare const toDateString: (value: Date, format?: string) => string | Date;
|
|
4
|
+
export declare const NullableDateString: (options?: TransformOptions) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
5
|
+
export declare const CreateDate: (format?: string, options?: ColumnOptions) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
6
|
+
export declare const UpdateDate: (format?: string, options?: ColumnOptions) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
7
|
+
export declare const DateColumn: (format?: string, options?: ColumnOptions) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateColumn = exports.UpdateDate = exports.CreateDate = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.DateColumn = exports.UpdateDate = exports.CreateDate = exports.NullableDateString = exports.toDateString = void 0;
|
|
4
|
+
const dayjs = require("dayjs");
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
const class_transformer_1 = require("class-transformer");
|
|
8
8
|
const DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
9
9
|
const toDateString = (value, format) => {
|
|
10
|
-
return value ?
|
|
10
|
+
return value ? dayjs(value).format(format || DEFAULT_DATE_FORMAT) : value;
|
|
11
11
|
};
|
|
12
|
+
exports.toDateString = toDateString;
|
|
13
|
+
const NullableDateString = (options = { toPlainOnly: true }) => {
|
|
14
|
+
return applyDateDecorators((0, class_transformer_1.Transform)(({ value }) => (value ? (0, exports.toDateString)(value) : null), options));
|
|
15
|
+
};
|
|
16
|
+
exports.NullableDateString = NullableDateString;
|
|
12
17
|
const applyDateDecorators = (decorator) => {
|
|
13
|
-
return (0, common_1.applyDecorators)((0, class_transformer_1.Transform)(({ value, type }) => toDateString(value)), decorator);
|
|
18
|
+
return (0, common_1.applyDecorators)((0, class_transformer_1.Transform)(({ value, type }) => (0, exports.toDateString)(value)), decorator);
|
|
14
19
|
};
|
|
15
|
-
const CreateDate = (format) => {
|
|
20
|
+
const CreateDate = (format, options) => {
|
|
16
21
|
return applyDateDecorators((0, typeorm_1.CreateDateColumn)({
|
|
17
22
|
transformer: {
|
|
18
|
-
to: (value) => toDateString(value, format),
|
|
23
|
+
to: (value) => (0, exports.toDateString)(value, format),
|
|
19
24
|
from: (value) => new Date(value),
|
|
20
25
|
},
|
|
26
|
+
...options,
|
|
21
27
|
}));
|
|
22
28
|
};
|
|
23
29
|
exports.CreateDate = CreateDate;
|
|
24
|
-
const UpdateDate = (format) => {
|
|
30
|
+
const UpdateDate = (format, options) => {
|
|
25
31
|
return applyDateDecorators((0, typeorm_1.UpdateDateColumn)({
|
|
26
32
|
transformer: {
|
|
27
|
-
to: (value) => toDateString(value, format),
|
|
33
|
+
to: (value) => (0, exports.toDateString)(value, format),
|
|
28
34
|
from: (value) => new Date(value),
|
|
29
35
|
},
|
|
36
|
+
...options,
|
|
30
37
|
}));
|
|
31
38
|
};
|
|
32
39
|
exports.UpdateDate = UpdateDate;
|
|
33
|
-
const DateColumn = (format) => {
|
|
40
|
+
const DateColumn = (format, options) => {
|
|
34
41
|
return applyDateDecorators((0, typeorm_1.Column)({
|
|
35
|
-
type: "datetime",
|
|
36
42
|
transformer: {
|
|
37
|
-
to: (value) => toDateString(value, format),
|
|
43
|
+
to: (value) => (0, exports.toDateString)(value, format),
|
|
38
44
|
from: (value) => new Date(value),
|
|
39
45
|
},
|
|
46
|
+
...options,
|
|
47
|
+
type: "datetime",
|
|
40
48
|
}));
|
|
41
49
|
};
|
|
42
50
|
exports.DateColumn = DateColumn;
|
|
51
|
+
//# sourceMappingURL=date-column.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-column.decorator.js","sourceRoot":"","sources":["../../lib/decorator/date-column.decorator.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,qCAAoF;AACpF,2CAAiD;AACjD,yDAAgE;AAEhE,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAE3C,MAAM,YAAY,GAAG,CAAC,KAAW,EAAE,MAAe,EAAE,EAAE;IAC3D,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,kBAAkB,GAAG,CAAC,UAA4B,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE;IACtF,OAAO,mBAAmB,CACxB,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CACxE,CAAA;AACH,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBA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E,CAAC,KAAU,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;SACtC;QACD,GAAG,OAAO;QACV,IAAI,EAAE,UAAU;KACjB,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,UAAU,cAWrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateDate, DateColumn, UpdateDate } from "./date-column.decorator";
|
|
1
|
+
import { CreateDate, DateColumn, NullableDateString, toDateString, UpdateDate } from "./date-column.decorator";
|
|
2
2
|
import { ReadOnlyColumn } from "./readonly-column.decorator";
|
|
3
3
|
import { CustomRepository, TYPEORM_EX_CUSTOM_REPOSITORY } from "./typeorm-ex.decorator";
|
|
4
|
-
export { DateColumn, CreateDate, UpdateDate, ReadOnlyColumn, CustomRepository, TYPEORM_EX_CUSTOM_REPOSITORY, };
|
|
4
|
+
export { DateColumn, CreateDate, UpdateDate, ReadOnlyColumn, CustomRepository, TYPEORM_EX_CUSTOM_REPOSITORY, toDateString, NullableDateString, };
|
package/dist/decorator/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TYPEORM_EX_CUSTOM_REPOSITORY = exports.CustomRepository = exports.ReadOnlyColumn = exports.UpdateDate = exports.CreateDate = exports.DateColumn = void 0;
|
|
3
|
+
exports.NullableDateString = exports.toDateString = exports.TYPEORM_EX_CUSTOM_REPOSITORY = exports.CustomRepository = exports.ReadOnlyColumn = exports.UpdateDate = exports.CreateDate = exports.DateColumn = void 0;
|
|
4
4
|
const date_column_decorator_1 = require("./date-column.decorator");
|
|
5
5
|
Object.defineProperty(exports, "CreateDate", { enumerable: true, get: function () { return date_column_decorator_1.CreateDate; } });
|
|
6
6
|
Object.defineProperty(exports, "DateColumn", { enumerable: true, get: function () { return date_column_decorator_1.DateColumn; } });
|
|
7
|
+
Object.defineProperty(exports, "NullableDateString", { enumerable: true, get: function () { return date_column_decorator_1.NullableDateString; } });
|
|
8
|
+
Object.defineProperty(exports, "toDateString", { enumerable: true, get: function () { return date_column_decorator_1.toDateString; } });
|
|
7
9
|
Object.defineProperty(exports, "UpdateDate", { enumerable: true, get: function () { return date_column_decorator_1.UpdateDate; } });
|
|
8
10
|
const readonly_column_decorator_1 = require("./readonly-column.decorator");
|
|
9
11
|
Object.defineProperty(exports, "ReadOnlyColumn", { enumerable: true, get: function () { return readonly_column_decorator_1.ReadOnlyColumn; } });
|
|
10
12
|
const typeorm_ex_decorator_1 = require("./typeorm-ex.decorator");
|
|
11
13
|
Object.defineProperty(exports, "CustomRepository", { enumerable: true, get: function () { return typeorm_ex_decorator_1.CustomRepository; } });
|
|
12
14
|
Object.defineProperty(exports, "TYPEORM_EX_CUSTOM_REPOSITORY", { enumerable: true, get: function () { return typeorm_ex_decorator_1.TYPEORM_EX_CUSTOM_REPOSITORY; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/decorator/index.ts"],"names":[],"mappings":";;;AAAA,mEAA+G;AAM7G,2FANO,kCAAU,OAMP;AADV,2FALmB,kCAAU,OAKnB;AAOV,mGAZ+B,0CAAkB,OAY/B;AADlB,6FAXmD,oCAAY,OAWnD;AAJZ,2FAPiE,kCAAU,OAOjE;AANZ,2EAA6D;AAO3D,+FAPO,0CAAc,OAOP;AANhB,iEAAwF;AAOtF,iGAPO,uCAAgB,OAOP;AAChB,6GARyB,mDAA4B,OAQzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly-column.decorator.js","sourceRoot":"","sources":["../../lib/decorator/readonly-column.decorator.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAE1B,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,IAAA,gBAAM,EAAC;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TYPEORM_EX_CUSTOM_REPOSITORY = void 0;
|
|
4
|
+
exports.CustomRepository = CustomRepository;
|
|
4
5
|
const common_1 = require("@nestjs/common");
|
|
5
6
|
exports.TYPEORM_EX_CUSTOM_REPOSITORY = "TYPEORM_EX_CUSTOM_REPOSITORY";
|
|
6
7
|
function CustomRepository(entity) {
|
|
7
8
|
return (0, common_1.SetMetadata)(exports.TYPEORM_EX_CUSTOM_REPOSITORY, entity);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
//# sourceMappingURL=typeorm-ex.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-ex.decorator.js","sourceRoot":"","sources":["../../lib/decorator/typeorm-ex.decorator.ts"],"names":[],"mappings":";;;AAIA,4CAEC;AAND,2CAA6C;AAEhC,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAE3E,SAAgB,gBAAgB,CAAC,MAAgB;IAC/C,OAAO,IAAA,oBAAW,EAAC,oCAA4B,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-entity.js","sourceRoot":"","sources":["../../lib/entities/base-entity.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAKtD,MAAsB,UAAW,SAAQ,4BAAY;CAAI;AAAzD,gCAAyD"}
|
package/dist/entities/index.js
CHANGED
|
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseEntity = void 0;
|
|
4
4
|
const base_entity_1 = require("./base-entity");
|
|
5
5
|
Object.defineProperty(exports, "BaseEntity", { enumerable: true, get: function () { return base_entity_1.BaseEntity; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/entities/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAGzC,2FAHO,wBAAU,OAGP"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,5 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./decorator"), exports);
|
|
18
18
|
__exportStar(require("./entities"), exports);
|
|
19
|
+
__exportStar(require("./repository"), exports);
|
|
19
20
|
__exportStar(require("./pagination"), exports);
|
|
21
|
+
__exportStar(require("./testing"), exports);
|
|
20
22
|
__exportStar(require("./typeorm"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B"}
|
package/dist/pagination/index.js
CHANGED
|
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "TransformOptions", { enumerable: true, get: func
|
|
|
6
6
|
Object.defineProperty(exports, "PageOption", { enumerable: true, get: function () { return page_1.PageOption; } });
|
|
7
7
|
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_1.Page; } });
|
|
8
8
|
Object.defineProperty(exports, "Paginate", { enumerable: true, get: function () { return page_1.Paginate; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/pagination/index.ts"],"names":[],"mappings":";;;AAAA,iCAAsE;AAGpE,iGAHO,uBAAgB,OAGP;AAChB,2FAJyB,iBAAU,OAIzB;AACV,qFALqC,WAAI,OAKrC;AACJ,yFAN2C,eAAQ,OAM3C"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import { ClassConstructor } from "class-transformer";
|
|
2
|
-
import { FindManyOptions, MongoRepository, Repository, SelectQueryBuilder } from "typeorm";
|
|
2
|
+
import { FindManyOptions, MongoRepository, ObjectLiteral, Repository, SelectQueryBuilder } from "typeorm";
|
|
3
3
|
type mapFunction<E> = (item: any, index: number, array: any[]) => E;
|
|
4
4
|
export declare class TransformOptions<T> {
|
|
5
5
|
cls?: ClassConstructor<T>;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export interface IPageOption {
|
|
8
8
|
current: number;
|
|
9
9
|
size: number;
|
|
10
10
|
}
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class PageOption implements IPageOption {
|
|
12
|
+
constructor();
|
|
13
|
+
constructor(current: number);
|
|
14
|
+
constructor(current: number, size: number);
|
|
15
|
+
current: number;
|
|
16
|
+
size: number;
|
|
17
|
+
static from(current: number, size: number): PageOption;
|
|
18
|
+
}
|
|
19
|
+
export declare class Page<T, S = Record<string, any> | any> {
|
|
12
20
|
total: number;
|
|
13
21
|
size: number;
|
|
14
22
|
current: number;
|
|
23
|
+
hasNext: boolean;
|
|
24
|
+
hasPrev: boolean;
|
|
15
25
|
records: T[];
|
|
16
|
-
transformOptions
|
|
17
|
-
|
|
26
|
+
transformOptions?: TransformOptions<T>;
|
|
27
|
+
extra?: S;
|
|
28
|
+
constructor(page: IPageOption, total: number, records: T[], transformOptions?: TransformOptions<T>, extractDefault?: S);
|
|
18
29
|
toInstance(transformOptions?: TransformOptions<T>): this;
|
|
19
30
|
toPlain(): this;
|
|
20
31
|
mapTo<E>(mapFunc: mapFunction<E>, cls?: ClassConstructor<E>): E[];
|
|
32
|
+
remap<E, S = any>(mapFunc: mapFunction<E>, cls?: ClassConstructor<E>, extra?: S): Page<E, S>;
|
|
21
33
|
}
|
|
22
|
-
export declare function Paginate<T>(repositoryOrQueryBuilder: Repository<T> | MongoRepository<T> | SelectQueryBuilder<T>, options:
|
|
34
|
+
export declare function Paginate<T extends ObjectLiteral>(repositoryOrQueryBuilder: Repository<T> | MongoRepository<T> | SelectQueryBuilder<T>, options: IPageOption, searchOptions?: FindManyOptions<T>, transformOptions?: TransformOptions<T>): Promise<Page<T, any>>;
|
|
23
35
|
export {};
|
package/dist/pagination/page.js
CHANGED
|
@@ -9,26 +9,37 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.Page = exports.PageOption = exports.TransformOptions = void 0;
|
|
13
|
+
exports.Paginate = Paginate;
|
|
13
14
|
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const typeorm_1 = require("typeorm");
|
|
15
16
|
class TransformOptions {
|
|
16
17
|
}
|
|
17
18
|
exports.TransformOptions = TransformOptions;
|
|
18
19
|
class PageOption {
|
|
19
|
-
constructor() {
|
|
20
|
+
constructor(current, size) {
|
|
20
21
|
this.current = 1;
|
|
21
|
-
this.size =
|
|
22
|
+
this.size = 10;
|
|
23
|
+
this.current = current;
|
|
24
|
+
this.size = size;
|
|
25
|
+
}
|
|
26
|
+
static from(current, size) {
|
|
27
|
+
return new PageOption(current, size);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
exports.PageOption = PageOption;
|
|
25
31
|
class Page {
|
|
26
|
-
constructor(page, total, records, transformOptions) {
|
|
32
|
+
constructor(page, total, records, transformOptions, extractDefault) {
|
|
33
|
+
this.hasNext = false;
|
|
34
|
+
this.hasPrev = false;
|
|
27
35
|
this.size = Number(page.size);
|
|
28
36
|
this.current = Number(page.current);
|
|
29
37
|
this.total = Number(total);
|
|
30
|
-
this.transformOptions = transformOptions;
|
|
38
|
+
this.transformOptions = transformOptions || new TransformOptions();
|
|
31
39
|
this.records = records;
|
|
40
|
+
this.hasPrev = this.current != 1;
|
|
41
|
+
this.hasNext = (this.current * this.size) < this.total;
|
|
42
|
+
this.extra = extractDefault || undefined;
|
|
32
43
|
}
|
|
33
44
|
toInstance(transformOptions) {
|
|
34
45
|
var _a, _b;
|
|
@@ -50,12 +61,16 @@ class Page {
|
|
|
50
61
|
const results = this.records.map(mapFunc);
|
|
51
62
|
return cls ? (0, class_transformer_1.plainToInstance)(cls, results) : results;
|
|
52
63
|
}
|
|
64
|
+
remap(mapFunc, cls, extra) {
|
|
65
|
+
const records = this.records.map(mapFunc);
|
|
66
|
+
return new Page({ current: this.current, size: this.size }, this.total, cls ? (0, class_transformer_1.plainToInstance)(cls, records) : records, extra || this.extra);
|
|
67
|
+
}
|
|
53
68
|
}
|
|
69
|
+
exports.Page = Page;
|
|
54
70
|
__decorate([
|
|
55
71
|
(0, class_transformer_1.Exclude)(),
|
|
56
72
|
__metadata("design:type", TransformOptions)
|
|
57
73
|
], Page.prototype, "transformOptions", void 0);
|
|
58
|
-
exports.Page = Page;
|
|
59
74
|
async function Paginate(repositoryOrQueryBuilder, options, searchOptions, transformOptions) {
|
|
60
75
|
if (repositoryOrQueryBuilder instanceof typeorm_1.MongoRepository) {
|
|
61
76
|
return paginateMongoRepository(repositoryOrQueryBuilder, options, searchOptions, transformOptions);
|
|
@@ -67,7 +82,6 @@ async function Paginate(repositoryOrQueryBuilder, options, searchOptions, transf
|
|
|
67
82
|
return paginateQueryBuilder(repositoryOrQueryBuilder, options, transformOptions);
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
|
-
exports.Paginate = Paginate;
|
|
71
85
|
async function paginateRepository(repository, options, searchOptions, transformOptions) {
|
|
72
86
|
const { take, skip } = resolvePageOption(options);
|
|
73
87
|
const [result, total] = await repository.findAndCount({
|
|
@@ -106,3 +120,4 @@ function resolvePageOption(pageOption) {
|
|
|
106
120
|
take,
|
|
107
121
|
};
|
|
108
122
|
}
|
|
123
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../lib/pagination/page.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoIA,4BA8BC;AAlKD,yDAK2B;AAC3B,qCAMiB;AAIjB,MAAa,gBAAgB;CAE5B;AAFD,4CAEC;AAUD,MAAa,UAAU;IAQrB,YAAY,OAAgB,EAAE,IAAa;QAK3C,YAAO,GAAG,CAAC,CAAC;QAEZ,SAAI,GAAG,EAAE,CAAC;QANR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC;IACpB,CAAC;IAMD,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,IAAY;QACvC,OAAO,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;CACF;AApBD,gCAoBC;AAGD,MAAa,IAAI;IAmBf,YACE,IAAiB,EACjB,KAAa,EACb,OAAY,EACZ,gBAAsC,EACtC,cAAkB;QAjBpB,YAAO,GAAY,KAAK,CAAC;QAEzB,YAAO,GAAY,KAAK,CAAC;QAiBvB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,IAAI,IAAI,gBAAgB,EAAK,CAAC;QACtE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,O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AO;QACL,OAAO;QACP,IAAI;QACJ,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
export interface PrepareResult {
|
|
3
|
+
formattedSP: string;
|
|
4
|
+
paramaters?: any[];
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class BaseRepository {
|
|
7
|
+
readonly dataSource: DataSource;
|
|
8
|
+
constructor(dataSource: DataSource);
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class BaseSpRepository extends BaseRepository {
|
|
11
|
+
readonly executeCommand: string;
|
|
12
|
+
constructor(dataSource: DataSource, executeCommand?: string);
|
|
13
|
+
callQuery(spName: string, formatOrValue?: any, params?: any, rename?: (key: string, depth: number, object: any) => string, objectifyForSignleRecord?: boolean): Promise<any>;
|
|
14
|
+
private resolveRecordsets;
|
|
15
|
+
private prepare;
|
|
16
|
+
private renameKey;
|
|
17
|
+
private changeKey;
|
|
18
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseSpRepository = exports.BaseRepository = void 0;
|
|
4
|
+
const common_1 = require("@nathapp/common");
|
|
5
|
+
class BaseRepository {
|
|
6
|
+
constructor(dataSource) {
|
|
7
|
+
this.dataSource = dataSource;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.BaseRepository = BaseRepository;
|
|
11
|
+
class BaseSpRepository extends BaseRepository {
|
|
12
|
+
constructor(dataSource, executeCommand) {
|
|
13
|
+
super(dataSource);
|
|
14
|
+
this.executeCommand = executeCommand || 'call';
|
|
15
|
+
}
|
|
16
|
+
async callQuery(spName, formatOrValue, params, rename, objectifyForSignleRecord = false) {
|
|
17
|
+
const { formattedSP, paramaters } = await this.prepare(spName, formatOrValue, params);
|
|
18
|
+
const results = await this.dataSource.query(formattedSP, paramaters);
|
|
19
|
+
return this.resolveRecordsets(results, rename, objectifyForSignleRecord);
|
|
20
|
+
}
|
|
21
|
+
resolveRecordsets(results, rename, objectifyForSignleRecord = false) {
|
|
22
|
+
if (!Array.isArray(results)) {
|
|
23
|
+
if (objectifyForSignleRecord) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const status = results.pop();
|
|
29
|
+
if (1 < results.length) {
|
|
30
|
+
const recordsets = [];
|
|
31
|
+
for (let i = 0; results.length > i; i++) {
|
|
32
|
+
const recordset = results[i];
|
|
33
|
+
if (!rename) {
|
|
34
|
+
recordsets.push(recordset);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const result = [];
|
|
38
|
+
for (let i = 0; recordset.length > i; i++) {
|
|
39
|
+
const record = recordset[i];
|
|
40
|
+
result.push(this.renameKey(record, rename));
|
|
41
|
+
}
|
|
42
|
+
recordsets.push(result);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return recordsets;
|
|
46
|
+
}
|
|
47
|
+
const recordset = results[0];
|
|
48
|
+
if (objectifyForSignleRecord) {
|
|
49
|
+
if (1 == recordset.length) {
|
|
50
|
+
if (rename) {
|
|
51
|
+
return this.renameKey(recordset[0], rename);
|
|
52
|
+
}
|
|
53
|
+
return recordset[0];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (rename) {
|
|
57
|
+
const result = [];
|
|
58
|
+
for (let i = 0; recordset.length > i; i++) {
|
|
59
|
+
result.push(this.renameKey(recordset[i], rename));
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
return recordset;
|
|
64
|
+
}
|
|
65
|
+
async prepare(spName, formatOrValue, params) {
|
|
66
|
+
let paramaters = [];
|
|
67
|
+
if (!(0, common_1.isUndefinedOrNullOrEmpty)(formatOrValue) &&
|
|
68
|
+
Array.isArray(formatOrValue)) {
|
|
69
|
+
paramaters = formatOrValue;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
if (!(0, common_1.isUndefinedOrNullOrEmpty)(params)) {
|
|
73
|
+
if (!(0, common_1.isUndefinedOrNullOrEmpty)(formatOrValue)) {
|
|
74
|
+
params = (0, common_1.checkFormat)(formatOrValue, params);
|
|
75
|
+
for (const key of Object.keys(params)) {
|
|
76
|
+
paramaters.push(params[key]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let qm;
|
|
82
|
+
if (0 >= paramaters.length) {
|
|
83
|
+
qm = '';
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
qm = '?';
|
|
87
|
+
if (1 < paramaters.length) {
|
|
88
|
+
qm += ',?'.repeat(paramaters.length - 1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
formattedSP: `${this.executeCommand} ${spName}(${qm})`,
|
|
93
|
+
paramaters,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
renameKey(object, rename, depth) {
|
|
97
|
+
for (const key in object) {
|
|
98
|
+
try {
|
|
99
|
+
if (undefined == depth) {
|
|
100
|
+
depth = 0;
|
|
101
|
+
}
|
|
102
|
+
if (object[key] && 'object' === typeof object[key]) {
|
|
103
|
+
const type = object[key].constructor
|
|
104
|
+
? object[key].constructor.name
|
|
105
|
+
: '';
|
|
106
|
+
switch (type) {
|
|
107
|
+
case 'Object':
|
|
108
|
+
case 'Array':
|
|
109
|
+
this.renameKey(object[key], rename, depth + 1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const newKey = rename(key, depth, object);
|
|
113
|
+
this.changeKey(object, key, newKey);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
error.checkKey = key;
|
|
117
|
+
error.checkValue = object[key];
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return object;
|
|
122
|
+
}
|
|
123
|
+
changeKey(object, name, newName) {
|
|
124
|
+
if (!object || name == newName) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if ('object' === typeof object) {
|
|
128
|
+
const item = Object.getOwnPropertyDescriptor(object, name);
|
|
129
|
+
if (item) {
|
|
130
|
+
Object.defineProperty(object, newName, item);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
object[newName] = object[name];
|
|
135
|
+
}
|
|
136
|
+
delete object[name];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.BaseSpRepository = BaseSpRepository;
|
|
140
|
+
//# sourceMappingURL=base.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.repository.js","sourceRoot":"","sources":["../../lib/repository/base.repository.ts"],"names":[],"mappings":";;;AAAA,4CAAwE;AAQxE,MAAsB,cAAc;IAElC,YAAY,UAAsB;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAED,MAAsB,gBAAiB,SAAQ,cAAc;IAG3D,YAAY,UAAsB,EAAE,cAAuB;QACzD,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,MAAM,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,SAAS,CACb,MAAc,EACd,aAAmB,EACnB,MAAY,EACZ,MAA4D,EAC5D,wBAAwB,GAAG,KAAK;QAEhC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CACpD,MAAM,EACN,aAAa,EACb,MAAM,CACP,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAC1E,CAAC;IAEO,iBAAiB,CAAC,OAAY,EAAE,MAA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AQ,GAAG,GAAG,CAAC;gBACrB,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/B,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,SAAS,CAAC,MAAW,EAAE,IAAY,EAAE,OAAe;QAC1D,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;YAC/B,OAAO;QACT,CAAC;QACD,IAAI,QAAQ,KAAK,OAAO,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC3D,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF;AA9KD,4CA8KC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseSpRepository = exports.BaseRepository = void 0;
|
|
4
|
+
const base_repository_1 = require("./base.repository");
|
|
5
|
+
Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return base_repository_1.BaseRepository; } });
|
|
6
|
+
Object.defineProperty(exports, "BaseSpRepository", { enumerable: true, get: function () { return base_repository_1.BaseSpRepository; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/repository/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqE;AAGnE,+FAHO,gCAAc,OAGP;AACd,iGAJuB,kCAAgB,OAIvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { sqlQueryResult, resolveQuerySingleResult, resolveQueryArrayResult, resolveEmptySingleResult, createInMemorySqliteDataSource, createInMemoryPgDataSource } from "./testing-utils";
|
|
2
|
+
export { sqlQueryResult, resolveQuerySingleResult, resolveQueryArrayResult, resolveEmptySingleResult, createInMemorySqliteDataSource, createInMemoryPgDataSource, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInMemoryPgDataSource = exports.createInMemorySqliteDataSource = exports.resolveEmptySingleResult = exports.resolveQueryArrayResult = exports.resolveQuerySingleResult = exports.sqlQueryResult = void 0;
|
|
4
|
+
const testing_utils_1 = require("./testing-utils");
|
|
5
|
+
Object.defineProperty(exports, "sqlQueryResult", { enumerable: true, get: function () { return testing_utils_1.sqlQueryResult; } });
|
|
6
|
+
Object.defineProperty(exports, "resolveQuerySingleResult", { enumerable: true, get: function () { return testing_utils_1.resolveQuerySingleResult; } });
|
|
7
|
+
Object.defineProperty(exports, "resolveQueryArrayResult", { enumerable: true, get: function () { return testing_utils_1.resolveQueryArrayResult; } });
|
|
8
|
+
Object.defineProperty(exports, "resolveEmptySingleResult", { enumerable: true, get: function () { return testing_utils_1.resolveEmptySingleResult; } });
|
|
9
|
+
Object.defineProperty(exports, "createInMemorySqliteDataSource", { enumerable: true, get: function () { return testing_utils_1.createInMemorySqliteDataSource; } });
|
|
10
|
+
Object.defineProperty(exports, "createInMemoryPgDataSource", { enumerable: true, get: function () { return testing_utils_1.createInMemoryPgDataSource; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/testing/index.ts"],"names":[],"mappings":";;;AAAA,mDAA0L;AAGxL,+FAHO,8BAAc,OAGP;AACd,yGAJuB,wCAAwB,OAIvB;AACxB,wGALiD,uCAAuB,OAKjD;AACvB,yGAN0E,wCAAwB,OAM1E;AACxB,+GAPoG,8CAA8B,OAOpG;AAC9B,2GARoI,0CAA0B,OAQpI"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DataSource, DataSourceOptions } from "typeorm";
|
|
2
|
+
export declare const sqlQueryResult: {
|
|
3
|
+
fieldCount: number;
|
|
4
|
+
affectedRows: number;
|
|
5
|
+
insertId: number;
|
|
6
|
+
info: string;
|
|
7
|
+
serverStatus: number;
|
|
8
|
+
warningStatus: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const resolveQuerySingleResult: (result: any, statusQueryResult?: {
|
|
11
|
+
fieldCount: number;
|
|
12
|
+
affectedRows: number;
|
|
13
|
+
insertId: number;
|
|
14
|
+
info: string;
|
|
15
|
+
serverStatus: number;
|
|
16
|
+
warningStatus: number;
|
|
17
|
+
}) => (any[] | {
|
|
18
|
+
fieldCount: number;
|
|
19
|
+
affectedRows: number;
|
|
20
|
+
insertId: number;
|
|
21
|
+
info: string;
|
|
22
|
+
serverStatus: number;
|
|
23
|
+
warningStatus: number;
|
|
24
|
+
})[];
|
|
25
|
+
export declare const resolveQueryArrayResult: (results: any[], statusQueryResult?: {
|
|
26
|
+
fieldCount: number;
|
|
27
|
+
affectedRows: number;
|
|
28
|
+
insertId: number;
|
|
29
|
+
info: string;
|
|
30
|
+
serverStatus: number;
|
|
31
|
+
warningStatus: number;
|
|
32
|
+
}) => (any[] | {
|
|
33
|
+
fieldCount: number;
|
|
34
|
+
affectedRows: number;
|
|
35
|
+
insertId: number;
|
|
36
|
+
info: string;
|
|
37
|
+
serverStatus: number;
|
|
38
|
+
warningStatus: number;
|
|
39
|
+
})[];
|
|
40
|
+
export declare const resolveEmptySingleResult: (statusQueryResult?: {
|
|
41
|
+
fieldCount: number;
|
|
42
|
+
affectedRows: number;
|
|
43
|
+
insertId: number;
|
|
44
|
+
info: string;
|
|
45
|
+
serverStatus: number;
|
|
46
|
+
warningStatus: number;
|
|
47
|
+
}) => (any[] | {
|
|
48
|
+
fieldCount: number;
|
|
49
|
+
affectedRows: number;
|
|
50
|
+
insertId: number;
|
|
51
|
+
info: string;
|
|
52
|
+
serverStatus: number;
|
|
53
|
+
warningStatus: number;
|
|
54
|
+
})[];
|
|
55
|
+
export declare const createInMemorySqliteDataSource: (options?: DataSourceOptions) => Promise<DataSource>;
|
|
56
|
+
export declare const createInMemoryPgDataSource: (options?: DataSourceOptions) => Promise<DataSource>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInMemoryPgDataSource = exports.createInMemorySqliteDataSource = exports.resolveEmptySingleResult = exports.resolveQueryArrayResult = exports.resolveQuerySingleResult = exports.sqlQueryResult = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const load_package_util_1 = require("@nestjs/common/utils/load-package.util");
|
|
6
|
+
exports.sqlQueryResult = {
|
|
7
|
+
fieldCount: 0,
|
|
8
|
+
affectedRows: 0,
|
|
9
|
+
insertId: 0,
|
|
10
|
+
info: '',
|
|
11
|
+
serverStatus: 34,
|
|
12
|
+
warningStatus: 0,
|
|
13
|
+
};
|
|
14
|
+
const resolveQuerySingleResult = (result, statusQueryResult = exports.sqlQueryResult) => {
|
|
15
|
+
return [[result], statusQueryResult];
|
|
16
|
+
};
|
|
17
|
+
exports.resolveQuerySingleResult = resolveQuerySingleResult;
|
|
18
|
+
const resolveQueryArrayResult = (results, statusQueryResult = exports.sqlQueryResult) => {
|
|
19
|
+
return [results, statusQueryResult];
|
|
20
|
+
};
|
|
21
|
+
exports.resolveQueryArrayResult = resolveQueryArrayResult;
|
|
22
|
+
const resolveEmptySingleResult = (statusQueryResult = exports.sqlQueryResult) => {
|
|
23
|
+
return [[], statusQueryResult];
|
|
24
|
+
};
|
|
25
|
+
exports.resolveEmptySingleResult = resolveEmptySingleResult;
|
|
26
|
+
const createInMemorySqliteDataSource = async (options) => {
|
|
27
|
+
const dbOptions = Object.assign({}, { type: "sqlite", database: ":memory:", }, options);
|
|
28
|
+
return new typeorm_1.DataSource(dbOptions);
|
|
29
|
+
};
|
|
30
|
+
exports.createInMemorySqliteDataSource = createInMemorySqliteDataSource;
|
|
31
|
+
const createInMemoryPgDataSource = (options) => {
|
|
32
|
+
const dbOptions = Object.assign({}, { type: "postgres", synchronize: true, }, options);
|
|
33
|
+
const pgMem = (0, load_package_util_1.loadPackage)('pg-mem', 'createInMemoryPgDataSource', () => require('pg-mem'));
|
|
34
|
+
const db = pgMem.newDb();
|
|
35
|
+
db.public.registerFunction({
|
|
36
|
+
name: 'current_database',
|
|
37
|
+
args: [],
|
|
38
|
+
returns: pgMem.DataType.text,
|
|
39
|
+
implementation: (x) => `hello world ${x}`,
|
|
40
|
+
});
|
|
41
|
+
return db.adapters.createTypeormDataSource(dbOptions);
|
|
42
|
+
};
|
|
43
|
+
exports.createInMemoryPgDataSource = createInMemoryPgDataSource;
|
|
44
|
+
//# sourceMappingURL=testing-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing-utils.js","sourceRoot":"","sources":["../../lib/testing/testing-utils.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AACxD,8EAAqE;AAExD,QAAA,cAAc,GAAG;IAC5B,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,EAAE;IACR,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,CAAC;CACjB,CAAC;AAEK,MAAM,wBAAwB,GAAG,CACtC,MAAW,EACX,iBAAiB,GAAG,sBAAc,EAClC,EAAE;IACF,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACvC,CAAC,CAAC;AALW,QAAA,wBAAwB,4BAKnC;AAEK,MAAM,uBAAuB,GAAG,CACrC,OAAc,EACd,iBAAiB,GAAG,sBA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S,CAAC,CAAC;AACxD,CAAC,CAAA;AAZY,QAAA,0BAA0B,8BAYtC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { TypeOrmModuleOptions, TypeOrmOptionsFactory } from "@nestjs/typeorm";
|
|
2
2
|
import { EntitySchema, MixedList } from "typeorm";
|
|
3
3
|
import { BaseDataSourceOptions } from "typeorm/data-source/BaseDataSourceOptions";
|
|
4
|
-
|
|
4
|
+
import { MysqlConnectionOptions } from "typeorm/driver/mysql/MysqlConnectionOptions";
|
|
5
|
+
import { MongoConnectionOptions } from "typeorm/driver/mongodb/MongoConnectionOptions";
|
|
6
|
+
import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions";
|
|
7
|
+
export type OptionWithoutEntities = Omit<Partial<BaseDataSourceOptions>, "entities" | "type"> | Omit<Partial<MysqlConnectionOptions>, "entities" | "type"> | Omit<Partial<MongoConnectionOptions>, "entities" | "type"> | Omit<Partial<PostgresConnectionOptions>, "entities" | "type">;
|
|
5
8
|
export declare class BaseTypeOrmModuleOptionFactory implements TypeOrmOptionsFactory {
|
|
6
9
|
private readonly connectionString;
|
|
7
10
|
private readonly entities?;
|
|
@@ -10,3 +13,6 @@ export declare class BaseTypeOrmModuleOptionFactory implements TypeOrmOptionsFac
|
|
|
10
13
|
constructor(connectionString: string, entities?: MixedList<Function | string | EntitySchema>, options?: OptionWithoutEntities);
|
|
11
14
|
createTypeOrmOptions(connectionName?: string): TypeOrmModuleOptions | Promise<TypeOrmModuleOptions>;
|
|
12
15
|
}
|
|
16
|
+
export declare class DefaultTypeOrmModuleOptionFactory extends BaseTypeOrmModuleOptionFactory {
|
|
17
|
+
constructor(entities?: MixedList<Function | string | EntitySchema>, options?: OptionWithoutEntities);
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseTypeOrmModuleOptionFactory = void 0;
|
|
3
|
+
exports.DefaultTypeOrmModuleOptionFactory = exports.BaseTypeOrmModuleOptionFactory = void 0;
|
|
4
4
|
const typeorm_utils_1 = require("./typeorm-utils");
|
|
5
5
|
class BaseTypeOrmModuleOptionFactory {
|
|
6
6
|
constructor(connectionString, entities, options) {
|
|
@@ -19,12 +19,13 @@ class BaseTypeOrmModuleOptionFactory {
|
|
|
19
19
|
case "mysql":
|
|
20
20
|
case "mariadb":
|
|
21
21
|
case "mongodb":
|
|
22
|
+
case "postgres":
|
|
22
23
|
return {
|
|
24
|
+
...options,
|
|
23
25
|
name: connectionName,
|
|
24
26
|
type: this.connectionType,
|
|
25
27
|
url: this.connectionString,
|
|
26
28
|
entities: this.entities || [],
|
|
27
|
-
...options,
|
|
28
29
|
};
|
|
29
30
|
default:
|
|
30
31
|
throw new Error("Connection Not Supported");
|
|
@@ -32,3 +33,10 @@ class BaseTypeOrmModuleOptionFactory {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
exports.BaseTypeOrmModuleOptionFactory = BaseTypeOrmModuleOptionFactory;
|
|
36
|
+
class DefaultTypeOrmModuleOptionFactory extends BaseTypeOrmModuleOptionFactory {
|
|
37
|
+
constructor(entities, options) {
|
|
38
|
+
super(process.env.MYSQL_URL, entities, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.DefaultTypeOrmModuleOptionFactory = DefaultTypeOrmModuleOptionFactory;
|
|
42
|
+
//# sourceMappingURL=base-typeorm-options-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-typeorm-options-factory.js","sourceRoot":"","sources":["../../lib/typeorm/base-typeorm-options-factory.ts"],"names":[],"mappings":";;;AAIA,mDAAyD;AAQzD,MAAa,8BAA8B;IAGzC,YAA6B,gBAAwB,EAClC,QAAsD,EACtD,OAA+B;QAFrB,qBAAgB,GAAhB,gBAAgB,CAAQ;QAClC,aAAQ,GAAR,QAAQ,CAA8C;QACtD,YAAO,GAAP,OA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AAA,yEAA+D;AAElD,QAAA,mBAAmB,GAAG;IACjC,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,KAAK;IAClB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI,+CAAmB,EAAE;CAC1C,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;CACvB,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,IAAI;CACzB,CAAA"}
|
package/dist/typeorm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseTypeOrmModuleOptionFactory, OptionWithoutEntities } from "./base-typeorm-options-factory";
|
|
1
|
+
import { BaseTypeOrmModuleOptionFactory, DefaultTypeOrmModuleOptionFactory, OptionWithoutEntities } from "./base-typeorm-options-factory";
|
|
2
2
|
import { defaultExtraOptions, defaultMongoExtraOptions, defaultMysqlExtraOptions } from "./constants";
|
|
3
3
|
import { DEFAULT_DATA_SOURCE_NAME, SupportedConnectionType, TypeOrmExModule } from "./typeorm-ex.module";
|
|
4
4
|
import { sanatizeTypeOrmOptions } from "./typeorm-utils";
|
|
5
|
-
export { TypeOrmExModule, DEFAULT_DATA_SOURCE_NAME, defaultExtraOptions, defaultMysqlExtraOptions, defaultMongoExtraOptions, SupportedConnectionType, sanatizeTypeOrmOptions, BaseTypeOrmModuleOptionFactory, OptionWithoutEntities, };
|
|
5
|
+
export { TypeOrmExModule, DEFAULT_DATA_SOURCE_NAME, defaultExtraOptions, defaultMysqlExtraOptions, defaultMongoExtraOptions, SupportedConnectionType, sanatizeTypeOrmOptions, BaseTypeOrmModuleOptionFactory, OptionWithoutEntities, DefaultTypeOrmModuleOptionFactory, };
|
package/dist/typeorm/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseTypeOrmModuleOptionFactory = exports.sanatizeTypeOrmOptions = exports.defaultMongoExtraOptions = exports.defaultMysqlExtraOptions = exports.defaultExtraOptions = exports.DEFAULT_DATA_SOURCE_NAME = exports.TypeOrmExModule = void 0;
|
|
3
|
+
exports.DefaultTypeOrmModuleOptionFactory = exports.BaseTypeOrmModuleOptionFactory = exports.sanatizeTypeOrmOptions = exports.defaultMongoExtraOptions = exports.defaultMysqlExtraOptions = exports.defaultExtraOptions = exports.DEFAULT_DATA_SOURCE_NAME = exports.TypeOrmExModule = void 0;
|
|
4
4
|
const base_typeorm_options_factory_1 = require("./base-typeorm-options-factory");
|
|
5
5
|
Object.defineProperty(exports, "BaseTypeOrmModuleOptionFactory", { enumerable: true, get: function () { return base_typeorm_options_factory_1.BaseTypeOrmModuleOptionFactory; } });
|
|
6
|
+
Object.defineProperty(exports, "DefaultTypeOrmModuleOptionFactory", { enumerable: true, get: function () { return base_typeorm_options_factory_1.DefaultTypeOrmModuleOptionFactory; } });
|
|
6
7
|
const constants_1 = require("./constants");
|
|
7
8
|
Object.defineProperty(exports, "defaultExtraOptions", { enumerable: true, get: function () { return constants_1.defaultExtraOptions; } });
|
|
8
9
|
Object.defineProperty(exports, "defaultMongoExtraOptions", { enumerable: true, get: function () { return constants_1.defaultMongoExtraOptions; } });
|
|
@@ -12,3 +13,4 @@ Object.defineProperty(exports, "DEFAULT_DATA_SOURCE_NAME", { enumerable: true, g
|
|
|
12
13
|
Object.defineProperty(exports, "TypeOrmExModule", { enumerable: true, get: function () { return typeorm_ex_module_1.TypeOrmExModule; } });
|
|
13
14
|
const typeorm_utils_1 = require("./typeorm-utils");
|
|
14
15
|
Object.defineProperty(exports, "sanatizeTypeOrmOptions", { enumerable: true, get: function () { return typeorm_utils_1.sanatizeTypeOrmOptions; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/typeorm/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0I;AAaxI,+GAbO,6DAA8B,OAaP;AAE9B,kHAfuC,gEAAiC,OAevC;AAdnC,2CAAsG;AAOpG,oGAPO,+BAAmB,OAOP;AAEnB,yGAT4B,oCAAwB,OAS5B;AADxB,yGARsD,oCAAwB,OAQtD;AAP1B,2DAAyG;AAKvG,yGALO,4CAAwB,OAKP;AADxB,gGAJ0D,mCAAe,OAI1D;AAHjB,mDAAyD;AASvD,uGATO,sCAAsB,OASP"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DynamicModule } from "@nestjs/common";
|
|
2
2
|
import { TypeOrmModuleAsyncOptions, TypeOrmModuleOptions } from "@nestjs/typeorm";
|
|
3
3
|
import { DataSource, DataSourceOptions } from "typeorm";
|
|
4
|
+
import { EntityClassOrSchema } from "@nestjs/typeorm/dist/interfaces/entity-class-or-schema.type";
|
|
4
5
|
export declare const DEFAULT_DATA_SOURCE_NAME = "default";
|
|
5
|
-
export type SupportedConnectionType = "mysql" | "mariadb" | "mongodb";
|
|
6
|
+
export type SupportedConnectionType = "mysql" | "mariadb" | "mongodb" | "postgres";
|
|
6
7
|
export declare class TypeOrmExModule {
|
|
7
8
|
static forRoot(options?: TypeOrmModuleOptions): DynamicModule;
|
|
8
9
|
static forRootAsync(options?: TypeOrmModuleAsyncOptions): DynamicModule;
|
|
10
|
+
static forFeature(entities?: EntityClassOrSchema[], dataSource?: string): DynamicModule;
|
|
9
11
|
static forCustomRepository<T extends new (...args: any[]) => any>(repositories: T[], dataSource?: DataSource | DataSourceOptions | string): DynamicModule;
|
|
10
12
|
private static sanitizeOptions;
|
|
11
13
|
}
|
|
@@ -4,6 +4,7 @@ exports.TypeOrmExModule = exports.DEFAULT_DATA_SOURCE_NAME = void 0;
|
|
|
4
4
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
5
5
|
const decorator_1 = require("../decorator");
|
|
6
6
|
const typeorm_utils_1 = require("./typeorm-utils");
|
|
7
|
+
const repository_1 = require("../repository");
|
|
7
8
|
exports.DEFAULT_DATA_SOURCE_NAME = 'default';
|
|
8
9
|
class TypeOrmExModule {
|
|
9
10
|
static forRoot(options) {
|
|
@@ -19,6 +20,12 @@ class TypeOrmExModule {
|
|
|
19
20
|
imports: [typeorm_1.TypeOrmModule.forRootAsync(options)],
|
|
20
21
|
};
|
|
21
22
|
}
|
|
23
|
+
static forFeature(entities, dataSource = exports.DEFAULT_DATA_SOURCE_NAME) {
|
|
24
|
+
return {
|
|
25
|
+
module: TypeOrmExModule,
|
|
26
|
+
imports: [typeorm_1.TypeOrmModule.forFeature(entities, dataSource)],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
22
29
|
static forCustomRepository(repositories, dataSource = exports.DEFAULT_DATA_SOURCE_NAME) {
|
|
23
30
|
const providers = [];
|
|
24
31
|
for (const repository of repositories) {
|
|
@@ -30,6 +37,9 @@ class TypeOrmExModule {
|
|
|
30
37
|
inject: [(0, typeorm_1.getDataSourceToken)(dataSource)],
|
|
31
38
|
provide: repository,
|
|
32
39
|
useFactory: (dataSource) => {
|
|
40
|
+
if (repository.prototype instanceof repository_1.BaseRepository) {
|
|
41
|
+
return new repository(dataSource);
|
|
42
|
+
}
|
|
33
43
|
const baseRepository = dataSource.getRepository(entity);
|
|
34
44
|
const customRepository = new repository(baseRepository.target, baseRepository.manager);
|
|
35
45
|
Object.defineProperty(customRepository, 'manager', {
|
|
@@ -62,3 +72,4 @@ class TypeOrmExModule {
|
|
|
62
72
|
}
|
|
63
73
|
}
|
|
64
74
|
exports.TypeOrmExModule = TypeOrmExModule;
|
|
75
|
+
//# sourceMappingURL=typeorm-ex.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-ex.module.js","sourceRoot":"","sources":["../../lib/typeorm/typeorm-ex.module.ts"],"names":[],"mappings":";;;AACA,6CAAqH;AAErH,4CAA4D;AAC5D,mDAAyD;AACzD,8CA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AM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAM,MAAM,CAAC,CAAC;oBAE7D,MAAM,gBAAgB,GAAG,IAAI,UAAU,CACrC,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,OAAO,CACvB,CAAC;oBAIF,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,SAAS,EAAE;wBACjD,GAAG;4BACD,OAAO,cAAc,CAAC,OAAO,CAAC;wBAChC,CAAC;qBACF,CAAC,CAAC;oBAEH,OAAO,gBAAgB,CAAC;gBAC1B,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,eAAe;YACvB,SAAS;SACV,CAAC;IACJ,CAAC;IAGO,MAAM,CAAC,eAAe,CAAC,OAA6B;QAC1D,IAAI,cAAuC,CAAC;QAE5C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,cAAc,GAAG,OAAO,CAAC,IAA+B,CAAC;QAE3D,CAAC;aAAM,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAA6B,CAAC;QAChF,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,IAAA,sCAAsB,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF;AAjGD,0CAiGC"}
|
|
@@ -12,7 +12,7 @@ export declare const sanatizeTypeOrmOptions: (connectionType: SupportedConnectio
|
|
|
12
12
|
bigNumberStrings: boolean;
|
|
13
13
|
} & {
|
|
14
14
|
type: SupportedConnectionType;
|
|
15
|
-
} &
|
|
15
|
+
} & Omit<Partial<import("typeorm/data-source/BaseDataSourceOptions").BaseDataSourceOptions>, "type" | "entities">) | ({
|
|
16
16
|
entities: any[];
|
|
17
17
|
logging: boolean;
|
|
18
18
|
synchronize: boolean;
|
|
@@ -23,4 +23,4 @@ export declare const sanatizeTypeOrmOptions: (connectionType: SupportedConnectio
|
|
|
23
23
|
useUnifiedTopology: boolean;
|
|
24
24
|
} & {
|
|
25
25
|
type: SupportedConnectionType;
|
|
26
|
-
} &
|
|
26
|
+
} & Omit<Partial<import("typeorm/data-source/BaseDataSourceOptions").BaseDataSourceOptions>, "type" | "entities">);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-utils.js","sourceRoot":"","sources":["../../lib/typeorm/typeorm-utils.ts"],"names":[],"mappings":";;;AAEA,2CAAsG;AAK/F,MAAM,sBAAsB,GAAG,CAAC,cAAuC,EAAE,OAAqD,EAAE,EAAE;IACvI,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IACxC,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAmB,EAAE,oCAAwB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvF,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAmB,EAAE,oCAAwB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;AACH,CAAC,CAAA;AATY,QAAA,sBAAsB,0BASlC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-data",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "@nathapp/nestjs-data",
|
|
5
5
|
"scripts": {
|
|
6
|
+
"clean": "rimraf dist/ .turbo/",
|
|
6
7
|
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
7
8
|
"precommit": "lint-staged",
|
|
8
9
|
"test": "jest --config ./test/jest-test.json",
|
|
@@ -10,41 +11,33 @@
|
|
|
10
11
|
"test:watch": "jest --config ./test/jest-test.json --watch",
|
|
11
12
|
"lint": "eslint -c .eslintrc.js"
|
|
12
13
|
},
|
|
13
|
-
"author": "",
|
|
14
|
+
"author": "William Khoo",
|
|
14
15
|
"license": "ISC",
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@golevelup/ts-jest": "^0.3.7",
|
|
17
|
-
"@nestjs/testing": "^10.0.0",
|
|
18
|
-
"@types/jest": "^29.5.2",
|
|
19
|
-
"@types/node": "^17.0.22",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^4",
|
|
21
|
-
"@typescript-eslint/parser": "^4",
|
|
22
|
-
"eslint": "*",
|
|
23
|
-
"eslint-config-prettier": "^6",
|
|
24
|
-
"eslint-plugin-prettier": "^3",
|
|
25
|
-
"jest": "^29.5.0",
|
|
26
|
-
"prettier": "^2",
|
|
27
|
-
"supertest": "^6.3.3",
|
|
28
|
-
"ts-jest": "^29.1.0",
|
|
29
|
-
"typescript": "^4"
|
|
30
|
-
},
|
|
31
16
|
"types": "./index.d.ts",
|
|
32
17
|
"main": "index.js",
|
|
33
18
|
"directories": {
|
|
34
19
|
"lib": "lib"
|
|
35
20
|
},
|
|
36
21
|
"dependencies": {
|
|
37
|
-
"@nathapp/nestjs-common": "^1.0.
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
"@nathapp/nestjs-common": "^1.0.2-rc.0",
|
|
23
|
+
"dayjs": "^1.11.13"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@nathapp/eslint-config": "1.0.1",
|
|
27
|
+
"@nathapp/typescript-config": "1.0.1",
|
|
28
|
+
"eslint": "^8.57.0",
|
|
29
|
+
"typescript": "^5"
|
|
41
30
|
},
|
|
42
31
|
"peerDependencies": {
|
|
43
|
-
"@nestjs
|
|
44
|
-
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
32
|
+
"@nathapp/nestjs-common": "^1.0.2",
|
|
45
33
|
"@nestjs/typeorm": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
34
|
+
"pg-mem": "*",
|
|
35
|
+
"typeorm": "^0.3.12",
|
|
36
|
+
"typeorm-naming-strategies": "^4.1.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"pg-mem": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
49
42
|
}
|
|
50
43
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
sourceType: 'module',
|
|
6
|
-
},
|
|
7
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
8
|
-
extends: [
|
|
9
|
-
'plugin:@typescript-eslint/recommended',
|
|
10
|
-
'plugin:prettier/recommended',
|
|
11
|
-
],
|
|
12
|
-
root: true,
|
|
13
|
-
env: {
|
|
14
|
-
node: true,
|
|
15
|
-
jest: true,
|
|
16
|
-
},
|
|
17
|
-
ignorePatterns: ['.eslintrc.js'],
|
|
18
|
-
rules: {
|
|
19
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
20
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
21
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
22
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
23
|
-
},
|
|
24
|
-
};
|