Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@comunica/actor-abstract-bindings-hash

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/actor-abstract-bindings-hash - npm Package Compare versions

Comparing version 1.13.0 to 1.14.0

17

index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./lib/AbstractBindingsHash"));
__export(require("./lib/AbstractFilterHash"));
__exportStar(require("./lib/AbstractBindingsHash"), exports);
__exportStar(require("./lib/AbstractFilterHash"), exports);
//# sourceMappingURL=index.js.map

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

import { ActorQueryOperationTypedMediated, Bindings, IActorQueryOperationOutputBindings } from "@comunica/bus-query-operation";
import { ActionContext, IActorTest } from "@comunica/core";
import { Algebra } from "sparqlalgebrajs";
import { IActorInitRdfDereferencePagedArgs } from "./AbstractFilterHash";
import { ActorQueryOperationTypedMediated, Bindings, IActorQueryOperationOutputBindings } from '@comunica/bus-query-operation';
import { ActionContext, IActorTest } from '@comunica/core';
import { Algebra } from 'sparqlalgebrajs';
import { IActorInitRdfDereferencePagedArgs } from './AbstractFilterHash';
/**

@@ -13,8 +13,8 @@ * A comunica Hash Query Operation Actor.

/**
* Create a new filter function for the given hash algorithm and digest algorithm.
* The given filter depends on the Algebraic operation
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @return {(bindings: Bindings) => boolean} A distinct filter for bindings.
*/
* Create a new filter function for the given hash algorithm and digest algorithm.
* The given filter depends on the Algebraic operation
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @return {(bindings: Bindings) => boolean} A distinct filter for bindings.
*/
abstract newHashFilter(hashAlgorithm: string, digestAlgorithm: string): (bindings: Bindings) => boolean;

@@ -21,0 +21,0 @@ testOperation(pattern: T, context: ActionContext): Promise<IActorTest>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractBindingsHash = void 0;
const bus_query_operation_1 = require("@comunica/bus-query-operation");

@@ -12,6 +13,6 @@ const AbstractFilterHash_1 = require("./AbstractFilterHash");

if (!AbstractFilterHash_1.AbstractFilterHash.doesHashAlgorithmExist(this.hashAlgorithm)) {
throw new Error("The given hash algorithm is not present in this version of Node: " + this.hashAlgorithm);
throw new Error(`The given hash algorithm is not present in this version of Node: ${this.hashAlgorithm}`);
}
if (!AbstractFilterHash_1.AbstractFilterHash.doesDigestAlgorithmExist(this.digestAlgorithm)) {
throw new Error("The given digest algorithm is not present in this version of Node: " + this.digestAlgorithm);
throw new Error(`The given digest algorithm is not present in this version of Node: ${this.digestAlgorithm}`);
}

@@ -18,0 +19,0 @@ }

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

import { ActorQueryOperationTypedMediated, Bindings, IActorQueryOperationOutputBindings, IActorQueryOperationTypedMediatedArgs } from "@comunica/bus-query-operation";
import { ActionContext } from "@comunica/core";
import { Algebra } from "sparqlalgebrajs";
import { ActorQueryOperationTypedMediated, Bindings, IActorQueryOperationOutputBindings, IActorQueryOperationTypedMediatedArgs } from '@comunica/bus-query-operation';
import { ActionContext } from '@comunica/core';
import { Algebra } from 'sparqlalgebrajs';
/**

@@ -12,20 +12,20 @@ * A comunica Hash Query Operation Actor.

/**
* Check if the given hash algorithm (such as sha1) exists.
* @param {string} hashAlgorithm A hash algorithm.
* @return {boolean} If it exists.
*/
* Check if the given hash algorithm (such as sha1) exists.
* @param {string} hashAlgorithm A hash algorithm.
* @return {boolean} If it exists.
*/
static doesHashAlgorithmExist(hashAlgorithm: string): boolean;
/**
* Check if the given digest (such as base64) algorithm exists.
* @param {string} digestAlgorithm A digest algorithm.
* @return {boolean} If it exists.
*/
* Check if the given digest (such as base64) algorithm exists.
* @param {string} digestAlgorithm A digest algorithm.
* @return {boolean} If it exists.
*/
static doesDigestAlgorithmExist(digestAlgorithm: string): boolean;
/**
* Create a string-based hash of the given object.
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @param bindings The bindings to hash.
* @return {string} The object's hash.
*/
* Create a string-based hash of the given object.
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @param bindings The bindings to hash.
* @return {string} The object's hash.
*/
static hash(hashAlgorithm: string, digestAlgorithm: string, bindings: Bindings): string;

@@ -32,0 +32,0 @@ abstract runOperation(pattern: T, context: ActionContext): Promise<IActorQueryOperationOutputBindings>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractFilterHash = void 0;
const crypto_1 = require("crypto");
const bus_query_operation_1 = require("@comunica/bus-query-operation");
const crypto_1 = require("crypto");
const rdf_string_1 = require("rdf-string");

@@ -13,34 +14,34 @@ /**

if (!AbstractFilterHash.doesHashAlgorithmExist(this.hashAlgorithm)) {
throw new Error("The given hash algorithm is not present in this version of Node: " + this.hashAlgorithm);
throw new Error(`The given hash algorithm is not present in this version of Node: ${this.hashAlgorithm}`);
}
if (!AbstractFilterHash.doesDigestAlgorithmExist(this.digestAlgorithm)) {
throw new Error("The given digest algorithm is not present in this version of Node: " + this.digestAlgorithm);
throw new Error(`The given digest algorithm is not present in this version of Node: ${this.digestAlgorithm}`);
}
}
/**
* Check if the given hash algorithm (such as sha1) exists.
* @param {string} hashAlgorithm A hash algorithm.
* @return {boolean} If it exists.
*/
* Check if the given hash algorithm (such as sha1) exists.
* @param {string} hashAlgorithm A hash algorithm.
* @return {boolean} If it exists.
*/
static doesHashAlgorithmExist(hashAlgorithm) {
return crypto_1.getHashes().indexOf(hashAlgorithm) >= 0;
return crypto_1.getHashes().includes(hashAlgorithm);
}
/**
* Check if the given digest (such as base64) algorithm exists.
* @param {string} digestAlgorithm A digest algorithm.
* @return {boolean} If it exists.
*/
* Check if the given digest (such as base64) algorithm exists.
* @param {string} digestAlgorithm A digest algorithm.
* @return {boolean} If it exists.
*/
static doesDigestAlgorithmExist(digestAlgorithm) {
return ["latin1", "hex", "base64"].indexOf(digestAlgorithm) >= 0;
return ['latin1', 'hex', 'base64'].includes(digestAlgorithm);
}
/**
* Create a string-based hash of the given object.
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @param bindings The bindings to hash.
* @return {string} The object's hash.
*/
* Create a string-based hash of the given object.
* @param {string} hashAlgorithm A hash algorithm.
* @param {string} digestAlgorithm A digest algorithm.
* @param bindings The bindings to hash.
* @return {string} The object's hash.
*/
static hash(hashAlgorithm, digestAlgorithm, bindings) {
const hash = crypto_1.createHash(hashAlgorithm);
hash.update(require('json-stable-stringify')(bindings.map(rdf_string_1.termToString)));
hash.update(require('canonicalize')(bindings.map(x => rdf_string_1.termToString(x))));
return hash.digest(digestAlgorithm);

@@ -47,0 +48,0 @@ }

{
"name": "@comunica/actor-abstract-bindings-hash",
"version": "1.13.0",
"version": "1.14.0",
"description": "An abstract actor for handling binding query operators",

@@ -43,4 +43,4 @@ "lsd:module": "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-abstract-bindings-hash",

"devDependencies": {
"@comunica/bus-query-operation": "^1.13.0",
"@comunica/core": "^1.13.0"
"@comunica/bus-query-operation": "^1.14.0",
"@comunica/core": "^1.14.0"
},

@@ -50,3 +50,3 @@ "jest": {

"ts-jest": {
"tsConfig": "test/tsconfig.json"
"tsConfig": "../../tsconfig.json"
}

@@ -67,3 +67,2 @@ },

"test-watch": "node \"../../node_modules/jest/bin/jest.js\" ${1} --watch",
"lint": "node \"../../node_modules/tslint/bin/tslint\" lib/**/*.ts test/**/*.ts --exclude '**/*.d.ts'",
"build": "node \"../../node_modules/typescript/bin/tsc\"",

@@ -73,6 +72,6 @@ "validate": "npm ls"

"dependencies": {
"json-stable-stringify": "^1.0.1",
"canonicalize": "^1.0.1",
"rdf-string": "^1.4.2"
},
"gitHead": "cd8df73fe091e3d7413147ec5301b47be2de392a"
"gitHead": "6517367d95ef072468bfc0d88cf3a27f6d25a145"
}
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