Socket
Socket
Sign inDemoInstall

@comunica/core

Package Overview
Dependencies
Maintainers
4
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/core - npm Package Compare versions

Comparing version 1.22.0 to 2.0.1-alpha.5.0

components/ActionContext.jsonld

1

lib/ActionObserver.d.ts

@@ -39,2 +39,3 @@ import type { Actor, IAction, IActorOutput, IActorTest } from './Actor';

* The name for this observer.
* @default {<rdf:subject>}
*/

@@ -41,0 +42,0 @@ name: string;

69

lib/Actor.d.ts

@@ -1,5 +0,4 @@

import type { IAction, ActionContext as _ActionContext } from '@comunica/types';
import type { IActionContext } from '@comunica/types';
import type { Bus } from './Bus';
import type { Logger } from './Logger';
export type { IAction };
/**

@@ -42,3 +41,3 @@ * An actor can act on messages of certain types and provide output of a certain type.

*/
static getContextLogger(context?: ActionContext): Logger | undefined;
static getContextLogger(context: IActionContext): Logger | undefined;
/**

@@ -86,51 +85,35 @@ * Check if this actor can run the given action,

deinitialize(): Promise<any>;
protected getDefaultLogData(context: ActionContext | undefined, data?: (() => any)): any;
protected logTrace(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected logDebug(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected logInfo(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected logWarn(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected logError(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected logFatal(context: ActionContext | undefined, message: string, data?: (() => any)): void;
protected getDefaultLogData(context: IActionContext, data?: (() => any)): any;
protected logTrace(context: IActionContext, message: string, data?: (() => any)): void;
protected logDebug(context: IActionContext, message: string, data?: (() => any)): void;
protected logInfo(context: IActionContext, message: string, data?: (() => any)): void;
protected logWarn(context: IActionContext, message: string, data?: (() => any)): void;
protected logError(context: IActionContext, message: string, data?: (() => any)): void;
protected logFatal(context: IActionContext, message: string, data?: (() => any)): void;
}
export interface IActorArgs<I extends IAction, T extends IActorTest, O extends IActorOutput> {
/**
* The name for this actor.
* @default {<rdf:subject>}
*/
name: string;
/**
* The bus this actor subscribes to.
*/
bus: Bus<Actor<I, T, O>, I, T, O>;
/**
* Actor that must be registered in the bus before this actor.
*/
beforeActors?: Actor<I, T, O>[];
}
/**
* An immutable key-value mapped context that can be passed to any (@link IAction}.
* All actors that receive a context must forward this context to any actor, mediator or bus that it calls.
* This context may be transformed before forwarding.
*
* Each bus should describe in its action interface which context entries are possible (non-restrictive)
* and corresponding context keys should be exposed in '@comunica/context-entries' for easy reuse.
* If actors support any specific context entries next to those inherited by the bus action interface,
* then this should be described in its README file.
*
* To avoid entry conflicts, all keys must be properly namespaced using the following convention:
* Each key must be prefixed with the package name followed by a `:`.
* For example, the `rdf-resolve-quad-pattern` bus declares the `sources` entry,
* which should be named as `@comunica/bus-rdf-resolve-quad-pattern:sources`.
*
* This context can contain any information that might be relevant for certain actors.
* For instance, this context can contain a list of datasources over which operators should query.
*
* @deprecated Use the same type from @comunica/types
* Data interface for the type of action.
*/
export declare type ActionContext = _ActionContext;
export interface IAction {
/**
* The input context that is passed through by actors.
*/
context: IActionContext;
}
/**
* A convenience constructor for {@link ActionContext} based on a given hash.
* @param {{[p: string]: any}} hash A hash that maps keys to values.
* @return {ActionContext} The immutable action context from the hash.
* @constructor
*/
export declare function ActionContext(hash: Record<string, any>): ActionContext;
/**
* Convert the given object to an action context object if it is not an action context object yet.
* If it already is an action context object, return the object as-is.
* @param maybeActionContext Any object.
* @return {ActionContext} An action context object.
*/
export declare function ensureActionContext(maybeActionContext: any): ActionContext;
/**
* Data interface for the type of an actor test result.

@@ -137,0 +120,0 @@ */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureActionContext = exports.ActionContext = exports.Actor = void 0;
exports.Actor = void 0;
const context_entries_1 = require("@comunica/context-entries");
const immutable_1 = require("immutable");
/**

@@ -126,23 +125,2 @@ * An actor can act on messages of certain types and provide output of a certain type.

exports.Actor = Actor;
/**
* A convenience constructor for {@link ActionContext} based on a given hash.
* @param {{[p: string]: any}} hash A hash that maps keys to values.
* @return {ActionContext} The immutable action context from the hash.
* @constructor
*/
// eslint-disable-next-line no-redeclare
function ActionContext(hash) {
return immutable_1.Map(hash);
}
exports.ActionContext = ActionContext;
/**
* Convert the given object to an action context object if it is not an action context object yet.
* If it already is an action context object, return the object as-is.
* @param maybeActionContext Any object.
* @return {ActionContext} An action context object.
*/
function ensureActionContext(maybeActionContext) {
return immutable_1.Map.isMap(maybeActionContext) ? maybeActionContext : ActionContext(maybeActionContext);
}
exports.ensureActionContext = ensureActionContext;
//# sourceMappingURL=Actor.js.map

@@ -102,2 +102,6 @@ import type { ActionObserver } from './ActionObserver';

export interface IBusArgs {
/**
* The name for this bus.
* @default {<rdf:subject>}
*/
name: string;

@@ -104,0 +108,0 @@ }

@@ -1,2 +0,1 @@

import { KeysCore } from '@comunica/context-entries';
/**

@@ -25,7 +24,1 @@ * A logger accepts messages from different levels

}
/**
* @type {string} Context entry for a logger instance.
* @value {Logger} A logger.
* @deprecated Import this constant from @comunica/context-entries.
*/
export declare const KEY_CONTEXT_LOG = KeysCore.log;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KEY_CONTEXT_LOG = exports.Logger = void 0;
const context_entries_1 = require("@comunica/context-entries");
exports.Logger = void 0;
/**

@@ -32,8 +31,2 @@ * A logger accepts messages from different levels

};
/**
* @type {string} Context entry for a logger instance.
* @value {Logger} A logger.
* @deprecated Import this constant from @comunica/context-entries.
*/
exports.KEY_CONTEXT_LOG = context_entries_1.KeysCore.log;
//# sourceMappingURL=Logger.js.map

@@ -80,4 +80,12 @@ import type { Actor, IAction, IActorOutput, IActorTest } from './Actor';

export interface IMediatorArgs<A extends Actor<I, T, O>, I extends IAction, T extends IActorTest, O extends IActorOutput> {
/**
* The name for this mediator.
* @default {<rdf:subject>}
*/
name: string;
/**
* The bus this mediator will mediate over.
*/
bus: Bus<A, I, T, O>;
}
export declare type Mediate<I extends IAction, O extends IActorOutput, T extends IActorTest = IActorTest> = Mediator<Actor<I, T, O>, I, T, O>;
The MIT License (MIT)
Copyright © 2017–2018 Ruben Taelman, Joachim Van Herwegen
Ghent University – imec, Belgium
Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
Comunica Association and Ghent University – imec, Belgium

@@ -6,0 +6,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "@comunica/core",
"version": "1.22.0",
"version": "2.0.1-alpha.5.0",
"description": "Lightweight, semantic and modular actor framework",
"lsd:module": true,
"main": "index.js",
"main": "lib/index.js",
"engines": {
"node": ">=8.0"
"node": ">=14.0"
},
"typings": "index",
"typings": "lib/index",
"repository": {

@@ -34,34 +34,15 @@ "type": "git",

"lib/**/*.d.ts",
"lib/**/*.js",
"index.d.ts",
"index.js"
"lib/**/*.js"
],
"dependencies": {
"@comunica/context-entries": "^1.22.0",
"@comunica/types": "^1.22.0",
"@comunica/context-entries": "2.0.1-alpha.5.0",
"@comunica/types": "2.0.1-alpha.5.0",
"immutable": "^3.8.2"
},
"jest": {
"globals": {
"ts-jest": {
"tsConfig": "../../tsconfig.json"
}
},
"transform": {
"^.+\\.ts$": "ts-jest"
},
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.ts$",
"moduleFileExtensions": [
"ts",
"js"
],
"collectCoverage": true
},
"scripts": {
"test": "node \"../../node_modules/jest/bin/jest.js\" ${1}",
"test-watch": "node \"../../node_modules/jest/bin/jest.js\" ${1} --watch",
"build": "node \"../../node_modules/typescript/bin/tsc\"",
"validate": "npm ls"
"build": "npm run build:ts && npm run build:components",
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
"build:components": "componentsjs-generator"
},
"gitHead": "0a249ba341022eb2f1b9922fcf549a9564671d9f"
"gitHead": "e2ae2e9e924bf0656df60cc99774f7e560d47695"
}

@@ -28,1 +28,2 @@ # Comunica Core

* [`Logger`](https://comunica.github.io/comunica/classes/core.logger.html): A logger accepts messages from different levels and emits them in a certain way.
* [`ActionContext`](https://comunica.github.io/comunica/classes/core.actioncontext.html): Implementation of IActionContext using Immutable.js.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc