@ptc-org/nestjs-query-rest 11.0.0-alpha.0 → 11.0.0-alpha.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/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptc-org/nestjs-query-rest",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.1",
|
|
4
4
|
"description": "Nestjs rest query adapter",
|
|
5
|
-
"author": "doug-martin <doug@dougamartin.com>",
|
|
6
|
-
"homepage": "https://github.com/tripss/nestjs-query#readme",
|
|
7
5
|
"keywords": [
|
|
8
6
|
"rest",
|
|
9
7
|
"crud",
|
|
10
8
|
"nestjs"
|
|
11
9
|
],
|
|
10
|
+
"homepage": "https://github.com/tripss/nestjs-query#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/tripss/nestjs-query/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/tripss/nestjs-query.git",
|
|
17
|
+
"directory": "packages/query-rest"
|
|
18
|
+
},
|
|
12
19
|
"license": "MIT",
|
|
20
|
+
"author": "doug-martin <doug@dougamartin.com>",
|
|
13
21
|
"main": "src/index.js",
|
|
14
22
|
"types": "src/index.d.ts",
|
|
15
23
|
"directories": {
|
|
@@ -19,23 +27,11 @@
|
|
|
19
27
|
"files": [
|
|
20
28
|
"src/**"
|
|
21
29
|
],
|
|
22
|
-
"publishConfig": {
|
|
23
|
-
"access": "public"
|
|
24
|
-
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/tripss/nestjs-query.git",
|
|
28
|
-
"directory": "packages/query-rest"
|
|
29
|
-
},
|
|
30
|
-
"bugs": {
|
|
31
|
-
"url": "https://github.com/tripss/nestjs-query/issues"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"csv-stringify": "^6.8.3",
|
|
35
31
|
"lodash.omit": "^4.18.0",
|
|
36
32
|
"pluralize": "^8.0.0",
|
|
37
33
|
"tslib": "^2.8.1",
|
|
38
|
-
"@ptc-org/nestjs-query-core": "11.0.0-alpha.
|
|
34
|
+
"@ptc-org/nestjs-query-core": "11.0.0-alpha.1",
|
|
39
35
|
"lodash.merge": "4.6.2",
|
|
40
36
|
"reflect-metadata": "0.2.2"
|
|
41
37
|
},
|
|
@@ -44,7 +40,16 @@
|
|
|
44
40
|
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
45
41
|
"@nestjs/swagger": "^10.0.0 || ^11.0.0",
|
|
46
42
|
"class-transformer": "^0.5",
|
|
47
|
-
"class-validator": "^0.14.0 || ^0.15.0"
|
|
43
|
+
"class-validator": "^0.14.0 || ^0.15.0",
|
|
44
|
+
"csv-stringify": "^6.8.3"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"csv-stringify": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
48
53
|
},
|
|
49
54
|
"packageManager": "yarn@4.18.0",
|
|
50
55
|
"resolutions": {
|
|
@@ -13,7 +13,7 @@ export type ExportControllerOpts<DTO, ExportDTO = DeepPartial<DTO>> = {
|
|
|
13
13
|
export interface ExportController<DTO, QS extends QueryService<DTO, unknown, unknown>> extends ServiceController<DTO, QS> {
|
|
14
14
|
exportMany(query: QueryType<DTO, PagingStrategies.NONE>, authorizeFilter?: Filter<DTO>): Promise<string>;
|
|
15
15
|
}
|
|
16
|
-
export declare const stringifyExportCsv: <DTO, ExportDTO>(ExportDTOClass: Class<ExportDTO>, items: DTO[]) => string
|
|
16
|
+
export declare const stringifyExportCsv: <DTO, ExportDTO>(ExportDTOClass: Class<ExportDTO>, items: DTO[]) => Promise<string>;
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
* Mixin to add `export` rest endpoint.
|
|
@@ -6,7 +6,6 @@ const common_1 = require("@nestjs/common");
|
|
|
6
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
7
7
|
const nestjs_query_core_1 = require("@ptc-org/nestjs-query-core");
|
|
8
8
|
const class_transformer_1 = require("class-transformer");
|
|
9
|
-
const sync_1 = require("csv-stringify/sync");
|
|
10
9
|
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
11
10
|
const __1 = require("../");
|
|
12
11
|
const common_2 = require("../common");
|
|
@@ -14,17 +13,27 @@ const decorators_1 = require("../decorators");
|
|
|
14
13
|
const interceptors_1 = require("../interceptors");
|
|
15
14
|
const export_paging_query_args_type_1 = require("../types/query/query-args/export-paging-query-args.type");
|
|
16
15
|
const controller_interface_1 = require("./controller.interface");
|
|
17
|
-
const stringifyExportCsv = (ExportDTOClass, items) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const stringifyExportCsv = async (ExportDTOClass, items) => {
|
|
17
|
+
let stringifyCsv;
|
|
18
|
+
try {
|
|
19
|
+
const { stringify } = await Promise.resolve().then(() => tslib_1.__importStar(require('csv-stringify/sync')));
|
|
20
|
+
stringifyCsv = stringify;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new Error('csv-stringify is required for CSV export; install it with `npm install csv-stringify`');
|
|
24
|
+
}
|
|
25
|
+
return stringifyCsv((0, class_transformer_1.plainToInstance)(ExportDTOClass, items, { excludeExtraneousValues: true, groups: [nestjs_query_core_1.EXPORT_TRANSFORM_GROUP] }), {
|
|
26
|
+
header: true,
|
|
27
|
+
delimiter: ',',
|
|
28
|
+
defaultEncoding: 'utf8',
|
|
29
|
+
quoted_string: true,
|
|
30
|
+
cast: {
|
|
31
|
+
date: (value) => value.toISOString(),
|
|
32
|
+
boolean: (value) => value.toString()
|
|
33
|
+
},
|
|
34
|
+
escape_formulas: true
|
|
35
|
+
});
|
|
36
|
+
};
|
|
28
37
|
exports.stringifyExportCsv = stringifyExportCsv;
|
|
29
38
|
/**
|
|
30
39
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.controller.js","sourceRoot":"","sources":["../../../../../packages/query-rest/src/controllers/export.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,6CAA6C;AAC7C,kEAAyH;AACzH,yDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"export.controller.js","sourceRoot":"","sources":["../../../../../packages/query-rest/src/controllers/export.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,6CAA6C;AAC7C,kEAAyH;AACzH,yDAAmD;AACnD,sEAA8B;AAE9B,2BAA8G;AAC9G,sCAAuC;AACvC,8CAA6C;AAC7C,kDAAwE;AAExE,2GAA+F;AAC/F,iEAAkH;AAkB3G,MAAM,kBAAkB,GAAG,KAAK,EAAkB,cAAgC,EAAE,KAAY,EAAmB,EAAE;IAC1H,IAAI,YAA2D,CAAA;IAC/D,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,gEAAa,oBAAoB,GAAC,CAAA;QACxD,YAAY,GAAG,SAAS,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,uFAAuF,CAAC,CAAA;IAC1G,CAAC;IAED,OAAO,YAAY,CACjB,IAAA,mCAAe,EAAC,cAAc,EAAE,KAAK,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,0CAAsB,CAAC,EAAE,CAAC,EAC3G;QACE,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,GAAG;QACd,eAAe,EAAE,MAAM;QACvB,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,C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