@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 +8 -0
- package/dist/index.d.ts +22 -7
- package/dist/index.js +197 -109
- package/dist/index.mjs +153 -69
- package/package.json +1 -1
- package/src/decorators/category.ts +49 -0
- package/src/decorators/index.ts +3 -1
- package/src/decorators/{localize.ts → localizable.ts} +2 -2
- package/src/decorators/menu.ts +3 -147
- package/src/decorators/optimize.ts +32 -0
- package/src/decorators/relation.ts +52 -74
- package/src/mock/mock-menu.service.ts +3 -3
- package/src/mock/mock-page.service.ts +11 -5
- package/src/mock/mock.service.ts +3 -3
- package/src/mock/mock.store.ts +15 -14
- package/src/remote/remote-menu.service.ts +3 -3
- package/src/remote/remote-page.service.ts +9 -3
- package/src/remote/remote.store.ts +3 -3
- package/src/static/static.service.ts +3 -3
- package/src/store/store.handler.ts +0 -107
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchRequestOptions,
|
|
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
|
|
25
|
-
declare function
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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 };
|