@origintrail-official/dkg-agent 10.0.12 → 10.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +54 -54
- package/dist/ccl-fact-resolution.js +22 -22
- package/dist/context-graph-meta-projection.js +58 -58
- package/dist/context-graph-private-meta-proof.js +18 -18
- package/dist/context-graph-public-meta-proof.js +11 -11
- package/dist/context-graph-public-meta-repair.js +33 -33
- package/dist/context-graph-subscription-policy.d.ts +31 -0
- package/dist/context-graph-subscription-policy.d.ts.map +1 -0
- package/dist/context-graph-subscription-policy.js +48 -0
- package/dist/context-graph-subscription-policy.js.map +1 -0
- package/dist/curator-meta-refresh.js +23 -23
- package/dist/discovery.js +52 -52
- package/dist/dkg-agent-ccl.js +50 -50
- package/dist/dkg-agent-cg-registry.js +5 -5
- package/dist/dkg-agent-cg-registry.js.map +1 -1
- package/dist/dkg-agent-cg-resolve.js +77 -77
- package/dist/dkg-agent-context-graph.d.ts.map +1 -1
- package/dist/dkg-agent-context-graph.js +13 -10
- package/dist/dkg-agent-context-graph.js.map +1 -1
- package/dist/dkg-agent-endorse.js +19 -19
- package/dist/dkg-agent-join.js +110 -110
- package/dist/dkg-agent-lifecycle.d.ts +6 -3
- package/dist/dkg-agent-lifecycle.d.ts.map +1 -1
- package/dist/dkg-agent-lifecycle.js +282 -114
- package/dist/dkg-agent-lifecycle.js.map +1 -1
- package/dist/dkg-agent-ownership.js +17 -17
- package/dist/dkg-agent-publish.d.ts +28 -0
- package/dist/dkg-agent-publish.d.ts.map +1 -1
- package/dist/dkg-agent-publish.js +118 -66
- package/dist/dkg-agent-publish.js.map +1 -1
- package/dist/dkg-agent-query.js +4 -4
- package/dist/dkg-agent-registry.js +32 -32
- package/dist/dkg-agent-rfc64-catalog-auto-publish.d.ts +67 -2
- package/dist/dkg-agent-rfc64-catalog-auto-publish.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-catalog-auto-publish.js +328 -30
- package/dist/dkg-agent-rfc64-catalog-auto-publish.js.map +1 -1
- package/dist/dkg-agent-swm-host.d.ts.map +1 -1
- package/dist/dkg-agent-swm-host.js +89 -82
- package/dist/dkg-agent-swm-host.js.map +1 -1
- package/dist/dkg-agent-swm-substrate.d.ts +3 -1
- package/dist/dkg-agent-swm-substrate.d.ts.map +1 -1
- package/dist/dkg-agent-swm-substrate.js +27 -6
- package/dist/dkg-agent-swm-substrate.js.map +1 -1
- package/dist/dkg-agent-types.d.ts +168 -4
- package/dist/dkg-agent-types.d.ts.map +1 -1
- package/dist/dkg-agent-types.js.map +1 -1
- package/dist/dkg-agent.d.ts +2 -2
- package/dist/dkg-agent.d.ts.map +1 -1
- package/dist/dkg-agent.js +153 -118
- package/dist/dkg-agent.js.map +1 -1
- package/dist/finalization-handler.d.ts.map +1 -1
- package/dist/finalization-handler.js +62 -50
- package/dist/finalization-handler.js.map +1 -1
- package/dist/finalization-recovery-sqlite-codec.d.ts +5 -0
- package/dist/finalization-recovery-sqlite-codec.d.ts.map +1 -1
- package/dist/finalization-recovery-sqlite-codec.js +10 -5
- package/dist/finalization-recovery-sqlite-codec.js.map +1 -1
- package/dist/finalization-recovery-sqlite-policy.d.ts +14 -0
- package/dist/finalization-recovery-sqlite-policy.d.ts.map +1 -1
- package/dist/finalization-recovery-sqlite-policy.js +98 -51
- package/dist/finalization-recovery-sqlite-policy.js.map +1 -1
- package/dist/finalization-recovery-sqlite-schema.d.ts.map +1 -1
- package/dist/finalization-recovery-sqlite-schema.js +161 -84
- package/dist/finalization-recovery-sqlite-schema.js.map +1 -1
- package/dist/finalization-recovery-sqlite-store.d.ts +4 -0
- package/dist/finalization-recovery-sqlite-store.d.ts.map +1 -1
- package/dist/finalization-recovery-sqlite-store.js +267 -137
- package/dist/finalization-recovery-sqlite-store.js.map +1 -1
- package/dist/finalization-recovery-store.d.ts +9 -0
- package/dist/finalization-recovery-store.d.ts.map +1 -1
- package/dist/finalization-recovery.d.ts +20 -2
- package/dist/finalization-recovery.d.ts.map +1 -1
- package/dist/finalization-recovery.js +125 -22
- package/dist/finalization-recovery.js.map +1 -1
- package/dist/finalized-assertion-author.js +6 -6
- package/dist/gossip-publish-handler.d.ts.map +1 -1
- package/dist/gossip-publish-handler.js +9 -6
- package/dist/gossip-publish-handler.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/join-request-retention.js +36 -36
- package/dist/rfc64/author-catalog-producer.d.ts +3 -5
- package/dist/rfc64/author-catalog-producer.d.ts.map +1 -1
- package/dist/rfc64/author-catalog-producer.js +8 -16
- package/dist/rfc64/author-catalog-producer.js.map +1 -1
- package/dist/rfc64/control-envelope-signer-v1.d.ts +18 -0
- package/dist/rfc64/control-envelope-signer-v1.d.ts.map +1 -0
- package/dist/rfc64/control-envelope-signer-v1.js +29 -0
- package/dist/rfc64/control-envelope-signer-v1.js.map +1 -0
- package/dist/rfc64/finalized-vm-store-materializer-v1.js +6 -6
- package/dist/rfc64/inventory-v1/candidate.d.ts +14 -4
- package/dist/rfc64/inventory-v1/candidate.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/candidate.js +61 -21
- package/dist/rfc64/inventory-v1/candidate.js.map +1 -1
- package/dist/rfc64/inventory-v1/exact-record.d.ts +13 -0
- package/dist/rfc64/inventory-v1/exact-record.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/exact-record.js +42 -0
- package/dist/rfc64/inventory-v1/exact-record.js.map +1 -0
- package/dist/rfc64/inventory-v1/index.d.ts +1 -1
- package/dist/rfc64/inventory-v1/index.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/index.js +1 -1
- package/dist/rfc64/inventory-v1/index.js.map +1 -1
- package/dist/rfc64/inventory-v1/open.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/open.js +89 -40
- package/dist/rfc64/inventory-v1/open.js.map +1 -1
- package/dist/rfc64/inventory-v1/scalars.d.ts +1 -0
- package/dist/rfc64/inventory-v1/scalars.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/scalars.js +5 -0
- package/dist/rfc64/inventory-v1/scalars.js.map +1 -1
- package/dist/rfc64/inventory-v1/sql.d.ts +12 -1
- package/dist/rfc64/inventory-v1/sql.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/sql.js +386 -274
- package/dist/rfc64/inventory-v1/sql.js.map +1 -1
- package/dist/rfc64/inventory-v1/statements.d.ts +14 -2
- package/dist/rfc64/inventory-v1/statements.d.ts.map +1 -1
- package/dist/rfc64/inventory-v1/statements.js +303 -228
- package/dist/rfc64/inventory-v1/statements.js.map +1 -1
- package/dist/rfc64/inventory-v1/swm-author-inventory-auth-v1.d.ts +16 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-auth-v1.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-auth-v1.js +52 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-auth-v1.js.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-commit-plan.d.ts +19 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-commit-plan.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-commit-plan.js +39 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-commit-plan.js.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-contracts.d.ts +33 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-contracts.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-contracts.js +17 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-contracts.js.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-mutation.d.ts +17 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-mutation.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-mutation.js +68 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-mutation.js.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-persistence.d.ts +30 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-persistence.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-persistence.js +228 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-persistence.js.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-sql-codec.d.ts +11 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-sql-codec.d.ts.map +1 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-sql-codec.js +62 -0
- package/dist/rfc64/inventory-v1/swm-author-inventory-sql-codec.js.map +1 -0
- package/dist/rfc64/persistence-v1.d.ts +3 -1
- package/dist/rfc64/persistence-v1.d.ts.map +1 -1
- package/dist/rfc64/persistence-v1.js +3 -1
- package/dist/rfc64/persistence-v1.js.map +1 -1
- package/dist/rfc64/public-catalog-activation-config-v1.d.ts +84 -0
- package/dist/rfc64/public-catalog-activation-config-v1.d.ts.map +1 -0
- package/dist/rfc64/public-catalog-activation-config-v1.js +223 -0
- package/dist/rfc64/public-catalog-activation-config-v1.js.map +1 -0
- package/dist/rfc64/public-catalog-native-receiver-v1.d.ts.map +1 -1
- package/dist/rfc64/public-catalog-native-receiver-v1.js +19 -1
- package/dist/rfc64/public-catalog-native-receiver-v1.js.map +1 -1
- package/dist/rfc64/secure-filesystem-policy-v1.js +91 -91
- package/dist/rfc64/swm-author-inventory-producer-v1.d.ts +47 -0
- package/dist/rfc64/swm-author-inventory-producer-v1.d.ts.map +1 -0
- package/dist/rfc64/swm-author-inventory-producer-v1.js +276 -0
- package/dist/rfc64/swm-author-inventory-producer-v1.js.map +1 -0
- package/dist/rfc64/swm-inventory-shadow-runtime-v1.d.ts +39 -0
- package/dist/rfc64/swm-inventory-shadow-runtime-v1.d.ts.map +1 -0
- package/dist/rfc64/swm-inventory-shadow-runtime-v1.js +137 -0
- package/dist/rfc64/swm-inventory-shadow-runtime-v1.js.map +1 -0
- package/dist/storage-ack-lifecycle-identity.js +6 -6
- package/dist/sync/catchup-pass-policy.d.ts +172 -0
- package/dist/sync/catchup-pass-policy.d.ts.map +1 -0
- package/dist/sync/catchup-pass-policy.js +239 -0
- package/dist/sync/catchup-pass-policy.js.map +1 -0
- package/dist/sync/catchup-policy.d.ts +8 -0
- package/dist/sync/catchup-policy.d.ts.map +1 -1
- package/dist/sync/catchup-policy.js +1 -1
- package/dist/sync/catchup-policy.js.map +1 -1
- package/dist/sync/durable-progress.d.ts +12 -0
- package/dist/sync/durable-progress.d.ts.map +1 -1
- package/dist/sync/durable-progress.js +16 -0
- package/dist/sync/durable-progress.js.map +1 -1
- package/dist/sync/on-connect/sync-on-connect.d.ts +2 -0
- package/dist/sync/on-connect/sync-on-connect.d.ts.map +1 -1
- package/dist/sync/on-connect/sync-on-connect.js +58 -19
- package/dist/sync/on-connect/sync-on-connect.js.map +1 -1
- package/dist/sync/policy.d.ts +20 -0
- package/dist/sync/policy.d.ts.map +1 -1
- package/dist/sync/policy.js +41 -1
- package/dist/sync/policy.js.map +1 -1
- package/dist/sync/priority-admission-queue.d.ts.map +1 -1
- package/dist/sync/priority-admission-queue.js +15 -0
- package/dist/sync/priority-admission-queue.js.map +1 -1
- package/dist/sync/requester/durable-sync-budget.d.ts +28 -1
- package/dist/sync/requester/durable-sync-budget.d.ts.map +1 -1
- package/dist/sync/requester/durable-sync-budget.js +49 -8
- package/dist/sync/requester/durable-sync-budget.js.map +1 -1
- package/dist/sync/requester/durable-sync.d.ts +1 -1
- package/dist/sync/requester/durable-sync.d.ts.map +1 -1
- package/dist/sync/requester/durable-sync.js +19 -10
- package/dist/sync/requester/durable-sync.js.map +1 -1
- package/dist/sync/requester/graph-scoped-materialization.js +12 -12
- package/dist/sync/requester/ordered-sync.d.ts +22 -1
- package/dist/sync/requester/ordered-sync.d.ts.map +1 -1
- package/dist/sync/requester/ordered-sync.js +25 -2
- package/dist/sync/requester/ordered-sync.js.map +1 -1
- package/dist/sync/requester/shared-memory-sync.d.ts +82 -0
- package/dist/sync/requester/shared-memory-sync.d.ts.map +1 -1
- package/dist/sync/requester/shared-memory-sync.js +605 -85
- package/dist/sync/requester/shared-memory-sync.js.map +1 -1
- package/dist/sync/requester/swm-recovery.d.ts.map +1 -1
- package/dist/sync/requester/swm-recovery.js +9 -0
- package/dist/sync/requester/swm-recovery.js.map +1 -1
- package/dist/sync/requester/swm-snapshot-materializer.d.ts.map +1 -1
- package/dist/sync/requester/swm-snapshot-materializer.js +89 -1
- package/dist/sync/requester/swm-snapshot-materializer.js.map +1 -1
- package/dist/sync/responder/durable-meta-admission.js +13 -13
- package/dist/sync/responder/graph-plan.d.ts +14 -1
- package/dist/sync/responder/graph-plan.d.ts.map +1 -1
- package/dist/sync/responder/graph-plan.js +329 -299
- package/dist/sync/responder/graph-plan.js.map +1 -1
- package/dist/sync/responder/snapshot-cache.d.ts +1 -1
- package/dist/sync/responder/snapshot-cache.d.ts.map +1 -1
- package/dist/sync/responder/snapshot-cache.js +21 -5
- package/dist/sync/responder/snapshot-cache.js.map +1 -1
- package/dist/sync/system-context-graph-policy.d.ts +13 -0
- package/dist/sync/system-context-graph-policy.d.ts.map +1 -0
- package/dist/sync/system-context-graph-policy.js +22 -0
- package/dist/sync/system-context-graph-policy.js.map +1 -0
- package/package.json +23 -7
|
@@ -173,13 +173,13 @@ export class ContextGraphMetaProjection {
|
|
|
173
173
|
const agentsGraph = contextGraphDataGraphUri(SYSTEM_CONTEXT_GRAPHS.AGENTS);
|
|
174
174
|
assertSafeIri(ontologyGraph);
|
|
175
175
|
assertSafeIri(agentsGraph);
|
|
176
|
-
const result = await this.store.query(`
|
|
177
|
-
SELECT DISTINCT ?ctxGraph WHERE {
|
|
178
|
-
VALUES ?sourceGraph { <${ontologyGraph}> <${agentsGraph}> }
|
|
179
|
-
GRAPH ?sourceGraph {
|
|
180
|
-
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> .
|
|
181
|
-
}
|
|
182
|
-
}
|
|
176
|
+
const result = await this.store.query(`
|
|
177
|
+
SELECT DISTINCT ?ctxGraph WHERE {
|
|
178
|
+
VALUES ?sourceGraph { <${ontologyGraph}> <${agentsGraph}> }
|
|
179
|
+
GRAPH ?sourceGraph {
|
|
180
|
+
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> .
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
183
|
`, options);
|
|
184
184
|
const ids = new Set();
|
|
185
185
|
if (result.type === 'bindings') {
|
|
@@ -212,15 +212,15 @@ export class ContextGraphMetaProjection {
|
|
|
212
212
|
for (const chunk of chunks(graphUris, 128)) {
|
|
213
213
|
for (const graphUri of chunk)
|
|
214
214
|
assertSafeIri(graphUri);
|
|
215
|
-
const result = await this.store.query(`
|
|
216
|
-
SELECT DISTINCT ?ctxGraph WHERE {
|
|
217
|
-
VALUES ?g { ${chunk.map((graphUri) => `<${graphUri}>`).join(' ')} }
|
|
218
|
-
GRAPH ?g {
|
|
219
|
-
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> .
|
|
220
|
-
FILTER(STRSTARTS(STR(?ctxGraph), "${CONTEXT_GRAPH_PREFIX}"))
|
|
221
|
-
FILTER(STR(?g) = CONCAT(STR(?ctxGraph), "/_meta"))
|
|
222
|
-
}
|
|
223
|
-
}
|
|
215
|
+
const result = await this.store.query(`
|
|
216
|
+
SELECT DISTINCT ?ctxGraph WHERE {
|
|
217
|
+
VALUES ?g { ${chunk.map((graphUri) => `<${graphUri}>`).join(' ')} }
|
|
218
|
+
GRAPH ?g {
|
|
219
|
+
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> .
|
|
220
|
+
FILTER(STRSTARTS(STR(?ctxGraph), "${CONTEXT_GRAPH_PREFIX}"))
|
|
221
|
+
FILTER(STR(?g) = CONCAT(STR(?ctxGraph), "/_meta"))
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
224
|
`, options);
|
|
225
225
|
if (result.type !== 'bindings')
|
|
226
226
|
continue;
|
|
@@ -242,15 +242,15 @@ export class ContextGraphMetaProjection {
|
|
|
242
242
|
for (const chunk of chunks(graphUris, 128)) {
|
|
243
243
|
for (const graphUri of chunk)
|
|
244
244
|
assertSafeIri(graphUri);
|
|
245
|
-
const result = await this.store.query(`
|
|
246
|
-
SELECT DISTINCT ?ctxGraph WHERE {
|
|
247
|
-
VALUES ?g { ${chunk.map((graphUri) => `<${graphUri}>`).join(' ')} }
|
|
248
|
-
GRAPH ?g {
|
|
249
|
-
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_PRIVATE_CONTEXT_GRAPH}> .
|
|
250
|
-
FILTER(STRSTARTS(STR(?ctxGraph), "${CONTEXT_GRAPH_PREFIX}"))
|
|
251
|
-
FILTER(STR(?g) = CONCAT(STR(?ctxGraph), "/_catalog"))
|
|
252
|
-
}
|
|
253
|
-
}
|
|
245
|
+
const result = await this.store.query(`
|
|
246
|
+
SELECT DISTINCT ?ctxGraph WHERE {
|
|
247
|
+
VALUES ?g { ${chunk.map((graphUri) => `<${graphUri}>`).join(' ')} }
|
|
248
|
+
GRAPH ?g {
|
|
249
|
+
?ctxGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_PRIVATE_CONTEXT_GRAPH}> .
|
|
250
|
+
FILTER(STRSTARTS(STR(?ctxGraph), "${CONTEXT_GRAPH_PREFIX}"))
|
|
251
|
+
FILTER(STR(?g) = CONCAT(STR(?ctxGraph), "/_catalog"))
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
254
|
`, options);
|
|
255
255
|
if (result.type !== 'bindings')
|
|
256
256
|
continue;
|
|
@@ -341,17 +341,17 @@ export class ContextGraphMetaProjection {
|
|
|
341
341
|
}
|
|
342
342
|
async loadDelegations(contextGraphId, options) {
|
|
343
343
|
const metaGraph = contextGraphMetaGraphUri(contextGraphId);
|
|
344
|
-
const result = await this.store.query(`SELECT ?delegation ?predicate ?object WHERE {
|
|
345
|
-
GRAPH <${metaGraph}> {
|
|
346
|
-
?delegation <${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}> ?delegatedAgent .
|
|
347
|
-
?delegation ?predicate ?object .
|
|
348
|
-
VALUES ?predicate {
|
|
349
|
-
<${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}>
|
|
350
|
-
<${DKG_ONTOLOGY.DKG_ALLOWED_DELEGATEE_PEER}>
|
|
351
|
-
<${DKG_ONTOLOGY.DKG_ALLOWED_DELEGATEE_KEY}>
|
|
352
|
-
<${DKG_ONTOLOGY.DKG_DELEGATION_EXPIRES_AT}>
|
|
353
|
-
}
|
|
354
|
-
}
|
|
344
|
+
const result = await this.store.query(`SELECT ?delegation ?predicate ?object WHERE {
|
|
345
|
+
GRAPH <${metaGraph}> {
|
|
346
|
+
?delegation <${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}> ?delegatedAgent .
|
|
347
|
+
?delegation ?predicate ?object .
|
|
348
|
+
VALUES ?predicate {
|
|
349
|
+
<${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}>
|
|
350
|
+
<${DKG_ONTOLOGY.DKG_ALLOWED_DELEGATEE_PEER}>
|
|
351
|
+
<${DKG_ONTOLOGY.DKG_ALLOWED_DELEGATEE_KEY}>
|
|
352
|
+
<${DKG_ONTOLOGY.DKG_DELEGATION_EXPIRES_AT}>
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
355
|
}`, options);
|
|
356
356
|
if (result.type !== 'bindings')
|
|
357
357
|
return [];
|
|
@@ -390,10 +390,10 @@ export class ContextGraphMetaProjection {
|
|
|
390
390
|
return [...byUri.values()];
|
|
391
391
|
}
|
|
392
392
|
async loadContextGraphFacts(graphUri, contextGraphUri, record, options, allowedPredicates) {
|
|
393
|
-
const result = await this.store.query(`SELECT ?p ?o WHERE {
|
|
394
|
-
GRAPH <${graphUri}> {
|
|
395
|
-
<${contextGraphUri}> ?p ?o .
|
|
396
|
-
}
|
|
393
|
+
const result = await this.store.query(`SELECT ?p ?o WHERE {
|
|
394
|
+
GRAPH <${graphUri}> {
|
|
395
|
+
<${contextGraphUri}> ?p ?o .
|
|
396
|
+
}
|
|
397
397
|
}`, options);
|
|
398
398
|
if (result.type !== 'bindings')
|
|
399
399
|
return;
|
|
@@ -476,24 +476,24 @@ export class ContextGraphMetaProjection {
|
|
|
476
476
|
}
|
|
477
477
|
async loadSubGraphs(contextGraphId, options) {
|
|
478
478
|
const metaGraph = contextGraphMetaGraphUri(contextGraphId);
|
|
479
|
-
const result = await this.store.query(`SELECT ?subGraph ?name ?createdBy ?createdAt ?description WHERE {
|
|
480
|
-
GRAPH <${metaGraph}> {
|
|
481
|
-
?subGraph ?typePred ?subGraphType ;
|
|
482
|
-
?namePred ?name ;
|
|
483
|
-
?createdByPred ?createdBy .
|
|
484
|
-
VALUES ?typePred { <${DKG_ONTOLOGY.RDF_TYPE}> }
|
|
485
|
-
VALUES ?subGraphType { <${DKG_NS}SubGraph> <${LEGACY_DKG_NS}SubGraph> }
|
|
486
|
-
VALUES ?namePred { <${DKG_ONTOLOGY.SCHEMA_NAME}> <${LEGACY_SCHEMA_NS}name> }
|
|
487
|
-
VALUES ?createdByPred { <${DKG_NS}createdBy> <${LEGACY_DKG_NS}createdBy> }
|
|
488
|
-
OPTIONAL {
|
|
489
|
-
?subGraph ?createdAtPred ?createdAt .
|
|
490
|
-
VALUES ?createdAtPred { <${DKG_NS}createdAt> <${LEGACY_DKG_NS}createdAt> }
|
|
491
|
-
}
|
|
492
|
-
OPTIONAL {
|
|
493
|
-
?subGraph ?descriptionPred ?description .
|
|
494
|
-
VALUES ?descriptionPred { <${DKG_ONTOLOGY.SCHEMA_DESCRIPTION}> <${LEGACY_SCHEMA_NS}description> }
|
|
495
|
-
}
|
|
496
|
-
}
|
|
479
|
+
const result = await this.store.query(`SELECT ?subGraph ?name ?createdBy ?createdAt ?description WHERE {
|
|
480
|
+
GRAPH <${metaGraph}> {
|
|
481
|
+
?subGraph ?typePred ?subGraphType ;
|
|
482
|
+
?namePred ?name ;
|
|
483
|
+
?createdByPred ?createdBy .
|
|
484
|
+
VALUES ?typePred { <${DKG_ONTOLOGY.RDF_TYPE}> }
|
|
485
|
+
VALUES ?subGraphType { <${DKG_NS}SubGraph> <${LEGACY_DKG_NS}SubGraph> }
|
|
486
|
+
VALUES ?namePred { <${DKG_ONTOLOGY.SCHEMA_NAME}> <${LEGACY_SCHEMA_NS}name> }
|
|
487
|
+
VALUES ?createdByPred { <${DKG_NS}createdBy> <${LEGACY_DKG_NS}createdBy> }
|
|
488
|
+
OPTIONAL {
|
|
489
|
+
?subGraph ?createdAtPred ?createdAt .
|
|
490
|
+
VALUES ?createdAtPred { <${DKG_NS}createdAt> <${LEGACY_DKG_NS}createdAt> }
|
|
491
|
+
}
|
|
492
|
+
OPTIONAL {
|
|
493
|
+
?subGraph ?descriptionPred ?description .
|
|
494
|
+
VALUES ?descriptionPred { <${DKG_ONTOLOGY.SCHEMA_DESCRIPTION}> <${LEGACY_SCHEMA_NS}description> }
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
497
|
}`, options);
|
|
498
498
|
if (result.type !== 'bindings')
|
|
499
499
|
return [];
|
|
@@ -148,19 +148,19 @@ function renderMemberProof(contextGraphId, contextGraphUri, rawProof) {
|
|
|
148
148
|
credentialPatterns.push(`OPTIONAL { <${delegationSubject}> <${DKG_ONTOLOGY.DKG_ALLOWED_DELEGATEE_KEY}> ?approvedDelegateeKey . }`);
|
|
149
149
|
credentialFilters.push(`(BOUND(?approvedDelegateeKey) && isLiteral(?approvedDelegateeKey) && LCASE(STR(?approvedDelegateeKey)) = ${sparqlString(proof.expectedDelegateeOpKey)})`);
|
|
150
150
|
}
|
|
151
|
-
return ` <${assertSafeIri(contextGraphUri)}> <${DKG_ONTOLOGY.DKG_ALLOWED_AGENT}> ?approvedAgent .
|
|
152
|
-
FILTER(isLiteral(?approvedAgent) && LCASE(STR(?approvedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
153
|
-
FILTER NOT EXISTS {
|
|
154
|
-
<${assertSafeIri(contextGraphUri)}> <${DKG_ONTOLOGY.DKG_REVOKED_AGENT}> ?revokedApprovedAgent .
|
|
155
|
-
FILTER(isLiteral(?revokedApprovedAgent) && LCASE(STR(?revokedApprovedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
156
|
-
}
|
|
157
|
-
<${delegationSubject}> <${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}> ?delegatedApprovedAgent ;
|
|
158
|
-
<${DKG_ONTOLOGY.DKG_DELEGATION_ISSUED_AT}> ?delegationIssuedAt .
|
|
159
|
-
FILTER(isLiteral(?delegatedApprovedAgent) && LCASE(STR(?delegatedApprovedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
160
|
-
FILTER(REGEX(STR(?delegationIssuedAt), "^[0-9]+$") && xsd:integer(STR(?delegationIssuedAt)) <= ${proof.nowMs})
|
|
161
|
-
OPTIONAL { <${delegationSubject}> <${DKG_ONTOLOGY.DKG_DELEGATION_EXPIRES_AT}> ?delegationExpiresAt . }
|
|
162
|
-
FILTER(!BOUND(?delegationExpiresAt) || (REGEX(STR(?delegationExpiresAt), "^[0-9]+$") && xsd:integer(STR(?delegationExpiresAt)) > ${proof.nowMs}))
|
|
163
|
-
${credentialPatterns.join('\n ')}
|
|
151
|
+
return ` <${assertSafeIri(contextGraphUri)}> <${DKG_ONTOLOGY.DKG_ALLOWED_AGENT}> ?approvedAgent .
|
|
152
|
+
FILTER(isLiteral(?approvedAgent) && LCASE(STR(?approvedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
153
|
+
FILTER NOT EXISTS {
|
|
154
|
+
<${assertSafeIri(contextGraphUri)}> <${DKG_ONTOLOGY.DKG_REVOKED_AGENT}> ?revokedApprovedAgent .
|
|
155
|
+
FILTER(isLiteral(?revokedApprovedAgent) && LCASE(STR(?revokedApprovedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
156
|
+
}
|
|
157
|
+
<${delegationSubject}> <${DKG_ONTOLOGY.DKG_DELEGATION_AGENT}> ?delegatedApprovedAgent ;
|
|
158
|
+
<${DKG_ONTOLOGY.DKG_DELEGATION_ISSUED_AT}> ?delegationIssuedAt .
|
|
159
|
+
FILTER(isLiteral(?delegatedApprovedAgent) && LCASE(STR(?delegatedApprovedAgent)) = ${sparqlString(proof.approvedAgentAddress)})
|
|
160
|
+
FILTER(REGEX(STR(?delegationIssuedAt), "^[0-9]+$") && xsd:integer(STR(?delegationIssuedAt)) <= ${proof.nowMs})
|
|
161
|
+
OPTIONAL { <${delegationSubject}> <${DKG_ONTOLOGY.DKG_DELEGATION_EXPIRES_AT}> ?delegationExpiresAt . }
|
|
162
|
+
FILTER(!BOUND(?delegationExpiresAt) || (REGEX(STR(?delegationExpiresAt), "^[0-9]+$") && xsd:integer(STR(?delegationExpiresAt)) > ${proof.nowMs}))
|
|
163
|
+
${credentialPatterns.join('\n ')}
|
|
164
164
|
FILTER(${credentialFilters.join(' || ')})`;
|
|
165
165
|
}
|
|
166
166
|
/** Build the store-side ASK query from the same canonical proof model. */
|
|
@@ -173,11 +173,11 @@ export function buildAuthoritativePrivateMetaAskQuery(contextGraphId, memberProo
|
|
|
173
173
|
const memberRequirements = memberProof
|
|
174
174
|
? `\n${renderMemberProof(contextGraphId, contextGraphUri, memberProof)}`
|
|
175
175
|
: '';
|
|
176
|
-
return `PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
177
|
-
ASK WHERE {
|
|
178
|
-
GRAPH <${assertSafeIri(metaGraph)}> {
|
|
179
|
-
${requirements}${memberRequirements}
|
|
180
|
-
}
|
|
176
|
+
return `PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
177
|
+
ASK WHERE {
|
|
178
|
+
GRAPH <${assertSafeIri(metaGraph)}> {
|
|
179
|
+
${requirements}${memberRequirements}
|
|
180
|
+
}
|
|
181
181
|
}`;
|
|
182
182
|
}
|
|
183
183
|
//# sourceMappingURL=context-graph-private-meta-proof.js.map
|
|
@@ -87,17 +87,17 @@ export function buildAuthoritativePublicMetaAskQuery(contextGraphId) {
|
|
|
87
87
|
if (publicPolicy.kind !== 'normalized-literal') {
|
|
88
88
|
throw new Error('Public access policy proof must use a normalized literal');
|
|
89
89
|
}
|
|
90
|
-
return `ASK WHERE {
|
|
91
|
-
GRAPH <${assertSafeIri(metaGraph)}> {
|
|
92
|
-
${requirements}
|
|
93
|
-
FILTER NOT EXISTS {
|
|
94
|
-
<${assertSafeIri(contextGraphUri)}> <${accessPolicyPredicate}> ?conflictingAccessPolicy .
|
|
95
|
-
FILTER(
|
|
96
|
-
!isLiteral(?conflictingAccessPolicy) ||
|
|
97
|
-
LCASE(REPLACE(STR(?conflictingAccessPolicy), "^\\\\s+|\\\\s+$", "")) != ${sparqlString(publicPolicy.value)}
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
90
|
+
return `ASK WHERE {
|
|
91
|
+
GRAPH <${assertSafeIri(metaGraph)}> {
|
|
92
|
+
${requirements}
|
|
93
|
+
FILTER NOT EXISTS {
|
|
94
|
+
<${assertSafeIri(contextGraphUri)}> <${accessPolicyPredicate}> ?conflictingAccessPolicy .
|
|
95
|
+
FILTER(
|
|
96
|
+
!isLiteral(?conflictingAccessPolicy) ||
|
|
97
|
+
LCASE(REPLACE(STR(?conflictingAccessPolicy), "^\\\\s+|\\\\s+$", "")) != ${sparqlString(publicPolicy.value)}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
101
|
}`;
|
|
102
102
|
}
|
|
103
103
|
//# sourceMappingURL=context-graph-public-meta-proof.js.map
|
|
@@ -16,29 +16,29 @@ const CONTEXT_GRAPH_URI_PREFIX = 'did:dkg:context-graph:';
|
|
|
16
16
|
export async function repairCreatorPublicMetaProjections(store, peerId) {
|
|
17
17
|
const ontologyGraph = assertSafeIri(contextGraphDataGraphUri(SYSTEM_CONTEXT_GRAPHS.ONTOLOGY));
|
|
18
18
|
const creatorDid = assertSafeIri(`did:dkg:agent:${peerId}`);
|
|
19
|
-
const candidatesResult = await store.query(`
|
|
20
|
-
SELECT DISTINCT ?contextGraph WHERE {
|
|
21
|
-
GRAPH <${ontologyGraph}> {
|
|
22
|
-
?contextGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> ;
|
|
23
|
-
<${DKG_ONTOLOGY.DKG_CREATOR}> <${creatorDid}> ;
|
|
24
|
-
<${DKG_ONTOLOGY.DKG_ACCESS_POLICY}> ?accessPolicy .
|
|
25
|
-
FILTER(
|
|
26
|
-
isLiteral(?accessPolicy) &&
|
|
27
|
-
LCASE(REPLACE(STR(?accessPolicy), "^\\\\s+|\\\\s+$", "")) = "public"
|
|
28
|
-
)
|
|
29
|
-
FILTER NOT EXISTS {
|
|
30
|
-
?contextGraph <${DKG_ONTOLOGY.DKG_CREATOR}> ?conflictingCreator .
|
|
31
|
-
FILTER(?conflictingCreator != <${creatorDid}>)
|
|
32
|
-
}
|
|
33
|
-
FILTER NOT EXISTS {
|
|
34
|
-
?contextGraph <${DKG_ONTOLOGY.DKG_ACCESS_POLICY}> ?conflictingAccessPolicy .
|
|
35
|
-
FILTER(
|
|
36
|
-
!isLiteral(?conflictingAccessPolicy) ||
|
|
37
|
-
LCASE(REPLACE(STR(?conflictingAccessPolicy), "^\\\\s+|\\\\s+$", "")) != "public"
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
19
|
+
const candidatesResult = await store.query(`
|
|
20
|
+
SELECT DISTINCT ?contextGraph WHERE {
|
|
21
|
+
GRAPH <${ontologyGraph}> {
|
|
22
|
+
?contextGraph <${DKG_ONTOLOGY.RDF_TYPE}> <${DKG_ONTOLOGY.DKG_CONTEXT_GRAPH}> ;
|
|
23
|
+
<${DKG_ONTOLOGY.DKG_CREATOR}> <${creatorDid}> ;
|
|
24
|
+
<${DKG_ONTOLOGY.DKG_ACCESS_POLICY}> ?accessPolicy .
|
|
25
|
+
FILTER(
|
|
26
|
+
isLiteral(?accessPolicy) &&
|
|
27
|
+
LCASE(REPLACE(STR(?accessPolicy), "^\\\\s+|\\\\s+$", "")) = "public"
|
|
28
|
+
)
|
|
29
|
+
FILTER NOT EXISTS {
|
|
30
|
+
?contextGraph <${DKG_ONTOLOGY.DKG_CREATOR}> ?conflictingCreator .
|
|
31
|
+
FILTER(?conflictingCreator != <${creatorDid}>)
|
|
32
|
+
}
|
|
33
|
+
FILTER NOT EXISTS {
|
|
34
|
+
?contextGraph <${DKG_ONTOLOGY.DKG_ACCESS_POLICY}> ?conflictingAccessPolicy .
|
|
35
|
+
FILTER(
|
|
36
|
+
!isLiteral(?conflictingAccessPolicy) ||
|
|
37
|
+
LCASE(REPLACE(STR(?conflictingAccessPolicy), "^\\\\s+|\\\\s+$", "")) != "public"
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
42
|
`);
|
|
43
43
|
const candidateSubjects = candidatesResult.type === 'bindings'
|
|
44
44
|
? [...new Set(candidatesResult.bindings
|
|
@@ -55,16 +55,16 @@ export async function repairCreatorPublicMetaProjections(store, peerId) {
|
|
|
55
55
|
if (!contextGraphId || contextGraphDataGraphUri(contextGraphId) !== subject)
|
|
56
56
|
continue;
|
|
57
57
|
const metaGraph = assertSafeIri(contextGraphMetaGraphUri(contextGraphId));
|
|
58
|
-
const existingResult = await store.query(`
|
|
59
|
-
SELECT ?predicate ?object WHERE {
|
|
60
|
-
GRAPH <${metaGraph}> {
|
|
61
|
-
<${assertSafeIri(subject)}> ?predicate ?object .
|
|
62
|
-
FILTER(?predicate IN (
|
|
63
|
-
<${DKG_ONTOLOGY.RDF_TYPE}>,
|
|
64
|
-
<${DKG_ONTOLOGY.DKG_ACCESS_POLICY}>
|
|
65
|
-
))
|
|
66
|
-
}
|
|
67
|
-
}
|
|
58
|
+
const existingResult = await store.query(`
|
|
59
|
+
SELECT ?predicate ?object WHERE {
|
|
60
|
+
GRAPH <${metaGraph}> {
|
|
61
|
+
<${assertSafeIri(subject)}> ?predicate ?object .
|
|
62
|
+
FILTER(?predicate IN (
|
|
63
|
+
<${DKG_ONTOLOGY.RDF_TYPE}>,
|
|
64
|
+
<${DKG_ONTOLOGY.DKG_ACCESS_POLICY}>
|
|
65
|
+
))
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
68
|
`);
|
|
69
69
|
const existing = existingResult.type === 'bindings'
|
|
70
70
|
? existingResult.bindings
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ContextGraphSub, ContextGraphSubInput, ContextGraphSubscriptionRecord, ContextGraphSyncMode } from './dkg-agent-types.js';
|
|
2
|
+
export declare function normalizeContextGraphSubscriptionTransition(previous: ContextGraphSub | undefined, next: ContextGraphSubInput): ContextGraphSub;
|
|
3
|
+
export declare function resolveContextGraphSyncMode(input: {
|
|
4
|
+
existing?: Pick<ContextGraphSub, 'subscribed' | 'syncMode'>;
|
|
5
|
+
requested?: ContextGraphSyncMode;
|
|
6
|
+
hasDormantDurableIntent: boolean;
|
|
7
|
+
}): ContextGraphSyncMode;
|
|
8
|
+
export type ContextGraphSubscriptionPersistenceProjection = {
|
|
9
|
+
action: 'skip';
|
|
10
|
+
persistMemberIntent: false;
|
|
11
|
+
} | {
|
|
12
|
+
action: 'delete';
|
|
13
|
+
persistMemberIntent: true;
|
|
14
|
+
} | {
|
|
15
|
+
action: 'save';
|
|
16
|
+
persistMemberIntent: boolean;
|
|
17
|
+
record: ContextGraphSubscriptionRecord;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Canonical durable projection for live Context Graph subscription state.
|
|
21
|
+
*
|
|
22
|
+
* On-demand member intent remains process-local. A Core hosting obligation is
|
|
23
|
+
* independently durable and therefore projects to a host-only row. Always-on
|
|
24
|
+
* member intent projects the complete live readiness state.
|
|
25
|
+
*/
|
|
26
|
+
export declare function projectContextGraphSubscriptionPersistence(input: {
|
|
27
|
+
contextGraphId: string;
|
|
28
|
+
subscription: ContextGraphSub | undefined;
|
|
29
|
+
syncScoped: boolean;
|
|
30
|
+
}): ContextGraphSubscriptionPersistenceProjection;
|
|
31
|
+
//# sourceMappingURL=context-graph-subscription-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-graph-subscription-policy.d.ts","sourceRoot":"","sources":["../src/context-graph-subscription-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,8BAA8B,EAC9B,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,2CAA2C,CACzD,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,IAAI,EAAE,oBAAoB,GACzB,eAAe,CAKjB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,UAAU,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,uBAAuB,EAAE,OAAO,CAAC;CAClC,GAAG,oBAAoB,CAQvB;AAED,MAAM,MAAM,6CAA6C,GACrD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,KAAK,CAAA;CAAE,GAC9C;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,mBAAmB,EAAE,IAAI,CAAA;CAAE,GAC/C;IACA,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,8BAA8B,CAAC;CACxC,CAAC;AAEJ;;;;;;GAMG;AACH,wBAAgB,0CAA0C,CAAC,KAAK,EAAE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,6CAA6C,CA2BhD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function normalizeContextGraphSubscriptionTransition(previous, next) {
|
|
2
|
+
return {
|
|
3
|
+
...next,
|
|
4
|
+
syncMode: next.syncMode ?? previous?.syncMode ?? 'always-on',
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function resolveContextGraphSyncMode(input) {
|
|
8
|
+
if (input.hasDormantDurableIntent
|
|
9
|
+
|| (input.existing?.subscribed === true && input.existing.syncMode === 'always-on')) {
|
|
10
|
+
return 'always-on';
|
|
11
|
+
}
|
|
12
|
+
return input.requested ?? input.existing?.syncMode ?? 'always-on';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Canonical durable projection for live Context Graph subscription state.
|
|
16
|
+
*
|
|
17
|
+
* On-demand member intent remains process-local. A Core hosting obligation is
|
|
18
|
+
* independently durable and therefore projects to a host-only row. Always-on
|
|
19
|
+
* member intent projects the complete live readiness state.
|
|
20
|
+
*/
|
|
21
|
+
export function projectContextGraphSubscriptionPersistence(input) {
|
|
22
|
+
const sub = input.subscription;
|
|
23
|
+
if (sub?.syncMode === 'on-demand' && sub.coreHosted !== true) {
|
|
24
|
+
return { action: 'skip', persistMemberIntent: false };
|
|
25
|
+
}
|
|
26
|
+
if (!sub?.subscribed && !sub?.coreHosted) {
|
|
27
|
+
return { action: 'delete', persistMemberIntent: true };
|
|
28
|
+
}
|
|
29
|
+
const persistMemberIntent = sub.syncMode !== 'on-demand';
|
|
30
|
+
return {
|
|
31
|
+
action: 'save',
|
|
32
|
+
persistMemberIntent,
|
|
33
|
+
record: {
|
|
34
|
+
id: input.contextGraphId,
|
|
35
|
+
name: sub.name,
|
|
36
|
+
subscribed: persistMemberIntent && sub.subscribed,
|
|
37
|
+
synced: persistMemberIntent && sub.synced,
|
|
38
|
+
sharedMemorySynced: persistMemberIntent ? sub.sharedMemorySynced : false,
|
|
39
|
+
metaSynced: persistMemberIntent ? sub.metaSynced : false,
|
|
40
|
+
onChainId: sub.onChainId,
|
|
41
|
+
onChainHash: sub.onChainHash,
|
|
42
|
+
lastReconciledOrdinal: sub.lastReconciledOrdinal,
|
|
43
|
+
coreHosted: sub.coreHosted,
|
|
44
|
+
syncScoped: persistMemberIntent && input.syncScoped,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=context-graph-subscription-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-graph-subscription-policy.js","sourceRoot":"","sources":["../src/context-graph-subscription-policy.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,2CAA2C,CACzD,QAAqC,EACrC,IAA0B;IAE1B,OAAO;QACL,GAAG,IAAI;QACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,QAAQ,IAAI,WAAW;KAC7D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAI3C;IACC,IACE,KAAK,CAAC,uBAAuB;WAC1B,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,KAAK,WAAW,CAAC,EACnF,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,QAAQ,EAAE,QAAQ,IAAI,WAAW,CAAC;AACpE,CAAC;AAWD;;;;;;GAMG;AACH,MAAM,UAAU,0CAA0C,CAAC,KAI1D;IACC,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC;IAC/B,IAAI,GAAG,EAAE,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;QACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IACzD,CAAC;IAED,MAAM,mBAAmB,GAAG,GAAG,CAAC,QAAQ,KAAK,WAAW,CAAC;IACzD,OAAO;QACL,MAAM,EAAE,MAAM;QACd,mBAAmB;QACnB,MAAM,EAAE;YACN,EAAE,EAAE,KAAK,CAAC,cAAc;YACxB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,UAAU,EAAE,mBAAmB,IAAI,GAAG,CAAC,UAAU;YACjD,MAAM,EAAE,mBAAmB,IAAI,GAAG,CAAC,MAAM;YACzC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK;YACxE,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK;YACxD,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,qBAAqB,EAAE,GAAG,CAAC,qBAAqB;YAChD,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,UAAU,EAAE,mBAAmB,IAAI,KAAK,CAAC,UAAU;SACpD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -233,29 +233,29 @@ function replaceCuratorMetaProjectionSparql(contextGraphId, metaGraph, stagingGr
|
|
|
233
233
|
const delegationPrefix = `did:dkg:agent-delegation:${contextGraphId}:`;
|
|
234
234
|
assertSafeIri(metaGraph);
|
|
235
235
|
assertSafeIri(stagingGraph);
|
|
236
|
-
return `DELETE {
|
|
237
|
-
GRAPH <${metaGraph}> { ?staleSubject ?stalePredicate ?staleObject . }
|
|
238
|
-
}
|
|
239
|
-
INSERT {
|
|
240
|
-
GRAPH <${metaGraph}> { ?freshSubject ?freshPredicate ?freshObject . }
|
|
241
|
-
}
|
|
242
|
-
WHERE {
|
|
243
|
-
{
|
|
244
|
-
GRAPH <${metaGraph}> {
|
|
245
|
-
?staleSubject ?stalePredicate ?staleObject .
|
|
246
|
-
FILTER (
|
|
247
|
-
(
|
|
248
|
-
?staleSubject = <${contextGraphUri}> &&
|
|
249
|
-
?stalePredicate != <${DKG_ONTOLOGY.DKG_REVOKED_AGENT}>
|
|
250
|
-
) ||
|
|
251
|
-
STRSTARTS(STR(?staleSubject), ${JSON.stringify(delegationPrefix)})
|
|
252
|
-
)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
UNION
|
|
256
|
-
{
|
|
257
|
-
GRAPH <${stagingGraph}> { ?freshSubject ?freshPredicate ?freshObject . }
|
|
258
|
-
}
|
|
236
|
+
return `DELETE {
|
|
237
|
+
GRAPH <${metaGraph}> { ?staleSubject ?stalePredicate ?staleObject . }
|
|
238
|
+
}
|
|
239
|
+
INSERT {
|
|
240
|
+
GRAPH <${metaGraph}> { ?freshSubject ?freshPredicate ?freshObject . }
|
|
241
|
+
}
|
|
242
|
+
WHERE {
|
|
243
|
+
{
|
|
244
|
+
GRAPH <${metaGraph}> {
|
|
245
|
+
?staleSubject ?stalePredicate ?staleObject .
|
|
246
|
+
FILTER (
|
|
247
|
+
(
|
|
248
|
+
?staleSubject = <${contextGraphUri}> &&
|
|
249
|
+
?stalePredicate != <${DKG_ONTOLOGY.DKG_REVOKED_AGENT}>
|
|
250
|
+
) ||
|
|
251
|
+
STRSTARTS(STR(?staleSubject), ${JSON.stringify(delegationPrefix)})
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
UNION
|
|
256
|
+
{
|
|
257
|
+
GRAPH <${stagingGraph}> { ?freshSubject ?freshPredicate ?freshObject . }
|
|
258
|
+
}
|
|
259
259
|
}`;
|
|
260
260
|
}
|
|
261
261
|
async function atomicallyReplaceCuratorMetaSnapshot(agent, contextGraphId, snapshot, ctx) {
|
package/dist/discovery.js
CHANGED
|
@@ -21,17 +21,17 @@ export class DiscoveryClient {
|
|
|
21
21
|
filter += `\n ?agent <${DKG}agentAddress> "${escapeSparqlLiteral(options.agentAddress)}" .`;
|
|
22
22
|
}
|
|
23
23
|
const limitClause = options.limit ? `LIMIT ${options.limit}` : '';
|
|
24
|
-
const sparql = `
|
|
25
|
-
SELECT ?agent ?name ?peerId ?framework ?nodeRole ?relayAddress ?agentAddress WHERE {
|
|
26
|
-
?agent a <${DKG}Agent> ;
|
|
27
|
-
<${SCHEMA}name> ?name ;
|
|
28
|
-
<${DKG}peerId> ?peerId .${filter}
|
|
29
|
-
OPTIONAL { ?agent <${SKILL}framework> ?framework }
|
|
30
|
-
OPTIONAL { ?agent <${DKG}nodeRole> ?nodeRole }
|
|
31
|
-
OPTIONAL { ?agent <${DKG}relayAddress> ?relayAddress }
|
|
32
|
-
OPTIONAL { ?agent <${DKG}agentAddress> ?agentAddress }
|
|
33
|
-
}
|
|
34
|
-
${limitClause}
|
|
24
|
+
const sparql = `
|
|
25
|
+
SELECT ?agent ?name ?peerId ?framework ?nodeRole ?relayAddress ?agentAddress WHERE {
|
|
26
|
+
?agent a <${DKG}Agent> ;
|
|
27
|
+
<${SCHEMA}name> ?name ;
|
|
28
|
+
<${DKG}peerId> ?peerId .${filter}
|
|
29
|
+
OPTIONAL { ?agent <${SKILL}framework> ?framework }
|
|
30
|
+
OPTIONAL { ?agent <${DKG}nodeRole> ?nodeRole }
|
|
31
|
+
OPTIONAL { ?agent <${DKG}relayAddress> ?relayAddress }
|
|
32
|
+
OPTIONAL { ?agent <${DKG}agentAddress> ?agentAddress }
|
|
33
|
+
}
|
|
34
|
+
${limitClause}
|
|
35
35
|
`;
|
|
36
36
|
const result = await this.engine.query(sparql, {
|
|
37
37
|
contextGraphId: AGENT_REGISTRY_CONTEXT_GRAPH,
|
|
@@ -55,7 +55,7 @@ export class DiscoveryClient {
|
|
|
55
55
|
async findAgentPeerIdsByAddress(agentAddress, options = {}) {
|
|
56
56
|
const isEvmAddress = /^0x[0-9a-fA-F]{40}$/.test(agentAddress);
|
|
57
57
|
const addressMatch = isEvmAddress
|
|
58
|
-
? `?agent <${DKG}agentAddress> ?storedAgentAddress .
|
|
58
|
+
? `?agent <${DKG}agentAddress> ?storedAgentAddress .
|
|
59
59
|
FILTER(LCASE(STR(?storedAgentAddress)) = "${escapeSparqlLiteral(agentAddress.toLowerCase())}")`
|
|
60
60
|
: `?agent <${DKG}agentAddress> "${escapeSparqlLiteral(agentAddress)}" .`;
|
|
61
61
|
const limit = options.limit === undefined
|
|
@@ -64,15 +64,15 @@ export class DiscoveryClient {
|
|
|
64
64
|
const afterFilter = options.afterPeerId
|
|
65
65
|
? `FILTER(STR(?peerId) > "${escapeSparqlLiteral(options.afterPeerId)}")`
|
|
66
66
|
: '';
|
|
67
|
-
const result = await this.engine.query(`
|
|
68
|
-
SELECT DISTINCT ?peerId WHERE {
|
|
69
|
-
?agent a <${DKG}Agent> ;
|
|
70
|
-
<${DKG}peerId> ?peerId .
|
|
71
|
-
${addressMatch}
|
|
72
|
-
${afterFilter}
|
|
73
|
-
}
|
|
74
|
-
ORDER BY ASC(STR(?peerId))
|
|
75
|
-
${limit === undefined ? '' : `LIMIT ${limit}`}
|
|
67
|
+
const result = await this.engine.query(`
|
|
68
|
+
SELECT DISTINCT ?peerId WHERE {
|
|
69
|
+
?agent a <${DKG}Agent> ;
|
|
70
|
+
<${DKG}peerId> ?peerId .
|
|
71
|
+
${addressMatch}
|
|
72
|
+
${afterFilter}
|
|
73
|
+
}
|
|
74
|
+
ORDER BY ASC(STR(?peerId))
|
|
75
|
+
${limit === undefined ? '' : `LIMIT ${limit}`}
|
|
76
76
|
`, {
|
|
77
77
|
contextGraphId: AGENT_REGISTRY_CONTEXT_GRAPH,
|
|
78
78
|
signal: options.signal,
|
|
@@ -86,7 +86,7 @@ export class DiscoveryClient {
|
|
|
86
86
|
let skillMatch = `?offering <${SKILL}skill> ?skillType .`;
|
|
87
87
|
if (options.skillType) {
|
|
88
88
|
const skillUri = assertSafeIri(`${SKILL}${options.skillType}`);
|
|
89
|
-
skillMatch = `?offering <${SKILL}skill> <${skillUri}> .
|
|
89
|
+
skillMatch = `?offering <${SKILL}skill> <${skillUri}> .
|
|
90
90
|
BIND(<${skillUri}> AS ?skillType)`;
|
|
91
91
|
}
|
|
92
92
|
if (options.maxPrice !== undefined) {
|
|
@@ -100,19 +100,19 @@ export class DiscoveryClient {
|
|
|
100
100
|
}
|
|
101
101
|
const limitClause = options.limit ? `LIMIT ${options.limit}` : '';
|
|
102
102
|
const filterBlock = filters.join('\n ');
|
|
103
|
-
const sparql = `
|
|
104
|
-
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
105
|
-
SELECT ?agent ?agentName ?offering ?skillType ?price ?successRate ?currency WHERE {
|
|
106
|
-
?agent a <${DKG}Agent> ;
|
|
107
|
-
<${SCHEMA}name> ?agentName ;
|
|
108
|
-
<${SKILL}offersSkill> ?offering .
|
|
109
|
-
${skillMatch}
|
|
110
|
-
OPTIONAL { ?offering <${SKILL}pricePerCall> ?price }
|
|
111
|
-
OPTIONAL { ?offering <${SKILL}successRate> ?successRate }
|
|
112
|
-
OPTIONAL { ?offering <${SKILL}currency> ?currency }
|
|
113
|
-
${filterBlock}
|
|
114
|
-
}
|
|
115
|
-
${limitClause}
|
|
103
|
+
const sparql = `
|
|
104
|
+
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
105
|
+
SELECT ?agent ?agentName ?offering ?skillType ?price ?successRate ?currency WHERE {
|
|
106
|
+
?agent a <${DKG}Agent> ;
|
|
107
|
+
<${SCHEMA}name> ?agentName ;
|
|
108
|
+
<${SKILL}offersSkill> ?offering .
|
|
109
|
+
${skillMatch}
|
|
110
|
+
OPTIONAL { ?offering <${SKILL}pricePerCall> ?price }
|
|
111
|
+
OPTIONAL { ?offering <${SKILL}successRate> ?successRate }
|
|
112
|
+
OPTIONAL { ?offering <${SKILL}currency> ?currency }
|
|
113
|
+
${filterBlock}
|
|
114
|
+
}
|
|
115
|
+
${limitClause}
|
|
116
116
|
`;
|
|
117
117
|
const result = await this.engine.query(sparql, { contextGraphId: AGENT_REGISTRY_CONTEXT_GRAPH });
|
|
118
118
|
return result.bindings.map((row) => ({
|
|
@@ -140,19 +140,19 @@ export class DiscoveryClient {
|
|
|
140
140
|
// contains a `>` / whitespace / control char would still break
|
|
141
141
|
// the second query's `<${agentUri}>` interpolation. Codex review
|
|
142
142
|
// of PR #700 round 3 caught the prior unguarded interpolation.
|
|
143
|
-
const scalar = `
|
|
144
|
-
SELECT ?agent ?name ?framework ?nodeRole ?relayAddress ?agentAddress ?lastSeen WHERE {
|
|
145
|
-
?agent a <${DKG}Agent> ;
|
|
146
|
-
<${SCHEMA}name> ?name ;
|
|
147
|
-
<${DKG}peerId> "${escapeSparqlLiteral(peerId)}" .
|
|
148
|
-
FILTER(isIRI(?agent))
|
|
149
|
-
OPTIONAL { ?agent <${SKILL}framework> ?framework }
|
|
150
|
-
OPTIONAL { ?agent <${DKG}nodeRole> ?nodeRole }
|
|
151
|
-
OPTIONAL { ?agent <${DKG}relayAddress> ?relayAddress }
|
|
152
|
-
OPTIONAL { ?agent <${DKG}agentAddress> ?agentAddress }
|
|
153
|
-
OPTIONAL { ?agent <${DKG}lastSeen> ?lastSeen }
|
|
154
|
-
}
|
|
155
|
-
LIMIT 1
|
|
143
|
+
const scalar = `
|
|
144
|
+
SELECT ?agent ?name ?framework ?nodeRole ?relayAddress ?agentAddress ?lastSeen WHERE {
|
|
145
|
+
?agent a <${DKG}Agent> ;
|
|
146
|
+
<${SCHEMA}name> ?name ;
|
|
147
|
+
<${DKG}peerId> "${escapeSparqlLiteral(peerId)}" .
|
|
148
|
+
FILTER(isIRI(?agent))
|
|
149
|
+
OPTIONAL { ?agent <${SKILL}framework> ?framework }
|
|
150
|
+
OPTIONAL { ?agent <${DKG}nodeRole> ?nodeRole }
|
|
151
|
+
OPTIONAL { ?agent <${DKG}relayAddress> ?relayAddress }
|
|
152
|
+
OPTIONAL { ?agent <${DKG}agentAddress> ?agentAddress }
|
|
153
|
+
OPTIONAL { ?agent <${DKG}lastSeen> ?lastSeen }
|
|
154
|
+
}
|
|
155
|
+
LIMIT 1
|
|
156
156
|
`;
|
|
157
157
|
const scalarResult = await this.engine.query(scalar, {
|
|
158
158
|
contextGraphId: AGENT_REGISTRY_CONTEXT_GRAPH,
|
|
@@ -179,10 +179,10 @@ export class DiscoveryClient {
|
|
|
179
179
|
catch {
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
|
-
const multiSparql = `
|
|
183
|
-
SELECT ?multiaddr WHERE {
|
|
184
|
-
${sparqlIri(safeAgentIri)} <${DKG}multiaddr> ?multiaddr .
|
|
185
|
-
}
|
|
182
|
+
const multiSparql = `
|
|
183
|
+
SELECT ?multiaddr WHERE {
|
|
184
|
+
${sparqlIri(safeAgentIri)} <${DKG}multiaddr> ?multiaddr .
|
|
185
|
+
}
|
|
186
186
|
`;
|
|
187
187
|
const multiResult = await this.engine.query(multiSparql, {
|
|
188
188
|
contextGraphId: AGENT_REGISTRY_CONTEXT_GRAPH,
|