@comunica/actor-http-proxy 2.4.0 → 2.5.0
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/lib/ActorHttpProxy.js.map +1 -0
- package/lib/ProxyHandlerStatic.js.map +1 -0
- package/lib/index.js.map +1 -0
- package/package.json +8 -7
- package/LICENSE.txt +0 -22
|
@@ -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.0",
|
|
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.0",
|
|
36
|
+
"@comunica/context-entries": "^2.5.0",
|
|
37
|
+
"@comunica/mediatortype-time": "^2.5.0",
|
|
38
|
+
"@comunica/types": "^2.5.0"
|
|
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": "349d57f5d1e539200e980bdff96973c2e0b66caa"
|
|
45
46
|
}
|
package/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
|
|
4
|
-
Comunica Association and Ghent University – imec, Belgium
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in
|
|
14
|
-
all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
THE SOFTWARE.
|