@jpmorganchase/mosaic-types 0.1.0-beta.51 → 0.1.0-beta.53

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/dist/Plugin.d.ts CHANGED
@@ -139,4 +139,32 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
139
139
  ignorePages: string[];
140
140
  namespace: string;
141
141
  }, options?: TOptions) => Promise<boolean>;
142
+ /**
143
+ * Plugin lifecycle method that triggers inside the main process **ONLY** if the `shouldUpdateNamespaceSources` method returns true.
144
+ * Calls after the filesystem and symlinks have been reconstructed due to a change to the current source. This happens in the main thread.
145
+ * Pages will NOT be cached when read at this stage, to allow for reading content and writing a new copy of it without the cached version taking effect.
146
+ * This method is safe to use with lazy loading, as the filesystem should return the full page when read.
147
+ * NOTE: Plugin methods that trigger inside the parent process should be async and highly optimised to avoid holding up the main thread.
148
+ * You should also be mindful of race conditions when reading / writing to the global filesystem from this method - as other plugins may
149
+ * also have a read copy of the same file and it could end up out of sync.
150
+ * @param mutableFilesystem Mutable filesystem instance with all of this source's pages inside (and symlinks re-applied)
151
+ * @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
152
+ * @param param.config An immutable object for reading data from other lifecycle phases of all plugins for this source in the child process for this plugin. Shared only with this source.
153
+ * @param param.globalConfig An immutable object for reading data from other lifecycle phases of all plugins. Shared across all sources.
154
+ * @param param.sharedFilesystem Mutable filesystem instance independent of any sources. Useful for global pages, like sitemaps
155
+ * @param param.globalFilesystem Immutable union filesystem instance with all source's pages (and symlinks applied)
156
+ * @param param.namespace The namespace of the source running the plugin
157
+ * @param options The options passed in when declaring the plugin
158
+ * @returns {void} No return expected
159
+ */
160
+ afterNamespaceSourceUpdate?: (mutableFilesystem: IVolumePartiallyMutable, helpers: {
161
+ serialiser: Serialiser<TPage>;
162
+ config: ImmutableData<ConfigData>;
163
+ globalFilesystem: IUnionVolume;
164
+ sharedFilesystem: IVolumeMutable;
165
+ globalConfig: ImmutableData<GlobalConfigData>;
166
+ pageExtensions: string[];
167
+ ignorePages: string[];
168
+ namespace: string;
169
+ }, options?: TOptions) => Promise<void>;
142
170
  };
@@ -1,6 +1,13 @@
1
- export declare type SourceWorkflowAction<TSourceOptions, TOptions> = (sourceOptions: TSourceOptions, workflowOptions: TOptions, ...args: any[]) => Promise<unknown>;
1
+ export declare type SourceWorkflowAction<TSourceOptions, TOptions> = (sendWorkflowProgressMessage: SendSourceWorkflowMessage, sourceOptions: TSourceOptions, workflowOptions: TOptions, ...args: any[]) => Promise<unknown>;
2
2
  export declare type SourceWorkflow<TSourceOptions = unknown, TOptions = unknown> = {
3
3
  name: string;
4
4
  options?: TOptions;
5
5
  action: SourceWorkflowAction<TSourceOptions, TOptions>;
6
6
  };
7
+ export declare type SourceWorkflowMessageStatus = 'SUCCESS' | 'ERROR' | 'IN_PROGRESS' | 'COMPLETE';
8
+ export declare type SendSourceWorkflowMessage = (message: any, status: SourceWorkflowMessageStatus) => void;
9
+ export declare type SourceWorkflowMessageEvent = {
10
+ status: SourceWorkflowMessageStatus;
11
+ message: any;
12
+ channel?: string;
13
+ };
package/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './Volume.js';
11
11
  export * from './WorkerData.js';
12
12
  export * from './Mode.js';
13
13
  export * from './Session.js';
14
+ export * from './SourceWorkflow.js';
14
15
  export { SerialiserModuleDefinition, MosaicConfig, PluginModuleDefinition, SourceModuleDefinition, SourceWorkflow, SourceSchedule };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpmorganchase/mosaic-types",
3
- "version": "0.1.0-beta.51",
3
+ "version": "0.1.0-beta.53",
4
4
  "description": "Mosaic BitBucket source for core file system",
5
5
  "license": "Apache-2.0",
6
6
  "author": "",
@@ -28,7 +28,7 @@
28
28
  "lint": "eslint --ignore-pattern \"**/__tests__/**\""
29
29
  },
30
30
  "devDependencies": {
31
- "@jpmorganchase/mosaic-schemas": "^0.1.0-beta.51",
31
+ "@jpmorganchase/mosaic-schemas": "^0.1.0-beta.53",
32
32
  "memfs": "^3.4.12",
33
33
  "rxjs": "^7.5.5",
34
34
  "zod": "^3.22.3"