@comunica/actor-http-proxy 2.4.0 → 2.5.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActorHttpProxy.js","sourceRoot":"","sources":["ActorHttpProxy.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAC/C,+DAA0D;AAI1D;;GAEG;AACH,MAAa,cAAe,SAAQ,oBAAS;IAG3C,YAAmB,IAAyB;QAC1C,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAAmB;QACnC,MAAM,YAAY,GAA8B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,+BAAa,CAAC,gBAAgB,CAAC,CAAC;QACnG,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,iDAAiD,CAAC,CAAC;SACtF;QACD,IAAI,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,qDAAqD,CAAC,CAAC;SAC1F;QACD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAAmB;QAClC,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACxF,MAAM,YAAY,GAAkB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,+BAAa,CAAC,gBAAgB,CAAE,CAAC;QAExF,0CAA0C;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;YAC7C,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;YACtC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,+BAAa,CAAC,gBAAgB,CAAC;SAC/D,CAAC,CAAC;QAEH,0BAA0B;QAC1B,mEAAmE;QACnE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE;YACnC,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,YAAY;SAC7D,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArCD,wCAqCC","sourcesContent":["import type { IActionHttp, IActorHttpOutput, MediatorHttp, IActorHttpArgs } from '@comunica/bus-http';\nimport { ActorHttp } from '@comunica/bus-http';\nimport { KeysHttpProxy } from '@comunica/context-entries';\nimport type { IMediatorTypeTime } from '@comunica/mediatortype-time';\nimport type { IProxyHandler } from '@comunica/types';\n\n/**\n * A comunica Proxy Http Actor.\n */\nexport class ActorHttpProxy extends ActorHttp {\n public readonly mediatorHttp: MediatorHttp;\n\n public constructor(args: IActorHttpProxyArgs) {\n super(args);\n }\n\n public async test(action: IActionHttp): Promise<IMediatorTypeTime> {\n const proxyHandler: IProxyHandler | undefined = action.context.get(KeysHttpProxy.httpProxyHandler);\n if (!proxyHandler) {\n throw new Error(`Actor ${this.name} could not find a proxy handler in the context.`);\n }\n if (!await proxyHandler.getProxy(action)) {\n throw new Error(`Actor ${this.name} could not determine a proxy for the given request.`);\n }\n return { time: Number.POSITIVE_INFINITY };\n }\n\n public async run(action: IActionHttp): Promise<IActorHttpOutput> {\n const requestedUrl = typeof action.input === 'string' ? action.input : action.input.url;\n const proxyHandler: IProxyHandler = action.context.get(KeysHttpProxy.httpProxyHandler)!;\n\n // Send a request for the modified request\n const output = await this.mediatorHttp.mediate({\n ...await proxyHandler.getProxy(action),\n context: action.context.delete(KeysHttpProxy.httpProxyHandler),\n });\n\n // Modify the response URL\n // use defineProperty to allow modification of unmodifiable objects\n Object.defineProperty(output, 'url', {\n configurable: true,\n enumerable: true,\n get: () => output.headers.get('x-final-url') ?? requestedUrl,\n });\n return output;\n }\n}\n\nexport interface IActorHttpProxyArgs extends IActorHttpArgs {\n /**\n * The HTTP mediator\n */\n mediatorHttp: MediatorHttp;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyHandlerStatic.js","sourceRoot":"","sources":["ProxyHandlerStatic.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,kBAAkB;IAG7B,YAAmB,SAAiB;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,OAAiB;QACrC,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;SACvC,CAAC;IACJ,CAAC;IAEM,WAAW,CAAC,KAAkB;QACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;SAC/B;QACD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;CACF;AApBD,gDAoBC","sourcesContent":["import type { IProxyHandler, IRequest } from '@comunica/types';\n\n/**\n * A proxy handler that prefixes all URLs with a given string.\n */\nexport class ProxyHandlerStatic implements IProxyHandler {\n private readonly prefixUrl: string;\n\n public constructor(prefixUrl: string) {\n this.prefixUrl = prefixUrl;\n }\n\n public async getProxy(request: IRequest): Promise<IRequest> {\n return {\n init: request.init,\n input: this.modifyInput(request.input),\n };\n }\n\n public modifyInput(input: RequestInfo): RequestInfo {\n if (typeof input === 'string') {\n return this.prefixUrl + input;\n }\n return new Request(this.prefixUrl + input.url, input);\n }\n}\n"]}
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uDAAqC","sourcesContent":["export * from './ActorHttpProxy';\nexport * from './ProxyHandlerStatic';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-http-proxy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "A proxy http actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"components",
|
|
30
30
|
"lib/**/*.d.ts",
|
|
31
|
-
"lib/**/*.js"
|
|
31
|
+
"lib/**/*.js",
|
|
32
|
+
"lib/**/*.js.map"
|
|
32
33
|
],
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@comunica/bus-http": "^2.
|
|
35
|
-
"@comunica/context-entries": "^2.
|
|
36
|
-
"@comunica/mediatortype-time": "^2.
|
|
37
|
-
"@comunica/types": "^2.
|
|
35
|
+
"@comunica/bus-http": "^2.5.1",
|
|
36
|
+
"@comunica/context-entries": "^2.5.1",
|
|
37
|
+
"@comunica/mediatortype-time": "^2.5.1",
|
|
38
|
+
"@comunica/types": "^2.5.1"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "npm run build:ts && npm run build:components",
|
|
41
42
|
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
42
43
|
"build:components": "componentsjs-generator"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d64e87fad4a616224c210c2d22b38f6f9b00e1ea"
|
|
45
46
|
}
|