@things-factory/operato-hub 6.0.0 → 6.0.3
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-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +46 -46
- package/dist-server/entities/email-attachment.js +0 -77
- package/dist-server/entities/email-attachment.js.map +0 -1
- package/dist-server/entities/email-recipient.js +0 -69
- package/dist-server/entities/email-recipient.js.map +0 -1
- package/dist-server/entities/email.js +0 -90
- package/dist-server/entities/email.js.map +0 -1
- package/dist-server/graphql/resolvers/email/index.js +0 -6
- package/dist-server/graphql/resolvers/email/index.js.map +0 -1
- package/dist-server/graphql/resolvers/email/send-emails.js +0 -197
- package/dist-server/graphql/resolvers/email/send-emails.js.map +0 -1
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +0 -200
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +0 -1
- package/dist-server/graphql/resolvers/reports/index.js +0 -7
- package/dist-server/graphql/resolvers/reports/index.js.map +0 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +0 -231
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +0 -1
- package/dist-server/graphql/types/reports/inbound-order-details-report-list.js +0 -14
- package/dist-server/graphql/types/reports/inbound-order-details-report-list.js.map +0 -1
- package/dist-server/graphql/types/reports/inbound-order-details-report.js +0 -59
- package/dist-server/graphql/types/reports/inbound-order-details-report.js.map +0 -1
- package/dist-server/graphql/types/reports/index.js +0 -13
- package/dist-server/graphql/types/reports/index.js.map +0 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report-list.js +0 -14
- package/dist-server/graphql/types/reports/outbound-order-details-report-list.js.map +0 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +0 -76
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/add-contact-points.js +0 -105
- package/dist-server/routers/api/restful-apis/v1/company/add-contact-points.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/add-marketplace-order.js +0 -197
- package/dist-server/routers/api/restful-apis/v1/company/add-marketplace-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/add-products.js +0 -79
- package/dist-server/routers/api/restful-apis/v1/company/add-products.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/cancel-marketplace-order.js +0 -90
- package/dist-server/routers/api/restful-apis/v1/company/cancel-marketplace-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-bizplace-list.js +0 -49
- package/dist-server/routers/api/restful-apis/v1/company/get-bizplace-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-contact-point-list.js +0 -62
- package/dist-server/routers/api/restful-apis/v1/company/get-contact-point-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-order-shipping-list.js +0 -98
- package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-order-shipping-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-store-list.js +0 -51
- package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-store-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-partner-list.js +0 -88
- package/dist-server/routers/api/restful-apis/v1/company/get-partner-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/get-product-list.js +0 -99
- package/dist-server/routers/api/restful-apis/v1/company/get-product-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/index.js +0 -15
- package/dist-server/routers/api/restful-apis/v1/company/index.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-order-delivered.js +0 -62
- package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-order-delivered.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-shipping-order.js +0 -40
- package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-shipping-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/business-middleware.js +0 -70
- package/dist-server/routers/api/restful-apis/v1/middlewares/business-middleware.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/index.js +0 -40
- package/dist-server/routers/api/restful-apis/v1/middlewares/index.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/logging-middleware.js +0 -23
- package/dist-server/routers/api/restful-apis/v1/middlewares/logging-middleware.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/store-middleware.js +0 -32
- package/dist-server/routers/api/restful-apis/v1/middlewares/store-middleware.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/validation-middleware.js +0 -118
- package/dist-server/routers/api/restful-apis/v1/middlewares/validation-middleware.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/middlewares/warehouse-middleware.js +0 -31
- package/dist-server/routers/api/restful-apis/v1/middlewares/warehouse-middleware.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/utils/error-util.js +0 -71
- package/dist-server/routers/api/restful-apis/v1/utils/error-util.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/utils/params.js +0 -563
- package/dist-server/routers/api/restful-apis/v1/utils/params.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/utils/validate-util.js +0 -66
- package/dist-server/routers/api/restful-apis/v1/utils/validate-util.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-inbound-order.js +0 -236
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-inbound-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js +0 -801
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-inbound-order.js +0 -199
- package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-inbound-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-release-order.js +0 -192
- package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-release-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-delivery-order-list.js +0 -138
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-delivery-order-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-goods-received-note-list.js +0 -97
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-goods-received-note-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js +0 -81
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-list.js +0 -94
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-product-group-list.js +0 -87
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-product-group-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-onhand-inventory-list.js +0 -87
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-onhand-inventory-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js +0 -96
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js +0 -110
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/index.js +0 -16
- package/dist-server/routers/api/restful-apis/v1/warehouse/index.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/update-release-order-details.js +0 -71
- package/dist-server/routers/api/restful-apis/v1/warehouse/update-release-order-details.js.map +0 -1
- package/dist-server/routers/xilnex-router.js +0 -1104
- package/dist-server/routers/xilnex-router.js.map +0 -1
- package/dist-server/utils/report-query-util.js +0 -42
- package/dist-server/utils/report-query-util.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-hub",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -61,56 +61,56 @@
|
|
|
61
61
|
"@operato/scene-switch": "^1.0.0",
|
|
62
62
|
"@operato/scene-tab": "^1.0.0",
|
|
63
63
|
"@operato/scene-table": "^1.0.0",
|
|
64
|
+
"@operato/scene-visualizer": "^1.0.0",
|
|
64
65
|
"@operato/scene-wheel-sorter": "^1.0.0",
|
|
65
|
-
"@things-factory/api": "^6.0.
|
|
66
|
-
"@things-factory/apptool-ui": "^6.0.
|
|
67
|
-
"@things-factory/attachment-base": "^6.0.
|
|
68
|
-
"@things-factory/auth-base": "^6.0.
|
|
69
|
-
"@things-factory/auth-ui": "^6.0.
|
|
70
|
-
"@things-factory/biz-base": "^6.0.
|
|
71
|
-
"@things-factory/biz-ui": "^6.0.
|
|
72
|
-
"@things-factory/board-service": "^6.0.
|
|
73
|
-
"@things-factory/board-ui": "^6.0.
|
|
74
|
-
"@things-factory/code-ui": "^6.0.
|
|
75
|
-
"@things-factory/component-ui": "^6.0.
|
|
76
|
-
"@things-factory/context-ui": "^6.0.
|
|
77
|
-
"@things-factory/document-template-ui": "^6.0.
|
|
78
|
-
"@things-factory/env": "^6.0.
|
|
79
|
-
"@things-factory/export-ui": "^6.0.
|
|
80
|
-
"@things-factory/export-ui-csv": "^6.0.
|
|
81
|
-
"@things-factory/export-ui-excel": "^6.0.
|
|
82
|
-
"@things-factory/grist-ui": "^6.0.
|
|
83
|
-
"@things-factory/help": "^6.0.
|
|
84
|
-
"@things-factory/i18n-base": "^6.0.
|
|
85
|
-
"@things-factory/import-ui": "^6.0.
|
|
86
|
-
"@things-factory/import-ui-excel": "^6.0.
|
|
87
|
-
"@things-factory/integration-accounting": "^6.0.
|
|
88
|
-
"@things-factory/integration-fulfillment": "^6.0.
|
|
89
|
-
"@things-factory/integration-lmd": "^6.0.
|
|
90
|
-
"@things-factory/integration-marketplace": "^6.0.
|
|
91
|
-
"@things-factory/integration-pos": "^6.0.
|
|
92
|
-
"@things-factory/integration-sellercraft": "^6.0.
|
|
93
|
-
"@things-factory/integration-sftp": "^6.0.
|
|
94
|
-
"@things-factory/lite-menu": "^6.0.
|
|
95
|
-
"@things-factory/more-ui": "^6.0.
|
|
96
|
-
"@things-factory/notification": "^6.0.
|
|
97
|
-
"@things-factory/pdf": "^6.0.
|
|
98
|
-
"@things-factory/product-ui": "^6.0.
|
|
99
|
-
"@things-factory/resource-ui": "^6.0.
|
|
100
|
-
"@things-factory/sales-base": "^6.0.
|
|
101
|
-
"@things-factory/scene-google-map": "^6.0.
|
|
102
|
-
"@things-factory/
|
|
103
|
-
"@things-factory/
|
|
104
|
-
"@things-factory/
|
|
105
|
-
"@things-factory/
|
|
106
|
-
"@things-factory/
|
|
107
|
-
"@things-factory/worksheet-base": "^6.0.0",
|
|
66
|
+
"@things-factory/api": "^6.0.3",
|
|
67
|
+
"@things-factory/apptool-ui": "^6.0.1",
|
|
68
|
+
"@things-factory/attachment-base": "^6.0.3",
|
|
69
|
+
"@things-factory/auth-base": "^6.0.3",
|
|
70
|
+
"@things-factory/auth-ui": "^6.0.3",
|
|
71
|
+
"@things-factory/biz-base": "^6.0.3",
|
|
72
|
+
"@things-factory/biz-ui": "^6.0.3",
|
|
73
|
+
"@things-factory/board-service": "^6.0.3",
|
|
74
|
+
"@things-factory/board-ui": "^6.0.1",
|
|
75
|
+
"@things-factory/code-ui": "^6.0.3",
|
|
76
|
+
"@things-factory/component-ui": "^6.0.1",
|
|
77
|
+
"@things-factory/context-ui": "^6.0.1",
|
|
78
|
+
"@things-factory/document-template-ui": "^6.0.3",
|
|
79
|
+
"@things-factory/env": "^6.0.1",
|
|
80
|
+
"@things-factory/export-ui": "^6.0.1",
|
|
81
|
+
"@things-factory/export-ui-csv": "^6.0.1",
|
|
82
|
+
"@things-factory/export-ui-excel": "^6.0.1",
|
|
83
|
+
"@things-factory/grist-ui": "^6.0.1",
|
|
84
|
+
"@things-factory/help": "^6.0.1",
|
|
85
|
+
"@things-factory/i18n-base": "^6.0.1",
|
|
86
|
+
"@things-factory/import-ui": "^6.0.1",
|
|
87
|
+
"@things-factory/import-ui-excel": "^6.0.1",
|
|
88
|
+
"@things-factory/integration-accounting": "^6.0.3",
|
|
89
|
+
"@things-factory/integration-fulfillment": "^6.0.3",
|
|
90
|
+
"@things-factory/integration-lmd": "^6.0.3",
|
|
91
|
+
"@things-factory/integration-marketplace": "^6.0.3",
|
|
92
|
+
"@things-factory/integration-pos": "^6.0.3",
|
|
93
|
+
"@things-factory/integration-sellercraft": "^6.0.3",
|
|
94
|
+
"@things-factory/integration-sftp": "^6.0.3",
|
|
95
|
+
"@things-factory/lite-menu": "^6.0.3",
|
|
96
|
+
"@things-factory/more-ui": "^6.0.1",
|
|
97
|
+
"@things-factory/notification": "^6.0.3",
|
|
98
|
+
"@things-factory/pdf": "^6.0.1",
|
|
99
|
+
"@things-factory/product-ui": "^6.0.3",
|
|
100
|
+
"@things-factory/resource-ui": "^6.0.3",
|
|
101
|
+
"@things-factory/sales-base": "^6.0.3",
|
|
102
|
+
"@things-factory/scene-google-map": "^6.0.1",
|
|
103
|
+
"@things-factory/setting-ui": "^6.0.3",
|
|
104
|
+
"@things-factory/shell": "^6.0.1",
|
|
105
|
+
"@things-factory/system-ui": "^6.0.1",
|
|
106
|
+
"@things-factory/warehouse-base": "^6.0.3",
|
|
107
|
+
"@things-factory/worksheet-base": "^6.0.3",
|
|
108
108
|
"koa2-swagger-ui": "^5.0.2",
|
|
109
109
|
"swagger-jsdoc": "^5.0.0",
|
|
110
110
|
"yamljs": "^0.3.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@things-factory/builder": "^6.0.
|
|
113
|
+
"@things-factory/builder": "^6.0.1"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "6d9a3aef103e6d8293bfce285662d15ec9c0d705"
|
|
116
116
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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 _a, _b, _c;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.EmailAttachment = void 0;
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
16
|
-
const shell_1 = require("@things-factory/shell");
|
|
17
|
-
const email_1 = require("./email");
|
|
18
|
-
let EmailAttachment = class EmailAttachment {
|
|
19
|
-
};
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], EmailAttachment.prototype, "id", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
26
|
-
__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
|
|
27
|
-
], EmailAttachment.prototype, "domain", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)(),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], EmailAttachment.prototype, "name", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typeorm_1.Column)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], EmailAttachment.prototype, "gqlString", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typeorm_1.Column)(),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], EmailAttachment.prototype, "headers", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], EmailAttachment.prototype, "variables", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], EmailAttachment.prototype, "mappingFunction", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.ManyToOne)(type => email_1.Email, email => email.emailAttachments),
|
|
50
|
-
__metadata("design:type", email_1.Email)
|
|
51
|
-
], EmailAttachment.prototype, "email", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
54
|
-
__metadata("design:type", Date)
|
|
55
|
-
], EmailAttachment.prototype, "createdAt", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
58
|
-
__metadata("design:type", Date)
|
|
59
|
-
], EmailAttachment.prototype, "updatedAt", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
62
|
-
nullable: true
|
|
63
|
-
}),
|
|
64
|
-
__metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
|
|
65
|
-
], EmailAttachment.prototype, "creator", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
68
|
-
nullable: true
|
|
69
|
-
}),
|
|
70
|
-
__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
|
|
71
|
-
], EmailAttachment.prototype, "updater", void 0);
|
|
72
|
-
EmailAttachment = __decorate([
|
|
73
|
-
(0, typeorm_1.Entity)(),
|
|
74
|
-
(0, typeorm_1.Index)('ix_email_attachment_0', (emailAttachment) => [emailAttachment.domain, emailAttachment.name])
|
|
75
|
-
], EmailAttachment);
|
|
76
|
-
exports.EmailAttachment = EmailAttachment;
|
|
77
|
-
//# sourceMappingURL=email-attachment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-attachment.js","sourceRoot":"","sources":["../../server/entities/email-attachment.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAsH;AAEtH,yDAAgD;AAChD,iDAA8C;AAC9C,mCAA+B;AAIxB,IAAM,eAAe,GAArB,MAAM,eAAe;CAwC3B,CAAA;AAvCC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;2CACrB;AAEV;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;kDAClB,cAAM,oBAAN,cAAM;+CAAA;AAEd;IAAC,IAAA,gBAAM,GAAE;;6CACG;AAEZ;IAAC,IAAA,gBAAM,GAAE;;kDACQ;AAEjB;IAAC,IAAA,gBAAM,GAAE;;gDACM;AAEf;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;AAEjB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACJ;AAEvB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,aAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;8BACnD,aAAK;8CAAA;AAEZ;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;kDAAA;AAEf;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;kDAAA;AAEf;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;gDAAA;AAEb;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;gDAAA;AAvCF,eAAe;IAF3B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,uBAAuB,EAAE,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;GACxG,eAAe,CAwC3B;AAxCY,0CAAe"}
|
|
@@ -1,69 +0,0 @@
|
|
|
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 _a, _b, _c;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.EmailRecipient = void 0;
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
16
|
-
const shell_1 = require("@things-factory/shell");
|
|
17
|
-
const email_1 = require("./email");
|
|
18
|
-
let EmailRecipient = class EmailRecipient {
|
|
19
|
-
};
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], EmailRecipient.prototype, "id", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
26
|
-
__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
|
|
27
|
-
], EmailRecipient.prototype, "domain", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)(),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], EmailRecipient.prototype, "name", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typeorm_1.Column)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], EmailRecipient.prototype, "emailAddress", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typeorm_1.Column)(),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], EmailRecipient.prototype, "type", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typeorm_1.ManyToOne)(type => email_1.Email, email => email.emailRecipients),
|
|
42
|
-
__metadata("design:type", email_1.Email)
|
|
43
|
-
], EmailRecipient.prototype, "email", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
46
|
-
__metadata("design:type", Date)
|
|
47
|
-
], EmailRecipient.prototype, "createdAt", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
50
|
-
__metadata("design:type", Date)
|
|
51
|
-
], EmailRecipient.prototype, "updatedAt", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
54
|
-
nullable: true
|
|
55
|
-
}),
|
|
56
|
-
__metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
|
|
57
|
-
], EmailRecipient.prototype, "creator", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
60
|
-
nullable: true
|
|
61
|
-
}),
|
|
62
|
-
__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
|
|
63
|
-
], EmailRecipient.prototype, "updater", void 0);
|
|
64
|
-
EmailRecipient = __decorate([
|
|
65
|
-
(0, typeorm_1.Entity)(),
|
|
66
|
-
(0, typeorm_1.Index)('ix_email_recipient_0', (emailRecipient) => [emailRecipient.domain, emailRecipient.name])
|
|
67
|
-
], EmailRecipient);
|
|
68
|
-
exports.EmailRecipient = EmailRecipient;
|
|
69
|
-
//# sourceMappingURL=email-recipient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-recipient.js","sourceRoot":"","sources":["../../server/entities/email-recipient.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAQgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAC9C,mCAA+B;AAIxB,IAAM,cAAc,GAApB,MAAM,cAAc;CAkC1B,CAAA;AAjCC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACrB;AAEV;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;kDAClB,cAAM,oBAAN,cAAM;8CAAA;AAEd;IAAC,IAAA,gBAAM,GAAE;;4CACG;AAEZ;IAAC,IAAA,gBAAM,GAAE;;oDACW;AAEpB;IAAC,IAAA,gBAAM,GAAE;;4CACG;AAEZ;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,aAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC;8BAClD,aAAK;6CAAA;AAEZ;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;iDAAA;AAEf;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;iDAAA;AAEf;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;+CAAA;AAEb;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;+CAAA;AAjCF,cAAc;IAF1B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,sBAAsB,EAAE,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;GACnG,cAAc,CAkC1B;AAlCY,wCAAc"}
|
|
@@ -1,90 +0,0 @@
|
|
|
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 _a, _b, _c;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Email = void 0;
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
16
|
-
const shell_1 = require("@things-factory/shell");
|
|
17
|
-
const email_recipient_1 = require("./email-recipient");
|
|
18
|
-
const email_attachment_1 = require("./email-attachment");
|
|
19
|
-
let Email = class Email {
|
|
20
|
-
};
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], Email.prototype, "id", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
27
|
-
__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
|
|
28
|
-
], Email.prototype, "domain", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, typeorm_1.Column)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], Email.prototype, "name", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, typeorm_1.Column)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], Email.prototype, "schedule", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, typeorm_1.Column)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], Email.prototype, "subject", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
43
|
-
__metadata("design:type", String)
|
|
44
|
-
], Email.prototype, "content", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typeorm_1.Column)({ default: true }),
|
|
47
|
-
__metadata("design:type", Boolean)
|
|
48
|
-
], Email.prototype, "active", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
|
-
__metadata("design:type", Number)
|
|
52
|
-
], Email.prototype, "timezoneOffset", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
55
|
-
__metadata("design:type", String)
|
|
56
|
-
], Email.prototype, "partnerBlackList", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, typeorm_1.OneToMany)(type => email_recipient_1.EmailRecipient, emailRecipient => emailRecipient.email),
|
|
59
|
-
__metadata("design:type", Array)
|
|
60
|
-
], Email.prototype, "emailRecipients", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, typeorm_1.OneToMany)(type => email_attachment_1.EmailAttachment, emailAttachment => emailAttachment.email),
|
|
63
|
-
__metadata("design:type", Array)
|
|
64
|
-
], Email.prototype, "emailAttachments", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
67
|
-
__metadata("design:type", Date)
|
|
68
|
-
], Email.prototype, "createdAt", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
71
|
-
__metadata("design:type", Date)
|
|
72
|
-
], Email.prototype, "updatedAt", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
75
|
-
nullable: true
|
|
76
|
-
}),
|
|
77
|
-
__metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
|
|
78
|
-
], Email.prototype, "creator", void 0);
|
|
79
|
-
__decorate([
|
|
80
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
81
|
-
nullable: true
|
|
82
|
-
}),
|
|
83
|
-
__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
|
|
84
|
-
], Email.prototype, "updater", void 0);
|
|
85
|
-
Email = __decorate([
|
|
86
|
-
(0, typeorm_1.Entity)(),
|
|
87
|
-
(0, typeorm_1.Index)('ix_email_0', (email) => [email.domain, email.name], { unique: true })
|
|
88
|
-
], Email);
|
|
89
|
-
exports.Email = Email;
|
|
90
|
-
//# sourceMappingURL=email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../server/entities/email.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAC9C,uDAAkD;AAClD,yDAAoD;AAI7C,IAAM,KAAK,GAAX,MAAM,KAAK;CAiDjB,CAAA;AAhDC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;iCACrB;AAEV;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;kDAClB,cAAM,oBAAN,cAAM;qCAAA;AAEd;IAAC,IAAA,gBAAM,GAAE;;mCACG;AAEZ;IAAC,IAAA,gBAAM,GAAE;;uCACO;AAEhB;IAAC,IAAA,gBAAM,GAAE;;sCACM;AAEf;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACZ;AAEf;IAAC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;qCACX;AAEf;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACL;AAEtB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACH;AAExB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gCAAc,EAAE,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;;8CACzC;AAEjC;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,kCAAe,EAAE,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;;+CAC1C;AAEnC;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;wCAAA;AAEf;IAAC,IAAA,0BAAgB,GAAE;8BACR,IAAI;wCAAA;AAEf;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;sCAAA;AAEb;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;kDACO,gBAAI,oBAAJ,gBAAI;sCAAA;AAhDF,KAAK;IAFjB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,YAAY,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACvE,KAAK,CAiDjB;AAjDY,sBAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/email/index.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAErC,QAAA,QAAQ,qBAChB,gCAAkB,EACtB"}
|
|
@@ -1,197 +0,0 @@
|
|
|
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 __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.sendEmailsResolver = void 0;
|
|
30
|
-
const cronParser = __importStar(require("cron-parser"));
|
|
31
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
32
|
-
const typeorm_1 = require("typeorm");
|
|
33
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
34
|
-
const biz_base_1 = require("@things-factory/biz-base");
|
|
35
|
-
const email_base_1 = require("@things-factory/email-base");
|
|
36
|
-
const env_1 = require("@things-factory/env");
|
|
37
|
-
const shell_1 = require("@things-factory/shell");
|
|
38
|
-
const entities_1 = require("../../../entities");
|
|
39
|
-
exports.sendEmailsResolver = {
|
|
40
|
-
async sendEmails(_, {}, context) {
|
|
41
|
-
const emails = await (0, typeorm_1.getRepository)(entities_1.Email).find({
|
|
42
|
-
where: { active: true },
|
|
43
|
-
relations: ['domain', 'creator', 'creator.domains', 'emailRecipients', 'emailAttachments']
|
|
44
|
-
});
|
|
45
|
-
try {
|
|
46
|
-
for (let email of emails) {
|
|
47
|
-
// parse cron job format (i.e. * * * * *)
|
|
48
|
-
let interval = cronParser.parseExpression(email.schedule);
|
|
49
|
-
let now = new Date();
|
|
50
|
-
let thirtyMinsAgo = new Date(now - 30 * 60000);
|
|
51
|
-
let dag = new Date(interval.prev()); // get the most recent schedule
|
|
52
|
-
let startDate = new Date(interval.prev());
|
|
53
|
-
if (dag < now && dag > thirtyMinsAgo) {
|
|
54
|
-
try {
|
|
55
|
-
processEmailCronJob(email, startDate.toISOString(), now.toISOString()); // removed await
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
env_1.logger.error(`[auto_email_log_by_id(${email.id})] ${e}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
env_1.logger.error(`[auto_email_log] ${e}`);
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
function replaceValues(variablesString, values = []) {
|
|
70
|
-
for (let obj of values) {
|
|
71
|
-
variablesString = variablesString.replace(obj.name, obj.value);
|
|
72
|
-
}
|
|
73
|
-
return JSON.parse(variablesString);
|
|
74
|
-
}
|
|
75
|
-
// NOTE: might show unused because of usage in eval function
|
|
76
|
-
function flattenObject(obj, delimiter = '|') {
|
|
77
|
-
var objResult = {};
|
|
78
|
-
for (var items in obj) {
|
|
79
|
-
if (!Object.hasOwnProperty.bind(obj)(items))
|
|
80
|
-
continue;
|
|
81
|
-
if (!!obj[items] && typeof obj[items] == 'object') {
|
|
82
|
-
var flatObject = flattenObject(obj[items], delimiter);
|
|
83
|
-
for (var x in flatObject) {
|
|
84
|
-
if (!Object.hasOwnProperty.bind(flatObject)(x))
|
|
85
|
-
continue;
|
|
86
|
-
objResult[items + delimiter + x] = flatObject[x];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
objResult[items] = obj[items];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return objResult;
|
|
94
|
-
}
|
|
95
|
-
async function processEmailCronJob(email, fromDate, toDate) {
|
|
96
|
-
let attachments = [];
|
|
97
|
-
// black list filtration
|
|
98
|
-
let partnerBlackList = JSON.parse(email.partnerBlackList) || [];
|
|
99
|
-
//
|
|
100
|
-
const partners = await (0, typeorm_1.getRepository)(auth_base_1.Partner).find({
|
|
101
|
-
where: { domain: email.domain, id: (0, typeorm_1.Not)((0, typeorm_1.In)(partnerBlackList)) },
|
|
102
|
-
relations: ['partnerDomain']
|
|
103
|
-
});
|
|
104
|
-
// retrieve and process xlsx attachmennts
|
|
105
|
-
for (let attachment of email.emailAttachments) {
|
|
106
|
-
let client = shell_1.GraphqlLocalClient.client;
|
|
107
|
-
for (let partner of partners) {
|
|
108
|
-
const bizplace = await (0, typeorm_1.getRepository)(biz_base_1.Bizplace).findOne({
|
|
109
|
-
where: { domain: partner.partnerDomain }
|
|
110
|
-
});
|
|
111
|
-
// date params processing
|
|
112
|
-
// let dateValue = new Date()
|
|
113
|
-
// let yesterday = dateValue.getDate() - 1
|
|
114
|
-
// let yesterdayBegin: any = new Date(dateValue.setDate(yesterday))
|
|
115
|
-
// let yesterdayEnd: any = new Date(dateValue.setDate(yesterday))
|
|
116
|
-
// yesterdayBegin.setHours(0, 0, 0, 0)
|
|
117
|
-
// yesterdayEnd.setHours(23, 59, 59, 999)
|
|
118
|
-
let timezoneOffset = (email === null || email === void 0 ? void 0 : email.timezoneOffset) || 0;
|
|
119
|
-
let curDate = new Date();
|
|
120
|
-
let curDateForMonth = new Date(curDate);
|
|
121
|
-
let curDateForWeek = new Date(curDate);
|
|
122
|
-
let curDateForDay = new Date(curDate);
|
|
123
|
-
let prevMonth = curDateForMonth.getMonth() - 1;
|
|
124
|
-
let prevMonthBegin = new Date(curDateForMonth.setMonth(prevMonth));
|
|
125
|
-
prevMonthBegin.setHours(0, 0, 0, 0);
|
|
126
|
-
let prevMonthBeginDateTime = new Date(prevMonthBegin - timezoneOffset * 60000).toISOString();
|
|
127
|
-
let prevWeek = curDateForWeek.getDate() - 7; // subtract 1 week
|
|
128
|
-
let prevWeekBegin = new Date(curDateForWeek.setDate(prevWeek));
|
|
129
|
-
prevWeekBegin.setHours(0, 0, 0, 0);
|
|
130
|
-
let prevWeekBeginDateTime = new Date(prevWeekBegin - timezoneOffset * 60000).toISOString();
|
|
131
|
-
let prevDay = curDateForDay.getDate() - 1; // subtract 1 day
|
|
132
|
-
let prevDayBegin = new Date(curDateForDay.setDate(prevDay));
|
|
133
|
-
prevDayBegin.setHours(0, 0, 0, 0);
|
|
134
|
-
let prevDayBeginDateTime = new Date(prevDayBegin - timezoneOffset * 60000).toISOString();
|
|
135
|
-
let endDate = curDate;
|
|
136
|
-
endDate.setHours(23, 59, 59, 999);
|
|
137
|
-
let endDateTime = new Date(endDate - timezoneOffset * 60000).toISOString();
|
|
138
|
-
// let fromDate = new Date(yesterdayBegin - timezoneOffset * 60000).toISOString()
|
|
139
|
-
// let toDate = new Date(yesterdayEnd - timezoneOffset * 60000).toISOString()
|
|
140
|
-
// to trace UTC conversion in production
|
|
141
|
-
env_1.logger.info(`[email_utc_conversion] fromDate: ${fromDate}, toDate: ${toDate}`);
|
|
142
|
-
let variables = replaceValues(attachment.variables, [
|
|
143
|
-
{ name: '{{bizplaceId}}', value: `"${bizplace.id}"` },
|
|
144
|
-
{ name: '{{timezoneOffset}}', value: `${timezoneOffset}` },
|
|
145
|
-
{ name: '{{lastRunDateTime}}', value: `"${fromDate}"` },
|
|
146
|
-
{ name: '{{toDateTime}}', value: `"${endDateTime}"` },
|
|
147
|
-
{ name: '{{prevMonthBeginDateTime}}', value: `"${prevMonthBeginDateTime}"` },
|
|
148
|
-
{ name: '{{prevWeekBeginDateTime}}', value: `"${prevWeekBeginDateTime}"` },
|
|
149
|
-
{ name: '{{prevDayBeginDateTime}}', value: `"${prevDayBeginDateTime}"` }
|
|
150
|
-
]);
|
|
151
|
-
let user = email.creator;
|
|
152
|
-
delete user.creatorId;
|
|
153
|
-
delete user.updaterId;
|
|
154
|
-
// might show unused because of usage in eval
|
|
155
|
-
const response = await client.query({
|
|
156
|
-
query: (0, graphql_tag_1.default) `
|
|
157
|
-
${attachment.gqlString}
|
|
158
|
-
`,
|
|
159
|
-
variables: variables || {},
|
|
160
|
-
context: { state: { domain: email.domain, user } }
|
|
161
|
-
});
|
|
162
|
-
let mappedResponse = eval(attachment.mappingFunction);
|
|
163
|
-
let header = JSON.parse(attachment.headers);
|
|
164
|
-
let excelResponse = await (0, email_base_1.objDataToExcel)({ name: 'name', data: { header, data: mappedResponse } });
|
|
165
|
-
attachments.push({
|
|
166
|
-
filename: `${bizplace.name} - ${attachment.name}.xlsx`,
|
|
167
|
-
content: excelResponse,
|
|
168
|
-
contentType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// modify content and subject
|
|
173
|
-
let bizplace = await (0, typeorm_1.getRepository)(biz_base_1.Bizplace).findOne({
|
|
174
|
-
where: { domain: email.domain },
|
|
175
|
-
relations: ['company']
|
|
176
|
-
});
|
|
177
|
-
let modifiedContent = email.content.replace('{{companyName}}', bizplace.company.name);
|
|
178
|
-
let modifiedSubject = email.subject.replace('{{warehouseName}}', email.domain.name);
|
|
179
|
-
modifiedSubject = modifiedSubject.replace('{{reportDate}}', new Date().toLocaleDateString('en-GB'));
|
|
180
|
-
//
|
|
181
|
-
let res = await (0, email_base_1.sendEmailSes)({
|
|
182
|
-
attachments,
|
|
183
|
-
subject: modifiedSubject,
|
|
184
|
-
content: modifiedContent,
|
|
185
|
-
toMailList: email.emailRecipients
|
|
186
|
-
.filter(er => er.type == 'to')
|
|
187
|
-
.map(er => {
|
|
188
|
-
return er.emailAddress;
|
|
189
|
-
}) || [],
|
|
190
|
-
ccMailList: email.emailRecipients
|
|
191
|
-
.filter(er => er.type == 'cc')
|
|
192
|
-
.map(er => {
|
|
193
|
-
return er.emailAddress;
|
|
194
|
-
}) || []
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
//# sourceMappingURL=send-emails.js.map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