@atlaspack/domain-sharding 2.14.2-typescript-b27501580.0 → 2.14.2-typescript-5b4d3ad41.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/lib/index.d.ts +29 -0
- package/package.json +2 -2
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a bounded numeric hash in [0, maxShards)
|
|
3
|
+
*/
|
|
4
|
+
declare function getDomainShardIndex(str: string, maxShards: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Given a shard number, inserts that shard in the expected pattern within the
|
|
7
|
+
* domain
|
|
8
|
+
*/
|
|
9
|
+
declare function applyShardToDomain(domain: string, shard: number): string;
|
|
10
|
+
/**
|
|
11
|
+
* Takes an absolute URL and applies a shard to the top level subdomain.
|
|
12
|
+
* The shard number is based on a hash of the file name, which is
|
|
13
|
+
* the content after the last / in the URL.
|
|
14
|
+
*
|
|
15
|
+
* Unlike `shardUrl`, this function will always apply sharding, without any
|
|
16
|
+
* conditional logic.
|
|
17
|
+
*/
|
|
18
|
+
declare function shardUrlUnchecked(url: string, maxShards: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Takes an absolute URL and applies a shard to the top level subdomain.
|
|
21
|
+
* The shard number is based on a hash of the file name, which is
|
|
22
|
+
* the content after the last / in the URL.
|
|
23
|
+
*
|
|
24
|
+
* This function only applies the sharding if the
|
|
25
|
+
* __ATLASPACK_ENABLE_DOMAIN_SHARDS global variable has been set to true
|
|
26
|
+
*/
|
|
27
|
+
declare function shardUrl(url: string, maxShards: number): string;
|
|
28
|
+
export { shardUrl, shardUrlUnchecked, getDomainShardIndex, applyShardToDomain };
|
|
29
|
+
export declare const domainShardingKey = "__ATLASPACK_ENABLE_DOMAIN_SHARDS";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/domain-sharding",
|
|
3
|
-
"version": "2.14.2-typescript-
|
|
3
|
+
"version": "2.14.2-typescript-5b4d3ad41.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"node": ">= 16.0.0"
|
|
20
20
|
},
|
|
21
21
|
"type": "commonjs",
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "5b4d3ad41ffa002b989ba77271bb3010a1f05b2a"
|
|
23
23
|
}
|