gt-react 4.0.3 → 4.0.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateHash.d.ts","sourceRoot":"","sources":["../../src/internal/calculateHash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculateHash.d.ts","sourceRoot":"","sources":["../../src/internal/calculateHash.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAA8B,aAAa,CAAC,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnF"}
|
|
@@ -62,12 +62,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
62
62
|
};
|
|
63
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
64
|
exports.default = calculateHash;
|
|
65
|
-
var
|
|
66
|
-
var hashFunctionPromise = (0, xxhash_wasm_1.default)().then(function (hasher) { return hasher.h64ToString; });
|
|
67
|
-
var hashFunction = null;
|
|
68
|
-
hashFunctionPromise.then(function (fn) {
|
|
69
|
-
hashFunction = fn;
|
|
70
|
-
});
|
|
65
|
+
var xxhashjs_1 = __importDefault(require("xxhashjs"));
|
|
71
66
|
/**
|
|
72
67
|
* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.
|
|
73
68
|
*
|
|
@@ -78,17 +73,8 @@ function calculateHash(childrenAsObjects) {
|
|
|
78
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
74
|
var unhashedKey;
|
|
80
75
|
return __generator(this, function (_a) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!!hashFunction) return [3 /*break*/, 2];
|
|
84
|
-
return [4 /*yield*/, hashFunctionPromise];
|
|
85
|
-
case 1:
|
|
86
|
-
hashFunction = _a.sent();
|
|
87
|
-
_a.label = 2;
|
|
88
|
-
case 2:
|
|
89
|
-
unhashedKey = JSON.stringify(sanitizeChildrenAsObjects(childrenAsObjects));
|
|
90
|
-
return [2 /*return*/, hashFunction(unhashedKey)];
|
|
91
|
-
}
|
|
76
|
+
unhashedKey = JSON.stringify(sanitizeChildrenAsObjects(childrenAsObjects));
|
|
77
|
+
return [2 /*return*/, xxhashjs_1.default.h64().update(unhashedKey).digest().toString(16)];
|
|
92
78
|
});
|
|
93
79
|
});
|
|
94
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateHash.js","sourceRoot":"","sources":["../../src/internal/calculateHash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"calculateHash.js","sourceRoot":"","sources":["../../src/internal/calculateHash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gCAGC;AAXD,sDAA2B;AAE3B;;;;;GAKG;AACH,SAA8B,aAAa,CAAC,iBAAsB;;;;YACxD,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC,CAAC;YACjF,sBAAO,kBAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAC;;;CAC9D;AAED,SAAS,yBAAyB,CAAC,iBAAsB;IACrD,IAAM,aAAa,GAAG,UAAC,KAAU;;QAC7B,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACpD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,QAAQ,EAAE,CAAC;gBACjB,IAAA,IAAI,GAAc,KAAK,KAAnB,EAAK,IAAI,UAAK,KAAK,EAAzB,QAAiB,CAAF,CAAW;gBAChC,6BACO,IAAI,KACP,KAAK,wBACE,KAAK,CAAC,KAAK,KACd,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAEvD;YACL,CAAC;iBAAM,CAAC;gBACI,IAAA,IAAI,GAAc,KAAK,KAAnB,EAAK,IAAI,UAAK,KAAK,EAAzB,QAAiB,CAAF,CAAW;gBAChC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAA;IACD,IAAM,gBAAgB,GAAG,UAAC,QAAa;QACnC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC1F,CAAC,CAAA;IACD,IACI,OAAO,iBAAiB,KAAK,QAAQ;QACrC,iBAAiB,IAAI,iBAAiB,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EACrE,CAAC;QACC,IAAM,QAAM,GAAwB,EAAE,CAAC;QACvC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,UAAC,EAAoB;gBAAnB,UAAU,QAAA,EAAE,MAAM,QAAA;YAC1D,QAAM,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,OAAO,QAAM,CAAC;IAClB,CAAC;IACD,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-react",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@types/node": "^20.14.9",
|
|
29
29
|
"@types/react": "^18.3.3",
|
|
30
30
|
"@types/react-dom": "^18.3.0",
|
|
31
|
+
"@types/xxhashjs": "^0.2.4",
|
|
31
32
|
"typescript": "^5.5.2"
|
|
32
33
|
},
|
|
33
34
|
"exports": {
|
|
@@ -76,6 +77,6 @@
|
|
|
76
77
|
],
|
|
77
78
|
"dependencies": {
|
|
78
79
|
"generaltranslation": "^2.0.66",
|
|
79
|
-
"
|
|
80
|
+
"xxhashjs": "^0.2.2"
|
|
80
81
|
}
|
|
81
82
|
}
|