@interopio/gateway-server 0.12.0-beta.0 → 0.13.0-beta.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 as CookieAgentUndiciV6} from 'http-cookie-agent/undici/v6';\nimport {CookieAgent as CookieAgentUndici} from 'http-cookie-agent/undici';\nimport {interceptors} from 'undici';\nimport {CookieJar} from 'tough-cookie';\n\nfunction cookieAgent(jar: CookieJar) {\n const version = process.version;\n const major = Number(version.substring(1 /*skip v prefix*/, version.indexOf('.')));\n const useUndiciV6 = major >= 18 && major < 24; // undici v6 is used for Node.js 18.x to 23.x\n\n if (useUndiciV6) {\n return new CookieAgentUndiciV6({cookies: {jar}});\n }\n else {\n return new CookieAgentUndici({cookies: {jar}}).compose(interceptors.redirect());\n }\n\n}\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n const jar = new CookieJar();\n const dispatcher = cookieAgent(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,gBAAiD;AACjD,oBAA+C;AAC/C,IAAAC,iBAA2B;AAC3B,0BAAwB;AAExB,SAAS,YAAY,KAAgB;AACjC,QAAM,UAAU,QAAQ;AACxB,QAAM,QAAQ,OAAO,QAAQ,UAAU,GAAqB,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjF,QAAM,cAAc,SAAS,MAAM,QAAQ;AAE3C,MAAI,aAAa;AACb,WAAO,IAAI,UAAAC,YAAoB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AAAA,EACnD,OACK;AACD,WAAO,IAAI,cAAAC,YAAkB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC,EAAE,QAAQ,4BAAa,SAAS,CAAC;AAAA,EAClF;AAEJ;AACO,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AACvC,QAAM,MAAM,IAAI,8BAAU;AAC1B,QAAM,aAAa,YAAY,GAAG;AAClC,SAAO,OAAO,OAA0B,YAA0B;AAC9D,UAAM,wBAAwB,EAAC,GAAG,SAAS,WAAU;AACrD,WAAO,MAAM,QAAQ,OAAO,qBAAqB;AAAA,EACrD;AACJ;AACO,IAAMH,QAAY;AAElB,SAASD,QAAO,KAA+B,QAAkC;AACpF,SAAY,YAAO,EAAC,GAAG,KAAK,OAAO,iBAAiB,IAAI,KAAK,EAAC,GAAG,MAAM;AAC3E;",
4
+ "sourcesContent": ["import * as rest from '@interopio/gateway/metrics/publisher/rest';\nimport type { Logger } from '@interopio/gateway/logging/api';\nimport { CookieAgent as CookieAgentUndiciV6 } from 'http-cookie-agent/undici/v6';\nimport { CookieAgent as CookieAgentUndici } from 'http-cookie-agent/undici';\nimport { interceptors } from 'undici';\nimport { CookieJar } from 'tough-cookie';\n\nfunction cookieAgent(jar: CookieJar) {\n const version = process.version;\n const major = Number(version.substring(1 /*skip v prefix*/, version.indexOf('.')));\n const useUndiciV6 = major >= 18 && major < 24; // undici v6 is used for Node.js 18.x to 23.x\n\n if (useUndiciV6) {\n return new CookieAgentUndiciV6({cookies: {jar}});\n }\n else {\n return new CookieAgentUndici({cookies: {jar}}).compose(interceptors.redirect());\n }\n\n}\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n const jar = new CookieJar();\n const dispatcher = cookieAgent(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: 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,gBAAmD;AACnD,oBAAiD;AACjD,IAAAC,iBAA6B;AAC7B,0BAA0B;AAE1B,SAAS,YAAY,KAAgB;AACjC,QAAM,UAAU,QAAQ;AACxB,QAAM,QAAQ,OAAO,QAAQ,UAAU,GAAqB,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjF,QAAM,cAAc,SAAS,MAAM,QAAQ;AAE3C,MAAI,aAAa;AACb,WAAO,IAAI,UAAAC,YAAoB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AAAA,EACnD,OACK;AACD,WAAO,IAAI,cAAAC,YAAkB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC,EAAE,QAAQ,4BAAa,SAAS,CAAC;AAAA,EAClF;AAEJ;AACO,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AACvC,QAAM,MAAM,IAAI,8BAAU;AAC1B,QAAM,aAAa,YAAY,GAAG;AAClC,SAAO,OAAO,OAA0B,YAA0B;AAC9D,UAAM,wBAAwB,EAAC,GAAG,SAAS,WAAU;AACrD,WAAO,MAAM,QAAQ,OAAO,qBAAqB;AAAA,EACrD;AACJ;AACO,IAAMH,QAAY;AAElB,SAASD,QAAO,KAA+B,QAAgB;AAClE,SAAY,YAAO,EAAC,GAAG,KAAK,OAAO,iBAAiB,IAAI,KAAK,EAAC,GAAG,MAAM;AAC3E;",
6
6
  "names": ["create", "name", "import_undici", "CookieAgentUndiciV6", "CookieAgentUndici"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 as CookieAgentUndiciV6} from 'http-cookie-agent/undici/v6';\nimport {CookieAgent as CookieAgentUndici} from 'http-cookie-agent/undici';\nimport {interceptors} from 'undici';\nimport {CookieJar} from 'tough-cookie';\n\nfunction cookieAgent(jar: CookieJar) {\n const version = process.version;\n const major = Number(version.substring(1 /*skip v prefix*/, version.indexOf('.')));\n const useUndiciV6 = major >= 18 && major < 24; // undici v6 is used for Node.js 18.x to 23.x\n\n if (useUndiciV6) {\n return new CookieAgentUndiciV6({cookies: {jar}});\n }\n else {\n return new CookieAgentUndici({cookies: {jar}}).compose(interceptors.redirect());\n }\n\n}\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n const jar = new CookieJar();\n const dispatcher = cookieAgent(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,eAAe,2BAA0B;AACjD,SAAQ,eAAe,yBAAwB;AAC/C,SAAQ,oBAAmB;AAC3B,SAAQ,iBAAgB;AAExB,SAAS,YAAY,KAAgB;AACjC,QAAM,UAAU,QAAQ;AACxB,QAAM,QAAQ,OAAO,QAAQ,UAAU,GAAqB,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjF,QAAM,cAAc,SAAS,MAAM,QAAQ;AAE3C,MAAI,aAAa;AACb,WAAO,IAAI,oBAAoB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AAAA,EACnD,OACK;AACD,WAAO,IAAI,kBAAkB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC,EAAE,QAAQ,aAAa,SAAS,CAAC;AAAA,EAClF;AAEJ;AACO,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AACvC,QAAM,MAAM,IAAI,UAAU;AAC1B,QAAM,aAAa,YAAY,GAAG;AAClC,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;",
4
+ "sourcesContent": ["import * as rest from '@interopio/gateway/metrics/publisher/rest';\nimport type { Logger } from '@interopio/gateway/logging/api';\nimport { CookieAgent as CookieAgentUndiciV6 } from 'http-cookie-agent/undici/v6';\nimport { CookieAgent as CookieAgentUndici } from 'http-cookie-agent/undici';\nimport { interceptors } from 'undici';\nimport { CookieJar } from 'tough-cookie';\n\nfunction cookieAgent(jar: CookieJar) {\n const version = process.version;\n const major = Number(version.substring(1 /*skip v prefix*/, version.indexOf('.')));\n const useUndiciV6 = major >= 18 && major < 24; // undici v6 is used for Node.js 18.x to 23.x\n\n if (useUndiciV6) {\n return new CookieAgentUndiciV6({cookies: {jar}});\n }\n else {\n return new CookieAgentUndici({cookies: {jar}}).compose(interceptors.redirect());\n }\n\n}\nexport const fetchWithCookies = (existing?: typeof fetch): typeof fetch => {\n const fetchFn = existing ?? globalThis.fetch;\n const jar = new CookieJar();\n const dispatcher = cookieAgent(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: Logger) {\n return rest.create({...cfg, fetch: fetchWithCookies(cfg.fetch)}, logger);\n}\n"],
5
+ "mappings": ";AAAA,YAAY,UAAU;AAEtB,SAAS,eAAe,2BAA2B;AACnD,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAE1B,SAAS,YAAY,KAAgB;AACjC,QAAM,UAAU,QAAQ;AACxB,QAAM,QAAQ,OAAO,QAAQ,UAAU,GAAqB,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjF,QAAM,cAAc,SAAS,MAAM,QAAQ;AAE3C,MAAI,aAAa;AACb,WAAO,IAAI,oBAAoB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC;AAAA,EACnD,OACK;AACD,WAAO,IAAI,kBAAkB,EAAC,SAAS,EAAC,IAAG,EAAC,CAAC,EAAE,QAAQ,aAAa,SAAS,CAAC;AAAA,EAClF;AAEJ;AACO,IAAM,mBAAmB,CAAC,aAA0C;AACvE,QAAM,UAAU,YAAY,WAAW;AACvC,QAAM,MAAM,IAAI,UAAU;AAC1B,QAAM,aAAa,YAAY,GAAG;AAClC,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,QAAgB;AAClE,SAAY,YAAO,EAAC,GAAG,KAAK,OAAO,iBAAiB,IAAI,KAAK,EAAC,GAAG,MAAM;AAC3E;",
6
6
  "names": ["name", "create"]
7
7
  }
package/dist/web/test.js CHANGED
@@ -855,9 +855,9 @@ var MockServerHttpResponse = class extends AbstractServerHttpResponse {
855
855
  };
856
856
 
857
857
  // src/logger.ts
858
- import { IOGateway } from "@interopio/gateway";
859
- function getLogger(name) {
860
- return IOGateway.Logging.getLogger(`gateway.server.${name}`);
858
+ import * as GatewayLogging from "@interopio/gateway/logging/core";
859
+ function getLogger2(name) {
860
+ return GatewayLogging.getLogger(`gateway.server.${name}`);
861
861
  }
862
862
 
863
863
  // src/server/handler.ts
@@ -976,7 +976,7 @@ var WebHttpHandlerBuilder = class {
976
976
  this.#webHandler = webHandler;
977
977
  }
978
978
  build() {
979
- const logger = getLogger("http");
979
+ const logger = getLogger2("http");
980
980
  const adapter = new HandlerAdapter(logger, this.#webHandler);
981
981
  if (this.#storage !== void 0) adapter.storage = this.#storage;
982
982
  adapter.enableLoggingRequestDetails = false;
@@ -1008,7 +1008,7 @@ async function sink() {
1008
1008
  }
1009
1009
  }
1010
1010
  var HttpHandlerConnector = class _HttpHandlerConnector {
1011
- static #logger = getLogger("test.http.handler.connector");
1011
+ static #logger = getLogger2("test.http.handler.connector");
1012
1012
  #httpHandler;
1013
1013
  constructor(httpHandler) {
1014
1014
  this.#httpHandler = httpHandler;
@@ -1108,12 +1108,12 @@ var HttpHandlerConnector = class _HttpHandlerConnector {
1108
1108
  };
1109
1109
 
1110
1110
  // src/server/ws-client-verify.ts
1111
- import { IOGateway as IOGateway2 } from "@interopio/gateway";
1112
- var log = getLogger("gateway.ws.client-verify");
1111
+ import { IOGateway } from "@interopio/gateway";
1112
+ var log = getLogger2("gateway.ws.client-verify");
1113
1113
  function regexifyOriginFilters(originFilters) {
1114
1114
  if (originFilters) {
1115
- const block = (originFilters.block ?? originFilters.blacklist ?? []).map(IOGateway2.Filtering.regexify);
1116
- const allow = (originFilters.allow ?? originFilters.whitelist ?? []).map(IOGateway2.Filtering.regexify);
1115
+ const block = (originFilters.block ?? originFilters.blacklist ?? []).map(IOGateway.Filtering.regexify);
1116
+ const allow = (originFilters.allow ?? originFilters.whitelist ?? []).map(IOGateway.Filtering.regexify);
1117
1117
  return {
1118
1118
  non_matched: originFilters.non_matched ?? "allow",
1119
1119
  missing: originFilters.missing ?? "allow",
@@ -1166,12 +1166,12 @@ var upgradeMatcher = async ({ request }) => {
1166
1166
  upgradeMatcher.toString = () => "websocket upgrade";
1167
1167
 
1168
1168
  // src/app/route.ts
1169
- import { IOGateway as IOGateway3 } from "@interopio/gateway";
1169
+ import { IOGateway as IOGateway2 } from "@interopio/gateway";
1170
1170
  async function configure(app, config, routes) {
1171
1171
  const applyCors = (request, options) => {
1172
1172
  if (options?.cors) {
1173
1173
  const cors = options.cors === true ? {
1174
- allowOrigins: options.origins?.allow?.map(IOGateway3.Filtering.regexify),
1174
+ allowOrigins: options.origins?.allow?.map(IOGateway2.Filtering.regexify),
1175
1175
  allowMethods: request.method === void 0 ? ["*"] : [request.method],
1176
1176
  allowCredentials: options.authorize?.access !== "permitted" ? true : void 0
1177
1177
  } : options.cors;
@@ -1182,7 +1182,7 @@ async function configure(app, config, routes) {
1182
1182
  const configurer = new class {
1183
1183
  handle(...handlers) {
1184
1184
  handlers.forEach(({ request, options, handler }) => {
1185
- const matcher = pattern(IOGateway3.Filtering.regexify(request.path), { method: request.method });
1185
+ const matcher = pattern(IOGateway2.Filtering.regexify(request.path), { method: request.method });
1186
1186
  if (options?.authorize) {
1187
1187
  routes.authorize.push([matcher, options.authorize]);
1188
1188
  }