@equinor/fusion-framework-module-bookmark 1.2.13 → 2.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 +37 -0
- package/README.md +242 -9
- package/dist/esm/BookmarkClient.interface.js +2 -0
- package/dist/esm/BookmarkClient.interface.js.map +1 -0
- package/dist/esm/BookmarkClient.js +174 -0
- package/dist/esm/BookmarkClient.js.map +1 -0
- package/dist/esm/BookmarkConfigurator.js +348 -0
- package/dist/esm/BookmarkConfigurator.js.map +1 -0
- package/dist/esm/BookmarkProvider.actions.js +60 -0
- package/dist/esm/BookmarkProvider.actions.js.map +1 -0
- package/dist/esm/BookmarkProvider.error.js +14 -0
- package/dist/esm/BookmarkProvider.error.js.map +1 -0
- package/dist/esm/BookmarkProvider.events.js +2 -0
- package/dist/esm/BookmarkProvider.events.js.map +1 -0
- package/dist/esm/BookmarkProvider.flows.js +219 -0
- package/dist/esm/BookmarkProvider.flows.js.map +1 -0
- package/dist/esm/BookmarkProvider.js +937 -0
- package/dist/esm/BookmarkProvider.js.map +1 -0
- package/dist/esm/BookmarkProvider.reducer.js +125 -0
- package/dist/esm/BookmarkProvider.reducer.js.map +1 -0
- package/dist/esm/BookmarkProvider.selectors.js +43 -0
- package/dist/esm/BookmarkProvider.selectors.js.map +1 -0
- package/dist/esm/BookmarkProvider.store.js +19 -0
- package/dist/esm/BookmarkProvider.store.js.map +1 -0
- package/dist/esm/bookmark-config.schema.js +30 -0
- package/dist/esm/bookmark-config.schema.js.map +1 -0
- package/dist/esm/bookmark-module.js +53 -0
- package/dist/esm/bookmark-module.js.map +1 -0
- package/dist/esm/bookmark.schemas.js +38 -0
- package/dist/esm/bookmark.schemas.js.map +1 -0
- package/dist/esm/enable-bookmark.js +20 -7
- package/dist/esm/enable-bookmark.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/BookmarkClient.d.ts +42 -0
- package/dist/types/BookmarkClient.interface.d.ts +139 -0
- package/dist/types/BookmarkConfigurator.d.ts +100 -0
- package/dist/types/BookmarkProvider.actions.d.ts +525 -0
- package/dist/types/BookmarkProvider.d.ts +462 -0
- package/dist/types/BookmarkProvider.error.d.ts +9 -0
- package/dist/types/BookmarkProvider.events.d.ts +78 -0
- package/dist/types/BookmarkProvider.flows.d.ts +79 -0
- package/dist/types/BookmarkProvider.reducer.d.ts +302 -0
- package/dist/types/BookmarkProvider.selectors.d.ts +34 -0
- package/dist/types/BookmarkProvider.store.d.ts +30 -0
- package/dist/types/bookmark-config.schema.d.ts +118 -0
- package/dist/types/{module.d.ts → bookmark-module.d.ts} +3 -3
- package/dist/types/bookmark.schemas.d.ts +760 -0
- package/dist/types/enable-bookmark.d.ts +7 -6
- package/dist/types/index.d.ts +4 -3
- package/dist/types/types.d.ts +29 -65
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -5
- package/src/BookmarkClient.interface.ts +157 -0
- package/src/BookmarkClient.ts +226 -0
- package/src/BookmarkConfigurator.ts +374 -0
- package/src/BookmarkProvider.actions.ts +131 -0
- package/src/BookmarkProvider.error.ts +21 -0
- package/src/BookmarkProvider.events.ts +89 -0
- package/src/BookmarkProvider.flows.ts +426 -0
- package/src/BookmarkProvider.reducer.ts +141 -0
- package/src/BookmarkProvider.selectors.ts +55 -0
- package/src/BookmarkProvider.store.ts +52 -0
- package/src/BookmarkProvider.ts +1308 -0
- package/src/bookmark-config.schema.ts +41 -0
- package/src/bookmark-module.ts +70 -0
- package/src/bookmark.schemas.ts +50 -0
- package/src/enable-bookmark.ts +13 -20
- package/src/index.ts +15 -7
- package/src/types.ts +46 -73
- package/src/version.ts +1 -1
- package/dist/esm/bookmark-config-builder.js +0 -131
- package/dist/esm/bookmark-config-builder.js.map +0 -1
- package/dist/esm/bookmark-provider.js +0 -155
- package/dist/esm/bookmark-provider.js.map +0 -1
- package/dist/esm/client/bookmarkActions.js +0 -10
- package/dist/esm/client/bookmarkActions.js.map +0 -1
- package/dist/esm/client/bookmarkClient.js +0 -259
- package/dist/esm/client/bookmarkClient.js.map +0 -1
- package/dist/esm/client/bookmarkFlows.js +0 -31
- package/dist/esm/client/bookmarkFlows.js.map +0 -1
- package/dist/esm/client/bookmarkReducer.js +0 -29
- package/dist/esm/client/bookmarkReducer.js.map +0 -1
- package/dist/esm/configurator.js +0 -155
- package/dist/esm/configurator.js.map +0 -1
- package/dist/esm/module.js +0 -27
- package/dist/esm/module.js.map +0 -1
- package/dist/esm/utils/handle-url.js +0 -11
- package/dist/esm/utils/handle-url.js.map +0 -1
- package/dist/esm/utils/index.js +0 -2
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/types/bookmark-config-builder.d.ts +0 -85
- package/dist/types/bookmark-provider.d.ts +0 -169
- package/dist/types/client/bookmarkActions.d.ts +0 -27
- package/dist/types/client/bookmarkClient.d.ts +0 -53
- package/dist/types/client/bookmarkFlows.d.ts +0 -22
- package/dist/types/client/bookmarkReducer.d.ts +0 -5
- package/dist/types/configurator.d.ts +0 -75
- package/dist/types/utils/handle-url.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -1
- package/src/bookmark-config-builder.ts +0 -177
- package/src/bookmark-provider.ts +0 -344
- package/src/client/bookmarkActions.ts +0 -44
- package/src/client/bookmarkClient.ts +0 -327
- package/src/client/bookmarkFlows.ts +0 -67
- package/src/client/bookmarkReducer.ts +0 -35
- package/src/configurator.ts +0 -235
- package/src/module.ts +0 -40
- package/src/utils/handle-url.ts +0 -13
- package/src/utils/index.ts +0 -1
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _BookmarkModuleConfigurator_log;
|
|
22
|
+
import { BaseConfigBuilder, } from '@equinor/fusion-framework-module';
|
|
23
|
+
import { BookmarkClient } from './BookmarkClient';
|
|
24
|
+
import { bookmarkConfigSchema } from './bookmark-config.schema';
|
|
25
|
+
const initialBookmarkConfig = bookmarkConfigSchema
|
|
26
|
+
.pick({
|
|
27
|
+
filters: true,
|
|
28
|
+
sourceSystem: true,
|
|
29
|
+
resolve: true,
|
|
30
|
+
})
|
|
31
|
+
.partial()
|
|
32
|
+
.optional();
|
|
33
|
+
/**
|
|
34
|
+
* Configurator for the bookmark module.
|
|
35
|
+
* This class provides a set of methods for configuring the bookmark module.
|
|
36
|
+
*/
|
|
37
|
+
export class BookmarkModuleConfigurator extends BaseConfigBuilder {
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super();
|
|
40
|
+
_BookmarkModuleConfigurator_log.set(this, void 0);
|
|
41
|
+
this.defaultExpireTime = 1 * 60 * 1000; // Default expiration time for bookmarks
|
|
42
|
+
const { log } = options !== null && options !== void 0 ? options : {};
|
|
43
|
+
__classPrivateFieldSet(this, _BookmarkModuleConfigurator_log, log, "f");
|
|
44
|
+
this._set('log', () => __awaiter(this, void 0, void 0, function* () { return log; }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sets the log level for the bookmark configurator.
|
|
48
|
+
*
|
|
49
|
+
* @param level - The log level to set. Allowed values are:
|
|
50
|
+
* - 0: No logging
|
|
51
|
+
* - 1: Error messages only
|
|
52
|
+
* - 2: Error and warning messages
|
|
53
|
+
* - 3: Error, warning, and info messages
|
|
54
|
+
* - 4: Error, warning, info, and debug messages
|
|
55
|
+
*/
|
|
56
|
+
setLogLevel(level) {
|
|
57
|
+
this._set('logLevel', () => __awaiter(this, void 0, void 0, function* () { return level; }));
|
|
58
|
+
if (__classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) {
|
|
59
|
+
__classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f").level = level;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sets the client for interacting with bookmark operations.
|
|
64
|
+
* The client argument can be either a client object with predefined methods for bookmark operations or a callback function that creates and returns such a client object.
|
|
65
|
+
* This method enables the configuration of how the bookmark module interacts with the backend or any other service to perform operations such as getting, creating, or updating bookmarks.
|
|
66
|
+
*
|
|
67
|
+
* @param client A client object or a callback function that returns a client object.
|
|
68
|
+
* - If a callback function is provided, it receives an initializer function as its argument,
|
|
69
|
+
* and it should return a Promise that resolves to a client object.
|
|
70
|
+
* - If a client object is provided directly, it is wrapped in a Promise and used as-is.
|
|
71
|
+
*
|
|
72
|
+
* @see {@link BookmarkModuleConfig.client}
|
|
73
|
+
*/
|
|
74
|
+
setClient(client) {
|
|
75
|
+
if (typeof client === 'function') {
|
|
76
|
+
this._set('client', (init) => client(init));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this._set('client', () => __awaiter(this, void 0, void 0, function* () { return client; }));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sets the parent configuration for the bookmark module.
|
|
84
|
+
* This allows the bookmark module to inherit configuration from a parent module.
|
|
85
|
+
*
|
|
86
|
+
* @param parent - A callback function or a configuration object that provides the parent configuration.
|
|
87
|
+
* - If a callback function is provided, it receives an initializer function as its argument and should return a Promise that resolves to the parent configuration object.
|
|
88
|
+
* - If a configuration object is provided directly, it is wrapped in a Promise and used as-is.
|
|
89
|
+
*/
|
|
90
|
+
setParent(parent) {
|
|
91
|
+
if (typeof parent === 'function') {
|
|
92
|
+
this._set('parent', (init) => parent(init));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this._set('parent', () => __awaiter(this, void 0, void 0, function* () { return parent; }));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Set the source system for the bookmark module.
|
|
100
|
+
* This is used to tag bookmarks with their originating system for filtering or categorization purposes.
|
|
101
|
+
* @param sourceSystem - A callback function that returns the source system or a string value of the source system.
|
|
102
|
+
*
|
|
103
|
+
* Example:
|
|
104
|
+
* ```
|
|
105
|
+
* configurator.setSourceSystem('MyApplication');
|
|
106
|
+
* ```
|
|
107
|
+
* or
|
|
108
|
+
* ```
|
|
109
|
+
* configurator.setSourceSystem((init) => 'MyApplication');
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
setSourceSystem(sourceSystem) {
|
|
113
|
+
if (typeof sourceSystem === 'function') {
|
|
114
|
+
this._set('sourceSystem', sourceSystem);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this._set('sourceSystem', () => __awaiter(this, void 0, void 0, function* () { return sourceSystem; }));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Set the context ID resolver for the bookmark module.
|
|
122
|
+
* This function is used to resolve the context ID dynamically, allowing for context-aware bookmark operations.
|
|
123
|
+
* @param cb - A callback function that returns the context ID resolver function.
|
|
124
|
+
*
|
|
125
|
+
* Example:
|
|
126
|
+
* ```
|
|
127
|
+
* configurator.setContextIdResolver((init) => () => 'currentContextId');
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
setContextResolver(cb) {
|
|
131
|
+
this._set('resolve.context', cb);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Set the application key resolver for the bookmark module.
|
|
135
|
+
* This function is used to resolve the application key dynamically, providing a way to associate bookmarks with specific applications.
|
|
136
|
+
* @param cb - A callback function that returns the application key resolver function.
|
|
137
|
+
*
|
|
138
|
+
* Example:
|
|
139
|
+
* ```
|
|
140
|
+
* configurator.setApplicationKeyResolver((init) => () => 'myApplicationKey');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
setApplicationResolver(cb) {
|
|
144
|
+
this._set('resolve.application', cb);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Sets a filter for the bookmark module.
|
|
148
|
+
* @param key - The key of the filter to set.
|
|
149
|
+
* @param value - The value to set for the filter.
|
|
150
|
+
*
|
|
151
|
+
* Applied when fetching bookmarks
|
|
152
|
+
* - application: Only return bookmarks for the resolved application.
|
|
153
|
+
* - context: Only return bookmarks for the resolved context.
|
|
154
|
+
*/
|
|
155
|
+
setFilter(key, value) {
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
this._set(`filters.${key}`, () => __awaiter(this, void 0, void 0, function* () { return value; }));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Will set default configuration:
|
|
162
|
+
* - `client` - a default client is set
|
|
163
|
+
* - `resolveContextId` - a default context resolver is set
|
|
164
|
+
* - `resolveApplicationKey` - a default application key resolver is set
|
|
165
|
+
* - `sourceSystem` - a default source system is set
|
|
166
|
+
* @internal method to create config, will apply defaults if not provided during build of config.
|
|
167
|
+
* @param init - The config builder callback args.
|
|
168
|
+
* @param initial - An optional initial config to merge into the returned config.
|
|
169
|
+
* @returns The config object.
|
|
170
|
+
*/
|
|
171
|
+
_createConfig(init, initial) {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
173
|
+
// check if parent is provided
|
|
174
|
+
if (!this._has('parent')) {
|
|
175
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('No parent provided, using default parent');
|
|
176
|
+
// Check if parent and parent version compatible
|
|
177
|
+
const parentModules = init.ref;
|
|
178
|
+
if (parentModules && 'bookmark' in parentModules) {
|
|
179
|
+
const parent = parentModules.bookmark;
|
|
180
|
+
if ('version' in parent && parent.version.satisfies('>=2.0.0')) {
|
|
181
|
+
this._set('parent', () => __awaiter(this, void 0, void 0, function* () { return parent; }));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.warn('invalid version of parent BookmarkProvider provided');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
(_c = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _c === void 0 ? void 0 : _c.info('No parent BookmarkProvider found');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Ensure a default client is set if none is provided
|
|
192
|
+
if (!this._has('client')) {
|
|
193
|
+
(_d = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _d === void 0 ? void 0 : _d.debug('No client provided, using default client');
|
|
194
|
+
this._set('client', this._createDefaultClient.bind(this));
|
|
195
|
+
}
|
|
196
|
+
// Ensure a default context resolver is set if none is provided
|
|
197
|
+
if (!this._has('resolve.context')) {
|
|
198
|
+
(_e = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _e === void 0 ? void 0 : _e.debug('No context resolver provided, using default context resolver');
|
|
199
|
+
this._set('resolve.context', this._createDefaultContextResolver.bind(this));
|
|
200
|
+
}
|
|
201
|
+
// Ensure a default application resolver is set if none is provided
|
|
202
|
+
if (!this._has('resolve.application')) {
|
|
203
|
+
(_f = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _f === void 0 ? void 0 : _f.debug('No application resolver provided, using default application resolver');
|
|
204
|
+
this._set('resolve.application', this._createDefaultApplicationResolver.bind(this));
|
|
205
|
+
}
|
|
206
|
+
// Ensure a default event provider is set if none is provided
|
|
207
|
+
if (!this._has('eventProvider')) {
|
|
208
|
+
(_g = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _g === void 0 ? void 0 : _g.debug('No event provider provided, using default event provider');
|
|
209
|
+
this._set('eventProvider', this._resolveEventProvider.bind(this));
|
|
210
|
+
}
|
|
211
|
+
// call super to create config
|
|
212
|
+
return super._createConfig(init, initialBookmarkConfig.parse(initial));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @internal Create a default context resolver for the bookmark module.
|
|
216
|
+
* @param init - The configuration initialization object.
|
|
217
|
+
* @returns A function that resolves the current context ID, or undefined if no context module is available.
|
|
218
|
+
*/
|
|
219
|
+
_createDefaultContextResolver(init) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
// Check if context module is available and use context provider if available
|
|
223
|
+
if (init.hasModule('context')) {
|
|
224
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('Context module available, awaiting instance');
|
|
225
|
+
const contextProvider = yield init.requireInstance('context');
|
|
226
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.debug('Context provider available, creating context resolver');
|
|
227
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('Resolving context for bookmarks');
|
|
230
|
+
const id = (_b = contextProvider.currentContext) === null || _b === void 0 ? void 0 : _b.id;
|
|
231
|
+
return id ? { id } : undefined;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* @internal Create a default application resolver for the bookmark module.
|
|
238
|
+
* @param init - The configuration initialization object.
|
|
239
|
+
* @returns A function that resolves the current application key, or undefined if no app module is available.
|
|
240
|
+
*/
|
|
241
|
+
_createDefaultApplicationResolver(init) {
|
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
var _a, _b;
|
|
244
|
+
// Check if app module is available and use app provider if available
|
|
245
|
+
if (init.hasModule('app')) {
|
|
246
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('App module available, awaiting instance');
|
|
247
|
+
const appProvider = yield init.requireInstance('app');
|
|
248
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.debug('App provider available, creating application resolver');
|
|
249
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
var _a, _b;
|
|
251
|
+
const app = appProvider.current;
|
|
252
|
+
if (app) {
|
|
253
|
+
return {
|
|
254
|
+
appKey: app.appKey,
|
|
255
|
+
name: (_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.warn('No current application found');
|
|
259
|
+
return undefined;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
_resolveAppProvider(init) {
|
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
// Check if app module is available
|
|
268
|
+
if (init.hasModule('app')) {
|
|
269
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('App module available, awaiting instance');
|
|
270
|
+
return init.requireInstance('app');
|
|
271
|
+
}
|
|
272
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.debug('No app module available, will use ref to app module if available');
|
|
273
|
+
return undefined;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @internal Create a default event provider for the bookmark module.
|
|
278
|
+
* @param init - The configuration initialization object.
|
|
279
|
+
* @returns A promise that resolves to the default event provider.
|
|
280
|
+
*/
|
|
281
|
+
_resolveEventProvider(init) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
var _a;
|
|
284
|
+
// Check if event module is available
|
|
285
|
+
if (init.hasModule('event')) {
|
|
286
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('Event module available, awaiting instance');
|
|
287
|
+
return init.requireInstance('event');
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @internal Create a default client for the bookmark module.
|
|
293
|
+
* @param init - The configuration initialization object.
|
|
294
|
+
* @returns A promise that resolves to the default client.
|
|
295
|
+
*/
|
|
296
|
+
_createDefaultClient(init) {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
var _a;
|
|
299
|
+
try {
|
|
300
|
+
const apiProvider = yield this._getServiceProvider(init);
|
|
301
|
+
const api = yield apiProvider.createBookmarksClient('json$');
|
|
302
|
+
return new BookmarkClient(api);
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.warn('Failed to create bookmark api client');
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @internal retrieves the service provider from the configuration initialization object.
|
|
311
|
+
* @param init - The configuration initialization object.
|
|
312
|
+
* @returns A promise that resolves to the service provider.
|
|
313
|
+
*/
|
|
314
|
+
_getServiceProvider(init) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
var _a, _b, _c, _d;
|
|
317
|
+
// check if services module is available
|
|
318
|
+
if (init.hasModule('services')) {
|
|
319
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.debug('Services module available, awaiting instance');
|
|
320
|
+
return init.requireInstance('services');
|
|
321
|
+
}
|
|
322
|
+
(_b = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _b === void 0 ? void 0 : _b.debug('No services module available, will use ref services module if available');
|
|
323
|
+
// check if parent has services module
|
|
324
|
+
const parentServiceModule = (_c = init.ref) === null || _c === void 0 ? void 0 : _c.services;
|
|
325
|
+
if (parentServiceModule) {
|
|
326
|
+
return parentServiceModule;
|
|
327
|
+
}
|
|
328
|
+
// No service provider available
|
|
329
|
+
(_d = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _d === void 0 ? void 0 : _d.error('No service provider available, cannot create bookmarks client');
|
|
330
|
+
throw Error('[BookmarkConfigurator] No service provider configures [ServicesModule] ');
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
_processConfig(config, _init) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
var _a, _b;
|
|
336
|
+
try {
|
|
337
|
+
return bookmarkConfigSchema.parse(config);
|
|
338
|
+
}
|
|
339
|
+
catch (err) {
|
|
340
|
+
(_a = __classPrivateFieldGet(this, _BookmarkModuleConfigurator_log, "f")) === null || _a === void 0 ? void 0 : _a.error('Failed to parse config', config, (_b = err.issues) !== null && _b !== void 0 ? _b : err);
|
|
341
|
+
throw err;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
_BookmarkModuleConfigurator_log = new WeakMap();
|
|
347
|
+
export default BookmarkModuleConfigurator;
|
|
348
|
+
//# sourceMappingURL=BookmarkConfigurator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BookmarkConfigurator.js","sourceRoot":"","sources":["../../src/BookmarkConfigurator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EACH,iBAAiB,GAIpB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,qBAAqB,GAAG,oBAAoB;KAC7C,IAAI,CAAC;IACF,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CAChB,CAAC;KACD,OAAO,EAAE;KACT,QAAQ,EAAE,CAAC;AAIhB;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAuC;IAInF,YAAY,OAAwE;QAChF,KAAK,EAAE,CAAC;QAJZ,kDAAe;QACf,sBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,wCAAwC;QAIvE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;QAC9B,uBAAA,IAAI,mCAAQ,GAAG,MAAA,CAAC;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able';
|
|
2
|
+
/**
|
|
3
|
+
* Actions related to the BookmarkProvider provider state.
|
|
4
|
+
*
|
|
5
|
+
* Exports a set of actions that can be used to manage bookmarks.
|
|
6
|
+
*/
|
|
7
|
+
export const bookmarkActions = {
|
|
8
|
+
aborted: createAction('action_aborted', (action) => ({
|
|
9
|
+
payload: action,
|
|
10
|
+
})),
|
|
11
|
+
setBookmark: createAction('update_bookmark', (bookmark) => {
|
|
12
|
+
return { payload: bookmark };
|
|
13
|
+
}),
|
|
14
|
+
setCurrentBookmark: createAction('set_current_bookmark', (bookmark) => {
|
|
15
|
+
return { payload: bookmark };
|
|
16
|
+
}),
|
|
17
|
+
fetchBookmark: createAsyncAction('fetch_bookmark', (bookmarkId, meta) => ({
|
|
18
|
+
payload: bookmarkId,
|
|
19
|
+
meta,
|
|
20
|
+
}), (bookmark, meta) => ({ payload: bookmark, meta }), (error, meta) => ({ payload: error, meta })),
|
|
21
|
+
fetchBookmarkData: createAsyncAction('fetch_bookmark_payload', (bookmarkId, meta) => ({ payload: bookmarkId, meta }), (bookmarkId, data, meta) => ({
|
|
22
|
+
payload: { bookmarkId, data },
|
|
23
|
+
meta,
|
|
24
|
+
}), (error, meta) => ({ payload: error, meta })),
|
|
25
|
+
fetchBookmarks: createAsyncAction('fetch_bookmarks', (filter, meta) => ({ payload: filter, meta }), (bookmarks, meta) => ({ payload: bookmarks, meta }), (error, meta) => ({ payload: error, meta })),
|
|
26
|
+
updateBookmark: createAsyncAction('update_bookmark', (payload, meta) => ({
|
|
27
|
+
payload,
|
|
28
|
+
meta,
|
|
29
|
+
}), (payload, meta) => ({ payload, meta }), (payload, meta) => ({ payload, meta })),
|
|
30
|
+
createBookmark: createAsyncAction('create_bookmark', (payload, meta) => ({ payload, meta }), (payload, meta) => ({ payload, meta }), (payload, meta) => ({ payload, meta })),
|
|
31
|
+
deleteBookmark: createAsyncAction('delete_bookmark', (bookmarkId, meta) => ({
|
|
32
|
+
payload: bookmarkId,
|
|
33
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
34
|
+
}), (bookmarkId, meta) => ({
|
|
35
|
+
payload: bookmarkId,
|
|
36
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
37
|
+
}), (payload, meta) => ({ payload, meta })),
|
|
38
|
+
removeBookmark: createAsyncAction('remove_bookmark', (bookmarkId, meta) => ({
|
|
39
|
+
payload: bookmarkId,
|
|
40
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
41
|
+
}), (payload, meta) => ({ payload, meta }), (payload, meta) => ({
|
|
42
|
+
payload,
|
|
43
|
+
meta,
|
|
44
|
+
})),
|
|
45
|
+
addBookmarkAsFavourite: createAsyncAction('add_favourite_bookmark', (bookmarkId, meta) => ({
|
|
46
|
+
payload: bookmarkId,
|
|
47
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
48
|
+
}), (bookmarkId, meta) => ({
|
|
49
|
+
payload: bookmarkId,
|
|
50
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
51
|
+
}), (error, meta) => ({ payload: error, meta })),
|
|
52
|
+
removeBookmarkAsFavourite: createAsyncAction('remove_favourite_bookmark', (bookmarkId, meta) => ({
|
|
53
|
+
payload: bookmarkId,
|
|
54
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
55
|
+
}), (bookmarkId, meta) => ({
|
|
56
|
+
payload: bookmarkId,
|
|
57
|
+
meta: Object.assign({ ref: bookmarkId }, meta),
|
|
58
|
+
}), (error, meta) => ({ payload: error, meta })),
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=BookmarkProvider.actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BookmarkProvider.actions.js","sourceRoot":"","sources":["../../src/BookmarkProvider.actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EACZ,iBAAiB,GAEpB,MAAM,4BAA4B,CAAC;AAepC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;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AAI,kBAAI,GAAG,EAAE,UAAU,IAAK,IAAI,CAAE;KACrC,CAAC,EACF,CAAC,KAAwB,EAAE,IAAwB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CACrF;CACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class BookmarkFlowError extends Error {
|
|
2
|
+
constructor(message, action, options) {
|
|
3
|
+
super(message, options);
|
|
4
|
+
this.action = action;
|
|
5
|
+
this.name = 'BookmarkProcessError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class BookmarkProviderError extends Error {
|
|
9
|
+
constructor(message, options) {
|
|
10
|
+
super(message, options);
|
|
11
|
+
this.name = 'BookmarkProviderError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=BookmarkProvider.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BookmarkProvider.error.js","sourceRoot":"","sources":["../../src/BookmarkProvider.error.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxC,YACI,OAAe,EACC,MAAoD,EACpE,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAHR,WAAM,GAAN,MAAM,CAA8C;QAIpE,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5C,YAAY,OAAe,EAAE,OAAsB;QAC/C,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BookmarkProvider.events.js","sourceRoot":"","sources":["../../src/BookmarkProvider.events.ts"],"names":[],"mappings":""}
|