@checkdigit/hash 2.0.3-PR.21-13ab → 3.0.0-PR.23-5a00

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@checkdigit/hash","version":"2.0.3-PR.21-13ab","description":"Hash is a small function for Check Digit services to create a uuid derived from a hash generated from a given value.","exports":{".":{"types":"./dist-types/index.d.ts","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"prettier":"@checkdigit/prettier-config","engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/hash.git"},"author":"Check Digit, LLC","license":"MIT","bugs":{"url":"https://github.com/checkdigit/hash/issues"},"homepage":"https://github.com/checkdigit/hash#readme","devDependencies":{"@checkdigit/eslint-config":"^7.8.0","@checkdigit/jest-config":"^2.2.1","@checkdigit/prettier-config":"^3.4.0","@checkdigit/typescript-config":"^3.5.0","@types/uuid":"^9.0.1","rimraf":"^5.0.1","uuid":"^9.0.0"},"eslintConfig":{"extends":["@checkdigit/eslint-config"]},"jest":{"preset":"@checkdigit/jest-config"},"scripts":{"prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && npm run build:dist-esm","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --outDir=dist-cjs","build:dist-esm":"rimraf dist-esm && npx builder --type=module --sourceMap --outDir=dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","lint:fix":"eslint -f unix --ext .ts,.mts src --fix","lint":"eslint -f unix --ext .ts,.mts src","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","ci:compile":"tsc --noEmit","ci:test":"jest --coverage=false","ci:coverage":"jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier"}}
1
+ {"name":"@checkdigit/hash","version":"3.0.0-PR.23-5a00","description":"Hash is a small function for Check Digit services to create a uuid derived from a hash generated from a given value.","type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"prettier":"@checkdigit/prettier-config","engines":{"node":">=20.11"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/hash.git"},"author":"Check Digit, LLC","license":"MIT","bugs":{"url":"https://github.com/checkdigit/hash/issues"},"homepage":"https://github.com/checkdigit/hash#readme","devDependencies":{"@checkdigit/eslint-config":"^9.2.0","@checkdigit/jest-config":"^6.0.0","@checkdigit/prettier-config":"^5.3.0","@checkdigit/typescript-config":"^7.0.0","@types/uuid":"^9.0.8","rimraf":"^5.0.5","uuid":"^9.0.1"},"eslintConfig":{"extends":["@checkdigit/eslint-config"]},"jest":{"preset":"@checkdigit/jest-config"},"scripts":{"prepublishOnly":"npm run build:dist-types && npm run build:dist-esm","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","build:dist-esm":"rimraf dist-esm && npx builder --type=module --sourceMap --outDir=dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","lint":"eslint --max-warnings 0 --ignore-path .gitignore .","lint:fix":"eslint --ignore-path .gitignore . --fix","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","ci:compile":"tsc --noEmit","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier"}}
package/src/hash.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // hash.ts
2
2
 
3
3
  /*
4
- * Copyright (c) 2021-2023 Check Digit, LLC
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
5
  *
6
6
  * This code is licensed under the MIT license (see LICENSE.txt for details).
7
7
  */
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // index.ts
2
2
 
3
3
  /*
4
- * Copyright (c) 2021-2023 Check Digit, LLC
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
5
  *
6
6
  * This code is licensed under the MIT license (see LICENSE.txt for details).
7
7
  */
package/src/uuid-v5.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // uuid-v5.ts
2
2
 
3
3
  /*
4
- * Copyright (c) 2021 Check Digit, LLC
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
5
  *
6
6
  * This code is derived from https://github.com/uuidjs/uuid,
7
7
  * licensed under the MIT license (see below for details).
package/dist-cjs/hash.cjs DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/hash.ts
31
- var hash_exports = {};
32
- __export(hash_exports, {
33
- HASH_NAMESPACE: () => HASH_NAMESPACE,
34
- default: () => hash_default
35
- });
36
- module.exports = __toCommonJS(hash_exports);
37
- var import_node_crypto = require("node:crypto");
38
- var import_uuid_v5 = __toESM(require("./uuid-v5.cjs"));
39
- var HASH_NAMESPACE = "f25d4515-fea7-44c7-8baf-f3ca50865e66";
40
- function hash_default(value) {
41
- return (0, import_uuid_v5.default)((0, import_node_crypto.createHash)("sha512").update(value).digest("base64"), HASH_NAMESPACE);
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- HASH_NAMESPACE
46
- });
47
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2hhc2gudHMiXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFRQSx5QkFBMkI7QUFFM0IscUJBQW1CO0FBR1osSUFBTSxpQkFBaUI7QUFNZixTQUFSLGFBQWtCLE9BQXVCO0FBQzlDLGFBQU8sZUFBQUEsYUFBTywrQkFBVyxRQUFRLEVBQUUsT0FBTyxLQUFLLEVBQUUsT0FBTyxRQUFRLEdBQUcsY0FBYztBQUNuRjsiLAogICJuYW1lcyI6IFsidXVpZFY1Il0KfQo=
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- HASH_NAMESPACE: () => import_hash2.HASH_NAMESPACE,
34
- default: () => import_hash.default,
35
- hash: () => import_hash2.default
36
- });
37
- module.exports = __toCommonJS(src_exports);
38
- var import_hash = __toESM(require("./hash.cjs"));
39
- var import_hash2 = __toESM(require("./hash.cjs"));
40
- // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- HASH_NAMESPACE,
43
- hash
44
- });
45
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnRzIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFRQSxrQkFBd0I7QUFDeEIsSUFBQUEsZUFBZ0Q7IiwKICAibmFtZXMiOiBbImltcG9ydF9oYXNoIl0KfQo=
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/uuid-v5.ts
21
- var uuid_v5_exports = {};
22
- __export(uuid_v5_exports, {
23
- default: () => uuid_v5_default
24
- });
25
- module.exports = __toCommonJS(uuid_v5_exports);
26
- var import_node_crypto = require("node:crypto");
27
- function parse(namespace) {
28
- let value;
29
- const intArray = new Uint8Array(16);
30
- intArray[0] = (value = Number.parseInt(namespace.slice(0, 8), 16)) >>> 24;
31
- intArray[1] = value >>> 16 & 255;
32
- intArray[2] = value >>> 8 & 255;
33
- intArray[3] = value & 255;
34
- intArray[4] = (value = Number.parseInt(namespace.slice(9, 13), 16)) >>> 8;
35
- intArray[5] = value & 255;
36
- intArray[6] = (value = Number.parseInt(namespace.slice(14, 18), 16)) >>> 8;
37
- intArray[7] = value & 255;
38
- intArray[8] = (value = Number.parseInt(namespace.slice(19, 23), 16)) >>> 8;
39
- intArray[9] = value & 255;
40
- intArray[10] = (value = Number.parseInt(namespace.slice(24, 36), 16)) / 1099511627776 & 255;
41
- intArray[11] = value / 4294967296 & 255;
42
- intArray[12] = value >>> 24 & 255;
43
- intArray[13] = value >>> 16 & 255;
44
- intArray[14] = value >>> 8 & 255;
45
- intArray[15] = value & 255;
46
- return intArray;
47
- }
48
- function uuid_v5_default(value, namespace) {
49
- const buffer = (0, import_node_crypto.createHash)("sha1").update(parse(namespace)).update(value).digest();
50
- buffer[6] = (buffer[6] ?? 0) & 15 | 80;
51
- buffer[8] = (buffer[8] ?? 0) & 63 | 128;
52
- const hex = buffer.toString("hex", 0, 16);
53
- return [hex.slice(0, 8), hex.slice(8, 12), hex.slice(12, 16), hex.slice(16, 20), hex.slice(20, 32)].join("-").toLowerCase();
54
- }
55
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL3V1aWQtdjUudHMiXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUE2QkEseUJBQTJCO0FBRzNCLFNBQVMsTUFBTSxXQUFtQjtBQUNoQyxNQUFJO0FBQ0osUUFBTSxXQUFXLElBQUksV0FBVyxFQUFFO0FBR2xDLFdBQVMsQ0FBQyxLQUFLLFFBQVEsT0FBTyxTQUFTLFVBQVUsTUFBTSxHQUFHLENBQUMsR0FBRyxFQUFFLE9BQU87QUFDdkUsV0FBUyxDQUFDLElBQUssVUFBVSxLQUFNO0FBQy9CLFdBQVMsQ0FBQyxJQUFLLFVBQVUsSUFBSztBQUM5QixXQUFTLENBQUMsSUFBSSxRQUFRO0FBR3RCLFdBQVMsQ0FBQyxLQUFLLFFBQVEsT0FBTyxTQUFTLFVBQVUsTUFBTSxHQUFHLEVBQUUsR0FBRy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