@undefineds.co/xpod 0.3.29 → 0.3.31
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/dist/authorization/PodAuthorizationResources.d.ts +1 -0
- package/dist/authorization/PodAuthorizationResources.js +36 -4
- package/dist/authorization/PodAuthorizationResources.js.map +1 -1
- package/dist/provision/LocalPodProvisioningService.js +2 -0
- package/dist/provision/LocalPodProvisioningService.js.map +1 -1
- package/dist/provision/ProvisionPodCreator.js +16 -0
- package/dist/provision/ProvisionPodCreator.js.map +1 -1
- package/dist/storage/accessors/MixDataAccessor.js.map +1 -1
- package/dist/storage/rdf/PostgresRdfEngine.d.ts +12 -15
- package/dist/storage/rdf/PostgresRdfEngine.js +1040 -150
- package/dist/storage/rdf/PostgresRdfEngine.js.map +1 -1
- package/dist/storage/rdf/PostgresRdfEngine.jsonld +40 -52
- package/dist/storage/rdf/{RdfLocalQueryEngine.d.ts → RdfQueryExecutor.d.ts} +3 -3
- package/dist/storage/rdf/{RdfLocalQueryEngine.js → RdfQueryExecutor.js} +9 -9
- package/dist/storage/rdf/RdfQueryExecutor.js.map +1 -0
- package/dist/storage/rdf/RdfSparqlAdapter.d.ts +5 -5
- package/dist/storage/rdf/RdfSparqlAdapter.js +27 -27
- package/dist/storage/rdf/RdfSparqlAdapter.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.d.ts +2 -5
- package/dist/storage/rdf/SolidRdfEngine.js +6 -38
- package/dist/storage/rdf/SolidRdfEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.jsonld +0 -12
- package/dist/storage/rdf/SolidRdfSparqlEngine.js.map +1 -1
- package/dist/storage/rdf/index.d.ts +3 -3
- package/dist/storage/rdf/index.js +6 -6
- package/dist/storage/rdf/index.js.map +1 -1
- package/dist/storage/rdf/models-benchmark.d.ts +9 -9
- package/dist/storage/rdf/models-benchmark.js +23 -23
- package/dist/storage/rdf/models-benchmark.js.map +1 -1
- package/dist/storage/rdf/types.d.ts +5 -5
- package/dist/storage/rdf/types.js.map +1 -1
- package/package.json +1 -1
- package/templates/pod/acp/profile/.acr +21 -0
- package/templates/pod/wac/profile/.acl.hbs +18 -0
- package/dist/storage/rdf/RdfLocalQueryEngine.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SparqlQuery } from 'sparqljs';
|
|
2
2
|
import type { NamedNode, Quad, Term } from '@rdfjs/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RdfQuery, RdfBindingRow, RdfConstructTemplate, RdfQueryTermPattern } from './types';
|
|
4
4
|
export interface RdfSparqlCompileResult {
|
|
5
|
-
query:
|
|
5
|
+
query: RdfQuery;
|
|
6
6
|
variables: string[];
|
|
7
7
|
queryType: 'SELECT' | 'ASK' | 'CONSTRUCT' | 'DESCRIBE';
|
|
8
8
|
constructTemplate?: RdfConstructTemplate[];
|
|
@@ -25,18 +25,18 @@ export interface RdfSparqlDeleteWhereTemplate {
|
|
|
25
25
|
export type RdfSparqlUpdateTemplate = RdfSparqlDeleteWhereTemplate;
|
|
26
26
|
export interface RdfSparqlDeleteWhereOperation {
|
|
27
27
|
type: 'deleteWhere';
|
|
28
|
-
query:
|
|
28
|
+
query: RdfQuery;
|
|
29
29
|
template: RdfSparqlUpdateTemplate[];
|
|
30
30
|
}
|
|
31
31
|
export interface RdfSparqlInsertDeleteWhereOperation {
|
|
32
32
|
type: 'insertDeleteWhere';
|
|
33
|
-
query:
|
|
33
|
+
query: RdfQuery;
|
|
34
34
|
deletes: RdfSparqlUpdateTemplate[];
|
|
35
35
|
inserts: RdfSparqlUpdateTemplate[];
|
|
36
36
|
}
|
|
37
37
|
export interface RdfSparqlInsertWhereOperation {
|
|
38
38
|
type: 'insertWhere';
|
|
39
|
-
query:
|
|
39
|
+
query: RdfQuery;
|
|
40
40
|
inserts: RdfSparqlUpdateTemplate[];
|
|
41
41
|
}
|
|
42
42
|
export type RdfSparqlUpdateDeltaOperation = RdfSparqlInsertOperation | RdfSparqlDeleteOperation | RdfSparqlDeleteWhereOperation | RdfSparqlInsertDeleteWhereOperation | RdfSparqlInsertWhereOperation;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RdfSparqlAdapter = exports.DisabledSparqlFeatureError = exports.UnsupportedSparqlQueryError = void 0;
|
|
4
4
|
const n3_1 = require("n3");
|
|
5
5
|
const sparqljs_1 = require("sparqljs");
|
|
6
|
-
const
|
|
6
|
+
const RdfQueryExecutor_1 = require("./RdfQueryExecutor");
|
|
7
7
|
const PATH_JOIN_VARIABLE_PREFIX = '__rdf_path';
|
|
8
8
|
const XPATH_FUNCTION_NS = 'http://www.w3.org/2005/xpath-functions#';
|
|
9
9
|
class UnsupportedSparqlQueryError extends Error {
|
|
@@ -324,7 +324,7 @@ class RdfSparqlAdapter {
|
|
|
324
324
|
if (!options.graphVariables?.has(item.name.value)) {
|
|
325
325
|
throw new UnsupportedSparqlQueryError(`${label} GRAPH variables fallback to compatibility engine`);
|
|
326
326
|
}
|
|
327
|
-
graph = (0,
|
|
327
|
+
graph = (0, RdfQueryExecutor_1.variable)(item.name.value);
|
|
328
328
|
}
|
|
329
329
|
else if (item.name.termType !== 'NamedNode') {
|
|
330
330
|
throw new UnsupportedSparqlQueryError(`${label} GRAPH variables fallback to compatibility engine`);
|
|
@@ -1077,7 +1077,7 @@ class RdfSparqlAdapter {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
compileGraphTerm(term, basePath) {
|
|
1079
1079
|
if (term.termType === 'Variable') {
|
|
1080
|
-
return (0,
|
|
1080
|
+
return (0, RdfQueryExecutor_1.variable)(term.value);
|
|
1081
1081
|
}
|
|
1082
1082
|
if (!term.value.startsWith(basePath)) {
|
|
1083
1083
|
return null;
|
|
@@ -1086,7 +1086,7 @@ class RdfSparqlAdapter {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
compileTerm(term) {
|
|
1088
1088
|
if (term.termType === 'Variable') {
|
|
1089
|
-
return (0,
|
|
1089
|
+
return (0, RdfQueryExecutor_1.variable)(term.value);
|
|
1090
1090
|
}
|
|
1091
1091
|
if (term.termType === 'Quad') {
|
|
1092
1092
|
throw new UnsupportedSparqlQueryError('RDF-star terms fallback to compatibility engine');
|
|
@@ -1154,24 +1154,24 @@ class RdfSparqlAdapter {
|
|
|
1154
1154
|
};
|
|
1155
1155
|
});
|
|
1156
1156
|
}
|
|
1157
|
-
compileDescribeTargets(query,
|
|
1157
|
+
compileDescribeTargets(query, rdfQuery) {
|
|
1158
1158
|
if (query.variables.length === 1 && query.variables[0] instanceof sparqljs_1.Wildcard) {
|
|
1159
1159
|
const variables = visibleSelectVariables(query);
|
|
1160
1160
|
if (variables.length === 0) {
|
|
1161
1161
|
throw new UnsupportedSparqlQueryError('DESCRIBE wildcard without visible variables fallback to compatibility engine');
|
|
1162
1162
|
}
|
|
1163
|
-
const unboundVariable = variables.find((variable) => !queryBindsVariableInRequiredShape(
|
|
1163
|
+
const unboundVariable = variables.find((variable) => !queryBindsVariableInRequiredShape(rdfQuery, variable));
|
|
1164
1164
|
if (unboundVariable) {
|
|
1165
1165
|
throw new UnsupportedSparqlQueryError('DESCRIBE wildcard variables must be bound by required embedded query patterns');
|
|
1166
1166
|
}
|
|
1167
|
-
return variables.map((variable) => (0,
|
|
1167
|
+
return variables.map((variable) => (0, RdfQueryExecutor_1.variable)(variable));
|
|
1168
1168
|
}
|
|
1169
1169
|
const targets = query.variables.map((target) => {
|
|
1170
1170
|
if (target.termType === 'Variable') {
|
|
1171
|
-
if (!queryBindsVariableInRequiredShape(
|
|
1171
|
+
if (!queryBindsVariableInRequiredShape(rdfQuery, target.value)) {
|
|
1172
1172
|
throw new UnsupportedSparqlQueryError('DESCRIBE variables must be bound by required embedded query patterns');
|
|
1173
1173
|
}
|
|
1174
|
-
return (0,
|
|
1174
|
+
return (0, RdfQueryExecutor_1.variable)(target.value);
|
|
1175
1175
|
}
|
|
1176
1176
|
if (target.termType === 'NamedNode') {
|
|
1177
1177
|
return target;
|
|
@@ -1190,9 +1190,9 @@ class RdfSparqlAdapter {
|
|
|
1190
1190
|
return term;
|
|
1191
1191
|
}
|
|
1192
1192
|
compileSelectVariables(query, state) {
|
|
1193
|
-
const
|
|
1193
|
+
const rdfQuery = state.query;
|
|
1194
1194
|
if (query.variables.length === 1 && query.variables[0] instanceof sparqljs_1.Wildcard) {
|
|
1195
|
-
if ((
|
|
1195
|
+
if ((rdfQuery.groupBy?.length ?? 0) > 0) {
|
|
1196
1196
|
throw new UnsupportedSparqlQueryError('Wildcard grouped SELECT fallback to compatibility engine');
|
|
1197
1197
|
}
|
|
1198
1198
|
return visibleSelectVariables(query);
|
|
@@ -1209,13 +1209,13 @@ class RdfSparqlAdapter {
|
|
|
1209
1209
|
throw new UnsupportedSparqlQueryError('Wildcard mixed with explicit SELECT projections fallback to compatibility engine');
|
|
1210
1210
|
}
|
|
1211
1211
|
if (!isAggregateExpression(variable.expression)) {
|
|
1212
|
-
if ((
|
|
1212
|
+
if ((rdfQuery.groupBy?.length ?? 0) > 0) {
|
|
1213
1213
|
throw new UnsupportedSparqlQueryError('Grouped SELECT expression projection fallback to compatibility engine');
|
|
1214
1214
|
}
|
|
1215
1215
|
const alias = variable.variable.value;
|
|
1216
1216
|
if (variables.includes(alias)
|
|
1217
1217
|
|| visibleVariables.includes(alias)
|
|
1218
|
-
|| (
|
|
1218
|
+
|| (rdfQuery.binds ?? []).some((bind) => bind.variable === alias)) {
|
|
1219
1219
|
throw new UnsupportedSparqlQueryError('SELECT expression alias is already bound locally');
|
|
1220
1220
|
}
|
|
1221
1221
|
state.addBind({
|
|
@@ -1227,11 +1227,11 @@ class RdfSparqlAdapter {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
const aggregate = variable.expression;
|
|
1229
1229
|
const compiledAggregate = this.compileAggregateProjection(aggregate, variable.variable.value, state);
|
|
1230
|
-
|
|
1231
|
-
|
|
1230
|
+
rdfQuery.aggregates = [...(rdfQuery.aggregates ?? []), compiledAggregate];
|
|
1231
|
+
rdfQuery.aggregate ??= compiledAggregate;
|
|
1232
1232
|
variables.push(variable.variable.value);
|
|
1233
1233
|
}
|
|
1234
|
-
this.assertGroupProjection(query,
|
|
1234
|
+
this.assertGroupProjection(query, rdfQuery, variables);
|
|
1235
1235
|
return variables;
|
|
1236
1236
|
}
|
|
1237
1237
|
compileAggregateProjection(aggregate, as, state) {
|
|
@@ -1319,8 +1319,8 @@ class RdfSparqlAdapter {
|
|
|
1319
1319
|
if (having.length === 0) {
|
|
1320
1320
|
return undefined;
|
|
1321
1321
|
}
|
|
1322
|
-
const
|
|
1323
|
-
if ((
|
|
1322
|
+
const rdfQuery = state.query;
|
|
1323
|
+
if ((rdfQuery.aggregates?.length ?? 0) === 0 && !rdfQuery.aggregate) {
|
|
1324
1324
|
throw new UnsupportedSparqlQueryError('HAVING without aggregate fallback to compatibility engine');
|
|
1325
1325
|
}
|
|
1326
1326
|
const filters = having.flatMap((expression) => this.compileHavingFilter(expression, state));
|
|
@@ -1363,8 +1363,8 @@ class RdfSparqlAdapter {
|
|
|
1363
1363
|
throw new UnsupportedSparqlQueryError('HAVING must compare one aggregate with one RDF term locally');
|
|
1364
1364
|
}
|
|
1365
1365
|
havingAggregateVariableOrUndefined(expression, state) {
|
|
1366
|
-
const
|
|
1367
|
-
const aggregates =
|
|
1366
|
+
const rdfQuery = state.query;
|
|
1367
|
+
const aggregates = rdfQuery.aggregates ?? (rdfQuery.aggregate ? [rdfQuery.aggregate] : []);
|
|
1368
1368
|
if (aggregates.length === 0) {
|
|
1369
1369
|
return undefined;
|
|
1370
1370
|
}
|
|
@@ -1397,21 +1397,21 @@ class RdfSparqlAdapter {
|
|
|
1397
1397
|
? { distinctVariables: state.visibleSolutionVariables }
|
|
1398
1398
|
: {}),
|
|
1399
1399
|
};
|
|
1400
|
-
|
|
1400
|
+
rdfQuery.aggregates = [...(rdfQuery.aggregates ?? []), hiddenAggregate];
|
|
1401
1401
|
return hiddenAggregate.as;
|
|
1402
1402
|
}
|
|
1403
|
-
assertGroupProjection(query,
|
|
1404
|
-
const groupBy =
|
|
1403
|
+
assertGroupProjection(query, rdfQuery, variables) {
|
|
1404
|
+
const groupBy = rdfQuery.groupBy ?? [];
|
|
1405
1405
|
if (groupBy.length === 0) {
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
|
-
const aggregates =
|
|
1408
|
+
const aggregates = rdfQuery.aggregates ?? (rdfQuery.aggregate ? [rdfQuery.aggregate] : []);
|
|
1409
1409
|
if (aggregates.length === 0) {
|
|
1410
1410
|
throw new UnsupportedSparqlQueryError('GROUP BY without aggregate fallback to compatibility engine');
|
|
1411
1411
|
}
|
|
1412
1412
|
const groupableVariables = new Set([
|
|
1413
|
-
...
|
|
1414
|
-
...(
|
|
1413
|
+
...rdfQuery.patterns.flatMap((pattern) => variablesInPattern(pattern)),
|
|
1414
|
+
...(rdfQuery.binds ?? []).map((bind) => bind.variable),
|
|
1415
1415
|
]);
|
|
1416
1416
|
if (groupBy.some((variableName) => !groupableVariables.has(variableName))) {
|
|
1417
1417
|
throw new UnsupportedSparqlQueryError('GROUP BY variables must come from required BGP patterns or local binds');
|
|
@@ -2252,7 +2252,7 @@ class CompileState {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
nextPathJoinVariable() {
|
|
2254
2254
|
this.pathJoinVariableIndex += 1;
|
|
2255
|
-
return (0,
|
|
2255
|
+
return (0, RdfQueryExecutor_1.variable)(`${PATH_JOIN_VARIABLE_PREFIX}_${this.pathJoinVariableIndex}`);
|
|
2256
2256
|
}
|
|
2257
2257
|
nextGroupVariable(index) {
|
|
2258
2258
|
this.groupVariableIndex += 1;
|