@solidstarters/solid-core 1.2.73 → 1.2.76
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/controllers/export-template.controller.d.ts +36 -0
- package/dist/controllers/export-template.controller.d.ts.map +1 -0
- package/dist/controllers/export-template.controller.js +182 -0
- package/dist/controllers/export-template.controller.js.map +1 -0
- package/dist/controllers/export-transaction.controller.d.ts +33 -0
- package/dist/controllers/export-transaction.controller.d.ts.map +1 -0
- package/dist/controllers/export-transaction.controller.js +150 -0
- package/dist/controllers/export-transaction.controller.js.map +1 -0
- package/dist/dtos/create-export-template.dto.d.ts +9 -0
- package/dist/dtos/create-export-template.dto.d.ts.map +1 -0
- package/dist/dtos/create-export-template.dto.js +55 -0
- package/dist/dtos/create-export-template.dto.js.map +1 -0
- package/dist/dtos/create-export-transaction.dto.d.ts +9 -0
- package/dist/dtos/create-export-transaction.dto.d.ts.map +1 -0
- package/dist/dtos/create-export-transaction.dto.js +50 -0
- package/dist/dtos/create-export-transaction.dto.js.map +1 -0
- package/dist/dtos/update-export-template.dto.d.ts +10 -0
- package/dist/dtos/update-export-template.dto.d.ts.map +1 -0
- package/dist/dtos/update-export-template.dto.js +62 -0
- package/dist/dtos/update-export-template.dto.js.map +1 -0
- package/dist/dtos/update-export-transaction.dto.d.ts +9 -0
- package/dist/dtos/update-export-transaction.dto.d.ts.map +1 -0
- package/dist/dtos/update-export-transaction.dto.js +53 -0
- package/dist/dtos/update-export-transaction.dto.js.map +1 -0
- package/dist/entities/export-template.entity.d.ts +10 -0
- package/dist/entities/export-template.entity.d.ts.map +1 -0
- package/dist/entities/export-template.entity.js +53 -0
- package/dist/entities/export-template.entity.js.map +1 -0
- package/dist/entities/export-transaction.entity.d.ts +10 -0
- package/dist/entities/export-transaction.entity.d.ts.map +1 -0
- package/dist/entities/export-transaction.entity.js +51 -0
- package/dist/entities/export-transaction.entity.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +2 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +1 -1
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +183 -1
- package/dist/services/csv.service.d.ts +6 -0
- package/dist/services/csv.service.d.ts.map +1 -0
- package/dist/services/csv.service.js +48 -0
- package/dist/services/csv.service.js.map +1 -0
- package/dist/services/excel.service.d.ts +6 -0
- package/dist/services/excel.service.d.ts.map +1 -0
- package/dist/services/excel.service.js +90 -0
- package/dist/services/excel.service.js.map +1 -0
- package/dist/services/export-template.service.d.ts +27 -0
- package/dist/services/export-template.service.d.ts.map +1 -0
- package/dist/services/export-template.service.js +79 -0
- package/dist/services/export-template.service.js.map +1 -0
- package/dist/services/export-transaction.service.d.ts +50 -0
- package/dist/services/export-transaction.service.d.ts.map +1 -0
- package/dist/services/export-transaction.service.js +191 -0
- package/dist/services/export-transaction.service.js.map +1 -0
- package/dist/services/file.service.d.ts +3 -0
- package/dist/services/file.service.d.ts.map +1 -1
- package/dist/services/file.service.js +18 -2
- package/dist/services/file.service.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts +4 -2
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +4 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts +5 -3
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.js +23 -3
- package/dist/services/mediaStorageProviders/file-storage-provider.js.map +1 -1
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +17 -1
- package/dist/solid-core.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/controllers/export-template.controller.ts +98 -0
- package/src/controllers/export-transaction.controller.ts +76 -0
- package/src/dtos/create-export-template.dto.ts +27 -0
- package/src/dtos/create-export-transaction.dto.ts +26 -0
- package/src/dtos/update-export-template.dto.ts +33 -0
- package/src/dtos/update-export-transaction.dto.ts +28 -0
- package/src/entities/export-template.entity.ts +20 -0
- package/src/entities/export-transaction.entity.ts +22 -0
- package/src/index.ts +2 -0
- package/src/interfaces.ts +2 -0
- package/src/seeders/module-metadata-seeder.service.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +183 -1
- package/src/services/csv.service.ts +41 -0
- package/src/services/excel.service.ts +105 -0
- package/src/services/export-template.service.ts +71 -0
- package/src/services/export-transaction.service.ts +208 -0
- package/src/services/export_issues.txt +6 -0
- package/src/services/file.service.ts +26 -1
- package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +9 -6
- package/src/services/mediaStorageProviders/file-storage-provider.ts +29 -7
- package/src/services/solid-introspect.service.ts +1 -0
- package/src/solid-core.module.ts +18 -1
|
@@ -2828,7 +2828,7 @@
|
|
|
2828
2828
|
"private": false,
|
|
2829
2829
|
"encrypt": false,
|
|
2830
2830
|
"relationType": "many-to-one",
|
|
2831
|
-
"
|
|
2831
|
+
"relationCoModelSingularName": "emailTemplate",
|
|
2832
2832
|
"relationCreateInverse": false,
|
|
2833
2833
|
"relationCascade": "cascade",
|
|
2834
2834
|
"relationTypeManyToManyOwner": true,
|
|
@@ -3395,6 +3395,188 @@
|
|
|
3395
3395
|
"isRelationManyToManyOwner": null
|
|
3396
3396
|
}
|
|
3397
3397
|
]
|
|
3398
|
+
},
|
|
3399
|
+
{
|
|
3400
|
+
"singularName": "exportTemplate",
|
|
3401
|
+
"tableName": "ss_export_template",
|
|
3402
|
+
"pluralName": "exportTemplates",
|
|
3403
|
+
"displayName": "Export Templates",
|
|
3404
|
+
"description": "Model to capture all information related to an file export template",
|
|
3405
|
+
"dataSource": "default",
|
|
3406
|
+
"dataSourceType": "postgres",
|
|
3407
|
+
"isSystem": true,
|
|
3408
|
+
"userKeyFieldUserKey": "templateName",
|
|
3409
|
+
"fields": [
|
|
3410
|
+
{
|
|
3411
|
+
"name": "templateName",
|
|
3412
|
+
"displayName": "Template Name",
|
|
3413
|
+
"type": "shortText",
|
|
3414
|
+
"ormType": "varchar",
|
|
3415
|
+
"length": 256,
|
|
3416
|
+
"required": true,
|
|
3417
|
+
"unique": true,
|
|
3418
|
+
"index": true,
|
|
3419
|
+
"private": false,
|
|
3420
|
+
"encrypt": false,
|
|
3421
|
+
"isSystem": true
|
|
3422
|
+
},
|
|
3423
|
+
{
|
|
3424
|
+
"name": "templateFormat",
|
|
3425
|
+
"displayName": "Template Format",
|
|
3426
|
+
"type": "selectionStatic",
|
|
3427
|
+
"ormType": "varchar",
|
|
3428
|
+
"length": 25,
|
|
3429
|
+
"required": true,
|
|
3430
|
+
"index": false,
|
|
3431
|
+
"isSystem": true,
|
|
3432
|
+
"selectionValueType": "string",
|
|
3433
|
+
"selectionStaticValues": [
|
|
3434
|
+
"csv:csv",
|
|
3435
|
+
"excel:excel"
|
|
3436
|
+
]
|
|
3437
|
+
},
|
|
3438
|
+
{
|
|
3439
|
+
"name": "notifyOnEmail",
|
|
3440
|
+
"displayName": "Notify On Email",
|
|
3441
|
+
"type": "boolean",
|
|
3442
|
+
"ormType": "boolean",
|
|
3443
|
+
"defaultValue": "false",
|
|
3444
|
+
"required": false,
|
|
3445
|
+
"unique": false,
|
|
3446
|
+
"index": false,
|
|
3447
|
+
"private": false,
|
|
3448
|
+
"encrypt": false,
|
|
3449
|
+
"isSystem": true
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"name": "modelMetadata",
|
|
3453
|
+
"displayName": "Related Model Metadata",
|
|
3454
|
+
"type": "relation",
|
|
3455
|
+
"ormType": "int",
|
|
3456
|
+
"required": true,
|
|
3457
|
+
"unique": false,
|
|
3458
|
+
"index": true,
|
|
3459
|
+
"private": false,
|
|
3460
|
+
"encrypt": false,
|
|
3461
|
+
"relationType": "many-to-one",
|
|
3462
|
+
"relationCoModelSingularName": "modelMetadata",
|
|
3463
|
+
"relationCreateInverse": false,
|
|
3464
|
+
"relationCascade": "cascade",
|
|
3465
|
+
"relationModelModuleName": "solid-core",
|
|
3466
|
+
"isSystem": true
|
|
3467
|
+
},
|
|
3468
|
+
{
|
|
3469
|
+
"name": "fields",
|
|
3470
|
+
"displayName": "Fields",
|
|
3471
|
+
"type": "json",
|
|
3472
|
+
"ormType": "varchar",
|
|
3473
|
+
"length": 2056,
|
|
3474
|
+
"required": true,
|
|
3475
|
+
"unique": false,
|
|
3476
|
+
"index": false,
|
|
3477
|
+
"private": false,
|
|
3478
|
+
"encrypt": false,
|
|
3479
|
+
"isSystem": true
|
|
3480
|
+
}
|
|
3481
|
+
]
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
"singularName": "exportTransaction",
|
|
3485
|
+
"tableName": "ss_export_transaction",
|
|
3486
|
+
"pluralName": "exportTransactions",
|
|
3487
|
+
"displayName": "Export Transactions",
|
|
3488
|
+
"description": "Model to capture all information related to a file export transaction",
|
|
3489
|
+
"dataSource": "default",
|
|
3490
|
+
"dataSourceType": "postgres",
|
|
3491
|
+
"isSystem": true,
|
|
3492
|
+
"userKeyFieldUserKey": "exportTransactionId",
|
|
3493
|
+
"fields": [
|
|
3494
|
+
{
|
|
3495
|
+
"name": "datetime",
|
|
3496
|
+
"displayName": "Transaction Date Time",
|
|
3497
|
+
"type": "datetime",
|
|
3498
|
+
"ormType": "timestamp",
|
|
3499
|
+
"required": true,
|
|
3500
|
+
"unique": false,
|
|
3501
|
+
"index": true,
|
|
3502
|
+
"private": false,
|
|
3503
|
+
"encrypt": false,
|
|
3504
|
+
"isSystem": true
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
"name": "exportTransactionId",
|
|
3508
|
+
"displayName": "Transaction Id",
|
|
3509
|
+
"type": "computed",
|
|
3510
|
+
"ormType": "varchar",
|
|
3511
|
+
"length": 128,
|
|
3512
|
+
"required": true,
|
|
3513
|
+
"unique": true,
|
|
3514
|
+
"index": true,
|
|
3515
|
+
"private": false,
|
|
3516
|
+
"encrypt": false,
|
|
3517
|
+
"isSystem": true,
|
|
3518
|
+
"computedFieldValueType": "string",
|
|
3519
|
+
"computedFieldValueProvider": "UuidExternalIdComputedFieldProvider",
|
|
3520
|
+
"computedFieldValueProviderCtxt": "{\"prefix\": \"export_transaction\"}"
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
"name": "status",
|
|
3524
|
+
"displayName": "Status",
|
|
3525
|
+
"type": "selectionStatic",
|
|
3526
|
+
"ormType": "varchar",
|
|
3527
|
+
"length": 25,
|
|
3528
|
+
"required": true,
|
|
3529
|
+
"index": true,
|
|
3530
|
+
"isSystem": true,
|
|
3531
|
+
"selectionValueType": "string",
|
|
3532
|
+
"selectionStaticValues": [
|
|
3533
|
+
"started:started",
|
|
3534
|
+
"failed:failed",
|
|
3535
|
+
"finished:finished"
|
|
3536
|
+
]
|
|
3537
|
+
},
|
|
3538
|
+
{
|
|
3539
|
+
"name": "exportedFile",
|
|
3540
|
+
"displayName": "Exported File",
|
|
3541
|
+
"type": "mediaSingle",
|
|
3542
|
+
"required": false,
|
|
3543
|
+
"unique": true,
|
|
3544
|
+
"index": false,
|
|
3545
|
+
"private": false,
|
|
3546
|
+
"encrypt": false,
|
|
3547
|
+
"isSystem": true,
|
|
3548
|
+
"mediaStorageProviderUserKey": "default-filesystem"
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
"name": "error",
|
|
3552
|
+
"displayName": "Error",
|
|
3553
|
+
"type": "longText",
|
|
3554
|
+
"ormType": "text",
|
|
3555
|
+
"required": false,
|
|
3556
|
+
"unique": false,
|
|
3557
|
+
"index": false,
|
|
3558
|
+
"private": false,
|
|
3559
|
+
"encrypt": false,
|
|
3560
|
+
"isSystem": true
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
"name": "exportTemplate",
|
|
3564
|
+
"displayName": "Related Export Template",
|
|
3565
|
+
"type": "relation",
|
|
3566
|
+
"ormType": "int",
|
|
3567
|
+
"required": true,
|
|
3568
|
+
"unique": false,
|
|
3569
|
+
"index": true,
|
|
3570
|
+
"private": false,
|
|
3571
|
+
"encrypt": false,
|
|
3572
|
+
"relationType": "many-to-one",
|
|
3573
|
+
"relationCoModelSingularName": "exportTemplate",
|
|
3574
|
+
"relationCreateInverse": false,
|
|
3575
|
+
"relationCascade": "cascade",
|
|
3576
|
+
"relationModelModuleName": "solid-core",
|
|
3577
|
+
"isSystem": true
|
|
3578
|
+
}
|
|
3579
|
+
]
|
|
3398
3580
|
}
|
|
3399
3581
|
]
|
|
3400
3582
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.service.d.ts","sourceRoot":"","sources":["../../src/services/csv.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAI/C,qBACa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA+B;IAChC,eAAe,CAC1B,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,EACzE,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC;CA8BrB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var CsvService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CsvService = void 0;
|
|
11
|
+
const stream_1 = require("stream");
|
|
12
|
+
const fast_csv_1 = require("fast-csv");
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
let CsvService = CsvService_1 = class CsvService {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.logger = new common_1.Logger(CsvService_1.name);
|
|
17
|
+
}
|
|
18
|
+
async createCsvStream(getDataRecords, chunkSize) {
|
|
19
|
+
const passThrough = new stream_1.PassThrough();
|
|
20
|
+
const csvStream = (0, fast_csv_1.format)({ headers: true });
|
|
21
|
+
csvStream.pipe(passThrough);
|
|
22
|
+
let chunkIndex = 0;
|
|
23
|
+
try {
|
|
24
|
+
while (true) {
|
|
25
|
+
const records = await getDataRecords(chunkIndex, chunkSize);
|
|
26
|
+
if (records.length === 0)
|
|
27
|
+
break;
|
|
28
|
+
for (const record of records) {
|
|
29
|
+
csvStream.write(record);
|
|
30
|
+
}
|
|
31
|
+
chunkIndex++;
|
|
32
|
+
this.logger.debug(`✅ Chunk ${chunkIndex} written to CSV`);
|
|
33
|
+
}
|
|
34
|
+
csvStream.end();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.logger.error(`❌ Error writing CSV: ${error.message}`);
|
|
38
|
+
passThrough.destroy(error);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
return passThrough;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.CsvService = CsvService;
|
|
45
|
+
exports.CsvService = CsvService = CsvService_1 = __decorate([
|
|
46
|
+
(0, common_1.Injectable)()
|
|
47
|
+
], CsvService);
|
|
48
|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;QACd,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAA;AAnCY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAmCtB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Readable } from 'stream';
|
|
2
|
+
export declare class ExcelService {
|
|
3
|
+
private logger;
|
|
4
|
+
createExcelStream(getDataRecords: (chunkIndex: number, chunkSize: number) => Promise<any[]>, chunkSize: number): Promise<Readable>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=excel.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel.service.d.ts","sourceRoot":"","sources":["../../src/services/excel.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAG/C,qBACa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAiC;IAsDlC,iBAAiB,CAC5B,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,EACzE,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC;CAwCrB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var ExcelService_1;
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ExcelService = void 0;
|
|
44
|
+
const common_1 = require("@nestjs/common");
|
|
45
|
+
const ExcelJS = __importStar(require("exceljs"));
|
|
46
|
+
const stream_1 = require("stream");
|
|
47
|
+
let ExcelService = ExcelService_1 = class ExcelService {
|
|
48
|
+
constructor() {
|
|
49
|
+
this.logger = new common_1.Logger(ExcelService_1.name);
|
|
50
|
+
}
|
|
51
|
+
async createExcelStream(getDataRecords, chunkSize) {
|
|
52
|
+
const passThrough = new stream_1.PassThrough();
|
|
53
|
+
try {
|
|
54
|
+
const workbook = new ExcelJS.stream.xlsx.WorkbookWriter({ stream: passThrough });
|
|
55
|
+
const worksheet = workbook.addWorksheet('Data');
|
|
56
|
+
let chunkIndex = 0;
|
|
57
|
+
let isHeaderWritten = false;
|
|
58
|
+
while (true) {
|
|
59
|
+
const records = await getDataRecords(chunkIndex, chunkSize);
|
|
60
|
+
if (records.length === 0)
|
|
61
|
+
break;
|
|
62
|
+
if (!isHeaderWritten) {
|
|
63
|
+
worksheet.columns = Object.keys(records[0]).map((key) => ({
|
|
64
|
+
header: key.toUpperCase(),
|
|
65
|
+
key: key,
|
|
66
|
+
width: 20,
|
|
67
|
+
}));
|
|
68
|
+
isHeaderWritten = true;
|
|
69
|
+
}
|
|
70
|
+
records.forEach((item) => {
|
|
71
|
+
worksheet.addRow(item).commit();
|
|
72
|
+
});
|
|
73
|
+
chunkIndex++;
|
|
74
|
+
this.logger.debug(`✅ Chunk ${chunkIndex} written to Excel`);
|
|
75
|
+
}
|
|
76
|
+
await workbook.commit();
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.logger.error(`❌ Error writing Excel: ${error.message}`);
|
|
80
|
+
passThrough.destroy(error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
return passThrough;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.ExcelService = ExcelService;
|
|
87
|
+
exports.ExcelService = ExcelService = ExcelService_1 = __decorate([
|
|
88
|
+
(0, common_1.Injectable)()
|
|
89
|
+
], ExcelService);
|
|
90
|
+
//# sourceMappingURL=excel.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel.service.js","sourceRoot":"","sources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,CAAC,CAAC,MAAM,EAAE,CAAC;gBAClC,CAAC,CAAC,CAAC;gBAEH,UAAU,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,UAAU,mBAAmB,CAAC,CAAC;YAC9D,CAAC;YAED,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC;QAE1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7D,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3B,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CAEF,CAAA;AAlGY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAkGxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DiscoveryService, ModuleRef } from "@nestjs/core";
|
|
2
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import { CrudHelperService } from 'src/services/crud-helper.service';
|
|
5
|
+
import { CRUDService } from 'src/services/crud.service';
|
|
6
|
+
import { FileService } from 'src/services/file.service';
|
|
7
|
+
import { ModelMetadataService } from 'src/services/model-metadata.service';
|
|
8
|
+
import { ModuleMetadataService } from 'src/services/module-metadata.service';
|
|
9
|
+
import { ExportTransaction } from 'src/entities/export-transaction.entity';
|
|
10
|
+
import { ExportTemplate } from '../entities/export-template.entity';
|
|
11
|
+
import { ExportTransactionFileInfo, ExportTransactionService } from './export-transaction.service';
|
|
12
|
+
export declare class ExportTemplateService extends CRUDService<ExportTemplate> {
|
|
13
|
+
readonly modelMetadataService: ModelMetadataService;
|
|
14
|
+
readonly moduleMetadataService: ModuleMetadataService;
|
|
15
|
+
readonly configService: ConfigService;
|
|
16
|
+
readonly fileService: FileService;
|
|
17
|
+
readonly discoveryService: DiscoveryService;
|
|
18
|
+
readonly crudHelperService: CrudHelperService;
|
|
19
|
+
readonly entityManager: EntityManager;
|
|
20
|
+
readonly repo: Repository<ExportTemplate>;
|
|
21
|
+
readonly exportTransactionService: ExportTransactionService;
|
|
22
|
+
readonly moduleRef: ModuleRef;
|
|
23
|
+
startExportSync(id: number): Promise<ExportTransactionFileInfo>;
|
|
24
|
+
startExportAsync(id: number): Promise<ExportTransaction>;
|
|
25
|
+
constructor(modelMetadataService: ModelMetadataService, moduleMetadataService: ModuleMetadataService, configService: ConfigService, fileService: FileService, discoveryService: DiscoveryService, crudHelperService: CrudHelperService, entityManager: EntityManager, repo: Repository<ExportTemplate>, exportTransactionService: ExportTransactionService, moduleRef: ModuleRef);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=export-template.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-template.service.d.ts","sourceRoot":"","sources":["../../src/services/export-template.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAI7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEnG,qBACa,qBAAsB,SAAQ,WAAW,CAAC,cAAc,CAAC;IAiClE,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB;IACnD,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,aAAa,EAAE,aAAa;IACrC,QAAQ,CAAC,WAAW,EAAE,WAAW;IACjC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IAC3C,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB;IAE7C,QAAQ,CAAC,aAAa,EAAE,aAAa;IAErC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;IACzC,QAAQ,CAAC,wBAAwB,EAAE,wBAAwB;IAC3D,QAAQ,CAAC,SAAS,EAAE,SAAS;IA3CzB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAe/D,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;gBAiBnD,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,EAEpC,aAAa,EAAE,aAAa,EAE5B,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,EAChC,wBAAwB,EAAE,wBAAwB,EAClD,SAAS,EAAE,SAAS;CAIhC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ExportTemplateService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const core_1 = require("@nestjs/core");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const config_1 = require("@nestjs/config");
|
|
21
|
+
const crud_helper_service_1 = require("./crud-helper.service");
|
|
22
|
+
const crud_service_1 = require("./crud.service");
|
|
23
|
+
const file_service_1 = require("./file.service");
|
|
24
|
+
const model_metadata_service_1 = require("./model-metadata.service");
|
|
25
|
+
const module_metadata_service_1 = require("./module-metadata.service");
|
|
26
|
+
const export_template_entity_1 = require("../entities/export-template.entity");
|
|
27
|
+
const export_transaction_service_1 = require("./export-transaction.service");
|
|
28
|
+
let ExportTemplateService = class ExportTemplateService extends crud_service_1.CRUDService {
|
|
29
|
+
async startExportSync(id) {
|
|
30
|
+
const exportTransaction = await this.exportTransactionService.toDto({
|
|
31
|
+
datetime: new Date(),
|
|
32
|
+
status: 'started',
|
|
33
|
+
exportTemplateId: id,
|
|
34
|
+
});
|
|
35
|
+
const exportTransactionEntity = await this.exportTransactionService.create(exportTransaction);
|
|
36
|
+
const exportFileInfo = await this.exportTransactionService.triggerExportSync(exportTransactionEntity.id);
|
|
37
|
+
return exportFileInfo;
|
|
38
|
+
}
|
|
39
|
+
async startExportAsync(id) {
|
|
40
|
+
const exportTransaction = await this.exportTransactionService.toDto({
|
|
41
|
+
datetime: new Date(),
|
|
42
|
+
status: 'started',
|
|
43
|
+
exportTemplateId: id,
|
|
44
|
+
});
|
|
45
|
+
const exportTransactionEntity = await this.exportTransactionService.create(exportTransaction);
|
|
46
|
+
this.exportTransactionService.triggerExportAsync(exportTransactionEntity.id);
|
|
47
|
+
return exportTransactionEntity;
|
|
48
|
+
}
|
|
49
|
+
constructor(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, exportTransactionService, moduleRef) {
|
|
50
|
+
super(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, 'exportTemplate', 'solid-core', moduleRef);
|
|
51
|
+
this.modelMetadataService = modelMetadataService;
|
|
52
|
+
this.moduleMetadataService = moduleMetadataService;
|
|
53
|
+
this.configService = configService;
|
|
54
|
+
this.fileService = fileService;
|
|
55
|
+
this.discoveryService = discoveryService;
|
|
56
|
+
this.crudHelperService = crudHelperService;
|
|
57
|
+
this.entityManager = entityManager;
|
|
58
|
+
this.repo = repo;
|
|
59
|
+
this.exportTransactionService = exportTransactionService;
|
|
60
|
+
this.moduleRef = moduleRef;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.ExportTemplateService = ExportTemplateService;
|
|
64
|
+
exports.ExportTemplateService = ExportTemplateService = __decorate([
|
|
65
|
+
(0, common_1.Injectable)(),
|
|
66
|
+
__param(6, (0, typeorm_1.InjectEntityManager)()),
|
|
67
|
+
__param(7, (0, typeorm_1.InjectRepository)(export_template_entity_1.ExportTemplate, 'default')),
|
|
68
|
+
__metadata("design:paramtypes", [model_metadata_service_1.ModelMetadataService,
|
|
69
|
+
module_metadata_service_1.ModuleMetadataService,
|
|
70
|
+
config_1.ConfigService,
|
|
71
|
+
file_service_1.FileService,
|
|
72
|
+
core_1.DiscoveryService,
|
|
73
|
+
crud_helper_service_1.CrudHelperService,
|
|
74
|
+
typeorm_2.EntityManager,
|
|
75
|
+
typeorm_2.Repository,
|
|
76
|
+
export_transaction_service_1.ExportTransactionService,
|
|
77
|
+
core_1.ModuleRef])
|
|
78
|
+
], ExportTemplateService);
|
|
79
|
+
//# sourceMappingURL=export-template.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-template.service.js","sourceRoot":"","sources":["../../src/services/export-template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAA2D;AAC3D,6CAAwE;AACxE,qCAAoD;AAEpD,2CAA+C;AAC/C,+DAAqE;AACrE,iDAAwD;AACxD,iDAAwD;AAGxD,qEAA2E;AAC3E,uEAA6E;AAM7E,+EAAoE;AACpE,6EAAmG;AAG5F,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,0BAA2B;IACpE,KAAK,CAAC,eAAe,CAAC,EAAU;QAE9B,MAAM,iBAAiB,GAAgC,MAAM,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC;YAC/F,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,EAAE;SACrB,CAAC,CAAC;QACH,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAG9F,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;QAEzG,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAU;QAE/B,MAAM,iBAAiB,GAAgC,MAAM,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC;YAC/F,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,EAAE;SACrB,CAAC,CAAC;QACH,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAAC,wBAAwB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from "@nestjs/core";
|
|
2
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import { CrudHelperService } from 'src/services/crud-helper.service';
|
|
5
|
+
import { CRUDService } from 'src/services/crud.service';
|
|
6
|
+
import { FileService } from 'src/services/file.service';
|
|
7
|
+
import { ModelMetadataService } from 'src/services/model-metadata.service';
|
|
8
|
+
import { ModuleMetadataService } from 'src/services/module-metadata.service';
|
|
9
|
+
import { CreateExportTransactionDto } from 'src/dtos/create-export-transaction.dto';
|
|
10
|
+
import { FieldMetadata } from 'src/entities/field-metadata.entity';
|
|
11
|
+
import { Readable } from 'stream';
|
|
12
|
+
import { ExportTransaction } from '../entities/export-transaction.entity';
|
|
13
|
+
import { CsvService } from './csv.service';
|
|
14
|
+
import { ExcelService } from './excel.service';
|
|
15
|
+
import { SolidIntrospectService } from './solid-introspect.service';
|
|
16
|
+
export interface ExportTransactionFileInfo {
|
|
17
|
+
exportStream: Readable;
|
|
18
|
+
fileName: string;
|
|
19
|
+
mimeType: string;
|
|
20
|
+
exportTransaction: ExportTransaction;
|
|
21
|
+
}
|
|
22
|
+
export declare class ExportTransactionService extends CRUDService<ExportTransaction> {
|
|
23
|
+
readonly modelMetadataService: ModelMetadataService;
|
|
24
|
+
readonly moduleMetadataService: ModuleMetadataService;
|
|
25
|
+
readonly configService: ConfigService;
|
|
26
|
+
readonly fileService: FileService;
|
|
27
|
+
readonly discoveryService: DiscoveryService;
|
|
28
|
+
readonly crudHelperService: CrudHelperService;
|
|
29
|
+
readonly entityManager: EntityManager;
|
|
30
|
+
readonly repo: Repository<ExportTransaction>;
|
|
31
|
+
readonly introspectService: SolidIntrospectService;
|
|
32
|
+
readonly excelService: ExcelService;
|
|
33
|
+
readonly csvService: CsvService;
|
|
34
|
+
readonly fieldRepo: Repository<FieldMetadata>;
|
|
35
|
+
readonly moduleRef: ModuleRef;
|
|
36
|
+
private logger;
|
|
37
|
+
constructor(modelMetadataService: ModelMetadataService, moduleMetadataService: ModuleMetadataService, configService: ConfigService, fileService: FileService, discoveryService: DiscoveryService, crudHelperService: CrudHelperService, entityManager: EntityManager, repo: Repository<ExportTransaction>, introspectService: SolidIntrospectService, excelService: ExcelService, csvService: CsvService, fieldRepo: Repository<FieldMetadata>, moduleRef: ModuleRef);
|
|
38
|
+
triggerExportSync(id: number): Promise<ExportTransactionFileInfo>;
|
|
39
|
+
triggerExportAsync(id: number): Promise<void>;
|
|
40
|
+
private loadExportTransaction;
|
|
41
|
+
private updateExportTransaction;
|
|
42
|
+
private getExportStreamDetails;
|
|
43
|
+
private getExportStream;
|
|
44
|
+
private storeExportStream;
|
|
45
|
+
private getFileName;
|
|
46
|
+
private getMimeType;
|
|
47
|
+
private getDataRecordsFunc;
|
|
48
|
+
toDto(data: Partial<CreateExportTransactionDto>): Promise<CreateExportTransactionDto>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=export-transaction.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-transaction.service.d.ts","sourceRoot":"","sources":["../../src/services/export-transaction.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAO7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,aAAa,E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