@comunica/bus-dereference 4.5.0 → 5.0.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/README.md CHANGED
@@ -17,7 +17,7 @@ $ yarn add @comunica/bus-dereference
17
17
 
18
18
  ## Bus usage
19
19
 
20
- * **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^4.0.0/components/context.jsonld"`
20
+ * **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld"`
21
21
  * **Bus name**: `cbd:Bus/Dereference`
22
22
 
23
23
  ## Creating actors on this bus
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^4.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld"
5
5
  ],
6
6
  "@id": "npmd:@comunica/bus-dereference",
7
7
  "components": [
@@ -44,37 +44,37 @@
44
44
  "genericTypeInstances": [
45
45
  {
46
46
  "@type": "ParameterRangeGenericTypeReference",
47
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
47
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
48
48
  },
49
49
  {
50
50
  "@type": "ParameterRangeGenericTypeReference",
51
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
51
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
52
52
  },
53
53
  {
54
54
  "@type": "ParameterRangeGenericTypeReference",
55
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
55
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
56
56
  },
57
57
  {
58
58
  "@type": "ParameterRangeGenericTypeReference",
59
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
59
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
60
60
  }
61
61
  ]
62
62
  },
63
63
  {
64
64
  "@type": "ParameterRangeGenericTypeReference",
65
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
65
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
66
66
  },
67
67
  {
68
68
  "@type": "ParameterRangeGenericTypeReference",
69
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
69
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
70
70
  },
71
71
  {
72
72
  "@type": "ParameterRangeGenericTypeReference",
73
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
73
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
74
74
  },
75
75
  {
76
76
  "@type": "ParameterRangeGenericTypeReference",
77
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
77
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
78
78
  }
79
79
  ]
80
80
  },
@@ -111,19 +111,19 @@
111
111
  "genericTypeInstances": [
112
112
  {
113
113
  "@type": "ParameterRangeGenericTypeReference",
114
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
114
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
115
115
  },
116
116
  {
117
117
  "@type": "ParameterRangeGenericTypeReference",
118
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
118
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
119
119
  },
120
120
  {
121
121
  "@type": "ParameterRangeGenericTypeReference",
122
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
122
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
123
123
  },
124
124
  {
125
125
  "@type": "ParameterRangeGenericTypeReference",
126
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
126
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
127
127
  }
128
128
  ]
129
129
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^4.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld"
5
5
  ],
6
6
  "@id": "npmd:@comunica/bus-dereference",
7
7
  "components": [
@@ -77,37 +77,37 @@
77
77
  "genericTypeInstances": [
78
78
  {
79
79
  "@type": "ParameterRangeGenericTypeReference",
80
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
80
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
81
81
  },
82
82
  {
83
83
  "@type": "ParameterRangeGenericTypeReference",
84
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
84
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
85
85
  },
86
86
  {
87
87
  "@type": "ParameterRangeGenericTypeReference",
88
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
88
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
89
89
  },
90
90
  {
91
91
  "@type": "ParameterRangeGenericTypeReference",
92
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
92
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
93
93
  }
94
94
  ]
95
95
  },
96
96
  {
97
97
  "@type": "ParameterRangeGenericTypeReference",
98
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
98
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
99
99
  },
100
100
  {
101
101
  "@type": "ParameterRangeGenericTypeReference",
102
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
102
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
103
103
  },
104
104
  {
105
105
  "@type": "ParameterRangeGenericTypeReference",
106
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
106
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
107
107
  },
108
108
  {
109
109
  "@type": "ParameterRangeGenericTypeReference",
110
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
110
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
111
111
  }
112
112
  ]
113
113
  },
@@ -139,19 +139,19 @@
139
139
  "genericTypeInstances": [
140
140
  {
141
141
  "@type": "ParameterRangeGenericTypeReference",
142
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
142
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
143
143
  },
144
144
  {
145
145
  "@type": "ParameterRangeGenericTypeReference",
146
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
146
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
147
147
  },
148
148
  {
149
149
  "@type": "ParameterRangeGenericTypeReference",
150
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
150
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
151
151
  },
152
152
  {
153
153
  "@type": "ParameterRangeGenericTypeReference",
154
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
154
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
155
155
  }
156
156
  ]
157
157
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^4.0.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
5
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-parse/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^5.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-parse/^5.0.0/components/context.jsonld"
6
6
  ],
7
7
  "@id": "npmd:@comunica/bus-dereference",
8
8
  "components": [
@@ -147,37 +147,37 @@
147
147
  "genericTypeInstances": [
148
148
  {
149
149
  "@type": "ParameterRangeGenericTypeReference",
150
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
150
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
151
151
  },
152
152
  {
153
153
  "@type": "ParameterRangeGenericTypeReference",
154
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
154
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
155
155
  },
156
156
  {
157
157
  "@type": "ParameterRangeGenericTypeReference",
158
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
158
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
159
159
  },
160
160
  {
161
161
  "@type": "ParameterRangeGenericTypeReference",
162
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
162
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
163
163
  }
164
164
  ]
165
165
  },
166
166
  {
167
167
  "@type": "ParameterRangeGenericTypeReference",
168
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
168
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
169
169
  },
170
170
  {
171
171
  "@type": "ParameterRangeGenericTypeReference",
172
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
172
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
173
173
  },
174
174
  {
175
175
  "@type": "ParameterRangeGenericTypeReference",
176
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
176
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
177
177
  },
178
178
  {
179
179
  "@type": "ParameterRangeGenericTypeReference",
180
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
180
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
181
181
  }
182
182
  ]
183
183
  },
@@ -209,19 +209,19 @@
209
209
  "genericTypeInstances": [
210
210
  {
211
211
  "@type": "ParameterRangeGenericTypeReference",
212
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
212
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
213
213
  },
214
214
  {
215
215
  "@type": "ParameterRangeGenericTypeReference",
216
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
216
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
217
217
  },
218
218
  {
219
219
  "@type": "ParameterRangeGenericTypeReference",
220
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
220
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
221
221
  },
222
222
  {
223
223
  "@type": "ParameterRangeGenericTypeReference",
224
- "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
224
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^5.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
225
225
  }
226
226
  ]
227
227
  }
@@ -0,0 +1,73 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/bus-dereference",
6
+ "components": [
7
+ {
8
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper",
9
+ "@type": "Class",
10
+ "requireElement": "DereferenceRdfCachePolicyDereferenceWrapper",
11
+ "parameters": [
12
+ {
13
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_cachePolicy",
14
+ "range": {
15
+ "@type": "ParameterRangeWildcard"
16
+ }
17
+ },
18
+ {
19
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_mediaTypes",
20
+ "range": {
21
+ "@type": "ParameterRangeWildcard"
22
+ }
23
+ }
24
+ ],
25
+ "memberFields": [
26
+ {
27
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_cachePolicy",
28
+ "memberFieldName": "cachePolicy"
29
+ },
30
+ {
31
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_mediaTypes",
32
+ "memberFieldName": "mediaTypes"
33
+ },
34
+ {
35
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_constructor",
36
+ "memberFieldName": "constructor"
37
+ },
38
+ {
39
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_storable",
40
+ "memberFieldName": "storable"
41
+ },
42
+ {
43
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_satisfiesWithoutRevalidation",
44
+ "memberFieldName": "satisfiesWithoutRevalidation"
45
+ },
46
+ {
47
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_responseHeaders",
48
+ "memberFieldName": "responseHeaders"
49
+ },
50
+ {
51
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_timeToLive",
52
+ "memberFieldName": "timeToLive"
53
+ },
54
+ {
55
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_revalidationHeaders",
56
+ "memberFieldName": "revalidationHeaders"
57
+ },
58
+ {
59
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper__member_revalidatedPolicy",
60
+ "memberFieldName": "revalidatedPolicy"
61
+ }
62
+ ],
63
+ "constructorArguments": [
64
+ {
65
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_cachePolicy"
66
+ },
67
+ {
68
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_mediaTypes"
69
+ }
70
+ ]
71
+ }
72
+ ]
73
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^4.0.0/components/context.jsonld"
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-dereference/^5.0.0/components/context.jsonld"
4
4
  ],
5
5
  "@id": "npmd:@comunica/bus-dereference",
6
6
  "@type": "Module",
@@ -8,6 +8,7 @@
8
8
  "import": [
9
9
  "cbd:components/ActorDereference.jsonld",
10
10
  "cbd:components/ActorDereferenceParse.jsonld",
11
- "cbd:components/ActorDereferenceBase.jsonld"
11
+ "cbd:components/ActorDereferenceBase.jsonld",
12
+ "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld"
12
13
  ]
13
14
  }
@@ -3,7 +3,7 @@
3
3
  "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
4
  {
5
5
  "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
- "cbd": "npmd:@comunica/bus-dereference/^4.0.0/",
6
+ "cbd": "npmd:@comunica/bus-dereference/^5.0.0/",
7
7
  "ActorDereference": {
8
8
  "@id": "cbd:components/ActorDereference.jsonld#ActorDereference",
9
9
  "@prefix": true,
@@ -140,6 +140,18 @@
140
140
  "@container": "@list"
141
141
  }
142
142
  }
143
+ },
144
+ "DereferenceRdfCachePolicyDereferenceWrapper": {
145
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper",
146
+ "@prefix": true,
147
+ "@context": {
148
+ "cachePolicy": {
149
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_cachePolicy"
150
+ },
151
+ "mediaTypes": {
152
+ "@id": "cbd:components/DereferenceRdfCachePolicyDereferenceWrapper.jsonld#DereferenceRdfCachePolicyDereferenceWrapper_mediaTypes"
153
+ }
154
+ }
143
155
  }
144
156
  }
145
157
  ]
@@ -1,5 +1,5 @@
1
- /// <reference types="node" />
2
1
  import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';
2
+ import type { ICachePolicy } from '@comunica/types';
3
3
  import { ActorDereferenceBase } from './ActorDereferenceBase';
4
4
  /**
5
5
  * A base actor for dereferencing URLs to (generic) streams.
@@ -83,6 +83,10 @@ export interface IActorDereferenceOutput extends IActorOutput {
83
83
  * This is the time until the first byte arrives.
84
84
  */
85
85
  requestTime: number;
86
+ /**
87
+ * The HTTP status code.
88
+ */
89
+ status: number;
86
90
  /**
87
91
  * The returned headers of the final URL.
88
92
  */
@@ -91,6 +95,14 @@ export interface IActorDereferenceOutput extends IActorOutput {
91
95
  * The mediatype of the source
92
96
  */
93
97
  mediaType?: string;
98
+ /**
99
+ * The version that was defined as media type parameter.
100
+ */
101
+ version?: string;
102
+ /**
103
+ * The cache policy of the request's response.
104
+ */
105
+ cachePolicy?: ICachePolicy<IActionDereference>;
94
106
  }
95
107
  export type IActorDereferenceArgs = IActorArgs<IActionDereference, IActorTest, IActorDereferenceOutput>;
96
108
  export type MediatorDereference = Mediate<IActionDereference, IActorDereferenceOutput>;
@@ -34,7 +34,7 @@ class ActorDereference extends ActorDereferenceBase_1.ActorDereferenceBase {
34
34
  * @return {Promise<IActorDereferenceOutput>} A promise that rejects or resolves to an empty output.
35
35
  */
36
36
  async handleDereferenceErrors(action, error, headers, requestTime = 0) {
37
- return this.dereferenceErrorHandler(action, error, { url: action.url, exists: false, headers, requestTime });
37
+ return this.dereferenceErrorHandler(action, error, { url: action.url, exists: false, status: 404, headers, requestTime });
38
38
  }
39
39
  }
40
40
  exports.ActorDereference = ActorDereference;
@@ -1 +1 @@
1
- {"version":3,"file":"ActorDereference.js","sourceRoot":"","sources":["ActorDereference.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAE9D;;;;;;;;;;GAUG;AACH,MAAsB,gBAAiB,SACrC,2CAA6E;IAC7E,4BAA4B;IAC5B;;;;OAIG;IACH,2BAA2B;IAC3B,YAAmB,IAA2B;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,uBAAuB,CACrC,MAA0B,EAC1B,KAAc,EACd,OAA6B,EAC7B,WAAW,GAAG,CAAC;QAEf,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/G,CAAC;CACF;AA9BD,4CA8BC","sourcesContent":["import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';\nimport { ActorDereferenceBase } from './ActorDereferenceBase';\n\n/**\n * A base actor for dereferencing URLs to (generic) streams.\n *\n * Actor types:\n * * Input: IActionDereference: A URL.\n * * Test: <none>\n * * Output: IActorDereferenceOutput: A Readable stream\n *\n * @see IActionDereference\n * @see IActorDereferenceOutput\n */\nexport abstract class ActorDereference extends\n ActorDereferenceBase<IActionDereference, IActorTest, IActorDereferenceOutput> {\n /* eslint-disable max-len */\n /**\n * @param args -\n * \\ @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus\n * \\ @defaultNested {Dereferencing failed: none of the configured actors were able to handle ${action.url}} busFailMessage\n */\n /* eslint-enable max-len */\n public constructor(args: IActorDereferenceArgs) {\n super(args);\n }\n\n /**\n * Handle the given error as a rejection or delegate it to the logger,\n * depending on whether or not hard errors are enabled.\n * @param {IActionDereference} action A dereference action.\n * @param {Error} error An error that has occurred.\n * @param headers Optional HTTP headers to pass.\n * @param {number} requestTime The time it took to request the page in milliseconds.\n * @return {Promise<IActorDereferenceOutput>} A promise that rejects or resolves to an empty output.\n */\n protected async handleDereferenceErrors(\n action: IActionDereference,\n error: unknown,\n headers?: Headers | undefined,\n requestTime = 0,\n ): Promise<IActorDereferenceOutput> {\n return this.dereferenceErrorHandler(action, error, { url: action.url, exists: false, headers, requestTime });\n }\n}\n\nexport interface IActionDereference extends IAction {\n /**\n * The URL to dereference\n */\n url: string;\n /**\n * By default, actors will reject upon receiving non-200 HTTP responses.\n * If this option is true, then all HTTP responses will cause the action to resolve,\n * but some outputs may therefore contain empty quad streams.\n */\n acceptErrors?: boolean;\n /**\n * Optional HTTP method to use.\n * Defaults to GET.\n */\n method?: string;\n /**\n * Optional HTTP headers to pass.\n */\n headers?: Headers;\n /**\n * An optional callback to retrieve the mediaType mappings\n */\n mediaTypes?: () => Promise<Record<string, number> | undefined>;\n}\n\ninterface IReadableClose extends NodeJS.ReadableStream {\n close?: () => void | Promise<void>;\n}\n\nexport interface IActorDereferenceOutput extends IActorOutput {\n /**\n * The page on which the output was found.\n *\n * This is not necessarily the same as the original input url,\n * as this may have changed due to redirects.\n */\n url: string;\n /**\n * BaseIRI, this is used over url when passed to metadata.baseIRI in ActorDereferenceRdfParse.ts\n */\n baseIRI?: string;\n /**\n * The resulting stream.\n */\n data: IReadableClose;\n /**\n * This will always be true, unless `acceptErrors` was set to true in the action and the dereferencing failed.\n */\n exists: boolean;\n /**\n * The time it took to request the page in milliseconds.\n * This is the time until the first byte arrives.\n */\n requestTime: number;\n /**\n * The returned headers of the final URL.\n */\n headers?: Headers;\n /**\n * The mediatype of the source\n */\n mediaType?: string;\n}\n\nexport type IActorDereferenceArgs = IActorArgs<IActionDereference, IActorTest, IActorDereferenceOutput>;\n\nexport type MediatorDereference = Mediate<IActionDereference, IActorDereferenceOutput>;\n"]}
1
+ {"version":3,"file":"ActorDereference.js","sourceRoot":"","sources":["ActorDereference.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAE9D;;;;;;;;;;GAUG;AACH,MAAsB,gBAAiB,SACrC,2CAA6E;IAC7E,4BAA4B;IAC5B;;;;OAIG;IACH,2BAA2B;IAC3B,YAAmB,IAA2B;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,uBAAuB,CACrC,MAA0B,EAC1B,KAAc,EACd,OAA6B,EAC7B,WAAW,GAAG,CAAC;QAEf,OAAO,IAAI,CAAC,uBAAuB,CACjC,MAAM,EACN,KAAK,EACL,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,CACtE,CAAC;IACJ,CAAC;CACF;AAlCD,4CAkCC","sourcesContent":["import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core';\nimport type { ICachePolicy } from '@comunica/types';\nimport { ActorDereferenceBase } from './ActorDereferenceBase';\n\n/**\n * A base actor for dereferencing URLs to (generic) streams.\n *\n * Actor types:\n * * Input: IActionDereference: A URL.\n * * Test: <none>\n * * Output: IActorDereferenceOutput: A Readable stream\n *\n * @see IActionDereference\n * @see IActorDereferenceOutput\n */\nexport abstract class ActorDereference extends\n ActorDereferenceBase<IActionDereference, IActorTest, IActorDereferenceOutput> {\n /* eslint-disable max-len */\n /**\n * @param args -\n * \\ @defaultNested {<default_bus> a <cc:components/Bus.jsonld#Bus>} bus\n * \\ @defaultNested {Dereferencing failed: none of the configured actors were able to handle ${action.url}} busFailMessage\n */\n /* eslint-enable max-len */\n public constructor(args: IActorDereferenceArgs) {\n super(args);\n }\n\n /**\n * Handle the given error as a rejection or delegate it to the logger,\n * depending on whether or not hard errors are enabled.\n * @param {IActionDereference} action A dereference action.\n * @param {Error} error An error that has occurred.\n * @param headers Optional HTTP headers to pass.\n * @param {number} requestTime The time it took to request the page in milliseconds.\n * @return {Promise<IActorDereferenceOutput>} A promise that rejects or resolves to an empty output.\n */\n protected async handleDereferenceErrors(\n action: IActionDereference,\n error: unknown,\n headers?: Headers | undefined,\n requestTime = 0,\n ): Promise<IActorDereferenceOutput> {\n return this.dereferenceErrorHandler(\n action,\n error,\n { url: action.url, exists: false, status: 404, headers, requestTime },\n );\n }\n}\n\nexport interface IActionDereference extends IAction {\n /**\n * The URL to dereference\n */\n url: string;\n /**\n * By default, actors will reject upon receiving non-200 HTTP responses.\n * If this option is true, then all HTTP responses will cause the action to resolve,\n * but some outputs may therefore contain empty quad streams.\n */\n acceptErrors?: boolean;\n /**\n * Optional HTTP method to use.\n * Defaults to GET.\n */\n method?: string;\n /**\n * Optional HTTP headers to pass.\n */\n headers?: Headers;\n /**\n * An optional callback to retrieve the mediaType mappings\n */\n mediaTypes?: () => Promise<Record<string, number> | undefined>;\n}\n\ninterface IReadableClose extends NodeJS.ReadableStream {\n close?: () => void | Promise<void>;\n}\n\nexport interface IActorDereferenceOutput extends IActorOutput {\n /**\n * The page on which the output was found.\n *\n * This is not necessarily the same as the original input url,\n * as this may have changed due to redirects.\n */\n url: string;\n /**\n * BaseIRI, this is used over url when passed to metadata.baseIRI in ActorDereferenceRdfParse.ts\n */\n baseIRI?: string;\n /**\n * The resulting stream.\n */\n data: IReadableClose;\n /**\n * This will always be true, unless `acceptErrors` was set to true in the action and the dereferencing failed.\n */\n exists: boolean;\n /**\n * The time it took to request the page in milliseconds.\n * This is the time until the first byte arrives.\n */\n requestTime: number;\n /**\n * The HTTP status code.\n */\n status: number;\n /**\n * The returned headers of the final URL.\n */\n headers?: Headers;\n /**\n * The mediatype of the source\n */\n mediaType?: string;\n /**\n * The version that was defined as media type parameter.\n */\n version?: string;\n /**\n * The cache policy of the request's response.\n */\n cachePolicy?: ICachePolicy<IActionDereference>;\n}\n\nexport type IActorDereferenceArgs = IActorArgs<IActionDereference, IActorTest, IActorDereferenceOutput>;\n\nexport type MediatorDereference = Mediate<IActionDereference, IActorDereferenceOutput>;\n"]}
@@ -10,6 +10,11 @@ export declare function emptyReadable<S extends Readable>(): S;
10
10
  * @return {boolean} If hard errors are enabled.
11
11
  */
12
12
  export declare function isHardError(context: IActionContext): boolean;
13
+ /**
14
+ * If a warning should be emitted for the given type of error.
15
+ * @param error An error.
16
+ */
17
+ export declare function shouldLogWarning(error: Error): boolean;
13
18
  /**
14
19
  * A base actor for dereferencing URLs to (generic) streams.
15
20
  *
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActorDereferenceBase = exports.isHardError = exports.emptyReadable = void 0;
3
+ exports.ActorDereferenceBase = void 0;
4
+ exports.emptyReadable = emptyReadable;
5
+ exports.isHardError = isHardError;
6
+ exports.shouldLogWarning = shouldLogWarning;
4
7
  const context_entries_1 = require("@comunica/context-entries");
5
8
  const core_1 = require("@comunica/core");
6
9
  const readable_stream_1 = require("readable-stream");
@@ -9,7 +12,6 @@ function emptyReadable() {
9
12
  data.push(null);
10
13
  return data;
11
14
  }
12
- exports.emptyReadable = emptyReadable;
13
15
  /**
14
16
  * Check if hard errors should occur on HTTP or parse errors.
15
17
  * @param {IActionContext} context An action context.
@@ -18,7 +20,13 @@ exports.emptyReadable = emptyReadable;
18
20
  function isHardError(context) {
19
21
  return !context.get(context_entries_1.KeysInitQuery.lenient);
20
22
  }
21
- exports.isHardError = isHardError;
23
+ /**
24
+ * If a warning should be emitted for the given type of error.
25
+ * @param error An error.
26
+ */
27
+ function shouldLogWarning(error) {
28
+ return error.name !== 'AbortError';
29
+ }
22
30
  /**
23
31
  * A base actor for dereferencing URLs to (generic) streams.
24
32
  *
@@ -45,7 +53,9 @@ class ActorDereferenceBase extends core_1.Actor {
45
53
  if (isHardError(action.context)) {
46
54
  throw error;
47
55
  }
48
- this.logWarn(action.context, error.message, () => ({ url: action.url }));
56
+ if (shouldLogWarning(error)) {
57
+ this.logWarn(action.context, error.message, () => ({ url: action.url }));
58
+ }
49
59
  return { ...output, data: emptyReadable() };
50
60
  }
51
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActorDereferenceBase.js","sourceRoot":"","sources":["ActorDereferenceBase.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,yCAAuC;AAEvC,qDAA2C;AAG3C,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,IAAI,0BAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,OAAW,IAAI,CAAC;AAClB,CAAC;AAJD,sCAIC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,OAAuB;IACjD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,+BAAa,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAFD,kCAEC;AAED;;;;;;;;;;GAUG;AACH,MAAsB,oBAMpB,SAAQ,YAAkB;IAC1B,YAAmB,IAA6B;QAC9C,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,uBAAuB,CACrC,MAAS,EACT,KAAc,EACd,MAAS;QAET,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAW,KAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACnF,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,aAAa,EAAK,EAAE,CAAC;IACjD,CAAC;CACF;AA7BD,oDA6BC","sourcesContent":["import { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorArgs, IActorTest } from '@comunica/core';\nimport { Actor } from '@comunica/core';\nimport type { IActionContext } from '@comunica/types';\nimport { Readable } from 'readable-stream';\nimport type { IActorDereferenceOutput, IActionDereference } from './ActorDereference';\n\nexport function emptyReadable<S extends Readable>(): S {\n const data = new Readable();\n data.push(null);\n return <S> data;\n}\n\n/**\n * Check if hard errors should occur on HTTP or parse errors.\n * @param {IActionContext} context An action context.\n * @return {boolean} If hard errors are enabled.\n */\nexport function isHardError(context: IActionContext): boolean {\n return !context.get(KeysInitQuery.lenient);\n}\n\n/**\n * A base actor for dereferencing URLs to (generic) streams.\n *\n * Actor types:\n * * Input: IActionDereference: A URL.\n * * Test: <none>\n * * Output: IActorDereferenceOutput: A Readable stream\n *\n * @see IActionDereference\n * @see IActorDereferenceOutput\n */\nexport abstract class ActorDereferenceBase<\n I extends IActionDereference,\nT extends IActorTest,\nO extends IActorDereferenceOutput,\nTS = undefined,\n>\n extends Actor<I, T, O, TS> {\n public constructor(args: IActorArgs<I, T, O, TS>) {\n super(args);\n }\n\n /**\n * Handle the given error as a rejection or delegate it to the logger,\n * depending on whether or not hard errors are enabled.\n * @param {I} action An action.\n * @param {Error} error An error that has occurred.\n * @param {N} output Data to add to the output\n */\n protected async dereferenceErrorHandler<N, M extends Readable>(\n action: I,\n error: unknown,\n output: N,\n ): Promise<N & { data: M }> {\n if (isHardError(action.context)) {\n throw error;\n }\n this.logWarn(action.context, (<Error> error).message, () => ({ url: action.url }));\n return { ...output, data: emptyReadable<M>() };\n }\n}\n"]}
1
+ {"version":3,"file":"ActorDereferenceBase.js","sourceRoot":"","sources":["ActorDereferenceBase.ts"],"names":[],"mappings":";;;AAOA,sCAIC;AAOD,kCAEC;AAMD,4CAEC;AA5BD,+DAA0D;AAE1D,yCAAuC;AAEvC,qDAA2C;AAG3C,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,IAAI,0BAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,OAAW,IAAI,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,OAAuB;IACjD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,+BAAa,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,KAAY;IAC3C,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AACrC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAsB,oBAMpB,SAAQ,YAAkB;IAC1B,YAAmB,IAA6B;QAC9C,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,uBAAuB,CACrC,MAAS,EACT,KAAc,EACd,MAAS;QAET,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,gBAAgB,CAAS,KAAK,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAU,KAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,aAAa,EAAK,EAAE,CAAC;IACjD,CAAC;CACF;AA/BD,oDA+BC","sourcesContent":["import { KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorArgs, IActorTest } from '@comunica/core';\nimport { Actor } from '@comunica/core';\nimport type { IActionContext } from '@comunica/types';\nimport { Readable } from 'readable-stream';\nimport type { IActorDereferenceOutput, IActionDereference } from './ActorDereference';\n\nexport function emptyReadable<S extends Readable>(): S {\n const data = new Readable();\n data.push(null);\n return <S> data;\n}\n\n/**\n * Check if hard errors should occur on HTTP or parse errors.\n * @param {IActionContext} context An action context.\n * @return {boolean} If hard errors are enabled.\n */\nexport function isHardError(context: IActionContext): boolean {\n return !context.get(KeysInitQuery.lenient);\n}\n\n/**\n * If a warning should be emitted for the given type of error.\n * @param error An error.\n */\nexport function shouldLogWarning(error: Error): boolean {\n return error.name !== 'AbortError';\n}\n\n/**\n * A base actor for dereferencing URLs to (generic) streams.\n *\n * Actor types:\n * * Input: IActionDereference: A URL.\n * * Test: <none>\n * * Output: IActorDereferenceOutput: A Readable stream\n *\n * @see IActionDereference\n * @see IActorDereferenceOutput\n */\nexport abstract class ActorDereferenceBase<\n I extends IActionDereference,\nT extends IActorTest,\nO extends IActorDereferenceOutput,\nTS = undefined,\n>\n extends Actor<I, T, O, TS> {\n public constructor(args: IActorArgs<I, T, O, TS>) {\n super(args);\n }\n\n /**\n * Handle the given error as a rejection or delegate it to the logger,\n * depending on whether or not hard errors are enabled.\n * @param {I} action An action.\n * @param {Error} error An error that has occurred.\n * @param {N} output Data to add to the output\n */\n protected async dereferenceErrorHandler<N, M extends Readable>(\n action: I,\n error: unknown,\n output: N,\n ): Promise<N & { data: M }> {\n if (isHardError(action.context)) {\n throw error;\n }\n if (shouldLogWarning(<Error> error)) {\n this.logWarn(action.context, (<Error>error).message, () => ({ url: action.url }));\n }\n return { ...output, data: emptyReadable<M>() };\n }\n}\n"]}
File without changes
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActorDereferenceParse = exports.getMediaTypeFromExtension = void 0;
3
+ exports.ActorDereferenceParse = void 0;
4
+ exports.getMediaTypeFromExtension = getMediaTypeFromExtension;
4
5
  const core_1 = require("@comunica/core");
5
6
  const readable_stream_1 = require("readable-stream");
6
7
  const ActorDereferenceBase_1 = require("./ActorDereferenceBase");
8
+ const DereferenceRdfCachePolicyDereferenceWrapper_1 = require("./DereferenceRdfCachePolicyDereferenceWrapper");
7
9
  /**
8
10
  * Get the media type based on the extension of the given path,
9
11
  * which can be an URL or file path.
@@ -18,7 +20,6 @@ function getMediaTypeFromExtension(path, mediaMappings) {
18
20
  // eslint-disable-next-line ts/prefer-nullish-coalescing
19
21
  return (dotIndex >= 0 && mediaMappings?.[path.slice(dotIndex + 1)]) || '';
20
22
  }
21
- exports.getMediaTypeFromExtension = getMediaTypeFromExtension;
22
23
  /**
23
24
  * An abstract actor that handles dereference and parse actions.
24
25
  *
@@ -29,8 +30,16 @@ exports.getMediaTypeFromExtension = getMediaTypeFromExtension;
29
30
  *
30
31
  */
31
32
  class ActorDereferenceParse extends ActorDereferenceBase_1.ActorDereferenceBase {
33
+ mediatorDereference;
34
+ mediatorParse;
35
+ mediatorParseMediatypes;
36
+ mediaMappings;
32
37
  constructor(args) {
33
38
  super(args);
39
+ this.mediatorDereference = args.mediatorDereference;
40
+ this.mediatorParse = args.mediatorParse;
41
+ this.mediatorParseMediatypes = args.mediatorParseMediatypes;
42
+ this.mediaMappings = args.mediaMappings;
34
43
  }
35
44
  async test(_action) {
36
45
  return (0, core_1.passTestVoid)();
@@ -45,7 +54,9 @@ class ActorDereferenceParse extends ActorDereferenceBase_1.ActorDereferenceBase
45
54
  // If we don't emit hard errors, make parsing error events log instead, and silence them downstream.
46
55
  if (!(0, ActorDereferenceBase_1.isHardError)(action.context)) {
47
56
  data.on('error', (error) => {
48
- this.logWarn(action.context, error.message, () => ({ url: action.url }));
57
+ if ((0, ActorDereferenceBase_1.shouldLogWarning)(error)) {
58
+ this.logWarn(action.context, error.message, () => ({ url: action.url }));
59
+ }
49
60
  // Make sure the errored stream is ended.
50
61
  data.push(null);
51
62
  });
@@ -55,10 +66,8 @@ class ActorDereferenceParse extends ActorDereferenceBase_1.ActorDereferenceBase
55
66
  }
56
67
  async run(action) {
57
68
  const { context } = action;
58
- const dereference = await this.mediatorDereference.mediate({
59
- ...action,
60
- mediaTypes: async () => (await this.mediatorParseMediatypes?.mediate({ context, mediaTypes: true }))?.mediaTypes,
61
- });
69
+ const mediaTypes = async () => (await this.mediatorParseMediatypes?.mediate({ context, mediaTypes: true }))?.mediaTypes;
70
+ const dereference = await this.mediatorDereference.mediate({ ...action, mediaTypes });
62
71
  let result;
63
72
  if (dereference.exists) {
64
73
  try {
@@ -84,7 +93,13 @@ class ActorDereferenceParse extends ActorDereferenceBase_1.ActorDereferenceBase
84
93
  result = { data: (0, ActorDereferenceBase_1.emptyReadable)() };
85
94
  }
86
95
  // Return the parsed stream and any metadata
87
- return { ...dereference, ...result };
96
+ return {
97
+ ...dereference,
98
+ ...result,
99
+ cachePolicy: dereference.cachePolicy ?
100
+ new DereferenceRdfCachePolicyDereferenceWrapper_1.DereferenceRdfCachePolicyDereferenceWrapper(dereference.cachePolicy, mediaTypes) :
101
+ undefined,
102
+ };
88
103
  }
89
104
  }
90
105
  exports.ActorDereferen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H,CAAC;aAAM,CAAC;YACN,sGAAsG;YACtG,2GAA2G;YAC3G,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACjC,MAAM,GAAG,EAAE,IAAI,EAAE,IAAA,oCAAa,GAAE,EAAE,CAAC;QACrC,CAAC;QAED,4CAA4C;QAC5C,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;IACvC,CAAC;CACF;AA5ED,sDA4EC","sourcesContent":["import type { MediateMediaTyped, MediateMediaTypes } from '@comunica/actor-abstract-mediatyped';\nimport type { IActionParse, IActorParseOutput, IParseMetadata } from '@comunica/actor-abstract-parse';\nimport type { IActorArgs, IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { Readable } from 'readable-stream';\nimport { PassThrough } from 'readable-stream';\nimport type { IActionDereference, IActorDereferenceOutput, MediatorDereference } from './ActorDereference';\nimport { ActorDereferenceBase, isHardError, emptyReadable } from './ActorDereferenceBase';\n\n/**\n * Get the media type based on the extension of the given path,\n * which can be an URL or file path.\n * @param {string} path A path.\n * @param {Record<string, string>} mediaMappings A collection of mappings,\n * mapping file extensions to their corresponding media type.\n * @return {string} A media type or the empty string.\n */\nexport function getMediaTypeFromExtension(path: string, mediaMappings?: Record<string, string>): string {\n const dotIndex = path.lastIndexOf('.');\n // Get extension after last dot and map to media\n // eslint-disable-next-line ts/prefer-nullish-coalescing\n return (dotIndex >= 0 && mediaMappings?.[path.slice(dotIndex + 1)]) || '';\n}\n\nexport interface IActorDereferenceParseArgs<\n S,\n K extends IParseMetadata = IParseMetadata,\n M extends IParseMetadata = IParseMetadata,\n> extends IActorArgs<IActionDereferenceParse<K>, IActorTest, IActorDereferenceParseOutput<S, M>> {\n mediatorDereference: MediatorDereference;\n mediatorParse: MediateMediaTyped<IActionParse<K>, IActorTest, IActorParseOutput<S, M>>;\n mediatorParseMediatypes: MediateMediaTypes;\n /**\n * A collection of mappings, mapping file extensions to their corresponding media type.\n * @range {json}\n */\n mediaMappings: Record<string, string>;\n}\n\n/**\n * An abstract actor that handles dereference and parse actions.\n *\n * Actor types:\n * Input: IActionDereferenceParse: A URL.\n * Test: <none>\n * Output: IActorDereferenceParseOutput: A data stream of type output by the Parser.\n *\n */\nexport abstract class ActorDereferenceParse<\n S,\n K extends IParseMetadata = IParseMetadata,\n M extends IParseMetadata = IParseMetadata,\n> extends ActorDereferenceBase<IActionDereferenceParse<K>, IActorTest, IActorDereferenceParseOutput<S, M>> {\n public readonly mediatorDereference: MediatorDereference;\n public readonly mediatorParse: MediateMediaTyped<IActionParse<K>, IActorTest, IActorParseOutput<S, M>>;\n public readonly mediatorParseMediatypes: MediateMediaTypes;\n public readonly mediaMappings: Record<string, string>;\n\n public constructor(args: IActorDereferenceParseArgs<S, K, M>) {\n super(args);\n }\n\n public async test(_action: IActionDereference): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n /**\n * If hard errors are disabled, modify the given stream so that errors are delegated to the logger.\n * @param {IActionDereferenceParse} action A dereference action.\n * @param {Readable} data A data stream.\n * @return {Readable} The resulting data stream.\n */\n protected handleDereferenceStreamErrors<L extends IParseMetadata, T extends Readable>(\n action: IActionDereferenceParse<L>,\n data: T,\n ): T {\n // If we don't emit hard errors, make parsing error events log instead, and silence them downstream.\n if (!isHardError(action.context)) {\n data.on('error', (error) => {\n this.logWarn(action.context, error.message, () => ({ url: action.url }));\n // Make sure the errored stream is ended.\n data.push(null);\n });\n data = <PassThrough & T> data.pipe(new PassThrough({ objectMode: true }));\n }\n return data;\n }\n\n public abstract getMetadata(dereference: IActorDereferenceOutput): Promise<K | undefined>;\n\n public async run(action: IActionDereferenceParse<K>): Promise<IActorDereferenceParseOutput<S, M>> {\n const { context } = action;\n const dereference = await this.mediatorDereference.mediate({\n ...action,\n mediaTypes: async() => (await this.mediatorParseMediatypes?.mediate({ context, mediaTypes: true }))?.mediaTypes,\n });\n\n let result: IActorParseOutput<S, M>;\n\n if (dereference.exists) {\n try {\n result = (await this.mediatorParse.mediate({\n context,\n handle: { context, ...dereference, metadata: await this.getMetadata(dereference) },\n // eslint-disable-next-line ts/prefer-nullish-coalescing\n handleMediaType: dereference.mediaType || action.mediaType ||\n getMediaTypeFromExtension(dereference.url, this.mediaMappings),\n })).handle;\n result.data = this.handleDereferenceStreamErrors(action, result.data);\n } catch (error: unknown) {\n // Close the body, to avoid process to hang\n await dereference.data.close?.();\n result = await this.dereferenceErrorHandler(action, error, {});\n }\n } else {\n // Close the dereference stream and return an empty response directly to avoid unnecessary processing.\n // This code is equivalent to the error handler above in the catch clause, but avoids redundant processing.\n await dereference.data.close?.();\n result = { data: emptyReadable() };\n }\n\n // Return the parsed stream and any metadata\n return { ...dereference, ...result };\n }\n}\n\nexport interface IActionDereferenceParse<T extends IParseMetadata = IParseMetadata> extends IActionDereference {\n /**\n * The mediatype of the source (if it can't be inferred from the source)\n */\n mediaType?: string;\n /**\n * Metadata to be given to the parser\n */\n metadata?: T;\n}\n\nexport type IActorDereferenceParseOutput<T, K extends IParseMetadata = IParseMetadata>\n = Omit<IActorDereferenceOutput, 'data'> & IActorParseOutput<T, K>;\n"]}
1
+ {"version":3,"file":"ActorDereferenceParse.js","sourceRoot":"","sources":["ActorDereferenceParse.ts"],"names":[],"mappings":";;;AAsBA,8DAKC;AAxBD,yCAA8C;AAE9C,qDAA8C;AAM9C,iEAA4G;AAC5G,+GAA4G;AAE5G;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CAAC,IAAY,EAAE,aAAsC;IAC5F,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,gDAAgD;IAChD,wDAAwD;IACxD,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5E,CAAC;AAiBD;;;;;;;;GAQG;AACH,MAAsB,qBAIpB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,GAAG,EAAE,IAAI,EAAE,IAAA,oCAAa,GAAE,EAAE,CAAC;QACrC,CAAC;QAED,4CAA4C;QAC5C,OAAO;YACL,GAAG,WAAW;YACd,GAAG,MAAM;YACT,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBACpC,IAAI,yFAA2C,CAAC,WAAW,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;gBACtF,SAAS;SACZ,CAAC;IACJ,CAAC;CACF;AAvFD,sDAuFC","sourcesContent":["import type { MediateMediaTyped, MediateMediaTypes } from '@comunica/actor-abstract-mediatyped';\nimport type { IActionParse, IActorParseOutput, IParseMetadata } from '@comunica/actor-abstract-parse';\nimport type { IActorArgs, IActorTest, TestResult } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { Readable } from 'readable-stream';\nimport { PassThrough } from 'readable-stream';\nimport type {\n IActionDereference,\n IActorDereferenceOutput,\n MediatorDereference,\n} from './ActorDereference';\nimport { ActorDereferenceBase, isHardError, emptyReadable, shouldLogWarning } from './ActorDereferenceBase';\nimport { DereferenceRdfCachePolicyDereferenceWrapper } from './DereferenceRdfCachePolicyDereferenceWrapper';\n\n/**\n * Get the media type based on the extension of the given path,\n * which can be an URL or file path.\n * @param {string} path A path.\n * @param {Record<string, string>} mediaMappings A collection of mappings,\n * mapping file extensions to their corresponding media type.\n * @return {string} A media type or the empty string.\n */\nexport function getMediaTypeFromExtension(path: string, mediaMappings?: Record<string, string>): string {\n const dotIndex = path.lastIndexOf('.');\n // Get extension after last dot and map to media\n // eslint-disable-next-line ts/prefer-nullish-coalescing\n return (dotIndex >= 0 && mediaMappings?.[path.slice(dotIndex + 1)]) || '';\n}\n\nexport interface IActorDereferenceParseArgs<\n S,\n K extends IParseMetadata = IParseMetadata,\n M extends IParseMetadata = IParseMetadata,\n> extends IActorArgs<IActionDereferenceParse<K>, IActorTest, IActorDereferenceParseOutput<S, M>> {\n mediatorDereference: MediatorDereference;\n mediatorParse: MediateMediaTyped<IActionParse<K>, IActorTest, IActorParseOutput<S, M>>;\n mediatorParseMediatypes: MediateMediaTypes;\n /**\n * A collection of mappings, mapping file extensions to their corresponding media type.\n * @range {json}\n */\n mediaMappings: Record<string, string>;\n}\n\n/**\n * An abstract actor that handles dereference and parse actions.\n *\n * Actor types:\n * Input: IActionDereferenceParse: A URL.\n * Test: <none>\n * Output: IActorDereferenceParseOutput: A data stream of type output by the Parser.\n *\n */\nexport abstract class ActorDereferenceParse<\n S,\n K extends IParseMetadata = IParseMetadata,\n M extends IParseMetadata = IParseMetadata,\n> extends ActorDereferenceBase<IActionDereferenceParse<K>, IActorTest, IActorDereferenceParseOutput<S, M>> {\n public readonly mediatorDereference: MediatorDereference;\n public readonly mediatorParse: MediateMediaTyped<IActionParse<K>, IActorTest, IActorParseOutput<S, M>>;\n public readonly mediatorParseMediatypes: MediateMediaTypes;\n public readonly mediaMappings: Record<string, string>;\n\n public constructor(args: IActorDereferenceParseArgs<S, K, M>) {\n super(args);\n this.mediatorDereference = args.mediatorDereference;\n this.mediatorParse = args.mediatorParse;\n this.mediatorParseMediatypes = args.mediatorParseMediatypes;\n this.mediaMappings = args.mediaMappings;\n }\n\n public async test(_action: IActionDereference): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n /**\n * If hard errors are disabled, modify the given stream so that errors are delegated to the logger.\n * @param {IActionDereferenceParse} action A dereference action.\n * @param {Readable} data A data stream.\n * @return {Readable} The resulting data stream.\n */\n protected handleDereferenceStreamErrors<L extends IParseMetadata, T extends Readable>(\n action: IActionDereferenceParse<L>,\n data: T,\n ): T {\n // If we don't emit hard errors, make parsing error events log instead, and silence them downstream.\n if (!isHardError(action.context)) {\n data.on('error', (error) => {\n if (shouldLogWarning(error)) {\n this.logWarn(action.context, error.message, () => ({ url: action.url }));\n }\n // Make sure the errored stream is ended.\n data.push(null);\n });\n data = <PassThrough & T> data.pipe(new PassThrough({ objectMode: true }));\n }\n return data;\n }\n\n public abstract getMetadata(dereference: IActorDereferenceOutput): Promise<K | undefined>;\n\n public async run(action: IActionDereferenceParse<K>): Promise<IActorDereferenceParseOutput<S, M>> {\n const { context } = action;\n const mediaTypes: () => Promise<Record<string, number> | undefined> =\n async() => (await this.mediatorParseMediatypes?.mediate({ context, mediaTypes: true }))?.mediaTypes;\n const dereference = await this.mediatorDereference.mediate({ ...action, mediaTypes });\n\n let result: IActorParseOutput<S, M>;\n\n if (dereference.exists) {\n try {\n result = (await this.mediatorParse.mediate({\n context,\n handle: { context, ...dereference, metadata: await this.getMetadata(dereference) },\n // eslint-disable-next-line ts/prefer-nullish-coalescing\n handleMediaType: dereference.mediaType || action.mediaType ||\n getMediaTypeFromExtension(dereference.url, this.mediaMappings),\n })).handle;\n result.data = this.handleDereferenceStreamErrors(action, result.data);\n } catch (error: unknown) {\n // Close the body, to avoid process to hang\n await dereference.data.close?.();\n result = await this.dereferenceErrorHandler(action, error, {});\n }\n } else {\n // Close the dereference stream and return an empty response directly to avoid unnecessary processing.\n // This code is equivalent to the error handler above in the catch clause, but avoids redundant processing.\n await dereference.data.close?.();\n result = { data: emptyReadable() };\n }\n\n // Return the parsed stream and any metadata\n return {\n ...dereference,\n ...result,\n cachePolicy: dereference.cachePolicy ?\n new DereferenceRdfCachePolicyDereferenceWrapper(dereference.cachePolicy, mediaTypes) :\n undefined,\n };\n }\n}\n\nexport interface IActionDereferenceParse<T extends IParseMetadata = IParseMetadata> extends IActionDereference {\n /**\n * The mediatype of the source (if it can't be inferred from the source)\n */\n mediaType?: string;\n /**\n * Metadata to be given to the parser\n */\n metadata?: T;\n}\n\nexport type IActorDereferenceParseOutput<T, K extends IParseMetadata = IParseMetadata>\n = Omit<IActorDereferenceOutput, 'data'> & IActorParseOutput<T, K>;\n"]}
@@ -0,0 +1,13 @@
1
+ import type { ICachePolicy, ICacheResponseHead, IRevalidationPolicy } from '@comunica/types';
2
+ import type { IActionDereference } from './ActorDereference';
3
+ export declare class DereferenceRdfCachePolicyDereferenceWrapper implements ICachePolicy<IActionDereference> {
4
+ private readonly cachePolicy;
5
+ private readonly mediaTypes;
6
+ constructor(cachePolicy: ICachePolicy<IActionDereference>, mediaTypes: () => Promise<Record<string, number> | undefined>);
7
+ storable(): boolean;
8
+ satisfiesWithoutRevalidation(action: IActionDereference): Promise<boolean>;
9
+ responseHeaders(): Headers;
10
+ timeToLive(): number;
11
+ revalidationHeaders(newAction: IActionDereference): Promise<Headers>;
12
+ revalidatedPolicy(revalidationAction: IActionDereference, revalidationResponse: ICacheResponseHead): Promise<IRevalidationPolicy<IActionDereference>>;
13
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DereferenceRdfCachePolicyDereferenceWrapper = void 0;
4
+ class DereferenceRdfCachePolicyDereferenceWrapper {
5
+ cachePolicy;
6
+ mediaTypes;
7
+ constructor(cachePolicy, mediaTypes) {
8
+ this.cachePolicy = cachePolicy;
9
+ this.mediaTypes = mediaTypes;
10
+ }
11
+ storable() {
12
+ return this.cachePolicy.storable();
13
+ }
14
+ async satisfiesWithoutRevalidation(action) {
15
+ return this.cachePolicy.satisfiesWithoutRevalidation({ ...action, mediaTypes: this.mediaTypes });
16
+ }
17
+ responseHeaders() {
18
+ return this.cachePolicy.responseHeaders();
19
+ }
20
+ timeToLive() {
21
+ return this.cachePolicy.timeToLive();
22
+ }
23
+ async revalidationHeaders(newAction) {
24
+ return this.cachePolicy.revalidationHeaders({ ...newAction, mediaTypes: this.mediaTypes });
25
+ }
26
+ async revalidatedPolicy(revalidationAction, revalidationResponse) {
27
+ return await this.cachePolicy.revalidatedPolicy({ ...revalidationAction, mediaTypes: this.mediaTypes }, revalidationResponse);
28
+ }
29
+ }
30
+ exports.DereferenceRdfCachePolicyDereferenceWrapper = DereferenceRdfCachePolicyDereferenceWrapper;
31
+ //# sourceMappingURL=DereferenceRdfCachePolicyDereferenceWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DereferenceRdfCachePolicyDereferenceWrapper.js","sourceRoot":"","sources":["DereferenceRdfCachePolicyDereferenceWrapper.ts"],"names":[],"mappings":";;;AAGA,MAAa,2CAA2C;IAEnC;IACA;IAFnB,YACmB,WAA6C,EAC7C,UAA6D;QAD7D,gBAAW,GAAX,WAAW,CAAkC;QAC7C,eAAU,GAAV,UAAU,CAAmD;IAC7E,CAAC;IAEG,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,4BAA4B,CAAC,MAA0B;QAClE,OAAO,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACnG,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;IAC5C,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,SAA6B;QAC5D,OAAO,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,EAAE,GAAG,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC5B,kBAAsC,EACtC,oBAAwC;QAExC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAC7C,EAAE,GAAG,kBAAkB,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EACtD,oBAAoB,CACrB,CAAC;IACJ,CAAC;CACF;AAnCD,kGAmCC","sourcesContent":["import type { ICachePolicy, ICacheResponseHead, IRevalidationPolicy } from '@comunica/types';\nimport type { IActionDereference } from './ActorDereference';\n\nexport class DereferenceRdfCachePolicyDereferenceWrapper implements ICachePolicy<IActionDereference> {\n public constructor(\n private readonly cachePolicy: ICachePolicy<IActionDereference>,\n private readonly mediaTypes: () => Promise<Record<string, number> | undefined>,\n ) {}\n\n public storable(): boolean {\n return this.cachePolicy.storable();\n }\n\n public async satisfiesWithoutRevalidation(action: IActionDereference): Promise<boolean> {\n return this.cachePolicy.satisfiesWithoutRevalidation({ ...action, mediaTypes: this.mediaTypes });\n }\n\n public responseHeaders(): Headers {\n return this.cachePolicy.responseHeaders();\n }\n\n public timeToLive(): number {\n return this.cachePolicy.timeToLive();\n }\n\n public async revalidationHeaders(newAction: IActionDereference): Promise<Headers> {\n return this.cachePolicy.revalidationHeaders({ ...newAction, mediaTypes: this.mediaTypes });\n }\n\n public async revalidatedPolicy(\n revalidationAction: IActionDereference,\n revalidationResponse: ICacheResponseHead,\n ): Promise<IRevalidationPolicy<IActionDereference>> {\n return await this.cachePolicy.revalidatedPolicy(\n { ...revalidationAction, mediaTypes: this.mediaTypes },\n revalidationResponse,\n );\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './ActorDereference';
2
2
  export * from './ActorDereferenceParse';
3
3
  export * from './ActorDereferenceBase';
4
+ export * from './DereferenceRdfCachePolicyDereferenceWrapper';
package/lib/index.js CHANGED
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ActorDereference"), exports);
18
18
  __exportStar(require("./ActorDereferenceParse"), exports);
19
19
  __exportStar(require("./ActorDereferenceBase"), exports);
20
+ __exportStar(require("./DereferenceRdfCachePolicyDereferenceWrapper"), exports);
20
21
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC","sourcesContent":["export * from './ActorDereference';\nexport * from './ActorDereferenceParse';\nexport * from './ActorDereferenceBase';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC;AACvC,gFAA8D","sourcesContent":["export * from './ActorDereference';\nexport * from './ActorDereferenceParse';\nexport * from './ActorDereferenceBase';\nexport * from './DereferenceRdfCachePolicyDereferenceWrapper';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/bus-dereference",
3
- "version": "4.5.0",
3
+ "version": "5.0.0",
4
4
  "description": "A bus for dereferencing a path or URL into a (generic) stream.",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -40,12 +40,12 @@
40
40
  "build:components": "componentsjs-generator"
41
41
  },
42
42
  "dependencies": {
43
- "@comunica/actor-abstract-mediatyped": "^4.5.0",
44
- "@comunica/actor-abstract-parse": "^4.5.0",
45
- "@comunica/context-entries": "^4.5.0",
46
- "@comunica/core": "^4.5.0",
47
- "@comunica/types": "^4.5.0",
48
- "readable-stream": "^4.5.2"
43
+ "@comunica/actor-abstract-mediatyped": "^5.0.0",
44
+ "@comunica/actor-abstract-parse": "^5.0.0",
45
+ "@comunica/context-entries": "^5.0.0",
46
+ "@comunica/core": "^5.0.0",
47
+ "@comunica/types": "^5.0.0",
48
+ "readable-stream": "^4.7.0"
49
49
  },
50
- "gitHead": "2bcd98c387a021fc5c08d375793c205ca3d1bf0d"
50
+ "gitHead": "0b1756fdb9bef014133432489627c1bd71779bd0"
51
51
  }