@metriport/shared 0.34.7-alpha.0 → 0.34.8-alpha.0
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metriport/shared",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.8-alpha.0",
|
|
4
4
|
"description": "Common code shared across packages - by Metriport Inc.",
|
|
5
5
|
"author": "Metriport Inc. <contact@metriport.com>",
|
|
6
6
|
"homepage": "https://metriport.com/",
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"ts-jest": "29.4.11",
|
|
165
165
|
"typescript": "6.0.3"
|
|
166
166
|
},
|
|
167
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "6210fe2c3a77f1af7d6080e74832897bef2ad235"
|
|
168
168
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** SQS max delivery delay is 15 minutes (900 seconds). Delay must not exceed this. */
|
|
2
|
-
export declare const SQS_MAX_DELAY_SECONDS = 900;
|
|
3
|
-
/**
|
|
4
|
-
* Maps a string (e.g. cxId or UUID v4) to a delivery delay in seconds for SQS,
|
|
5
|
-
* evenly distributed across 0 to 15 minutes (max). Same input always gets the same delay (deterministic).
|
|
6
|
-
*
|
|
7
|
-
* @param id - Any string identifier (e.g. cxId, UUID v4)
|
|
8
|
-
* @returns Delay in seconds in [0, 900] (≤ 15 min, SQS max)
|
|
9
|
-
*/
|
|
10
|
-
export declare function uuidToDelaySeconds(id: string, maxDelaySeconds?: number): number;
|
|
11
|
-
//# sourceMappingURL=sqs-delay-from-uuid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqs-delay-from-uuid.d.ts","sourceRoot":"","sources":["../../src/util/sqs-delay-from-uuid.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,eAAe,GAAE,MAA8B,GAC9C,MAAM,CAKR"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SQS_MAX_DELAY_SECONDS = void 0;
|
|
4
|
-
exports.uuidToDelaySeconds = uuidToDelaySeconds;
|
|
5
|
-
const node_crypto_1 = require("node:crypto");
|
|
6
|
-
/** SQS max delivery delay is 15 minutes (900 seconds). Delay must not exceed this. */
|
|
7
|
-
exports.SQS_MAX_DELAY_SECONDS = 900;
|
|
8
|
-
/**
|
|
9
|
-
* Maps a string (e.g. cxId or UUID v4) to a delivery delay in seconds for SQS,
|
|
10
|
-
* evenly distributed across 0 to 15 minutes (max). Same input always gets the same delay (deterministic).
|
|
11
|
-
*
|
|
12
|
-
* @param id - Any string identifier (e.g. cxId, UUID v4)
|
|
13
|
-
* @returns Delay in seconds in [0, 900] (≤ 15 min, SQS max)
|
|
14
|
-
*/
|
|
15
|
-
function uuidToDelaySeconds(id, maxDelaySeconds = exports.SQS_MAX_DELAY_SECONDS) {
|
|
16
|
-
const BUCKET_COUNT = maxDelaySeconds + 1; // maxDelaySeconds + 1 → 0..maxDelaySeconds
|
|
17
|
-
const hash = (0, node_crypto_1.createHash)("sha256").update(id, "utf8").digest();
|
|
18
|
-
const value = hash.readUInt32BE(0) * 0x100000000 + hash.readUInt32BE(4);
|
|
19
|
-
return value % BUCKET_COUNT; // always in [0, maxDelaySeconds]
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=sqs-delay-from-uuid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqs-delay-from-uuid.js","sourceRoot":"","sources":["../../src/util/sqs-delay-from-uuid.ts"],"names":[],"mappings":";;;;AAAA,6CAAyC;AAEzC,sFAAsF;AACzE,QAAA,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;GAMG;AACH,4BACE,EAAU,EACV,eAAe,GAAW,QAAA,qBAAqB;IAE/C,MAAM,YAAY,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,2CAA2C;IACrF,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,KAAK,GAAG,YAAY,CAAC,CAAC,iCAAiC;AAChE,CAAC"}
|