@jpmorganchase/mosaic-types 0.1.0-beta.42 → 0.1.0-beta.43
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 +32 -23
- package/package.json +2 -2
package/dist/Plugin.d.ts
CHANGED
|
@@ -5,6 +5,30 @@ import type { Page } from './Page.js';
|
|
|
5
5
|
import type { MutableData, ImmutableData } from './MutableData.js';
|
|
6
6
|
export declare type LoadedPlugin = Partial<Plugin<Page>> & PluginModuleDefinition;
|
|
7
7
|
export declare type LifecycleMethod = keyof Plugin<Page>;
|
|
8
|
+
export declare type PluginErrorDescriptor = {
|
|
9
|
+
/**
|
|
10
|
+
* The plugin lifecycle method running when the error occurred
|
|
11
|
+
*/
|
|
12
|
+
lifecycleMethod: string;
|
|
13
|
+
/**
|
|
14
|
+
* The path to the loaded plugin module
|
|
15
|
+
*/
|
|
16
|
+
pluginModulePath: string;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the plugin
|
|
19
|
+
*/
|
|
20
|
+
pluginName: string;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the error
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* The path of the file that triggered the plugin error
|
|
27
|
+
*/
|
|
28
|
+
fullPath?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type PluginErrors = Array<PluginErrorDescriptor>;
|
|
31
|
+
export declare type TrackPluginErrorCallback = (errors: Array<PluginErrorDescriptor>, lifecycleMethod: string) => void;
|
|
8
32
|
/**
|
|
9
33
|
* Plugins are lifecycle-based hooks that are called on every source at different stages.
|
|
10
34
|
* Consumers will never need to invoke a lifecycle method; but for technical clarity - when a lifecycle method is called,
|
|
@@ -18,6 +42,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
18
42
|
* @param pages Array of pages from the source
|
|
19
43
|
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
20
44
|
* @param param.config A mutable object for sharing data with other lifecycle phases of all plugins for this source (including in the main thread) in this plugin
|
|
45
|
+
* @param param.namespace The namespace of the source running the plugin
|
|
21
46
|
* @param options The options passed in when declaring the plugin
|
|
22
47
|
* @returns {Promise<Page[]>} Must re-return an array of `Page` objects, modified or not
|
|
23
48
|
*/
|
|
@@ -26,6 +51,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
26
51
|
config: MutableData<ConfigData>;
|
|
27
52
|
pageExtensions: string[];
|
|
28
53
|
ignorePages: string[];
|
|
54
|
+
namespace: string;
|
|
29
55
|
}, options?: TOptions) => Promise<Array<TPage>>;
|
|
30
56
|
/**
|
|
31
57
|
* Plugin lifecycle method that triggers inside child processes.
|
|
@@ -33,6 +59,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
33
59
|
* @param mutableFilesystem Mutable virtual filesystem instance with all of this source's pages inside (and symlinks applied)
|
|
34
60
|
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
35
61
|
* @param param.config A mutable object for sharing data with other lifecycle phases of all plugins for this source (including in the main thread) in this plugin
|
|
62
|
+
* @param param.namespace The namespace of the source running the plugin
|
|
36
63
|
* @param options The options passed in when declaring the plugin
|
|
37
64
|
* @returns {void} No return expected
|
|
38
65
|
*/
|
|
@@ -41,6 +68,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
41
68
|
pageExtensions: string[];
|
|
42
69
|
ignorePages: string[];
|
|
43
70
|
config: MutableData<ConfigData>;
|
|
71
|
+
namespace: string;
|
|
44
72
|
}, options?: TOptions) => Promise<void>;
|
|
45
73
|
/**
|
|
46
74
|
* Plugin lifecycle method that triggers inside the main process.
|
|
@@ -56,6 +84,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
56
84
|
* @param param.globalConfig An immutable object for reading data from other lifecycle phases of all plugins. Shared across all sources.
|
|
57
85
|
* @param param.sharedFilesystem Mutable filesystem instance independent of any sources. Useful for global pages, like sitemaps
|
|
58
86
|
* @param param.globalFilesystem Immutable union filesystem instance with all source's pages (and symlinks applied)
|
|
87
|
+
* @param param.namespace The namespace of the source running the plugin
|
|
59
88
|
* @param options The options passed in when declaring the plugin
|
|
60
89
|
* @returns {void} No return expected
|
|
61
90
|
*/
|
|
@@ -67,6 +96,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
67
96
|
globalConfig: ImmutableData<GlobalConfigData>;
|
|
68
97
|
pageExtensions: string[];
|
|
69
98
|
ignorePages: string[];
|
|
99
|
+
namespace: string;
|
|
70
100
|
}, options?: TOptions) => Promise<void>;
|
|
71
101
|
/**
|
|
72
102
|
* Plugin lifecycle method that triggers inside the main process everytime ANY source emits new pages.
|
|
@@ -77,6 +107,7 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
77
107
|
* @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
|
|
78
108
|
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
79
109
|
* @param param.globalFilesystem Immutable union filesystem instance with all source's pages (and symlinks applied)
|
|
110
|
+
* @param param.namespace The namespace of the source running the plugin
|
|
80
111
|
* @param options The options passed in when declaring the plugin
|
|
81
112
|
* @returns {Promise<boolean>} A boolean indicating whether to clear the cache for this source
|
|
82
113
|
*/
|
|
@@ -86,28 +117,6 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
86
117
|
globalFilesystem: IUnionVolume;
|
|
87
118
|
pageExtensions: string[];
|
|
88
119
|
ignorePages: string[];
|
|
89
|
-
}, options?: TOptions) => Promise<boolean>;
|
|
90
|
-
/**
|
|
91
|
-
* Plugin lifecycle method that triggers inside the main process whenever a request to save content is made.
|
|
92
|
-
* This method should return the result of the save
|
|
93
|
-
* Returning `undefined`, false or no value, will result in the plugin runner discarding the result.
|
|
94
|
-
* @param path the route of the content being edited.
|
|
95
|
-
* @param data the data from the the request
|
|
96
|
-
* @param sourceOptions options used to create the source that is running the plugin
|
|
97
|
-
* @param mutableFilesystem Mutable filesystem instance with all of this source's pages inside (and symlinks re-applied)
|
|
98
|
-
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
99
|
-
* @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.
|
|
100
|
-
* @param param.sharedFilesystem Mutable filesystem instance independent of any sources. Useful for global pages, like sitemaps
|
|
101
|
-
* @param param.namespace The namespace of the source running the plugin
|
|
102
|
-
* @param options The options passed in when declaring the plugin
|
|
103
|
-
* @returns {Promise<unknown>} The result of the save
|
|
104
|
-
*/
|
|
105
|
-
saveContent?(path: string, data: unknown, sourceOptions: unknown, helpers: {
|
|
106
|
-
serialiser: Serialiser<TPage>;
|
|
107
|
-
config: ImmutableData<ConfigData>;
|
|
108
|
-
sharedFilesystem: IVolumeMutable;
|
|
109
|
-
pageExtensions: string[];
|
|
110
|
-
ignorePages: string[];
|
|
111
120
|
namespace: string;
|
|
112
|
-
}, options?: TOptions)
|
|
121
|
+
}, options?: TOptions) => Promise<boolean>;
|
|
113
122
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-types",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.43",
|
|
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.
|
|
31
|
+
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.43",
|
|
32
32
|
"memfs": "^3.4.12",
|
|
33
33
|
"rxjs": "^7.5.5",
|
|
34
34
|
"zod": "^3.19.1"
|