@websolutespa/bom-mixer-store 1.4.6 → 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 +16 -0
- package/dist/index.d.ts +25 -7
- package/dist/index.js +206 -110
- package/dist/index.mjs +161 -70
- 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.service.ts +7 -0
- package/src/remote/remote.store.ts +4 -4
- package/src/static/static.service.ts +3 -3
- package/src/store/store.handler.ts +0 -107
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
11
|
+
## 1.6.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f664993: Added: useLivePreview
|
|
16
|
+
- Updated dependencies [6cbf4cb]
|
|
17
|
+
- @websolutespa/bom-core@0.6.7
|
|
18
|
+
|
|
3
19
|
## 1.4.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
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
|
}
|
|
@@ -107,6 +122,9 @@ declare function mockHandler(): any;
|
|
|
107
122
|
declare function getMockStoreFromData_<T extends IStore>(data?: IMemoryStore): T;
|
|
108
123
|
declare function getMockStore<T extends IStore = IStore>(): Promise<T>;
|
|
109
124
|
|
|
125
|
+
declare const RemoteServiceStrategy: {
|
|
126
|
+
draft: boolean;
|
|
127
|
+
};
|
|
110
128
|
/**
|
|
111
129
|
* This service handle call to remote api (bowl or over)
|
|
112
130
|
*/
|
|
@@ -129,7 +147,7 @@ declare class RemoteMenuService<T extends IEntity = IEntity> extends RemoteServi
|
|
|
129
147
|
protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
|
|
130
148
|
}
|
|
131
149
|
|
|
132
|
-
declare class RemotePageService<T extends
|
|
150
|
+
declare class RemotePageService<T extends ICategorized = ICategorized> extends RemoteService<T> {
|
|
133
151
|
protected decorateOne_<B extends T = T>(item: B, params?: QueryParams): Promise<B>;
|
|
134
152
|
protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
|
|
135
153
|
}
|
|
@@ -217,4 +235,4 @@ declare function findRoute(store: IStore, pathname: string, href: string): Promi
|
|
|
217
235
|
|
|
218
236
|
declare function getStore<T extends IStore>(): Promise<T>;
|
|
219
237
|
|
|
220
|
-
export { ApiRequestOptions, BuildStrategy, COLLECTIONS, IApiHandler, ICrudMethod, IField, IHandler, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, MapTo, MockMenuService, MockPageService, MockService, NextPhase, RemoteMenuService, RemotePageService, RemoteService, 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 };
|