@mainsail/webhooks 0.0.1-alpha.11 → 0.0.1-alpha.12
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/distribution/conditions.js +3 -6
- package/distribution/conditions.js.map +1 -1
- package/distribution/database.d.ts +2 -2
- package/distribution/database.d.ts.map +1 -1
- package/distribution/database.js +28 -27
- package/distribution/database.js.map +1 -1
- package/distribution/defaults.js +7 -10
- package/distribution/defaults.js.map +1 -1
- package/distribution/events.js +2 -5
- package/distribution/events.js.map +1 -1
- package/distribution/identifiers.js +1 -4
- package/distribution/identifiers.js.map +1 -1
- package/distribution/index.d.ts +1 -1
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +1 -17
- package/distribution/index.js.map +1 -1
- package/distribution/interfaces.js +1 -2
- package/distribution/listener.d.ts +1 -1
- package/distribution/listener.d.ts.map +1 -1
- package/distribution/listener.js +21 -24
- package/distribution/listener.js.map +1 -1
- package/distribution/server/index.d.ts +1 -1
- package/distribution/server/index.d.ts.map +1 -1
- package/distribution/server/index.js +1 -17
- package/distribution/server/index.js.map +1 -1
- package/distribution/server/plugins/whitelist.js +5 -11
- package/distribution/server/plugins/whitelist.js.map +1 -1
- package/distribution/server/schema.js +32 -38
- package/distribution/server/schema.js.map +1 -1
- package/distribution/server/server.d.ts +1 -1
- package/distribution/server/server.d.ts.map +1 -1
- package/distribution/server/server.js +34 -60
- package/distribution/server/server.js.map +1 -1
- package/distribution/server/utils.d.ts +1 -1
- package/distribution/server/utils.d.ts.map +1 -1
- package/distribution/server/utils.js +3 -8
- package/distribution/server/utils.js.map +1 -1
- package/distribution/service-provider.js +24 -31
- package/distribution/service-provider.js.map +1 -1
- package/package.json +11 -10
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.conditions = void 0;
|
|
4
|
-
const utils_1 = require("@mainsail/utils");
|
|
1
|
+
import { BigNumber } from "@mainsail/utils";
|
|
5
2
|
const toBoolean = (value) => value.toString().toLowerCase().trim() === "true";
|
|
6
3
|
const compareBigNumber = (value, expected, comparison) => {
|
|
7
4
|
try {
|
|
8
|
-
return
|
|
5
|
+
return BigNumber.make(value)[comparison](expected);
|
|
9
6
|
}
|
|
10
7
|
catch {
|
|
11
8
|
return false;
|
|
@@ -23,7 +20,7 @@ const ne = (actual, expected) => !eq(actual, expected);
|
|
|
23
20
|
const notBetween = (actual, expected) => !between(actual, expected);
|
|
24
21
|
const regexp = (actual, expected) => new RegExp(expected).test(actual);
|
|
25
22
|
const truthy = (actual) => actual === true || toBoolean(actual);
|
|
26
|
-
|
|
23
|
+
export const conditions = {
|
|
27
24
|
between,
|
|
28
25
|
contains,
|
|
29
26
|
eq,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../source/conditions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../source/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,SAAS,GAAG,CAAC,KAAK,EAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;AAEvF,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAW,EAAE;IACjE,IAAI,CAAC;QACJ,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE1E,MA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Q,EAAW,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEhF,MAAM,MAAM,GAAG,CAAC,MAAM,EAAW,EAAE,CAAC,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,OAAO;IACP,QAAQ;IACR,EAAE;IACF,KAAK;IACL,EAAE;IACF,GAAG;IACH,EAAE;IACF,GAAG;IACH,EAAE;IACF,UAAU;IACV,MAAM;IACN,MAAM;CACN,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Webhook } from "./interfaces";
|
|
1
|
+
import { Webhook } from "./interfaces.js";
|
|
2
2
|
export declare class Database {
|
|
3
3
|
#private;
|
|
4
4
|
private readonly app;
|
|
@@ -8,7 +8,7 @@ export declare class Database {
|
|
|
8
8
|
findById(id: string): Webhook | undefined;
|
|
9
9
|
findByEvent(event: string): Webhook[];
|
|
10
10
|
create(data: Webhook): Webhook | undefined;
|
|
11
|
-
update(id: string, data: Webhook): Webhook;
|
|
11
|
+
update(id: string, data: Webhook): Webhook | undefined;
|
|
12
12
|
destroy(id: string): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=database.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../source/database.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../source/database.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,qBACa,QAAQ;;IAEpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAI7C,IAAI;IAUJ,GAAG,IAAI,OAAO,EAAE;IAIhB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI5B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIzC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE;IAIrC,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAS1C,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAUtD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;CAIhC"}
|
package/distribution/database.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -19,61 +18,63 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
18
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
19
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
20
|
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
21
|
var _Database_database;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const uuid_1 = require("uuid");
|
|
22
|
+
import { inject, injectable } from "@mainsail/container";
|
|
23
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
|
24
|
+
import { existsSync } from "fs";
|
|
25
|
+
import { ensureFileSync } from "fs-extra/esm";
|
|
26
|
+
import { LowSync } from "lowdb";
|
|
27
|
+
import { JSONFileSync } from "lowdb/node";
|
|
28
|
+
import { v4 as uuidv4 } from "uuid";
|
|
34
29
|
let Database = class Database {
|
|
35
30
|
constructor() {
|
|
36
31
|
_Database_database.set(this, void 0);
|
|
37
32
|
}
|
|
38
33
|
boot() {
|
|
39
34
|
const adapterFile = this.app.cachePath("webhooks.json");
|
|
40
|
-
if (!
|
|
41
|
-
|
|
35
|
+
if (!existsSync(adapterFile)) {
|
|
36
|
+
ensureFileSync(adapterFile);
|
|
42
37
|
}
|
|
43
|
-
__classPrivateFieldSet(this, _Database_database,
|
|
44
|
-
__classPrivateFieldGet(this, _Database_database, "f").defaults({ webhooks: [] }).write();
|
|
38
|
+
__classPrivateFieldSet(this, _Database_database, new LowSync(new JSONFileSync(adapterFile), { webhooks: [] }), "f");
|
|
45
39
|
}
|
|
46
40
|
all() {
|
|
47
|
-
return __classPrivateFieldGet(this, _Database_database, "f").
|
|
41
|
+
return __classPrivateFieldGet(this, _Database_database, "f").data.webhooks;
|
|
48
42
|
}
|
|
49
43
|
hasById(id) {
|
|
50
44
|
return !!this.findById(id);
|
|
51
45
|
}
|
|
52
46
|
findById(id) {
|
|
53
|
-
return __classPrivateFieldGet(this, _Database_database, "f").
|
|
47
|
+
return __classPrivateFieldGet(this, _Database_database, "f").data.webhooks.find((webhook) => webhook.id === id);
|
|
54
48
|
}
|
|
55
49
|
findByEvent(event) {
|
|
56
|
-
return __classPrivateFieldGet(this, _Database_database, "f").
|
|
50
|
+
return __classPrivateFieldGet(this, _Database_database, "f").data.webhooks.filter((webhook) => webhook.event === event);
|
|
57
51
|
}
|
|
58
52
|
create(data) {
|
|
59
|
-
data.id = (
|
|
60
|
-
__classPrivateFieldGet(this, _Database_database, "f").
|
|
53
|
+
data.id = uuidv4();
|
|
54
|
+
__classPrivateFieldGet(this, _Database_database, "f").data.webhooks.push(data);
|
|
55
|
+
__classPrivateFieldGet(this, _Database_database, "f").write();
|
|
61
56
|
return this.findById(data.id);
|
|
62
57
|
}
|
|
63
58
|
update(id, data) {
|
|
64
|
-
|
|
59
|
+
const webhook = __classPrivateFieldGet(this, _Database_database, "f").data.webhooks.find((webhook) => webhook.id === id);
|
|
60
|
+
if (webhook) {
|
|
61
|
+
Object.assign(webhook, data);
|
|
62
|
+
__classPrivateFieldGet(this, _Database_database, "f").write();
|
|
63
|
+
}
|
|
64
|
+
return webhook;
|
|
65
65
|
}
|
|
66
66
|
destroy(id) {
|
|
67
|
-
__classPrivateFieldGet(this, _Database_database, "f").
|
|
67
|
+
__classPrivateFieldGet(this, _Database_database, "f").data.webhooks = __classPrivateFieldGet(this, _Database_database, "f").data.webhooks.filter((webhook) => webhook.id !== id);
|
|
68
|
+
__classPrivateFieldGet(this, _Database_database, "f").write();
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
|
-
exports.Database = Database;
|
|
71
71
|
_Database_database = new WeakMap();
|
|
72
72
|
__decorate([
|
|
73
|
-
|
|
73
|
+
inject(Identifiers.Application.Instance),
|
|
74
74
|
__metadata("design:type", Object)
|
|
75
75
|
], Database.prototype, "app", void 0);
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
Database = __decorate([
|
|
77
|
+
injectable()
|
|
78
78
|
], Database);
|
|
79
|
+
export { Database };
|
|
79
80
|
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../source/database.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../source/database.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;A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I,CAAC,CAAC;QACxC,uBAAA,IAAI,0BAAU,CAAC,KAAK,EAAE,CAAC;QAEvB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,EAAU,EAAE,IAAa;QACtC,MAAM,OAAO,GAAG,uBAAA,IAAI,0BAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAClF,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC7B,uBAAA,IAAI,0BAAU,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;IAEM,OAAO,CAAC,EAAU;QACxB,uBAAA,IAAI,0BAAU,CAAC,IAAI,CAAC,QAAQ,GAAG,uBAAA,IAAI,0BAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACnG,uBAAA,IAAI,0BAAU,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACD,CAAA;;AArDiB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;qCACW;AAFxC,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CAuDpB"}
|
package/distribution/defaults.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const kernel_1 = require("@mainsail/kernel");
|
|
6
|
-
exports.defaults = {
|
|
7
|
-
enabled: kernel_1.Environment.isTrue(contracts_1.Constants.EnvironmentVariables.CORE_WEBHOOKS_ENABLED),
|
|
1
|
+
import { Constants } from "@mainsail/contracts";
|
|
2
|
+
import { Environment } from "@mainsail/kernel";
|
|
3
|
+
export const defaults = {
|
|
4
|
+
enabled: Environment.isTrue(Constants.EnvironmentVariables.CORE_WEBHOOKS_ENABLED),
|
|
8
5
|
server: {
|
|
9
6
|
http: {
|
|
10
|
-
host:
|
|
11
|
-
port:
|
|
7
|
+
host: Environment.get(Constants.EnvironmentVariables.CORE_WEBHOOKS_HOST, "0.0.0.0"),
|
|
8
|
+
port: Environment.get(Constants.EnvironmentVariables.CORE_WEBHOOKS_PORT, 4004),
|
|
12
9
|
},
|
|
13
10
|
whitelist: ["127.0.0.1", "::ffff:127.0.0.1"],
|
|
14
11
|
},
|
|
15
|
-
timeout:
|
|
12
|
+
timeout: Environment.get(Constants.EnvironmentVariables.CORE_WEBHOOKS_TIMEOUT, 1500),
|
|
16
13
|
};
|
|
17
14
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../source/defaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../source/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,qBAAqB,CAAC;IACjF,MAAM,EAAE;QACP,IAAI,EAAE;YACL,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,SAAS,CAAC;YACnF,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,IAAI,CAAC;SAC9E;QACD,SAAS,EAAE,CAAC,WAAW,EAAE,kBAAkB,CAAC;KAC5C;IACD,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,qBAAqB,EAAE,IAAI,CAAC;CACpF,CAAC"}
|
package/distribution/events.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookEvent = void 0;
|
|
4
|
-
var WebhookEvent;
|
|
1
|
+
export var WebhookEvent;
|
|
5
2
|
(function (WebhookEvent) {
|
|
6
3
|
WebhookEvent["Broadcasted"] = "webhooks.broadcasted";
|
|
7
4
|
WebhookEvent["Failed"] = "webhooks.failed";
|
|
8
|
-
})(WebhookEvent || (
|
|
5
|
+
})(WebhookEvent || (WebhookEvent = {}));
|
|
9
6
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../source/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../source/events.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,oDAAoC,CAAA;IACpC,0CAA0B,CAAA;AAC3B,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternalIdentifiers = void 0;
|
|
4
|
-
exports.InternalIdentifiers = {
|
|
1
|
+
export const InternalIdentifiers = {
|
|
5
2
|
Broadcaster: Symbol.for("Webhook<Broadcaster>"),
|
|
6
3
|
Database: Symbol.for("Webhook<Database>"),
|
|
7
4
|
Listener: Symbol.for("Webhook<Listener>"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../source/identifiers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;CACrC,CAAC"}
|
package/distribution/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./service-provider";
|
|
1
|
+
export * from "./service-provider.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/distribution/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./service-provider"), exports);
|
|
1
|
+
export * from "./service-provider.js";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../source/listener.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../source/listener.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,qBACa,QAAQ;;IAEpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAGpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAG3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAErC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;;;KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBrC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA4ExF"}
|
package/distribution/listener.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14,15 +13,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
14
13
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
14
|
};
|
|
16
15
|
var _Listener_instances, _Listener_dispatchWebhookEvent, _Listener_getWebhooks;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const events_1 = require("./events");
|
|
25
|
-
const identifiers_1 = require("./identifiers");
|
|
16
|
+
import { inject, injectable } from "@mainsail/container";
|
|
17
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
|
18
|
+
import { Utils } from "@mainsail/kernel";
|
|
19
|
+
import { performance } from "perf_hooks";
|
|
20
|
+
import { conditions } from "./conditions.js";
|
|
21
|
+
import { WebhookEvent } from "./events.js";
|
|
22
|
+
import { InternalIdentifiers } from "./identifiers.js";
|
|
26
23
|
let Listener = class Listener {
|
|
27
24
|
constructor() {
|
|
28
25
|
_Listener_instances.add(this);
|
|
@@ -40,9 +37,9 @@ let Listener = class Listener {
|
|
|
40
37
|
await Promise.all(promises);
|
|
41
38
|
}
|
|
42
39
|
async broadcast(webhook, payload, timeout = 1500) {
|
|
43
|
-
const start =
|
|
40
|
+
const start = performance.now();
|
|
44
41
|
try {
|
|
45
|
-
const { statusCode } = await
|
|
42
|
+
const { statusCode } = await Utils.http.post(webhook.target, {
|
|
46
43
|
body: {
|
|
47
44
|
data: payload,
|
|
48
45
|
// @TODO utils currently expects a primitive as data
|
|
@@ -63,22 +60,21 @@ let Listener = class Listener {
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
};
|
|
66
|
-
exports.Listener = Listener;
|
|
67
63
|
_Listener_instances = new WeakSet();
|
|
68
64
|
_Listener_dispatchWebhookEvent = async function _Listener_dispatchWebhookEvent(start, webhook, payload, error) {
|
|
69
65
|
if (error) {
|
|
70
66
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
71
|
-
this.events.dispatch(
|
|
67
|
+
this.events.dispatch(WebhookEvent.Failed, {
|
|
72
68
|
error: error,
|
|
73
|
-
executionTime:
|
|
69
|
+
executionTime: performance.now() - start,
|
|
74
70
|
payload: payload,
|
|
75
71
|
webhook: webhook,
|
|
76
72
|
});
|
|
77
73
|
}
|
|
78
74
|
else {
|
|
79
75
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
80
|
-
this.events.dispatch(
|
|
81
|
-
executionTime:
|
|
76
|
+
this.events.dispatch(WebhookEvent.Broadcasted, {
|
|
77
|
+
executionTime: performance.now() - start,
|
|
82
78
|
payload: payload,
|
|
83
79
|
webhook: webhook,
|
|
84
80
|
});
|
|
@@ -86,7 +82,7 @@ _Listener_dispatchWebhookEvent = async function _Listener_dispatchWebhookEvent(s
|
|
|
86
82
|
};
|
|
87
83
|
_Listener_getWebhooks = function _Listener_getWebhooks(event, payload) {
|
|
88
84
|
return this.app
|
|
89
|
-
.get(
|
|
85
|
+
.get(InternalIdentifiers.Database)
|
|
90
86
|
.findByEvent(event)
|
|
91
87
|
.filter((webhook) => {
|
|
92
88
|
if (!webhook.enabled) {
|
|
@@ -97,7 +93,7 @@ _Listener_getWebhooks = function _Listener_getWebhooks(event, payload) {
|
|
|
97
93
|
}
|
|
98
94
|
for (const condition of webhook.conditions) {
|
|
99
95
|
try {
|
|
100
|
-
const satisfies =
|
|
96
|
+
const satisfies = conditions[condition.condition];
|
|
101
97
|
if (satisfies(payload[condition.key], condition.value)) {
|
|
102
98
|
return true;
|
|
103
99
|
}
|
|
@@ -110,18 +106,19 @@ _Listener_getWebhooks = function _Listener_getWebhooks(event, payload) {
|
|
|
110
106
|
});
|
|
111
107
|
};
|
|
112
108
|
__decorate([
|
|
113
|
-
|
|
109
|
+
inject(Identifiers.Application.Instance),
|
|
114
110
|
__metadata("design:type", Object)
|
|
115
111
|
], Listener.prototype, "app", void 0);
|
|
116
112
|
__decorate([
|
|
117
|
-
|
|
113
|
+
inject(Identifiers.Services.EventDispatcher.Service),
|
|
118
114
|
__metadata("design:type", Object)
|
|
119
115
|
], Listener.prototype, "events", void 0);
|
|
120
116
|
__decorate([
|
|
121
|
-
|
|
117
|
+
inject(Identifiers.Services.Log.Service),
|
|
122
118
|
__metadata("design:type", Object)
|
|
123
119
|
], Listener.prototype, "logger", void 0);
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
Listener = __decorate([
|
|
121
|
+
injectable()
|
|
126
122
|
], Listener);
|
|
123
|
+
export { Listener };
|
|
127
124
|
//# sourceMappingURL=listener.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.js","sourceRoot":"","sources":["../source/listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listener.js","sourceRoot":"","sources":["../source/listener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIhD,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAAd;;IAuGP,CAAC;IA7FO,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;QACjC,qCAAqC;QACrC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,OAAO;QACR,CAAC;QAED,MAAM,QAAQ,GAAc,uBAAA,IAAI,kDAAa,MAAjB,IAA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,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAElD,IAAI,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;oBACxD,OAAO,IAAI,CAAC;gBACb,CAAC;YACF,CAAC;YAAC,MAAM,CAAC;gBACR,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AApGgB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;qCACW;AAGnC;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;;wCACM;AAG1C;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;wCACS;AARtC,QAAQ;IADpB,UAAU,EAAE;GACA,QAAQ,CAuGpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./server";
|
|
1
|
+
export * from "./server.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./server"), exports);
|
|
1
|
+
export * from "./server.js";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.whitelist = void 0;
|
|
7
|
-
const boom_1 = __importDefault(require("@hapi/boom"));
|
|
8
|
-
const kernel_1 = require("@mainsail/kernel");
|
|
9
|
-
exports.whitelist = {
|
|
1
|
+
import Boom from "@hapi/boom";
|
|
2
|
+
import { Utils } from "@mainsail/kernel";
|
|
3
|
+
export const whitelist = {
|
|
10
4
|
name: "whitelist",
|
|
11
5
|
register(server, options) {
|
|
12
6
|
server.ext({
|
|
@@ -14,10 +8,10 @@ exports.whitelist = {
|
|
|
14
8
|
if (!options.whitelist) {
|
|
15
9
|
return h.continue;
|
|
16
10
|
}
|
|
17
|
-
if (
|
|
11
|
+
if (Utils.isWhitelisted(options.whitelist, request.info.remoteAddress)) {
|
|
18
12
|
return h.continue;
|
|
19
13
|
}
|
|
20
|
-
return
|
|
14
|
+
return Boom.forbidden();
|
|
21
15
|
},
|
|
22
16
|
type: "onRequest",
|
|
23
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whitelist.js","sourceRoot":"","sources":["../../../source/server/plugins/whitelist.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"whitelist.js","sourceRoot":"","sources":["../../../source/server/plugins/whitelist.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,IAAI,EAAE,WAAW;IACjB,QAAQ,CAAC,MAAM,EAAE,OAAO;QACvB,MAAM,CAAC,GAAG,CAAC;YACV,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACtB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;oBACxB,OAAO,CAAC,CAAC,QAAQ,CAAC;gBACnB,CAAC;gBAED,IAAI,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;oBACxE,OAAO,CAAC,CAAC,QAAQ,CAAC;gBACnB,CAAC;gBAED,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;YACzB,CAAC;YACD,IAAI,EAAE,WAAW;SACjB,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO;CAChB,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.destroy = exports.update = exports.store = exports.show = exports.conditions = void 0;
|
|
7
|
-
const joi_1 = __importDefault(require("joi"));
|
|
8
|
-
exports.conditions = [
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
export const conditions = [
|
|
9
3
|
"between",
|
|
10
4
|
"contains",
|
|
11
5
|
"eq",
|
|
@@ -19,49 +13,49 @@ exports.conditions = [
|
|
|
19
13
|
"regexp",
|
|
20
14
|
"truthy",
|
|
21
15
|
];
|
|
22
|
-
|
|
23
|
-
params:
|
|
24
|
-
id:
|
|
16
|
+
export const show = {
|
|
17
|
+
params: Joi.object({
|
|
18
|
+
id: Joi.string().required(),
|
|
25
19
|
}),
|
|
26
20
|
};
|
|
27
|
-
|
|
28
|
-
payload:
|
|
29
|
-
conditions:
|
|
30
|
-
.items(
|
|
31
|
-
condition:
|
|
32
|
-
.allow(...
|
|
21
|
+
export const store = {
|
|
22
|
+
payload: Joi.object({
|
|
23
|
+
conditions: Joi.array()
|
|
24
|
+
.items(Joi.object({
|
|
25
|
+
condition: Joi.string()
|
|
26
|
+
.allow(...conditions)
|
|
33
27
|
.required(),
|
|
34
|
-
key:
|
|
35
|
-
value:
|
|
28
|
+
key: Joi.string().required(),
|
|
29
|
+
value: Joi.any(),
|
|
36
30
|
}))
|
|
37
31
|
.required(),
|
|
38
|
-
enabled:
|
|
39
|
-
event:
|
|
40
|
-
target:
|
|
32
|
+
enabled: Joi.boolean().default(true),
|
|
33
|
+
event: Joi.string().required(),
|
|
34
|
+
target: Joi.string().uri().required(),
|
|
41
35
|
}),
|
|
42
36
|
};
|
|
43
|
-
|
|
44
|
-
params:
|
|
45
|
-
id:
|
|
37
|
+
export const update = {
|
|
38
|
+
params: Joi.object({
|
|
39
|
+
id: Joi.string().required(),
|
|
46
40
|
}),
|
|
47
|
-
payload:
|
|
48
|
-
conditions:
|
|
49
|
-
.items(
|
|
50
|
-
condition:
|
|
51
|
-
.allow(...
|
|
41
|
+
payload: Joi.object({
|
|
42
|
+
conditions: Joi.array()
|
|
43
|
+
.items(Joi.object({
|
|
44
|
+
condition: Joi.string()
|
|
45
|
+
.allow(...conditions)
|
|
52
46
|
.required(),
|
|
53
|
-
key:
|
|
54
|
-
value:
|
|
47
|
+
key: Joi.string().required(),
|
|
48
|
+
value: Joi.any(),
|
|
55
49
|
}))
|
|
56
50
|
.required(),
|
|
57
|
-
enabled:
|
|
58
|
-
event:
|
|
59
|
-
target:
|
|
51
|
+
enabled: Joi.boolean().required(),
|
|
52
|
+
event: Joi.string().required(),
|
|
53
|
+
target: Joi.string().uri().required(),
|
|
60
54
|
}),
|
|
61
55
|
};
|
|
62
|
-
|
|
63
|
-
params:
|
|
64
|
-
id:
|
|
56
|
+
export const destroy = {
|
|
57
|
+
params: Joi.object({
|
|
58
|
+
id: Joi.string().required(),
|
|
65
59
|
}),
|
|
66
60
|
};
|
|
67
61
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../source/server/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../source/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,UAAU,GAAa;IACnC,SAAS;IACT,UAAU;IACV,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,QAAQ;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAW;IAC3B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;QAClB,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAW;IAC5B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,GAAG,CAAC,KAAK,EAAE;aACrB,KAAK,CACL,GAAG,CAAC,MAAM,CAAC;YACV,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;iBACrB,KAAK,CAAC,GAAG,UAAU,CAAC;iBACpB,QAAQ,EAAE;YACZ,GAA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AAC,QAAQ,EAAE;KAC3B,CAAC;CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server as HapiServer, ServerInjectOptions, ServerInjectResponse } from "@hapi/hapi";
|
|
2
2
|
import { Contracts } from "@mainsail/contracts";
|
|
3
|
-
import { Database } from "../database";
|
|
3
|
+
import { Database } from "../database.js";
|
|
4
4
|
export type WebhookAppState = {
|
|
5
5
|
database: Database;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../source/server/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAI7D,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../source/server/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAI7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO1C,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAExD,qBACa,MAAM;;IAElB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;IAGpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAY;IAGrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAIrC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBlE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAiKzF"}
|
|
@@ -1,33 +1,9 @@
|
|
|
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
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
6
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
9
|
};
|
|
@@ -43,26 +19,24 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
43
19
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
44
20
|
};
|
|
45
21
|
var _Server_instances, _Server_server, _Server_getServerOptions, _Server_registerPlugins, _Server_registerRoutes;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const schema_1 = require("./schema");
|
|
58
|
-
const utils_1 = require("./utils");
|
|
22
|
+
import Boom, { badData } from "@hapi/boom";
|
|
23
|
+
import { Server as HapiServer } from "@hapi/hapi";
|
|
24
|
+
import { inject, injectable } from "@mainsail/container";
|
|
25
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
|
26
|
+
import { Utils } from "@mainsail/kernel";
|
|
27
|
+
import { randomBytes } from "crypto";
|
|
28
|
+
import { Database } from "../database.js";
|
|
29
|
+
import { InternalIdentifiers } from "../identifiers.js";
|
|
30
|
+
import { whitelist } from "./plugins/whitelist.js";
|
|
31
|
+
import { destroy, show, store, update } from "./schema.js";
|
|
32
|
+
import { respondWithResource } from "./utils.js";
|
|
59
33
|
let Server = class Server {
|
|
60
34
|
constructor() {
|
|
61
35
|
_Server_instances.add(this);
|
|
62
36
|
_Server_server.set(this, void 0);
|
|
63
37
|
}
|
|
64
38
|
async register(optionsServer) {
|
|
65
|
-
__classPrivateFieldSet(this, _Server_server, new
|
|
39
|
+
__classPrivateFieldSet(this, _Server_server, new HapiServer(__classPrivateFieldGet(this, _Server_instances, "m", _Server_getServerOptions).call(this, optionsServer)), "f");
|
|
66
40
|
__classPrivateFieldGet(this, _Server_server, "f").app.database = this.database;
|
|
67
41
|
__classPrivateFieldGet(this, _Server_server, "f").ext({
|
|
68
42
|
async method(request, h) {
|
|
@@ -96,7 +70,6 @@ let Server = class Server {
|
|
|
96
70
|
return __classPrivateFieldGet(this, _Server_server, "f").inject(options);
|
|
97
71
|
}
|
|
98
72
|
};
|
|
99
|
-
exports.Server = Server;
|
|
100
73
|
_Server_server = new WeakMap();
|
|
101
74
|
_Server_instances = new WeakSet();
|
|
102
75
|
_Server_getServerOptions = function _Server_getServerOptions(options) {
|
|
@@ -115,13 +88,13 @@ _Server_getServerOptions = function _Server_getServerOptions(options) {
|
|
|
115
88
|
/* c8 ignore next 3 */
|
|
116
89
|
payload: {
|
|
117
90
|
async failAction(request, h, error) {
|
|
118
|
-
return
|
|
91
|
+
return badData(error.message);
|
|
119
92
|
},
|
|
120
93
|
},
|
|
121
94
|
/* c8 ignore next 3 */
|
|
122
95
|
validate: {
|
|
123
96
|
async failAction(request, h, error) {
|
|
124
|
-
return
|
|
97
|
+
return badData(error.message);
|
|
125
98
|
},
|
|
126
99
|
},
|
|
127
100
|
},
|
|
@@ -133,7 +106,7 @@ _Server_registerPlugins = async function _Server_registerPlugins(config) {
|
|
|
133
106
|
options: {
|
|
134
107
|
whitelist: config.whitelist,
|
|
135
108
|
},
|
|
136
|
-
plugin:
|
|
109
|
+
plugin: whitelist,
|
|
137
110
|
});
|
|
138
111
|
};
|
|
139
112
|
_Server_registerRoutes = function _Server_registerRoutes() {
|
|
@@ -158,9 +131,9 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
158
131
|
});
|
|
159
132
|
__classPrivateFieldGet(this, _Server_server, "f").route({
|
|
160
133
|
handler(request, h) {
|
|
161
|
-
const token =
|
|
134
|
+
const token = randomBytes(32).toString("hex");
|
|
162
135
|
return h
|
|
163
|
-
.response(
|
|
136
|
+
.response(respondWithResource({
|
|
164
137
|
...request.server.app.database.create({
|
|
165
138
|
...request.payload,
|
|
166
139
|
token: token.slice(0, 32),
|
|
@@ -176,7 +149,7 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
176
149
|
enabled: false,
|
|
177
150
|
},
|
|
178
151
|
},
|
|
179
|
-
validate:
|
|
152
|
+
validate: store,
|
|
180
153
|
},
|
|
181
154
|
path: "/api/webhooks",
|
|
182
155
|
});
|
|
@@ -184,21 +157,21 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
184
157
|
async handler(request) {
|
|
185
158
|
// @ts-ignore TODO: check typings
|
|
186
159
|
if (!request.server.app.database.hasById(request.params.id)) {
|
|
187
|
-
return
|
|
160
|
+
return Boom.notFound();
|
|
188
161
|
}
|
|
189
|
-
const webhook =
|
|
162
|
+
const webhook = Utils.cloneDeep(
|
|
190
163
|
// @ts-ignore TODO: check typings
|
|
191
164
|
request.server.app.database.findById(request.params.id));
|
|
192
165
|
/* c8 ignore next 3 */
|
|
193
166
|
if (!webhook) {
|
|
194
|
-
return
|
|
167
|
+
return Boom.badImplementation();
|
|
195
168
|
}
|
|
196
169
|
delete webhook.token;
|
|
197
|
-
return
|
|
170
|
+
return respondWithResource(webhook);
|
|
198
171
|
},
|
|
199
172
|
method: "GET",
|
|
200
173
|
options: {
|
|
201
|
-
validate:
|
|
174
|
+
validate: show,
|
|
202
175
|
},
|
|
203
176
|
path: "/api/webhooks/{id}",
|
|
204
177
|
});
|
|
@@ -206,7 +179,7 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
206
179
|
handler: (request, h) => {
|
|
207
180
|
// @ts-ignore TODO: check typings
|
|
208
181
|
if (!request.server.app.database.hasById(request.params.id)) {
|
|
209
|
-
return
|
|
182
|
+
return Boom.notFound();
|
|
210
183
|
}
|
|
211
184
|
// @ts-ignore TODO: check typings
|
|
212
185
|
request.server.app.database.update(request.params.id, request.payload);
|
|
@@ -214,7 +187,7 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
214
187
|
},
|
|
215
188
|
method: "PUT",
|
|
216
189
|
options: {
|
|
217
|
-
validate:
|
|
190
|
+
validate: update,
|
|
218
191
|
},
|
|
219
192
|
path: "/api/webhooks/{id}",
|
|
220
193
|
});
|
|
@@ -222,7 +195,7 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
222
195
|
handler: (request, h) => {
|
|
223
196
|
// @ts-ignore TODO: check typings
|
|
224
197
|
if (!request.server.app.database.hasById(request.params.id)) {
|
|
225
|
-
return
|
|
198
|
+
return Boom.notFound();
|
|
226
199
|
}
|
|
227
200
|
// @ts-ignore TODO: check typings
|
|
228
201
|
request.server.app.database.destroy(request.params.id);
|
|
@@ -230,24 +203,25 @@ _Server_registerRoutes = function _Server_registerRoutes() {
|
|
|
230
203
|
},
|
|
231
204
|
method: "DELETE",
|
|
232
205
|
options: {
|
|
233
|
-
validate:
|
|
206
|
+
validate: destroy,
|
|
234
207
|
},
|
|
235
208
|
path: "/api/webhooks/{id}",
|
|
236
209
|
});
|
|
237
210
|
};
|
|
238
211
|
__decorate([
|
|
239
|
-
|
|
212
|
+
inject(Identifiers.Application.Instance),
|
|
240
213
|
__metadata("design:type", Object)
|
|
241
214
|
], Server.prototype, "app", void 0);
|
|
242
215
|
__decorate([
|
|
243
|
-
|
|
244
|
-
__metadata("design:type",
|
|
216
|
+
inject(InternalIdentifiers.Database),
|
|
217
|
+
__metadata("design:type", Database)
|
|
245
218
|
], Server.prototype, "database", void 0);
|
|
246
219
|
__decorate([
|
|
247
|
-
|
|
220
|
+
inject(Identifiers.Services.Log.Service),
|
|
248
221
|
__metadata("design:type", Object)
|
|
249
222
|
], Server.prototype, "logger", void 0);
|
|
250
|
-
|
|
251
|
-
|
|
223
|
+
Server = __decorate([
|
|
224
|
+
injectable()
|
|
252
225
|
], Server);
|
|
226
|
+
export { Server };
|
|
253
227
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../source/server/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../source/server/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,IAAI,UAAU,EAA6C,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAM1C,IAAM,MAAM,GAAZ,MAAM,MAAM;IAAZ;;QAUN,iCAAwB;IAyMzB,CAAC;IAvMO,KAAK,CAAC,QAAQ,CAAC,aAAyC;QAC9D,uBAAA,IAAI,kBAAW,IAAI,UAAU,CAAC,uBAAA,IAAI,mDAAkB,MAAtB,IAAI,EAAmB,aAAa,CAAC,CAAC,MAAA,CAAC;QACrE,uBAAA,IAAI,sBAAQ,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE1C,uBAAA,IAAI,sBAAQ,CAAC,GAAG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AAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC7D,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;YAED,iCAAiC;YACjC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAEvD,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE;YACR,QAAQ,EAAE,OAAO;SACjB;QACD,IAAI,EAAE,oBAAoB;KAC1B,CAAC,CAAC;AACJ,CAAC;AAhNgB;IADhB,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;mCACW;AAGnC;IADhB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC;8BACT,QAAQ;wCAAC;AAGpB;IADhB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;;sCACS;AARtC,MAAM;IADlB,UAAU,EAAE;GACA,MAAM,CAmNlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../source/server/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../source/server/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,iBAAiB,kBAAY,OAOxC,CAAC;AAEH,eAAO,MAAM,mBAAmB;UAAmB,OAAO;iBACJ,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.respondWithResource = exports.transformResource = void 0;
|
|
4
|
-
const boom_1 = require("@hapi/boom");
|
|
5
|
-
const transformResource = (model) => ({
|
|
1
|
+
import { notFound } from "@hapi/boom";
|
|
2
|
+
export const transformResource = (model) => ({
|
|
6
3
|
conditions: model.conditions,
|
|
7
4
|
enabled: model.enabled,
|
|
8
5
|
event: model.event,
|
|
@@ -10,7 +7,5 @@ const transformResource = (model) => ({
|
|
|
10
7
|
target: model.target,
|
|
11
8
|
token: model.token,
|
|
12
9
|
});
|
|
13
|
-
|
|
14
|
-
const respondWithResource = (data) => data ? { data: (0, exports.transformResource)(data) } : (0, boom_1.notFound)();
|
|
15
|
-
exports.respondWithResource = respondWithResource;
|
|
10
|
+
export const respondWithResource = (data) => data ? { data: transformResource(data) } : notFound();
|
|
16
11
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/server/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/server/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAW,EAAE,CAAC,CAAC;IACrD,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,KAAK,EAAE,KAAK,CAAC,KAAK;IAClB,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,KAAK,EAAE,KAAK,CAAC,KAAK;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAqC,EAAE,CAC9E,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC"}
|
|
@@ -1,68 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
2
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
5
|
};
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
6
|
var _ServiceProvider_instances, _ServiceProvider_startListeners;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const server_1 = require("./server");
|
|
20
|
-
class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
|
7
|
+
import { Identifiers } from "@mainsail/contracts";
|
|
8
|
+
import { Providers } from "@mainsail/kernel";
|
|
9
|
+
import Joi from "joi";
|
|
10
|
+
import { Database } from "./database.js";
|
|
11
|
+
import { InternalIdentifiers } from "./identifiers.js";
|
|
12
|
+
import { Listener } from "./listener.js";
|
|
13
|
+
import { Server } from "./server/index.js";
|
|
14
|
+
export class ServiceProvider extends Providers.ServiceProvider {
|
|
21
15
|
constructor() {
|
|
22
16
|
super(...arguments);
|
|
23
17
|
_ServiceProvider_instances.add(this);
|
|
24
18
|
}
|
|
25
19
|
async register() {
|
|
26
20
|
// Setup Database...
|
|
27
|
-
this.app.bind(
|
|
28
|
-
this.app.get(
|
|
21
|
+
this.app.bind(InternalIdentifiers.Database).to(Database).inSingletonScope();
|
|
22
|
+
this.app.get(InternalIdentifiers.Database).boot();
|
|
29
23
|
// Setup Server...
|
|
30
|
-
this.app.bind(
|
|
24
|
+
this.app.bind(InternalIdentifiers.Server).to(Server).inSingletonScope();
|
|
31
25
|
await this.app
|
|
32
|
-
.get(
|
|
26
|
+
.get(InternalIdentifiers.Server)
|
|
33
27
|
.register(this.config().get("server"));
|
|
34
28
|
// Setup Listeners...
|
|
35
29
|
__classPrivateFieldGet(this, _ServiceProvider_instances, "m", _ServiceProvider_startListeners).call(this);
|
|
36
30
|
}
|
|
37
31
|
async boot() {
|
|
38
|
-
await this.app.get(
|
|
32
|
+
await this.app.get(InternalIdentifiers.Server).boot();
|
|
39
33
|
}
|
|
40
34
|
async dispose() {
|
|
41
|
-
await this.app.get(
|
|
35
|
+
await this.app.get(InternalIdentifiers.Server).dispose();
|
|
42
36
|
}
|
|
43
37
|
async bootWhen() {
|
|
44
38
|
return this.config().get("enabled") === true;
|
|
45
39
|
}
|
|
46
40
|
configSchema() {
|
|
47
|
-
return
|
|
48
|
-
enabled:
|
|
49
|
-
server:
|
|
50
|
-
http:
|
|
51
|
-
host:
|
|
41
|
+
return Joi.object({
|
|
42
|
+
enabled: Joi.boolean().required(),
|
|
43
|
+
server: Joi.object({
|
|
44
|
+
http: Joi.object({
|
|
45
|
+
host: Joi.string()
|
|
52
46
|
.ip({ version: ["ipv4", "ipv6"] })
|
|
53
47
|
.required(),
|
|
54
|
-
port:
|
|
48
|
+
port: Joi.number().integer().min(1).max(65_535).required(),
|
|
55
49
|
}).required(),
|
|
56
|
-
whitelist:
|
|
50
|
+
whitelist: Joi.array().items(Joi.string()).required(),
|
|
57
51
|
}).required(),
|
|
58
|
-
timeout:
|
|
52
|
+
timeout: Joi.number().integer().min(1).required(),
|
|
59
53
|
}).unknown(true);
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
|
-
exports.ServiceProvider = ServiceProvider;
|
|
63
56
|
_ServiceProvider_instances = new WeakSet(), _ServiceProvider_startListeners = function _ServiceProvider_startListeners() {
|
|
64
57
|
this.app
|
|
65
|
-
.get(
|
|
66
|
-
.listen("*", this.app.resolve(
|
|
58
|
+
.get(Identifiers.Services.EventDispatcher.Service)
|
|
59
|
+
.listen("*", this.app.resolve(Listener));
|
|
67
60
|
};
|
|
68
61
|
//# sourceMappingURL=service-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,OAAO,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAA9D;;;IAmDA,CAAC;IAlDO,KAAK,CAAC,QAAQ;QACpB,oBAAoB;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAW,mBAAmB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAEtF,IAAI,CAAC,GAAG,CAAC,GAAG,CAAW,mBAAmB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAE5D,kBAAkB;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAExE,MAAM,IAAI,CAAC,GAAG;aACZ,GAAG,CAAS,mBA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EAAE;YACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;SACjD,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;CAOD;;IAJC,IAAI,CAAC,GAAG;SACN,GAAG,CAAmC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC;SACnF,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mainsail/webhooks",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.12",
|
|
4
4
|
"description": "Webhooks service for the Mainsail blockchain",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"contributors": [],
|
|
7
|
+
"type": "module",
|
|
7
8
|
"main": "distribution/index.js",
|
|
8
9
|
"files": [
|
|
9
10
|
"/distribution"
|
|
10
11
|
],
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@hapi/boom": "10.0.1",
|
|
13
|
-
"@hapi/hapi": "21.3.
|
|
14
|
+
"@hapi/hapi": "21.3.6",
|
|
14
15
|
"fs-extra": "11.2.0",
|
|
15
|
-
"joi": "17.
|
|
16
|
-
"lowdb": "
|
|
16
|
+
"joi": "17.12.2",
|
|
17
|
+
"lowdb": "7.0.1",
|
|
17
18
|
"uuid": "9.0.1",
|
|
18
|
-
"@mainsail/container": "0.0.1-alpha.
|
|
19
|
-
"@mainsail/
|
|
20
|
-
"@mainsail/
|
|
21
|
-
"@mainsail/utils": "0.0.1-alpha.
|
|
19
|
+
"@mainsail/container": "0.0.1-alpha.12",
|
|
20
|
+
"@mainsail/contracts": "0.0.1-alpha.12",
|
|
21
|
+
"@mainsail/kernel": "0.0.1-alpha.12",
|
|
22
|
+
"@mainsail/utils": "0.0.1-alpha.12"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/fs-extra": "11.0.4",
|
|
25
26
|
"@types/tmp": "0.2.6",
|
|
26
|
-
"@types/uuid": "9.0.
|
|
27
|
+
"@types/uuid": "9.0.8",
|
|
27
28
|
"import-fresh": "3.3.0",
|
|
28
|
-
"tmp": "0.2.
|
|
29
|
+
"tmp": "0.2.3",
|
|
29
30
|
"uvu": "^0.5.6"
|
|
30
31
|
},
|
|
31
32
|
"engines": {
|