@comunica/actor-http-proxy 1.22.1 → 2.0.1-alpha.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/LICENSE.txt +2 -2
- package/README.md +6 -8
- package/components/ActorHttpProxy.jsonld +174 -0
- package/components/IProxyHandler.jsonld +31 -0
- package/components/ProxyHandlerStatic.jsonld +47 -0
- package/components/components.jsonld +6 -3
- package/components/context.jsonld +49 -6
- package/lib/ActorHttpProxy.d.ts +7 -10
- package/lib/ActorHttpProxy.js +6 -13
- package/lib/ProxyHandlerStatic.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/{index.js → lib/index.js} +2 -3
- package/package.json +14 -36
- package/components/Actor/Http/Proxy.jsonld +0 -36
- package/index.d.ts +0 -3
- package/lib/IProxyHandler.d.ts +0 -19
- package/lib/IProxyHandler.js +0 -3
package/LICENSE.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright © 2017–
|
|
4
|
-
Ghent University – imec, Belgium
|
|
3
|
+
Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
|
|
4
|
+
Comunica Association and Ghent University – imec, Belgium
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -23,24 +23,22 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
23
23
|
{
|
|
24
24
|
"@context": [
|
|
25
25
|
...
|
|
26
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^
|
|
26
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^2.0.0/components/context.jsonld"
|
|
27
27
|
],
|
|
28
28
|
"actors": [
|
|
29
29
|
...
|
|
30
30
|
{
|
|
31
|
-
"@id": "
|
|
31
|
+
"@id": "urn:comunica:default:http/actors#proxy",
|
|
32
32
|
"@type": "ActorHttpProxy",
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
"beforeActor": "config-sets:http.json#myHttpFetcher"
|
|
33
|
+
"mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" },
|
|
34
|
+
"beforeActors": { "@id": "urn:comunica:default:http/actors#fetch" }
|
|
37
35
|
}
|
|
38
36
|
]
|
|
39
37
|
}
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
Use `
|
|
40
|
+
Use `beforeActors` to indicate that this actor MUST always run _before_ your default HTTP actor.
|
|
43
41
|
|
|
44
42
|
### Config Parameters
|
|
45
43
|
|
|
46
|
-
* `
|
|
44
|
+
* `mediatorHttp`: A mediator over the [HTTP bus](https://github.com/comunica/comunica/tree/master/packages/bus-http).
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^2.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-http/^2.0.0/components/context.jsonld"
|
|
6
|
+
],
|
|
7
|
+
"@id": "npmd:@comunica/actor-http-proxy",
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy",
|
|
11
|
+
"@type": "Class",
|
|
12
|
+
"requireElement": "ActorHttpProxy",
|
|
13
|
+
"extends": [
|
|
14
|
+
"cbh:components/ActorHttp.jsonld#ActorHttp"
|
|
15
|
+
],
|
|
16
|
+
"comment": "A comunica Proxy Http Actor.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_mediatorHttp",
|
|
20
|
+
"range": "cc:components/Mediator.jsonld#Mediator",
|
|
21
|
+
"comment": "The HTTP mediator"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_name",
|
|
25
|
+
"range": "xsd:string",
|
|
26
|
+
"default": {
|
|
27
|
+
"@id": "rdf:subject"
|
|
28
|
+
},
|
|
29
|
+
"comment": "The name for this actor."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_bus",
|
|
33
|
+
"range": {
|
|
34
|
+
"@type": "ParameterRangeGenericComponent",
|
|
35
|
+
"component": "cc:components/Bus.jsonld#Bus",
|
|
36
|
+
"genericTypeInstances": [
|
|
37
|
+
{
|
|
38
|
+
"@type": "ParameterRangeGenericComponent",
|
|
39
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
40
|
+
"genericTypeInstances": [
|
|
41
|
+
{
|
|
42
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
43
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
47
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
51
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
57
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
61
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
65
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"default": {
|
|
70
|
+
"@id": "cbh:components/ActorHttp.jsonld#ActorHttp_default_bus",
|
|
71
|
+
"@type": "cc:components/Bus.jsonld#Bus"
|
|
72
|
+
},
|
|
73
|
+
"comment": "The bus this actor subscribes to."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_beforeActors",
|
|
77
|
+
"range": {
|
|
78
|
+
"@type": "ParameterRangeUnion",
|
|
79
|
+
"parameterRangeElements": [
|
|
80
|
+
{
|
|
81
|
+
"@type": "ParameterRangeArray",
|
|
82
|
+
"parameterRangeValue": {
|
|
83
|
+
"@type": "ParameterRangeGenericComponent",
|
|
84
|
+
"component": "cc:components/Actor.jsonld#Actor",
|
|
85
|
+
"genericTypeInstances": [
|
|
86
|
+
{
|
|
87
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
88
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
92
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
96
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^2.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"@type": "ParameterRangeUndefined"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"comment": "Actor that must be registered in the bus before this actor."
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"memberFields": [
|
|
110
|
+
{
|
|
111
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy__member_mediatorHttp",
|
|
112
|
+
"memberFieldName": "mediatorHttp",
|
|
113
|
+
"range": "cc:components/Mediator.jsonld#Mediator"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy__member_constructor",
|
|
117
|
+
"memberFieldName": "constructor"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy__member_test",
|
|
121
|
+
"memberFieldName": "test"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy__member_run",
|
|
125
|
+
"memberFieldName": "run"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"constructorArguments": [
|
|
129
|
+
{
|
|
130
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args__constructorArgument",
|
|
131
|
+
"fields": [
|
|
132
|
+
{
|
|
133
|
+
"keyRaw": "mediatorHttp",
|
|
134
|
+
"value": {
|
|
135
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_mediatorHttp"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"keyRaw": "name",
|
|
140
|
+
"value": {
|
|
141
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_name"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"keyRaw": "bus",
|
|
146
|
+
"value": {
|
|
147
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_bus"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"keyRaw": "beforeActors",
|
|
152
|
+
"value": {
|
|
153
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_beforeActors"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#IActorHttpProxyArgs",
|
|
162
|
+
"@type": "AbstractClass",
|
|
163
|
+
"requireElement": "IActorHttpProxyArgs",
|
|
164
|
+
"parameters": [],
|
|
165
|
+
"memberFields": [
|
|
166
|
+
{
|
|
167
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#IActorHttpProxyArgs__member_mediatorHttp",
|
|
168
|
+
"memberFieldName": "mediatorHttp"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"constructorArguments": []
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^2.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@comunica/actor-http-proxy",
|
|
6
|
+
"components": [
|
|
7
|
+
{
|
|
8
|
+
"@id": "cahp:components/IProxyHandler.jsonld#IProxyHandler",
|
|
9
|
+
"@type": "AbstractClass",
|
|
10
|
+
"requireElement": "IProxyHandler",
|
|
11
|
+
"comment": "A proxy handler can override a request.",
|
|
12
|
+
"parameters": [],
|
|
13
|
+
"memberKeys": [
|
|
14
|
+
"getProxy"
|
|
15
|
+
],
|
|
16
|
+
"constructorArguments": []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"@id": "cahp:components/IProxyHandler.jsonld#IRequest",
|
|
20
|
+
"@type": "AbstractClass",
|
|
21
|
+
"requireElement": "IRequest",
|
|
22
|
+
"comment": "A request that conforms to the fetch interface.",
|
|
23
|
+
"parameters": [],
|
|
24
|
+
"memberKeys": [
|
|
25
|
+
"input",
|
|
26
|
+
"init"
|
|
27
|
+
],
|
|
28
|
+
"constructorArguments": []
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^2.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/types/^2.0.0/components/context.jsonld"
|
|
5
|
+
],
|
|
6
|
+
"@id": "npmd:@comunica/actor-http-proxy",
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic",
|
|
10
|
+
"@type": "Class",
|
|
11
|
+
"requireElement": "ProxyHandlerStatic",
|
|
12
|
+
"extends": [
|
|
13
|
+
"ct:components/IProxyHandler.jsonld#IProxyHandler"
|
|
14
|
+
],
|
|
15
|
+
"comment": "A proxy handler that prefixes all URLs with a given string.",
|
|
16
|
+
"parameters": [
|
|
17
|
+
{
|
|
18
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic_prefixUrl",
|
|
19
|
+
"range": "xsd:string"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"memberFields": [
|
|
23
|
+
{
|
|
24
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic__member_prefixUrl",
|
|
25
|
+
"memberFieldName": "prefixUrl"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic__member_constructor",
|
|
29
|
+
"memberFieldName": "constructor"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic__member_getProxy",
|
|
33
|
+
"memberFieldName": "getProxy"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic__member_modifyInput",
|
|
37
|
+
"memberFieldName": "modifyInput"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"constructorArguments": [
|
|
41
|
+
{
|
|
42
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic_prefixUrl"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@context":
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^2.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
3
5
|
"@id": "npmd:@comunica/actor-http-proxy",
|
|
4
6
|
"@type": "Module",
|
|
5
7
|
"requireName": "@comunica/actor-http-proxy",
|
|
6
8
|
"import": [
|
|
7
|
-
"
|
|
9
|
+
"cahp:components/ActorHttpProxy.jsonld",
|
|
10
|
+
"cahp:components/ProxyHandlerStatic.jsonld"
|
|
8
11
|
]
|
|
9
|
-
}
|
|
12
|
+
}
|
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
|
|
4
4
|
{
|
|
5
5
|
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
-
"cahp": "npmd:@comunica/actor-http-proxy/",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"cahp": "npmd:@comunica/actor-http-proxy/^2.0.0/",
|
|
7
|
+
"ActorHttpProxy": {
|
|
8
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"args_mediatorHttp": {
|
|
12
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_mediatorHttp"
|
|
13
|
+
},
|
|
14
|
+
"args_name": {
|
|
15
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_name"
|
|
16
|
+
},
|
|
17
|
+
"args_bus": {
|
|
18
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_bus"
|
|
19
|
+
},
|
|
20
|
+
"args_beforeActors": {
|
|
21
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_beforeActors",
|
|
22
|
+
"@container": "@list"
|
|
23
|
+
},
|
|
24
|
+
"mediatorHttp": {
|
|
25
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_mediatorHttp"
|
|
26
|
+
},
|
|
27
|
+
"name": {
|
|
28
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_name"
|
|
29
|
+
},
|
|
30
|
+
"bus": {
|
|
31
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_bus"
|
|
32
|
+
},
|
|
33
|
+
"beforeActors": {
|
|
34
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#ActorHttpProxy_args_beforeActors",
|
|
35
|
+
"@container": "@list"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"IActorHttpProxyArgs": {
|
|
40
|
+
"@id": "cahp:components/ActorHttpProxy.jsonld#IActorHttpProxyArgs",
|
|
41
|
+
"@prefix": true,
|
|
42
|
+
"@context": {}
|
|
43
|
+
},
|
|
44
|
+
"ProxyHandlerStatic": {
|
|
45
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic",
|
|
46
|
+
"@prefix": true,
|
|
47
|
+
"@context": {
|
|
48
|
+
"prefixUrl": {
|
|
49
|
+
"@id": "cahp:components/ProxyHandlerStatic.jsonld#ProxyHandlerStatic_prefixUrl"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
10
53
|
}
|
|
11
54
|
]
|
|
12
|
-
}
|
|
55
|
+
}
|
package/lib/ActorHttpProxy.d.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import type { IActionHttp, IActorHttpOutput } from '@comunica/bus-http';
|
|
1
|
+
import type { IActionHttp, IActorHttpOutput, MediatorHttp, IActorHttpArgs } from '@comunica/bus-http';
|
|
2
2
|
import { ActorHttp } from '@comunica/bus-http';
|
|
3
|
-
import { KeysHttpProxy } from '@comunica/context-entries';
|
|
4
|
-
import type { IActorArgs, IActorTest, Mediator } from '@comunica/core';
|
|
5
3
|
import type { IMediatorTypeTime } from '@comunica/mediatortype-time';
|
|
6
4
|
/**
|
|
7
5
|
* A comunica Proxy Http Actor.
|
|
8
6
|
*/
|
|
9
7
|
export declare class ActorHttpProxy extends ActorHttp {
|
|
10
|
-
readonly mediatorHttp:
|
|
8
|
+
readonly mediatorHttp: MediatorHttp;
|
|
11
9
|
constructor(args: IActorHttpProxyArgs);
|
|
12
10
|
test(action: IActionHttp): Promise<IMediatorTypeTime>;
|
|
13
11
|
run(action: IActionHttp): Promise<IActorHttpOutput>;
|
|
14
12
|
}
|
|
15
|
-
export interface IActorHttpProxyArgs extends
|
|
16
|
-
|
|
13
|
+
export interface IActorHttpProxyArgs extends IActorHttpArgs {
|
|
14
|
+
/**
|
|
15
|
+
* The HTTP mediator
|
|
16
|
+
*/
|
|
17
|
+
mediatorHttp: MediatorHttp;
|
|
17
18
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Import this constant from @comunica/context-entries.
|
|
20
|
-
*/
|
|
21
|
-
export declare const KEY_CONTEXT_HTTPPROXYHANDLER = KeysHttpProxy.httpProxyHandler;
|
package/lib/ActorHttpProxy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ActorHttpProxy = void 0;
|
|
4
4
|
const bus_http_1 = require("@comunica/bus-http");
|
|
5
5
|
const context_entries_1 = require("@comunica/context-entries");
|
|
6
6
|
/**
|
|
@@ -11,9 +11,6 @@ class ActorHttpProxy extends bus_http_1.ActorHttp {
|
|
|
11
11
|
super(args);
|
|
12
12
|
}
|
|
13
13
|
async test(action) {
|
|
14
|
-
if (!action.context) {
|
|
15
|
-
throw new Error(`Actor ${this.name} could not find a context.`);
|
|
16
|
-
}
|
|
17
14
|
const proxyHandler = action.context.get(context_entries_1.KeysHttpProxy.httpProxyHandler);
|
|
18
15
|
if (!proxyHandler) {
|
|
19
16
|
throw new Error(`Actor ${this.name} could not find a proxy handler in the context.`);
|
|
@@ -25,25 +22,21 @@ class ActorHttpProxy extends bus_http_1.ActorHttp {
|
|
|
25
22
|
}
|
|
26
23
|
async run(action) {
|
|
27
24
|
const requestedUrl = typeof action.input === 'string' ? action.input : action.input.url;
|
|
28
|
-
if (!action.context) {
|
|
29
|
-
throw new Error('Illegal state: missing context');
|
|
30
|
-
}
|
|
31
25
|
const proxyHandler = action.context.get(context_entries_1.KeysHttpProxy.httpProxyHandler);
|
|
32
26
|
// Send a request for the modified request
|
|
33
|
-
const output = await this.mediatorHttp.mediate(
|
|
27
|
+
const output = await this.mediatorHttp.mediate({
|
|
28
|
+
...await proxyHandler.getProxy(action),
|
|
29
|
+
context: action.context.delete(context_entries_1.KeysHttpProxy.httpProxyHandler),
|
|
30
|
+
});
|
|
34
31
|
// Modify the response URL
|
|
35
32
|
// use defineProperty to allow modification of unmodifiable objects
|
|
36
33
|
Object.defineProperty(output, 'url', {
|
|
37
34
|
configurable: true,
|
|
38
35
|
enumerable: true,
|
|
39
|
-
get: () =>
|
|
36
|
+
get: () => output.headers.get('x-final-url') ?? requestedUrl,
|
|
40
37
|
});
|
|
41
38
|
return output;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
exports.ActorHttpProxy = ActorHttpProxy;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Import this constant from @comunica/context-entries.
|
|
47
|
-
*/
|
|
48
|
-
exports.KEY_CONTEXT_HTTPPROXYHANDLER = context_entries_1.KeysHttpProxy.httpProxyHandler;
|
|
49
42
|
//# sourceMappingURL=ActorHttpProxy.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -10,7 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./
|
|
15
|
-
__exportStar(require("./lib/ProxyHandlerStatic"), exports);
|
|
13
|
+
__exportStar(require("./ActorHttpProxy"), exports);
|
|
14
|
+
__exportStar(require("./ProxyHandlerStatic"), exports);
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-http-proxy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.1-alpha.5.0",
|
|
4
4
|
"description": "A proxy http actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"typings": "index",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/comunica/comunica.git",
|
|
@@ -27,41 +27,19 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"components",
|
|
29
29
|
"lib/**/*.d.ts",
|
|
30
|
-
"lib/**/*.js"
|
|
31
|
-
"index.d.ts",
|
|
32
|
-
"index.js"
|
|
30
|
+
"lib/**/*.js"
|
|
33
31
|
],
|
|
34
|
-
"
|
|
35
|
-
"@comunica/bus-http": "
|
|
36
|
-
"@comunica/context-entries": "
|
|
37
|
-
"@comunica/core": "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"@comunica/bus-http": "^1.22.1",
|
|
41
|
-
"@comunica/core": "^1.22.0",
|
|
42
|
-
"@comunica/mediatortype-time": "^1.22.0"
|
|
43
|
-
},
|
|
44
|
-
"jest": {
|
|
45
|
-
"globals": {
|
|
46
|
-
"ts-jest": {
|
|
47
|
-
"tsConfig": "../../tsconfig.json"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"transform": {
|
|
51
|
-
"^.+\\.ts$": "ts-jest"
|
|
52
|
-
},
|
|
53
|
-
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
|
|
54
|
-
"moduleFileExtensions": [
|
|
55
|
-
"ts",
|
|
56
|
-
"js"
|
|
57
|
-
],
|
|
58
|
-
"collectCoverage": true
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@comunica/bus-http": "2.0.1-alpha.5.0",
|
|
34
|
+
"@comunica/context-entries": "2.0.1-alpha.5.0",
|
|
35
|
+
"@comunica/core": "2.0.1-alpha.5.0",
|
|
36
|
+
"@comunica/mediatortype-time": "2.0.1-alpha.5.0",
|
|
37
|
+
"@comunica/types": "2.0.1-alpha.5.0"
|
|
59
38
|
},
|
|
60
39
|
"scripts": {
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"build": "
|
|
64
|
-
"validate": "npm ls"
|
|
40
|
+
"build": "npm run build:ts && npm run build:components",
|
|
41
|
+
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
42
|
+
"build:components": "componentsjs-generator"
|
|
65
43
|
},
|
|
66
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e2ae2e9e924bf0656df60cc99774f7e560d47695"
|
|
67
45
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^1.0.0/components/context.jsonld",
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-http/^1.0.0/components/context.jsonld"
|
|
5
|
-
],
|
|
6
|
-
"@id": "npmd:@comunica/actor-http-proxy",
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"@id": "cahp:Actor/Http/Proxy",
|
|
10
|
-
"@type": "Class",
|
|
11
|
-
"extends": "cbh:Actor/Http",
|
|
12
|
-
"requireElement": "ActorHttpProxy",
|
|
13
|
-
"comment": "A comunica Proxy Http Actor.",
|
|
14
|
-
"parameters": [
|
|
15
|
-
{
|
|
16
|
-
"@id": "cahp:Actor/Http/Proxy/mediatorHttp",
|
|
17
|
-
"comment": "The HTTP mediator",
|
|
18
|
-
"required": true,
|
|
19
|
-
"unique": true
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"constructorArguments": [
|
|
23
|
-
{
|
|
24
|
-
"@id": "cahp:Actor/Http/Proxy/constructorArgumentsObject",
|
|
25
|
-
"extends": "cbh:Actor/Http/constructorArgumentsObject",
|
|
26
|
-
"fields": [
|
|
27
|
-
{
|
|
28
|
-
"keyRaw": "mediatorHttp",
|
|
29
|
-
"value": "cahp:Actor/Http/Proxy/mediatorHttp"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
package/index.d.ts
DELETED
package/lib/IProxyHandler.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A proxy handler can override a request.
|
|
3
|
-
*/
|
|
4
|
-
export interface IProxyHandler {
|
|
5
|
-
/**
|
|
6
|
-
* Get a new proxied request for a given request.
|
|
7
|
-
* If the given request is not applicable, null can be returned.
|
|
8
|
-
* @param {IRequest} request A request.
|
|
9
|
-
* @return {Promise<IRequest>} A new request, or null.
|
|
10
|
-
*/
|
|
11
|
-
getProxy: (request: IRequest) => Promise<IRequest>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* A request that conforms to the fetch interface.
|
|
15
|
-
*/
|
|
16
|
-
export interface IRequest {
|
|
17
|
-
input: RequestInfo;
|
|
18
|
-
init?: RequestInit;
|
|
19
|
-
}
|
package/lib/IProxyHandler.js
DELETED