11/// <reference types="geojson" />
22
33import {
4+ frameResource ,
5+ HAS_PART ,
6+ isSpecificResource ,
7+ PART_OF ,
8+ type SerializeConfig ,
9+ serialize ,
10+ serializeConfigPresentation2 ,
11+ serializeConfigPresentation3 ,
12+ } from '@iiif/parser' ;
13+ import type { Collection , Manifest , Reference , SpecificResource } from '@iiif/parser/presentation-3/types' ;
14+ import type { CollectionNormalized , ManifestNormalized } from '@iiif/parser/presentation-3-normalized/types' ;
15+ import mitt , { type Emitter } from 'mitt' ;
16+ import { BATCH_ACTIONS , type BatchAction , batchActions , entityActions , metaActions } from './actions' ;
17+ import { createStore , type VaultZustandStore } from './store' ;
18+ import type {
419 ActionFromType ,
520 AllActions ,
621 Entities ,
@@ -10,26 +25,11 @@ import {
1025 RefToNormalized ,
1126 RequestState ,
1227} from './types' ;
13- import { Collection , Manifest , Reference , SpecificResource } from '@iiif/parser/presentation-3/types' ;
14- import {
15- frameResource ,
16- HAS_PART ,
17- isSpecificResource ,
18- PART_OF ,
19- serialize ,
20- SerializeConfig ,
21- serializeConfigPresentation2 ,
22- serializeConfigPresentation3 ,
23- } from '@iiif/parser' ;
24- import { BATCH_ACTIONS , BatchAction , batchActions , entityActions , metaActions } from './actions' ;
25- import { createFetchHelper , areInputsEqual } from './utility' ;
26- import { createStore , VaultZustandStore } from './store' ;
27- import mitt , { Emitter } from 'mitt' ;
28- import { CollectionNormalized , ManifestNormalized } from '@iiif/parser/presentation-3-normalized/types' ;
29- import { isWrapped , ReactiveWrapped , wrapObject } from './utility/objects' ;
28+ import { areInputsEqual , createFetchHelper } from './utility' ;
29+ import { type ActionListFromResource , actionListFromResourceV3 } from './utility/action-list-from-resource' ;
30+ import { defaultFetcher } from './utility/default-fetcher' ;
31+ import { isWrapped , type ReactiveWrapped , wrapObject } from './utility/objects' ;
3032import { resolveType } from './utility/resolve-type' ;
31- import { actionListFromResourceV3 , type ActionListFromResource } from './utility/action-list-from-resource' ;
32- import { defaultFetcher as defaultVaultFetcher } from './utility/default-fetcher' ;
3333
3434export type VaultOptions = {
3535 reducers : Record < string , any > ;
@@ -67,7 +67,7 @@ export class Vault {
6767 this . options = Object . assign (
6868 {
6969 reducers : { } ,
70- customFetcher : this . defaultFetcher ,
70+ customFetcher : defaultFetcher ,
7171 enableDevtools : true ,
7272 } ,
7373 options || { }
@@ -92,7 +92,7 @@ export class Vault {
9292 return actionListFromResourceV3 ;
9393 }
9494
95- defaultFetcher = defaultVaultFetcher ;
95+ defaultFetcher = defaultFetcher ;
9696
9797 batch ( cb : ( vault : this) => void ) {
9898 this . isBatching = true ;
@@ -141,12 +141,18 @@ export class Vault {
141141 if ( ! this . isBatching ) {
142142 if ( action . type === BATCH_ACTIONS ) {
143143 for ( const realAction of action . payload . actions ) {
144- this . emitter . emit ( realAction . type , { action : realAction , state : this . store . getState ( ) } ) ;
144+ this . emitter . emit ( realAction . type , {
145+ action : realAction ,
146+ state : this . store . getState ( ) ,
147+ } ) ;
145148 }
146149 this . store . dispatch ( action ) ;
147150 const state = this . getState ( ) ;
148151 for ( const realAction of action . payload . actions ) {
149- this . emitter . emit ( `after:${ realAction . type } ` , { action : realAction , state } ) ;
152+ this . emitter . emit ( `after:${ realAction . type } ` , {
153+ action : realAction ,
154+ state,
155+ } ) ;
150156 }
151157 return ;
152158 }
@@ -198,7 +204,10 @@ export class Vault {
198204 type ?: string | GetOptions ,
199205 options : GetOptions = { }
200206 ) : RefToNormalized < R > | RefToNormalized < R > [ ] {
201- return this . get < R > ( reference as any , type as any , { ...options , skipSelfReturn : false } ) ;
207+ return this . get < R > ( reference as any , type as any , {
208+ ...options ,
209+ skipSelfReturn : false ,
210+ } ) ;
202211 }
203212
204213 get < R extends { type ?: string } > (
0 commit comments