@comunica/actor-abstract-bindings-hash
Advanced tools
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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14707
151
+ Addedcanonicalize@^1.0.1
+ Addedcanonicalize@1.0.8(transitive)
- Removedjson-stable-stringify@^1.0.1
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedisarray@2.0.5(transitive)
- Removedjson-stable-stringify@1.2.1(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedset-function-length@1.2.2(transitive)