@undefineds.co/xpod 0.3.14 → 0.3.16
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/config/local.json +5 -5
- package/config/xpod.json +24 -10
- package/dist/cli/commands/auth.d.ts +1 -0
- package/dist/cli/commands/auth.js +117 -37
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/login.js +16 -23
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/logs.d.ts +2 -0
- package/dist/cli/commands/logs.js +20 -5
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/obj.d.ts +44 -0
- package/dist/cli/commands/obj.js +1059 -0
- package/dist/cli/commands/obj.js.map +1 -0
- package/dist/cli/commands/rdf.d.ts +14 -0
- package/dist/cli/commands/rdf.js +235 -0
- package/dist/cli/commands/rdf.js.map +1 -0
- package/dist/cli/commands/resource.d.ts +31 -0
- package/dist/cli/commands/resource.js +191 -0
- package/dist/cli/commands/resource.js.map +1 -0
- package/dist/cli/commands/secret.d.ts +36 -0
- package/dist/cli/commands/secret.js +285 -0
- package/dist/cli/commands/secret.js.map +1 -0
- package/dist/cli/commands/server.d.ts +11 -0
- package/dist/cli/commands/server.js +168 -0
- package/dist/cli/commands/server.js.map +1 -0
- package/dist/cli/commands/start.d.ts +1 -0
- package/dist/cli/commands/start.js +5 -0
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.js +21 -6
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stop.d.ts +3 -0
- package/dist/cli/commands/stop.js +40 -6
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/index.js +23 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lib/auth-context.d.ts +24 -0
- package/dist/cli/lib/auth-context.js +70 -0
- package/dist/cli/lib/auth-context.js.map +1 -0
- package/dist/cli/lib/output.d.ts +23 -0
- package/dist/cli/lib/output.js +63 -0
- package/dist/cli/lib/output.js.map +1 -0
- package/dist/cli/lib/resource.d.ts +29 -0
- package/dist/cli/lib/resource.js +114 -0
- package/dist/cli/lib/resource.js.map +1 -0
- package/dist/components/context.jsonld +6 -0
- package/dist/identity/oidc/AutoDetectIdentityProviderHandler.d.ts +11 -10
- package/dist/identity/oidc/AutoDetectIdentityProviderHandler.js +13 -24
- package/dist/identity/oidc/AutoDetectIdentityProviderHandler.js.map +1 -1
- package/dist/identity/oidc/AutoDetectIdentityProviderHandler.jsonld +4 -4
- package/dist/identity/oidc/AutoDetectOidcHandler.d.ts +8 -4
- package/dist/identity/oidc/AutoDetectOidcHandler.js +10 -6
- package/dist/identity/oidc/AutoDetectOidcHandler.js.map +1 -1
- package/dist/identity/oidc/AutoDetectOidcHandler.jsonld +3 -3
- package/dist/storage/accessors/MixDataAccessor.js +3 -0
- package/dist/storage/accessors/MixDataAccessor.js.map +1 -1
- package/dist/storage/quint/SqliteQuintStore.d.ts +26 -1
- package/dist/storage/quint/SqliteQuintStore.js +551 -318
- package/dist/storage/quint/SqliteQuintStore.js.map +1 -1
- package/dist/storage/quint/SqliteQuintStore.jsonld +102 -2
- package/dist/storage/quint/schema.d.ts +76 -0
- package/dist/storage/quint/schema.js +13 -7
- package/dist/storage/quint/schema.js.map +1 -1
- package/dist/storage/rdf/RdfLocalQueryEngine.d.ts +4 -1
- package/dist/storage/rdf/RdfLocalQueryEngine.js +77 -8
- package/dist/storage/rdf/RdfLocalQueryEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.d.ts +5 -0
- package/dist/storage/rdf/SolidRdfEngine.js +31 -3
- package/dist/storage/rdf/SolidRdfEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.jsonld +34 -0
- package/dist/storage/sparql/ComunicaQuintEngine.js +16 -3
- package/dist/storage/sparql/ComunicaQuintEngine.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/commands/config.d.ts +0 -42
- package/dist/cli/commands/config.js +0 -289
- package/dist/cli/commands/config.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RdfQuadIndex } from './RdfQuadIndex';
|
|
2
|
+
import { Rdf3xTripleIndex } from './Rdf3xTripleIndex';
|
|
2
3
|
import type { RdfTextIndex } from './RdfTextIndex';
|
|
3
4
|
import type { RdfVectorIndex } from './RdfVectorIndex';
|
|
4
5
|
import type { RdfLocalQuery, RdfLocalQueryResult, RdfQueryVariable } from './types';
|
|
@@ -6,7 +7,8 @@ export declare class RdfLocalQueryEngine {
|
|
|
6
7
|
private readonly index;
|
|
7
8
|
private readonly textIndex?;
|
|
8
9
|
private readonly vectorIndex?;
|
|
9
|
-
|
|
10
|
+
private readonly rdf3xPrimaryIndex?;
|
|
11
|
+
constructor(index: RdfQuadIndex, textIndex?: RdfTextIndex | undefined, vectorIndex?: RdfVectorIndex | undefined, rdf3xPrimaryIndex?: Rdf3xTripleIndex | undefined);
|
|
10
12
|
query(query: RdfLocalQuery): RdfLocalQueryResult;
|
|
11
13
|
private chooseRequiredSourceIndex;
|
|
12
14
|
private estimatePatternRows;
|
|
@@ -34,6 +36,7 @@ export declare class RdfLocalQueryEngine {
|
|
|
34
36
|
private canPushRequiredBgpOrder;
|
|
35
37
|
private reorderJoinPatterns;
|
|
36
38
|
private compileJoinPattern;
|
|
39
|
+
private canUseRdf3xPrimaryJoin;
|
|
37
40
|
private tupleValuesForBinding;
|
|
38
41
|
private joinTextSearch;
|
|
39
42
|
private joinVectorSearch;
|
|
@@ -10,10 +10,11 @@ const PLANNER_SAMPLE_BINDINGS = 16;
|
|
|
10
10
|
const XSD_DECIMAL = 'http://www.w3.org/2001/XMLSchema#decimal';
|
|
11
11
|
const XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer';
|
|
12
12
|
class RdfLocalQueryEngine {
|
|
13
|
-
constructor(index, textIndex, vectorIndex) {
|
|
13
|
+
constructor(index, textIndex, vectorIndex, rdf3xPrimaryIndex) {
|
|
14
14
|
this.index = index;
|
|
15
15
|
this.textIndex = textIndex;
|
|
16
16
|
this.vectorIndex = vectorIndex;
|
|
17
|
+
this.rdf3xPrimaryIndex = rdf3xPrimaryIndex;
|
|
17
18
|
}
|
|
18
19
|
query(query) {
|
|
19
20
|
const start = Date.now();
|
|
@@ -170,31 +171,35 @@ class RdfLocalQueryEngine {
|
|
|
170
171
|
groupedAggregatePushed = true;
|
|
171
172
|
}
|
|
172
173
|
else if (requiredBgpPushdown) {
|
|
173
|
-
const
|
|
174
|
+
const useRdf3xPrimary = this.canUseRdf3xPrimaryJoin(requiredBgpPushdown.patterns);
|
|
175
|
+
const scanOptions = {
|
|
174
176
|
...(requiredBgpPushdown.project ? { project: requiredBgpPushdown.project } : {}),
|
|
175
177
|
...(requiredBgpPushdown.distinctPushed ? { distinct: true } : {}),
|
|
176
178
|
...(requiredBgpPushdown.orderPushed ? { orderBy: query.orderBy } : {}),
|
|
177
179
|
...(requiredBgpPushdown.paginationPushed && query.limit !== undefined ? { limit: Math.max(0, query.limit) } : {}),
|
|
178
180
|
...(requiredBgpPushdown.paginationPushed && query.offset !== undefined ? { offset: Math.max(0, query.offset) } : {}),
|
|
179
181
|
...(requiredBgpPushdown.paginationPushed ? { countMatchedRows: false } : {}),
|
|
180
|
-
}
|
|
182
|
+
};
|
|
183
|
+
const scan = useRdf3xPrimary
|
|
184
|
+
? this.rdf3xPrimaryIndex.joinPatterns(requiredBgpPushdown.patterns, scanOptions)
|
|
185
|
+
: this.index.joinPatterns(requiredBgpPushdown.patterns, scanOptions);
|
|
181
186
|
bindings = scan.bindings;
|
|
182
187
|
metrics.scannedRows += scan.metrics.matchedRows;
|
|
183
188
|
metrics.indexChoices.push(scan.metrics.indexChoice);
|
|
184
189
|
metrics.filtersPushedDown += requiredBgpPushdown.pushedDownFilters;
|
|
185
|
-
if (requiredBgpPushdown.reorderPlan) {
|
|
190
|
+
if (!useRdf3xPrimary && requiredBgpPushdown.reorderPlan) {
|
|
186
191
|
metrics.plan.push(requiredBgpPushdown.reorderPlan);
|
|
187
192
|
}
|
|
188
193
|
metrics.plan.push(...storagePlanMarkers(scan.metrics.queryPlan));
|
|
189
|
-
metrics.plan.push(
|
|
194
|
+
metrics.plan.push(`${useRdf3xPrimary ? 'Rdf3xPrimaryJoin' : 'IndexJoin'}(${requiredBgpPushdown.patterns.map((source) => describePatternSource(source)).join('|')})`);
|
|
190
195
|
if (requiredBgpPushdown.orderPushed) {
|
|
191
|
-
metrics.plan.push(
|
|
196
|
+
metrics.plan.push(`${useRdf3xPrimary ? 'Rdf3xPrimaryJoinOrder' : 'IndexJoinOrder'}(${describeQueryOrder(query.orderBy ?? [])})`);
|
|
192
197
|
}
|
|
193
198
|
if (requiredBgpPushdown.distinctPushed) {
|
|
194
|
-
metrics.plan.push(
|
|
199
|
+
metrics.plan.push(`${useRdf3xPrimary ? 'Rdf3xPrimaryJoinDistinct' : 'IndexJoinDistinct'}(${(requiredBgpPushdown.project ?? []).map((variableName) => `?${variableName}`).join(',')})`);
|
|
195
200
|
}
|
|
196
201
|
if (requiredBgpPushdown.paginationPushed) {
|
|
197
|
-
metrics.plan.push('IndexJoinLimit');
|
|
202
|
+
metrics.plan.push(useRdf3xPrimary ? 'Rdf3xPrimaryJoinLimit' : 'IndexJoinLimit');
|
|
198
203
|
}
|
|
199
204
|
remainingSources.splice(0, remainingSources.length);
|
|
200
205
|
}
|
|
@@ -986,6 +991,11 @@ class RdfLocalQueryEngine {
|
|
|
986
991
|
const compiled = this.compilePattern(pattern, {}, filters);
|
|
987
992
|
return compiled ? { pattern: compiled, variables } : undefined;
|
|
988
993
|
}
|
|
994
|
+
canUseRdf3xPrimaryJoin(patterns) {
|
|
995
|
+
return Boolean(this.rdf3xPrimaryIndex)
|
|
996
|
+
&& patterns.length > 0
|
|
997
|
+
&& patterns.every((entry) => isRdf3xCompatiblePattern(entry.pattern));
|
|
998
|
+
}
|
|
989
999
|
tupleValuesForBinding(source, binding) {
|
|
990
1000
|
if (!source.tupleValues) {
|
|
991
1001
|
return undefined;
|
|
@@ -2531,6 +2541,9 @@ function describeQueryOrder(orderBy) {
|
|
|
2531
2541
|
}
|
|
2532
2542
|
function storagePlanMarkers(queryPlan) {
|
|
2533
2543
|
return (queryPlan ?? []).filter((entry) => (entry.startsWith('TextSearch(')
|
|
2544
|
+
|| entry.startsWith('Rdf3x')
|
|
2545
|
+
|| entry === 'GraphMembershipFilter'
|
|
2546
|
+
|| entry === 'GraphPrefixMembershipFilter'
|
|
2534
2547
|
|| entry.startsWith('LexicalRange(')
|
|
2535
2548
|
|| entry.startsWith('NumericRange(')
|
|
2536
2549
|
|| entry.startsWith('PrefixRange(')
|
|
@@ -2548,6 +2561,62 @@ function storagePlanMarkers(queryPlan) {
|
|
|
2548
2561
|
|| entry.startsWith('JoinGroupAggregateHaving(')
|
|
2549
2562
|
|| entry.startsWith('JoinGroupAggregateNumeric(')));
|
|
2550
2563
|
}
|
|
2564
|
+
function isRdf3xCompatiblePattern(pattern) {
|
|
2565
|
+
return TERM_KEYS.every((key) => {
|
|
2566
|
+
const value = pattern[key];
|
|
2567
|
+
if (!value || (0, types_1.isTerm)(value)) {
|
|
2568
|
+
return true;
|
|
2569
|
+
}
|
|
2570
|
+
if (key === 'graph' && isGraphPrefixPattern(value)) {
|
|
2571
|
+
return true;
|
|
2572
|
+
}
|
|
2573
|
+
if (key === 'object' && isRdf3xNumericRangePattern(value)) {
|
|
2574
|
+
return true;
|
|
2575
|
+
}
|
|
2576
|
+
return false;
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
function isGraphPrefixPattern(value) {
|
|
2580
|
+
return value !== null
|
|
2581
|
+
&& typeof value === 'object'
|
|
2582
|
+
&& Object.keys(value).length === 1
|
|
2583
|
+
&& '$startsWith' in value
|
|
2584
|
+
&& typeof value.$startsWith === 'string';
|
|
2585
|
+
}
|
|
2586
|
+
function isRdf3xNumericRangePattern(value) {
|
|
2587
|
+
if (value === null || typeof value !== 'object' || 'termType' in value) {
|
|
2588
|
+
return false;
|
|
2589
|
+
}
|
|
2590
|
+
const operators = ['$gt', '$gte', '$lt', '$lte'];
|
|
2591
|
+
if (Object.keys(value).some((key) => !operators.includes(key))) {
|
|
2592
|
+
return false;
|
|
2593
|
+
}
|
|
2594
|
+
let hasRange = false;
|
|
2595
|
+
for (const operator of operators) {
|
|
2596
|
+
const rangeValue = value[operator];
|
|
2597
|
+
if (rangeValue === undefined) {
|
|
2598
|
+
continue;
|
|
2599
|
+
}
|
|
2600
|
+
hasRange = true;
|
|
2601
|
+
if (rdf3xNumericRangeValue(rangeValue) === undefined) {
|
|
2602
|
+
return false;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
return hasRange;
|
|
2606
|
+
}
|
|
2607
|
+
function rdf3xNumericRangeValue(value) {
|
|
2608
|
+
if (typeof value === 'number') {
|
|
2609
|
+
return Number.isFinite(value) ? value : undefined;
|
|
2610
|
+
}
|
|
2611
|
+
if (typeof value === 'string') {
|
|
2612
|
+
const parsed = Number(value);
|
|
2613
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
2614
|
+
}
|
|
2615
|
+
if ((0, types_1.isTerm)(value)) {
|
|
2616
|
+
return (0, RdfTermSemantics_1.isRdfNumericTerm)(value) ? (0, RdfTermSemantics_1.rdfNumericValue)(value.value) : undefined;
|
|
2617
|
+
}
|
|
2618
|
+
return undefined;
|
|
2619
|
+
}
|
|
2551
2620
|
function bindTextSearchResult(binding, pattern, result) {
|
|
2552
2621
|
const next = { ...binding };
|
|
2553
2622
|
const chunkResource = `${result.source}#chunk-${encodeURIComponent(result.chunkKey)}`;
|