@steedos-labs/content-compliance 1.0.1 → 1.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/index.js +1 -1
- package/lib/actions/contentHubFillOnSave.d.ts +5 -0
- package/lib/actions/contentHubFillOnSave.js +49 -0
- package/lib/actions/contentHubFillOnSave.js.map +1 -0
- package/lib/actions/contentHubMaterialGroups.js +19 -35
- package/lib/actions/contentHubMaterialGroups.js.map +1 -1
- package/lib/actions/contentHubSyncPreview.d.ts +9 -4
- package/lib/actions/contentHubSyncPreview.js +23 -19
- package/lib/actions/contentHubSyncPreview.js.map +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/index.js.map +1 -1
- package/lib/index.js +35 -110
- package/lib/index.js.map +1 -1
- package/lib/methods/__tests__/contentHubFormFill.test.d.ts +1 -0
- package/lib/methods/__tests__/contentHubFormFill.test.js +274 -0
- package/lib/methods/__tests__/contentHubFormFill.test.js.map +1 -0
- package/lib/methods/__tests__/contentHubPush.test.js +211 -6
- package/lib/methods/__tests__/contentHubPush.test.js.map +1 -1
- package/lib/methods/__tests__/contentHubSyncRule.test.js +37 -5
- package/lib/methods/__tests__/contentHubSyncRule.test.js.map +1 -1
- package/lib/methods/__tests__/contentHubTagSync.test.js +21 -57
- package/lib/methods/__tests__/contentHubTagSync.test.js.map +1 -1
- package/lib/methods/content_hub.js +13 -3
- package/lib/methods/content_hub.js.map +1 -1
- package/lib/methods/content_hub_form_fill.d.ts +2 -0
- package/lib/methods/content_hub_form_fill.js +75 -0
- package/lib/methods/content_hub_form_fill.js.map +1 -0
- package/lib/methods/content_hub_material_group.d.ts +1 -0
- package/lib/methods/content_hub_material_group.js +14 -1
- package/lib/methods/content_hub_material_group.js.map +1 -1
- package/lib/methods/content_hub_material_group_rule.d.ts +9 -0
- package/lib/methods/content_hub_material_group_rule.js +62 -1
- package/lib/methods/content_hub_material_group_rule.js.map +1 -1
- package/lib/methods/content_hub_sync_rule.d.ts +13 -0
- package/lib/methods/content_hub_sync_rule.js +49 -13
- package/lib/methods/content_hub_sync_rule.js.map +1 -1
- package/lib/methods/content_hub_tag.d.ts +0 -5
- package/lib/methods/content_hub_tag.js +47 -207
- package/lib/methods/content_hub_tag.js.map +1 -1
- package/lib/methods/content_hub_uploader.d.ts +24 -0
- package/lib/methods/content_hub_uploader.js +282 -0
- package/lib/methods/content_hub_uploader.js.map +1 -0
- package/main/default/objects/pepsico_ch_sync_rule/fields/kol_classification.field.yml +1 -1
- package/main/default/objects/pepsico_ch_tag_sync_log/fields/expired_date.field.yml +1 -0
- package/main/default/objects/pepsico_material_approval/fields/ch_material_group.field.yml +5 -12
- package/main/default/objects/pepsico_material_approval/fields/ch_material_group_path.field.yml +8 -4
- package/main/default/objects/pepsico_material_approval/fields/ch_sync_enabled.field.yml +10 -0
- package/main/default/objects/pepsico_material_approval/fields/ch_sync_manual.field.yml +12 -0
- package/main/default/objects/pepsico_material_approval/fields/ch_sync_rule_check.field.yml +13 -16
- package/main/default/objects/pepsico_material_approval/fields/ch_uploader_notified_group.field.yml +11 -0
- package/main/default/triggers/pepsico_material_approval_content_hub.trigger.yml +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contentHubFillOnSave = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var content_hub_form_fill_1 = require("../methods/content_hub_form_fill");
|
|
6
|
+
exports.contentHubFillOnSave = {
|
|
7
|
+
handler: function (ctx) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
9
|
+
var logger, _a, doc, id, previous, rows, error_1;
|
|
10
|
+
var _b;
|
|
11
|
+
return tslib_1.__generator(this, function (_c) {
|
|
12
|
+
switch (_c.label) {
|
|
13
|
+
case 0: return [4, this.getLogger()];
|
|
14
|
+
case 1:
|
|
15
|
+
logger = _c.sent();
|
|
16
|
+
ctx.logger = logger;
|
|
17
|
+
ctx.getObject = this.getObject;
|
|
18
|
+
_a = ctx.params || {}, doc = _a.doc, id = _a.id;
|
|
19
|
+
_c.label = 2;
|
|
20
|
+
case 2:
|
|
21
|
+
_c.trys.push([2, 6, , 8]);
|
|
22
|
+
previous = null;
|
|
23
|
+
if (!id) return [3, 4];
|
|
24
|
+
return [4, ctx.getObject('pepsico_material_approval').directFind({
|
|
25
|
+
filters: [['_id', '=', id]],
|
|
26
|
+
fields: content_hub_form_fill_1.CONTENT_HUB_INPUT_FIELDS,
|
|
27
|
+
top: 1
|
|
28
|
+
})];
|
|
29
|
+
case 3:
|
|
30
|
+
rows = _c.sent();
|
|
31
|
+
previous = rows && rows.length > 0 ? rows[0] : null;
|
|
32
|
+
_c.label = 4;
|
|
33
|
+
case 4:
|
|
34
|
+
_b = {};
|
|
35
|
+
return [4, (0, content_hub_form_fill_1.fillContentHubFields)(ctx, doc || {}, previous)];
|
|
36
|
+
case 5: return [2, (_b.patch = _c.sent(), _b)];
|
|
37
|
+
case 6:
|
|
38
|
+
error_1 = _c.sent();
|
|
39
|
+
return [4, logger.error("[Content Hub]\u4FDD\u5B58\u65F6\u8865\u7B97\u540C\u6B65\u5F00\u5173 / \u7D20\u6750\u7EC4\u8DEF\u5F84\u5931\u8D25, \u4E0D\u5F71\u54CD\u4FDD\u5B58", { id: id, error: error_1.message })];
|
|
40
|
+
case 7:
|
|
41
|
+
_c.sent();
|
|
42
|
+
return [2, { patch: {} }];
|
|
43
|
+
case 8: return [2];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=contentHubFillOnSave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentHubFillOnSave.js","sourceRoot":"","sources":["../../src/actions/contentHubFillOnSave.ts"],"names":[],"mappings":";;;;AAKA,0E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var tslib_1 = require("tslib");
|
|
5
|
-
var _ = require("lodash");
|
|
6
|
-
var content_hub_material_group_1 = require("../methods/content_hub_material_group");
|
|
7
5
|
var content_hub_material_group_rule_1 = require("../methods/content_hub_material_group_rule");
|
|
8
|
-
var
|
|
9
|
-
var PRODUCT_TAG_ID = _.find(tag_label_1.TAG_LABEL_FIELDS.pepsico_material_approval, { field: 'product' }).tagId;
|
|
6
|
+
var content_hub_sync_rule_1 = require("../methods/content_hub_sync_rule");
|
|
10
7
|
exports.contentHubMaterialGroups = {
|
|
11
8
|
rest: {
|
|
12
9
|
method: 'GET',
|
|
@@ -15,9 +12,10 @@ exports.contentHubMaterialGroups = {
|
|
|
15
12
|
handler: function (ctx) {
|
|
16
13
|
var _a, _b;
|
|
17
14
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
18
|
-
var user, logger, _c, product, path, owner_department, classification, sales,
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
var user, logger, _c, product, path, owner_department, classification, sales, options, _d, _e, error_1;
|
|
16
|
+
var _f;
|
|
17
|
+
return tslib_1.__generator(this, function (_g) {
|
|
18
|
+
switch (_g.label) {
|
|
21
19
|
case 0:
|
|
22
20
|
user = ctx.meta.user;
|
|
23
21
|
if (!user || !user.userId) {
|
|
@@ -25,43 +23,29 @@ exports.contentHubMaterialGroups = {
|
|
|
25
23
|
}
|
|
26
24
|
return [4, this.getLogger()];
|
|
27
25
|
case 1:
|
|
28
|
-
logger =
|
|
26
|
+
logger = _g.sent();
|
|
29
27
|
ctx.logger = logger;
|
|
30
28
|
ctx.getObject = this.getObject;
|
|
31
29
|
_c = ctx.params || {}, product = _c.product, path = _c.path, owner_department = _c.owner_department, classification = _c.classification;
|
|
32
30
|
sales = ((_a = ctx.params) === null || _a === void 0 ? void 0 : _a.sales) === true || ((_b = ctx.params) === null || _b === void 0 ? void 0 : _b.sales) === 'true';
|
|
33
|
-
|
|
31
|
+
_g.label = 2;
|
|
34
32
|
case 2:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
sales = (0, content_hub_material_group_rule_1.getQueryMode)(rule) === content_hub_material_group_rule_1.QueryMode.sales;
|
|
42
|
-
_d.label = 4;
|
|
33
|
+
_g.trys.push([2, 5, , 7]);
|
|
34
|
+
_d = content_hub_material_group_rule_1.loadMaterialGroupOptions;
|
|
35
|
+
_e = [ctx];
|
|
36
|
+
_f = { product: product, path: path };
|
|
37
|
+
return [4, (0, content_hub_sync_rule_1.resolveOwnerDepartment)(ctx, owner_department)];
|
|
38
|
+
case 3: return [4, _d.apply(void 0, _e.concat([(_f.ownerDepartment = _g.sent(), _f.classification = classification, _f.sales = sales, _f)]))];
|
|
43
39
|
case 4:
|
|
44
|
-
|
|
45
|
-
productPaths = (0, tag_label_1.parseTagValuePaths)(product);
|
|
46
|
-
if (productPaths.length === 0) {
|
|
47
|
-
return [2, { status: 0, msg: '', data: { options: [] } }];
|
|
48
|
-
}
|
|
49
|
-
return [4, (0, tag_label_1.loadTagNames)(ctx, PRODUCT_TAG_ID, _.flatten(productPaths))];
|
|
50
|
-
case 5:
|
|
51
|
-
names_1 = _d.sent();
|
|
52
|
-
materialGroupPath = productPaths.map(function (ids) { return (0, content_hub_material_group_1.toMaterialGroupPath)(ids.map(function (id) { return names_1[id] || id; })); });
|
|
53
|
-
_d.label = 6;
|
|
54
|
-
case 6: return [4, (0, content_hub_material_group_1.queryMaterialGroupTree)(ctx, { sales: sales, materialGroupPath: materialGroupPath })];
|
|
55
|
-
case 7:
|
|
56
|
-
options = _d.sent();
|
|
40
|
+
options = _g.sent();
|
|
57
41
|
return [2, { status: 0, msg: '', data: { options: options } }];
|
|
58
|
-
case
|
|
59
|
-
error_1 =
|
|
42
|
+
case 5:
|
|
43
|
+
error_1 = _g.sent();
|
|
60
44
|
return [4, logger.error("[Content Hub \u7D20\u6750\u7EC4\u67E5\u8BE2]\u5931\u8D25", { product: product, path: path, owner_department: owner_department, classification: classification, sales: sales, error: error_1.message })];
|
|
61
|
-
case
|
|
62
|
-
|
|
45
|
+
case 6:
|
|
46
|
+
_g.sent();
|
|
63
47
|
return [2, { status: 500, msg: error_1.message, data: { options: [] } }];
|
|
64
|
-
case
|
|
48
|
+
case 7: return [2];
|
|
65
49
|
}
|
|
66
50
|
});
|
|
67
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentHubMaterialGroups.js","sourceRoot":"","sources":["../../src/actions/contentHubMaterialGroups.ts"],"names":[],"mappings":";;;;AASA,
|
|
1
|
+
{"version":3,"file":"contentHubMaterialGroups.js","sourceRoot":"","sources":["../../src/actions/contentHubMaterialGroups.ts"],"names":[],"mappings":";;;;AASA,8FAAsF;AACtF,0EAA0E;AAE7D,QAAA,wBAAwB,GAAG;IACpC,IAAI,EAAE;QACF,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,kDAAkD;KAC/D;IACK,OAAO,YAAC,GAAG;;;;;;;;wBACP,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;wBAC3B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;4BACvB,WAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAC;yBAC7D;wBACc,WAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAA/B,MAAM,GAAG,SAAsB;wBACrC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;wBACpB,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;wBAEzB,KAAsD,GAAG,CAAC,MAAM,IAAI,EAAE,EAApE,OAAO,aAAA,EAAE,IAAI,UAAA,EAAE,gBAAgB,sBAAA,EAAE,cAAc,oBAAA,CAAsB;wBACvE,KAAK,GAAG,CAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,KAAK,MAAK,IAAI,IAAI,CAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,KAAK,MAAK,MAAM,CAAC;;;;wBAG/C,KAAA,0DAAwB,CAAA;8BAAC,GAAG;+BAAI,OAAO,SAAA,EAAE,IAAI,MAAA;wBAAmB,WAAM,IAAA,8CAAsB,EAAC,GAAG,EAAE,gBAAgB,CAAC,EAAA;4BAAzH,WAAM,6BAA+C,kBAAe,GAAE,SAAmD,EAAE,iBAAc,iBAAA,EAAE,QAAK,QAAA,QAAG,EAAA;;wBAA7J,OAAO,GAAG,SAAmJ;wBACnK,WAAO,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,EAAE,EAAC;;;wBAEjD,WAAM,MAAM,CAAC,KAAK,CAAC,0DAAuB,EAAE,EAAE,OAAO,SAAA,EAAE,IAAI,MAAA,EAAE,gBAAgB,kBAAA,EAAE,cAAc,gBAAA,EAAE,KAAK,OAAA,EAAE,KAAK,EAAE,OAAK,CAAC,OAAO,EAAE,CAAC,EAAA;;wBAA7H,SAA6H,CAAC;wBAC9H,WAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAK,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAC;;;;;KAEzE;CACJ,CAAC"}
|
|
@@ -7,15 +7,20 @@ export declare const contentHubSyncPreview: {
|
|
|
7
7
|
status: number;
|
|
8
8
|
msg: string;
|
|
9
9
|
data: {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
ch_sync_preview: {
|
|
11
|
+
needSync: boolean;
|
|
12
|
+
ruleName: string;
|
|
13
|
+
mismatches: {
|
|
14
|
+
rule: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
12
18
|
};
|
|
13
19
|
} | {
|
|
14
20
|
status: number;
|
|
15
21
|
msg: any;
|
|
16
22
|
data: {
|
|
17
|
-
|
|
18
|
-
ruleName?: undefined;
|
|
23
|
+
ch_sync_preview?: undefined;
|
|
19
24
|
};
|
|
20
25
|
}>;
|
|
21
26
|
};
|
|
@@ -10,9 +10,10 @@ exports.contentHubSyncPreview = {
|
|
|
10
10
|
},
|
|
11
11
|
handler: function (ctx) {
|
|
12
12
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
13
|
-
var user, logger, _a, owner_department, classification, product, kol_classification, _b, needSync, rule, error_1;
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
var user, logger, _a, owner_department, classification, product, kol_classification, _b, needSync, rule, mismatches, _c, _d, error_1;
|
|
14
|
+
var _e;
|
|
15
|
+
return tslib_1.__generator(this, function (_f) {
|
|
16
|
+
switch (_f.label) {
|
|
16
17
|
case 0:
|
|
17
18
|
user = ctx.meta.user;
|
|
18
19
|
if (!user || !user.userId) {
|
|
@@ -20,29 +21,32 @@ exports.contentHubSyncPreview = {
|
|
|
20
21
|
}
|
|
21
22
|
return [4, this.getLogger()];
|
|
22
23
|
case 1:
|
|
23
|
-
logger =
|
|
24
|
+
logger = _f.sent();
|
|
24
25
|
ctx.logger = logger;
|
|
25
26
|
ctx.getObject = this.getObject;
|
|
26
27
|
_a = ctx.params || {}, owner_department = _a.owner_department, classification = _a.classification, product = _a.product, kol_classification = _a.kol_classification;
|
|
27
|
-
|
|
28
|
+
_f.label = 2;
|
|
28
29
|
case 2:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
_f.trys.push([2, 5, , 7]);
|
|
31
|
+
_c = content_hub_sync_rule_1.previewSyncForForm;
|
|
32
|
+
_d = [ctx];
|
|
33
|
+
_e = {};
|
|
34
|
+
return [4, (0, content_hub_sync_rule_1.resolveOwnerDepartment)(ctx, owner_department)];
|
|
35
|
+
case 3: return [4, _c.apply(void 0, _d.concat([(_e.ownerDepartment = _f.sent(),
|
|
36
|
+
_e.classification = classification,
|
|
37
|
+
_e.product = product,
|
|
38
|
+
_e.kolClassification = kol_classification,
|
|
39
|
+
_e)]))];
|
|
39
40
|
case 4:
|
|
40
|
-
|
|
41
|
-
return [
|
|
41
|
+
_b = _f.sent(), needSync = _b.needSync, rule = _b.rule, mismatches = _b.mismatches;
|
|
42
|
+
return [2, { status: 0, msg: '', data: { ch_sync_preview: { needSync: needSync, ruleName: rule ? rule.name : null, mismatches: mismatches } } }];
|
|
42
43
|
case 5:
|
|
43
|
-
|
|
44
|
+
error_1 = _f.sent();
|
|
45
|
+
return [4, logger.error("[Content Hub \u540C\u6B65\u89C4\u5219]\u586B\u5355\u9884\u5224\u5931\u8D25", { owner_department: owner_department, classification: classification, product: product, kol_classification: kol_classification, error: error_1.message })];
|
|
46
|
+
case 6:
|
|
47
|
+
_f.sent();
|
|
44
48
|
return [2, { status: 500, msg: error_1.message, data: {} }];
|
|
45
|
-
case
|
|
49
|
+
case 7: return [2];
|
|
46
50
|
}
|
|
47
51
|
});
|
|
48
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentHubSyncPreview.js","sourceRoot":"","sources":["../../src/actions/contentHubSyncPreview.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"contentHubSyncPreview.js","sourceRoot":"","sources":["../../src/actions/contentHubSyncPreview.ts"],"names":[],"mappings":";;;;AAQA,0EAA8F;AAEjF,QAAA,qBAAqB,GAAG;IACjC,IAAI,EAAE;QACF,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,+CAA+C;KAC5D;IACK,OAAO,YAAC,GAAG;;;;;;;wBACP,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;wBAC3B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;4BACvB,WAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE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
|
package/lib/actions/index.d.ts
CHANGED
package/lib/actions/index.js
CHANGED
|
@@ -32,4 +32,5 @@ tslib_1.__exportStar(require("./initCollaborator"), exports);
|
|
|
32
32
|
tslib_1.__exportStar(require("./approvalCc"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./contentHubMaterialGroups"), exports);
|
|
34
34
|
tslib_1.__exportStar(require("./contentHubSyncPreview"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./contentHubFillOnSave"), exports);
|
|
35
36
|
//# sourceMappingURL=index.js.map
|
package/lib/actions/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAOA,mDAAyB;AAEzB,sDAA4B;AAE5B,6DAAmC;AAEnC,2DAAiC;AAEjC,8DAAoC;AAEpC,+DAAqC;AAErC,uDAA6B;AAE7B,4DAAkC;AAElC,oEAA0C;AAE1C,iDAAuB;AAEvB,kEAAwC;AAExC,qDAA2B;AAE3B,uDAA6B;AAE7B,gEAAsC;AAEtC,6DAAmC;AAEnC,gEAAsC;AAEtC,8DAAoC;AAEpC,iEAAuC;AACvC,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,uEAA6C;AAE7C,wEAA8C;AAE9C,oEAA0C;AAE1C,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,6DAAmC;AAEnC,uDAA6B;AAE7B,qEAA2C;AAE3C,kEAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAOA,mDAAyB;AAEzB,sDAA4B;AAE5B,6DAAmC;AAEnC,2DAAiC;AAEjC,8DAAoC;AAEpC,+DAAqC;AAErC,uDAA6B;AAE7B,4DAAkC;AAElC,oEAA0C;AAE1C,iDAAuB;AAEvB,kEAAwC;AAExC,qDAA2B;AAE3B,uDAA6B;AAE7B,gEAAsC;AAEtC,6DAAmC;AAEnC,gEAAsC;AAEtC,8DAAoC;AAEpC,iEAAuC;AACvC,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,uEAA6C;AAE7C,wEAA8C;AAE9C,oEAA0C;AAE1C,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,6DAAmC;AAEnC,uDAA6B;AAE7B,qEAA2C;AAE3C,kEAAwC;AACxC,iEAAuC"}
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var pls_1 = require("./methods/pls");
|
|
|
9
9
|
var AI_1 = require("./methods/AI");
|
|
10
10
|
var image_comparison_1 = require("./methods/image_comparison");
|
|
11
11
|
var password_expiry_1 = require("./methods/password_expiry");
|
|
12
|
-
var content_hub_tag_1 = require("./methods/content_hub_tag");
|
|
13
12
|
var tag_label_1 = require("./methods/tag_label");
|
|
14
13
|
var objectql = require('@steedos/objectql');
|
|
15
14
|
var _ = require('lodash');
|
|
@@ -439,39 +438,6 @@ var cronJobs = [
|
|
|
439
438
|
onComplete: function () {
|
|
440
439
|
console.log("checkUserPasswordExpirationJob is stopped");
|
|
441
440
|
}
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
name: "purgeContentHubTagSyncLogsJob",
|
|
445
|
-
cronTime: process.env.PEPSICO_CRON_CH_TAG_SYNC_LOG_CLEANUP || '0 4 * * *',
|
|
446
|
-
timeZone: process.env.STEEDOS_CRON_TIME_ZONE || 'Asia/Shanghai',
|
|
447
|
-
manualStart: false,
|
|
448
|
-
onTick: function () {
|
|
449
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
450
|
-
var e_13;
|
|
451
|
-
return tslib_1.__generator(this, function (_a) {
|
|
452
|
-
switch (_a.label) {
|
|
453
|
-
case 0:
|
|
454
|
-
_a.trys.push([0, 2, , 3]);
|
|
455
|
-
console.log('purgeContentHubTagSyncLogsJob run', new Date());
|
|
456
|
-
return [4, this.broker.call("".concat(packageName, ".purgeContentHubTagSyncLogs"))];
|
|
457
|
-
case 1:
|
|
458
|
-
_a.sent();
|
|
459
|
-
return [3, 3];
|
|
460
|
-
case 2:
|
|
461
|
-
e_13 = _a.sent();
|
|
462
|
-
console.log("purgeContentHubTagSyncLogsJob error ", e_13);
|
|
463
|
-
return [3, 3];
|
|
464
|
-
case 3: return [2];
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
},
|
|
469
|
-
onInitialize: function () {
|
|
470
|
-
this.startJob("purgeContentHubTagSyncLogsJob");
|
|
471
|
-
},
|
|
472
|
-
onComplete: function () {
|
|
473
|
-
console.log("purgeContentHubTagSyncLogsJob is stopped");
|
|
474
|
-
}
|
|
475
441
|
}
|
|
476
442
|
];
|
|
477
443
|
module.exports = {
|
|
@@ -491,8 +457,8 @@ module.exports = {
|
|
|
491
457
|
dependencies: ['~packages-standard-objects'],
|
|
492
458
|
actions: tslib_1.__assign(tslib_1.__assign({}, actions), { materialsUploadToOneDrive: function (ctx) {
|
|
493
459
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
494
|
-
var logger, pendingApprovals, pendingApprovals_1, pendingApprovals_1_1, pendingApproval, allTrue, error_1,
|
|
495
|
-
var
|
|
460
|
+
var logger, pendingApprovals, pendingApprovals_1, pendingApprovals_1_1, pendingApproval, allTrue, error_1, e_13_1;
|
|
461
|
+
var e_13, _a;
|
|
496
462
|
return tslib_1.__generator(this, function (_b) {
|
|
497
463
|
switch (_b.label) {
|
|
498
464
|
case 0: return [4, this.getLogger()];
|
|
@@ -552,14 +518,14 @@ module.exports = {
|
|
|
552
518
|
return [3, 4];
|
|
553
519
|
case 12: return [3, 15];
|
|
554
520
|
case 13:
|
|
555
|
-
|
|
556
|
-
|
|
521
|
+
e_13_1 = _b.sent();
|
|
522
|
+
e_13 = { error: e_13_1 };
|
|
557
523
|
return [3, 15];
|
|
558
524
|
case 14:
|
|
559
525
|
try {
|
|
560
526
|
if (pendingApprovals_1_1 && !pendingApprovals_1_1.done && (_a = pendingApprovals_1.return)) _a.call(pendingApprovals_1);
|
|
561
527
|
}
|
|
562
|
-
finally { if (
|
|
528
|
+
finally { if (e_13) throw e_13.error; }
|
|
563
529
|
return [7];
|
|
564
530
|
case 15: return [2];
|
|
565
531
|
}
|
|
@@ -567,8 +533,8 @@ module.exports = {
|
|
|
567
533
|
});
|
|
568
534
|
}, materialsDownloadFromOneDrive: function (ctx) {
|
|
569
535
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
570
|
-
var logger, pendingApprovals, pendingApprovals_2, pendingApprovals_2_1, pendingApproval, error_2,
|
|
571
|
-
var
|
|
536
|
+
var logger, pendingApprovals, pendingApprovals_2, pendingApprovals_2_1, pendingApproval, error_2, e_14_1;
|
|
537
|
+
var e_14, _a;
|
|
572
538
|
return tslib_1.__generator(this, function (_b) {
|
|
573
539
|
switch (_b.label) {
|
|
574
540
|
case 0: return [4, this.getLogger()];
|
|
@@ -623,14 +589,14 @@ module.exports = {
|
|
|
623
589
|
return [3, 4];
|
|
624
590
|
case 10: return [3, 13];
|
|
625
591
|
case 11:
|
|
626
|
-
|
|
627
|
-
|
|
592
|
+
e_14_1 = _b.sent();
|
|
593
|
+
e_14 = { error: e_14_1 };
|
|
628
594
|
return [3, 13];
|
|
629
595
|
case 12:
|
|
630
596
|
try {
|
|
631
597
|
if (pendingApprovals_2_1 && !pendingApprovals_2_1.done && (_a = pendingApprovals_2.return)) _a.call(pendingApprovals_2);
|
|
632
598
|
}
|
|
633
|
-
finally { if (
|
|
599
|
+
finally { if (e_14) throw e_14.error; }
|
|
634
600
|
return [7];
|
|
635
601
|
case 13: return [2];
|
|
636
602
|
}
|
|
@@ -638,8 +604,8 @@ module.exports = {
|
|
|
638
604
|
});
|
|
639
605
|
}, materialsRemoveShareLinkToOneDrive: function (ctx) {
|
|
640
606
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
641
|
-
var logger, pendingApprovals, pendingApprovals_3, pendingApprovals_3_1, pendingApproval, error_3,
|
|
642
|
-
var
|
|
607
|
+
var logger, pendingApprovals, pendingApprovals_3, pendingApprovals_3_1, pendingApproval, error_3, e_15_1;
|
|
608
|
+
var e_15, _a;
|
|
643
609
|
return tslib_1.__generator(this, function (_b) {
|
|
644
610
|
switch (_b.label) {
|
|
645
611
|
case 0: return [4, this.getLogger()];
|
|
@@ -694,14 +660,14 @@ module.exports = {
|
|
|
694
660
|
return [3, 4];
|
|
695
661
|
case 10: return [3, 13];
|
|
696
662
|
case 11:
|
|
697
|
-
|
|
698
|
-
|
|
663
|
+
e_15_1 = _b.sent();
|
|
664
|
+
e_15 = { error: e_15_1 };
|
|
699
665
|
return [3, 13];
|
|
700
666
|
case 12:
|
|
701
667
|
try {
|
|
702
668
|
if (pendingApprovals_3_1 && !pendingApprovals_3_1.done && (_a = pendingApprovals_3.return)) _a.call(pendingApprovals_3);
|
|
703
669
|
}
|
|
704
|
-
finally { if (
|
|
670
|
+
finally { if (e_15) throw e_15.error; }
|
|
705
671
|
return [7];
|
|
706
672
|
case 13: return [2];
|
|
707
673
|
}
|
|
@@ -768,8 +734,8 @@ module.exports = {
|
|
|
768
734
|
},
|
|
769
735
|
handler: function (ctx) {
|
|
770
736
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
771
|
-
var user, logger, result, _a, _b, objectName, lastId, scanned, updated, hasMore, batch,
|
|
772
|
-
var
|
|
737
|
+
var user, logger, result, _a, _b, objectName, lastId, scanned, updated, hasMore, batch, e_16_1;
|
|
738
|
+
var e_16, _c;
|
|
773
739
|
return tslib_1.__generator(this, function (_d) {
|
|
774
740
|
switch (_d.label) {
|
|
775
741
|
case 0:
|
|
@@ -814,61 +780,20 @@ module.exports = {
|
|
|
814
780
|
return [3, 3];
|
|
815
781
|
case 8: return [3, 11];
|
|
816
782
|
case 9:
|
|
817
|
-
|
|
818
|
-
|
|
783
|
+
e_16_1 = _d.sent();
|
|
784
|
+
e_16 = { error: e_16_1 };
|
|
819
785
|
return [3, 11];
|
|
820
786
|
case 10:
|
|
821
787
|
try {
|
|
822
788
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
823
789
|
}
|
|
824
|
-
finally { if (
|
|
790
|
+
finally { if (e_16) throw e_16.error; }
|
|
825
791
|
return [7];
|
|
826
792
|
case 11: return [2, result];
|
|
827
793
|
}
|
|
828
794
|
});
|
|
829
795
|
});
|
|
830
796
|
}
|
|
831
|
-
}, purgeContentHubTagSyncLogs: {
|
|
832
|
-
rest: {
|
|
833
|
-
method: 'GET',
|
|
834
|
-
fullPath: '/api/pepsico-content/content-hub/purge-tag-sync-logs'
|
|
835
|
-
},
|
|
836
|
-
handler: function (ctx) {
|
|
837
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
838
|
-
var user, logger, deleted, round, result;
|
|
839
|
-
return tslib_1.__generator(this, function (_a) {
|
|
840
|
-
switch (_a.label) {
|
|
841
|
-
case 0:
|
|
842
|
-
user = ctx.meta.user;
|
|
843
|
-
if (user && !user.is_space_admin) {
|
|
844
|
-
return [2, { error: '没有权限' }];
|
|
845
|
-
}
|
|
846
|
-
return [4, this.getLogger()];
|
|
847
|
-
case 1:
|
|
848
|
-
logger = _a.sent();
|
|
849
|
-
ctx.getObject = this.getObject;
|
|
850
|
-
ctx.logger = logger;
|
|
851
|
-
deleted = 0;
|
|
852
|
-
round = 0;
|
|
853
|
-
_a.label = 2;
|
|
854
|
-
case 2:
|
|
855
|
-
if (!(round < 20)) return [3, 5];
|
|
856
|
-
return [4, (0, content_hub_tag_1.purgeExpiredTagSyncLogs)(ctx)];
|
|
857
|
-
case 3:
|
|
858
|
-
result = _a.sent();
|
|
859
|
-
deleted += result.deleted;
|
|
860
|
-
if (!result.hasMore) {
|
|
861
|
-
return [3, 5];
|
|
862
|
-
}
|
|
863
|
-
_a.label = 4;
|
|
864
|
-
case 4:
|
|
865
|
-
round++;
|
|
866
|
-
return [3, 2];
|
|
867
|
-
case 5: return [2, { '清理明细日志数量': deleted }];
|
|
868
|
-
}
|
|
869
|
-
});
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
797
|
}, checkUserPasswordExpiration: function (ctx) {
|
|
873
798
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
874
799
|
var logger;
|
|
@@ -1298,8 +1223,8 @@ module.exports = {
|
|
|
1298
1223
|
},
|
|
1299
1224
|
handler: function (ctx) {
|
|
1300
1225
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1301
|
-
var user, logger, today, ninetyDaysAgo, coll, suColl, users, users_1, users_1_1, user_1,
|
|
1302
|
-
var
|
|
1226
|
+
var user, logger, today, ninetyDaysAgo, coll, suColl, users, users_1, users_1_1, user_1, e_17_1;
|
|
1227
|
+
var e_17, _a;
|
|
1303
1228
|
return tslib_1.__generator(this, function (_b) {
|
|
1304
1229
|
switch (_b.label) {
|
|
1305
1230
|
case 0:
|
|
@@ -1377,14 +1302,14 @@ module.exports = {
|
|
|
1377
1302
|
return [3, 8];
|
|
1378
1303
|
case 12: return [3, 15];
|
|
1379
1304
|
case 13:
|
|
1380
|
-
|
|
1381
|
-
|
|
1305
|
+
e_17_1 = _b.sent();
|
|
1306
|
+
e_17 = { error: e_17_1 };
|
|
1382
1307
|
return [3, 15];
|
|
1383
1308
|
case 14:
|
|
1384
1309
|
try {
|
|
1385
1310
|
if (users_1_1 && !users_1_1.done && (_a = users_1.return)) _a.call(users_1);
|
|
1386
1311
|
}
|
|
1387
|
-
finally { if (
|
|
1312
|
+
finally { if (e_17) throw e_17.error; }
|
|
1388
1313
|
return [7];
|
|
1389
1314
|
case 15: return [2, {
|
|
1390
1315
|
'新增90天未登录用户数量': users.length
|
|
@@ -1497,8 +1422,8 @@ module.exports = {
|
|
|
1497
1422
|
}
|
|
1498
1423
|
}, scanApprovalAndDeletedMaterialFromSharepoint: function (ctx) {
|
|
1499
1424
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1500
|
-
var logger, lastMonth, approvalRecords, approvalRecords_1, approvalRecords_1_1, approval,
|
|
1501
|
-
var
|
|
1425
|
+
var logger, lastMonth, approvalRecords, approvalRecords_1, approvalRecords_1_1, approval, e_18_1;
|
|
1426
|
+
var e_18, _a;
|
|
1502
1427
|
return tslib_1.__generator(this, function (_b) {
|
|
1503
1428
|
switch (_b.label) {
|
|
1504
1429
|
case 0: return [4, this.getLogger()];
|
|
@@ -1529,14 +1454,14 @@ module.exports = {
|
|
|
1529
1454
|
return [3, 4];
|
|
1530
1455
|
case 7: return [3, 10];
|
|
1531
1456
|
case 8:
|
|
1532
|
-
|
|
1533
|
-
|
|
1457
|
+
e_18_1 = _b.sent();
|
|
1458
|
+
e_18 = { error: e_18_1 };
|
|
1534
1459
|
return [3, 10];
|
|
1535
1460
|
case 9:
|
|
1536
1461
|
try {
|
|
1537
1462
|
if (approvalRecords_1_1 && !approvalRecords_1_1.done && (_a = approvalRecords_1.return)) _a.call(approvalRecords_1);
|
|
1538
1463
|
}
|
|
1539
|
-
finally { if (
|
|
1464
|
+
finally { if (e_18) throw e_18.error; }
|
|
1540
1465
|
return [7];
|
|
1541
1466
|
case 10: return [2];
|
|
1542
1467
|
}
|
|
@@ -1603,8 +1528,8 @@ module.exports = {
|
|
|
1603
1528
|
}
|
|
1604
1529
|
},
|
|
1605
1530
|
methods: tslib_1.__assign(tslib_1.__assign({}, _.pickBy(methods, _.isFunction)), { permanentlyDeleteApprovalAllMaterialFromSharePoint: function (ctx, approval) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
1606
|
-
var materialRecords, allSuccessful, materialRecords_1, materialRecords_1_1, material, downloaded, maxRetries, attempt, success, error_5,
|
|
1607
|
-
var
|
|
1531
|
+
var materialRecords, allSuccessful, materialRecords_1, materialRecords_1_1, material, downloaded, maxRetries, attempt, success, error_5, e_19_1, error_6;
|
|
1532
|
+
var e_19, _a;
|
|
1608
1533
|
return tslib_1.__generator(this, function (_b) {
|
|
1609
1534
|
switch (_b.label) {
|
|
1610
1535
|
case 0:
|
|
@@ -1696,14 +1621,14 @@ module.exports = {
|
|
|
1696
1621
|
return [3, 3];
|
|
1697
1622
|
case 17: return [3, 20];
|
|
1698
1623
|
case 18:
|
|
1699
|
-
|
|
1700
|
-
|
|
1624
|
+
e_19_1 = _b.sent();
|
|
1625
|
+
e_19 = { error: e_19_1 };
|
|
1701
1626
|
return [3, 20];
|
|
1702
1627
|
case 19:
|
|
1703
1628
|
try {
|
|
1704
1629
|
if (materialRecords_1_1 && !materialRecords_1_1.done && (_a = materialRecords_1.return)) _a.call(materialRecords_1);
|
|
1705
1630
|
}
|
|
1706
|
-
finally { if (
|
|
1631
|
+
finally { if (e_19) throw e_19.error; }
|
|
1707
1632
|
return [7];
|
|
1708
1633
|
case 20:
|
|
1709
1634
|
if (!allSuccessful) return [3, 23];
|