@equinor/fusion-framework-module-bookmark 4.1.0 → 4.1.2

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.
Files changed (48) hide show
  1. package/dist/esm/BookmarkProvider.js +10 -5
  2. package/dist/esm/BookmarkProvider.js.map +1 -1
  3. package/dist/esm/__tests__/BookmarkProvider.test.js +34 -0
  4. package/dist/esm/__tests__/BookmarkProvider.test.js.map +1 -0
  5. package/dist/esm/version.js +1 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/types/BookmarkProvider.d.ts +5 -2
  8. package/dist/types/__tests__/BookmarkProvider.test.d.ts +1 -0
  9. package/dist/types/version.d.ts +1 -1
  10. package/package.json +13 -10
  11. package/CHANGELOG.md +0 -821
  12. package/src/BookmarkClient.interface.ts +0 -157
  13. package/src/BookmarkClient.ts +0 -290
  14. package/src/BookmarkFlowError.ts +0 -38
  15. package/src/BookmarkModuleConfigurator.ts +0 -412
  16. package/src/BookmarkProvider.events.ts +0 -87
  17. package/src/BookmarkProvider.interface.ts +0 -180
  18. package/src/BookmarkProvider.selectors.ts +0 -69
  19. package/src/BookmarkProvider.ts +0 -1549
  20. package/src/BookmarkProviderError.ts +0 -19
  21. package/src/__tests__/mock/bookmark-mock.test.ts +0 -199
  22. package/src/bookmark-actions.ts +0 -132
  23. package/src/bookmark-config.schema.ts +0 -55
  24. package/src/bookmark-flows/bookmark-api-flows.ts +0 -45
  25. package/src/bookmark-flows/handle-add-bookmark-as-favorite.ts +0 -49
  26. package/src/bookmark-flows/handle-create-bookmark.ts +0 -47
  27. package/src/bookmark-flows/handle-delete-bookmark.ts +0 -47
  28. package/src/bookmark-flows/handle-fetch-all-bookmark.ts +0 -53
  29. package/src/bookmark-flows/handle-fetch-bookmark-data.ts +0 -58
  30. package/src/bookmark-flows/handle-fetch-bookmark.ts +0 -64
  31. package/src/bookmark-flows/handle-remove-bookmark-from-favorites.ts +0 -49
  32. package/src/bookmark-flows/handle-remove-bookmark.ts +0 -76
  33. package/src/bookmark-flows/handle-update-bookmark.ts +0 -48
  34. package/src/bookmark-flows/index.ts +0 -10
  35. package/src/bookmark-module.ts +0 -98
  36. package/src/bookmark.schemas.ts +0 -81
  37. package/src/create-bookmark-reducer.ts +0 -149
  38. package/src/create-bookmark-store.ts +0 -61
  39. package/src/enable-bookmark.ts +0 -44
  40. package/src/index.ts +0 -43
  41. package/src/mock/BookmarkMockClient.ts +0 -310
  42. package/src/mock/BookmarkMockConfigurator.ts +0 -159
  43. package/src/mock/index.ts +0 -25
  44. package/src/mock/module.ts +0 -64
  45. package/src/types.ts +0 -121
  46. package/src/version.ts +0 -2
  47. package/tsconfig.json +0 -30
  48. package/vitest.config.ts +0 -11
@@ -1,64 +0,0 @@
1
- import type { AnyModule, IModulesConfigurator } from '@equinor/fusion-framework-module';
2
-
3
- import { module, type BookmarkModule } from '../bookmark-module';
4
-
5
- import { BookmarkMockConfigurator } from './BookmarkMockConfigurator';
6
-
7
- /**
8
- * The bookmark module with a mock, in-memory client instead of a live
9
- * `@equinor/fusion-framework-module-services` connection.
10
- *
11
- * @remarks
12
- * Only `configure` differs from the real module. `initialize` is the
13
- * production one, untouched, so the real `BookmarkProvider` and
14
- * `bookmark-flows/` epics run exactly as they do in production — a test
15
- * observes the real create/update/delete/favorite flow, not a rehearsal of it.
16
- */
17
- export const bookmarkMockModule: BookmarkModule = {
18
- ...module,
19
- configure: () => new BookmarkMockConfigurator(),
20
- };
21
-
22
- /**
23
- * Configuration callback for {@link enableBookmarkMock}.
24
- *
25
- * @template TRef - Reference type forwarded to the callback, inferred from the configurator.
26
- */
27
- export type BookmarkMockConfigFn<TRef = unknown> = (
28
- configurator: BookmarkMockConfigurator,
29
- ref?: TRef,
30
- ) => void | Promise<void>;
31
-
32
- /**
33
- * Enables the bookmark module against an in-memory mock client, so a test
34
- * needs no network and no real Fusion Core Services backend.
35
- *
36
- * @remarks
37
- * Registered last, this replaces whichever bookmark module the configurator
38
- * already carries, so it works on a `FrameworkConfigurator` that pre-registers
39
- * the real one.
40
- *
41
- * @param configurator - The modules configurator to register on.
42
- * @param configure - Optional callback to seed bookmarks, the current bookmark, or favorites.
43
- * @template TModules - The array of module descriptors managed by `configurator`.
44
- * @template TRef - Reference type forwarded to `configure`, inferred from `configurator`.
45
- *
46
- * @example
47
- * ```typescript
48
- * enableBookmarkMock(configurator, (builder) => {
49
- * builder.setBookmarks([myBookmark]);
50
- * builder.setCurrentBookmark(myBookmark.id);
51
- * });
52
- * ```
53
- */
54
- export const enableBookmarkMock = <
55
- TModules extends Array<AnyModule> = Array<AnyModule>,
56
- TRef = unknown,
57
- >(
58
- configurator: IModulesConfigurator<TModules, TRef>,
59
- configure?: BookmarkMockConfigFn<TRef>,
60
- ): void => {
61
- configurator.addConfig({ module: bookmarkMockModule, configure } as {
62
- module: BookmarkModule;
63
- });
64
- };
package/src/types.ts DELETED
@@ -1,121 +0,0 @@
1
- import type { ILogger, LogLevel } from '@equinor/fusion-log';
2
- import type { IEventModuleProvider } from '@equinor/fusion-framework-module-event';
3
- import type { IBookmarkProvider } from './BookmarkProvider.interface';
4
- import type { IBookmarkClient } from './BookmarkClient.interface';
5
-
6
- /**
7
- * Represents the source system for a bookmark.
8
- */
9
- export interface SourceSystem {
10
- /** Unique identifier for the source system */
11
- identifier: string;
12
- /** Human-readable name of the source system */
13
- name?: string | null;
14
- /** Sub-system identifier */
15
- subSystem?: string | null;
16
- }
17
-
18
- /**
19
- * Represents the data associated with a bookmark.
20
- * This is a generic type that can hold any arbitrary data as a key-value map.
21
- */
22
- export type BookmarkData = Record<string, unknown> | string;
23
-
24
- /**
25
- * Represents a user associated with a bookmark.
26
- */
27
- export interface BookmarkUser {
28
- /** Unique identifier for the user */
29
- id: string;
30
- /** Display name of the user */
31
- name: string;
32
- /** Email address of the user */
33
- mail?: string;
34
- }
35
-
36
- /**
37
- * Represents the context associated with a bookmark.
38
- */
39
- export interface BookmarkContext {
40
- /** Unique identifier for the context */
41
- id: string;
42
- /** Human-readable name of the context */
43
- name?: string;
44
- /** Type of the context */
45
- type?: string;
46
- }
47
-
48
- /**
49
- * Represents a bookmark without any associated data.
50
- */
51
- export interface BookmarkWithoutData {
52
- /** Unique identifier for the bookmark */
53
- id: string;
54
- /** Name of the bookmark */
55
- name: string;
56
- /** Application key this bookmark belongs to */
57
- appKey: string;
58
- /** Optional description of the bookmark */
59
- description?: string;
60
- /** Whether the bookmark is shared */
61
- isShared?: boolean;
62
- /** When the bookmark was created */
63
- created: Date;
64
- /** User who created the bookmark */
65
- createdBy: BookmarkUser;
66
- /** When the bookmark was last updated */
67
- updated?: Date;
68
- /** User who last updated the bookmark */
69
- updatedBy?: BookmarkUser;
70
- /** Context associated with the bookmark */
71
- context?: BookmarkContext;
72
- /** Source system information */
73
- sourceSystem?: SourceSystem | null;
74
- }
75
-
76
- /**
77
- * Represents a bookmark with associated data.
78
- * @template T - The type of the bookmark data.
79
- */
80
- // biome-ignore lint/suspicious/noExplicitAny: must be any to support all bookmark data types
81
- export interface Bookmark<T extends BookmarkData = any> extends BookmarkWithoutData {
82
- /** Optional payload data associated with the bookmark */
83
- payload?: T;
84
- }
85
-
86
- /**
87
- * Represents a collection of bookmarks.
88
- */
89
- export type Bookmarks = BookmarkWithoutData[];
90
-
91
- /**
92
- * Represents the configuration options for a bookmark module.
93
- */
94
- export interface BookmarkModuleConfig {
95
- /** Optional logger instance */
96
- log?: ILogger;
97
- /** Optional log level */
98
- logLevel?: LogLevel;
99
- /** Optional event provider for handling events */
100
- eventProvider?: IEventModuleProvider;
101
- /** The source system for the bookmarks */
102
- sourceSystem?: SourceSystem;
103
- /** Parent Bookmark provider */
104
- parent?: IBookmarkProvider | null;
105
- /** API client for interacting with bookmarks */
106
- client: IBookmarkClient;
107
- /** Functions for resolving context and application */
108
- resolve: {
109
- /** Function to resolve the current context */
110
- context: () => Promise<{ id: string } | undefined>;
111
- /** Function to resolve the current application */
112
- application: () => Promise<{ appKey: string; name?: string } | undefined>;
113
- };
114
- /** Flags for enabling resolving when fetching bookmarks */
115
- filters?: {
116
- /** Whether to filter by context */
117
- context?: boolean;
118
- /** Whether to filter by application */
119
- application?: boolean;
120
- };
121
- }
package/src/version.ts DELETED
@@ -1,2 +0,0 @@
1
- // Generated by genversion.
2
- export const version = '4.1.0';
package/tsconfig.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist/esm",
5
- "rootDir": "src",
6
- "declarationDir": "./dist/types"
7
- },
8
- "references": [
9
- {
10
- "path": "../../utils/query"
11
- },
12
- {
13
- "path": "../module"
14
- },
15
- {
16
- "path": "../event"
17
- },
18
- {
19
- "path": "../services"
20
- },
21
- {
22
- "path": "../context"
23
- },
24
- {
25
- "path": "../app"
26
- }
27
- ],
28
- "include": ["src/**/*"],
29
- "exclude": ["node_modules", "dist"]
30
- }
package/vitest.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import { defineProject } from 'vitest/config';
2
-
3
- import { name, version } from './package.json' with { type: 'json' };
4
-
5
- export default defineProject({
6
- test: {
7
- environment: 'node',
8
- include: ['src/__tests__/**/*.test.ts'],
9
- name: `${name}@${version}`,
10
- },
11
- });