@websolutespa/bom-mixer-store 1.6.0 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @websolutespa/bom-mixer-store
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 28e86bd: Modified: IPage, Store services & decorators
8
+ - Updated dependencies [28e86bd]
9
+ - @websolutespa/bom-core@1.7.0
10
+
3
11
  ## 1.6.0
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FetchRequestOptions, ISchema, IStore, QueryParams, IUndecoratedMenu, IMenu, IRoute, IEntity, JsonService, IMemoryStore, IQuerable, IEquatable, IPagedResult } from '@websolutespa/bom-core';
1
+ import { FetchRequestOptions, ICategorized, IStore, QueryParams, ICategory, ISchema, IUndecoratedMenu, IMenu, IRoute, IEquatable, IEntity, JsonService, IMemoryStore, IQuerable, IPagedResult } from '@websolutespa/bom-core';
2
2
  import { NextApiRequest, NextApiResponse } from 'next';
3
3
  import { NextRequest } from 'next/server';
4
4
 
@@ -14,6 +14,13 @@ declare function errorHandler(error: any, response: NextApiResponse): Promise<an
14
14
 
15
15
  declare function fromCache<T = unknown>(callback: () => Promise<T>, key?: string): Promise<T>;
16
16
 
17
+ declare function decorateCategory_<T extends ICategorized = ICategorized>(store: IStore, item: T, params?: QueryParams): Promise<T | (T & {
18
+ category: ICategory;
19
+ })>;
20
+ declare function decorateCategories_<T extends ICategorized = ICategorized>(store: IStore, items: T[], params?: QueryParams): Promise<(T | (T & {
21
+ category: ICategory;
22
+ }))[]>;
23
+
17
24
  declare function decorateHref_<T extends ISchema = ISchema>(store: IStore, item: T, params?: QueryParams): Promise<T | T & {
18
25
  href: string | null;
19
26
  }>;
@@ -21,8 +28,8 @@ declare function decorateHrefs_<T extends ISchema = ISchema>(store: IStore, item
21
28
  href: string | null;
22
29
  })[]>;
23
30
 
24
- declare function localizeItem_<B>(item: B, params?: QueryParams): Promise<B>;
25
- declare function localizeItems_<B>(items: B[], params?: QueryParams): Promise<B[]>;
31
+ declare function decorateLocalizable_<B>(item: B, params?: QueryParams): Promise<B>;
32
+ declare function decorateLocalizables_<B>(items: B[], params?: QueryParams): Promise<B[]>;
26
33
 
27
34
  declare function decorateMenu_(store: IStore, item: IUndecoratedMenu, params: {
28
35
  market: string;
@@ -37,9 +44,17 @@ declare const MAX_INT = 1000000000000;
37
44
  declare function decorateNav_<T extends ISchema = ISchema>(store: IStore, item: T, params?: QueryParams, routes?: IRoute[]): Promise<T>;
38
45
  declare function decorateNavs_<T extends ISchema = ISchema>(store: IStore, items: T[], params?: QueryParams): Promise<T[]>;
39
46
 
40
- declare const SERVICE_DEFAULT_DEPTH = 2;
47
+ declare function optimizeOne_<T extends ICategorized = ICategorized>(item: T): Promise<T>;
48
+ declare function optimizeMany_<T extends ICategorized = ICategorized>(items: T[]): Promise<T[]>;
49
+
50
+ declare const SERVICE_DEFAULT_DEPTH = 3;
41
51
  declare function decorateRelation_<T extends ISchema = ISchema>(store: IStore, item: T, params?: QueryParams): Promise<T>;
42
52
  declare function decorateRelations_<T extends ISchema = ISchema>(store: IStore, items: T[], params?: QueryParams): Promise<T[]>;
53
+ type IPageResolvedRelation = {
54
+ relationTo: string;
55
+ value: IEquatable | IEquatable[];
56
+ resolvedValue: ICategorized | ICategorized[] | null;
57
+ };
43
58
 
44
59
  declare function decorateSchema_<T extends ISchema = ISchema>(store: IStore, item: T, schema: string): Promise<T | T & {
45
60
  schema: string;
@@ -90,7 +105,7 @@ declare class MockMenuService<T extends IEntity = IEntity> extends MockService<T
90
105
  protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
91
106
  }
92
107
 
93
- declare class MockPageService<T extends IEntity = IEntity> extends MockService<T> {
108
+ declare class MockPageService<T extends ICategorized = ICategorized> extends MockService<T> {
94
109
  protected decorateOne_<B extends T = T>(item: B, params?: QueryParams): Promise<B>;
95
110
  protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
96
111
  }
@@ -132,7 +147,7 @@ declare class RemoteMenuService<T extends IEntity = IEntity> extends RemoteServi
132
147
  protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
133
148
  }
134
149
 
135
- declare class RemotePageService<T extends IEntity = IEntity> extends RemoteService<T> {
150
+ declare class RemotePageService<T extends ICategorized = ICategorized> extends RemoteService<T> {
136
151
  protected decorateOne_<B extends T = T>(item: B, params?: QueryParams): Promise<B>;
137
152
  protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
138
153
  }
@@ -220,4 +235,4 @@ declare function findRoute(store: IStore, pathname: string, href: string): Promi
220
235
 
221
236
  declare function getStore<T extends IStore>(): Promise<T>;
222
237
 
223
- export { ApiRequestOptions, BuildStrategy, COLLECTIONS, IApiHandler, ICrudMethod, IField, IHandler, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, MapTo, MockMenuService, MockPageService, MockService, NextPhase, RemoteMenuService, RemotePageService, RemoteService, RemoteServiceStrategy, SERVICE_DEFAULT_DEPTH, STATIC_COLLECTIONS, StaticService, StaticServiceConfig, StaticServiceSrc, StoreStrategy, apiHandler, buildStrategy, collectionDelete, collectionGet, collectionPatch, collectionPost, decorateHref_, decorateHrefs_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, decorateStaticRelation_, decorateStaticRelations_, defaultApiRequestOptions, errorHandler, findRoute, fromCache, getDefaultApiRequestOptions, getLocalApiUrl, getMockStore, getMockStoreFromData_, getRemoteStore, getStore, isApiRequest, isNextRequest, isStaticRequest, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, localizeItem_, localizeItems_, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, mockHandler, nextPhase, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, routePost, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeHandler, storeIndexHandler, storeStrategy };
238
+ export { ApiRequestOptions, BuildStrategy, COLLECTIONS, IApiHandler, ICrudMethod, IField, IHandler, IPageResolvedRelation, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, MapTo, MockMenuService, MockPageService, MockService, NextPhase, RemoteMenuService, RemotePageService, RemoteService, RemoteServiceStrategy, SERVICE_DEFAULT_DEPTH, STATIC_COLLECTIONS, StaticService, StaticServiceConfig, StaticServiceSrc, StoreStrategy, apiHandler, buildStrategy, collectionDelete, collectionGet, collectionPatch, collectionPost, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateLocalizable_, decorateLocalizables_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, decorateStaticRelation_, decorateStaticRelations_, defaultApiRequestOptions, errorHandler, findRoute, fromCache, getDefaultApiRequestOptions, getLocalApiUrl, getMockStore, getMockStoreFromData_, getRemoteStore, getStore, isApiRequest, isNextRequest, isStaticRequest, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, mockHandler, nextPhase, optimizeMany_, optimizeOne_, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, routePost, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeHandler, storeIndexHandler, storeStrategy };