From 3e0028fce194a2aed2afb13cf53122decd7d8216 Mon Sep 17 00:00:00 2001 From: maartenvandenbrande Date: Wed, 15 Jan 2025 12:53:19 +0100 Subject: [PATCH] chore: rename to source-watch and determine-changes --- .../config/config-default.json | 8 +-- .../config/context-preprocess/actors.json | 2 +- .../{guard => determine-changes}/actors.json | 8 +-- .../mediators.json | 6 +- .../actors.json | 2 +- .../config/rdf-metadata-extract/actors.json | 6 +- .../actors.json | 20 +++--- .../mediators.json | 6 +- engines/query-sparql-incremental/package.json | 10 +-- .../test-browser/QuerySparql-test.ts | 18 ++--- .../test/QuerySparql-test.ts | 26 +++---- .../actor-determine-changes-naive/README.md | 30 ++++++++ .../lib/ActorDetermineChangesNaive.ts} | 58 ++++++++------- .../lib/index.ts | 1 + .../package.json | 12 ++-- .../test/ActorDetermineChangesNaive-test.ts} | 72 +++++++++---------- packages/actor-guard-naive/README.md | 30 -------- packages/actor-guard-naive/lib/index.ts | 1 - .../README.md | 2 +- .../ActorQuerySourceIdentifyHypermediaNone.ts | 16 ++--- .../package.json | 2 +- ...rQuerySourceIdentifyHypermediaNone-test.ts | 34 ++++----- .../lib/StreamingQuerySourceRdfJs.ts | 8 +-- .../README.md | 30 ++++++++ ...RdfMetadataExtractDetermineChangesData.ts} | 4 +- .../lib/index.ts | 1 + .../package.json | 8 +-- ...tadataExtractDetermineChangesData-test.ts} | 10 +-- .../README.md | 30 -------- .../lib/index.ts | 1 - .../actor-resource-watch-deferred/README.md | 30 -------- .../lib/index.ts | 1 - .../actor-resource-watch-polling/README.md | 30 -------- .../actor-resource-watch-polling/lib/index.ts | 1 - .../README.md | 30 -------- .../lib/index.ts | 1 - .../actor-source-watch-deferred/README.md | 30 ++++++++ .../lib/ActorSourceWatchDeferred.ts} | 36 +++++----- .../actor-source-watch-deferred/lib/index.ts | 1 + .../package.json | 10 +-- .../test/ActorSourceWatchDeferred-test.ts} | 18 ++--- packages/actor-source-watch-polling/README.md | 30 ++++++++ .../lib/ActorSourceWatchPolling.ts} | 56 +++++++-------- .../actor-source-watch-polling/lib/index.ts | 1 + .../package.json | 10 +-- .../test/ActorSourceWatchPolling-test.ts} | 22 +++--- .../README.md | 30 ++++++++ ...SourceWatchSolidNotificationWebsockets.ts} | 30 ++++---- .../lib/index.ts | 1 + .../package.json | 10 +-- ...eWatchSolidNotificationWebsockets-test.ts} | 18 ++--- .../test/mocks/HTTPMock.ts | 0 .../package.json | 1 - packages/bus-determine-changes/README.md | 22 ++++++ .../lib/ActorDetermineChanges.ts | 63 ++++++++++++++++ packages/bus-determine-changes/lib/index.ts | 1 + .../package.json | 8 +-- packages/bus-guard/README.md | 22 ------ packages/bus-guard/lib/ActorGuard.ts | 58 --------------- packages/bus-guard/lib/index.ts | 1 - packages/bus-resource-watch/README.md | 22 ------ packages/bus-resource-watch/lib/index.ts | 1 - packages/bus-source-watch/README.md | 22 ++++++ .../lib/ActorSourceWatch.ts} | 42 +++++------ packages/bus-source-watch/lib/index.ts | 1 + .../package.json | 8 +-- packages/context-entries/lib/Keys.ts | 16 ++--- packages/context-entries/package.json | 2 +- ...ardEvents.ts => DetermineChangesEvents.ts} | 2 +- packages/incremental-types/lib/index.ts | 2 +- 70 files changed, 580 insertions(+), 572 deletions(-) rename engines/config-query-sparql-incremental/config/{guard => determine-changes}/actors.json (58%) rename engines/config-query-sparql-incremental/config/{guard => determine-changes}/mediators.json (62%) rename engines/config-query-sparql-incremental/config/{resource-watch => source-watch}/actors.json (53%) rename engines/config-query-sparql-incremental/config/{resource-watch => source-watch}/mediators.json (63%) create mode 100644 packages/actor-determine-changes-naive/README.md rename packages/{actor-guard-naive/lib/ActorGuardNaive.ts => actor-determine-changes-naive/lib/ActorDetermineChangesNaive.ts} (58%) create mode 100644 packages/actor-determine-changes-naive/lib/index.ts rename packages/{actor-guard-naive => actor-determine-changes-naive}/package.json (77%) rename packages/{actor-guard-naive/test/ActorGuardNaive-test.ts => actor-determine-changes-naive/test/ActorDetermineChangesNaive-test.ts} (76%) delete mode 100644 packages/actor-guard-naive/README.md delete mode 100644 packages/actor-guard-naive/lib/index.ts create mode 100644 packages/actor-rdf-metadata-extract-determine-changes-data/README.md rename packages/{actor-rdf-metadata-extract-guard-data/lib/ActorRdfMetadataExtractGuardData.ts => actor-rdf-metadata-extract-determine-changes-data/lib/ActorRdfMetadataExtractDetermineChangesData.ts} (87%) create mode 100644 packages/actor-rdf-metadata-extract-determine-changes-data/lib/index.ts rename packages/{actor-rdf-metadata-extract-guard-data => actor-rdf-metadata-extract-determine-changes-data}/package.json (78%) rename packages/{actor-rdf-metadata-extract-guard-data/test/ActorRdfMetadataExtractGuardData-test.ts => actor-rdf-metadata-extract-determine-changes-data/test/ActorRdfMetadataExtractDetermineChangesData-test.ts} (80%) delete mode 100644 packages/actor-rdf-metadata-extract-guard-data/README.md delete mode 100644 packages/actor-rdf-metadata-extract-guard-data/lib/index.ts delete mode 100644 packages/actor-resource-watch-deferred/README.md delete mode 100644 packages/actor-resource-watch-deferred/lib/index.ts delete mode 100644 packages/actor-resource-watch-polling/README.md delete mode 100644 packages/actor-resource-watch-polling/lib/index.ts delete mode 100644 packages/actor-resource-watch-solid-notification-websockets/README.md delete mode 100644 packages/actor-resource-watch-solid-notification-websockets/lib/index.ts create mode 100644 packages/actor-source-watch-deferred/README.md rename packages/{actor-resource-watch-deferred/lib/ActorResourceWatchDeferred.ts => actor-source-watch-deferred/lib/ActorSourceWatchDeferred.ts} (67%) create mode 100644 packages/actor-source-watch-deferred/lib/index.ts rename packages/{actor-resource-watch-deferred => actor-source-watch-deferred}/package.json (80%) rename packages/{actor-resource-watch-deferred/test/ActorResourceWatchDeferred-test.ts => actor-source-watch-deferred/test/ActorSourceWatchDeferred-test.ts} (90%) create mode 100644 packages/actor-source-watch-polling/README.md rename packages/{actor-resource-watch-polling/lib/ActorResourceWatchPolling.ts => actor-source-watch-polling/lib/ActorSourceWatchPolling.ts} (61%) create mode 100644 packages/actor-source-watch-polling/lib/index.ts rename packages/{actor-resource-watch-polling => actor-source-watch-polling}/package.json (80%) rename packages/{actor-resource-watch-polling/test/ActorResourceWatchPolling-test.ts => actor-source-watch-polling/test/ActorSourceWatchPolling-test.ts} (95%) create mode 100644 packages/actor-source-watch-solid-notification-websockets/README.md rename packages/{actor-resource-watch-solid-notification-websockets/lib/ActorResourceWatchSolidNotificationWebsockets.ts => actor-source-watch-solid-notification-websockets/lib/ActorSourceWatchSolidNotificationWebsockets.ts} (79%) create mode 100644 packages/actor-source-watch-solid-notification-websockets/lib/index.ts rename packages/{actor-resource-watch-solid-notification-websockets => actor-source-watch-solid-notification-websockets}/package.json (77%) rename packages/{actor-resource-watch-solid-notification-websockets/test/ActorResourceWatchSolidNotificationWebsockets-test.ts => actor-source-watch-solid-notification-websockets/test/ActorSourceWatchSolidNotificationWebsockets-test.ts} (95%) rename packages/{actor-resource-watch-solid-notification-websockets => actor-source-watch-solid-notification-websockets}/test/mocks/HTTPMock.ts (100%) create mode 100644 packages/bus-determine-changes/README.md create mode 100644 packages/bus-determine-changes/lib/ActorDetermineChanges.ts create mode 100644 packages/bus-determine-changes/lib/index.ts rename packages/{bus-guard => bus-determine-changes}/package.json (83%) delete mode 100644 packages/bus-guard/README.md delete mode 100644 packages/bus-guard/lib/ActorGuard.ts delete mode 100644 packages/bus-guard/lib/index.ts delete mode 100644 packages/bus-resource-watch/README.md delete mode 100644 packages/bus-resource-watch/lib/index.ts create mode 100644 packages/bus-source-watch/README.md rename packages/{bus-resource-watch/lib/ActorResourceWatch.ts => bus-source-watch/lib/ActorSourceWatch.ts} (50%) create mode 100644 packages/bus-source-watch/lib/index.ts rename packages/{bus-resource-watch => bus-source-watch}/package.json (82%) rename packages/incremental-types/lib/{GuardEvents.ts => DetermineChangesEvents.ts} (79%) diff --git a/engines/config-query-sparql-incremental/config/config-default.json b/engines/config-query-sparql-incremental/config/config-default.json index 67051e13..2fbea4e9 100644 --- a/engines/config-query-sparql-incremental/config/config-default.json +++ b/engines/config-query-sparql-incremental/config/config-default.json @@ -65,9 +65,9 @@ "ccqs:config/term-comparator-factory/actors.json", "ccqs:config/term-comparator-factory/mediators.json", - "icqsi:config/guard/mediators.json", - "icqsi:config/guard/actors.json", - "icqsi:config/resource-watch/mediators.json", - "icqsi:config/resource-watch/actors.json" + "icqsi:config/determine-changes/mediators.json", + "icqsi:config/determine-changes/actors.json", + "icqsi:config/source-watch/mediators.json", + "icqsi:config/source-watch/actors.json" ] } diff --git a/engines/config-query-sparql-incremental/config/context-preprocess/actors.json b/engines/config-query-sparql-incremental/config/context-preprocess/actors.json index 213e300f..43d5d03f 100644 --- a/engines/config-query-sparql-incremental/config/context-preprocess/actors.json +++ b/engines/config-query-sparql-incremental/config/context-preprocess/actors.json @@ -46,7 +46,7 @@ "invalidateCache": "@comunica/actor-init-query:invalidateCache", "dataFactory": "@comunica/actor-init-query:dataFactory", "distinctConstruct": "@comunica/actor-init-query:distinctConstruct", - "pollingFrequency": "@incremunica/resource-watch:pollingFrequency", + "pollingPeriod": "@incremunica/resource-watch:pollingPeriod", "deferredEvaluationEventEmitter": "@incremunica/resource-watch:deferredEvaluationEventEmitter" } }, diff --git a/engines/config-query-sparql-incremental/config/guard/actors.json b/engines/config-query-sparql-incremental/config/determine-changes/actors.json similarity index 58% rename from engines/config-query-sparql-incremental/config/guard/actors.json rename to engines/config-query-sparql-incremental/config/determine-changes/actors.json index 7a8a7dd1..bd7edf72 100644 --- a/engines/config-query-sparql-incremental/config/guard/actors.json +++ b/engines/config-query-sparql-incremental/config/determine-changes/actors.json @@ -2,15 +2,15 @@ "@context": [ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^4.0.0/components/context.jsonld", - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-guard-naive/^1.0.0/components/context.jsonld" + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-determine-changes-naive/^1.0.0/components/context.jsonld" ], "@id": "urn:comunica:default:Runner", "@type": "Runner", "actors": [ { - "@id": "urn:comunica:default:guard/actors#naive", - "@type": "ActorGuardNaive", - "mediatorResourceWatch": { "@id": "urn:comunica:default:resource-watch/mediators#main" }, + "@id": "urn:comunica:default:determine-changes/actors#naive", + "@type": "ActorDetermineChangesNaive", + "mediatorSourceWatch": { "@id": "urn:comunica:default:source-watch/mediators#main" }, "mediatorDereferenceRdf": { "@id": "urn:comunica:default:dereference-rdf/mediators#main" } } ] diff --git a/engines/config-query-sparql-incremental/config/guard/mediators.json b/engines/config-query-sparql-incremental/config/determine-changes/mediators.json similarity index 62% rename from engines/config-query-sparql-incremental/config/guard/mediators.json rename to engines/config-query-sparql-incremental/config/determine-changes/mediators.json index f17ce921..fafdd74a 100644 --- a/engines/config-query-sparql-incremental/config/guard/mediators.json +++ b/engines/config-query-sparql-incremental/config/determine-changes/mediators.json @@ -1,12 +1,12 @@ { "@context": [ - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-guard/^1.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-determine-changes/^1.0.0/components/context.jsonld", "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/^4.0.0/components/context.jsonld" ], - "@id": "urn:comunica:default:guard/mediators#main", + "@id": "urn:comunica:default:determine-changes/mediators#main", "@type": "MediatorNumber", "type": "max", "field": "filterFactor", "ignoreFailures": true, - "bus": { "@id": "ActorGuard:_default_bus" } + "bus": { "@id": "ActorDetermineChanges:_default_bus" } } diff --git a/engines/config-query-sparql-incremental/config/query-source-identify-hypermedia/actors.json b/engines/config-query-sparql-incremental/config/query-source-identify-hypermedia/actors.json index 2aaf075c..d461537d 100644 --- a/engines/config-query-sparql-incremental/config/query-source-identify-hypermedia/actors.json +++ b/engines/config-query-sparql-incremental/config/query-source-identify-hypermedia/actors.json @@ -10,7 +10,7 @@ { "@id": "urn:comunica:default:query-source-identify-hypermedia/actors#none", "@type": "ActorQuerySourceIdentifyHypermediaNone", - "mediatorGuard": { "@id": "urn:comunica:default:guard/mediators#main" }, + "mediatorDetermineChanges": { "@id": "urn:comunica:default:determine-changes/mediators#main" }, "mediatorMergeBindingsContext": { "@id": "urn:comunica:default:merge-bindings-context/mediators#main" } } ] diff --git a/engines/config-query-sparql-incremental/config/rdf-metadata-extract/actors.json b/engines/config-query-sparql-incremental/config/rdf-metadata-extract/actors.json index d001d9df..b87e6419 100644 --- a/engines/config-query-sparql-incremental/config/rdf-metadata-extract/actors.json +++ b/engines/config-query-sparql-incremental/config/rdf-metadata-extract/actors.json @@ -2,7 +2,7 @@ "@context": [ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^4.0.0/components/context.jsonld", - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-rdf-metadata-extract-guard-data/^1.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-rdf-metadata-extract-determine-changes-data/^1.0.0/components/context.jsonld", "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-metadata-extract-hydra-controls/^4.0.0/components/context.jsonld", "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-metadata-extract-hydra-count/^4.0.0/components/context.jsonld", "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-metadata-extract-hydra-pagesize/^4.0.0/components/context.jsonld", @@ -43,8 +43,8 @@ "@type": "ActorRdfMetadataExtractPatchSparqlUpdate" }, { - "@id": "urn:comunica:default:rdf-metadata-extract/actors#guard-data", - "@type": "ActorRdfMetadataExtractGuardData" + "@id": "urn:comunica:default:rdf-metadata-extract/actors#determine-changes-data", + "@type": "ActorRdfMetadataExtractDetermineChangesData" } ] } diff --git a/engines/config-query-sparql-incremental/config/resource-watch/actors.json b/engines/config-query-sparql-incremental/config/source-watch/actors.json similarity index 53% rename from engines/config-query-sparql-incremental/config/resource-watch/actors.json rename to engines/config-query-sparql-incremental/config/source-watch/actors.json index 4418e9f3..e7829b65 100644 --- a/engines/config-query-sparql-incremental/config/resource-watch/actors.json +++ b/engines/config-query-sparql-incremental/config/source-watch/actors.json @@ -2,29 +2,29 @@ "@context": [ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^4.0.0/components/context.jsonld", - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-polling/^1.0.0/components/context.jsonld", - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-deferred/^1.0.0/components/context.jsonld", - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-solid-notification-websockets/^1.0.0/components/context.jsonld" + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-polling/^1.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-deferred/^1.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-solid-notification-websockets/^1.0.0/components/context.jsonld" ], "@id": "urn:comunica:default:Runner", "@type": "Runner", "actors": [ { - "@id": "urn:comunica:default:resource-watch/actors#polling", - "@type": "ActorResourceWatchPolling", + "@id": "urn:comunica:default:source-watch/actors#polling", + "@type": "ActorSourceWatchPolling", "mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" }, - "defaultPollingFrequency": 10, + "defaultPollingPeriod": 10, "priority": 5 }, { - "@id": "urn:comunica:default:resource-watch/actors#solid-notification-websockets", - "@type": "ActorResourceWatchSolidNotificationWebsockets", + "@id": "urn:comunica:default:source-watch/actors#solid-notification-websockets", + "@type": "ActorSourceWatchSolidNotificationWebsockets", "mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" }, "priority": 10 }, { - "@id": "urn:comunica:default:resource-watch/actors#deferred", - "@type": "ActorResourceWatchDeferred", + "@id": "urn:comunica:default:source-watch/actors#deferred", + "@type": "ActorSourceWatchDeferred", "mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" }, "priority": 15 } diff --git a/engines/config-query-sparql-incremental/config/resource-watch/mediators.json b/engines/config-query-sparql-incremental/config/source-watch/mediators.json similarity index 63% rename from engines/config-query-sparql-incremental/config/resource-watch/mediators.json rename to engines/config-query-sparql-incremental/config/source-watch/mediators.json index 313029a8..f522e2ca 100644 --- a/engines/config-query-sparql-incremental/config/resource-watch/mediators.json +++ b/engines/config-query-sparql-incremental/config/source-watch/mediators.json @@ -1,12 +1,12 @@ { "@context": [ - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-resource-watch/^1.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-source-watch/^1.0.0/components/context.jsonld", "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/^4.0.0/components/context.jsonld" ], - "@id": "urn:comunica:default:resource-watch/mediators#main", + "@id": "urn:comunica:default:source-watch/mediators#main", "@type": "MediatorNumber", "type": "max", "field": "priority", "ignoreFailures": true, - "bus": { "@id": "ActorResourceWatch:_default_bus" } + "bus": { "@id": "ActorSourceWatch:_default_bus" } } diff --git a/engines/query-sparql-incremental/package.json b/engines/query-sparql-incremental/package.json index 1e0e8a48..b855bb68 100644 --- a/engines/query-sparql-incremental/package.json +++ b/engines/query-sparql-incremental/package.json @@ -267,7 +267,7 @@ "@incremunica/actor-bindings-aggregator-factory-sum": "^1.3.0", "@incremunica/actor-bindings-aggregator-factory-wildcard-count": "^1.3.0", "@incremunica/actor-context-preprocess-query-source-convert-streams": "^1.3.0", - "@incremunica/actor-guard-naive": "^1.3.0", + "@incremunica/actor-determine-changes-naive": "^1.3.0", "@incremunica/actor-merge-bindings-context-is-addition": "^1.3.0", "@incremunica/actor-query-operation-group": "^1.3.0", "@incremunica/actor-query-operation-incremental-distinct-hash": "^1.3.0", @@ -277,10 +277,10 @@ "@incremunica/actor-rdf-join-incremental-minus-hash": "^1.3.0", "@incremunica/actor-rdf-join-incremental-optional-hash": "^1.3.0", "@incremunica/actor-rdf-join-inner-incremental-full-hash": "^1.3.0", - "@incremunica/actor-rdf-metadata-extract-guard-data": "^1.3.0", - "@incremunica/actor-resource-watch-deferred": "^1.3.0", - "@incremunica/actor-resource-watch-polling": "^1.3.0", - "@incremunica/actor-resource-watch-solid-notification-websockets": "^1.3.0", + "@incremunica/actor-rdf-metadata-extract-determine-changes-data": "^1.3.0", + "@incremunica/actor-source-watch-deferred": "^1.3.0", + "@incremunica/actor-source-watch-polling": "^1.3.0", + "@incremunica/actor-source-watch-solid-notification-websockets": "^1.3.0", "@incremunica/config-query-sparql-incremental": "^1.3.0" }, "browser": { diff --git a/engines/query-sparql-incremental/test-browser/QuerySparql-test.ts b/engines/query-sparql-incremental/test-browser/QuerySparql-test.ts index 958f094a..00a12213 100644 --- a/engines/query-sparql-incremental/test-browser/QuerySparql-test.ts +++ b/engines/query-sparql-incremental/test-browser/QuerySparql-test.ts @@ -57,7 +57,7 @@ describe('System test: QuerySparql (without polly)', () => { ?s ?p ?o. }`, { sources: [ streamingStore ], - pollingFrequency: 500, + pollingPeriod: 500, }); expect(await partialArrayifyStream(bindingStream, 2)).toBeIsomorphicBindingsArray([ @@ -105,7 +105,7 @@ describe('System test: QuerySparql (without polly)', () => { ?o1 ?p2 ?o2. }`, { sources: [ streamingStore ], - pollingFrequency: 500, + pollingPeriod: 500, }); expect(await partialArrayifyStream(bindingStream, 1)).toBeIsomorphicBindingsArray([ @@ -167,7 +167,7 @@ describe('System test: QuerySparql (with polly)', () => { ?s ?p ?o. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 500, + pollingPeriod: 500, }); expect(await partialArrayifyStream(bindingStream, 100)).toHaveLength(100); @@ -179,7 +179,7 @@ describe('System test: QuerySparql (with polly)', () => { }`; const context: QueryStringContext = { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 500, + pollingPeriod: 500, }; bindingStream = await engine.queryBindings(query, context); @@ -207,7 +207,7 @@ describe('System test: QuerySparql (with polly)', () => { }`; const context: QueryStringContext = { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 500, + pollingPeriod: 500, }; bindingStream = await engine.queryBindings(query, context); @@ -225,7 +225,7 @@ describe('System test: QuerySparql (with polly)', () => { ?s ?p ?s. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 500, + pollingPeriod: 500, }); expect(await partialArrayifyStream(bindingStream, 1)).toHaveLength(1); @@ -239,7 +239,7 @@ describe('System test: QuerySparql (with polly)', () => { ?v0 ?name. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 500, + pollingPeriod: 500, }); expect(await partialArrayifyStream(bindingStream, 20)).toHaveLength(20); @@ -251,7 +251,7 @@ describe('System test: QuerySparql (with polly)', () => { ?v0 ?name. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); expect(await partialArrayifyStream(bindingStream, 20)).toHaveLength(20); @@ -266,7 +266,7 @@ describe('System test: QuerySparql (with polly)', () => { 'https://raw.githubusercontent.com/w3c/data-shapes/gh-pages/shacl-compact-syntax/' + 'tests/valid/basic-shape-iri.shaclc', ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); expect(await partialArrayifyStream(bindingStream, 1)).toHaveLength(1); diff --git a/engines/query-sparql-incremental/test/QuerySparql-test.ts b/engines/query-sparql-incremental/test/QuerySparql-test.ts index 0d957b1d..e4343584 100644 --- a/engines/query-sparql-incremental/test/QuerySparql-test.ts +++ b/engines/query-sparql-incremental/test/QuerySparql-test.ts @@ -321,7 +321,7 @@ describe('System test: QuerySparql (without polly)', () => { ?s ?p ?o. }`, { sources: [ 'http://localhost:8787' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect(new Promise(resolve => bindingStream.once('data', (bindings) => { @@ -344,7 +344,7 @@ describe('System test: QuerySparql (without polly)', () => { sources: [ 'http://localhost:8787', ], - pollingFrequency: 100, + pollingPeriod: 100, deferredEvaluationEventEmitter: deferredEventEmitter, }); @@ -396,7 +396,7 @@ describe('System test: QuerySparql (without polly)', () => { }`, { // @ts-expect-error sources: [ sourcesStream ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect(new Promise(resolve => bindingStream.once('data', (bindings) => { @@ -467,7 +467,7 @@ describe('System test: QuerySparql (without polly)', () => { ?s ?p ?o. }`, { sources: [ 'http://localhost:8787' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect(new Promise(resolve => bindingStream.once('data', (bindings) => { @@ -498,7 +498,7 @@ describe('System test: QuerySparql (without polly)', () => { OPTIONAL { ?s2 ?o2 . } }`, { sources: [ 'http://localhost:8787' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect(new Promise(resolve => bindingStream.once('data', (bindings) => { @@ -550,7 +550,7 @@ describe('System test: QuerySparql (with polly)', () => { ?s ?p ?o. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 100))).resolves.toHaveLength(100); @@ -567,7 +567,7 @@ describe('System test: QuerySparql (with polly)', () => { isAddition: true, }, ]) ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 100))).resolves.toHaveLength(100); @@ -578,7 +578,7 @@ describe('System test: QuerySparql (with polly)', () => { ?s ?p ?o. }`; const context: QueryStringContext = { - pollingFrequency: 1000, + pollingPeriod: 1000, sources: [ 'https://www.rubensworks.net/' ], }; @@ -595,7 +595,7 @@ describe('System test: QuerySparql (with polly)', () => { }`; const context: QueryStringContext = { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }; bindingStream = await engine.queryBindings(query, context); @@ -615,7 +615,7 @@ describe('System test: QuerySparql (with polly)', () => { ?s ?p ?s. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 1))).resolves.toHaveLength(1); @@ -629,7 +629,7 @@ describe('System test: QuerySparql (with polly)', () => { ?v0 ?name. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 20))).resolves.toHaveLength(20); @@ -641,7 +641,7 @@ describe('System test: QuerySparql (with polly)', () => { ?v0 ?name. }`, { sources: [ 'https://www.rubensworks.net/' ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 20))).resolves.toHaveLength(20); @@ -656,7 +656,7 @@ describe('System test: QuerySparql (with polly)', () => { 'https://raw.githubusercontent.com/w3c/data-shapes/gh-pages/shacl-compact-syntax/' + 'tests/valid/basic-shape-iri.shaclc', ], - pollingFrequency: 1000, + pollingPeriod: 1000, }); await expect((partialArrayifyStream(bindingStream, 1))).resolves.toHaveLength(1); diff --git a/packages/actor-determine-changes-naive/README.md b/packages/actor-determine-changes-naive/README.md new file mode 100644 index 00000000..154b145a --- /dev/null +++ b/packages/actor-determine-changes-naive/README.md @@ -0,0 +1,30 @@ +# Incremunica Naive Determine Changes Actor + +[![npm version](https://badge.fury.io/js/@incremunica%2Factor-determine-changes-naive.svg)](https://badge.fury.io/js/@incremunica%2Factor-determine-changes-naive) + +An incremunica Naive Determine Changes Actor. + +## Install + +```bash +$ yarn add @incremunica/actor-determine-changes-naive +``` + +## Configure + +After installing, this package can be added to your engine's configuration as follows: +```text +{ + "@context": [ + ... + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-determine-changes-naive/^1.0.0/components/context.jsonld" + ], + "actors": [ + ... + { + "@id": "urn:comunica:default:determine-changes/actors#naive", + "@type": "ActorDetermineChangesNaive" + } + ] +} +``` diff --git a/packages/actor-guard-naive/lib/ActorGuardNaive.ts b/packages/actor-determine-changes-naive/lib/ActorDetermineChangesNaive.ts similarity index 58% rename from packages/actor-guard-naive/lib/ActorGuardNaive.ts rename to packages/actor-determine-changes-naive/lib/ActorDetermineChangesNaive.ts index 9b7a441a..ea8cdc08 100644 --- a/packages/actor-guard-naive/lib/ActorGuardNaive.ts +++ b/packages/actor-determine-changes-naive/lib/ActorDetermineChangesNaive.ts @@ -3,24 +3,28 @@ import type { MediatorDereferenceRdf } from '@comunica/bus-dereference-rdf'; import type { IActorTest, TestResult } from '@comunica/core'; import { failTest, passTestVoid } from '@comunica/core'; import { StreamingQuerySourceRdfJs } from '@incremunica/actor-query-source-identify-streaming-rdfjs'; -import type { IActionGuard, IActorGuardOutput, IActorGuardArgs } from '@incremunica/bus-guard'; -import { ActorGuard } from '@incremunica/bus-guard'; -import type { MediatorResourceWatch } from '@incremunica/bus-resource-watch'; -import type { IGuardEvents, Quad } from '@incremunica/incremental-types'; +import type { + IActionDetermineChanges, + IActorDetermineChangesOutput, + IActorDetermineChangesArgs, +} from '@incremunica/bus-determine-changes'; +import { ActorDetermineChanges } from '@incremunica/bus-determine-changes'; +import type { MediatorSourceWatch } from '@incremunica/bus-source-watch'; +import type { IDetermineChangesEvents, Quad } from '@incremunica/incremental-types'; import { StreamingQuerySourceStatus } from '@incremunica/streaming-query-source'; /** - * A comunica Naive Guard Actor. + * A comunica Naive Determine Changes Actor. */ -export class ActorGuardNaive extends ActorGuard { - public readonly mediatorResourceWatch: MediatorResourceWatch; +export class ActorDetermineChangesNaive extends ActorDetermineChanges { + public readonly mediatorSourceWatch: MediatorSourceWatch; public readonly mediatorDereferenceRdf: MediatorDereferenceRdf; - public constructor(args: IActorGuardNaiveArgs) { + public constructor(args: IActorDetermineChangesNaiveArgs) { super(args); } - public async test(action: IActionGuard): Promise> { + public async test(action: IActionDetermineChanges): Promise> { if ( action.streamingQuerySource === undefined || !(action.streamingQuerySource instanceof StreamingQuerySourceRdfJs) @@ -30,8 +34,8 @@ export class ActorGuardNaive extends ActorGuard { return passTestVoid(); } - public async run(action: IActionGuard): Promise { - const resourceWatch = await this.mediatorResourceWatch.mediate({ + public async run(action: IActionDetermineChanges): Promise { + const sourceWatch = await this.mediatorSourceWatch.mediate({ context: action.context, url: action.url, metadata: action.metadata, @@ -39,21 +43,21 @@ export class ActorGuardNaive extends ActorGuard { const store = (action.streamingQuerySource).store; if (action.streamingQuerySource.status === StreamingQuerySourceStatus.Running) { - resourceWatch.start(); + sourceWatch.start(); } action.streamingQuerySource.statusEvents.on('status', (status: StreamingQuerySourceStatus) => { if (status === StreamingQuerySourceStatus.Running) { - resourceWatch.start(); + sourceWatch.start(); } else { - resourceWatch.stop(); + sourceWatch.stop(); } }); - const guardEvents: IGuardEvents = new EventEmitter(); - guardEvents.emit('up-to-date'); + const determineChangesEvents: IDetermineChangesEvents = new EventEmitter(); + determineChangesEvents.emit('up-to-date'); - resourceWatch.events.on('update', () => { - guardEvents.emit('modified'); + sourceWatch.events.on('update', () => { + determineChangesEvents.emit('modified'); const deletionStore = store.copyOfStore(); const additionArray: Quad[] = []; this.mediatorDereferenceRdf.mediate({ @@ -75,33 +79,33 @@ export class ActorGuardNaive extends ActorGuard { for (const quad of additionArray) { store.addQuad(quad); } - guardEvents.emit('up-to-date'); + determineChangesEvents.emit('up-to-date'); }); }).catch(() => { for (const quad of deletionStore) { store.removeQuad(quad); } - guardEvents.emit('up-to-date'); + determineChangesEvents.emit('up-to-date'); }); }); - resourceWatch.events.on('delete', () => { - guardEvents.emit('modified'); + sourceWatch.events.on('delete', () => { + determineChangesEvents.emit('modified'); for (const quad of store.getStore()) { store.removeQuad(quad); } - guardEvents.emit('up-to-date'); + determineChangesEvents.emit('up-to-date'); }); - return { guardEvents }; + return { determineChangesEvents }; } } -export interface IActorGuardNaiveArgs extends IActorGuardArgs { +export interface IActorDetermineChangesNaiveArgs extends IActorDetermineChangesArgs { /** - * The Resource Watch mediator + * The Source Watch mediator */ - mediatorResourceWatch: MediatorResourceWatch; + mediatorSourceWatch: MediatorSourceWatch; /** * The Dereference mediator */ diff --git a/packages/actor-determine-changes-naive/lib/index.ts b/packages/actor-determine-changes-naive/lib/index.ts new file mode 100644 index 00000000..8b73ae93 --- /dev/null +++ b/packages/actor-determine-changes-naive/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorDetermineChangesNaive'; diff --git a/packages/actor-guard-naive/package.json b/packages/actor-determine-changes-naive/package.json similarity index 77% rename from packages/actor-guard-naive/package.json rename to packages/actor-determine-changes-naive/package.json index 9be883bc..ae857ea4 100644 --- a/packages/actor-guard-naive/package.json +++ b/packages/actor-determine-changes-naive/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/actor-guard-naive", + "name": "@incremunica/actor-determine-changes-naive", "version": "1.3.0", - "description": "A naive guard actor", + "description": "A naive determine-changes actor", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/actor-guard-naive" + "directory": "packages/actor-determine-changes-naive" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "comunica", "actor", - "guard", + "determine-changes", "naive" ], "sideEffects": false, @@ -40,8 +40,8 @@ "@comunica/bus-dereference-rdf": "^4.0.1", "@comunica/core": "^4.0.1", "@incremunica/actor-query-source-identify-streaming-rdfjs": "^1.3.0", - "@incremunica/bus-guard": "^1.3.0", - "@incremunica/bus-resource-watch": "^1.3.0", + "@incremunica/bus-determine-changes": "^1.3.0", + "@incremunica/bus-source-watch": "^1.3.0", "@incremunica/streaming-query-source": "^1.3.0" } } diff --git a/packages/actor-guard-naive/test/ActorGuardNaive-test.ts b/packages/actor-determine-changes-naive/test/ActorDetermineChangesNaive-test.ts similarity index 76% rename from packages/actor-guard-naive/test/ActorGuardNaive-test.ts rename to packages/actor-determine-changes-naive/test/ActorDetermineChangesNaive-test.ts index 12ab7541..6621afd8 100644 --- a/packages/actor-guard-naive/test/ActorGuardNaive-test.ts +++ b/packages/actor-determine-changes-naive/test/ActorDetermineChangesNaive-test.ts @@ -1,16 +1,16 @@ import EventEmitter = require('events'); import type { IActionDereferenceRdf, MediatorDereferenceRdf } from '@comunica/bus-dereference-rdf'; import { Bus } from '@comunica/core'; -import type { IActionGuard } from '@incremunica/bus-guard'; +import type { IActionDetermineChanges } from '@incremunica/bus-determine-changes'; import type { - IActionResourceWatch, - IActorResourceWatchOutput, - MediatorResourceWatch, -} from '@incremunica/bus-resource-watch'; + IActionSourceWatch, + IActorSourceWatchOutput, + MediatorSourceWatch, +} from '@incremunica/bus-source-watch'; import { Store, DataFactory } from 'n3'; import type { Transform } from 'readable-stream'; import 'jest-rdf'; -import { ActorGuardNaive } from '../lib'; +import { ActorDetermineChangesNaive } from '../lib'; const quad = require('rdf-quad'); const streamifyArray = require('streamify-array'); @@ -27,18 +27,18 @@ function captureEvents(item: EventEmitter, ...events: string[]) { return item; } -describe('ActorGuardNaive', () => { +describe('ActorDetermineChangesNaive', () => { let bus: any; beforeEach(() => { bus = new Bus({ name: 'bus' }); }); - describe('An ActorGuardNaive instance', () => { - let actor: ActorGuardNaive; - let mediatorResourceWatch: MediatorResourceWatch; + describe('An ActorDetermineChangesNaive instance', () => { + let actor: ActorDetermineChangesNaive; + let mediatorSourceWatch: MediatorSourceWatch; let mediatorDereferenceRdf: MediatorDereferenceRdf; - let action: IActionGuard; + let action: IActionDetermineChanges; let quadArrayStore: any[]; let quadArray: any[]; let streamingStoreEventEmitter: EventEmitter; @@ -73,8 +73,8 @@ describe('ActorGuardNaive', () => { }, }; - mediatorResourceWatch = { - mediate: async(action: IActionResourceWatch): Promise => { + mediatorSourceWatch = { + mediate: async(action: IActionSourceWatch): Promise => { return { events: changeNotificationEventEmitter, stop: stopFn, @@ -83,10 +83,10 @@ describe('ActorGuardNaive', () => { }, }; - actor = new ActorGuardNaive({ + actor = new ActorDetermineChangesNaive({ name: 'actor', bus, - mediatorResourceWatch, + mediatorSourceWatch, mediatorDereferenceRdf, }); @@ -125,7 +125,7 @@ describe('ActorGuardNaive', () => { await expect(actor.test(action)).resolves.toBeTruthy(); }); - it('should only start resource watcher if streamingQuerySource is running', async() => { + it('should only start source watcher if streamingQuerySource is running', async() => { await actor.run(action); expect(startFn).toHaveBeenCalledTimes(0); expect(stopFn).toHaveBeenCalledTimes(0); @@ -138,7 +138,7 @@ describe('ActorGuardNaive', () => { expect(stopFn).toHaveBeenCalledTimes(1); }); - it('should start resource watcher if streamingQuerySource is running early', async() => { + it('should start source watcher if streamingQuerySource is running early', async() => { setStatus(1); await actor.run(action); @@ -157,21 +157,21 @@ describe('ActorGuardNaive', () => { quad('s3', 'p3', 'o3'), ]; - actor = new ActorGuardNaive({ + actor = new ActorDetermineChangesNaive({ name: 'actor', bus, - mediatorResourceWatch, + mediatorSourceWatch, mediatorDereferenceRdf, }); - const { guardEvents } = await actor.run(action); + const { determineChangesEvents } = await actor.run(action); mediatorDereferenceRdf.mediate = async() => { throw new Error('mediatorDereferenceRdf errors'); }; changeNotificationEventEmitter.emit('update'); - await new Promise(resolve => guardEvents.once('up-to-date', resolve)); + await new Promise(resolve => determineChangesEvents.once('up-to-date', resolve)); expect(removeQuadFn).toHaveBeenCalledTimes(3); expect(removeQuadFn).toHaveBeenNthCalledWith(1, DataFactory.quad( @@ -197,8 +197,8 @@ describe('ActorGuardNaive', () => { quad('s2', 'p2', 'o2'), ]; - const { guardEvents } = await actor.run(action); - captureEvents(guardEvents, 'modified', 'up-to-date'); + const { determineChangesEvents } = await actor.run(action); + captureEvents(determineChangesEvents, 'modified', 'up-to-date'); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'update')).toBe(1); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'delete')).toBe(1); @@ -211,10 +211,10 @@ describe('ActorGuardNaive', () => { changeNotificationEventEmitter.emit('update'); - await new Promise(resolve => guardEvents.once('up-to-date', resolve)); + await new Promise(resolve => determineChangesEvents.once('up-to-date', resolve)); - expect((guardEvents)._eventCounts.modified).toBe(1); - expect((guardEvents)._eventCounts['up-to-date']).toBe(1); + expect((determineChangesEvents)._eventCounts.modified).toBe(1); + expect((determineChangesEvents)._eventCounts['up-to-date']).toBe(1); expect(addQuadFn).toHaveBeenCalledTimes(1); expect(addQuadFn).toHaveBeenCalledWith(quad('s3', 'p3', 'o3')); }); @@ -226,8 +226,8 @@ describe('ActorGuardNaive', () => { quad('s3', 'p3', 'o3'), ]; - const { guardEvents } = await actor.run(action); - captureEvents(guardEvents, 'modified', 'up-to-date'); + const { determineChangesEvents } = await actor.run(action); + captureEvents(determineChangesEvents, 'modified', 'up-to-date'); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'update')).toBe(1); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'delete')).toBe(1); @@ -239,10 +239,10 @@ describe('ActorGuardNaive', () => { changeNotificationEventEmitter.emit('update'); - await new Promise(resolve => guardEvents.once('up-to-date', resolve)); + await new Promise(resolve => determineChangesEvents.once('up-to-date', resolve)); - expect((guardEvents)._eventCounts.modified).toBe(1); - expect((guardEvents)._eventCounts['up-to-date']).toBe(1); + expect((determineChangesEvents)._eventCounts.modified).toBe(1); + expect((determineChangesEvents)._eventCounts['up-to-date']).toBe(1); expect(removeQuadFn).toHaveBeenCalledTimes(1); expect(removeQuadFn).toHaveBeenCalledWith( DataFactory.quad( @@ -260,20 +260,20 @@ describe('ActorGuardNaive', () => { quad('s3', 'p3', 'o3'), ]; - const { guardEvents } = await actor.run(action); - captureEvents(guardEvents, 'modified', 'up-to-date'); + const { determineChangesEvents } = await actor.run(action); + captureEvents(determineChangesEvents, 'modified', 'up-to-date'); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'update')).toBe(1); expect(EventEmitter.listenerCount(changeNotificationEventEmitter, 'delete')).toBe(1); - const updatePromise = new Promise(resolve => guardEvents.once('up-to-date', resolve)); + const updatePromise = new Promise(resolve => determineChangesEvents.once('up-to-date', resolve)); changeNotificationEventEmitter.emit('delete'); await updatePromise; - expect((guardEvents)._eventCounts.modified).toBe(1); - expect((guardEvents)._eventCounts['up-to-date']).toBe(1); + expect((determineChangesEvents)._eventCounts.modified).toBe(1); + expect((determineChangesEvents)._eventCounts['up-to-date']).toBe(1); expect(removeQuadFn).toHaveBeenCalledTimes(3); expect(removeQuadFn).toHaveBeenNthCalledWith(1, DataFactory.quad( DataFactory.namedNode('s1'), diff --git a/packages/actor-guard-naive/README.md b/packages/actor-guard-naive/README.md deleted file mode 100644 index 42768372..00000000 --- a/packages/actor-guard-naive/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Incremunica Naive Guard Actor - -[![npm version](https://badge.fury.io/js/@incremunica%2Factor-guard-naive.svg)](https://badge.fury.io/js/@incremunica%2Factor-guard-naive) - -An incremunica Naive Guard Actor. - -## Install - -```bash -$ yarn add @incremunica/actor-guard-naive -``` - -## Configure - -After installing, this package can be added to your engine's configuration as follows: -```text -{ - "@context": [ - ... - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-guard-naive/^1.0.0/components/context.jsonld" - ], - "actors": [ - ... - { - "@id": "urn:comunica:default:guard/actors#naive", - "@type": "ActorGuardNaive" - } - ] -} -``` diff --git a/packages/actor-guard-naive/lib/index.ts b/packages/actor-guard-naive/lib/index.ts deleted file mode 100644 index e2292479..00000000 --- a/packages/actor-guard-naive/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorGuardNaive'; diff --git a/packages/actor-query-source-identify-hypermedia-none/README.md b/packages/actor-query-source-identify-hypermedia-none/README.md index 5225ef0e..81615535 100644 --- a/packages/actor-query-source-identify-hypermedia-none/README.md +++ b/packages/actor-query-source-identify-hypermedia-none/README.md @@ -24,7 +24,7 @@ After installing, this package can be added to your engine's configuration as fo { "@id": "urn:comunica:default:query-source-identify-hypermedia/actors#none", "@type": "ActorQuerySourceIdentifyHypermediaNone", - "mediatorGuard": { "@id": "urn:comunica:default:guard/mediators#main" }, + "mediatorGuard": { "@id": "urn:comunica:default:determine-changes/mediators#main" }, "mediatorMergeBindingsContext": { "@id": "urn:comunica:default:merge-bindings-context/mediators#main" } } ] diff --git a/packages/actor-query-source-identify-hypermedia-none/lib/ActorQuerySourceIdentifyHypermediaNone.ts b/packages/actor-query-source-identify-hypermedia-none/lib/ActorQuerySourceIdentifyHypermediaNone.ts index 5f74f67d..b730d1d5 100644 --- a/packages/actor-query-source-identify-hypermedia-none/lib/ActorQuerySourceIdentifyHypermediaNone.ts +++ b/packages/actor-query-source-identify-hypermedia-none/lib/ActorQuerySourceIdentifyHypermediaNone.ts @@ -12,8 +12,8 @@ import { ActionContext, passTest } from '@comunica/core'; import type { ComunicaDataFactory } from '@comunica/types'; import { BindingsFactory } from '@comunica/utils-bindings-factory'; import { StreamingQuerySourceRdfJs } from '@incremunica/actor-query-source-identify-streaming-rdfjs'; -import type { MediatorGuard } from '@incremunica/bus-guard'; -import { KeysGuard } from '@incremunica/context-entries'; +import type { MediatorDetermineChanges } from '@incremunica/bus-determine-changes'; +import { KeysDetermineChanges } from '@incremunica/context-entries'; import type { Quad } from '@incremunica/incremental-types'; import { StreamingStore } from '@incremunica/streaming-store'; import type * as RDF from '@rdfjs/types'; @@ -23,7 +23,7 @@ import type * as RDF from '@rdfjs/types'; */ export class ActorQuerySourceIdentifyHypermediaNone extends ActorQuerySourceIdentifyHypermedia { public readonly mediatorMergeBindingsContext: MediatorMergeBindingsContext; - public readonly mediatorGuard: MediatorGuard; + public readonly mediatorDetermineChanges: MediatorDetermineChanges; public constructor(args: IActorQuerySourceIdentifyHypermediaNoneArgs) { super(args, 'file'); @@ -48,7 +48,7 @@ export class ActorQuerySourceIdentifyHypermediaNone extends ActorQuerySourceIden source.toString = () => `ActorQuerySourceIdentifyHypermediaNone(${action.url})`; source.referenceValue = action.url; - const { guardEvents } = await this.mediatorGuard.mediate({ + const { determineChangesEvents } = await this.mediatorDetermineChanges.mediate({ context: action.context, url: action.url, metadata: action.metadata, @@ -56,9 +56,9 @@ export class ActorQuerySourceIdentifyHypermediaNone extends ActorQuerySourceIden }); if (source.context) { - source.context = source.context.set(KeysGuard.events, guardEvents); + source.context = source.context.set(KeysDetermineChanges.events, determineChangesEvents); } else { - source.context = new ActionContext().set(KeysGuard.events, guardEvents); + source.context = new ActionContext().set(KeysDetermineChanges.events, determineChangesEvents); } return { source }; @@ -67,9 +67,9 @@ export class ActorQuerySourceIdentifyHypermediaNone extends ActorQuerySourceIden export interface IActorQuerySourceIdentifyHypermediaNoneArgs extends IActorQuerySourceIdentifyHypermediaArgs { /** - * The Guard mediator + * The Determine Changes mediator */ - mediatorGuard: MediatorGuard; + mediatorDetermineChanges: MediatorDetermineChanges; /** * A mediator for creating binding context merge handlers */ diff --git a/packages/actor-query-source-identify-hypermedia-none/package.json b/packages/actor-query-source-identify-hypermedia-none/package.json index 21c45717..9196e199 100644 --- a/packages/actor-query-source-identify-hypermedia-none/package.json +++ b/packages/actor-query-source-identify-hypermedia-none/package.json @@ -43,7 +43,7 @@ "@comunica/core": "^4.0.1", "@comunica/utils-bindings-factory": "^4.0.1", "@incremunica/actor-query-source-identify-streaming-rdfjs": "^1.3.0", - "@incremunica/bus-guard": "^1.3.0", + "@incremunica/bus-determine-changes": "^1.3.0", "@incremunica/context-entries": "^1.3.0", "@incremunica/streaming-store": "^1.3.0" } diff --git a/packages/actor-query-source-identify-hypermedia-none/test/ActorQuerySourceIdentifyHypermediaNone-test.ts b/packages/actor-query-source-identify-hypermedia-none/test/ActorQuerySourceIdentifyHypermediaNone-test.ts index 24a4d372..159e3b3d 100644 --- a/packages/actor-query-source-identify-hypermedia-none/test/ActorQuerySourceIdentifyHypermediaNone-test.ts +++ b/packages/actor-query-source-identify-hypermedia-none/test/ActorQuerySourceIdentifyHypermediaNone-test.ts @@ -7,8 +7,8 @@ import type { BindingsFactory } from '@comunica/utils-bindings-factory'; import { ActorMergeBindingsContextIsAddition, } from '@incremunica/actor-merge-bindings-context-is-addition'; -import type { IActionGuard, MediatorGuard } from '@incremunica/bus-guard'; -import { KeysBindings, KeysGuard } from '@incremunica/context-entries'; +import type { IActionDetermineChanges, MediatorDetermineChanges } from '@incremunica/bus-determine-changes'; +import { KeysBindings, KeysDetermineChanges } from '@incremunica/context-entries'; import { createTestBindingsFactory, createTestContextWithDataFactory } from '@incremunica/dev-tools'; import { arrayifyStream } from 'arrayify-stream'; import { DataFactory } from 'rdf-data-factory'; @@ -43,20 +43,20 @@ describe('ActorRdfResolveHypermediaNone', () => { describe('An ActorRdfResolveHypermediaNone instance', () => { let actor: ActorQuerySourceIdentifyHypermediaNone; let context: IActionContext; - let mediatorGuard: MediatorGuard; + let mediatorDetermineChanges: MediatorDetermineChanges; let mediatorMergeBindingsContext: any; - let guardEvents: EventEmitter; + let determineChangesEvents: EventEmitter; let mediatorFn: jest.Func; beforeEach(() => { context = createTestContextWithDataFactory(DF); - guardEvents = new EventEmitter(); - captureEvents(guardEvents, 'modified', 'up-to-date'); + determineChangesEvents = new EventEmitter(); + captureEvents(determineChangesEvents, 'modified', 'up-to-date'); mediatorFn = jest.fn(); - mediatorGuard = { - mediate: (action: IActionGuard) => { + mediatorDetermineChanges = { + mediate: (action: IActionDetermineChanges) => { mediatorFn(action); - return { guardEvents }; + return { determineChangesEvents }; }, }; mediatorMergeBindingsContext = { @@ -70,7 +70,7 @@ describe('ActorRdfResolveHypermediaNone', () => { actor = new ActorQuerySourceIdentifyHypermediaNone({ name: 'actor', bus, - mediatorGuard, + mediatorDetermineChanges, mediatorMergeBindingsContext, }); }); @@ -133,7 +133,7 @@ describe('ActorRdfResolveHypermediaNone', () => { expect(result.source.toString()).toBe('ActorQuerySourceIdentifyHypermediaNone(http://test.com)'); }); - it('should run and add a guard', async() => { + it('should run and add a determine-changes', async() => { const action = { context, url: 'http://test.com', @@ -143,13 +143,13 @@ describe('ActorRdfResolveHypermediaNone', () => { expect(mediatorFn).toHaveBeenCalledTimes(1); }); - it('should add the guard events to the source', async() => { + it('should add the determine-changes events to the source', async() => { class ActionContextKeyTest implements IActionContextKey { public readonly name = 'test'; public readonly dummy: boolean | undefined; } - mediatorFn = jest.fn((action: IActionGuard) => { + mediatorFn = jest.fn((action: IActionDetermineChanges) => { action.streamingQuerySource.context = (new ActionContext()).set(new ActionContextKeyTest(), true); }); const action = { @@ -159,12 +159,12 @@ describe('ActorRdfResolveHypermediaNone', () => { }; const result = await actor.run(action); expect(mediatorFn).toHaveBeenCalledTimes(1); - expect(( result.source).context.get(KeysGuard.events)).toEqual(guardEvents); + expect(( result.source).context.get(KeysDetermineChanges.events)).toEqual(determineChangesEvents); expect(( result.source).context.get(new ActionContextKeyTest())).toBe(true); }); - it('should add the guard events to the source even if the source has no context', async() => { - mediatorFn = jest.fn((action: IActionGuard) => { + it('should add the determine changes events to the source even if the source has no context', async() => { + mediatorFn = jest.fn((action: IActionDetermineChanges) => { action.streamingQuerySource.context = undefined; }); const action = { @@ -174,7 +174,7 @@ describe('ActorRdfResolveHypermediaNone', () => { }; const result = await actor.run(action); expect(mediatorFn).toHaveBeenCalledTimes(1); - expect(( result.source).context.get(KeysGuard.events)).toEqual(guardEvents); + expect(( result.source).context.get(KeysDetermineChanges.events)).toEqual(determineChangesEvents); }); }); }); diff --git a/packages/actor-query-source-identify-streaming-rdfjs/lib/StreamingQuerySourceRdfJs.ts b/packages/actor-query-source-identify-streaming-rdfjs/lib/StreamingQuerySourceRdfJs.ts index 29c6cfa1..4f06b327 100644 --- a/packages/actor-query-source-identify-streaming-rdfjs/lib/StreamingQuerySourceRdfJs.ts +++ b/packages/actor-query-source-identify-streaming-rdfjs/lib/StreamingQuerySourceRdfJs.ts @@ -128,12 +128,12 @@ export class StreamingQuerySourceRdfJs extends StreamingQuerySource { // Set up-to-date property // quads.setProperty('up-to-date', true); // if (context) { - // const guardEvents = context.get(KeysGuard.events); - // if (guardEvents) { - // guardEvents.on('modified', () => { + // const determineChangesEvents = context.get(KeysDetermineChanges.events); + // if (determineChangesEvents) { + // determineChangesEvents.on('modified', () => { // quads.setProperty('up-to-date', false); // }); - // guardEvents.on('up-to-date', () => { + // determineChangesEvents.on('up-to-date', () => { // quads.setProperty('up-to-date', true); // }); // } diff --git a/packages/actor-rdf-metadata-extract-determine-changes-data/README.md b/packages/actor-rdf-metadata-extract-determine-changes-data/README.md new file mode 100644 index 00000000..e7368f7e --- /dev/null +++ b/packages/actor-rdf-metadata-extract-determine-changes-data/README.md @@ -0,0 +1,30 @@ +# Incremunica Determine Changes Data RDF Metadata Extract Actor + +[![npm version](https://badge.fury.io/js/@incremunica%2Factor-rdf-metadata-extract-determine-changes-data.svg)](https://badge.fury.io/js/@incremunica%2Factor-rdf-metadata-extract-determine-changes-data) + +A comunica Determine Changes Data RDF Metadata Extract Actor. + +## Install + +```bash +$ yarn add @comunica/actor-rdf-metadata-extract-determine-changes-data +``` + +## Configure + +After installing, this package can be added to your engine's configuration as follows: +```text +{ + "@context": [ + ... + "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-metadata-extract-determine-changes-data/^1.0.0/components/context.jsonld" + ], + "actors": [ + ... + { + "@id": "urn:comunica:default:rdf-metadata-extract/actors#determine-changes-data", + "@type": "ActorRdfMetadataExtractDetermineChangesData" + } + ] +} +``` diff --git a/packages/actor-rdf-metadata-extract-guard-data/lib/ActorRdfMetadataExtractGuardData.ts b/packages/actor-rdf-metadata-extract-determine-changes-data/lib/ActorRdfMetadataExtractDetermineChangesData.ts similarity index 87% rename from packages/actor-rdf-metadata-extract-guard-data/lib/ActorRdfMetadataExtractGuardData.ts rename to packages/actor-rdf-metadata-extract-determine-changes-data/lib/ActorRdfMetadataExtractDetermineChangesData.ts index 546ccdee..a6a86e54 100644 --- a/packages/actor-rdf-metadata-extract-guard-data/lib/ActorRdfMetadataExtractGuardData.ts +++ b/packages/actor-rdf-metadata-extract-determine-changes-data/lib/ActorRdfMetadataExtractDetermineChangesData.ts @@ -8,9 +8,9 @@ import type { IActorTest, TestResult } from '@comunica/core'; import { passTestVoid } from '@comunica/core'; /** - * A comunica Guard Data RDF Metadata Extract Actor. + * A comunica Determine Changes Data RDF Metadata Extract Actor. */ -export class ActorRdfMetadataExtractGuardData extends ActorRdfMetadataExtract { +export class ActorRdfMetadataExtractDetermineChangesData extends ActorRdfMetadataExtract { public constructor(args: IActorRdfMetadataExtractArgs) { super(args); } diff --git a/packages/actor-rdf-metadata-extract-determine-changes-data/lib/index.ts b/packages/actor-rdf-metadata-extract-determine-changes-data/lib/index.ts new file mode 100644 index 00000000..09f52422 --- /dev/null +++ b/packages/actor-rdf-metadata-extract-determine-changes-data/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorRdfMetadataExtractDetermineChangesData'; diff --git a/packages/actor-rdf-metadata-extract-guard-data/package.json b/packages/actor-rdf-metadata-extract-determine-changes-data/package.json similarity index 78% rename from packages/actor-rdf-metadata-extract-guard-data/package.json rename to packages/actor-rdf-metadata-extract-determine-changes-data/package.json index 27521390..cf561f0b 100644 --- a/packages/actor-rdf-metadata-extract-guard-data/package.json +++ b/packages/actor-rdf-metadata-extract-determine-changes-data/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/actor-rdf-metadata-extract-guard-data", + "name": "@incremunica/actor-rdf-metadata-extract-determine-changes-data", "version": "1.3.0", - "description": "A guard-data rdf-metadata-extract actor", + "description": "A determine-changes-data rdf-metadata-extract actor", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/actor-rdf-metadata-extract-guard-data" + "directory": "packages/actor-rdf-metadata-extract-determine-changes-data" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -17,7 +17,7 @@ "comunica", "actor", "rdf-metadata-extract", - "guard-data" + "determine-changes-data" ], "sideEffects": false, "main": "lib/index.js", diff --git a/packages/actor-rdf-metadata-extract-guard-data/test/ActorRdfMetadataExtractGuardData-test.ts b/packages/actor-rdf-metadata-extract-determine-changes-data/test/ActorRdfMetadataExtractDetermineChangesData-test.ts similarity index 80% rename from packages/actor-rdf-metadata-extract-guard-data/test/ActorRdfMetadataExtractGuardData-test.ts rename to packages/actor-rdf-metadata-extract-determine-changes-data/test/ActorRdfMetadataExtractDetermineChangesData-test.ts index eb3c2652..2bad74bf 100644 --- a/packages/actor-rdf-metadata-extract-guard-data/test/ActorRdfMetadataExtractGuardData-test.ts +++ b/packages/actor-rdf-metadata-extract-determine-changes-data/test/ActorRdfMetadataExtractDetermineChangesData-test.ts @@ -1,18 +1,18 @@ import { Bus } from '@comunica/core'; -import { ActorRdfMetadataExtractGuardData } from '../lib/ActorRdfMetadataExtractGuardData'; +import { ActorRdfMetadataExtractDetermineChangesData } from '../lib'; -describe('ActorRdfMetadataExtractGuardData', () => { +describe('ActorRdfMetadataExtractDetermineChangesData', () => { let bus: any; beforeEach(() => { bus = new Bus({ name: 'bus' }); }); - describe('An ActorRdfMetadataExtractGuardData instance', () => { - let actor: ActorRdfMetadataExtractGuardData; + describe('An ActorRdfMetadataExtractDetermineChangesData instance', () => { + let actor: ActorRdfMetadataExtractDetermineChangesData; beforeEach(() => { - actor = new ActorRdfMetadataExtractGuardData({ name: 'actor', bus }); + actor = new ActorRdfMetadataExtractDetermineChangesData({ name: 'actor', bus }); }); it('should test', async() => { diff --git a/packages/actor-rdf-metadata-extract-guard-data/README.md b/packages/actor-rdf-metadata-extract-guard-data/README.md deleted file mode 100644 index d716f258..00000000 --- a/packages/actor-rdf-metadata-extract-guard-data/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Incremunica Guard Data RDF Metadata Extract Actor - -[![npm version](https://badge.fury.io/js/@incremunica%2Factor-rdf-metadata-extract-guard-data.svg)](https://badge.fury.io/js/@incremunica%2Factor-rdf-metadata-extract-guard-data) - -A comunica Guard Data RDF Metadata Extract Actor. - -## Install - -```bash -$ yarn add @comunica/actor-rdf-metadata-extract-guard-data -``` - -## Configure - -After installing, this package can be added to your engine's configuration as follows: -```text -{ - "@context": [ - ... - "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-metadata-extract-guard-data/^1.0.0/components/context.jsonld" - ], - "actors": [ - ... - { - "@id": "urn:comunica:default:rdf-metadata-extract/actors#guard-data", - "@type": "ActorRdfMetadataExtractGuardData" - } - ] -} -``` diff --git a/packages/actor-rdf-metadata-extract-guard-data/lib/index.ts b/packages/actor-rdf-metadata-extract-guard-data/lib/index.ts deleted file mode 100644 index ff1f1e6f..00000000 --- a/packages/actor-rdf-metadata-extract-guard-data/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorRdfMetadataExtractGuardData'; diff --git a/packages/actor-resource-watch-deferred/README.md b/packages/actor-resource-watch-deferred/README.md deleted file mode 100644 index 3157a2e6..00000000 --- a/packages/actor-resource-watch-deferred/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Incremunica Deferred Resource Watch Actor - -[![npm version](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-deferred.svg)](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-deferred) - -An incremunica Deferred Resource Watch Actor. - -## Install - -```bash -$ yarn add @incremunica/actor-resource-watch-deferred -``` - -## Configure - -After installing, this package can be added to your engine's configuration as follows: -```text -{ - "@context": [ - ... - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-deferred/^1.0.0/components/context.jsonld" - ], - "actors": [ - ... - { - "@id": "urn:comunica:default:resource-watch/actors#deferred", - "@type": "ActorResourceWatchDeferred" - } - ] -} -``` diff --git a/packages/actor-resource-watch-deferred/lib/index.ts b/packages/actor-resource-watch-deferred/lib/index.ts deleted file mode 100644 index 51abab2d..00000000 --- a/packages/actor-resource-watch-deferred/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorResourceWatchDeferred'; diff --git a/packages/actor-resource-watch-polling/README.md b/packages/actor-resource-watch-polling/README.md deleted file mode 100644 index cd9d13d5..00000000 --- a/packages/actor-resource-watch-polling/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Incremunica Polling Resource Watch Actor - -[![npm version](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-polling.svg)](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-polling) - -An incremunica Polling Resource Watch Actor. - -## Install - -```bash -$ yarn add @incremunica/actor-resource-watch-polling -``` - -## Configure - -After installing, this package can be added to your engine's configuration as follows: -```text -{ - "@context": [ - ... - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-polling/^1.0.0/components/context.jsonld" - ], - "actors": [ - ... - { - "@id": "urn:comunica:default:resource-watch/actors#polling", - "@type": "ActorResourceWatchPolling" - } - ] -} -``` diff --git a/packages/actor-resource-watch-polling/lib/index.ts b/packages/actor-resource-watch-polling/lib/index.ts deleted file mode 100644 index 4b6838bd..00000000 --- a/packages/actor-resource-watch-polling/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorResourceWatchPolling'; diff --git a/packages/actor-resource-watch-solid-notification-websockets/README.md b/packages/actor-resource-watch-solid-notification-websockets/README.md deleted file mode 100644 index 098d4d45..00000000 --- a/packages/actor-resource-watch-solid-notification-websockets/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Incremunica Solid Notifications Websockets Resource Watch Actor - -[![npm version](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-solid-notification-websockets.svg)](https://badge.fury.io/js/@incremunica%2Factor-resource-watch-solid-notification-websockets) - -An incremunica Solid Notifications Websockets Resource Watch Actor. - -## Install - -```bash -$ yarn add @incremunica/actor-resource-watch-solid-notification-websockets -``` - -## Configure - -After installing, this package can be added to your engine's configuration as follows: -```text -{ - "@context": [ - ... - "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-resource-watch-solid-notification-websockets/^1.0.0/components/context.jsonld" - ], - "actors": [ - ... - { - "@id": "urn:comunica:default:resource-watch/actors#actor-resource-watch-solid-notification-websockets", - "@type": "ActorResourceWatchSolidNotificationWebsockets" - } - ] -} -``` diff --git a/packages/actor-resource-watch-solid-notification-websockets/lib/index.ts b/packages/actor-resource-watch-solid-notification-websockets/lib/index.ts deleted file mode 100644 index 31b9a77e..00000000 --- a/packages/actor-resource-watch-solid-notification-websockets/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorResourceWatchSolidNotificationWebsockets'; diff --git a/packages/actor-source-watch-deferred/README.md b/packages/actor-source-watch-deferred/README.md new file mode 100644 index 00000000..36254594 --- /dev/null +++ b/packages/actor-source-watch-deferred/README.md @@ -0,0 +1,30 @@ +# Incremunica Deferred Source Watch Actor + +[![npm version](https://badge.fury.io/js/@incremunica%2Factor-source-watch-deferred.svg)](https://badge.fury.io/js/@incremunica%2Factor-source-watch-deferred) + +An incremunica Deferred Source Watch Actor. + +## Install + +```bash +$ yarn add @incremunica/actor-source-watch-deferred +``` + +## Configure + +After installing, this package can be added to your engine's configuration as follows: +```text +{ + "@context": [ + ... + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-deferred/^1.0.0/components/context.jsonld" + ], + "actors": [ + ... + { + "@id": "urn:comunica:default:source-watch/actors#deferred", + "@type": "ActorSourceWatchDeferred" + } + ] +} +``` diff --git a/packages/actor-resource-watch-deferred/lib/ActorResourceWatchDeferred.ts b/packages/actor-source-watch-deferred/lib/ActorSourceWatchDeferred.ts similarity index 67% rename from packages/actor-resource-watch-deferred/lib/ActorResourceWatchDeferred.ts rename to packages/actor-source-watch-deferred/lib/ActorSourceWatchDeferred.ts index e1876bea..07230e0d 100644 --- a/packages/actor-resource-watch-deferred/lib/ActorResourceWatchDeferred.ts +++ b/packages/actor-source-watch-deferred/lib/ActorSourceWatchDeferred.ts @@ -3,27 +3,27 @@ import type { MediatorHttp } from '@comunica/bus-http'; import type { IActorTest, TestResult } from '@comunica/core'; import { failTest, passTest } from '@comunica/core'; import type { - IActionResourceWatch, - IActorResourceWatchArgs, - IActorResourceWatchOutput, - IResourceWatchEventEmitter, -} from '@incremunica/bus-resource-watch'; + IActionSourceWatch, + IActorSourceWatchArgs, + IActorSourceWatchOutput, + ISourceWatchEventEmitter, +} from '@incremunica/bus-source-watch'; import { - ActorResourceWatch, -} from '@incremunica/bus-resource-watch'; -import { KeysResourceWatch } from '@incremunica/context-entries'; + ActorSourceWatch, +} from '@incremunica/bus-source-watch'; +import { KeysSourceWatch } from '@incremunica/context-entries'; /** - * An incremunica Deferred Resource Watch Actor. + * An incremunica Deferred Source Watch Actor. */ -export class ActorResourceWatchDeferred extends ActorResourceWatch { +export class ActorSourceWatchDeferred extends ActorSourceWatch { public readonly mediatorHttp: MediatorHttp; - public constructor(args: IActorResourceWatchDeferredArgs) { + public constructor(args: IActorSourceWatchDeferredArgs) { super(args); } - public async test(action: IActionResourceWatch): Promise> { - if (!action.context.has(KeysResourceWatch.deferredEvaluationEventEmitter)) { + public async test(action: IActionSourceWatch): Promise> { + if (!action.context.has(KeysSourceWatch.deferredEvaluationEventEmitter)) { return failTest('Context does not have \'deferredEvaluationEventEmitter\''); } const responseHead = await this.mediatorHttp.mediate( @@ -44,11 +44,11 @@ export class ActorResourceWatchDeferred extends ActorResourceWatch { return passTest({ priority: this.priority }); } - public async run(action: IActionResourceWatch): Promise { - const eventsSource: IResourceWatchEventEmitter = action.context - .getSafe(KeysResourceWatch.deferredEvaluationEventEmitter); + public async run(action: IActionSourceWatch): Promise { + const eventsSource: ISourceWatchEventEmitter = action.context + .getSafe(KeysSourceWatch.deferredEvaluationEventEmitter); eventsSource.setMaxListeners(eventsSource.getMaxListeners() + 1); - const outputEvents: IResourceWatchEventEmitter = new EventEmitter(); + const outputEvents: ISourceWatchEventEmitter = new EventEmitter(); let etag = action.metadata.etag; const checkForChanges = (): void => { @@ -93,7 +93,7 @@ export class ActorResourceWatchDeferred extends ActorResourceWatch { } } -export interface IActorResourceWatchDeferredArgs extends IActorResourceWatchArgs { +export interface IActorSourceWatchDeferredArgs extends IActorSourceWatchArgs { /** * The HTTP mediator */ diff --git a/packages/actor-source-watch-deferred/lib/index.ts b/packages/actor-source-watch-deferred/lib/index.ts new file mode 100644 index 00000000..122e5e57 --- /dev/null +++ b/packages/actor-source-watch-deferred/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorSourceWatchDeferred'; diff --git a/packages/actor-resource-watch-deferred/package.json b/packages/actor-source-watch-deferred/package.json similarity index 80% rename from packages/actor-resource-watch-deferred/package.json rename to packages/actor-source-watch-deferred/package.json index 091b4c19..506f2d38 100644 --- a/packages/actor-resource-watch-deferred/package.json +++ b/packages/actor-source-watch-deferred/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/actor-resource-watch-deferred", + "name": "@incremunica/actor-source-watch-deferred", "version": "1.3.0", - "description": "A deferred-diff guard actor", + "description": "A deferred source-watch actor", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/actor-resource-watch-deferred" + "directory": "packages/actor-source-watch-deferred" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "comunica", "actor", - "guard", + "source-watch", "deferred" ], "sideEffects": false, @@ -39,7 +39,7 @@ "dependencies": { "@comunica/bus-http": "^4.0.2", "@comunica/core": "^4.0.1", - "@incremunica/bus-resource-watch": "^1.3.0", + "@incremunica/bus-source-watch": "^1.3.0", "@incremunica/context-entries": "^1.3.0" } } diff --git a/packages/actor-resource-watch-deferred/test/ActorResourceWatchDeferred-test.ts b/packages/actor-source-watch-deferred/test/ActorSourceWatchDeferred-test.ts similarity index 90% rename from packages/actor-resource-watch-deferred/test/ActorResourceWatchDeferred-test.ts rename to packages/actor-source-watch-deferred/test/ActorSourceWatchDeferred-test.ts index 11b407a7..00e0f08c 100644 --- a/packages/actor-resource-watch-deferred/test/ActorResourceWatchDeferred-test.ts +++ b/packages/actor-source-watch-deferred/test/ActorSourceWatchDeferred-test.ts @@ -1,32 +1,32 @@ import { EventEmitter } from 'events'; import { ActionContext, Bus } from '@comunica/core'; -import type { IActionResourceWatch } from '@incremunica/bus-resource-watch'; -import { KeysResourceWatch } from '@incremunica/context-entries'; -import { ActorResourceWatchDeferred } from '../lib'; +import type { IActionSourceWatch } from '@incremunica/bus-source-watch'; +import { KeysSourceWatch } from '@incremunica/context-entries'; +import { ActorSourceWatchDeferred } from '../lib'; import 'jest-rdf'; import '@comunica/utils-jest'; -describe('ActorGuardDeferred', () => { +describe('ActorSourceWatchDeferred', () => { let bus: any; beforeEach(() => { bus = new Bus({ name: 'bus' }); }); - describe('An ActorGuardDeferred instance', () => { - let actor: ActorResourceWatchDeferred; + describe('An ActorSourceWatchDeferred instance', () => { + let actor: ActorSourceWatchDeferred; let priority: number; - let action: IActionResourceWatch; + let action: IActionSourceWatch; let deferredEventEmitter: EventEmitter; let mediatorHttp: any; beforeEach(() => { deferredEventEmitter = new EventEmitter(); - const context = new ActionContext().set(KeysResourceWatch.deferredEvaluationEventEmitter, deferredEventEmitter); + const context = new ActionContext().set(KeysSourceWatch.deferredEvaluationEventEmitter, deferredEventEmitter); priority = 0; mediatorHttp = { mediate: jest.fn(() => Promise.resolve({ ok: true, headers: { get: () => '0' }})) }; - actor = new ActorResourceWatchDeferred({ + actor = new ActorSourceWatchDeferred({ priority, name: 'actor', bus, diff --git a/packages/actor-source-watch-polling/README.md b/packages/actor-source-watch-polling/README.md new file mode 100644 index 00000000..669ad565 --- /dev/null +++ b/packages/actor-source-watch-polling/README.md @@ -0,0 +1,30 @@ +# Incremunica Polling Source Watch Actor + +[![npm version](https://badge.fury.io/js/@incremunica%2Factor-source-watch-polling.svg)](https://badge.fury.io/js/@incremunica%2Factor-source-watch-polling) + +An incremunica Polling Source Watch Actor. + +## Install + +```bash +$ yarn add @incremunica/actor-source-watch-polling +``` + +## Configure + +After installing, this package can be added to your engine's configuration as follows: +```text +{ + "@context": [ + ... + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-polling/^1.0.0/components/context.jsonld" + ], + "actors": [ + ... + { + "@id": "urn:comunica:default:source-watch/actors#polling", + "@type": "ActorSourceWatchPolling" + } + ] +} +``` diff --git a/packages/actor-resource-watch-polling/lib/ActorResourceWatchPolling.ts b/packages/actor-source-watch-polling/lib/ActorSourceWatchPolling.ts similarity index 61% rename from packages/actor-resource-watch-polling/lib/ActorResourceWatchPolling.ts rename to packages/actor-source-watch-polling/lib/ActorSourceWatchPolling.ts index 8794f03f..ea3e5217 100644 --- a/packages/actor-resource-watch-polling/lib/ActorResourceWatchPolling.ts +++ b/packages/actor-source-watch-polling/lib/ActorSourceWatchPolling.ts @@ -3,47 +3,47 @@ import type { MediatorHttp } from '@comunica/bus-http'; import type { IActorTest, TestResult } from '@comunica/core'; import { passTest } from '@comunica/core'; import type { - IActionResourceWatch, - IActorResourceWatchArgs, - IActorResourceWatchOutput, - IResourceWatchEventEmitter, -} from '@incremunica/bus-resource-watch'; + IActionSourceWatch, + IActorSourceWatchArgs, + IActorSourceWatchOutput, + ISourceWatchEventEmitter, +} from '@incremunica/bus-source-watch'; import { - ActorResourceWatch, -} from '@incremunica/bus-resource-watch'; -import { KeysResourceWatch } from '@incremunica/context-entries'; + ActorSourceWatch, +} from '@incremunica/bus-source-watch'; +import { KeysSourceWatch } from '@incremunica/context-entries'; /** - * An incremunica Polling Resource Watch Actor. + * An incremunica Polling Source Watch Actor. */ -export class ActorResourceWatchPolling extends ActorResourceWatch { +export class ActorSourceWatchPolling extends ActorSourceWatch { public readonly mediatorHttp: MediatorHttp; - public readonly defaultPollingFrequency: number; + public readonly defaultPollingPeriod: number; private readonly regex = /max-age=(\d+)/u; - public constructor(args: IActorResourceWatchPollingArgs) { + public constructor(args: IActorSourceWatchPollingArgs) { super(args); } - public async test(_action: IActionResourceWatch): Promise> { + public async test(_action: IActionSourceWatch): Promise> { return passTest({ priority: this.priority }); } - public async run(action: IActionResourceWatch): Promise { - const events: IResourceWatchEventEmitter = new EventEmitter(); + public async run(action: IActionSourceWatch): Promise { + const events: ISourceWatchEventEmitter = new EventEmitter(); const maxAgeArray = this.regex.exec(action.metadata['cache-control']); - let pollingFrequency: number; + let pollingPeriod: number; if (maxAgeArray) { - pollingFrequency = Number.parseInt(maxAgeArray[1], 10); - } else if (action.context.has(KeysResourceWatch.pollingFrequency)) { - pollingFrequency = action.context.get(KeysResourceWatch.pollingFrequency)!; + pollingPeriod = Number.parseInt(maxAgeArray[1], 10); + } else if (action.context.has(KeysSourceWatch.pollingPeriod)) { + pollingPeriod = action.context.get(KeysSourceWatch.pollingPeriod)!; } else { - pollingFrequency = this.defaultPollingFrequency; + pollingPeriod = this.defaultPollingPeriod; } - let pollingStartTime = Date.now() + (pollingFrequency - Number.parseInt(action.metadata.age, 10)) * 1000; + let pollingStartTime = Date.now() + (pollingPeriod - Number.parseInt(action.metadata.age, 10)) * 1000; let etag = action.metadata.etag; const checkForChanges = (): void => { @@ -58,7 +58,7 @@ export class ActorResourceWatchPolling extends ActorResourceWatch { }, ).then((responseHead) => { if (responseHead.headers.has('age')) { - pollingStartTime = Date.now() + (pollingFrequency - Number.parseInt(action.metadata.age, 10)) * 1000; + pollingStartTime = Date.now() + (pollingPeriod - Number.parseInt(action.metadata.age, 10)) * 1000; } // TODO [2024-12-01]: have more specific error handling for example 304: Not Modified should not emit 'delete' @@ -79,7 +79,7 @@ export class ActorResourceWatchPolling extends ActorResourceWatch { checkForChanges(); loopId = setInterval( checkForChanges, - pollingFrequency * 1_000, + pollingPeriod * 1_000, ); }; @@ -94,7 +94,7 @@ export class ActorResourceWatchPolling extends ActorResourceWatch { let waitTime: number; const now = Date.now(); if (now > pollingStartTime) { - waitTime = pollingFrequency * 1_000 - ((now - pollingStartTime) % (pollingFrequency * 1_000)); + waitTime = pollingPeriod * 1_000 - ((now - pollingStartTime) % (pollingPeriod * 1_000)); checkForChanges(); } else { waitTime = (pollingStartTime - now); @@ -106,7 +106,7 @@ export class ActorResourceWatchPolling extends ActorResourceWatch { } else { timeoutId = setTimeout( startCheckLoop, - pollingFrequency * 1_000, + pollingPeriod * 1_000, ); } }; @@ -130,13 +130,13 @@ export class ActorResourceWatchPolling extends ActorResourceWatch { } } -export interface IActorResourceWatchPollingArgs extends IActorResourceWatchArgs { +export interface IActorSourceWatchPollingArgs extends IActorSourceWatchArgs { /** * The HTTP mediator */ mediatorHttp: MediatorHttp; /** - * The Polling Frequency in seconds + * The Polling Period in seconds */ - defaultPollingFrequency: number; + defaultPollingPeriod: number; } diff --git a/packages/actor-source-watch-polling/lib/index.ts b/packages/actor-source-watch-polling/lib/index.ts new file mode 100644 index 00000000..76d55348 --- /dev/null +++ b/packages/actor-source-watch-polling/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorSourceWatchPolling'; diff --git a/packages/actor-resource-watch-polling/package.json b/packages/actor-source-watch-polling/package.json similarity index 80% rename from packages/actor-resource-watch-polling/package.json rename to packages/actor-source-watch-polling/package.json index f91939ef..a731ebfb 100644 --- a/packages/actor-resource-watch-polling/package.json +++ b/packages/actor-source-watch-polling/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/actor-resource-watch-polling", + "name": "@incremunica/actor-source-watch-polling", "version": "1.3.0", - "description": "A polling-diff guard actor", + "description": "A polling source-watch actor", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/actor-resource-watch-polling" + "directory": "packages/actor-source-watch-polling" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "comunica", "actor", - "guard", + "source-watch", "polling" ], "sideEffects": false, @@ -39,7 +39,7 @@ "dependencies": { "@comunica/bus-http": "^4.0.1", "@comunica/core": "^4.0.1", - "@incremunica/bus-resource-watch": "^1.3.0", + "@incremunica/bus-source-watch": "^1.3.0", "@incremunica/context-entries": "^1.3.0" } } diff --git a/packages/actor-resource-watch-polling/test/ActorResourceWatchPolling-test.ts b/packages/actor-source-watch-polling/test/ActorSourceWatchPolling-test.ts similarity index 95% rename from packages/actor-resource-watch-polling/test/ActorResourceWatchPolling-test.ts rename to packages/actor-source-watch-polling/test/ActorSourceWatchPolling-test.ts index ca265794..ecac455d 100644 --- a/packages/actor-resource-watch-polling/test/ActorResourceWatchPolling-test.ts +++ b/packages/actor-source-watch-polling/test/ActorSourceWatchPolling-test.ts @@ -1,8 +1,8 @@ import type { IActionHttp, IActorHttpOutput, MediatorHttp } from '@comunica/bus-http'; import { ActionContext, Bus } from '@comunica/core'; -import type { IActionResourceWatch } from '@incremunica/bus-resource-watch'; -import { KeysResourceWatch } from '@incremunica/context-entries'; -import { ActorResourceWatchPolling } from '../lib'; +import type { IActionSourceWatch } from '@incremunica/bus-source-watch'; +import { KeysSourceWatch } from '@incremunica/context-entries'; +import { ActorSourceWatchPolling } from '../lib'; import 'jest-rdf'; import '@comunica/utils-jest'; @@ -28,19 +28,19 @@ expect.extend({ }, }); -describe('ActorGuardPolling', () => { +describe('ActorSourceWatchPolling', () => { let bus: any; beforeEach(() => { bus = new Bus({ name: 'bus' }); }); - describe('An ActorGuardPolling instance', () => { - let actor: ActorResourceWatchPolling; + describe('An ActorSourceWatchPolling instance', () => { + let actor: ActorSourceWatchPolling; let mediatorHttp: MediatorHttp; let priority: number; - let action: IActionResourceWatch; + let action: IActionSourceWatch; let headersObject: { age: string | undefined; 'cache-control': string | undefined; @@ -85,10 +85,10 @@ describe('ActorGuardPolling', () => { }), }; - actor = new ActorResourceWatchPolling({ + actor = new ActorSourceWatchPolling({ beforeActors: [], mediatorHttp, - defaultPollingFrequency: 1, + defaultPollingPeriod: 1, priority, name: 'actor', bus, @@ -167,7 +167,7 @@ describe('ActorGuardPolling', () => { }); it('should be able to start and stop multiple times', async() => { - action.context = action.context.set(KeysResourceWatch.pollingFrequency, 0.5); + action.context = action.context.set(KeysSourceWatch.pollingPeriod, 0.5); headersObject.etag = 0; const result = await actor.run(action); @@ -230,7 +230,7 @@ describe('ActorGuardPolling', () => { }); it('should use polling frequency in context', async() => { - action.context = new ActionContext().set(KeysResourceWatch.pollingFrequency, 2); + action.context = new ActionContext().set(KeysSourceWatch.pollingPeriod, 2); headersObject.etag = 0; diff --git a/packages/actor-source-watch-solid-notification-websockets/README.md b/packages/actor-source-watch-solid-notification-websockets/README.md new file mode 100644 index 00000000..ab0a9db2 --- /dev/null +++ b/packages/actor-source-watch-solid-notification-websockets/README.md @@ -0,0 +1,30 @@ +# Incremunica Solid Notifications Websockets Source Watch Actor + +[![npm version](https://badge.fury.io/js/@incremunica%2Factor-source-watch-solid-notification-websockets.svg)](https://badge.fury.io/js/@incremunica%2Factor-source-watch-solid-notification-websockets) + +An incremunica Solid Notifications Websockets Source Watch Actor. + +## Install + +```bash +$ yarn add @incremunica/actor-source-watch-solid-notification-websockets +``` + +## Configure + +After installing, this package can be added to your engine's configuration as follows: +```text +{ + "@context": [ + ... + "https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/actor-source-watch-solid-notification-websockets/^1.0.0/components/context.jsonld" + ], + "actors": [ + ... + { + "@id": "urn:comunica:default:source-watch/actors#actor-source-watch-solid-notification-websockets", + "@type": "ActorSourceWatchSolidNotificationWebsockets" + } + ] +} +``` diff --git a/packages/actor-resource-watch-solid-notification-websockets/lib/ActorResourceWatchSolidNotificationWebsockets.ts b/packages/actor-source-watch-solid-notification-websockets/lib/ActorSourceWatchSolidNotificationWebsockets.ts similarity index 79% rename from packages/actor-resource-watch-solid-notification-websockets/lib/ActorResourceWatchSolidNotificationWebsockets.ts rename to packages/actor-source-watch-solid-notification-websockets/lib/ActorSourceWatchSolidNotificationWebsockets.ts index fa7811cf..7809771e 100644 --- a/packages/actor-resource-watch-solid-notification-websockets/lib/ActorResourceWatchSolidNotificationWebsockets.ts +++ b/packages/actor-source-watch-solid-notification-websockets/lib/ActorSourceWatchSolidNotificationWebsockets.ts @@ -3,14 +3,14 @@ import type { MediatorHttp } from '@comunica/bus-http'; import type { IActorTest, TestResult } from '@comunica/core'; import { failTest, passTestWithSideData } from '@comunica/core'; import type { - IActionResourceWatch, - IActorResourceWatchArgs, - IActorResourceWatchOutput, - IResourceWatchEventEmitter, -} from '@incremunica/bus-resource-watch'; + IActionSourceWatch, + IActorSourceWatchArgs, + IActorSourceWatchOutput, + ISourceWatchEventEmitter, +} from '@incremunica/bus-source-watch'; import { - ActorResourceWatch, -} from '@incremunica/bus-resource-watch'; + ActorSourceWatch, +} from '@incremunica/bus-source-watch'; import { SubscriptionClient } from '@solid-notifications/subscription'; import type { NotificationChannel } from '@solid-notifications/types'; import { ChannelType } from '@solid-notifications/types'; @@ -22,9 +22,9 @@ if (is_node()) { } /** - * An incremunica Resource Watch Solid Notification Websockets Actor. + * An incremunica Source Watch Solid Notification Websockets Actor. */ -export class ActorResourceWatchSolidNotificationWebsockets extends ActorResourceWatch { +export class ActorSourceWatchSolidNotificationWebsockets extends ActorSourceWatch { public readonly mediatorHttp: MediatorHttp; private readonly channelType: ChannelType = ChannelType.WebSocketChannel2023; @@ -32,7 +32,7 @@ export class ActorResourceWatchSolidNotificationWebsockets extends ActorResource super(args); } - public async test(action: IActionResourceWatch): Promise> { + public async test(action: IActionSourceWatch): Promise> { const customFetch = (input: RequestInfo, init?: RequestInit | undefined): Promise => this.mediatorHttp.mediate({ context: action.context, @@ -49,17 +49,17 @@ export class ActorResourceWatchSolidNotificationWebsockets extends ActorResource } if (notificationChannel.receiveFrom === undefined) { - return failTest('Resource does not support Solid Notifications with Websockets'); + return failTest('Source does not support Solid Notifications with Websockets'); } return passTestWithSideData({ priority: this.priority }, { notificationChannel: notificationChannel.receiveFrom }); } public async run( - _action: IActionResourceWatch, + _action: IActionSourceWatch, sideData: SideData, - ): Promise { - const events: IResourceWatchEventEmitter = new EventEmitter(); + ): Promise { + const events: ISourceWatchEventEmitter = new EventEmitter(); let socket: WebSocket | undefined; const start = (): void => { @@ -106,7 +106,7 @@ export class ActorResourceWatchSolidNotificationWebsockets extends ActorResource } } -export interface IActorSolidNotificationWebsocketsArgs extends IActorResourceWatchArgs { +export interface IActorSolidNotificationWebsocketsArgs extends IActorSourceWatchArgs { /** * The HTTP mediator */ diff --git a/packages/actor-source-watch-solid-notification-websockets/lib/index.ts b/packages/actor-source-watch-solid-notification-websockets/lib/index.ts new file mode 100644 index 00000000..fccfad2d --- /dev/null +++ b/packages/actor-source-watch-solid-notification-websockets/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorSourceWatchSolidNotificationWebsockets'; diff --git a/packages/actor-resource-watch-solid-notification-websockets/package.json b/packages/actor-source-watch-solid-notification-websockets/package.json similarity index 77% rename from packages/actor-resource-watch-solid-notification-websockets/package.json rename to packages/actor-source-watch-solid-notification-websockets/package.json index 79259c2e..e4d59e0e 100644 --- a/packages/actor-resource-watch-solid-notification-websockets/package.json +++ b/packages/actor-source-watch-solid-notification-websockets/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/actor-resource-watch-solid-notification-websockets", + "name": "@incremunica/actor-source-watch-solid-notification-websockets", "version": "1.3.0", - "description": "An incremunica solid notification resource watch actor", + "description": "An incremunica solid notification source watch actor", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/actor-resource-watch-solid-notification-websockets" + "directory": "packages/actor-source-watch-solid-notification-websockets" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "comunica", "actor", - "resource-watch", + "source-watch", "solid-notification-websockets" ], "sideEffects": false, @@ -39,7 +39,7 @@ "dependencies": { "@comunica/bus-http": "^4.0.1", "@comunica/core": "^4.0.1", - "@incremunica/bus-resource-watch": "^1.3.0", + "@incremunica/bus-source-watch": "^1.3.0", "@solid-notifications/subscription": "^0.1.0", "@solid-notifications/types": "^0.1.0", "tstl": "^3.0.0", diff --git a/packages/actor-resource-watch-solid-notification-websockets/test/ActorResourceWatchSolidNotificationWebsockets-test.ts b/packages/actor-source-watch-solid-notification-websockets/test/ActorSourceWatchSolidNotificationWebsockets-test.ts similarity index 95% rename from packages/actor-resource-watch-solid-notification-websockets/test/ActorResourceWatchSolidNotificationWebsockets-test.ts rename to packages/actor-source-watch-solid-notification-websockets/test/ActorSourceWatchSolidNotificationWebsockets-test.ts index 68733406..46d571d6 100644 --- a/packages/actor-resource-watch-solid-notification-websockets/test/ActorResourceWatchSolidNotificationWebsockets-test.ts +++ b/packages/actor-source-watch-solid-notification-websockets/test/ActorSourceWatchSolidNotificationWebsockets-test.ts @@ -3,10 +3,10 @@ import type { Actor, IActorTest, Mediator } from '@comunica/core'; import { Bus } from '@comunica/core'; import 'jest-rdf'; import '@comunica/utils-jest'; -import type { IActionResourceWatch } from '@incremunica/bus-resource-watch'; +import type { IActionSourceWatch } from '@incremunica/bus-source-watch'; import type { Server } from 'ws'; import { WebSocket } from 'ws'; -import { ActorResourceWatchSolidNotificationWebsockets } from '../lib/ActorResourceWatchSolidNotificationWebsockets'; +import { ActorSourceWatchSolidNotificationWebsockets } from '../lib/ActorSourceWatchSolidNotificationWebsockets'; import { createChannelDescriptionRequest, createDescriptionResourceRequest, @@ -60,16 +60,16 @@ const message: any = { // }; // -describe('ActorResourceWatchSolidNotificationWebsockets', () => { +describe('ActorSourceWatchSolidNotificationWebsockets', () => { let bus: any; - let actor: ActorResourceWatchSolidNotificationWebsockets; + let actor: ActorSourceWatchSolidNotificationWebsockets; let mediatorHttp: Mediator< Actor, IActionHttp, IActorTest, IActorHttpOutput >; - let action: IActionResourceWatch; + let action: IActionSourceWatch; let priority: number; let createResourceRequestFn: (url: string) => any; let createDescriptionResourceRequestFn: (url: string) => any; @@ -104,7 +104,7 @@ IActorHttpOutput }, }; - actor = new ActorResourceWatchSolidNotificationWebsockets({ + actor = new ActorSourceWatchSolidNotificationWebsockets({ beforeActors: [], mediatorHttp, name: 'actor', @@ -123,7 +123,7 @@ IActorHttpOutput }; }); - describe('ActorResourceWatchSolidNotificationWebsockets test', () => { + describe('ActorSourceWatchSolidNotificationWebsockets test', () => { it('should test', async() => { createResourceRequestFn = createResourceRequest; createDescriptionResourceRequestFn = createDescriptionResourceRequest; @@ -173,11 +173,11 @@ IActorHttpOutput createChannelDescriptionRequestFn = createEmptyChannelDescriptionRequest; await expect(actor.test(action)) - .resolves.toFailTest('Resource does not support Solid Notifications with Websockets'); + .resolves.toFailTest('Source does not support Solid Notifications with Websockets'); }); }); - describe('ActorResourceWatchSolidNotificationWebsockets run', () => { + describe('ActorSourceWatchSolidNotificationWebsockets run', () => { let websocket: Server; const onCloseFn = jest.fn(); const onConnectionFn = jest.fn((ws: WebSocket) => { diff --git a/packages/actor-resource-watch-solid-notification-websockets/test/mocks/HTTPMock.ts b/packages/actor-source-watch-solid-notification-websockets/test/mocks/HTTPMock.ts similarity index 100% rename from packages/actor-resource-watch-solid-notification-websockets/test/mocks/HTTPMock.ts rename to packages/actor-source-watch-solid-notification-websockets/test/mocks/HTTPMock.ts diff --git a/packages/bus-bindings-aggregator-factory/package.json b/packages/bus-bindings-aggregator-factory/package.json index 17f08c25..1509b9a4 100644 --- a/packages/bus-bindings-aggregator-factory/package.json +++ b/packages/bus-bindings-aggregator-factory/package.json @@ -44,7 +44,6 @@ "@comunica/utils-expression-evaluator": "^4.0.2", "@incremunica/context-entries": "^1.3.0", "@rdfjs/types": "*", - "rdf-string": "^1.6.3", "sparqlalgebrajs": "^4.3.8" } } diff --git a/packages/bus-determine-changes/README.md b/packages/bus-determine-changes/README.md new file mode 100644 index 00000000..89a781a2 --- /dev/null +++ b/packages/bus-determine-changes/README.md @@ -0,0 +1,22 @@ +# Incremunica Bus Determine Changes + +[![npm version](https://badge.fury.io/js/@incremunica%2Fbus-determine-changes.svg)](https://badge.fury.io/js/@incremunica%2Fbus-determine-changes) + +A comunica bus for determine-changes events. + +## Install + +```bash +$ yarn add @comunica/bus-determine-changes +``` + +## Usage + +## Bus usage + +* **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-determine-changes/^1.0.0/components/context.jsonld"` +* **Bus name**: `ActorDetermineChanges:_default_bus` + +## Creating actors on this bus + +Actors extending [`ActorDetermineChanges`](TODO:jsdoc_url) are automatically subscribed to this bus. diff --git a/packages/bus-determine-changes/lib/ActorDetermineChanges.ts b/packages/bus-determine-changes/lib/ActorDetermineChanges.ts new file mode 100644 index 00000000..bf10235d --- /dev/null +++ b/packages/bus-determine-changes/lib/ActorDetermineChanges.ts @@ -0,0 +1,63 @@ +import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core'; +import { Actor } from '@comunica/core'; +import type { IDetermineChangesEvents } from '@incremunica/incremental-types'; +import type { StreamingQuerySource } from '@incremunica/streaming-query-source'; + +/** + * A comunica actor for determine-changes events. + * + * Actor DetermineChanges: + * * Input: IActionDetermineChanges: // TODO [2024-12-01]: fill in. + * * Test: + * * Output: IActorDetermineChangesOutput: // TODO [2024-12-01]: fill in. + * + * @see IActionDetermineChanges + * @see IActorDetermineChangesOutput + */ +export abstract class ActorDetermineChanges extends Actor< + IActionDetermineChanges, + IActorTest, + IActorDetermineChangesOutput, +TS +> { + /** + * @param args - @defaultNested { a } bus + */ + public constructor(args: IActorDetermineChangesArgs) { + super(args); + } +} + +export interface IActionDetermineChanges extends IAction { + /** + * The source element of the data. + */ + streamingQuerySource: StreamingQuerySource; + /** + * The URL of the source that was fetched. + */ + url: string; + /** + * The extracted metadata. + */ + metadata: Record; +} + +export interface IActorDetermineChangesOutput extends IActorOutput { + /** + * Events send by the determine-changes + */ + determineChangesEvents: IDetermineChangesEvents; +} + +export type IActorDetermineChangesArgs = IActorArgs< +IActionDetermineChanges, +IActorTest, +IActorDetermineChangesOutput, +TS +>; + +export type MediatorDetermineChanges = Mediate< +IActionDetermineChanges, +IActorDetermineChangesOutput +>; diff --git a/packages/bus-determine-changes/lib/index.ts b/packages/bus-determine-changes/lib/index.ts new file mode 100644 index 00000000..e5ed670c --- /dev/null +++ b/packages/bus-determine-changes/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorDetermineChanges'; diff --git a/packages/bus-guard/package.json b/packages/bus-determine-changes/package.json similarity index 83% rename from packages/bus-guard/package.json rename to packages/bus-determine-changes/package.json index 397aca2c..3169b6cf 100644 --- a/packages/bus-guard/package.json +++ b/packages/bus-determine-changes/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/bus-guard", + "name": "@incremunica/bus-determine-changes", "version": "1.3.0", - "description": "A comunica bus for guard events.", + "description": "A comunica bus for determine-changes events.", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/bus-guard" + "directory": "packages/bus-determine-changes" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "comunica", "bus", - "guard" + "determine-changes" ], "sideEffects": false, "main": "lib/index.js", diff --git a/packages/bus-guard/README.md b/packages/bus-guard/README.md deleted file mode 100644 index 76477a15..00000000 --- a/packages/bus-guard/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Incremunica Bus Guard - -[![npm version](https://badge.fury.io/js/@incremunica%2Fbus-guard.svg)](https://badge.fury.io/js/@incremunica%2Fbus-guard) - -A comunica bus for guard events. - -## Install - -```bash -$ yarn add @comunica/bus-guard -``` - -## Usage - -## Bus usage - -* **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-guard/^1.0.0/components/context.jsonld"` -* **Bus name**: `ActorGuard:_default_bus` - -## Creating actors on this bus - -Actors extending [`ActorGuard`](TODO:jsdoc_url) are automatically subscribed to this bus. diff --git a/packages/bus-guard/lib/ActorGuard.ts b/packages/bus-guard/lib/ActorGuard.ts deleted file mode 100644 index fca61bc8..00000000 --- a/packages/bus-guard/lib/ActorGuard.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core'; -import { Actor } from '@comunica/core'; -import type { IGuardEvents } from '@incremunica/incremental-types/lib/GuardEvents'; -import type { StreamingQuerySource } from '@incremunica/streaming-query-source'; - -/** - * A comunica actor for guard events. - * - * Actor Guard: - * * Input: IActionGuard: // TODO [2024-12-01]: fill in. - * * Test: - * * Output: IActorGuardOutput: // TODO [2024-12-01]: fill in. - * - * @see IActionGuard - * @see IActorGuardOutput - */ -export abstract class ActorGuard extends Actor { - /** - * @param args - @defaultNested { a } bus - */ - public constructor(args: IActorGuardArgs) { - super(args); - } -} - -export interface IActionGuard extends IAction { - /** - * The source element of the data. - */ - streamingQuerySource: StreamingQuerySource; - /** - * The URL of the source that was fetched. - */ - url: string; - /** - * The extracted metadata. - */ - metadata: Record; -} - -export interface IActorGuardOutput extends IActorOutput { - /** - * Events send by the guard - */ - guardEvents: IGuardEvents; -} - -export type IActorGuardArgs = IActorArgs< -IActionGuard, -IActorTest, -IActorGuardOutput, -TS ->; - -export type MediatorGuard = Mediate< -IActionGuard, -IActorGuardOutput ->; diff --git a/packages/bus-guard/lib/index.ts b/packages/bus-guard/lib/index.ts deleted file mode 100644 index beae7b65..00000000 --- a/packages/bus-guard/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorGuard'; diff --git a/packages/bus-resource-watch/README.md b/packages/bus-resource-watch/README.md deleted file mode 100644 index 4b352338..00000000 --- a/packages/bus-resource-watch/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Incremunica Bus Resource Watch - -[![npm version](https://badge.fury.io/js/%40incremunica%2Fbus-resource-watch.svg)](https://www.npmjs.com/package/@incremunica/bus-resource-watch) - -An incremunica bus for watching resources events. - -## Install - -```bash -$ yarn add @incremunica/bus-resource-watch -``` - -## Usage - -## Bus usage - -* **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-resource-watch/^1.0.0/components/context.jsonld"` -* **Bus name**: `ActorResourceWatch:_default_bus` - -## Creating actors on this bus - -Actors extending [`ActorResourceWatch`](TODO:jsdoc_url) are automatically subscribed to this bus. diff --git a/packages/bus-resource-watch/lib/index.ts b/packages/bus-resource-watch/lib/index.ts deleted file mode 100644 index 500393ed..00000000 --- a/packages/bus-resource-watch/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ActorResourceWatch'; diff --git a/packages/bus-source-watch/README.md b/packages/bus-source-watch/README.md new file mode 100644 index 00000000..9441491b --- /dev/null +++ b/packages/bus-source-watch/README.md @@ -0,0 +1,22 @@ +# Incremunica Bus Source Watch + +[![npm version](https://badge.fury.io/js/%40incremunica%2Fbus-source-watch.svg)](https://www.npmjs.com/package/@incremunica/bus-source-watch) + +An incremunica bus for watching sources events. + +## Install + +```bash +$ yarn add @incremunica/bus-source-watch +``` + +## Usage + +## Bus usage + +* **Context**: `"https://linkedsoftwaredependencies.org/bundles/npm/@incremunica/bus-source-watch/^1.0.0/components/context.jsonld"` +* **Bus name**: `ActorSourceWatch:_default_bus` + +## Creating actors on this bus + +Actors extending [`ActorSourceWatch`](TODO:jsdoc_url) are automatically subscribed to this bus. diff --git a/packages/bus-resource-watch/lib/ActorResourceWatch.ts b/packages/bus-source-watch/lib/ActorSourceWatch.ts similarity index 50% rename from packages/bus-resource-watch/lib/ActorResourceWatch.ts rename to packages/bus-source-watch/lib/ActorSourceWatch.ts index 02533af3..d16713f9 100644 --- a/packages/bus-resource-watch/lib/ActorResourceWatch.ts +++ b/packages/bus-source-watch/lib/ActorSourceWatch.ts @@ -3,37 +3,37 @@ import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@co import { Actor } from '@comunica/core'; /** - * An incremunica actor for resource-watch events. + * An incremunica actor for source-watch events. * * Actor types: - * * Input: IActionResourceWatch: // TODO: fill in. + * * Input: IActionSourceWatch: // TODO: fill in. * * Test: - * * Output: IActorResourceWatchOutput: // TODO: fill in. + * * Output: IActorSourceWatchOutput: // TODO: fill in. * - * @see IActionResourceWatch - * @see IActorResourceWatchOutput + * @see IActionSourceWatch + * @see IActorSourceWatchOutput */ -export abstract class ActorResourceWatch extends Actor< - IActionResourceWatch, +export abstract class ActorSourceWatch extends Actor< + IActionSourceWatch, IActorTest, - IActorResourceWatchOutput, + IActorSourceWatchOutput, TS > { public readonly priority: number; /** * @param args - @defaultNested { a } bus */ - public constructor(args: IActorResourceWatchArgs) { + public constructor(args: IActorSourceWatchArgs) { super(args); } } -export declare interface IResourceWatchEventEmitter extends EventEmitter { +export declare interface ISourceWatchEventEmitter extends EventEmitter { emit: ((event: 'update') => boolean) & ((event: 'delete') => boolean); on: ((event: 'update', listener: () => void) => this) & ((event: 'delete', listener: () => void) => this); } -export interface IActionResourceWatch extends IAction { +export interface IActionSourceWatch extends IAction { /** * The URL of the source that was fetched. */ @@ -44,25 +44,25 @@ export interface IActionResourceWatch extends IAction { metadata: Record; } -export interface IActorResourceWatchOutput extends IActorOutput { +export interface IActorSourceWatchOutput extends IActorOutput { /** * An event emitter that emits 'update' and 'delete' events. */ - events: IResourceWatchEventEmitter; + events: ISourceWatchEventEmitter; /** - * A function to stop watching the resource. + * A function to stop watching the source. */ stop: () => void; /** - * A function to start watching the resource. + * A function to start watching the source. */ start: () => void; } -export interface IActorResourceWatchArgs extends IActorArgs< -IActionResourceWatch, +export interface IActorSourceWatchArgs extends IActorArgs< +IActionSourceWatch, IActorTest, -IActorResourceWatchOutput, +IActorSourceWatchOutput, TS > { /** @@ -71,7 +71,7 @@ TS priority: number; } -export type MediatorResourceWatch = Mediate< -IActionResourceWatch, -IActorResourceWatchOutput +export type MediatorSourceWatch = Mediate< +IActionSourceWatch, +IActorSourceWatchOutput >; diff --git a/packages/bus-source-watch/lib/index.ts b/packages/bus-source-watch/lib/index.ts new file mode 100644 index 00000000..96d9f3c4 --- /dev/null +++ b/packages/bus-source-watch/lib/index.ts @@ -0,0 +1 @@ +export * from './ActorSourceWatch'; diff --git a/packages/bus-resource-watch/package.json b/packages/bus-source-watch/package.json similarity index 82% rename from packages/bus-resource-watch/package.json rename to packages/bus-source-watch/package.json index 7cdf6711..40ff6cc3 100644 --- a/packages/bus-resource-watch/package.json +++ b/packages/bus-source-watch/package.json @@ -1,14 +1,14 @@ { - "name": "@incremunica/bus-resource-watch", + "name": "@incremunica/bus-source-watch", "version": "1.3.0", - "description": "An incremunica bus for resource-watch events.", + "description": "An incremunica bus for source-watch events.", "lsd:module": true, "license": "MIT", "homepage": "https://maartyman.github.io/incremunica/", "repository": { "type": "git", "url": "https://github.com/maartyman/incremunica.git", - "directory": "packages/bus-resource-watch" + "directory": "packages/bus-source-watch" }, "bugs": { "url": "https://github.com/maartyman/incremunica/issues" @@ -16,7 +16,7 @@ "keywords": [ "incremunica", "bus", - "resource-watch" + "source-watch" ], "sideEffects": false, "main": "lib/index.js", diff --git a/packages/context-entries/lib/Keys.ts b/packages/context-entries/lib/Keys.ts index b02625b6..e1ef9f36 100644 --- a/packages/context-entries/lib/Keys.ts +++ b/packages/context-entries/lib/Keys.ts @@ -1,6 +1,6 @@ import { ActionContextKey } from '@comunica/core'; -import type { IResourceWatchEventEmitter } from '@incremunica/bus-resource-watch'; -import type { IGuardEvents } from '@incremunica/incremental-types'; +import type { ISourceWatchEventEmitter } from '@incremunica/bus-source-watch'; +import type { IDetermineChangesEvents } from '@incremunica/incremental-types'; /** * When adding entries to this file, also add a shortcut for them in the contextKeyShortcuts TSDoc comment in @@ -8,11 +8,11 @@ import type { IGuardEvents } from '@incremunica/incremental-types'; * Also, add this shortcut to IQueryContextCommon in @comunica/types. */ -export const KeysGuard = { +export const KeysDetermineChanges = { /** - * Events sent by the guard. + * Events sent by the determine-changes actor. */ - events: new ActionContextKey('@incremunica/guard:events'), + events: new ActionContextKey('@incremunica/determine-changes:events'), }; export const KeysStreamingSource = { @@ -23,8 +23,8 @@ export const KeysBindings = { isAddition: new ActionContextKey('@incremunica/bindings:isAddition'), }; -export const KeysResourceWatch = { - pollingFrequency: new ActionContextKey('@incremunica/resource-watch:pollingFrequency'), +export const KeysSourceWatch = { + pollingPeriod: new ActionContextKey('@incremunica/source-watch:pollingPeriod'), deferredEvaluationEventEmitter: - new ActionContextKey('@incremunica/resource-watch:deferredEvaluationEventEmitter'), + new ActionContextKey('@incremunica/resource-watch:deferredEvaluationEventEmitter'), }; diff --git a/packages/context-entries/package.json b/packages/context-entries/package.json index 5c550f85..61e09264 100644 --- a/packages/context-entries/package.json +++ b/packages/context-entries/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@comunica/core": "^4.0.1", - "@incremunica/bus-resource-watch": "^1.3.0", + "@incremunica/bus-source-watch": "^1.3.0", "@incremunica/incremental-types": "^1.3.0" } } diff --git a/packages/incremental-types/lib/GuardEvents.ts b/packages/incremental-types/lib/DetermineChangesEvents.ts similarity index 79% rename from packages/incremental-types/lib/GuardEvents.ts rename to packages/incremental-types/lib/DetermineChangesEvents.ts index fa01d89e..9d1fb0b3 100644 --- a/packages/incremental-types/lib/GuardEvents.ts +++ b/packages/incremental-types/lib/DetermineChangesEvents.ts @@ -1,6 +1,6 @@ import type { EventEmitter } from 'events'; -export interface IGuardEvents extends EventEmitter { +export interface IDetermineChangesEvents extends EventEmitter { emit: ((event: 'modified') => boolean) & ((event: 'up-to-date') => boolean); on: ((event: 'modified', listener: () => void) => this) & ((event: 'up-to-date', listener: () => void) => this); } diff --git a/packages/incremental-types/lib/index.ts b/packages/incremental-types/lib/index.ts index 8db5365d..41cd63a0 100644 --- a/packages/incremental-types/lib/index.ts +++ b/packages/incremental-types/lib/index.ts @@ -1,2 +1,2 @@ export * from './Quad'; -export * from './GuardEvents'; +export * from './DetermineChangesEvents';