@interopio/gateway-server 0.4.0-beta → 0.5.1-beta
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/changelog.md +24 -0
- package/dist/gateway-ent.cjs +25 -2
- package/dist/gateway-ent.cjs.map +2 -2
- package/dist/gateway-ent.js +25 -2
- package/dist/gateway-ent.js.map +2 -2
- package/dist/index.cjs +1185 -109
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +1185 -109
- package/dist/index.js.map +4 -4
- package/dist/metrics/publisher/rest.cjs +60 -0
- package/dist/metrics/publisher/rest.cjs.map +7 -0
- package/dist/metrics/publisher/rest.js +23 -0
- package/dist/metrics/publisher/rest.js.map +7 -0
- package/package.json +12 -12
- package/types/gateway-ent.d.ts +2 -1
- package/dist/metrics-rest.cjs +0 -21440
- package/dist/metrics-rest.cjs.map +0 -7
- package/dist/metrics-rest.js +0 -21430
- package/dist/metrics-rest.js.map +0 -7
- package/src/common/compose.ts +0 -40
- package/src/gateway/ent/config.ts +0 -174
- package/src/gateway/ent/index.ts +0 -18
- package/src/gateway/ent/logging.ts +0 -89
- package/src/gateway/ent/server.ts +0 -34
- package/src/gateway/metrics/rest.ts +0 -20
- package/src/gateway/ws/core.ts +0 -90
- package/src/index.ts +0 -3
- package/src/logger.ts +0 -6
- package/src/mesh/connections.ts +0 -101
- package/src/mesh/rest-directory/routes.ts +0 -38
- package/src/mesh/ws/broker/core.ts +0 -163
- package/src/mesh/ws/cluster/core.ts +0 -107
- package/src/mesh/ws/relays/core.ts +0 -159
- package/src/metrics/routes.ts +0 -86
- package/src/server/address.ts +0 -47
- package/src/server/cors.ts +0 -311
- package/src/server/exchange.ts +0 -379
- package/src/server/monitoring.ts +0 -167
- package/src/server/types.ts +0 -69
- package/src/server/ws-client-verify.ts +0 -79
- package/src/server.ts +0 -316
- package/src/utils.ts +0 -10
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name3 in all)
|
|
10
|
+
__defProp(target, name3, { get: all[name3], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/gateway/metrics/rest.ts
|
|
31
|
+
var rest_exports = {};
|
|
32
|
+
__export(rest_exports, {
|
|
33
|
+
create: () => create2,
|
|
34
|
+
fetchWithCookies: () => fetchWithCookies,
|
|
35
|
+
name: () => name2
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(rest_exports);
|
|
38
|
+
var rest = __toESM(require("@interopio/gateway/metrics/publisher/rest"), 1);
|
|
39
|
+
var import_v6 = require("http-cookie-agent/undici/v6");
|
|
40
|
+
var import_tough_cookie = require("tough-cookie");
|
|
41
|
+
var fetchWithCookies = (existing) => {
|
|
42
|
+
const fetchFn = existing ?? globalThis.fetch;
|
|
43
|
+
const jar = new import_tough_cookie.CookieJar();
|
|
44
|
+
const dispatcher = new import_v6.CookieAgent({ cookies: { jar } });
|
|
45
|
+
return async (input, request) => {
|
|
46
|
+
const requestWithDispatcher = { ...request, dispatcher };
|
|
47
|
+
return await fetchFn(input, requestWithDispatcher);
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var name2 = rest.name;
|
|
51
|
+
function create2(cfg, logger) {
|
|
52
|
+
return rest.create({ ...cfg, fetch: fetchWithCookies(cfg.fetch) }, logger);
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
create,
|
|
57
|
+
fetchWithCookies,
|
|
58
|
+
name
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=rest.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/gateway/metrics/rest.ts"],
|
|
4
|
+
"sourcesContent": ["import * as rest from '@interopio/gateway/metrics/publisher/rest';\nimport {IOGateway} from '@interopio/gateway';\nimport {CookieAgent} from 'http-cookie-agent/undici/v6';\nimport {CookieJar} from 'tough-cookie';\n\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const jar: any = new CookieJar();\n const dispatcher = new CookieAgent({cookies: {jar}});\n return async (input: RequestInfo | URL, request?: RequestInit) => {\n const requestWithDispatcher = {...request, dispatcher};\n return await fetchFn(input, requestWithDispatcher);\n }\n}\nexport const name = rest.name;\n\nexport function create(cfg: rest.RestPublisherConfig, logger: IOGateway.Logging.Logger) {\n return rest.create({...cfg, fetch: fetchWithCookies(cfg.fetch)}, logger);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA,cAAAC;AAAA;AAAA;AAAA,WAAsB;AAEtB,gBAA0B;AAC1B,0BAAwB;AAEjB,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AAEvC,QAAM,MAAW,IAAI,8BAAU;AAC/B,QAAM,aAAa,IAAI,sBAAY,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AACnD,SAAO,OAAO,OAA0B,YAA0B;AAC9D,UAAM,wBAAwB,EAAC,GAAG,SAAS,WAAU;AACrD,WAAO,MAAM,QAAQ,OAAO,qBAAqB;AAAA,EACrD;AACJ;AACO,IAAMA,QAAY;AAElB,SAASD,QAAO,KAA+B,QAAkC;AACpF,SAAY,YAAO,EAAC,GAAG,KAAK,OAAO,iBAAiB,IAAI,KAAK,EAAC,GAAG,MAAM;AAC3E;",
|
|
6
|
+
"names": ["create", "name"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/gateway/metrics/rest.ts
|
|
2
|
+
import * as rest from "@interopio/gateway/metrics/publisher/rest";
|
|
3
|
+
import { CookieAgent } from "http-cookie-agent/undici/v6";
|
|
4
|
+
import { CookieJar } from "tough-cookie";
|
|
5
|
+
var fetchWithCookies = (existing) => {
|
|
6
|
+
const fetchFn = existing ?? globalThis.fetch;
|
|
7
|
+
const jar = new CookieJar();
|
|
8
|
+
const dispatcher = new CookieAgent({ cookies: { jar } });
|
|
9
|
+
return async (input, request) => {
|
|
10
|
+
const requestWithDispatcher = { ...request, dispatcher };
|
|
11
|
+
return await fetchFn(input, requestWithDispatcher);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
var name2 = rest.name;
|
|
15
|
+
function create2(cfg, logger) {
|
|
16
|
+
return rest.create({ ...cfg, fetch: fetchWithCookies(cfg.fetch) }, logger);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
create2 as create,
|
|
20
|
+
fetchWithCookies,
|
|
21
|
+
name2 as name
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=rest.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/gateway/metrics/rest.ts"],
|
|
4
|
+
"sourcesContent": ["import * as rest from '@interopio/gateway/metrics/publisher/rest';\nimport {IOGateway} from '@interopio/gateway';\nimport {CookieAgent} from 'http-cookie-agent/undici/v6';\nimport {CookieJar} from 'tough-cookie';\n\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const jar: any = new CookieJar();\n const dispatcher = new CookieAgent({cookies: {jar}});\n return async (input: RequestInfo | URL, request?: RequestInit) => {\n const requestWithDispatcher = {...request, dispatcher};\n return await fetchFn(input, requestWithDispatcher);\n }\n}\nexport const name = rest.name;\n\nexport function create(cfg: rest.RestPublisherConfig, logger: IOGateway.Logging.Logger) {\n return rest.create({...cfg, fetch: fetchWithCookies(cfg.fetch)}, logger);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,UAAU;AAEtB,SAAQ,mBAAkB;AAC1B,SAAQ,iBAAgB;AAEjB,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AAEvC,QAAM,MAAW,IAAI,UAAU;AAC/B,QAAM,aAAa,IAAI,YAAY,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AACnD,SAAO,OAAO,OAA0B,YAA0B;AAC9D,UAAM,wBAAwB,EAAC,GAAG,SAAS,WAAU;AACrD,WAAO,MAAM,QAAQ,OAAO,qBAAqB;AAAA,EACrD;AACJ;AACO,IAAMA,QAAY;AAElB,SAASC,QAAO,KAA+B,QAAkC;AACpF,SAAY,YAAO,EAAC,GAAG,KAAK,OAAO,iBAAiB,IAAI,KAAK,EAAC,GAAG,MAAM;AAC3E;",
|
|
6
|
+
"names": ["name", "create"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/gateway-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1-beta",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"gateway",
|
|
6
6
|
"server",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "node .",
|
|
20
20
|
"test": "mocha test --recursive",
|
|
21
|
-
"prepare": "node scripts/
|
|
21
|
+
"prepare": "node ../../scripts/copy-resource.mjs @glue42/gateway-ent/types/gateway-ent.d.ts ./types/gateway-ent.d.ts",
|
|
22
22
|
"build": "node scripts/build.mjs",
|
|
23
23
|
"prepack": "npm run build",
|
|
24
24
|
"clean": "node scripts/clean.mjs",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"node": "./dist/index.cjs",
|
|
33
33
|
"require": "./dist/index.cjs"
|
|
34
34
|
},
|
|
35
|
-
"./metrics
|
|
36
|
-
"import": "./dist/metrics
|
|
37
|
-
"node": "./dist/metrics
|
|
38
|
-
"require": "./dist/metrics
|
|
35
|
+
"./metrics/publisher/rest": {
|
|
36
|
+
"import": "./dist/metrics/publisher/rest.js",
|
|
37
|
+
"node": "./dist/metrics/publisher/rest.cjs",
|
|
38
|
+
"require": "./dist/metrics/publisher/rest.cjs"
|
|
39
39
|
},
|
|
40
40
|
"./gateway-ent": {
|
|
41
41
|
"import": {
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"main": "dist/index.js",
|
|
50
50
|
"types": "gateway-server.d.ts",
|
|
51
51
|
"type": "module",
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20"
|
|
54
|
+
},
|
|
52
55
|
"dependencies": {
|
|
53
|
-
"@interopio/gateway": "^0.
|
|
56
|
+
"@interopio/gateway": "^0.10.0-beta",
|
|
54
57
|
"ws": "^8.18.2",
|
|
55
|
-
"http-cookie-agent": "^
|
|
58
|
+
"http-cookie-agent": "^7.0.1",
|
|
56
59
|
"undici": "^6.21.3",
|
|
57
|
-
"tough-cookie": "^5.
|
|
58
|
-
},
|
|
59
|
-
"engines": {
|
|
60
|
-
"node": ">=18.17"
|
|
60
|
+
"tough-cookie": "^5.1.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/transit-js": "^0.8.3",
|
package/types/gateway-ent.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ type GatewayConfig = {
|
|
|
108
108
|
"log-level"?: LogLevel // defaults to warn
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
kafka
|
|
111
|
+
kafka?: {
|
|
112
112
|
topic: string;
|
|
113
113
|
"publisher-config": object;
|
|
114
114
|
conflation?: MetricsPublisherConfig['conflation'] & {
|
|
@@ -184,6 +184,7 @@ type GatewayConfig = {
|
|
|
184
184
|
report_interval?: number, // report schedule interval in ms. defaults to 600000 ms (10 min)
|
|
185
185
|
max_backups?: number, // defaults to 10
|
|
186
186
|
}
|
|
187
|
+
[key: string]: unknown //allow additional properties
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
interface Gateway {
|