@things-factory/integration-base 4.3.310 → 4.3.367
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/service/index.js +12 -3
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/integration/integration.js +5 -0
- package/dist-server/service/integration/integration.js.map +1 -1
- package/dist-server/service/webhook/index.js +9 -0
- package/dist-server/service/webhook/index.js.map +1 -0
- package/dist-server/service/webhook/webhook-mutation.js +60 -0
- package/dist-server/service/webhook/webhook-mutation.js.map +1 -0
- package/dist-server/service/webhook/webhook-query.js +18 -0
- package/dist-server/service/webhook/webhook-query.js.map +1 -0
- package/dist-server/service/webhook/webhook-type.js +77 -0
- package/dist-server/service/webhook/webhook-type.js.map +1 -0
- package/dist-server/service/webhook/webhook.js +70 -0
- package/dist-server/service/webhook/webhook.js.map +1 -0
- package/dist-server/service/webhook-event/index.js +9 -0
- package/dist-server/service/webhook-event/index.js.map +1 -0
- package/dist-server/service/webhook-event/webhook-event-mutation.js +18 -0
- package/dist-server/service/webhook-event/webhook-event-mutation.js.map +1 -0
- package/dist-server/service/webhook-event/webhook-event-query.js +18 -0
- package/dist-server/service/webhook-event/webhook-event-query.js.map +1 -0
- package/dist-server/service/webhook-event/webhook-event-type.js +77 -0
- package/dist-server/service/webhook-event/webhook-event-type.js.map +1 -0
- package/dist-server/service/webhook-event/webhook-event.js +51 -0
- package/dist-server/service/webhook-event/webhook-event.js.map +1 -0
- package/package.json +2 -2
- package/server/service/index.ts +52 -11
- package/server/service/integration/integration.ts +4 -0
- package/server/service/webhook/index.ts +6 -0
- package/server/service/webhook/webhook-mutation.ts +55 -0
- package/server/service/webhook/webhook-query.ts +6 -0
- package/server/service/webhook/webhook-type.ts +51 -0
- package/server/service/webhook/webhook.ts +62 -0
- package/server/service/webhook-event/index.ts +6 -0
- package/server/service/webhook-event/webhook-event-mutation.ts +6 -0
- package/server/service/webhook-event/webhook-event-query.ts +6 -0
- package/server/service/webhook-event/webhook-event-type.ts +51 -0
- package/server/service/webhook-event/webhook-event.ts +43 -0
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createPayloadLog = exports.PayloadType = exports.schema = exports.entities = void 0;
|
|
17
|
+
exports.triggerWebhook = exports.createPayloadLog = exports.PayloadType = exports.schema = exports.entities = void 0;
|
|
18
18
|
const connection_1 = require("./connection");
|
|
19
19
|
const connector_1 = require("./connector");
|
|
20
20
|
const integration_1 = require("./integration");
|
|
@@ -24,6 +24,8 @@ const scenario_instance_1 = require("./scenario-instance");
|
|
|
24
24
|
const scenario_queue_1 = require("./scenario-queue");
|
|
25
25
|
const step_1 = require("./step");
|
|
26
26
|
const task_type_1 = require("./task-type");
|
|
27
|
+
const webhook_1 = require("./webhook");
|
|
28
|
+
const webhook_event_1 = require("./webhook-event");
|
|
27
29
|
__exportStar(require("./property-spec"), exports);
|
|
28
30
|
__exportStar(require("./task-type/task-type-type"), exports);
|
|
29
31
|
__exportStar(require("./connector/connector-type"), exports);
|
|
@@ -35,6 +37,7 @@ __exportStar(require("./step/step-type"), exports);
|
|
|
35
37
|
__exportStar(require("./scenario-flow/scenario-flow"), exports);
|
|
36
38
|
__exportStar(require("./payload-log/payload-log"), exports);
|
|
37
39
|
__exportStar(require("./integration/integration"), exports);
|
|
40
|
+
__exportStar(require("./webhook/webhook"), exports);
|
|
38
41
|
exports.entities = [
|
|
39
42
|
...task_type_1.entities,
|
|
40
43
|
...connector_1.entities,
|
|
@@ -44,7 +47,9 @@ exports.entities = [
|
|
|
44
47
|
...scenario_queue_1.entities,
|
|
45
48
|
...step_1.entities,
|
|
46
49
|
...payload_log_1.entities,
|
|
47
|
-
...integration_1.entities
|
|
50
|
+
...integration_1.entities,
|
|
51
|
+
...webhook_1.entities,
|
|
52
|
+
...webhook_event_1.entities
|
|
48
53
|
];
|
|
49
54
|
exports.schema = {
|
|
50
55
|
resolverClasses: [
|
|
@@ -56,11 +61,15 @@ exports.schema = {
|
|
|
56
61
|
...scenario_queue_1.resolvers,
|
|
57
62
|
...step_1.resolvers,
|
|
58
63
|
...payload_log_1.resolvers,
|
|
59
|
-
...integration_1.resolvers
|
|
64
|
+
...integration_1.resolvers,
|
|
65
|
+
...webhook_1.resolvers,
|
|
66
|
+
...webhook_event_1.resolvers
|
|
60
67
|
]
|
|
61
68
|
};
|
|
62
69
|
var payload_log_2 = require("./payload-log/payload-log");
|
|
63
70
|
Object.defineProperty(exports, "PayloadType", { enumerable: true, get: function () { return payload_log_2.PayloadType; } });
|
|
64
71
|
var payload_log_mutation_1 = require("./payload-log/payload-log-mutation");
|
|
65
72
|
Object.defineProperty(exports, "createPayloadLog", { enumerable: true, get: function () { return payload_log_mutation_1.createPayloadLog; } });
|
|
73
|
+
var webhook_mutation_1 = require("./webhook/webhook-mutation");
|
|
74
|
+
Object.defineProperty(exports, "triggerWebhook", { enumerable: true, get: function () { return webhook_mutation_1.triggerWebhook; } });
|
|
66
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAGqB;AACrB,2CAGoB;AACpB,+CAGsB;AACtB,+CAGsB;AACtB,yCAGmB;AACnB,2DAG4B;AAC5B,qDAGyB;AACzB,iCAGe;AACf,2CAGoB;AACpB,uCAGkB;AAClB,mDAGwB;AAExB,kDAA+B;AAC/B,6DAA0C;AAC1C,6DAA0C;AAC1C,+DAA4C;AAC5C,2DAAwC;AACxC,6EAA0D;AAC1D,uEAAoD;AACpD,mDAAgC;AAChC,gEAA6C;AAC7C,4DAAyC;AACzC,4DAAyC;AACzC,oDAAiC;AAEpB,QAAA,QAAQ,GAAG;IACtB,GAAG,oBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;IACxB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,sBAAmB;IACtB,GAAG,kBAAe;IAClB,GAAG,wBAAoB;CACxB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,GAAG,qBAAiB;QACpB,GAAG,qBAAkB;QACrB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,6BAAyB;QAC5B,GAAG,0BAAsB;QACzB,GAAG,gBAAa;QAChB,GAAG,uBAAmB;QACtB,GAAG,uBAAoB;QACvB,GAAG,mBAAgB;QACnB,GAAG,yBAAqB;KACzB;CACF,CAAA;AAED,yDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,2EAAqE;AAA5D,wHAAA,gBAAgB,OAAA;AACzB,+DAA2D;AAAlD,kHAAA,cAAc,OAAA"}
|
|
@@ -54,6 +54,11 @@ __decorate([
|
|
|
54
54
|
(0, typeorm_1.RelationId)((integration) => integration.bizplace),
|
|
55
55
|
__metadata("design:type", String)
|
|
56
56
|
], Integration.prototype, "bizplaceId", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], Integration.prototype, "urlCallback", void 0);
|
|
57
62
|
__decorate([
|
|
58
63
|
(0, typeorm_1.Column)(),
|
|
59
64
|
(0, type_graphql_1.Field)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../server/service/integration/integration.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAKqB;AACrB,qCASgB;AAEhB,yDAAgD;AAChD,uDAAmD;AACnD,6CAA4C;AAC5C,iDAA8C;AAE9C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,+CAAmC,CAAA;IACnC,6BAAiB,CAAA;AACnB,CAAC,EAJW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAInB;AAED,IAAA,+BAAgB,EAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAA;AAKK,IAAM,WAAW,GAAjB,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../server/service/integration/integration.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAKqB;AACrB,qCASgB;AAEhB,yDAAgD;AAChD,uDAAmD;AACnD,6CAA4C;AAC5C,iDAA8C;AAE9C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,+CAAmC,CAAA;IACnC,6BAAiB,CAAA;AACnB,CAAC,EAJW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAInB;AAED,IAAA,+BAAgB,EAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAA;AAKK,IAAM,WAAW,GAAjB,MAAM,WAAW;CA0FvB,CAAA;AAzFC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;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AAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;8CAC5C;AAzFP,WAAW;IAHvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;GACzC,WAAW,CA0FvB;AA1FY,kCAAW"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const webhook_1 = require("./webhook");
|
|
5
|
+
const webhook_query_1 = require("./webhook-query");
|
|
6
|
+
const webhook_mutation_1 = require("./webhook-mutation");
|
|
7
|
+
exports.entities = [webhook_1.Webhook];
|
|
8
|
+
exports.resolvers = [webhook_query_1.WebhookQuery, webhook_mutation_1.WebhookMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/webhook/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,mDAA8C;AAC9C,yDAAoD;AAEvC,QAAA,QAAQ,GAAG,CAAC,iBAAO,CAAC,CAAA;AACpB,QAAA,SAAS,GAAG,CAAC,4BAAY,EAAE,kCAAe,CAAC,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.triggerWebhook = exports.WebhookMutation = void 0;
|
|
10
|
+
const type_graphql_1 = require("type-graphql");
|
|
11
|
+
const webhook_1 = require("./webhook");
|
|
12
|
+
const axios = require('axios');
|
|
13
|
+
let WebhookMutation = class WebhookMutation {
|
|
14
|
+
};
|
|
15
|
+
WebhookMutation = __decorate([
|
|
16
|
+
(0, type_graphql_1.Resolver)(webhook_1.Webhook)
|
|
17
|
+
], WebhookMutation);
|
|
18
|
+
exports.WebhookMutation = WebhookMutation;
|
|
19
|
+
async function triggerWebhook(id, bizplaceIds, name, context) {
|
|
20
|
+
try {
|
|
21
|
+
const { tx } = context === null || context === void 0 ? void 0 : context.state;
|
|
22
|
+
let qb = await tx
|
|
23
|
+
.getRepository(webhook_1.Webhook)
|
|
24
|
+
.createQueryBuilder('webhook')
|
|
25
|
+
.innerJoinAndSelect('webhook.bizplaces', 'bz')
|
|
26
|
+
.innerJoinAndSelect('webhook.webhookEvents', 'webhookEvent')
|
|
27
|
+
.where('bz.id IN (:...bizplaceIds)', { bizplaceIds: bizplaceIds })
|
|
28
|
+
.andWhere('webhookEvent.name = :name', { name: name })
|
|
29
|
+
.andWhere(`webhook.active = 'TRUE'`);
|
|
30
|
+
const results = await qb.getMany();
|
|
31
|
+
if (results) {
|
|
32
|
+
await Promise.all(results.map(async (result) => {
|
|
33
|
+
for (const bizplace of result.bizplaces) {
|
|
34
|
+
const data = {
|
|
35
|
+
eventName: name,
|
|
36
|
+
id: id,
|
|
37
|
+
bizplaceId: bizplace.id,
|
|
38
|
+
timestamp: new Date()
|
|
39
|
+
};
|
|
40
|
+
const config = {
|
|
41
|
+
method: 'post',
|
|
42
|
+
url: result.targetUrl,
|
|
43
|
+
data
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
await axios(config);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.error(e.message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.error(e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.triggerWebhook = triggerWebhook;
|
|
60
|
+
//# sourceMappingURL=webhook-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-mutation.js","sourceRoot":"","sources":["../../../server/service/webhook/webhook-mutation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAuC;AAGvC,uCAAmC;AAEnC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAGvB,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,eAAe;IAD3B,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,eAAe,CAAG;AAAlB,0CAAe;AAErB,KAAK,UAAU,cAAc,CAAC,EAAU,EAAE,WAAqB,EAAE,IAAY,EAAE,OAAa;IACjG,IAAI;QACF,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAA;QAE7B,IAAI,EAAE,GAAgC,MAAM,EAAE;aAC3C,aAAa,CAAC,iBAAO,CAAC;aACtB,kBAAkB,CAAC,SAAS,CAAC;aAC7B,kBAAkB,CAAC,mBAAmB,EAAE,IAAI,CAAC;aAC7C,kBAAkB,CAAC,uBAAuB,EAAE,cAAc,CAAC;aAC3D,KAAK,CAAC,4BAA4B,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;aACjE,QAAQ,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;aACrD,QAAQ,CAAC,yBAAyB,CAAC,CAAA;QAEtC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;QAElC,IAAI,OAAO,EAAE;YACX,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;gBACzB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;oBACvC,MAAM,IAAI,GAAG;wBACX,SAAS,EAAE,IAAI;wBACf,EAAE,EAAE,EAAE;wBACN,UAAU,EAAE,QAAQ,CAAC,EAAE;wBACvB,SAAS,EAAE,IAAI,IAAI,EAAE;qBACtB,CAAA;oBAED,MAAM,MAAM,GAAG;wBACb,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,MAAM,CAAC,SAAS;wBACrB,IAAI;qBACL,CAAA;oBAED,IAAI;wBACF,MAAM,KAAK,CAAC,MAAM,CAAC,CAAA;qBACpB;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;qBACzB;iBACF;YACH,CAAC,CAAC,CACH,CAAA;SACF;KACF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACjB;AACH,CAAC;AA5CD,wCA4CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WebhookQuery = void 0;
|
|
10
|
+
const type_graphql_1 = require("type-graphql");
|
|
11
|
+
const webhook_1 = require("./webhook");
|
|
12
|
+
let WebhookQuery = class WebhookQuery {
|
|
13
|
+
};
|
|
14
|
+
WebhookQuery = __decorate([
|
|
15
|
+
(0, type_graphql_1.Resolver)(webhook_1.Webhook)
|
|
16
|
+
], WebhookQuery);
|
|
17
|
+
exports.WebhookQuery = WebhookQuery;
|
|
18
|
+
//# sourceMappingURL=webhook-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-query.js","sourceRoot":"","sources":["../../../server/service/webhook/webhook-query.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAuC;AAEvC,uCAAmC;AAG5B,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IADxB,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,YAAY,CAAG;AAAf,oCAAY"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebhookList = exports.WebhookPatch = exports.NewWebhook = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const webhook_1 = require("./webhook");
|
|
15
|
+
let NewWebhook = class NewWebhook {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], NewWebhook.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], NewWebhook.prototype, "description", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
+
__metadata("design:type", Boolean)
|
|
28
|
+
], NewWebhook.prototype, "active", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], NewWebhook.prototype, "params", void 0);
|
|
33
|
+
NewWebhook = __decorate([
|
|
34
|
+
(0, type_graphql_1.InputType)()
|
|
35
|
+
], NewWebhook);
|
|
36
|
+
exports.NewWebhook = NewWebhook;
|
|
37
|
+
let WebhookPatch = class WebhookPatch {
|
|
38
|
+
};
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], WebhookPatch.prototype, "id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], WebhookPatch.prototype, "name", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], WebhookPatch.prototype, "description", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
+
__metadata("design:type", Boolean)
|
|
54
|
+
], WebhookPatch.prototype, "active", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)(),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], WebhookPatch.prototype, "cuFlag", void 0);
|
|
59
|
+
WebhookPatch = __decorate([
|
|
60
|
+
(0, type_graphql_1.InputType)()
|
|
61
|
+
], WebhookPatch);
|
|
62
|
+
exports.WebhookPatch = WebhookPatch;
|
|
63
|
+
let WebhookList = class WebhookList {
|
|
64
|
+
};
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, type_graphql_1.Field)(type => [webhook_1.Webhook]),
|
|
67
|
+
__metadata("design:type", Array)
|
|
68
|
+
], WebhookList.prototype, "items", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], WebhookList.prototype, "total", void 0);
|
|
73
|
+
WebhookList = __decorate([
|
|
74
|
+
(0, type_graphql_1.ObjectType)()
|
|
75
|
+
], WebhookList);
|
|
76
|
+
exports.WebhookList = WebhookList;
|
|
77
|
+
//# sourceMappingURL=webhook-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-type.js","sourceRoot":"","sources":["../../../server/service/webhook/webhook-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAMqB;AAErB,uCAAmC;AAG5B,IAAM,UAAU,GAAhB,MAAM,UAAU;CAYtB,CAAA;AAXC;IAAC,IAAA,oBAAK,GAAE;;wCACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACX;AAXJ,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAYtB;AAZY,gCAAU;AAehB,IAAM,YAAY,GAAlB,MAAM,YAAY;CAexB,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAEhB;IAAC,IAAA,oBAAK,GAAE;;4CACM;AAdH,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAexB;AAfY,oCAAY;AAkBlB,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,CAAC;;0CACT;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;0CACN;AALF,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AANY,kCAAW"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Webhook = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const biz_base_1 = require("@things-factory/biz-base");
|
|
16
|
+
const webhook_event_1 = require("../webhook-event/webhook-event");
|
|
17
|
+
let Webhook = class Webhook {
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
21
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], Webhook.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)(),
|
|
26
|
+
(0, type_graphql_1.Field)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Webhook.prototype, "name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({
|
|
31
|
+
nullable: true
|
|
32
|
+
}),
|
|
33
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
34
|
+
__metadata("design:type", Boolean)
|
|
35
|
+
], Webhook.prototype, "active", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Webhook.prototype, "targetUrl", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.OneToMany)(type => webhook_event_1.WebhookEvent, webhookEvent => webhookEvent.webhook),
|
|
42
|
+
(0, type_graphql_1.Field)(type => [webhook_event_1.WebhookEvent], { nullable: true }),
|
|
43
|
+
__metadata("design:type", Array)
|
|
44
|
+
], Webhook.prototype, "webhookEvents", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.ManyToMany)(type => biz_base_1.Bizplace),
|
|
47
|
+
(0, typeorm_1.JoinTable)({ name: 'webhook_bizplaces' }),
|
|
48
|
+
(0, type_graphql_1.Field)(type => [biz_base_1.Bizplace]),
|
|
49
|
+
__metadata("design:type", Array)
|
|
50
|
+
], Webhook.prototype, "bizplaces", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
+
__metadata("design:type", Date
|
|
55
|
+
// targetUrl varchar [note:'Destination to POST event info to URL for webhooks']
|
|
56
|
+
// headers JSON [note:'Hook specific additional HTTP headers that should be added to HTTP request, stored as JSON blob']
|
|
57
|
+
// properties JSON [note:'Hook specific additional data that should be added to payload, stored as JSON blob']
|
|
58
|
+
// includeTime bool [note:'To include sending timestamp during hashing']
|
|
59
|
+
// algorithm enum [note:'none, HS256, RS256']
|
|
60
|
+
// publicKey varchar [note:'System Generated. Public key used for generating/verify signature, so that powrhub can use to sign or receiver can verify that call came from this server. Used when as sign and verification key for HS256 and RS256']
|
|
61
|
+
// privateKey varchar [note:'System Generated. Private key used for generating signature, so that powrhub can use to sign, only for RS256']
|
|
62
|
+
)
|
|
63
|
+
], Webhook.prototype, "createdAt", void 0);
|
|
64
|
+
Webhook = __decorate([
|
|
65
|
+
(0, typeorm_1.Entity)(),
|
|
66
|
+
(0, typeorm_1.Index)('ix_webhook_0', (webhook) => [webhook.name], { unique: true }),
|
|
67
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for Webhook' })
|
|
68
|
+
], Webhook);
|
|
69
|
+
exports.Webhook = Webhook;
|
|
70
|
+
//# sourceMappingURL=webhook.js.map
|
|
@@ -0,0 +1 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AA2I;;0CAR3H;AA7BL,OAAO;IAHnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7E,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;GACrC,OAAO,CAsCnB;AAtCY,0BAAO"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const webhook_event_1 = require("./webhook-event");
|
|
5
|
+
const webhook_event_query_1 = require("./webhook-event-query");
|
|
6
|
+
const webhook_event_mutation_1 = require("./webhook-event-mutation");
|
|
7
|
+
exports.entities = [webhook_event_1.WebhookEvent];
|
|
8
|
+
exports.resolvers = [webhook_event_query_1.WebhookEventQuery, webhook_event_mutation_1.WebhookEventMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/webhook-event/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,+DAAyD;AACzD,qEAA+D;AAElD,QAAA,QAAQ,GAAG,CAAC,4BAAY,CAAC,CAAA;AACzB,QAAA,SAAS,GAAG,CAAC,uCAAiB,EAAE,6CAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WebhookEventMutation = void 0;
|
|
10
|
+
const type_graphql_1 = require("type-graphql");
|
|
11
|
+
const webhook_event_1 = require("./webhook-event");
|
|
12
|
+
let WebhookEventMutation = class WebhookEventMutation {
|
|
13
|
+
};
|
|
14
|
+
WebhookEventMutation = __decorate([
|
|
15
|
+
(0, type_graphql_1.Resolver)(webhook_event_1.WebhookEvent)
|
|
16
|
+
], WebhookEventMutation);
|
|
17
|
+
exports.WebhookEventMutation = WebhookEventMutation;
|
|
18
|
+
//# sourceMappingURL=webhook-event-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-event-mutation.js","sourceRoot":"","sources":["../../../server/service/webhook-event/webhook-event-mutation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAuC;AAEvC,mDAA8C;AAGvC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CAAG;AAAvB,oDAAoB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WebhookEventQuery = void 0;
|
|
10
|
+
const type_graphql_1 = require("type-graphql");
|
|
11
|
+
const webhook_event_1 = require("./webhook-event");
|
|
12
|
+
let WebhookEventQuery = class WebhookEventQuery {
|
|
13
|
+
};
|
|
14
|
+
WebhookEventQuery = __decorate([
|
|
15
|
+
(0, type_graphql_1.Resolver)(webhook_event_1.WebhookEvent)
|
|
16
|
+
], WebhookEventQuery);
|
|
17
|
+
exports.WebhookEventQuery = WebhookEventQuery;
|
|
18
|
+
//# sourceMappingURL=webhook-event-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-event-query.js","sourceRoot":"","sources":["../../../server/service/webhook-event/webhook-event-query.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAuC;AAEvC,mDAA8C;AAGvC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CAAG;AAApB,8CAAiB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebhookEventList = exports.WebhookEventPatch = exports.NewWebhookEvent = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const webhook_event_1 = require("./webhook-event");
|
|
15
|
+
let NewWebhookEvent = class NewWebhookEvent {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], NewWebhookEvent.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], NewWebhookEvent.prototype, "description", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
+
__metadata("design:type", Boolean)
|
|
28
|
+
], NewWebhookEvent.prototype, "active", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], NewWebhookEvent.prototype, "params", void 0);
|
|
33
|
+
NewWebhookEvent = __decorate([
|
|
34
|
+
(0, type_graphql_1.InputType)()
|
|
35
|
+
], NewWebhookEvent);
|
|
36
|
+
exports.NewWebhookEvent = NewWebhookEvent;
|
|
37
|
+
let WebhookEventPatch = class WebhookEventPatch {
|
|
38
|
+
};
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], WebhookEventPatch.prototype, "id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], WebhookEventPatch.prototype, "name", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], WebhookEventPatch.prototype, "description", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
+
__metadata("design:type", Boolean)
|
|
54
|
+
], WebhookEventPatch.prototype, "active", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)(),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], WebhookEventPatch.prototype, "cuFlag", void 0);
|
|
59
|
+
WebhookEventPatch = __decorate([
|
|
60
|
+
(0, type_graphql_1.InputType)()
|
|
61
|
+
], WebhookEventPatch);
|
|
62
|
+
exports.WebhookEventPatch = WebhookEventPatch;
|
|
63
|
+
let WebhookEventList = class WebhookEventList {
|
|
64
|
+
};
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, type_graphql_1.Field)(type => [webhook_event_1.WebhookEvent]),
|
|
67
|
+
__metadata("design:type", Array)
|
|
68
|
+
], WebhookEventList.prototype, "items", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], WebhookEventList.prototype, "total", void 0);
|
|
73
|
+
WebhookEventList = __decorate([
|
|
74
|
+
(0, type_graphql_1.ObjectType)()
|
|
75
|
+
], WebhookEventList);
|
|
76
|
+
exports.WebhookEventList = WebhookEventList;
|
|
77
|
+
//# sourceMappingURL=webhook-event-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-event-type.js","sourceRoot":"","sources":["../../../server/service/webhook-event/webhook-event-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAMqB;AAErB,mDAA8C;AAGvC,IAAM,eAAe,GAArB,MAAM,eAAe;CAY3B,CAAA;AAXC;IAAC,IAAA,oBAAK,GAAE;;6CACI;AAEZ;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 ? 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebhookEvent = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const webhook_1 = require("../webhook/webhook");
|
|
16
|
+
let WebhookEvent = class WebhookEvent {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
20
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], WebhookEvent.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.Column)(),
|
|
25
|
+
(0, type_graphql_1.Field)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], WebhookEvent.prototype, "name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.ManyToOne)(type => webhook_1.Webhook, { nullable: true }),
|
|
30
|
+
(0, type_graphql_1.Field)(type => webhook_1.Webhook),
|
|
31
|
+
__metadata("design:type", webhook_1.Webhook)
|
|
32
|
+
], WebhookEvent.prototype, "webhook", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.RelationId)((webhookEvent) => webhookEvent.webhook),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], WebhookEvent.prototype, "webhookId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, type_graphql_1.Field)(),
|
|
39
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
+
__metadata("design:type", Date)
|
|
42
|
+
], WebhookEvent.prototype, "createdAt", void 0);
|
|
43
|
+
WebhookEvent = __decorate([
|
|
44
|
+
(0, typeorm_1.Entity)(),
|
|
45
|
+
(0, typeorm_1.Index)('ix_webhook_event_0', (webhookEvent) => [webhookEvent.name, webhookEvent.webhook], {
|
|
46
|
+
unique: true
|
|
47
|
+
}),
|
|
48
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for WebhookEvent' })
|
|
49
|
+
], WebhookEvent);
|
|
50
|
+
exports.WebhookEvent = WebhookEvent;
|
|
51
|
+
//# sourceMappingURL=webhook-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-event.js","sourceRoot":"","sources":["../../../server/service/webhook-event/webhook-event.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAIqB;AACrB,qCAQgB;AAEhB,gDAA4C;AAOrC,IAAM,YAAY,GAAlB,MAAM,YAAY;CAoBxB,CAAA;AAnBC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;wCACC;AAEnB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;0CACI;AAEZ;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;8BACb,iBAAO;6CAAA;AAEjB;IAAC,IAAA,oBAAU,EAAC,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;;+CAC/C;AAElB;IAAC,IAAA,oBAAK,GAAE;IACP,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;+CAAA;AAnBL,YAAY;IALxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE;QACtG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CAoBxB;AApBY,oCAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-base",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.367",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"promise-socket": "^7.0.0",
|
|
41
41
|
"vm2": "^3.9.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7ca4aeb73080cd52d7058fe97e6cbb2cc431a80d"
|
|
44
44
|
}
|
package/server/service/index.ts
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
entities as ConnectionEntities,
|
|
3
|
+
resolvers as ConnectionResolvers
|
|
4
|
+
} from './connection'
|
|
5
|
+
import {
|
|
6
|
+
entities as ConnectorEntities,
|
|
7
|
+
resolvers as ConnectorResolvers
|
|
8
|
+
} from './connector'
|
|
9
|
+
import {
|
|
10
|
+
entities as IntegrationEntities,
|
|
11
|
+
resolvers as IntegrationResolvers
|
|
12
|
+
} from './integration'
|
|
13
|
+
import {
|
|
14
|
+
entities as PayloadLogEntities,
|
|
15
|
+
resolvers as PayloadLogResolvers
|
|
16
|
+
} from './payload-log'
|
|
17
|
+
import {
|
|
18
|
+
entities as ScenarioEntities,
|
|
19
|
+
resolvers as ScenarioResolvers
|
|
20
|
+
} from './scenario'
|
|
21
|
+
import {
|
|
22
|
+
entities as ScenarioInstanceEntities,
|
|
23
|
+
resolvers as ScenarioInstanceResolvers
|
|
24
|
+
} from './scenario-instance'
|
|
25
|
+
import {
|
|
26
|
+
entities as ScenarioQueueEntities,
|
|
27
|
+
resolvers as ScenarioQueueResolvers
|
|
28
|
+
} from './scenario-queue'
|
|
29
|
+
import {
|
|
30
|
+
entities as StepEntities,
|
|
31
|
+
resolvers as StepResolvers
|
|
32
|
+
} from './step'
|
|
33
|
+
import {
|
|
34
|
+
entities as TaskTypeEntities,
|
|
35
|
+
resolvers as TaskTypeResolvers
|
|
36
|
+
} from './task-type'
|
|
37
|
+
import {
|
|
38
|
+
entities as WebhookEntities,
|
|
39
|
+
resolvers as WebhookResolvers
|
|
40
|
+
} from './webhook'
|
|
41
|
+
import {
|
|
42
|
+
entities as WebhookEventEntities,
|
|
43
|
+
resolvers as WebhookEventResolvers
|
|
44
|
+
} from './webhook-event'
|
|
10
45
|
|
|
11
46
|
export * from './property-spec'
|
|
12
47
|
export * from './task-type/task-type-type'
|
|
@@ -19,6 +54,7 @@ export * from './step/step-type'
|
|
|
19
54
|
export * from './scenario-flow/scenario-flow'
|
|
20
55
|
export * from './payload-log/payload-log'
|
|
21
56
|
export * from './integration/integration'
|
|
57
|
+
export * from './webhook/webhook'
|
|
22
58
|
|
|
23
59
|
export const entities = [
|
|
24
60
|
...TaskTypeEntities,
|
|
@@ -29,7 +65,9 @@ export const entities = [
|
|
|
29
65
|
...ScenarioQueueEntities,
|
|
30
66
|
...StepEntities,
|
|
31
67
|
...PayloadLogEntities,
|
|
32
|
-
...IntegrationEntities
|
|
68
|
+
...IntegrationEntities,
|
|
69
|
+
...WebhookEntities,
|
|
70
|
+
...WebhookEventEntities
|
|
33
71
|
]
|
|
34
72
|
|
|
35
73
|
export const schema = {
|
|
@@ -42,9 +80,12 @@ export const schema = {
|
|
|
42
80
|
...ScenarioQueueResolvers,
|
|
43
81
|
...StepResolvers,
|
|
44
82
|
...PayloadLogResolvers,
|
|
45
|
-
...IntegrationResolvers
|
|
83
|
+
...IntegrationResolvers,
|
|
84
|
+
...WebhookResolvers,
|
|
85
|
+
...WebhookEventResolvers
|
|
46
86
|
]
|
|
47
87
|
}
|
|
48
88
|
|
|
49
89
|
export { PayloadType } from './payload-log/payload-log'
|
|
50
90
|
export { createPayloadLog } from './payload-log/payload-log-mutation'
|
|
91
|
+
export { triggerWebhook } from './webhook/webhook-mutation'
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Resolver } from 'type-graphql'
|
|
2
|
+
import { SelectQueryBuilder } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { Webhook } from './webhook'
|
|
5
|
+
|
|
6
|
+
const axios = require('axios')
|
|
7
|
+
|
|
8
|
+
@Resolver(Webhook)
|
|
9
|
+
export class WebhookMutation {}
|
|
10
|
+
|
|
11
|
+
export async function triggerWebhook(id: string, bizplaceIds: string[], name: string, context?: any): Promise<void> {
|
|
12
|
+
try {
|
|
13
|
+
const { tx } = context?.state
|
|
14
|
+
|
|
15
|
+
let qb: SelectQueryBuilder<Webhook> = await tx
|
|
16
|
+
.getRepository(Webhook)
|
|
17
|
+
.createQueryBuilder('webhook')
|
|
18
|
+
.innerJoinAndSelect('webhook.bizplaces', 'bz')
|
|
19
|
+
.innerJoinAndSelect('webhook.webhookEvents', 'webhookEvent')
|
|
20
|
+
.where('bz.id IN (:...bizplaceIds)', { bizplaceIds: bizplaceIds })
|
|
21
|
+
.andWhere('webhookEvent.name = :name', { name: name })
|
|
22
|
+
.andWhere(`webhook.active = 'TRUE'`)
|
|
23
|
+
|
|
24
|
+
const results = await qb.getMany()
|
|
25
|
+
|
|
26
|
+
if (results) {
|
|
27
|
+
await Promise.all(
|
|
28
|
+
results.map(async result => {
|
|
29
|
+
for (const bizplace of result.bizplaces) {
|
|
30
|
+
const data = {
|
|
31
|
+
eventName: name,
|
|
32
|
+
id: id,
|
|
33
|
+
bizplaceId: bizplace.id,
|
|
34
|
+
timestamp: new Date()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const config = {
|
|
38
|
+
method: 'post',
|
|
39
|
+
url: result.targetUrl,
|
|
40
|
+
data
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await axios(config)
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error(e.message)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error(e)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
ID,
|
|
4
|
+
InputType,
|
|
5
|
+
Int,
|
|
6
|
+
ObjectType
|
|
7
|
+
} from 'type-graphql'
|
|
8
|
+
|
|
9
|
+
import { Webhook } from './webhook'
|
|
10
|
+
|
|
11
|
+
@InputType()
|
|
12
|
+
export class NewWebhook {
|
|
13
|
+
@Field()
|
|
14
|
+
name: string
|
|
15
|
+
|
|
16
|
+
@Field({ nullable: true })
|
|
17
|
+
description?: string
|
|
18
|
+
|
|
19
|
+
@Field({ nullable: true })
|
|
20
|
+
active?: boolean
|
|
21
|
+
|
|
22
|
+
@Field({ nullable: true })
|
|
23
|
+
params?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@InputType()
|
|
27
|
+
export class WebhookPatch {
|
|
28
|
+
@Field(type => ID, { nullable: true })
|
|
29
|
+
id?: string
|
|
30
|
+
|
|
31
|
+
@Field({ nullable: true })
|
|
32
|
+
name?: string
|
|
33
|
+
|
|
34
|
+
@Field({ nullable: true })
|
|
35
|
+
description?: string
|
|
36
|
+
|
|
37
|
+
@Field({ nullable: true })
|
|
38
|
+
active?: boolean
|
|
39
|
+
|
|
40
|
+
@Field()
|
|
41
|
+
cuFlag: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ObjectType()
|
|
45
|
+
export class WebhookList {
|
|
46
|
+
@Field(type => [Webhook])
|
|
47
|
+
items: Webhook[]
|
|
48
|
+
|
|
49
|
+
@Field(type => Int)
|
|
50
|
+
total: number
|
|
51
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
ID,
|
|
4
|
+
ObjectType
|
|
5
|
+
} from 'type-graphql'
|
|
6
|
+
import {
|
|
7
|
+
Column,
|
|
8
|
+
CreateDateColumn,
|
|
9
|
+
Entity,
|
|
10
|
+
Index,
|
|
11
|
+
JoinTable,
|
|
12
|
+
ManyToMany,
|
|
13
|
+
OneToMany,
|
|
14
|
+
PrimaryGeneratedColumn
|
|
15
|
+
} from 'typeorm'
|
|
16
|
+
|
|
17
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
18
|
+
|
|
19
|
+
import { WebhookEvent } from '../webhook-event/webhook-event'
|
|
20
|
+
|
|
21
|
+
@Entity()
|
|
22
|
+
@Index('ix_webhook_0', (webhook: Webhook) => [webhook.name], { unique: true })
|
|
23
|
+
@ObjectType({ description: 'Entity for Webhook' })
|
|
24
|
+
export class Webhook {
|
|
25
|
+
@PrimaryGeneratedColumn('uuid')
|
|
26
|
+
@Field(type => ID)
|
|
27
|
+
readonly id: string
|
|
28
|
+
|
|
29
|
+
@Column()
|
|
30
|
+
@Field()
|
|
31
|
+
name: string
|
|
32
|
+
|
|
33
|
+
@Column({
|
|
34
|
+
nullable: true
|
|
35
|
+
})
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
active?: boolean
|
|
38
|
+
|
|
39
|
+
@Column()
|
|
40
|
+
targetUrl?: string
|
|
41
|
+
|
|
42
|
+
@OneToMany(type => WebhookEvent, webhookEvent => webhookEvent.webhook)
|
|
43
|
+
@Field(type => [WebhookEvent], { nullable: true })
|
|
44
|
+
webhookEvents: WebhookEvent[]
|
|
45
|
+
|
|
46
|
+
@ManyToMany(type => Bizplace)
|
|
47
|
+
@JoinTable({ name: 'webhook_bizplaces' })
|
|
48
|
+
@Field(type => [Bizplace])
|
|
49
|
+
bizplaces?: Bizplace[]
|
|
50
|
+
|
|
51
|
+
@CreateDateColumn()
|
|
52
|
+
@Field({ nullable: true })
|
|
53
|
+
createdAt?: Date
|
|
54
|
+
|
|
55
|
+
// targetUrl varchar [note:'Destination to POST event info to URL for webhooks']
|
|
56
|
+
// headers JSON [note:'Hook specific additional HTTP headers that should be added to HTTP request, stored as JSON blob']
|
|
57
|
+
// properties JSON [note:'Hook specific additional data that should be added to payload, stored as JSON blob']
|
|
58
|
+
// includeTime bool [note:'To include sending timestamp during hashing']
|
|
59
|
+
// algorithm enum [note:'none, HS256, RS256']
|
|
60
|
+
// publicKey varchar [note:'System Generated. Public key used for generating/verify signature, so that powrhub can use to sign or receiver can verify that call came from this server. Used when as sign and verification key for HS256 and RS256']
|
|
61
|
+
// privateKey varchar [note:'System Generated. Private key used for generating signature, so that powrhub can use to sign, only for RS256']
|
|
62
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WebhookEvent } from './webhook-event'
|
|
2
|
+
import { WebhookEventQuery } from './webhook-event-query'
|
|
3
|
+
import { WebhookEventMutation } from './webhook-event-mutation'
|
|
4
|
+
|
|
5
|
+
export const entities = [WebhookEvent]
|
|
6
|
+
export const resolvers = [WebhookEventQuery, WebhookEventMutation]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
ID,
|
|
4
|
+
InputType,
|
|
5
|
+
Int,
|
|
6
|
+
ObjectType
|
|
7
|
+
} from 'type-graphql'
|
|
8
|
+
|
|
9
|
+
import { WebhookEvent } from './webhook-event'
|
|
10
|
+
|
|
11
|
+
@InputType()
|
|
12
|
+
export class NewWebhookEvent {
|
|
13
|
+
@Field()
|
|
14
|
+
name: string
|
|
15
|
+
|
|
16
|
+
@Field({ nullable: true })
|
|
17
|
+
description?: string
|
|
18
|
+
|
|
19
|
+
@Field({ nullable: true })
|
|
20
|
+
active?: boolean
|
|
21
|
+
|
|
22
|
+
@Field({ nullable: true })
|
|
23
|
+
params?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@InputType()
|
|
27
|
+
export class WebhookEventPatch {
|
|
28
|
+
@Field(type => ID, { nullable: true })
|
|
29
|
+
id?: string
|
|
30
|
+
|
|
31
|
+
@Field({ nullable: true })
|
|
32
|
+
name?: string
|
|
33
|
+
|
|
34
|
+
@Field({ nullable: true })
|
|
35
|
+
description?: string
|
|
36
|
+
|
|
37
|
+
@Field({ nullable: true })
|
|
38
|
+
active?: boolean
|
|
39
|
+
|
|
40
|
+
@Field()
|
|
41
|
+
cuFlag: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ObjectType()
|
|
45
|
+
export class WebhookEventList {
|
|
46
|
+
@Field(type => [WebhookEvent])
|
|
47
|
+
items: WebhookEvent[]
|
|
48
|
+
|
|
49
|
+
@Field(type => Int)
|
|
50
|
+
total: number
|
|
51
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
ID,
|
|
4
|
+
ObjectType
|
|
5
|
+
} from 'type-graphql'
|
|
6
|
+
import {
|
|
7
|
+
Column,
|
|
8
|
+
CreateDateColumn,
|
|
9
|
+
Entity,
|
|
10
|
+
Index,
|
|
11
|
+
ManyToOne,
|
|
12
|
+
PrimaryGeneratedColumn,
|
|
13
|
+
RelationId
|
|
14
|
+
} from 'typeorm'
|
|
15
|
+
|
|
16
|
+
import { Webhook } from '../webhook/webhook'
|
|
17
|
+
|
|
18
|
+
@Entity()
|
|
19
|
+
@Index('ix_webhook_event_0', (webhookEvent: WebhookEvent) => [webhookEvent.name, webhookEvent.webhook], {
|
|
20
|
+
unique: true
|
|
21
|
+
})
|
|
22
|
+
@ObjectType({ description: 'Entity for WebhookEvent' })
|
|
23
|
+
export class WebhookEvent {
|
|
24
|
+
@PrimaryGeneratedColumn('uuid')
|
|
25
|
+
@Field(type => ID)
|
|
26
|
+
readonly id: string
|
|
27
|
+
|
|
28
|
+
@Column()
|
|
29
|
+
@Field()
|
|
30
|
+
name: string
|
|
31
|
+
|
|
32
|
+
@ManyToOne(type => Webhook, { nullable: true })
|
|
33
|
+
@Field(type => Webhook)
|
|
34
|
+
webhook?: Webhook
|
|
35
|
+
|
|
36
|
+
@RelationId((webhookEvent: WebhookEvent) => webhookEvent.webhook)
|
|
37
|
+
webhookId?: string
|
|
38
|
+
|
|
39
|
+
@Field()
|
|
40
|
+
@CreateDateColumn()
|
|
41
|
+
@Field({ nullable: true })
|
|
42
|
+
createdAt?: Date
|
|
43
|
+
}
|