@comunica/actor-rdf-update-hypermedia-put-ldp 3.3.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/ActorRdfUpdateHypermediaPutLdp.jsonld +44 -12
- package/components/QuadDestinationPutLdp.jsonld +6 -10
- package/components/components.jsonld +1 -1
- package/components/context.jsonld +7 -1
- package/lib/ActorRdfUpdateHypermediaPutLdp.d.ts +2 -2
- package/lib/ActorRdfUpdateHypermediaPutLdp.js +4 -3
- package/lib/ActorRdfUpdateHypermediaPutLdp.js.map +1 -1
- package/lib/QuadDestinationPutLdp.d.ts +4 -2
- package/lib/QuadDestinationPutLdp.js +8 -7
- package/lib/QuadDestinationPutLdp.js.map +1 -1
- package/package.json +13 -10
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ After installing, this package can be added to your engine's configuration as fo
|
|
|
26
26
|
{
|
|
27
27
|
"@context": [
|
|
28
28
|
...
|
|
29
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^
|
|
29
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^4.0.0/components/context.jsonld"
|
|
30
30
|
],
|
|
31
31
|
"actors": [
|
|
32
32
|
...
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-update-hypermedia/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^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/bus-rdf-update-hypermedia/^4.0.0/components/context.jsonld"
|
|
6
6
|
],
|
|
7
7
|
"@id": "npmd:@comunica/actor-rdf-update-hypermedia-put-ldp",
|
|
8
8
|
"components": [
|
|
@@ -50,29 +50,37 @@
|
|
|
50
50
|
"genericTypeInstances": [
|
|
51
51
|
{
|
|
52
52
|
"@type": "ParameterRangeGenericTypeReference",
|
|
53
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
53
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"@type": "ParameterRangeGenericTypeReference",
|
|
57
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
57
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"@type": "ParameterRangeGenericTypeReference",
|
|
61
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
61
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
65
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
62
66
|
}
|
|
63
67
|
]
|
|
64
68
|
},
|
|
65
69
|
{
|
|
66
70
|
"@type": "ParameterRangeGenericTypeReference",
|
|
67
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
71
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
75
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
68
76
|
},
|
|
69
77
|
{
|
|
70
78
|
"@type": "ParameterRangeGenericTypeReference",
|
|
71
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
79
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
72
80
|
},
|
|
73
81
|
{
|
|
74
82
|
"@type": "ParameterRangeGenericTypeReference",
|
|
75
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
83
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
76
84
|
}
|
|
77
85
|
]
|
|
78
86
|
},
|
|
@@ -82,6 +90,20 @@
|
|
|
82
90
|
},
|
|
83
91
|
"comment": "The bus this actor subscribes to."
|
|
84
92
|
},
|
|
93
|
+
{
|
|
94
|
+
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_busFailMessage",
|
|
95
|
+
"range": {
|
|
96
|
+
"@type": "ParameterRangeUnion",
|
|
97
|
+
"parameterRangeElements": [
|
|
98
|
+
"xsd:string",
|
|
99
|
+
{
|
|
100
|
+
"@type": "ParameterRangeUndefined"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"default": "RDF hypermedia updating failed: none of the configured actors were able to handle an update for ${action.url}",
|
|
105
|
+
"comment": "The message that will be configured in the bus for reporting failures. This message may be a template string that contains references to the executed `action`. For example, the following templated string is allowed: \"RDF dereferencing failed: no actors could handle ${action.handle.mediaType}\""
|
|
106
|
+
},
|
|
85
107
|
{
|
|
86
108
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_beforeActors",
|
|
87
109
|
"range": {
|
|
@@ -95,15 +117,19 @@
|
|
|
95
117
|
"genericTypeInstances": [
|
|
96
118
|
{
|
|
97
119
|
"@type": "ParameterRangeGenericTypeReference",
|
|
98
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
120
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
|
|
99
121
|
},
|
|
100
122
|
{
|
|
101
123
|
"@type": "ParameterRangeGenericTypeReference",
|
|
102
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
124
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
|
|
103
125
|
},
|
|
104
126
|
{
|
|
105
127
|
"@type": "ParameterRangeGenericTypeReference",
|
|
106
|
-
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^
|
|
128
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
132
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^4.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
107
133
|
}
|
|
108
134
|
]
|
|
109
135
|
}
|
|
@@ -179,6 +205,12 @@
|
|
|
179
205
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_bus"
|
|
180
206
|
}
|
|
181
207
|
},
|
|
208
|
+
{
|
|
209
|
+
"keyRaw": "busFailMessage",
|
|
210
|
+
"value": {
|
|
211
|
+
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_busFailMessage"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
182
214
|
{
|
|
183
215
|
"keyRaw": "beforeActors",
|
|
184
216
|
"value": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^
|
|
4
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/types/^
|
|
5
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^
|
|
6
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-update-quads/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^4.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/types/^4.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^4.0.0/components/context.jsonld",
|
|
6
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-update-quads/^4.0.0/components/context.jsonld"
|
|
7
7
|
],
|
|
8
8
|
"@id": "npmd:@comunica/actor-rdf-update-hypermedia-put-ldp",
|
|
9
9
|
"components": [
|
|
@@ -75,12 +75,8 @@
|
|
|
75
75
|
"memberFieldName": "constructor"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
"@id": "caruhpl:components/QuadDestinationPutLdp.jsonld#
|
|
79
|
-
"memberFieldName": "
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"@id": "caruhpl:components/QuadDestinationPutLdp.jsonld#QuadDestinationPutLdp__member_delete",
|
|
83
|
-
"memberFieldName": "delete"
|
|
78
|
+
"@id": "caruhpl:components/QuadDestinationPutLdp.jsonld#QuadDestinationPutLdp__member_update",
|
|
79
|
+
"memberFieldName": "update"
|
|
84
80
|
},
|
|
85
81
|
{
|
|
86
82
|
"@id": "caruhpl:components/QuadDestinationPutLdp.jsonld#QuadDestinationPutLdp__member_wrapRdfUpdateRequest",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": [
|
|
3
|
-
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-update-hypermedia-put-ldp/^4.0.0/components/context.jsonld"
|
|
4
4
|
],
|
|
5
5
|
"@id": "npmd:@comunica/actor-rdf-update-hypermedia-put-ldp",
|
|
6
6
|
"@type": "Module",
|
|
@@ -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
|
-
"caruhpl": "npmd:@comunica/actor-rdf-update-hypermedia-put-ldp/^
|
|
6
|
+
"caruhpl": "npmd:@comunica/actor-rdf-update-hypermedia-put-ldp/^4.0.0/",
|
|
7
7
|
"ActorRdfUpdateHypermediaPutLdp": {
|
|
8
8
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp",
|
|
9
9
|
"@prefix": true,
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"args_bus": {
|
|
24
24
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_bus"
|
|
25
25
|
},
|
|
26
|
+
"args_busFailMessage": {
|
|
27
|
+
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_busFailMessage"
|
|
28
|
+
},
|
|
26
29
|
"args_beforeActors": {
|
|
27
30
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_beforeActors",
|
|
28
31
|
"@container": "@list"
|
|
@@ -42,6 +45,9 @@
|
|
|
42
45
|
"bus": {
|
|
43
46
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_bus"
|
|
44
47
|
},
|
|
48
|
+
"busFailMessage": {
|
|
49
|
+
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_busFailMessage"
|
|
50
|
+
},
|
|
45
51
|
"beforeActors": {
|
|
46
52
|
"@id": "caruhpl:components/ActorRdfUpdateHypermediaPutLdp.jsonld#ActorRdfUpdateHypermediaPutLdp_args_beforeActors",
|
|
47
53
|
"@container": "@list"
|
|
@@ -2,7 +2,7 @@ import type { MediatorHttp } from '@comunica/bus-http';
|
|
|
2
2
|
import type { MediatorRdfSerializeHandle, MediatorRdfSerializeMediaTypes } from '@comunica/bus-rdf-serialize';
|
|
3
3
|
import type { IActionRdfUpdateHypermedia, IActorRdfUpdateHypermediaOutput, IActorRdfUpdateHypermediaArgs } from '@comunica/bus-rdf-update-hypermedia';
|
|
4
4
|
import { ActorRdfUpdateHypermedia } from '@comunica/bus-rdf-update-hypermedia';
|
|
5
|
-
import type { IActorTest } from '@comunica/core';
|
|
5
|
+
import type { IActorTest, TestResult } from '@comunica/core';
|
|
6
6
|
/**
|
|
7
7
|
* A comunica Post LDP RDF Update Hypermedia Actor.
|
|
8
8
|
*/
|
|
@@ -11,7 +11,7 @@ export declare class ActorRdfUpdateHypermediaPutLdp extends ActorRdfUpdateHyperm
|
|
|
11
11
|
readonly mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes;
|
|
12
12
|
readonly mediatorRdfSerialize: MediatorRdfSerializeHandle;
|
|
13
13
|
constructor(args: IActorRdfUpdateHypermediaPostLdpArgs);
|
|
14
|
-
testMetadata(action: IActionRdfUpdateHypermedia): Promise<IActorTest
|
|
14
|
+
testMetadata(action: IActionRdfUpdateHypermedia): Promise<TestResult<IActorTest>>;
|
|
15
15
|
run(action: IActionRdfUpdateHypermedia): Promise<IActorRdfUpdateHypermediaOutput>;
|
|
16
16
|
}
|
|
17
17
|
export interface IActorRdfUpdateHypermediaPostLdpArgs extends IActorRdfUpdateHypermediaArgs {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorRdfUpdateHypermediaPutLdp = void 0;
|
|
4
4
|
const bus_rdf_update_hypermedia_1 = require("@comunica/bus-rdf-update-hypermedia");
|
|
5
|
+
const core_1 = require("@comunica/core");
|
|
5
6
|
const QuadDestinationPutLdp_1 = require("./QuadDestinationPutLdp");
|
|
6
7
|
/**
|
|
7
8
|
* A comunica Post LDP RDF Update Hypermedia Actor.
|
|
@@ -13,13 +14,13 @@ class ActorRdfUpdateHypermediaPutLdp extends bus_rdf_update_hypermedia_1.ActorRd
|
|
|
13
14
|
async testMetadata(action) {
|
|
14
15
|
if (!action.forceDestinationType) {
|
|
15
16
|
if (!action.metadata.allowHttpMethods || !action.metadata.allowHttpMethods.includes('PUT')) {
|
|
16
|
-
|
|
17
|
+
return (0, core_1.failTest)(`Actor ${this.name} could not detect a destination with 'Allow: PUT' header.`);
|
|
17
18
|
}
|
|
18
19
|
if (action.exists) {
|
|
19
|
-
|
|
20
|
+
return (0, core_1.failTest)(`Actor ${this.name} can only put on a destination that does not already exists.`);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
return
|
|
23
|
+
return (0, core_1.passTestVoid)();
|
|
23
24
|
}
|
|
24
25
|
async run(action) {
|
|
25
26
|
this.logInfo(action.context, `Identified as putLdp destination: ${action.url}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorRdfUpdateHypermediaPutLdp.js","sourceRoot":"","sources":["ActorRdfUpdateHypermediaPutLdp.ts"],"names":[],"mappings":";;;AAOA,mFAA+E;AAE/E,mEAAgE;AAEhE;;GAEG;AACH,MAAa,8BAA+B,SAAQ,oDAAwB;IAK1E,YAAmB,IAA0C;QAC3D,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAkC;QAC1D,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3F,
|
|
1
|
+
{"version":3,"file":"ActorRdfUpdateHypermediaPutLdp.js","sourceRoot":"","sources":["ActorRdfUpdateHypermediaPutLdp.ts"],"names":[],"mappings":";;;AAOA,mFAA+E;AAE/E,yCAAwD;AACxD,mEAAgE;AAEhE;;GAEG;AACH,MAAa,8BAA+B,SAAQ,oDAAwB;IAK1E,YAAmB,IAA0C;QAC3D,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAkC;QAC1D,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3F,OAAO,IAAA,eAAQ,EAAC,SAAS,IAAI,CAAC,IAAI,2DAA2D,CAAC,CAAC;YACjG,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,OAAO,IAAA,eAAQ,EAAC,SAAS,IAAI,CAAC,IAAI,8DAA8D,CAAC,CAAC;YACpG,CAAC;QACH,CAAC;QACD,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAAkC;QACjD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,qCAAqC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QAChF,OAAO;YACL,WAAW,EAAE,IAAI,6CAAqB,CACpC,MAAM,CAAC,GAAG,EACV,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,EACjC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,8BAA8B,EACnC,IAAI,CAAC,oBAAoB,CAC1B;SACF,CAAC;IACJ,CAAC;CACF;AAlCD,wEAkCC","sourcesContent":["import type { MediatorHttp } from '@comunica/bus-http';\nimport type { MediatorRdfSerializeHandle, MediatorRdfSerializeMediaTypes } from '@comunica/bus-rdf-serialize';\nimport type {\n IActionRdfUpdateHypermedia,\n IActorRdfUpdateHypermediaOutput,\n IActorRdfUpdateHypermediaArgs,\n} from '@comunica/bus-rdf-update-hypermedia';\nimport { ActorRdfUpdateHypermedia } from '@comunica/bus-rdf-update-hypermedia';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { failTest, passTestVoid } from '@comunica/core';\nimport { QuadDestinationPutLdp } from './QuadDestinationPutLdp';\n\n/**\n * A comunica Post LDP RDF Update Hypermedia Actor.\n */\nexport class ActorRdfUpdateHypermediaPutLdp extends ActorRdfUpdateHypermedia {\n public readonly mediatorHttp: MediatorHttp;\n public readonly mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes;\n public readonly mediatorRdfSerialize: MediatorRdfSerializeHandle;\n\n public constructor(args: IActorRdfUpdateHypermediaPostLdpArgs) {\n super(args, 'putLdp');\n }\n\n public async testMetadata(action: IActionRdfUpdateHypermedia): Promise<TestResult<IActorTest>> {\n if (!action.forceDestinationType) {\n if (!action.metadata.allowHttpMethods || !action.metadata.allowHttpMethods.includes('PUT')) {\n return failTest(`Actor ${this.name} could not detect a destination with 'Allow: PUT' header.`);\n }\n if (action.exists) {\n return failTest(`Actor ${this.name} can only put on a destination that does not already exists.`);\n }\n }\n return passTestVoid();\n }\n\n public async run(action: IActionRdfUpdateHypermedia): Promise<IActorRdfUpdateHypermediaOutput> {\n this.logInfo(action.context, `Identified as putLdp destination: ${action.url}`);\n return {\n destination: new QuadDestinationPutLdp(\n action.url,\n action.context,\n action.metadata.putAccepted || [],\n this.mediatorHttp,\n this.mediatorRdfSerializeMediatypes,\n this.mediatorRdfSerialize,\n ),\n };\n }\n}\n\nexport interface IActorRdfUpdateHypermediaPostLdpArgs extends IActorRdfUpdateHypermediaArgs {\n /**\n * The HTTP mediator\n */\n mediatorHttp: MediatorHttp;\n /**\n * The RDF Serialize mediator for collecting media types\n */\n mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes;\n /**\n * The RDF Serialize mediator for handling serialization\n */\n mediatorRdfSerialize: MediatorRdfSerializeHandle;\n}\n"]}
|
|
@@ -15,8 +15,10 @@ export declare class QuadDestinationPutLdp implements IQuadDestination {
|
|
|
15
15
|
readonly mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes;
|
|
16
16
|
private readonly mediatorRdfSerialize;
|
|
17
17
|
constructor(url: string, context: IActionContext, mediaTypes: string[], mediatorHttp: MediatorHttp, mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes, mediatorRdfSerialize: MediatorRdfSerialize);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
update(quadStreams: {
|
|
19
|
+
insert?: AsyncIterator<RDF.Quad>;
|
|
20
|
+
delete?: AsyncIterator<RDF.Quad>;
|
|
21
|
+
}): Promise<void>;
|
|
20
22
|
wrapRdfUpdateRequest(type: 'INSERT' | 'DELETE', quads: AsyncIterator<RDF.Quad>): Promise<void>;
|
|
21
23
|
deleteGraphs(_graphs: RDF.DefaultGraph | 'NAMED' | 'ALL' | RDF.NamedNode[], _requireExistence: boolean, _dropGraphs: boolean): Promise<void>;
|
|
22
24
|
createGraphs(_graphs: RDF.NamedNode[], _requireNonExistence: boolean): Promise<void>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QuadDestinationPutLdp = void 0;
|
|
4
4
|
const bus_http_1 = require("@comunica/bus-http");
|
|
5
|
-
const cross_fetch_1 = require("cross-fetch");
|
|
6
5
|
/**
|
|
7
6
|
* A quad destination that represents a resource that can be PUT.
|
|
8
7
|
*/
|
|
@@ -15,11 +14,13 @@ class QuadDestinationPutLdp {
|
|
|
15
14
|
this.mediatorRdfSerializeMediatypes = mediatorRdfSerializeMediatypes;
|
|
16
15
|
this.mediatorRdfSerialize = mediatorRdfSerialize;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
async update(quadStreams) {
|
|
18
|
+
if (quadStreams.delete) {
|
|
19
|
+
throw new Error(`Put-based LDP destinations don't support deletions`);
|
|
20
|
+
}
|
|
21
|
+
if (quadStreams.insert) {
|
|
22
|
+
await this.wrapRdfUpdateRequest('INSERT', quadStreams.insert);
|
|
23
|
+
}
|
|
23
24
|
}
|
|
24
25
|
async wrapRdfUpdateRequest(type, quads) {
|
|
25
26
|
// Determine media type for serialization
|
|
@@ -37,7 +38,7 @@ class QuadDestinationPutLdp {
|
|
|
37
38
|
handleMediaType: mediaType,
|
|
38
39
|
});
|
|
39
40
|
// Send data in (LDP) PUT request
|
|
40
|
-
const headers = new
|
|
41
|
+
const headers = new Headers({ 'content-type': mediaType });
|
|
41
42
|
const httpResponse = await this.mediatorHttp.mediate({
|
|
42
43
|
context: this.context,
|
|
43
44
|
init: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuadDestinationPutLdp.js","sourceRoot":"","sources":["QuadDestinationPutLdp.ts"],"names":[],"mappings":";;;AACA,iDAA6E;
|
|
1
|
+
{"version":3,"file":"QuadDestinationPutLdp.js","sourceRoot":"","sources":["QuadDestinationPutLdp.ts"],"names":[],"mappings":"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","sourcesContent":["import type { MediatorHttp } from '@comunica/bus-http';\nimport { validateAndCloseHttpResponse, ActorHttp } from '@comunica/bus-http';\nimport type { MediatorRdfSerialize, MediatorRdfSerializeMediaTypes } from '@comunica/bus-rdf-serialize';\nimport type { IQuadDestination } from '@comunica/bus-rdf-update-quads';\nimport type { IActionContext } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\n\n/**\n * A quad destination that represents a resource that can be PUT.\n */\nexport class QuadDestinationPutLdp implements IQuadDestination {\n private readonly url: string;\n private readonly context: IActionContext;\n private readonly mediaTypes: string[];\n\n private readonly mediatorHttp: MediatorHttp;\n\n public readonly mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes;\n\n private readonly mediatorRdfSerialize: MediatorRdfSerialize;\n\n public constructor(\n url: string,\n context: IActionContext,\n mediaTypes: string[],\n mediatorHttp: MediatorHttp,\n mediatorRdfSerializeMediatypes: MediatorRdfSerializeMediaTypes,\n mediatorRdfSerialize: MediatorRdfSerialize,\n ) {\n this.url = url;\n this.context = context;\n this.mediaTypes = mediaTypes;\n this.mediatorHttp = mediatorHttp;\n this.mediatorRdfSerializeMediatypes = mediatorRdfSerializeMediatypes;\n this.mediatorRdfSerialize = mediatorRdfSerialize;\n }\n\n public async update(\n quadStreams: { insert?: AsyncIterator<RDF.Quad>; delete?: AsyncIterator<RDF.Quad> },\n ): Promise<void> {\n if (quadStreams.delete) {\n throw new Error(`Put-based LDP destinations don't support deletions`);\n }\n if (quadStreams.insert) {\n await this.wrapRdfUpdateRequest('INSERT', quadStreams.insert);\n }\n }\n\n public async wrapRdfUpdateRequest(type: 'INSERT' | 'DELETE', quads: AsyncIterator<RDF.Quad>): Promise<void> {\n // Determine media type for serialization\n const { mediaTypes } = await this.mediatorRdfSerializeMediatypes.mediate(\n { context: this.context, mediaTypes: true },\n );\n const availableMediaTypes = this.mediaTypes\n .filter(mediaType => mediaType in mediaTypes);\n // Fallback to our own preferred media type\n const mediaType = availableMediaTypes.length > 0 ?\n availableMediaTypes[0] :\n Object.keys(mediaTypes).sort((typeA, typeB) => mediaTypes[typeB] - mediaTypes[typeA])[0];\n\n // Serialize quads\n const { handle: { data }} = await this.mediatorRdfSerialize.mediate({\n context: this.context,\n handle: { quadStream: quads, context: this.context },\n handleMediaType: mediaType,\n });\n\n // Send data in (LDP) PUT request\n const headers: Headers = new Headers({ 'content-type': mediaType });\n const httpResponse = await this.mediatorHttp.mediate({\n context: this.context,\n init: {\n headers,\n method: 'PUT',\n body: ActorHttp.toWebReadableStream(data),\n },\n input: this.url,\n });\n\n await validateAndCloseHttpResponse(this.url, httpResponse);\n }\n\n public async deleteGraphs(\n _graphs: RDF.DefaultGraph | 'NAMED' | 'ALL' | RDF.NamedNode[],\n _requireExistence: boolean,\n _dropGraphs: boolean,\n ): Promise<void> {\n throw new Error(`Put-based LDP destinations don't support named graphs`);\n }\n\n public async createGraphs(_graphs: RDF.NamedNode[], _requireNonExistence: boolean): Promise<void> {\n throw new Error(`Put-based LDP destinations don't support named graphs`);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-rdf-update-hypermedia-put-ldp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "A put-ldp rdf-update-hypermedia actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"funding": {
|
|
8
|
+
"type": "opencollective",
|
|
9
|
+
"url": "https://opencollective.com/comunica-association"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://comunica.dev/",
|
|
8
12
|
"repository": {
|
|
9
13
|
"type": "git",
|
|
@@ -37,15 +41,14 @@
|
|
|
37
41
|
"build:components": "componentsjs-generator"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@comunica/bus-http": "^
|
|
41
|
-
"@comunica/bus-rdf-serialize": "^
|
|
42
|
-
"@comunica/bus-rdf-update-hypermedia": "^
|
|
43
|
-
"@comunica/bus-rdf-update-quads": "^
|
|
44
|
-
"@comunica/core": "^
|
|
45
|
-
"@comunica/types": "^
|
|
44
|
+
"@comunica/bus-http": "^4.0.1",
|
|
45
|
+
"@comunica/bus-rdf-serialize": "^4.0.1",
|
|
46
|
+
"@comunica/bus-rdf-update-hypermedia": "^4.0.1",
|
|
47
|
+
"@comunica/bus-rdf-update-quads": "^4.0.1",
|
|
48
|
+
"@comunica/core": "^4.0.1",
|
|
49
|
+
"@comunica/types": "^4.0.1",
|
|
46
50
|
"@rdfjs/types": "*",
|
|
47
|
-
"asynciterator": "^3.9.0"
|
|
48
|
-
"cross-fetch": "^4.0.0"
|
|
51
|
+
"asynciterator": "^3.9.0"
|
|
49
52
|
},
|
|
50
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "67831ba79e45ea1ced41fe3f83c5d6e8802dbeaa"
|
|
51
54
|
}
|