@equinor/fusion-framework-module-bookmark 2.2.0 → 3.0.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 +84 -0
- package/dist/esm/BookmarkConfigurator.js +6 -3
- package/dist/esm/BookmarkConfigurator.js.map +1 -1
- package/dist/esm/BookmarkProvider.js +287 -219
- package/dist/esm/BookmarkProvider.js.map +1 -1
- package/dist/esm/bookmark-config.schema.js +5 -4
- package/dist/esm/bookmark-config.schema.js.map +1 -1
- package/dist/esm/bookmark.schemas.js +4 -1
- package/dist/esm/bookmark.schemas.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/BookmarkProvider.actions.d.ts +7 -175
- package/dist/types/BookmarkProvider.d.ts +47 -46
- package/dist/types/BookmarkProvider.reducer.d.ts +7 -90
- package/dist/types/bookmark-config.schema.d.ts +13 -104
- package/dist/types/bookmark.schemas.d.ts +20 -376
- package/dist/types/types.d.ts +96 -18
- package/dist/types/version.d.ts +1 -1
- package/package.json +12 -12
- package/src/BookmarkConfigurator.ts +10 -5
- package/src/BookmarkProvider.ts +377 -307
- package/src/bookmark-config.schema.ts +7 -6
- package/src/bookmark.schemas.ts +6 -2
- package/src/types.ts +92 -28
- package/src/version.ts +1 -1
|
@@ -13,7 +13,7 @@ import type { ILogger, LogLevel } from '@equinor/fusion-log';
|
|
|
13
13
|
|
|
14
14
|
import { BookmarkClient } from './BookmarkClient';
|
|
15
15
|
import type { BookmarkModule } from './bookmark-module';
|
|
16
|
-
import { bookmarkConfigSchema } from './bookmark-config.schema';
|
|
16
|
+
import { bookmarkConfigSchema, parseBookmarkConfig } from './bookmark-config.schema';
|
|
17
17
|
import type { BookmarkModuleConfig } from './types';
|
|
18
18
|
import type { BookmarkProvider } from './BookmarkProvider';
|
|
19
19
|
|
|
@@ -26,7 +26,9 @@ const initialBookmarkConfig = bookmarkConfigSchema
|
|
|
26
26
|
.partial()
|
|
27
27
|
.optional();
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const parseInitialBookmarkConfigConfig = (initial?: unknown): BookmarkModuleConfig => {
|
|
30
|
+
return initialBookmarkConfig.parse(initial) as BookmarkModuleConfig;
|
|
31
|
+
};
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Configurator for the bookmark module.
|
|
@@ -185,7 +187,10 @@ export class BookmarkModuleConfigurator extends BaseConfigBuilder<BookmarkModule
|
|
|
185
187
|
* @param initial - An optional initial config to merge into the returned config.
|
|
186
188
|
* @returns The config object.
|
|
187
189
|
*/
|
|
188
|
-
protected _createConfig(
|
|
190
|
+
protected _createConfig(
|
|
191
|
+
init: ConfigBuilderCallbackArgs,
|
|
192
|
+
initial?: Partial<BookmarkModuleConfig>,
|
|
193
|
+
) {
|
|
189
194
|
// check if parent is provided
|
|
190
195
|
if (!this._has('parent')) {
|
|
191
196
|
this.#log?.debug('No parent provided, using default parent');
|
|
@@ -232,7 +237,7 @@ export class BookmarkModuleConfigurator extends BaseConfigBuilder<BookmarkModule
|
|
|
232
237
|
}
|
|
233
238
|
|
|
234
239
|
// call super to create config
|
|
235
|
-
return super._createConfig(init,
|
|
240
|
+
return super._createConfig(init, parseInitialBookmarkConfigConfig(initial));
|
|
236
241
|
}
|
|
237
242
|
|
|
238
243
|
/**
|
|
@@ -359,7 +364,7 @@ export class BookmarkModuleConfigurator extends BaseConfigBuilder<BookmarkModule
|
|
|
359
364
|
_init: ConfigBuilderCallbackArgs,
|
|
360
365
|
): Promise<BookmarkModuleConfig> {
|
|
361
366
|
try {
|
|
362
|
-
return
|
|
367
|
+
return parseBookmarkConfig(config);
|
|
363
368
|
} catch (err) {
|
|
364
369
|
this.#log?.error('Failed to parse config', config, (err as ZodError).issues ?? err);
|
|
365
370
|
throw err;
|