utilium 1.2.4 → 1.2.5
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/dist/cache.d.ts +4 -4
- package/dist/requests.d.ts +2 -2
- package/package.json +1 -1
- package/src/cache.ts +3 -3
- package/src/requests.ts +2 -2
package/dist/cache.d.ts
CHANGED
@@ -34,9 +34,9 @@ export interface Region {
|
|
34
34
|
* The cache for a specific resource
|
35
35
|
* @internal
|
36
36
|
*/
|
37
|
-
export declare class Resource {
|
37
|
+
export declare class Resource<ID> {
|
38
38
|
/** The resource ID */
|
39
|
-
readonly id:
|
39
|
+
readonly id: ID;
|
40
40
|
/** The full size of the resource */
|
41
41
|
readonly size: number;
|
42
42
|
protected readonly options: Options;
|
@@ -44,9 +44,9 @@ export declare class Resource {
|
|
44
44
|
readonly regions: Region[];
|
45
45
|
constructor(
|
46
46
|
/** The resource ID */
|
47
|
-
id:
|
47
|
+
id: ID,
|
48
48
|
/** The full size of the resource */
|
49
|
-
size: number, options: Options, resources?: Map<
|
49
|
+
size: number, options: Options, resources?: Map<ID, Resource<ID> | undefined>);
|
50
50
|
/** Combines adjacent regions and combines adjacent ranges within a region */
|
51
51
|
collect(): void;
|
52
52
|
/** Takes an initial range and finds the sub-ranges that are not in the cache */
|
package/dist/requests.d.ts
CHANGED
@@ -4,7 +4,7 @@ export type ResourceCacheOptions = cache.Options;
|
|
4
4
|
/** @deprecated Use `cache.Resource` */
|
5
5
|
export declare const ResourceCache: typeof cache.Resource;
|
6
6
|
/** @deprecated Use `cache.Resource` */
|
7
|
-
export type ResourceCache = cache.Resource
|
7
|
+
export type ResourceCache = cache.Resource<string>;
|
8
8
|
/** @deprecated Use `cache.Range` */
|
9
9
|
export type CacheRange = cache.Range;
|
10
10
|
/** @deprecated Use `cache.Options` */
|
@@ -12,7 +12,7 @@ export type CacheOptions = cache.Options;
|
|
12
12
|
/**
|
13
13
|
* @internal
|
14
14
|
*/
|
15
|
-
export declare const resourcesCache: Map<string, cache.Resource | undefined>;
|
15
|
+
export declare const resourcesCache: Map<string, cache.Resource<string> | undefined>;
|
16
16
|
export type Issue = {
|
17
17
|
tag: 'status';
|
18
18
|
response: Response;
|
package/package.json
CHANGED
package/src/cache.ts
CHANGED
@@ -41,17 +41,17 @@ export interface Region {
|
|
41
41
|
* The cache for a specific resource
|
42
42
|
* @internal
|
43
43
|
*/
|
44
|
-
export class Resource {
|
44
|
+
export class Resource<ID> {
|
45
45
|
/** Regions used to reduce unneeded allocations. Think of sparse arrays. */
|
46
46
|
public readonly regions: Region[] = [];
|
47
47
|
|
48
48
|
public constructor(
|
49
49
|
/** The resource ID */
|
50
|
-
public readonly id:
|
50
|
+
public readonly id: ID,
|
51
51
|
/** The full size of the resource */
|
52
52
|
public readonly size: number,
|
53
53
|
protected readonly options: Options,
|
54
|
-
resources?: Map<
|
54
|
+
resources?: Map<ID, Resource<ID> | undefined>
|
55
55
|
) {
|
56
56
|
options.sparse ??= true;
|
57
57
|
if (!options.sparse) this.regions.push({ offset: 0, data: new Uint8Array(size), ranges: [] });
|
package/src/requests.ts
CHANGED
@@ -9,7 +9,7 @@ export type ResourceCacheOptions = cache.Options;
|
|
9
9
|
/** @deprecated Use `cache.Resource` */
|
10
10
|
export const ResourceCache = cache.Resource;
|
11
11
|
/** @deprecated Use `cache.Resource` */
|
12
|
-
export type ResourceCache = cache.Resource
|
12
|
+
export type ResourceCache = cache.Resource<string>;
|
13
13
|
/** @deprecated Use `cache.Range` */
|
14
14
|
export type CacheRange = cache.Range;
|
15
15
|
/** @deprecated Use `cache.Options` */
|
@@ -20,7 +20,7 @@ export type CacheOptions = cache.Options;
|
|
20
20
|
/**
|
21
21
|
* @internal
|
22
22
|
*/
|
23
|
-
export const resourcesCache = new Map<string, cache.Resource | undefined>();
|
23
|
+
export const resourcesCache = new Map<string, cache.Resource<string> | undefined>();
|
24
24
|
|
25
25
|
export type Issue = { tag: 'status'; response: Response } | { tag: 'buffer'; response: Response; message: string } | { tag: 'fetch' | 'size'; message: string } | Error;
|
26
26
|
|