@servicelabsco/nestjs-utility-services 2.0.5 → 2.0.7
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/CLAUDE.md +96 -0
- package/CODEBASE-REVIEW.md +227 -0
- package/CODEBASE_REFERENCE.md +568 -0
- package/dist/app.controller.d.ts +3 -4
- package/dist/app.controller.js +7 -23
- package/dist/app.controller.js.map +1 -1
- package/dist/app.module.js +37 -4
- package/dist/app.module.js.map +1 -1
- package/dist/auth/auth.module.js +4 -1
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/controllers/admin.auth.controller.js +6 -1
- package/dist/auth/controllers/admin.auth.controller.js.map +1 -1
- package/dist/auth/middlewares/client.connect.middleware.js +0 -2
- package/dist/auth/middlewares/client.connect.middleware.js.map +1 -1
- package/dist/auth/middlewares/internal.middleware.d.ts +1 -0
- package/dist/auth/middlewares/internal.middleware.js +43 -1
- package/dist/auth/middlewares/internal.middleware.js.map +1 -1
- package/dist/auth/middlewares/jwt.middleware.js +1 -1
- package/dist/auth/middlewares/jwt.middleware.js.map +1 -1
- package/dist/auth/services/auth.service.js +1 -1
- package/dist/auth/services/auth.service.js.map +1 -1
- package/dist/auth/services/refresh.token.service.js +35 -1
- package/dist/auth/services/refresh.token.service.js.map +1 -1
- package/dist/auth/services/user.service.d.ts +6 -0
- package/dist/auth/services/user.service.js +41 -2
- package/dist/auth/services/user.service.js.map +1 -1
- package/dist/common/dtos/capture.record.index.dto.js.map +1 -1
- package/dist/common/dtos/index.params.dto.js.map +1 -1
- package/dist/common/dtos/record.data.manager.dto.d.ts +2 -2
- package/dist/common/dtos/report.data.manager.dto.d.ts +2 -2
- package/dist/common/es6.classes.js +10 -1
- package/dist/common/es6.classes.js.map +1 -1
- package/dist/common/exceptions/index.d.ts +1 -0
- package/dist/common/exceptions/index.js +1 -0
- package/dist/common/exceptions/index.js.map +1 -1
- package/dist/common/exceptions/too.many.attempts.exception.d.ts +4 -0
- package/dist/common/exceptions/too.many.attempts.exception.js +11 -0
- package/dist/common/exceptions/too.many.attempts.exception.js.map +1 -0
- package/dist/common/libraries/auth.js +34 -1
- package/dist/common/libraries/auth.js.map +1 -1
- package/dist/common/libraries/custom.crypt.js +34 -1
- package/dist/common/libraries/custom.crypt.js.map +1 -1
- package/dist/common/libraries/custom.logger.d.ts +1 -6
- package/dist/common/libraries/custom.logger.js +12 -34
- package/dist/common/libraries/custom.logger.js.map +1 -1
- package/dist/common/libraries/generic.index.parser.js +8 -2
- package/dist/common/libraries/generic.index.parser.js.map +1 -1
- package/dist/common/libraries/hash.d.ts +2 -2
- package/dist/common/libraries/hash.js +52 -10
- package/dist/common/libraries/hash.js.map +1 -1
- package/dist/common/libraries/index.d.ts +1 -0
- package/dist/common/libraries/index.js +1 -0
- package/dist/common/libraries/index.js.map +1 -1
- package/dist/common/libraries/list.manager.js +6 -1
- package/dist/common/libraries/list.manager.js.map +1 -1
- package/dist/common/libraries/platform.utility.d.ts +1 -0
- package/dist/common/libraries/platform.utility.js +17 -2
- package/dist/common/libraries/platform.utility.js.map +1 -1
- package/dist/common/libraries/record.manager.d.ts +2 -2
- package/dist/common/libraries/record.manager.js +4 -1
- package/dist/common/libraries/record.manager.js.map +1 -1
- package/dist/common/libraries/report.list.manager.js +6 -1
- package/dist/common/libraries/report.list.manager.js.map +1 -1
- package/dist/common/libraries/sql.safety.d.ts +5 -0
- package/dist/common/libraries/sql.safety.js +72 -0
- package/dist/common/libraries/sql.safety.js.map +1 -0
- package/dist/config/cors.config.d.ts +1 -1
- package/dist/config/cors.config.js +11 -2
- package/dist/config/cors.config.js.map +1 -1
- package/dist/config/rate.limiter.config.d.ts +2 -0
- package/dist/config/rate.limiter.config.js +2 -0
- package/dist/config/rate.limiter.config.js.map +1 -1
- package/dist/config/read.typeorm.config.js +34 -1
- package/dist/config/read.typeorm.config.js.map +1 -1
- package/dist/config/typeorm.config.js +34 -1
- package/dist/config/typeorm.config.js.map +1 -1
- package/dist/main.js +61 -10
- package/dist/main.js.map +1 -1
- package/dist/migrations/1619296224563-AddMasterSeedersDataSeederTable.js +35 -2
- package/dist/migrations/1619296224563-AddMasterSeedersDataSeederTable.js.map +1 -1
- package/dist/migrations/1778754675764-AlterColumnValueTypeSysPropertiesTable.d.ts +5 -0
- package/dist/migrations/1778754675764-AlterColumnValueTypeSysPropertiesTable.js +13 -0
- package/dist/migrations/1778754675764-AlterColumnValueTypeSysPropertiesTable.js.map +1 -0
- package/dist/platformUtility/consumers/job.consumer.js +4 -1
- package/dist/platformUtility/consumers/job.consumer.js.map +1 -1
- package/dist/platformUtility/dtos/index.d.ts +1 -0
- package/dist/platformUtility/dtos/index.js +1 -0
- package/dist/platformUtility/dtos/index.js.map +1 -1
- package/dist/platformUtility/dtos/r2.config.dto.d.ts +7 -0
- package/dist/platformUtility/dtos/r2.config.dto.js +7 -0
- package/dist/platformUtility/dtos/r2.config.dto.js.map +1 -0
- package/dist/platformUtility/dtos/set.sms.payload.dto.d.ts +1 -1
- package/dist/platformUtility/dtos/set.sms.payload.dto.js.map +1 -1
- package/dist/platformUtility/es6.classes.d.ts +4 -2
- package/dist/platformUtility/es6.classes.js +4 -0
- package/dist/platformUtility/es6.classes.js.map +1 -1
- package/dist/platformUtility/jobs/process.tracking.webhook.job.js +1 -1
- package/dist/platformUtility/jobs/process.tracking.webhook.job.js.map +1 -1
- package/dist/platformUtility/libraries/common.sqs.polling.js +34 -1
- package/dist/platformUtility/libraries/common.sqs.polling.js.map +1 -1
- package/dist/platformUtility/libraries/create.entity.constants.file.js +34 -1
- package/dist/platformUtility/libraries/create.entity.constants.file.js.map +1 -1
- package/dist/platformUtility/libraries/create.es6.classes.file.js +34 -1
- package/dist/platformUtility/libraries/create.es6.classes.file.js.map +1 -1
- package/dist/platformUtility/libraries/create.es6.jobs.file.js +34 -1
- package/dist/platformUtility/libraries/create.es6.jobs.file.js.map +1 -1
- package/dist/platformUtility/libraries/create.es6.service.file.js +34 -1
- package/dist/platformUtility/libraries/create.es6.service.file.js.map +1 -1
- package/dist/platformUtility/libraries/create.index.file.js +34 -1
- package/dist/platformUtility/libraries/create.index.file.js.map +1 -1
- package/dist/platformUtility/libraries/file.system.utility.js +34 -1
- package/dist/platformUtility/libraries/file.system.utility.js.map +1 -1
- package/dist/platformUtility/libraries/process.common.mail.js +4 -1
- package/dist/platformUtility/libraries/process.common.mail.js.map +1 -1
- package/dist/platformUtility/libraries/process.kaleyra.sms.js +34 -1
- package/dist/platformUtility/libraries/process.kaleyra.sms.js.map +1 -1
- package/dist/platformUtility/libraries/process.ses.raw.mail.js +18 -12
- package/dist/platformUtility/libraries/process.ses.raw.mail.js.map +1 -1
- package/dist/platformUtility/libraries/process.smtp.mail.js +36 -3
- package/dist/platformUtility/libraries/process.smtp.mail.js.map +1 -1
- package/dist/platformUtility/platform.utility.module.js +4 -1
- package/dist/platformUtility/platform.utility.module.js.map +1 -1
- package/dist/platformUtility/services/index.d.ts +1 -0
- package/dist/platformUtility/services/index.js +1 -0
- package/dist/platformUtility/services/index.js.map +1 -1
- package/dist/platformUtility/services/local.property.service.js +4 -1
- package/dist/platformUtility/services/local.property.service.js.map +1 -1
- package/dist/platformUtility/services/mail.service.js +1 -1
- package/dist/platformUtility/services/mail.service.js.map +1 -1
- package/dist/platformUtility/services/maintenance.service.js +35 -2
- package/dist/platformUtility/services/maintenance.service.js.map +1 -1
- package/dist/platformUtility/services/r2.config.service.d.ts +11 -0
- package/dist/platformUtility/services/r2.config.service.js +51 -0
- package/dist/platformUtility/services/r2.config.service.js.map +1 -0
- package/dist/platformUtility/services/redis.service.js +4 -1
- package/dist/platformUtility/services/redis.service.js.map +1 -1
- package/dist/platformUtility/services/remote.request.service.js +4 -1
- package/dist/platformUtility/services/remote.request.service.js.map +1 -1
- package/dist/platformUtility/services/s3.service.js +34 -1
- package/dist/platformUtility/services/s3.service.js.map +1 -1
- package/dist/platformUtility/services/ses.mail.notification.service.js +1 -1
- package/dist/platformUtility/services/ses.mail.notification.service.js.map +1 -1
- package/dist/platformUtility/services/sql.service.d.ts +4 -0
- package/dist/platformUtility/services/sql.service.js +88 -27
- package/dist/platformUtility/services/sql.service.js.map +1 -1
- package/dist/platformUtility/services/zip.service.d.ts +3 -1
- package/dist/platformUtility/services/zip.service.js +3 -3
- package/dist/platformUtility/services/zip.service.js.map +1 -1
- package/dist/security/security.module.js +4 -1
- package/dist/security/security.module.js.map +1 -1
- package/dist/system/constants/index.d.ts +1 -0
- package/dist/system/constants/index.js +18 -0
- package/dist/system/constants/index.js.map +1 -0
- package/dist/system/constants/storage.constants.d.ts +3 -0
- package/dist/system/constants/storage.constants.js +7 -0
- package/dist/system/constants/storage.constants.js.map +1 -0
- package/dist/system/controllers/upload.controller.d.ts +0 -1
- package/dist/system/controllers/upload.controller.js +6 -12
- package/dist/system/controllers/upload.controller.js.map +1 -1
- package/dist/system/dtos/engine.feature.support.dto.d.ts +8 -0
- package/dist/system/dtos/engine.feature.support.dto.js +3 -0
- package/dist/system/dtos/engine.feature.support.dto.js.map +1 -0
- package/dist/system/dtos/index.d.ts +3 -0
- package/dist/system/dtos/index.js +3 -0
- package/dist/system/dtos/index.js.map +1 -1
- package/dist/system/dtos/s3.upload.options.dto.d.ts +2 -7
- package/dist/system/dtos/s3.upload.options.dto.js +2 -43
- package/dist/system/dtos/s3.upload.options.dto.js.map +1 -1
- package/dist/system/dtos/storage.ref.dto.d.ts +37 -0
- package/dist/system/dtos/storage.ref.dto.js +3 -0
- package/dist/system/dtos/storage.ref.dto.js.map +1 -0
- package/dist/system/dtos/storage.upload.options.dto.d.ts +22 -0
- package/dist/system/dtos/storage.upload.options.dto.js +113 -0
- package/dist/system/dtos/storage.upload.options.dto.js.map +1 -0
- package/dist/system/es6.classes.d.ts +4 -2
- package/dist/system/es6.classes.js +4 -0
- package/dist/system/es6.classes.js.map +1 -1
- package/dist/system/index.d.ts +1 -0
- package/dist/system/index.js +1 -0
- package/dist/system/index.js.map +1 -1
- package/dist/system/interceptors/sentry.interceptor.js +34 -1
- package/dist/system/interceptors/sentry.interceptor.js.map +1 -1
- package/dist/system/jobs/sqs.polling.job.js +4 -1
- package/dist/system/jobs/sqs.polling.job.js.map +1 -1
- package/dist/system/jobs/sync.all.code.job.js +4 -1
- package/dist/system/jobs/sync.all.code.job.js.map +1 -1
- package/dist/system/libraries/business.rule.filter.validator.js +1 -1
- package/dist/system/libraries/business.rule.filter.validator.js.map +1 -1
- package/dist/system/libraries/business.rule.query.evaluator.js +1 -1
- package/dist/system/libraries/business.rule.query.evaluator.js.map +1 -1
- package/dist/system/libraries/column.manager.d.ts +1 -1
- package/dist/system/libraries/column.manager.js.map +1 -1
- package/dist/system/libraries/common.storage.service.d.ts +26 -2
- package/dist/system/libraries/common.storage.service.js +88 -1
- package/dist/system/libraries/common.storage.service.js.map +1 -1
- package/dist/system/libraries/execute.code.fix.js +1 -1
- package/dist/system/libraries/execute.code.fix.js.map +1 -1
- package/dist/system/libraries/file.type.detector.d.ts +7 -0
- package/dist/system/libraries/file.type.detector.js +113 -0
- package/dist/system/libraries/file.type.detector.js.map +1 -0
- package/dist/system/libraries/generate.downloadable.report.file.js +36 -3
- package/dist/system/libraries/generate.downloadable.report.file.js.map +1 -1
- package/dist/system/libraries/get.report.query.d.ts +1 -0
- package/dist/system/libraries/get.report.query.js +28 -6
- package/dist/system/libraries/get.report.query.js.map +1 -1
- package/dist/system/libraries/index.d.ts +1 -0
- package/dist/system/libraries/index.js +1 -0
- package/dist/system/libraries/index.js.map +1 -1
- package/dist/system/libraries/model.sync.js +4 -1
- package/dist/system/libraries/model.sync.js.map +1 -1
- package/dist/system/libraries/security.rule.evaluator.js +1 -1
- package/dist/system/libraries/security.rule.evaluator.js.map +1 -1
- package/dist/system/services/aws.s3.service.d.ts +16 -1
- package/dist/system/services/aws.s3.service.js +56 -2
- package/dist/system/services/aws.s3.service.js.map +1 -1
- package/dist/system/services/base.service.js +4 -1
- package/dist/system/services/base.service.js.map +1 -1
- package/dist/system/services/client.credential.service.js +0 -2
- package/dist/system/services/client.credential.service.js.map +1 -1
- package/dist/system/services/cloudflare.r2.service.d.ts +22 -8
- package/dist/system/services/cloudflare.r2.service.js +76 -38
- package/dist/system/services/cloudflare.r2.service.js.map +1 -1
- package/dist/system/services/document.service.js +38 -2
- package/dist/system/services/document.service.js.map +1 -1
- package/dist/system/services/event.detail.service.js +4 -1
- package/dist/system/services/event.detail.service.js.map +1 -1
- package/dist/system/services/index.d.ts +1 -0
- package/dist/system/services/index.js +1 -0
- package/dist/system/services/index.js.map +1 -1
- package/dist/system/services/internal.server.connect.service.d.ts +1 -1
- package/dist/system/services/list.service.d.ts +2 -2
- package/dist/system/services/storage.service.d.ts +65 -0
- package/dist/system/services/storage.service.js +342 -0
- package/dist/system/services/storage.service.js.map +1 -0
- package/dist/system/services/upload.service.d.ts +6 -22
- package/dist/system/services/upload.service.js +71 -243
- package/dist/system/services/upload.service.js.map +1 -1
- package/dist/system/services/user.preference.service.js.map +1 -1
- package/dist/system/subscribers/code.fix.script.subscriber.d.ts +1 -0
- package/dist/system/subscribers/code.fix.script.subscriber.js +10 -1
- package/dist/system/subscribers/code.fix.script.subscriber.js.map +1 -1
- package/dist/system/subscribers/material.view.subscriber.d.ts +1 -0
- package/dist/system/subscribers/material.view.subscriber.js +9 -0
- package/dist/system/subscribers/material.view.subscriber.js.map +1 -1
- package/dist/system/subscribers/recurring.query.subscriber.d.ts +1 -0
- package/dist/system/subscribers/recurring.query.subscriber.js +9 -0
- package/dist/system/subscribers/recurring.query.subscriber.js.map +1 -1
- package/dist/system/subscribers/scheduled.event.subscriber.d.ts +1 -0
- package/dist/system/subscribers/scheduled.event.subscriber.js +9 -0
- package/dist/system/subscribers/scheduled.event.subscriber.js.map +1 -1
- package/dist/system/system.module.js +18 -3
- package/dist/system/system.module.js.map +1 -1
- package/package.json +9 -13
|
@@ -1,70 +1,134 @@
|
|
|
1
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
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
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;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
})();
|
|
8
41
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
42
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
43
|
};
|
|
11
44
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
45
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
46
|
};
|
|
47
|
+
var SqlService_1;
|
|
14
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
49
|
exports.SqlService = void 0;
|
|
16
50
|
require("dotenv/config");
|
|
17
51
|
const common_1 = require("@nestjs/common");
|
|
18
52
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
-
const Sentry = require("@sentry/node");
|
|
53
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
20
54
|
const class_transformer_1 = require("class-transformer");
|
|
21
55
|
const typeorm_2 = require("typeorm");
|
|
22
56
|
const operation_exception_1 = require("../../common/exceptions/operation.exception");
|
|
23
57
|
const common_service_1 = require("../../common/libraries/common.service");
|
|
58
|
+
const sql_safety_1 = require("../../common/libraries/sql.safety");
|
|
24
59
|
const sqlLogEnabled = process.env.ENABLE_SQL_LOG;
|
|
25
|
-
let SqlService = class SqlService extends common_service_1.CommonService {
|
|
60
|
+
let SqlService = SqlService_1 = class SqlService extends common_service_1.CommonService {
|
|
26
61
|
constructor(connection, readReplica) {
|
|
27
62
|
super();
|
|
28
63
|
this.connection = connection;
|
|
29
64
|
this.readReplica = readReplica;
|
|
30
65
|
this.publicExposed = true;
|
|
31
66
|
}
|
|
67
|
+
static guardQuery(query, sourceMethod) {
|
|
68
|
+
const matched = (0, sql_safety_1.detectHighConfidenceInjection)(query);
|
|
69
|
+
if (!matched)
|
|
70
|
+
return;
|
|
71
|
+
Sentry.captureMessage(`SqlService injection signature detected: ${matched} via ${sourceMethod}`, {
|
|
72
|
+
level: 'warning',
|
|
73
|
+
extra: { matched, sourceMethod },
|
|
74
|
+
});
|
|
75
|
+
throw new operation_exception_1.OperationException('issue with internal query');
|
|
76
|
+
}
|
|
77
|
+
static logQuery(query) {
|
|
78
|
+
if (!sqlLogEnabled)
|
|
79
|
+
return;
|
|
80
|
+
const truncated = query.length > 500 ? `${query.slice(0, 500)}...[truncated ${query.length - 500} chars]` : query;
|
|
81
|
+
global.console.log('sql-query : ', truncated);
|
|
82
|
+
}
|
|
32
83
|
async sql(query) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
let result;
|
|
84
|
+
SqlService_1.guardQuery(query, 'sql');
|
|
85
|
+
SqlService_1.logQuery(query);
|
|
37
86
|
try {
|
|
38
|
-
|
|
87
|
+
return await this.connection.query(query);
|
|
39
88
|
}
|
|
40
89
|
catch (error) {
|
|
41
|
-
global.console.error('sql-query-
|
|
42
|
-
global.console.log('error', error);
|
|
90
|
+
global.console.error('sql-query-failed (length=' + (query?.length ?? 0) + ')');
|
|
43
91
|
Sentry.captureException(error);
|
|
44
92
|
throw new operation_exception_1.OperationException(`issue with internal query`);
|
|
45
93
|
}
|
|
46
|
-
return result;
|
|
47
94
|
}
|
|
48
95
|
async read(query) {
|
|
49
|
-
|
|
50
|
-
|
|
96
|
+
SqlService_1.guardQuery(query, 'read');
|
|
97
|
+
SqlService_1.logQuery(query);
|
|
98
|
+
try {
|
|
99
|
+
return await this.readReplica.query(query);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
global.console.error('sql-query-failed (length=' + (query?.length ?? 0) + ')');
|
|
103
|
+
Sentry.captureException(error);
|
|
104
|
+
throw new operation_exception_1.OperationException(`issue with internal query`);
|
|
51
105
|
}
|
|
52
|
-
|
|
106
|
+
}
|
|
107
|
+
async boundSql(query, params = []) {
|
|
108
|
+
SqlService_1.guardQuery(query, 'boundSql');
|
|
109
|
+
SqlService_1.logQuery(query);
|
|
53
110
|
try {
|
|
54
|
-
|
|
111
|
+
return await this.connection.query(query, params);
|
|
55
112
|
}
|
|
56
113
|
catch (error) {
|
|
57
|
-
global.console.error('sql-query-
|
|
58
|
-
global.console.log('error', error);
|
|
114
|
+
global.console.error('sql-query-failed (length=' + (query?.length ?? 0) + ')');
|
|
59
115
|
Sentry.captureException(error);
|
|
60
116
|
throw new operation_exception_1.OperationException(`issue with internal query`);
|
|
61
117
|
}
|
|
62
|
-
return result;
|
|
63
118
|
}
|
|
64
|
-
async
|
|
65
|
-
|
|
66
|
-
|
|
119
|
+
async boundRead(query, params = []) {
|
|
120
|
+
SqlService_1.guardQuery(query, 'boundRead');
|
|
121
|
+
SqlService_1.logQuery(query);
|
|
122
|
+
try {
|
|
123
|
+
return await this.readReplica.query(query, params);
|
|
67
124
|
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
global.console.error('sql-query-failed (length=' + (query?.length ?? 0) + ')');
|
|
127
|
+
Sentry.captureException(error);
|
|
128
|
+
throw new operation_exception_1.OperationException(`issue with internal query`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async readFirst(query, column) {
|
|
68
132
|
const record = await this.read(query);
|
|
69
133
|
const data = Array.isArray(record) ? record[0] : null;
|
|
70
134
|
if (!column)
|
|
@@ -72,9 +136,6 @@ let SqlService = class SqlService extends common_service_1.CommonService {
|
|
|
72
136
|
return data?.[column];
|
|
73
137
|
}
|
|
74
138
|
async first(query, column) {
|
|
75
|
-
if (sqlLogEnabled) {
|
|
76
|
-
global.console.log('sql-query : ', query);
|
|
77
|
-
}
|
|
78
139
|
const record = await this.sql(query);
|
|
79
140
|
const data = Array.isArray(record) ? record[0] : null;
|
|
80
141
|
if (!column)
|
|
@@ -97,13 +158,13 @@ let SqlService = class SqlService extends common_service_1.CommonService {
|
|
|
97
158
|
return this.sql(sql);
|
|
98
159
|
}
|
|
99
160
|
async getTableColumns(tableName) {
|
|
100
|
-
const sql = `SELECT a.table_catalog, a.table_schema, a.table_name, a."column_name", a.ordinal_position, a.is_nullable, a.data_type, a.udt_name
|
|
101
|
-
|
|
102
|
-
return this.
|
|
161
|
+
const sql = `SELECT a.table_catalog, a.table_schema, a.table_name, a."column_name", a.ordinal_position, a.is_nullable, a.data_type, a.udt_name
|
|
162
|
+
FROM INFORMATION_SCHEMA.COLUMNS a WHERE table_name = $1`;
|
|
163
|
+
return this.boundSql(sql, [tableName]);
|
|
103
164
|
}
|
|
104
165
|
};
|
|
105
166
|
exports.SqlService = SqlService;
|
|
106
|
-
exports.SqlService = SqlService = __decorate([
|
|
167
|
+
exports.SqlService = SqlService = SqlService_1 = __decorate([
|
|
107
168
|
(0, common_1.Injectable)(),
|
|
108
169
|
__param(0, (0, typeorm_1.InjectDataSource)('default')),
|
|
109
170
|
__param(1, (0, typeorm_1.InjectDataSource)('read')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sql.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sql.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sql.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAuB;AAEvB,2CAA4C;AAC5C,6CAAmD;AACnD,qDAAuC;AACvC,yDAAoD;AACpD,qCAAqC;AACrC,qFAAiF;AACjF,0EAAsE;AACtE,kEAAkF;AAElF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAS1C,IAAM,UAAU,kBAAhB,MAAM,UAAW,SAAQ,8BAAa;IAQzC,YAEI,UAAuC,EAGvC,WAAwC;QAExC,KAAK,EAAE,CAAC;QALS,eAAU,GAAV,UAAU,CAAY;QAGtB,gBAAW,GAAX,WAAW,CAAY;QAZlC,kBAAa,GAAG,IAAI,CAAC;IAe/B,CAAC;IAUO,MAAM,CAAC,UAA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AAK,CAAC,IAAI,CAAC,SAAc,EAAE,GAAQ;QAC/B,MAAM,MAAM,GAAQ,IAAA,mCAAe,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAEpD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC;IAClB,CAAC;IASD,KAAK,CAAC,kBAAkB,CAAC,UAAe,EAAE,MAAc,EAAE,SAAiB;QACvE,OAAO,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC;IAC7G,CAAC;IAMD,KAAK,CAAC,YAAY;QACd,MAAM,GAAG,GAAG,4GAA4G,CAAC;QACzH,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IASD,KAAK,CAAC,eAAe,CAAC,SAAiB;QACnC,MAAM,GAAG,GAAG;gFAC4D,CAAC;QACzE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AAvNY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;IAUJ,WAAA,IAAA,0BAAgB,EAAC,SAAS,CAAC,CAAA;IAG3B,WAAA,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAA;qCAFI,oBAAU;QAGT,oBAAU;GAbnC,UAAU,CAuNtB"}
|
|
@@ -9,7 +9,9 @@ export declare class ZipService extends CommonService {
|
|
|
9
9
|
private unzipToken;
|
|
10
10
|
protected publicExposed: boolean;
|
|
11
11
|
constructor(propertyService: PropertyService, remoteRequestService: RemoteRequestService);
|
|
12
|
-
zip(files: LambdaZipDto[]): Promise<
|
|
12
|
+
zip(files: LambdaZipDto[]): Promise<{
|
|
13
|
+
url: any;
|
|
14
|
+
}>;
|
|
13
15
|
unzip(url: string): Promise<string[]>;
|
|
14
16
|
private getZipToken;
|
|
15
17
|
private getUnzipToken;
|
|
@@ -38,9 +38,9 @@ let ZipService = class ZipService extends common_service_1.CommonService {
|
|
|
38
38
|
maxBodyLength: Infinity,
|
|
39
39
|
};
|
|
40
40
|
try {
|
|
41
|
-
const response = await this.remoteRequestService.
|
|
41
|
+
const response = await this.remoteRequestService.getRawResponse(options);
|
|
42
42
|
if (response?.data?.success) {
|
|
43
|
-
return response.data.zipUrl;
|
|
43
|
+
return { url: response.data.zipUrl };
|
|
44
44
|
}
|
|
45
45
|
const apiError = response?.data?.error || 'Failed to create zip file';
|
|
46
46
|
throw new operation_exception_1.OperationException(apiError);
|
|
@@ -67,7 +67,7 @@ let ZipService = class ZipService extends common_service_1.CommonService {
|
|
|
67
67
|
data: { url },
|
|
68
68
|
};
|
|
69
69
|
try {
|
|
70
|
-
const response = await this.remoteRequestService.
|
|
70
|
+
const response = await this.remoteRequestService.getRawResponse(options);
|
|
71
71
|
if (response?.data?.success) {
|
|
72
72
|
return response.data.files || [];
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/zip.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qFAAiF;AACjF,0EAAsE;AACtE,6EAAyE;AACzE,qEAAgE;AAQzD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAa;IAMzC,YACuB,eAAgC,EAChC,oBAA0C;QAE7D,KAAK,EAAE,CAAC;QAHW,oBAAe,GAAf,eAAe,CAAiB;QAChC,yBAAoB,GAApB,oBAAoB,CAAsB;QAJvD,kBAAa,GAAG,IAAI,CAAC;IAO/B,CAAC;IAMD,KAAK,CAAC,GAAG,CAAC,KAAqB;QAC3B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,wCAAkB,C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,mBAAU,GAAE;qCAQ+B,kCAAe;QACV,6CAAoB;GARxD,UAAU,CA0GtB"}
|
|
@@ -5,11 +5,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.SecurityModule = void 0;
|
|
10
13
|
const common_1 = require("@nestjs/common");
|
|
11
14
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
-
const es6_classes_1 = require("./es6.classes");
|
|
15
|
+
const es6_classes_1 = __importDefault(require("./es6.classes"));
|
|
13
16
|
let SecurityModule = class SecurityModule {
|
|
14
17
|
};
|
|
15
18
|
exports.SecurityModule = SecurityModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.module.js","sourceRoot":"","sources":["../../src/security/security.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.module.js","sourceRoot":"","sources":["../../src/security/security.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,gEAAuC;AAKhC,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAH1B,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,qBAAU,CAAC,QAAQ,CAAC,CAAC;KAC3D,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './storage.constants';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./storage.constants"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENGINE_R2 = exports.ENGINE_S3 = exports.STORAGE_ENGINE_ADAPTERS = void 0;
|
|
4
|
+
exports.STORAGE_ENGINE_ADAPTERS = Symbol('STORAGE_ENGINE_ADAPTERS');
|
|
5
|
+
exports.ENGINE_S3 = 's3';
|
|
6
|
+
exports.ENGINE_R2 = 'r2';
|
|
7
|
+
//# sourceMappingURL=storage.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.constants.js","sourceRoot":"","sources":["../../../src/system/constants/storage.constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAM5D,QAAA,SAAS,GAAG,IAAI,CAAC;AACjB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { UploadService } from '../services/upload.service';
|
|
|
2
2
|
export declare class UploadController {
|
|
3
3
|
private uploadService;
|
|
4
4
|
constructor(uploadService: UploadService);
|
|
5
|
-
file(files: any): Promise<any>;
|
|
6
5
|
uploadFile(files: any): Promise<any>;
|
|
7
6
|
private uploadFiles;
|
|
8
7
|
}
|
|
@@ -20,9 +20,6 @@ let UploadController = class UploadController {
|
|
|
20
20
|
constructor(uploadService) {
|
|
21
21
|
this.uploadService = uploadService;
|
|
22
22
|
}
|
|
23
|
-
async file(files) {
|
|
24
|
-
return this.uploadFiles(files);
|
|
25
|
-
}
|
|
26
23
|
async uploadFile(files) {
|
|
27
24
|
return this.uploadFiles(files);
|
|
28
25
|
}
|
|
@@ -36,17 +33,14 @@ let UploadController = class UploadController {
|
|
|
36
33
|
}
|
|
37
34
|
};
|
|
38
35
|
exports.UploadController = UploadController;
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, common_1.Post)('uploads'),
|
|
41
|
-
(0, common_1.UseInterceptors)((0, platform_express_1.AnyFilesInterceptor)()),
|
|
42
|
-
__param(0, (0, common_1.UploadedFiles)()),
|
|
43
|
-
__metadata("design:type", Function),
|
|
44
|
-
__metadata("design:paramtypes", [Object]),
|
|
45
|
-
__metadata("design:returntype", Promise)
|
|
46
|
-
], UploadController.prototype, "file", null);
|
|
47
36
|
__decorate([
|
|
48
37
|
(0, common_1.Post)('api/admin/uploads'),
|
|
49
|
-
(0, common_1.UseInterceptors)((0, platform_express_1.AnyFilesInterceptor)(
|
|
38
|
+
(0, common_1.UseInterceptors)((0, platform_express_1.AnyFilesInterceptor)({
|
|
39
|
+
limits: {
|
|
40
|
+
fileSize: parseInt(process.env.UPLOAD_MAX_FILE_SIZE, 10) || 25 * 1024 * 1024,
|
|
41
|
+
files: parseInt(process.env.UPLOAD_MAX_FILES, 10) || 10,
|
|
42
|
+
},
|
|
43
|
+
})),
|
|
50
44
|
__param(0, (0, common_1.UploadedFiles)()),
|
|
51
45
|
__metadata("design:type", Function),
|
|
52
46
|
__metadata("design:paramtypes", [Object]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.controller.js","sourceRoot":"","sources":["../../../src/system/controllers/upload.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkF;AAClF,+DAA+D;AAC/D,+DAA2D;AASpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAKzB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"upload.controller.js","sourceRoot":"","sources":["../../../src/system/controllers/upload.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkF;AAClF,+DAA+D;AAC/D,+DAA2D;AASpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAKzB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAyB9C,AAAN,KAAK,CAAC,UAAU,CAAkB,KAAK;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAQO,KAAK,CAAC,WAAW,CAAC,KAAK;QAC3B,MAAM,GAAG,GAAG,EAAE,CAAC;QAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AAlDY,4CAAgB;AA8BnB;IATL,IAAA,aAAI,EAAC,mBAAmB,CAAC;IACzB,IAAA,wBAAe,EACZ,IAAA,sCAAmB,EAAC;QAChB,MAAM,EAAE;YACJ,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI;YAC5E,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAI,EAAE;SAC1D;KACJ,CAAC,CACL;IACiB,WAAA,IAAA,sBAAa,GAAE,CAAA;;;;kDAEhC;2BAhCQ,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAM0B,8BAAa;GALvC,gBAAgB,CAkD5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.feature.support.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/engine.feature.support.dto.ts"],"names":[],"mappings":""}
|
|
@@ -9,6 +9,7 @@ export * from './comment.attributes.dto';
|
|
|
9
9
|
export * from './credential.ip.attributes.dto';
|
|
10
10
|
export * from './data.log.attributes.dto';
|
|
11
11
|
export * from './document.attributes.dto';
|
|
12
|
+
export * from './engine.feature.support.dto';
|
|
12
13
|
export * from './event.log.attributes.dto';
|
|
13
14
|
export * from './executable.script.attributes.dto';
|
|
14
15
|
export * from './executable.script.payload.dto';
|
|
@@ -30,6 +31,8 @@ export * from './report.sheet.attributes.dto';
|
|
|
30
31
|
export * from './s3.object.info.dto';
|
|
31
32
|
export * from './s3.upload.options.dto';
|
|
32
33
|
export * from './sms.message.attributes.dto';
|
|
34
|
+
export * from './storage.ref.dto';
|
|
35
|
+
export * from './storage.upload.options.dto';
|
|
33
36
|
export * from './system.log.attributes.dto';
|
|
34
37
|
export * from './user.preference.creation.dto';
|
|
35
38
|
export * from './validation.options.dto';
|
|
@@ -25,6 +25,7 @@ __exportStar(require("./comment.attributes.dto"), exports);
|
|
|
25
25
|
__exportStar(require("./credential.ip.attributes.dto"), exports);
|
|
26
26
|
__exportStar(require("./data.log.attributes.dto"), exports);
|
|
27
27
|
__exportStar(require("./document.attributes.dto"), exports);
|
|
28
|
+
__exportStar(require("./engine.feature.support.dto"), exports);
|
|
28
29
|
__exportStar(require("./event.log.attributes.dto"), exports);
|
|
29
30
|
__exportStar(require("./executable.script.attributes.dto"), exports);
|
|
30
31
|
__exportStar(require("./executable.script.payload.dto"), exports);
|
|
@@ -46,6 +47,8 @@ __exportStar(require("./report.sheet.attributes.dto"), exports);
|
|
|
46
47
|
__exportStar(require("./s3.object.info.dto"), exports);
|
|
47
48
|
__exportStar(require("./s3.upload.options.dto"), exports);
|
|
48
49
|
__exportStar(require("./sms.message.attributes.dto"), exports);
|
|
50
|
+
__exportStar(require("./storage.ref.dto"), exports);
|
|
51
|
+
__exportStar(require("./storage.upload.options.dto"), exports);
|
|
49
52
|
__exportStar(require("./system.log.attributes.dto"), exports);
|
|
50
53
|
__exportStar(require("./user.preference.creation.dto"), exports);
|
|
51
54
|
__exportStar(require("./validation.options.dto"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAAA,wDAAsC;AAAA,0DAAwC;AAAA,qEAAmD;AAAA,0DAAwC;AAAA,gEAA8C;AAAA,mEAAiD;AAAA,2DAAyC;AAAA,iEAA+C;AAAA,4DAA0C;AAAA,4DAA0C;AAAA,6DAA2C;AAAA,qEAAmD;AAAA,kEAAgD;AAAA,oDAAkC;AAAA,yDAAuC;AAAA,yDAAuC;AAAA,6DAA2C;AAAA,8DAA4C;AAAA,kEAAgD;AAAA,wDAAsC;AAAA,iEAA+C;AAAA,sEAAoD;AAAA,0DAAwC;AAAA,6DAA2C;AAAA,uEAAqD;AAAA,uDAAqC;AAAA,mEAAiD;AAAA,gEAA8C;AAAA,uDAAqC;AAAA,0DAAwC;AAAA,+DAA6C;AAAA,8DAA4C;AAAA,iEAA+C;AAAA,2DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAAA,wDAAsC;AAAA,0DAAwC;AAAA,qEAAmD;AAAA,0DAAwC;AAAA,gEAA8C;AAAA,mEAAiD;AAAA,2DAAyC;AAAA,iEAA+C;AAAA,4DAA0C;AAAA,4DAA0C;AAAA,+DAA6C;AAAA,6DAA2C;AAAA,qEAAmD;AAAA,kEAAgD;AAAA,oDAAkC;AAAA,yDAAuC;AAAA,yDAAuC;AAAA,6DAA2C;AAAA,8DAA4C;AAAA,kEAAgD;AAAA,wDAAsC;AAAA,iEAA+C;AAAA,sEAAoD;AAAA,0DAAwC;AAAA,6DAA2C;AAAA,uEAAqD;AAAA,uDAAqC;AAAA,mEAAiD;AAAA,gEAA8C;AAAA,uDAAqC;AAAA,0DAAwC;AAAA,+DAA6C;AAAA,oDAAkC;AAAA,+DAA6C;AAAA,8DAA4C;AAAA,iEAA+C;AAAA,2DAAwC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
folder?: string;
|
|
4
|
-
file?: string;
|
|
5
|
-
acl?: string;
|
|
6
|
-
mime_type?: string;
|
|
7
|
-
engine?: string;
|
|
1
|
+
import { StorageUploadOptionsDto } from './storage.upload.options.dto';
|
|
2
|
+
export declare class S3UploadOptionsDto extends StorageUploadOptionsDto {
|
|
8
3
|
}
|
|
@@ -1,49 +1,8 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.S3UploadOptionsDto = void 0;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
class S3UploadOptionsDto {
|
|
4
|
+
const storage_upload_options_dto_1 = require("./storage.upload.options.dto");
|
|
5
|
+
class S3UploadOptionsDto extends storage_upload_options_dto_1.StorageUploadOptionsDto {
|
|
16
6
|
}
|
|
17
7
|
exports.S3UploadOptionsDto = S3UploadOptionsDto;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, class_transformer_1.Expose)(),
|
|
20
|
-
(0, class_validator_1.IsOptional)(),
|
|
21
|
-
__metadata("design:type", String)
|
|
22
|
-
], S3UploadOptionsDto.prototype, "bucket", void 0);
|
|
23
|
-
__decorate([
|
|
24
|
-
(0, class_transformer_1.Expose)(),
|
|
25
|
-
(0, class_validator_1.IsOptional)(),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], S3UploadOptionsDto.prototype, "folder", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, class_transformer_1.Expose)(),
|
|
30
|
-
(0, class_validator_1.IsOptional)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], S3UploadOptionsDto.prototype, "file", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, class_transformer_1.Expose)(),
|
|
35
|
-
(0, class_validator_1.IsOptional)(),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], S3UploadOptionsDto.prototype, "acl", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, class_transformer_1.Expose)(),
|
|
40
|
-
(0, class_validator_1.IsOptional)(),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], S3UploadOptionsDto.prototype, "mime_type", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, class_transformer_1.Expose)(),
|
|
45
|
-
(0, class_validator_1.IsOptional)(),
|
|
46
|
-
(0, class_validator_1.IsEnum)(['aws', 'r2']),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], S3UploadOptionsDto.prototype, "engine", void 0);
|
|
49
8
|
//# sourceMappingURL=s3.upload.options.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3.upload.options.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/s3.upload.options.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"s3.upload.options.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/s3.upload.options.dto.ts"],"names":[],"mappings":";;;AAAA,6EAAuE;AAUvE,MAAa,kBAAmB,SAAQ,oDAAuB;CAAG;AAAlE,gDAAkE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ObjectRef {
|
|
2
|
+
bucket?: string;
|
|
3
|
+
key: string;
|
|
4
|
+
engine?: string;
|
|
5
|
+
}
|
|
6
|
+
export type StorageRef = string | ObjectRef;
|
|
7
|
+
export interface MigrationTarget {
|
|
8
|
+
engine: string;
|
|
9
|
+
bucket?: string;
|
|
10
|
+
key?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StorageObject {
|
|
13
|
+
url: string;
|
|
14
|
+
bucket: string;
|
|
15
|
+
key: string;
|
|
16
|
+
etag?: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
contentType?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface StorageObjectMetadata extends StorageObject {
|
|
21
|
+
lastModified?: Date;
|
|
22
|
+
metadata?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export interface BulkDeleteResult {
|
|
25
|
+
identifier: string;
|
|
26
|
+
key: string;
|
|
27
|
+
success: boolean;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ListOptions {
|
|
31
|
+
bucket?: string;
|
|
32
|
+
prefix?: string;
|
|
33
|
+
delimiter?: string;
|
|
34
|
+
maxKeys?: number;
|
|
35
|
+
continuationToken?: string;
|
|
36
|
+
engine?: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.ref.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/storage.ref.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class StorageSseOptions {
|
|
2
|
+
algorithm: 'AES256' | 'aws:kms';
|
|
3
|
+
kmsKeyId?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class StorageUploadOptionsDto {
|
|
6
|
+
bucket?: string;
|
|
7
|
+
folder?: string;
|
|
8
|
+
file?: string;
|
|
9
|
+
visibility?: 'public' | 'private';
|
|
10
|
+
contentType?: string;
|
|
11
|
+
contentDisposition?: string;
|
|
12
|
+
cacheControl?: string;
|
|
13
|
+
mime_type?: string;
|
|
14
|
+
acl?: string;
|
|
15
|
+
metadata?: Record<string, string>;
|
|
16
|
+
tags?: Record<string, string>;
|
|
17
|
+
sse?: StorageSseOptions;
|
|
18
|
+
storageClass?: string;
|
|
19
|
+
partSize?: number;
|
|
20
|
+
concurrency?: number;
|
|
21
|
+
engine?: string;
|
|
22
|
+
}
|