@equinor/fusion-framework-module-app 8.0.2 → 8.0.3

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 (109) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/esm/AppClient.js +75 -8
  3. package/dist/esm/AppClient.js.map +1 -1
  4. package/dist/esm/AppConfig.js +9 -1
  5. package/dist/esm/AppConfig.js.map +1 -1
  6. package/dist/esm/{AppClient.Selectors.js → AppConfigSelector.js} +1 -1
  7. package/dist/esm/AppConfigSelector.js.map +1 -0
  8. package/dist/esm/AppConfigurator.js +28 -2
  9. package/dist/esm/AppConfigurator.js.map +1 -1
  10. package/dist/esm/AppModuleProvider.js +16 -0
  11. package/dist/esm/AppModuleProvider.js.map +1 -1
  12. package/dist/esm/app/App.js +82 -24
  13. package/dist/esm/app/App.js.map +1 -1
  14. package/dist/esm/app/actions.js +2 -2
  15. package/dist/esm/app/actions.js.map +1 -1
  16. package/dist/esm/app/create-reducer.js +2 -1
  17. package/dist/esm/app/create-reducer.js.map +1 -1
  18. package/dist/esm/app/filter-empty.js +11 -0
  19. package/dist/esm/app/filter-empty.js.map +1 -0
  20. package/dist/esm/app/flows/handle-fetch-config.js +30 -0
  21. package/dist/esm/app/flows/handle-fetch-config.js.map +1 -0
  22. package/dist/esm/app/flows/handle-fetch-manifest.js +30 -0
  23. package/dist/esm/app/flows/handle-fetch-manifest.js.map +1 -0
  24. package/dist/esm/app/flows/handle-fetch-settings.js +30 -0
  25. package/dist/esm/app/flows/handle-fetch-settings.js.map +1 -0
  26. package/dist/esm/app/flows/handle-import-application.js +23 -0
  27. package/dist/esm/app/flows/handle-import-application.js.map +1 -0
  28. package/dist/esm/app/flows/handle-update-settings.js +22 -0
  29. package/dist/esm/app/flows/handle-update-settings.js.map +1 -0
  30. package/dist/esm/app/flows/index.js +6 -0
  31. package/dist/esm/app/flows/index.js.map +1 -0
  32. package/dist/esm/enable-app-module.js +2 -1
  33. package/dist/esm/enable-app-module.js.map +1 -1
  34. package/dist/esm/errors/AppBuildError.js +35 -0
  35. package/dist/esm/errors/AppBuildError.js.map +1 -0
  36. package/dist/esm/errors/AppConfigError.js +35 -0
  37. package/dist/esm/errors/AppConfigError.js.map +1 -0
  38. package/dist/esm/errors/AppManifestError.js +35 -0
  39. package/dist/esm/errors/AppManifestError.js.map +1 -0
  40. package/dist/esm/errors/AppScriptModuleError.js +17 -0
  41. package/dist/esm/errors/AppScriptModuleError.js.map +1 -0
  42. package/dist/esm/errors/AppSettingsError.js +35 -0
  43. package/dist/esm/errors/AppSettingsError.js.map +1 -0
  44. package/dist/esm/errors/app-error-type.js +2 -0
  45. package/dist/esm/errors/app-error-type.js.map +1 -0
  46. package/dist/esm/errors.js +5 -148
  47. package/dist/esm/errors.js.map +1 -1
  48. package/dist/esm/module.js +2 -0
  49. package/dist/esm/module.js.map +1 -1
  50. package/dist/esm/schemas.js +4 -0
  51. package/dist/esm/schemas.js.map +1 -1
  52. package/dist/esm/version.js +1 -1
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/dist/types/AppClient.d.ts +42 -0
  55. package/dist/types/AppConfig.d.ts +7 -1
  56. package/dist/types/AppConfigurator.d.ts +25 -0
  57. package/dist/types/AppModuleProvider.d.ts +10 -0
  58. package/dist/types/app/App.d.ts +49 -8
  59. package/dist/types/app/create-reducer.d.ts +55 -55
  60. package/dist/types/app/filter-empty.d.ts +8 -0
  61. package/dist/types/app/flows/handle-fetch-config.d.ts +12 -0
  62. package/dist/types/app/flows/handle-fetch-manifest.d.ts +12 -0
  63. package/dist/types/app/flows/handle-fetch-settings.d.ts +12 -0
  64. package/dist/types/app/flows/handle-import-application.d.ts +10 -0
  65. package/dist/types/app/flows/handle-update-settings.d.ts +12 -0
  66. package/dist/types/app/flows/index.d.ts +5 -0
  67. package/dist/types/errors/AppBuildError.d.ts +21 -0
  68. package/dist/types/errors/AppConfigError.d.ts +21 -0
  69. package/dist/types/errors/AppManifestError.d.ts +21 -0
  70. package/dist/types/errors/AppScriptModuleError.d.ts +14 -0
  71. package/dist/types/errors/AppSettingsError.d.ts +21 -0
  72. package/dist/types/errors/app-error-type.d.ts +9 -0
  73. package/dist/types/errors.d.ts +6 -103
  74. package/dist/types/version.d.ts +1 -1
  75. package/package.json +9 -9
  76. package/src/AppClient.ts +65 -4
  77. package/src/AppConfig.ts +9 -1
  78. package/src/AppConfigurator.ts +28 -4
  79. package/src/AppModuleProvider.ts +16 -0
  80. package/src/app/App.ts +88 -31
  81. package/src/app/actions.ts +2 -2
  82. package/src/app/create-reducer.ts +2 -1
  83. package/src/app/filter-empty.ts +11 -0
  84. package/src/app/flows/handle-fetch-config.ts +48 -0
  85. package/src/app/flows/handle-fetch-manifest.ts +53 -0
  86. package/src/app/flows/handle-fetch-settings.ts +50 -0
  87. package/src/app/flows/handle-import-application.ts +37 -0
  88. package/src/app/flows/handle-update-settings.ts +39 -0
  89. package/src/app/flows/index.ts +5 -0
  90. package/src/app/types.ts +2 -2
  91. package/src/enable-app-module.ts +2 -1
  92. package/src/errors/AppBuildError.ts +47 -0
  93. package/src/errors/AppConfigError.ts +47 -0
  94. package/src/errors/AppManifestError.ts +47 -0
  95. package/src/errors/AppScriptModuleError.ts +20 -0
  96. package/src/errors/AppSettingsError.ts +47 -0
  97. package/src/errors/app-error-type.ts +9 -0
  98. package/src/errors.ts +6 -208
  99. package/src/module.ts +2 -0
  100. package/src/schemas.ts +4 -0
  101. package/src/types.ts +1 -1
  102. package/src/version.ts +1 -1
  103. package/dist/esm/AppClient.Selectors.js.map +0 -1
  104. package/dist/esm/app/flows.js +0 -120
  105. package/dist/esm/app/flows.js.map +0 -1
  106. package/dist/types/app/flows.d.ts +0 -41
  107. package/src/app/flows.ts +0 -189
  108. /package/dist/types/{AppClient.Selectors.d.ts → AppConfigSelector.d.ts} +0 -0
  109. /package/src/{AppClient.Selectors.ts → AppConfigSelector.ts} +0 -0
@@ -24,13 +24,14 @@ import type { AppConfigurator } from './AppConfigurator';
24
24
  * ```
25
25
  */
26
26
  export const enableAppModule = (
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ // biome-ignore lint/suspicious/noExplicitAny: `IModulesConfigurator<any, any>` widens to accept a configurator for any concrete module set — `unknown` would break assignability of a real configurator instance to this parameter
28
28
  configurator: IModulesConfigurator<any, any>,
29
29
  callback?: (builder: AppConfigurator) => void | Promise<void>,
30
30
  ): void => {
31
31
  configurator.addConfig({
32
32
  module,
33
33
  configure: async (configurator) => {
34
+ // apply the caller's configuration overrides, if provided
34
35
  if (callback) {
35
36
  Promise.resolve(callback(configurator));
36
37
  }
@@ -0,0 +1,47 @@
1
+ import type { AppErrorType } from './app-error-type';
2
+
3
+ /**
4
+ * Represents an error that occurs in the application build.
5
+ */
6
+ export class AppBuildError extends Error {
7
+ /**
8
+ * Creates an instance of `AppBuildError` based on the HTTP response status.
9
+ * @param response The HTTP response.
10
+ * @param options Additional error options.
11
+ * @returns An instance of `AppBuildError` based on the HTTP response status.
12
+ */
13
+ static fromHttpResponse(response: Response, options?: ErrorOptions): AppBuildError {
14
+ // map well-known HTTP statuses to a specific error type
15
+ switch (response.status) {
16
+ case 401:
17
+ return new AppBuildError(
18
+ 'unauthorized',
19
+ 'failed to load application build metadata, request not authorized',
20
+ options,
21
+ );
22
+ case 404:
23
+ return new AppBuildError('not_found', 'application build metadata not found', options);
24
+ case 410:
25
+ return new AppBuildError('deleted', 'application build deleted', options);
26
+ }
27
+ return new AppBuildError(
28
+ 'unknown',
29
+ `failed to load application build, status code ${response.status}`,
30
+ options,
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Creates an instance of `AppBuildError`.
36
+ * @param type The type of the application error.
37
+ * @param message The error message.
38
+ * @param options Additional error options.
39
+ */
40
+ constructor(
41
+ public readonly type: AppErrorType,
42
+ message?: string,
43
+ options?: ErrorOptions,
44
+ ) {
45
+ super(message, options);
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ import type { AppErrorType } from './app-error-type';
2
+
3
+ /**
4
+ * Represents an error that occurs in the application configuration.
5
+ */
6
+ export class AppConfigError extends Error {
7
+ /**
8
+ * Creates an instance of `AppConfigError` based on the HTTP response status.
9
+ * @param response The HTTP response.
10
+ * @param options Additional error options.
11
+ * @returns An instance of `AppConfigError` based on the HTTP response status.
12
+ */
13
+ static fromHttpResponse(response: Response, options?: ErrorOptions): AppConfigError {
14
+ // map well-known HTTP statuses to a specific error type
15
+ switch (response.status) {
16
+ case 401:
17
+ return new AppConfigError(
18
+ 'unauthorized',
19
+ 'failed to load application config, request not authorized',
20
+ options,
21
+ );
22
+ case 404:
23
+ return new AppConfigError('not_found', 'application config not found', options);
24
+ case 410:
25
+ return new AppConfigError('deleted', 'application config deleted', options);
26
+ }
27
+ return new AppConfigError(
28
+ 'unknown',
29
+ `failed to load application config, status code ${response.status}`,
30
+ options,
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Creates an instance of `AppConfigError`.
36
+ * @param type The type of the application error.
37
+ * @param message The error message.
38
+ * @param options Additional error options.
39
+ */
40
+ constructor(
41
+ public readonly type: AppErrorType,
42
+ message?: string,
43
+ options?: ErrorOptions,
44
+ ) {
45
+ super(message, options);
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ import type { AppErrorType } from './app-error-type';
2
+
3
+ /**
4
+ * Represents an error that occurs when loading an application manifest.
5
+ */
6
+ export class AppManifestError extends Error {
7
+ /**
8
+ * Creates an instance of AppManifestError based on the HTTP response status.
9
+ * @param response The HTTP response.
10
+ * @param options Optional error options.
11
+ * @returns An instance of AppManifestError.
12
+ */
13
+ static fromHttpResponse(response: Response, options?: ErrorOptions) {
14
+ // map well-known HTTP statuses to a specific error type
15
+ switch (response.status) {
16
+ case 401:
17
+ return new AppManifestError(
18
+ 'unauthorized',
19
+ 'failed to load application manifest, request not authorized',
20
+ options,
21
+ );
22
+ case 404:
23
+ return new AppManifestError('not_found', 'application manifest not found', options);
24
+ case 410:
25
+ return new AppManifestError('deleted', 'application manifest deleted', options);
26
+ }
27
+ return new AppManifestError(
28
+ 'unknown',
29
+ `failed to load application manifest, status code ${response.status}`,
30
+ options,
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Creates an instance of AppManifestError.
36
+ * @param type The type of the error.
37
+ * @param message The error message.
38
+ * @param options Optional error options.
39
+ */
40
+ constructor(
41
+ public readonly type: AppErrorType,
42
+ message?: string,
43
+ options?: ErrorOptions,
44
+ ) {
45
+ super(message, options);
46
+ }
47
+ }
@@ -0,0 +1,20 @@
1
+ import type { AppErrorType } from './app-error-type';
2
+
3
+ /**
4
+ * Represents an error that occurs when loading the application script.
5
+ */
6
+ export class AppScriptModuleError extends Error {
7
+ /**
8
+ * Creates a new instance of the AppScriptModuleError class.
9
+ * @param type The type of the error.
10
+ * @param message The error message.
11
+ * @param options Additional options for the error.
12
+ */
13
+ constructor(
14
+ public readonly type: AppErrorType,
15
+ message?: string,
16
+ options?: ErrorOptions,
17
+ ) {
18
+ super(message, options);
19
+ }
20
+ }
@@ -0,0 +1,47 @@
1
+ import type { AppErrorType } from './app-error-type';
2
+
3
+ /**
4
+ * Represents an error that occurs while fetching application settings.
5
+ */
6
+ export class AppSettingsError extends Error {
7
+ /**
8
+ * Creates an instance of `AppSettingsError` based on the HTTP response status.
9
+ * @param response The HTTP response.
10
+ * @param options Additional error options.
11
+ * @returns An instance of `AppSettingsError` based on the HTTP response status.
12
+ */
13
+ static fromHttpResponse(response: Response, options?: ErrorOptions): AppSettingsError {
14
+ // map well-known HTTP statuses to a specific error type
15
+ switch (response.status) {
16
+ case 401:
17
+ return new AppSettingsError(
18
+ 'unauthorized',
19
+ 'failed to load application settings, request not authorized',
20
+ options,
21
+ );
22
+ case 404:
23
+ return new AppSettingsError('not_found', 'application not found', options);
24
+ case 410:
25
+ return new AppSettingsError('deleted', 'application settings deleted', options);
26
+ }
27
+ return new AppSettingsError(
28
+ 'unknown',
29
+ `failed to load application settings, status code ${response.status}`,
30
+ options,
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Creates an instance of `AppSettingsError`.
36
+ * @param type The type of the application error.
37
+ * @param message The error message.
38
+ * @param options Additional error options.
39
+ */
40
+ constructor(
41
+ public readonly type: AppErrorType,
42
+ message?: string,
43
+ options?: ErrorOptions,
44
+ ) {
45
+ super(message, options);
46
+ }
47
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Discriminant for application-related errors.
3
+ *
4
+ * - `'not_found'` – The requested resource does not exist (HTTP 404).
5
+ * - `'unauthorized'` – The request lacks valid credentials (HTTP 401).
6
+ * - `'deleted'` – The resource has been removed (HTTP 410).
7
+ * - `'unknown'` – An unexpected failure occurred.
8
+ */
9
+ export type AppErrorType = 'not_found' | 'unauthorized' | 'unknown' | 'deleted';
package/src/errors.ts CHANGED
@@ -1,208 +1,6 @@
1
- /**
2
- * Discriminant for application-related errors.
3
- *
4
- * - `'not_found'` – The requested resource does not exist (HTTP 404).
5
- * - `'unauthorized'` – The request lacks valid credentials (HTTP 401).
6
- * - `'deleted'` The resource has been removed (HTTP 410).
7
- * - `'unknown'` – An unexpected failure occurred.
8
- */
9
- type AppErrorType = 'not_found' | 'unauthorized' | 'unknown' | 'deleted';
10
-
11
- /**
12
- * Represents an error that occurs when loading an application manifest.
13
- */
14
- export class AppManifestError extends Error {
15
- /**
16
- * Creates an instance of AppManifestError based on the HTTP response status.
17
- * @param response The HTTP response.
18
- * @param options Optional error options.
19
- * @returns An instance of AppManifestError.
20
- */
21
- static fromHttpResponse(response: Response, options?: ErrorOptions) {
22
- switch (response.status) {
23
- case 401:
24
- return new AppManifestError(
25
- 'unauthorized',
26
- 'failed to load application manifest, request not authorized',
27
- options,
28
- );
29
- case 404:
30
- return new AppManifestError('not_found', 'application manifest not found', options);
31
- case 410:
32
- return new AppManifestError('deleted', 'application manifest deleted', options);
33
- }
34
- return new AppManifestError(
35
- 'unknown',
36
- `failed to load application manifest, status code ${response.status}`,
37
- options,
38
- );
39
- }
40
-
41
- /**
42
- * Creates an instance of AppManifestError.
43
- * @param type The type of the error.
44
- * @param message The error message.
45
- * @param options Optional error options.
46
- */
47
- constructor(
48
- public readonly type: AppErrorType,
49
- message?: string,
50
- options?: ErrorOptions,
51
- ) {
52
- super(message, options);
53
- }
54
- }
55
-
56
- /**
57
- * Represents an error that occurs in the application configuration.
58
- */
59
- export class AppConfigError extends Error {
60
- /**
61
- * Creates an instance of `AppConfigError` based on the HTTP response status.
62
- * @param response The HTTP response.
63
- * @param options Additional error options.
64
- * @returns An instance of `AppConfigError` based on the HTTP response status.
65
- */
66
- static fromHttpResponse(response: Response, options?: ErrorOptions): AppConfigError {
67
- switch (response.status) {
68
- case 401:
69
- return new AppConfigError(
70
- 'unauthorized',
71
- 'failed to load application config, request not authorized',
72
- options,
73
- );
74
- case 404:
75
- return new AppConfigError('not_found', 'application config not found', options);
76
- case 410:
77
- return new AppConfigError('deleted', 'application config deleted', options);
78
- }
79
- return new AppConfigError(
80
- 'unknown',
81
- `failed to load application config, status code ${response.status}`,
82
- options,
83
- );
84
- }
85
-
86
- /**
87
- * Creates an instance of `AppConfigError`.
88
- * @param type The type of the application error.
89
- * @param message The error message.
90
- * @param options Additional error options.
91
- */
92
- constructor(
93
- public readonly type: AppErrorType,
94
- message?: string,
95
- options?: ErrorOptions,
96
- ) {
97
- super(message, options);
98
- }
99
- }
100
-
101
- /**
102
- * Represents an error that occurs in the application build.
103
- */
104
- export class AppBuildError extends Error {
105
- /**
106
- * Creates an instance of `AppBuildError` based on the HTTP response status.
107
- * @param response The HTTP response.
108
- * @param options Additional error options.
109
- * @returns An instance of `AppBuildError` based on the HTTP response status.
110
- */
111
- static fromHttpResponse(response: Response, options?: ErrorOptions): AppBuildError {
112
- switch (response.status) {
113
- case 401:
114
- return new AppBuildError(
115
- 'unauthorized',
116
- 'failed to load application build metadata, request not authorized',
117
- options,
118
- );
119
- case 404:
120
- return new AppBuildError('not_found', 'application build metadata not found', options);
121
- case 410:
122
- return new AppBuildError('deleted', 'application build deleted', options);
123
- }
124
- return new AppBuildError(
125
- 'unknown',
126
- `failed to load application build, status code ${response.status}`,
127
- options,
128
- );
129
- }
130
-
131
- /**
132
- * Creates an instance of `AppBuildError`.
133
- * @param type The type of the application error.
134
- * @param message The error message.
135
- * @param options Additional error options.
136
- */
137
- constructor(
138
- public readonly type: AppErrorType,
139
- message?: string,
140
- options?: ErrorOptions,
141
- ) {
142
- super(message, options);
143
- }
144
- }
145
-
146
- /**
147
- * Represents an error that occurs while fetching application settings.
148
- */
149
- export class AppSettingsError extends Error {
150
- /**
151
- * Creates an instance of `AppSettingsError` based on the HTTP response status.
152
- * @param response The HTTP response.
153
- * @param options Additional error options.
154
- * @returns An instance of `AppSettingsError` based on the HTTP response status.
155
- */
156
- static fromHttpResponse(response: Response, options?: ErrorOptions): AppSettingsError {
157
- switch (response.status) {
158
- case 401:
159
- return new AppSettingsError(
160
- 'unauthorized',
161
- 'failed to load application settings, request not authorized',
162
- options,
163
- );
164
- case 404:
165
- return new AppSettingsError('not_found', 'application not found', options);
166
- case 410:
167
- return new AppSettingsError('deleted', 'application settings deleted', options);
168
- }
169
- return new AppSettingsError(
170
- 'unknown',
171
- `failed to load application settings, status code ${response.status}`,
172
- options,
173
- );
174
- }
175
-
176
- /**
177
- * Creates an instance of `AppSettingsError`.
178
- * @param type The type of the application error.
179
- * @param message The error message.
180
- * @param options Additional error options.
181
- */
182
- constructor(
183
- public readonly type: AppErrorType,
184
- message?: string,
185
- options?: ErrorOptions,
186
- ) {
187
- super(message, options);
188
- }
189
- }
190
-
191
- /**
192
- * Represents an error that occurs when loading the application script.
193
- */
194
- export class AppScriptModuleError extends Error {
195
- /**
196
- * Creates a new instance of the AppScriptModuleError class.
197
- * @param type The type of the error.
198
- * @param message The error message.
199
- * @param options Additional options for the error.
200
- */
201
- constructor(
202
- public readonly type: AppErrorType,
203
- message?: string,
204
- options?: ErrorOptions,
205
- ) {
206
- super(message, options);
207
- }
208
- }
1
+ export { AppManifestError } from './errors/AppManifestError';
2
+ export { AppConfigError } from './errors/AppConfigError';
3
+ export { AppBuildError } from './errors/AppBuildError';
4
+ export { AppSettingsError } from './errors/AppSettingsError';
5
+ export { AppScriptModuleError } from './errors/AppScriptModuleError';
6
+ export type { AppErrorType } from './errors/app-error-type';
package/src/module.ts CHANGED
@@ -44,6 +44,8 @@ export const module: AppModule = {
44
44
  * @param args - The disposal arguments.
45
45
  */
46
46
  dispose: (args) => {
47
+ // `args.instance` is typed as the generic module instance, but the module descriptor
48
+ // guarantees it was created as an `AppModuleProvider` — safe to cast for disposal.
47
49
  (args.instance as unknown as AppModuleProvider).dispose();
48
50
  },
49
51
  };
package/src/schemas.ts CHANGED
@@ -77,6 +77,8 @@ const ApiApplicationPersonSchema = z.object({
77
77
  * - `allowedExtensions`: An optional array of allowed extensions for the build.
78
78
  * - `uploadedBy`: An optional schema for the person who uploaded the build.
79
79
  */
80
+ // Deliberately co-located with ApiApplicationPersonSchema, which it depends on
81
+ // fusion-lint-disable-next-line single-export-per-file
80
82
  export const ApiApplicationBuildSchema = z.object({
81
83
  version: z.string(),
82
84
  entryPoint: z.string(),
@@ -118,6 +120,8 @@ export const ApiApplicationBuildSchema = z.object({
118
120
  * - `owners` (array of ApiApplicationPersonSchema | nullish): List of owner users for the application.
119
121
  * - `build` (ApiApplicationBuildSchema | nullish): Build details of the application.
120
122
  */
123
+ // Deliberately co-located with ApiApplicationPersonSchema and ApiApplicationBuildSchema, which it depends on
124
+ // fusion-lint-disable-next-line single-export-per-file
121
125
  export const ApiApplicationSchema = z.object({
122
126
  appKey: z.string(),
123
127
  displayName: z.string(),
package/src/types.ts CHANGED
@@ -12,7 +12,7 @@ import type IApp from './app';
12
12
  export type ConfigEnvironment = Record<string, unknown>;
13
13
  export type { AppConfig } from './AppConfig';
14
14
 
15
- // biome-ignore lint/suspicious/noExplicitAny: TODO - needs proper type definition
15
+ // biome-ignore lint/suspicious/noExplicitAny: TODO(#5123) - needs proper type definition
16
16
  type Fusion = any;
17
17
 
18
18
  /**
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '8.0.2';
2
+ export const version = '8.0.3';
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppClient.Selectors.js","sourceRoot":"","sources":["../../src/AppClient.Selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAEb,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAgC,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC/E,yCAAyC;IACzC,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEzC,qEAAqE;IACrE,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC"}
@@ -1,120 +0,0 @@
1
- import { from, of, concat } from 'rxjs';
2
- import { catchError, concatMap, filter, last, map, share, switchMap } from 'rxjs/operators';
3
- import { actions } from './actions';
4
- /**
5
- * Handles the fetch manifest action by fetching the app manifest from the provider,
6
- * dispatching success or failure actions based on the result.
7
- *
8
- * @param provider The AppModuleProvider used to fetch the app manifest.
9
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
10
- */
11
- export const handleFetchManifest = (provider) => (action$) => action$.pipe(
12
- // only handle fetch manifest request actions
13
- filter(actions.fetchManifest.match),
14
- // when request is received, abort any ongoing request and start new
15
- switchMap((action) => {
16
- const { payload: { key, tag }, meta: { update }, } = action;
17
- // fetch manifest from provider
18
- const subject = from(provider.getAppManifest(key, tag)).pipe(
19
- // filter out null values
20
- filter((x) => !!x),
21
- // allow multiple subscriptions
22
- share());
23
- // first load manifest and then dispatch success action
24
- return concat(subject.pipe(map((manifest) => actions.setManifest(manifest, update))), subject.pipe(last(), map((manifest) => actions.fetchManifest.success(manifest)))).pipe(
25
- // catch any error and dispatch failure action
26
- catchError((err) => {
27
- return of(actions.fetchManifest.failure(err));
28
- }));
29
- }));
30
- /**
31
- * Handles the fetch config action by fetching the app configuration from the provider,
32
- * filtering out null values, and dispatching success or failure actions accordingly.
33
- *
34
- * @param provider The AppModuleProvider used to fetch the app configuration.
35
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
36
- */
37
- export const handleFetchConfig = (provider) => (action$) => action$.pipe(
38
- // only handle fetch config request actions
39
- filter(actions.fetchConfig.match),
40
- // when request is received, abort any ongoing request and start new
41
- switchMap(({ payload }) => {
42
- // TODO - use the configUrl directly from the manifest
43
- // fetch config from provider
44
- const subject = from(provider.getAppConfig(payload.appKey, payload.build?.version)).pipe(
45
- // filter out null values
46
- filter((x) => !!x),
47
- // allow multiple subscriptions
48
- share());
49
- // first load config and then dispatch success action
50
- return concat(subject.pipe(map((config) => actions.setConfig(config))), subject.pipe(last(), map((config) => actions.fetchConfig.success(config)))).pipe(
51
- // catch any error and dispatch failure action
52
- catchError((err) => {
53
- return of(actions.fetchConfig.failure(err));
54
- }));
55
- }));
56
- /**
57
- * Handles the fetch settings action by fetching the app settings from the provider,
58
- * filtering out null values, and dispatching success or failure actions accordingly.
59
- *
60
- * @param provider The AppModuleProvider used to fetch the app settings.
61
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
62
- */
63
- export const handleFetchSettings = (provider) => (action$) => action$.pipe(
64
- // only handle fetch settings request actions
65
- filter(actions.fetchSettings.match),
66
- // when request is received, abort any ongoing request and start new
67
- switchMap(({ payload }) => {
68
- const { appKey } = payload;
69
- // fetch settings from provider
70
- const subject = from(provider.getAppSettings(appKey)).pipe(
71
- // filter out null values
72
- filter((x) => !!x),
73
- // allow multiple subscriptions
74
- share());
75
- // first load settings and then dispatch success action
76
- return concat(subject.pipe(map((settings) => actions.setSettings(settings))), subject.pipe(last(), map((settings) => actions.fetchSettings.success(settings)))).pipe(
77
- // catch any error and dispatch failure action
78
- catchError((err) => {
79
- return of(actions.fetchSettings.failure(err));
80
- }));
81
- }));
82
- /**
83
- * Handles the set settings action by setting the app settings from the provider,
84
- * filtering out null values, and dispatching success or failure actions accordingly.
85
- *
86
- * @param provider The AppModuleProvider used to fetch the app settings.
87
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
88
- */
89
- export const handleUpdateSettings = (provider) => (action$) => {
90
- return action$.pipe(filter(actions.updateSettings.match)).pipe(switchMap(({ payload }) => {
91
- const { appKey, settings } = payload;
92
- return provider.updateAppSettings(appKey, settings).pipe(
93
- // take the last value
94
- last(),
95
- // request updating of settings and dispatch success action
96
- concatMap((updatedSettings) => from([
97
- actions.setSettings(updatedSettings),
98
- actions.updateSettings.success(updatedSettings),
99
- ])), catchError((err) => of(actions.updateSettings.failure(err))));
100
- }));
101
- };
102
- /**
103
- * Handles the import application flow.
104
- * @returns A flow that takes in actions and returns an observable of AppBundleState.
105
- */
106
- export const handleImportApplication = (provider) => (action$) => action$.pipe(
107
- // only handle import script request actions
108
- filter(actions.importApp.match),
109
- // when request is received, abort any ongoing request and start new
110
- switchMap(({ payload }) => {
111
- // dynamically import the application script
112
- return from(import(
113
- /* @vite-ignore */ /* webpackIgnore: true */
114
- [provider.assetUri, payload].join('/').replace(/\/{2,}/g, '/'))).pipe(
115
- // dispatch success action
116
- map(actions.importApp.success),
117
- // catch any error and dispatch failure action
118
- catchError((err) => of(actions.importApp.failure(err))));
119
- }));
120
- //# sourceMappingURL=flows.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flows.js","sourceRoot":"","sources":["../../../src/app/flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE5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,CACH,CAAC"}
@@ -1,41 +0,0 @@
1
- import type { Flow } from '@equinor/fusion-observable';
2
- import type { AppModuleProvider } from '../AppModuleProvider';
3
- import type { Actions } from './actions';
4
- import type { AppBundleState } from './types';
5
- /**
6
- * Handles the fetch manifest action by fetching the app manifest from the provider,
7
- * dispatching success or failure actions based on the result.
8
- *
9
- * @param provider The AppModuleProvider used to fetch the app manifest.
10
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
11
- */
12
- export declare const handleFetchManifest: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
13
- /**
14
- * Handles the fetch config action by fetching the app configuration from the provider,
15
- * filtering out null values, and dispatching success or failure actions accordingly.
16
- *
17
- * @param provider The AppModuleProvider used to fetch the app configuration.
18
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
19
- */
20
- export declare const handleFetchConfig: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
21
- /**
22
- * Handles the fetch settings action by fetching the app settings from the provider,
23
- * filtering out null values, and dispatching success or failure actions accordingly.
24
- *
25
- * @param provider The AppModuleProvider used to fetch the app settings.
26
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
27
- */
28
- export declare const handleFetchSettings: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
29
- /**
30
- * Handles the set settings action by setting the app settings from the provider,
31
- * filtering out null values, and dispatching success or failure actions accordingly.
32
- *
33
- * @param provider The AppModuleProvider used to fetch the app settings.
34
- * @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
35
- */
36
- export declare const handleUpdateSettings: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
37
- /**
38
- * Handles the import application flow.
39
- * @returns A flow that takes in actions and returns an observable of AppBundleState.
40
- */
41
- export declare const handleImportApplication: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;