@equinor/fusion-framework-module-bookmark 1.0.7 → 1.0.10
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 +33 -0
- package/LICENSE +21 -0
- package/dist/esm/bookmark-config-builder.js.map +1 -1
- package/dist/esm/client/bookmarkClient.js.map +1 -1
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -0
- package/package.json +45 -46
- package/src/bookmark-config-builder.ts +11 -5
- package/src/bookmark-provider.ts +3 -3
- package/src/client/bookmarkActions.ts +6 -6
- package/src/client/bookmarkClient.ts +17 -18
- package/src/client/bookmarkFlows.ts +9 -9
- package/src/configurator.ts +10 -10
- package/src/enable-bookmark.ts +2 -2
- package/src/version.ts +2 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "1.0.10";
|
package/package.json
CHANGED
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc -b",
|
|
21
|
-
"prepack": "yarn build"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [],
|
|
24
|
-
"author": "",
|
|
25
|
-
"license": "ISC",
|
|
26
|
-
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/equinor/fusion-framework.git",
|
|
32
|
-
"directory": "packages/modules/context"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@equinor/fusion-query": "^3.0.2"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@equinor/fusion-framework-module": "^4.2.1",
|
|
39
|
-
"@equinor/fusion-framework-module-event": "^4.0.2",
|
|
40
|
-
"@equinor/fusion-framework-module-services": "^3.1.3",
|
|
41
|
-
"rxjs": "^7.5.7",
|
|
42
|
-
"typescript": "^5.1.3"
|
|
43
|
-
},
|
|
44
|
-
"peerDependencies": {
|
|
45
|
-
"@equinor/fusion-framework-module": ">=1.2.5",
|
|
46
|
-
"rxjs": "^7.5.7"
|
|
2
|
+
"name": "@equinor/fusion-framework-module-bookmark",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/esm/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/esm/index.js",
|
|
8
|
+
"./package.json": "./package.json",
|
|
9
|
+
"./utils": "./dist/esm/utils/index.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"typesVersions": {
|
|
13
|
+
"*": {
|
|
14
|
+
"utils": [
|
|
15
|
+
"dist/types/utils/index.d.ts"
|
|
16
|
+
]
|
|
47
17
|
}
|
|
48
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/equinor/fusion-framework.git",
|
|
28
|
+
"directory": "packages/modules/context"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"rxjs": "^7.8.1",
|
|
32
|
+
"@equinor/fusion-framework-module": "^4.2.4",
|
|
33
|
+
"@equinor/fusion-observable": "^8.1.1",
|
|
34
|
+
"@equinor/fusion-query": "^3.0.7"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"typescript": "^5.1.3",
|
|
38
|
+
"@equinor/fusion-framework-module-app": "^5.2.4",
|
|
39
|
+
"@equinor/fusion-framework-module-context": "^4.0.13",
|
|
40
|
+
"@equinor/fusion-framework-module-event": "^4.0.5",
|
|
41
|
+
"@equinor/fusion-framework-module-http": "^5.0.6",
|
|
42
|
+
"@equinor/fusion-framework-module-services": "^3.1.5"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -b"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
import { Bookmark, GetAllBookmarksParameters, GetBookmarkParameters, SourceSystem } from './types';
|
|
19
19
|
|
|
20
20
|
export type BookmarkConfigBuilderCallback = <TDeps extends Array<AnyModule> = []>(
|
|
21
|
-
builder: BookmarkConfigBuilder<
|
|
21
|
+
builder: BookmarkConfigBuilder<
|
|
22
|
+
TDeps,
|
|
23
|
+
ModuleInitializerArgs<IBookmarkModuleConfigurator, TDeps>
|
|
24
|
+
>,
|
|
22
25
|
) => void | Promise<void>;
|
|
23
26
|
|
|
24
27
|
export class BookmarkConfigBuilder<
|
|
@@ -27,15 +30,18 @@ export class BookmarkConfigBuilder<
|
|
|
27
30
|
TInit extends ModuleInitializerArgs<any, any> = ModuleInitializerArgs<
|
|
28
31
|
BookmarkModuleConfigurator,
|
|
29
32
|
TModules
|
|
30
|
-
|
|
33
|
+
>,
|
|
31
34
|
> {
|
|
32
35
|
#init: TInit;
|
|
33
|
-
constructor(
|
|
36
|
+
constructor(
|
|
37
|
+
init: TInit,
|
|
38
|
+
public config: Partial<BookmarkModuleConfig> = {},
|
|
39
|
+
) {
|
|
34
40
|
this.#init = init;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
requireInstance<TKey extends string = Extract<keyof Modules, string>>(
|
|
38
|
-
module: TKey
|
|
44
|
+
module: TKey,
|
|
39
45
|
): Promise<ModuleType<Modules[TKey]>>;
|
|
40
46
|
|
|
41
47
|
requireInstance<T>(module: string): Promise<T>;
|
|
@@ -81,7 +87,7 @@ export class BookmarkConfigBuilder<
|
|
|
81
87
|
* @memberof BookmarkConfigBuilder
|
|
82
88
|
*/
|
|
83
89
|
serCustomBookmarkApiClient(
|
|
84
|
-
client: BookmarksApiClient<'fetch', IHttpClient, Bookmark<unknown
|
|
90
|
+
client: BookmarksApiClient<'fetch', IHttpClient, Bookmark<unknown>>,
|
|
85
91
|
) {
|
|
86
92
|
if (this.config.clientConfiguration) {
|
|
87
93
|
this.config.clientConfiguration.client = client;
|
package/src/bookmark-provider.ts
CHANGED
|
@@ -88,7 +88,7 @@ export interface IBookmarkModuleProvider {
|
|
|
88
88
|
*/
|
|
89
89
|
updateBookmarkAsync<T>(
|
|
90
90
|
bookmark: PatchBookmark<T>,
|
|
91
|
-
options?: UpdateBookmarkOptions
|
|
91
|
+
options?: UpdateBookmarkOptions,
|
|
92
92
|
): Promise<Bookmark<T> | undefined>;
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -195,7 +195,7 @@ export class BookmarkModuleProvider implements IBookmarkModuleProvider {
|
|
|
195
195
|
|
|
196
196
|
if (this.#event) {
|
|
197
197
|
this.#subscriptions.add(
|
|
198
|
-
this.#event.addEventListener('onCurrentAppChanged', this.#clearStateCreators)
|
|
198
|
+
this.#event.addEventListener('onCurrentAppChanged', this.#clearStateCreators),
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
@@ -222,7 +222,7 @@ export class BookmarkModuleProvider implements IBookmarkModuleProvider {
|
|
|
222
222
|
|
|
223
223
|
public async updateBookmarkAsync<T>(
|
|
224
224
|
bookmark: PatchBookmark<T>,
|
|
225
|
-
options?: UpdateBookmarkOptions
|
|
225
|
+
options?: UpdateBookmarkOptions,
|
|
226
226
|
): Promise<Bookmark<T> | undefined> {
|
|
227
227
|
if (this.#getAppKey() !== bookmark.appKey) {
|
|
228
228
|
return;
|
|
@@ -7,33 +7,33 @@ export const actions = {
|
|
|
7
7
|
'getAll',
|
|
8
8
|
(isValid: boolean) => ({ payload: isValid }),
|
|
9
9
|
(bookmarks: Bookmark[]) => ({ payload: bookmarks }),
|
|
10
|
-
(err: unknown) => ({ payload: err })
|
|
10
|
+
(err: unknown) => ({ payload: err }),
|
|
11
11
|
),
|
|
12
12
|
delete: createAsyncAction(
|
|
13
13
|
'delete',
|
|
14
14
|
(id: string) => ({ payload: id }),
|
|
15
|
-
(id: string) => ({ payload: id })
|
|
15
|
+
(id: string) => ({ payload: id }),
|
|
16
16
|
),
|
|
17
17
|
addFavorite: createAsyncAction(
|
|
18
18
|
'addFavorite',
|
|
19
19
|
(bookmark: Bookmark) => ({ payload: bookmark }),
|
|
20
|
-
(bookmark: Bookmark) => ({ payload: bookmark })
|
|
20
|
+
(bookmark: Bookmark) => ({ payload: bookmark }),
|
|
21
21
|
),
|
|
22
22
|
removeFavorite: createAsyncAction(
|
|
23
23
|
'removeFavorite',
|
|
24
24
|
(id: string) => ({ payload: id }),
|
|
25
|
-
(id: string) => ({ payload: id })
|
|
25
|
+
(id: string) => ({ payload: id }),
|
|
26
26
|
),
|
|
27
27
|
update: createAsyncAction(
|
|
28
28
|
'update',
|
|
29
29
|
(bookmark: PatchBookmark) => ({ payload: bookmark }),
|
|
30
|
-
(bookmark: Bookmark) => ({ payload: bookmark })
|
|
30
|
+
(bookmark: Bookmark) => ({ payload: bookmark }),
|
|
31
31
|
),
|
|
32
32
|
create: createAsyncAction(
|
|
33
33
|
'create',
|
|
34
34
|
(bookmark: CreateBookmark) => ({ payload: bookmark }),
|
|
35
35
|
(bookmark: Bookmark) => ({ payload: bookmark }),
|
|
36
|
-
(err: unknown) => ({ payload: err })
|
|
36
|
+
(err: unknown) => ({ payload: err }),
|
|
37
37
|
),
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
import { IHttpClient } from '@equinor/fusion-framework-module-http';
|
|
7
7
|
|
|
8
8
|
import { BookmarksApiClient } from '@equinor/fusion-framework-module-services/bookmarks';
|
|
9
|
-
import { createState } from '@equinor/fusion-observable';
|
|
10
|
-
import { FlowState } from '@equinor/fusion-observable/src/create-state';
|
|
9
|
+
import { createState, FlowState } from '@equinor/fusion-observable';
|
|
11
10
|
import Query, { type QueryCtorOptions } from '@equinor/fusion-query';
|
|
12
11
|
|
|
13
12
|
import { BehaviorSubject, lastValueFrom, map, Observable, Subscription } from 'rxjs';
|
|
@@ -55,7 +54,7 @@ export class BookmarkClient {
|
|
|
55
54
|
constructor(
|
|
56
55
|
config: BookmarkClientConfig,
|
|
57
56
|
sourceSystem: SourceSystem,
|
|
58
|
-
event?: IEventModuleProvider
|
|
57
|
+
event?: IEventModuleProvider,
|
|
59
58
|
) {
|
|
60
59
|
this.#currentBookmark$ = new BehaviorSubject<Bookmark<unknown> | undefined>(undefined);
|
|
61
60
|
|
|
@@ -82,7 +81,7 @@ export class BookmarkClient {
|
|
|
82
81
|
canBubble: true,
|
|
83
82
|
source: this,
|
|
84
83
|
});
|
|
85
|
-
})
|
|
84
|
+
}),
|
|
86
85
|
);
|
|
87
86
|
}
|
|
88
87
|
}
|
|
@@ -93,7 +92,7 @@ export class BookmarkClient {
|
|
|
93
92
|
|
|
94
93
|
public get bookmarks$(): Observable<Bookmark[]> {
|
|
95
94
|
return this.#state.subject.pipe(
|
|
96
|
-
map((state) => Object.values(state.bookmarks).map((bookmark) => bookmark))
|
|
95
|
+
map((state) => Object.values(state.bookmarks).map((bookmark) => bookmark)),
|
|
97
96
|
);
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -139,7 +138,7 @@ export class BookmarkClient {
|
|
|
139
138
|
.pipe(
|
|
140
139
|
map((bookmark) => {
|
|
141
140
|
return bookmark.value;
|
|
142
|
-
})
|
|
141
|
+
}),
|
|
143
142
|
) as Observable<Bookmark<T>>;
|
|
144
143
|
}
|
|
145
144
|
|
|
@@ -160,7 +159,7 @@ export class BookmarkClient {
|
|
|
160
159
|
detail: action.payload,
|
|
161
160
|
source: this,
|
|
162
161
|
});
|
|
163
|
-
})
|
|
162
|
+
}),
|
|
164
163
|
);
|
|
165
164
|
});
|
|
166
165
|
}
|
|
@@ -182,18 +181,18 @@ export class BookmarkClient {
|
|
|
182
181
|
this.#state.subject.addEffect('create::success', (action) => {
|
|
183
182
|
subscriber.next(action.payload as Bookmark<unknown>);
|
|
184
183
|
subscriber.complete();
|
|
185
|
-
})
|
|
184
|
+
}),
|
|
186
185
|
);
|
|
187
186
|
subscriber.add(
|
|
188
187
|
this.#state.subject.addEffect('create::failure', (action) => {
|
|
189
188
|
subscriber.error(action.payload);
|
|
190
|
-
})
|
|
189
|
+
}),
|
|
191
190
|
);
|
|
192
191
|
});
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
public async createBookmarkAsync(
|
|
196
|
-
bookmark: CreateBookmark<unknown
|
|
195
|
+
bookmark: CreateBookmark<unknown>,
|
|
197
196
|
): Promise<Bookmark<unknown>> {
|
|
198
197
|
return lastValueFrom(this.createBookmark(bookmark));
|
|
199
198
|
}
|
|
@@ -206,7 +205,7 @@ export class BookmarkClient {
|
|
|
206
205
|
subscriber.next(action.payload as Bookmark<T>);
|
|
207
206
|
subscriber.complete();
|
|
208
207
|
this.#queryBookmarkById.cache.invalidate(action.payload.id);
|
|
209
|
-
})
|
|
208
|
+
}),
|
|
210
209
|
);
|
|
211
210
|
});
|
|
212
211
|
}
|
|
@@ -223,7 +222,7 @@ export class BookmarkClient {
|
|
|
223
222
|
subscriber.next(action.payload);
|
|
224
223
|
subscriber.complete();
|
|
225
224
|
this.#queryBookmarkById.cache.invalidate(action.payload);
|
|
226
|
-
})
|
|
225
|
+
}),
|
|
227
226
|
);
|
|
228
227
|
});
|
|
229
228
|
}
|
|
@@ -295,20 +294,20 @@ export class BookmarkClient {
|
|
|
295
294
|
#addSubjectFlows() {
|
|
296
295
|
this.#subscriptions.add(
|
|
297
296
|
this.#state.subject.addFlow(
|
|
298
|
-
handleBookmarkGetAll(this.#queryAllBookmarks, this.#sourceSystem.identifier)
|
|
299
|
-
)
|
|
297
|
+
handleBookmarkGetAll(this.#queryAllBookmarks, this.#sourceSystem.identifier),
|
|
298
|
+
),
|
|
300
299
|
);
|
|
301
300
|
this.#subscriptions.add(
|
|
302
|
-
this.#state.subject.addFlow(handleCreateBookmark(this.#bookmarkAPiClient))
|
|
301
|
+
this.#state.subject.addFlow(handleCreateBookmark(this.#bookmarkAPiClient)),
|
|
303
302
|
);
|
|
304
303
|
this.#subscriptions.add(
|
|
305
|
-
this.#state.subject.addFlow(handleDeleteBookmark(this.#bookmarkAPiClient))
|
|
304
|
+
this.#state.subject.addFlow(handleDeleteBookmark(this.#bookmarkAPiClient)),
|
|
306
305
|
);
|
|
307
306
|
this.#subscriptions.add(
|
|
308
|
-
this.#state.subject.addFlow(handleUpdateBookmark(this.#bookmarkAPiClient))
|
|
307
|
+
this.#state.subject.addFlow(handleUpdateBookmark(this.#bookmarkAPiClient)),
|
|
309
308
|
);
|
|
310
309
|
this.#subscriptions.add(
|
|
311
|
-
this.#state.subject.addFlow(handleUpdateBookmark(this.#bookmarkAPiClient))
|
|
310
|
+
this.#state.subject.addFlow(handleUpdateBookmark(this.#bookmarkAPiClient)),
|
|
312
311
|
);
|
|
313
312
|
}
|
|
314
313
|
}
|
|
@@ -10,7 +10,7 @@ import { actions, Actions } from './bookmarkActions';
|
|
|
10
10
|
export const handleBookmarkGetAll =
|
|
11
11
|
(
|
|
12
12
|
queryAllBookmarks: Query<Array<Bookmark<unknown>>, GetAllBookmarksParameters>,
|
|
13
|
-
sourceSystemIdentifier: string
|
|
13
|
+
sourceSystemIdentifier: string,
|
|
14
14
|
) =>
|
|
15
15
|
(action$: Observable<Actions>) =>
|
|
16
16
|
action$.pipe(
|
|
@@ -22,13 +22,13 @@ export const handleBookmarkGetAll =
|
|
|
22
22
|
actions.getAll.success(
|
|
23
23
|
bookmarks.value.filter(
|
|
24
24
|
(bookmark) =>
|
|
25
|
-
bookmark.sourceSystem.identifier === sourceSystemIdentifier
|
|
26
|
-
)
|
|
27
|
-
)
|
|
25
|
+
bookmark.sourceSystem.identifier === sourceSystemIdentifier,
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
28
|
),
|
|
29
|
-
catchError(() => EMPTY)
|
|
29
|
+
catchError(() => EMPTY),
|
|
30
30
|
);
|
|
31
|
-
})
|
|
31
|
+
}),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
export const handleCreateBookmark =
|
|
@@ -39,7 +39,7 @@ export const handleCreateBookmark =
|
|
|
39
39
|
switchMap(async (action) => {
|
|
40
40
|
const response = await apiClient.post('v1', action.payload);
|
|
41
41
|
return actions.create.success(await response.json());
|
|
42
|
-
})
|
|
42
|
+
}),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
export const handleUpdateBookmark =
|
|
@@ -51,7 +51,7 @@ export const handleUpdateBookmark =
|
|
|
51
51
|
// Should payload be partial? then api client wil need to change.
|
|
52
52
|
const response = await apiClient.patch('v1', action.payload);
|
|
53
53
|
return actions.update.success(await response.json());
|
|
54
|
-
})
|
|
54
|
+
}),
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
export const handleDeleteBookmark =
|
|
@@ -63,5 +63,5 @@ export const handleDeleteBookmark =
|
|
|
63
63
|
const response = await apiClient.delete('v1', { id: action.payload });
|
|
64
64
|
if (response.ok) return actions.delete.success(action.payload);
|
|
65
65
|
return actions.delete.success(action.payload);
|
|
66
|
-
})
|
|
66
|
+
}),
|
|
67
67
|
);
|
package/src/configurator.ts
CHANGED
|
@@ -62,7 +62,7 @@ export type IBookmarkModuleConfigurator = {
|
|
|
62
62
|
IBookmarkModuleConfigurator,
|
|
63
63
|
[ServicesModule, AppModule, ContextModule]
|
|
64
64
|
>,
|
|
65
|
-
parentProvider?: IBookmarkModuleProvider
|
|
65
|
+
parentProvider?: IBookmarkModuleProvider,
|
|
66
66
|
): Promise<BookmarkModuleConfig>;
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -80,7 +80,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
80
80
|
IBookmarkModuleConfigurator,
|
|
81
81
|
[ServicesModule, AppModule, ContextModule]
|
|
82
82
|
>,
|
|
83
|
-
parentProvider?: IBookmarkModuleProvider
|
|
83
|
+
parentProvider?: IBookmarkModuleProvider,
|
|
84
84
|
): Promise<BookmarkModuleConfig> {
|
|
85
85
|
const config: Partial<BookmarkModuleConfig> = await this.#configBuilders.reduce(
|
|
86
86
|
async (cur, cb) => {
|
|
@@ -89,7 +89,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
89
89
|
await Promise.resolve(cb(builder));
|
|
90
90
|
return Object.assign(cur, builder.config);
|
|
91
91
|
},
|
|
92
|
-
Promise.resolve({} as Partial<BookmarkModuleConfig>)
|
|
92
|
+
Promise.resolve({} as Partial<BookmarkModuleConfig>),
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
const appProvider = await this._getAppProvider(init);
|
|
@@ -118,7 +118,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
118
118
|
|
|
119
119
|
config.clientConfiguration = await this._createClientConfiguration(
|
|
120
120
|
init,
|
|
121
|
-
config.clientConfiguration
|
|
121
|
+
config.clientConfiguration,
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
if (!config.sourceSystem) {
|
|
@@ -130,7 +130,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
130
130
|
|
|
131
131
|
#applyParentProviderConfiguration(
|
|
132
132
|
parentProvider: IBookmarkModuleProvider | undefined,
|
|
133
|
-
config: Partial<BookmarkModuleConfig
|
|
133
|
+
config: Partial<BookmarkModuleConfig>,
|
|
134
134
|
) {
|
|
135
135
|
if (parentProvider) {
|
|
136
136
|
config.clientConfiguration = parentProvider.config.clientConfiguration;
|
|
@@ -145,7 +145,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
145
145
|
IBookmarkModuleConfigurator,
|
|
146
146
|
[ServicesModule, AppModule, ContextModule]
|
|
147
147
|
>,
|
|
148
|
-
config: Partial<BookmarkClientConfig> = {}
|
|
148
|
+
config: Partial<BookmarkClientConfig> = {},
|
|
149
149
|
): Promise<BookmarkClientConfig> {
|
|
150
150
|
if (!config.client) {
|
|
151
151
|
const apiProvider = await this._getServiceProvider(init);
|
|
@@ -180,7 +180,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
protected async _getServiceProvider(
|
|
183
|
-
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [ServicesModule]
|
|
183
|
+
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [ServicesModule]>,
|
|
184
184
|
): Promise<IApiProvider> {
|
|
185
185
|
if (init.hasModule('services')) {
|
|
186
186
|
return init.requireInstance('services');
|
|
@@ -195,7 +195,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
protected async _getContextProvider(
|
|
198
|
-
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [ContextModule]
|
|
198
|
+
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [ContextModule]>,
|
|
199
199
|
): Promise<IContextProvider> {
|
|
200
200
|
if (init.hasModule('context')) {
|
|
201
201
|
return init.requireInstance('context');
|
|
@@ -209,7 +209,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
protected async _getAppProvider(
|
|
212
|
-
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [AppModule]
|
|
212
|
+
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [AppModule]>,
|
|
213
213
|
): Promise<AppModuleProvider> {
|
|
214
214
|
if (init.hasModule('app')) {
|
|
215
215
|
return init.requireInstance('app');
|
|
@@ -222,7 +222,7 @@ export class BookmarkModuleConfigurator implements IBookmarkModuleConfigurator {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
protected async _getEventProvider(
|
|
225
|
-
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [EventModule]
|
|
225
|
+
init: ModuleInitializerArgs<IBookmarkModuleConfigurator, [EventModule]>,
|
|
226
226
|
): Promise<IEventModuleProvider> {
|
|
227
227
|
if (init.hasModule('event')) {
|
|
228
228
|
return init.requireInstance('event');
|
package/src/enable-bookmark.ts
CHANGED
|
@@ -20,8 +20,8 @@ export const enableBookmark = (
|
|
|
20
20
|
builder: BookmarkConfigBuilder<
|
|
21
21
|
TDeps,
|
|
22
22
|
ModuleInitializerArgs<IBookmarkModuleConfigurator, TDeps>
|
|
23
|
-
|
|
24
|
-
) => void | Promise<void
|
|
23
|
+
>,
|
|
24
|
+
) => void | Promise<void>,
|
|
25
25
|
): void => {
|
|
26
26
|
configurator.addConfig({
|
|
27
27
|
module,
|
package/src/version.ts
ADDED