Comparing version 1.2.4 to 1.2.5
@@ -37,5 +37,5 @@ export interface Options { | ||
*/ | ||
export declare class Resource { | ||
export declare class Resource<ID> { | ||
/** The resource ID */ | ||
readonly id: string; | ||
readonly id: ID; | ||
/** The full size of the resource */ | ||
@@ -48,5 +48,5 @@ readonly size: number; | ||
/** The resource ID */ | ||
id: string, | ||
id: ID, | ||
/** The full size of the resource */ | ||
size: number, options: Options, resources?: Map<string, Resource | undefined>); | ||
size: number, options: Options, resources?: Map<ID, Resource<ID> | undefined>); | ||
/** Combines adjacent regions and combines adjacent ranges within a region */ | ||
@@ -53,0 +53,0 @@ collect(): void; |
@@ -7,3 +7,3 @@ import * as cache from './cache.js'; | ||
/** @deprecated Use `cache.Resource` */ | ||
export type ResourceCache = cache.Resource; | ||
export type ResourceCache = cache.Resource<string>; | ||
/** @deprecated Use `cache.Range` */ | ||
@@ -16,3 +16,3 @@ export type CacheRange = cache.Range; | ||
*/ | ||
export declare const resourcesCache: Map<string, cache.Resource | undefined>; | ||
export declare const resourcesCache: Map<string, cache.Resource<string> | undefined>; | ||
export type Issue = { | ||
@@ -19,0 +19,0 @@ tag: 'status'; |
{ | ||
"name": "utilium", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Typescript utilities", | ||
@@ -5,0 +5,0 @@ "funding": { |
@@ -44,3 +44,3 @@ /** A ranged cache */ | ||
*/ | ||
export class Resource { | ||
export class Resource<ID> { | ||
/** Regions used to reduce unneeded allocations. Think of sparse arrays. */ | ||
@@ -51,7 +51,7 @@ public readonly regions: Region[] = []; | ||
/** The resource ID */ | ||
public readonly id: string, | ||
public readonly id: ID, | ||
/** The full size of the resource */ | ||
public readonly size: number, | ||
protected readonly options: Options, | ||
resources?: Map<string, Resource | undefined> | ||
resources?: Map<ID, Resource<ID> | undefined> | ||
) { | ||
@@ -58,0 +58,0 @@ options.sparse ??= true; |
@@ -12,3 +12,3 @@ /* Utilities for `fetch` when using range requests. It also allows you to handle errors easier */ | ||
/** @deprecated Use `cache.Resource` */ | ||
export type ResourceCache = cache.Resource; | ||
export type ResourceCache = cache.Resource<string>; | ||
/** @deprecated Use `cache.Range` */ | ||
@@ -24,3 +24,3 @@ export type CacheRange = cache.Range; | ||
*/ | ||
export const resourcesCache = new Map<string, cache.Resource | undefined>(); | ||
export const resourcesCache = new Map<string, cache.Resource<string> | undefined>(); | ||
@@ -27,0 +27,0 @@ export type Issue = { tag: 'status'; response: Response } | { tag: 'buffer'; response: Response; message: string } | { tag: 'fetch' | 'size'; message: string } | Error; |
125616