@@ -16,11 +16,11 @@ import {
1616 type ContentCompressionTypes ,
1717} from '../../models/compression/index.js' ;
1818import {
19- isKVAssetVariantMetadata ,
20- type KVAssetEntry ,
21- type KVAssetEntryMap ,
22- type KVAssetVariantMetadata ,
23- } from '../../models/assets/kvstore-assets .js' ;
19+ isAssetVariantMetadata ,
20+ type AssetEntry ,
21+ type AssetEntryMap ,
22+ type AssetVariantMetadata ,
23+ } from '../../models/assets/index .js' ;
2424import { type IndexMetadata } from '../../models/server/index.js' ;
2525import { isExpired } from '../../models/time/index.js' ;
2626import { getKVStoreEntry } from '../util/kv-store.js' ;
@@ -29,7 +29,7 @@ import { checkIfNoneMatch, getIfNoneMatchHeader } from './serve-preconditions/if
2929
3030type KVAssetVariant = {
3131 kvStoreEntry : KVStoreEntry ,
32- } & KVAssetVariantMetadata ;
32+ } & AssetVariantMetadata ;
3333
3434export function buildHeadersSubset ( responseHeaders : Headers , keys : Readonly < string [ ] > ) {
3535 const resultHeaders = new Headers ( ) ;
@@ -98,7 +98,7 @@ export class PublisherServer {
9898 settingsCached : PublisherServerConfigNormalized | null | undefined ;
9999
100100 // Cached index
101- kvAssetsIndex : KVAssetEntryMap | null | undefined ;
101+ kvAssetsIndex : AssetEntryMap | null | undefined ;
102102
103103 setActiveCollectionName ( collectionName : string ) {
104104 this . activeCollectionName = collectionName ;
@@ -180,11 +180,11 @@ export class PublisherServer {
180180 return null ;
181181 }
182182
183- this . kvAssetsIndex = ( await indexFile . json ( ) ) as KVAssetEntryMap ;
183+ this . kvAssetsIndex = ( await indexFile . json ( ) ) as AssetEntryMap ;
184184 return this . kvAssetsIndex ;
185185 }
186186
187- async getMatchingAsset ( assetKey : string , applyAuto : boolean = false ) : Promise < KVAssetEntry | null > {
187+ async getMatchingAsset ( assetKey : string , applyAuto : boolean = false ) : Promise < AssetEntry | null > {
188188
189189 const serverConfig = await this . getServerConfig ( ) ;
190190 if ( serverConfig == null ) {
@@ -309,7 +309,7 @@ export class PublisherServer {
309309 } ) ;
310310 }
311311
312- handlePreconditions ( request : Request , asset : KVAssetEntry , responseHeaders : Headers ) : Response | null {
312+ handlePreconditions ( request : Request , asset : AssetEntry , responseHeaders : Headers ) : Response | null {
313313 // Handle preconditions according to https://httpwg.org/specs/rfc9110.html#rfc.section.13.2.2
314314
315315 // A recipient cache or origin server MUST evaluate the request preconditions defined by this specification in the following order:
@@ -370,7 +370,7 @@ export class PublisherServer {
370370 return null ;
371371 }
372372
373- public async loadKvAssetVariant ( entry : KVAssetEntry , variant : ContentCompressionTypes | null ) : Promise < KVAssetVariant | null > {
373+ public async loadKvAssetVariant ( entry : AssetEntry , variant : ContentCompressionTypes | null ) : Promise < KVAssetVariant | null > {
374374
375375 const kvStore = new KVStore ( this . kvStoreName ) ;
376376
@@ -392,7 +392,7 @@ export class PublisherServer {
392392 } catch {
393393 return null ;
394394 }
395- if ( ! isKVAssetVariantMetadata ( metadata ) ) {
395+ if ( ! isAssetVariantMetadata ( metadata ) ) {
396396 return null ;
397397 }
398398 if ( metadata . size == null ) {
@@ -404,7 +404,7 @@ export class PublisherServer {
404404 } ;
405405 }
406406
407- private async findKVAssetVariantForAcceptEncodingsGroups ( entry : KVAssetEntry , acceptEncodingsGroups : ContentCompressionTypes [ ] [ ] = [ ] ) : Promise < KVAssetVariant > {
407+ private async findKVAssetVariantForAcceptEncodingsGroups ( entry : AssetEntry , acceptEncodingsGroups : ContentCompressionTypes [ ] [ ] = [ ] ) : Promise < KVAssetVariant > {
408408
409409 if ( ! entry . key . startsWith ( 'sha256:' ) ) {
410410 throw new TypeError ( `Key must start with 'sha256:': ${ entry . key } ` ) ;
@@ -445,7 +445,7 @@ export class PublisherServer {
445445 return baseKvStoreEntry ;
446446 }
447447
448- async serveAsset ( request : Request , asset : KVAssetEntry , init ?: AssetInit ) : Promise < Response > {
448+ async serveAsset ( request : Request , asset : AssetEntry , init ?: AssetInit ) : Promise < Response > {
449449
450450 const headers = new Headers ( init ?. headers ) ;
451451 headers . set ( 'Content-Type' , asset . contentType ) ;
0 commit comments