@jpmorganchase/mosaic-core 0.1.0-beta.9 → 0.1.0-beta.90
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/PullDocs.d.ts +27 -0
- package/dist/PullDocs.js +64 -79
- package/dist/PullDocs.js.map +1 -1
- package/dist/Source.d.ts +31 -0
- package/dist/Source.js +165 -184
- package/dist/Source.js.map +1 -1
- package/dist/SourceManager.d.ts +41 -0
- package/dist/SourceManager.js +122 -95
- package/dist/SourceManager.js.map +1 -1
- package/dist/WorkerSubscription.d.ts +16 -0
- package/dist/WorkerSubscription.js +50 -64
- package/dist/WorkerSubscription.js.map +1 -1
- package/dist/filesystems/FileAccess.d.ts +33 -0
- package/dist/filesystems/FileAccess.js +161 -189
- package/dist/filesystems/FileAccess.js.map +1 -1
- package/dist/filesystems/ImmutableVolume.d.ts +15 -0
- package/dist/filesystems/ImmutableVolume.js +15 -30
- package/dist/filesystems/ImmutableVolume.js.map +1 -1
- package/dist/filesystems/MutableVolume.d.ts +26 -0
- package/dist/filesystems/MutableVolume.js +22 -52
- package/dist/filesystems/MutableVolume.js.map +1 -1
- package/dist/filesystems/RestrictedVolume.d.ts +24 -0
- package/dist/filesystems/RestrictedVolume.js +16 -34
- package/dist/filesystems/RestrictedVolume.js.map +1 -1
- package/dist/filesystems/UnionFileAccess.d.ts +23 -0
- package/dist/filesystems/UnionFileAccess.js +20 -54
- package/dist/filesystems/UnionFileAccess.js.map +1 -1
- package/dist/filesystems/UnionVolume.d.ts +7 -0
- package/dist/filesystems/UnionVolume.js +10 -29
- package/dist/filesystems/UnionVolume.js.map +1 -1
- package/dist/helpers/createConfig.d.ts +2 -0
- package/dist/helpers/createConfig.js +12 -13
- package/dist/helpers/createConfig.js.map +1 -1
- package/dist/helpers/parsePluginModuleDefinitions.d.ts +13 -0
- package/dist/helpers/parsePluginModuleDefinitions.js +28 -0
- package/dist/helpers/parsePluginModuleDefinitions.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/operators/ObservableWorker.d.ts +3 -0
- package/dist/operators/ObservableWorker.js +9 -8
- package/dist/operators/ObservableWorker.js.map +1 -1
- package/dist/plugin/createPluginAPI.d.ts +2 -0
- package/dist/plugin/createPluginAPI.js +54 -59
- package/dist/plugin/createPluginAPI.js.map +1 -1
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +52 -113
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/loadDefinitionModules.d.ts +2 -0
- package/dist/plugin/loadDefinitionModules.js +21 -35
- package/dist/plugin/loadDefinitionModules.js.map +1 -1
- package/dist/plugin/pluginRunner.d.ts +8 -0
- package/dist/plugin/pluginRunner.js +50 -55
- package/dist/plugin/pluginRunner.js.map +1 -1
- package/dist/plugin/serialiserRunner.d.ts +5 -0
- package/dist/plugin/serialiserRunner.js +31 -42
- package/dist/plugin/serialiserRunner.js.map +1 -1
- package/dist/worker/Source.worker.d.ts +1 -0
- package/dist/worker/Source.worker.js +48 -53
- package/dist/worker/Source.worker.js.map +1 -1
- package/dist/worker/helpers/createSourceObservable.d.ts +3 -0
- package/dist/worker/helpers/createSourceObservable.js +46 -56
- package/dist/worker/helpers/createSourceObservable.js.map +1 -1
- package/dist/worker/helpers/exponentialBackOffRetryStrategy.d.ts +9 -0
- package/dist/worker/helpers/exponentialBackOffRetryStrategy.js +19 -0
- package/dist/worker/helpers/exponentialBackOffRetryStrategy.js.map +1 -0
- package/package.json +21 -10
- package/CHANGELOG.md +0 -103
- package/dist/PluginError.js +0 -6
- package/dist/PluginError.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MosaicConfig, SourceModuleDefinition, IUnionVolume, SendSourceWorkflowMessage } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
export default class PullDocs {
|
|
3
|
+
#private;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param config.sources Sources are observables that emit pages
|
|
7
|
+
* @param config.plugins Plugins are modules with lifecycles methods for manipulating files and/or the virtual filesystem
|
|
8
|
+
* @param config.serialisers Serialisers are a form of plugin that tell PullDocs how to turn a file from/to a storable form for the filesystem - or back into a `Page` object
|
|
9
|
+
* @param config.ignorePages Page names to exclude from lazy loading / `$ref`s / `$tag`s / serialisers and also any plugins that expect pages as input. Example input would be "ignore-me.xml"
|
|
10
|
+
* @param config.pageExtensions Exts of files to treat as pages. Pages contain metadata and content, in any file format (as long as a serialiser exists to encode/decode them). They can be referenced via `$ref`s / `$tag`s and also support lazy loading
|
|
11
|
+
* @param config.schedule Schedule to re-pull content from remote sources
|
|
12
|
+
*/
|
|
13
|
+
constructor(config: MosaicConfig);
|
|
14
|
+
get filesystem(): IUnionVolume;
|
|
15
|
+
onSourceUpdate(callback: any): () => boolean;
|
|
16
|
+
start(): Promise<import("./Source.js").default[]>;
|
|
17
|
+
stop(): Promise<void>;
|
|
18
|
+
triggerWorkflow(sendWorkflowProgressMessage: SendSourceWorkflowMessage, name: string, filePath: string, data: any): void;
|
|
19
|
+
addSource(sourceDefinition: SourceModuleDefinition): Promise<import("./Source.js").default>;
|
|
20
|
+
stopSource(name: string): Promise<void>;
|
|
21
|
+
restartSource(name: string): Promise<void>;
|
|
22
|
+
listSources(): Promise<{
|
|
23
|
+
name: string;
|
|
24
|
+
pluginErrors: any;
|
|
25
|
+
index: number;
|
|
26
|
+
}[]>;
|
|
27
|
+
}
|
package/dist/PullDocs.js
CHANGED
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
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");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
17
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
18
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
19
|
-
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");
|
|
20
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
var _PullDocs_instances, _PullDocs_sourceDefinitions, _PullDocs_sourceManager, _PullDocs_ufs, _PullDocs_vfs, _PullDocs_addSource;
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const unionfs_1 = require("unionfs");
|
|
28
|
-
const memfs_1 = require("memfs");
|
|
29
|
-
const mosaic_schemas_1 = require("@jpmorganchase/mosaic-schemas");
|
|
30
|
-
const SourceManager_1 = __importDefault(require("./SourceManager"));
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { Union } from 'unionfs';
|
|
3
|
+
import { Volume } from 'memfs';
|
|
4
|
+
import { mosaicConfigSchema, validateMosaicSchema } from '@jpmorganchase/mosaic-schemas';
|
|
31
5
|
// TODO:
|
|
32
6
|
// Remove $ref /index resolution
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
import FileAccess from './filesystems/FileAccess.js';
|
|
8
|
+
import MutableVolume from './filesystems/MutableVolume.js';
|
|
9
|
+
import UnionFileAccess from './filesystems/UnionFileAccess.js';
|
|
10
|
+
import UnionVolume from './filesystems/UnionVolume.js';
|
|
11
|
+
import SourceManager from './SourceManager.js';
|
|
12
|
+
import parsePluginModuleDefinitions from './helpers/parsePluginModuleDefinitions.js';
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
export default class PullDocs {
|
|
15
|
+
#sourceDefinitions;
|
|
16
|
+
#sourceManager;
|
|
17
|
+
#ufs = new Union();
|
|
18
|
+
#vfs;
|
|
38
19
|
/**
|
|
39
20
|
*
|
|
40
21
|
* @param config.sources Sources are observables that emit pages
|
|
@@ -42,85 +23,89 @@ class PullDocs {
|
|
|
42
23
|
* @param config.serialisers Serialisers are a form of plugin that tell PullDocs how to turn a file from/to a storable form for the filesystem - or back into a `Page` object
|
|
43
24
|
* @param config.ignorePages Page names to exclude from lazy loading / `$ref`s / `$tag`s / serialisers and also any plugins that expect pages as input. Example input would be "ignore-me.xml"
|
|
44
25
|
* @param config.pageExtensions Exts of files to treat as pages. Pages contain metadata and content, in any file format (as long as a serialiser exists to encode/decode them). They can be referenced via `$ref`s / `$tag`s and also support lazy loading
|
|
26
|
+
* @param config.schedule Schedule to re-pull content from remote sources
|
|
45
27
|
*/
|
|
46
28
|
constructor(config) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_PullDocs_sourceManager.set(this, void 0);
|
|
50
|
-
_PullDocs_ufs.set(this, new unionfs_1.Union());
|
|
51
|
-
_PullDocs_vfs.set(this, void 0);
|
|
52
|
-
(0, mosaic_schemas_1.validateMosaicSchema)(mosaic_schemas_1.mosaicConfigSchema, config);
|
|
53
|
-
const sharedFilesystem = new MutableVolume_1.default(new FileAccess_1.default(new memfs_1.Volume()), '*');
|
|
29
|
+
const { ignorePages = [], sources = [], plugins = [], serialisers = [], pageExtensions = ['.mdx'], schedule } = validateMosaicSchema(mosaicConfigSchema, config, true);
|
|
30
|
+
const sharedFilesystem = new MutableVolume(new FileAccess(new Volume()), '*');
|
|
54
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
__classPrivateFieldSet(this, _PullDocs_sourceManager, new SourceManager_1.default(__classPrivateFieldGet(this, _PullDocs_vfs, "f"), sharedFilesystem,
|
|
32
|
+
this.#ufs.use(sharedFilesystem);
|
|
33
|
+
this.#sourceDefinitions = sources.filter((source) => !source.disabled);
|
|
34
|
+
this.#vfs = new UnionVolume(new UnionFileAccess(this.#ufs), '*');
|
|
35
|
+
this.#sourceManager = new SourceManager(this.#vfs, sharedFilesystem,
|
|
60
36
|
// Refs and aliases should be applied after all other plugins, so we add them manually with a negative priority
|
|
61
|
-
plugins
|
|
37
|
+
parsePluginModuleDefinitions(plugins)
|
|
38
|
+
.filter((plugin) => !plugin.disabled)
|
|
62
39
|
.concat({
|
|
63
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
40
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$TagPlugin'),
|
|
64
41
|
options: {}
|
|
65
42
|
}, {
|
|
66
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
43
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$CodeModPlugin'),
|
|
67
44
|
options: {},
|
|
68
45
|
// Make sure this happens as the very first plugin, so it can fix any page issues
|
|
69
46
|
priority: Number.POSITIVE_INFINITY
|
|
70
47
|
}, {
|
|
71
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
48
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$AliasPlugin'),
|
|
72
49
|
options: {},
|
|
73
50
|
priority: -1
|
|
74
51
|
}, {
|
|
75
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
52
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$RefPlugin'),
|
|
76
53
|
options: {},
|
|
77
54
|
priority: -1
|
|
78
55
|
})
|
|
79
56
|
.sort(({ priority: priorityA = 0 }, { priority: priorityB = 0 }) => priorityB - priorityA),
|
|
80
57
|
// Auto add JSON serialiser
|
|
81
58
|
serialisers.concat({
|
|
82
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/
|
|
59
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/json'),
|
|
83
60
|
filter: /\.json$/
|
|
84
|
-
}), pageExtensions, ignorePages
|
|
61
|
+
}), pageExtensions, ignorePages, schedule);
|
|
85
62
|
}
|
|
86
63
|
get filesystem() {
|
|
87
|
-
return
|
|
64
|
+
return this.#vfs;
|
|
88
65
|
}
|
|
89
66
|
onSourceUpdate(callback) {
|
|
90
|
-
return
|
|
67
|
+
return this.#sourceManager.onSourceUpdate(callback);
|
|
91
68
|
}
|
|
92
|
-
start() {
|
|
93
|
-
return
|
|
94
|
-
return Promise.all(__classPrivateFieldGet(this, _PullDocs_sourceDefinitions, "f").map(source => __classPrivateFieldGet(this, _PullDocs_instances, "m", _PullDocs_addSource).call(this, source)));
|
|
95
|
-
});
|
|
69
|
+
async start() {
|
|
70
|
+
return Promise.all(this.#sourceDefinitions.map(source => this.addSource(source)));
|
|
96
71
|
}
|
|
97
|
-
stop() {
|
|
98
|
-
return
|
|
99
|
-
return __classPrivateFieldGet(this, _PullDocs_sourceManager, "f").destroyAll();
|
|
100
|
-
});
|
|
72
|
+
async stop() {
|
|
73
|
+
return this.#sourceManager.destroyAll();
|
|
101
74
|
}
|
|
102
|
-
triggerWorkflow(name, filePath, data) {
|
|
103
|
-
|
|
104
|
-
return __classPrivateFieldGet(this, _PullDocs_sourceManager, "f").triggerWorkflow(name, filePath, data);
|
|
105
|
-
});
|
|
75
|
+
triggerWorkflow(sendWorkflowProgressMessage, name, filePath, data) {
|
|
76
|
+
this.#sourceManager.triggerWorkflow(sendWorkflowProgressMessage, name, filePath, data);
|
|
106
77
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_PullDocs_sourceDefinitions = new WeakMap(), _PullDocs_sourceManager = new WeakMap(), _PullDocs_ufs = new WeakMap(), _PullDocs_vfs = new WeakMap(), _PullDocs_instances = new WeakSet(), _PullDocs_addSource = function _PullDocs_addSource(sourceDefinition) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
const source = yield __classPrivateFieldGet(this, _PullDocs_sourceManager, "f").addSource(sourceDefinition, {});
|
|
78
|
+
async addSource(sourceDefinition) {
|
|
79
|
+
const source = await this.#sourceManager.addSource(sourceDefinition, {});
|
|
112
80
|
source.onError(error => {
|
|
113
|
-
console.error(new Error(`Source '${source.id.description}' threw an exception. See below:`));
|
|
81
|
+
console.error(new Error(`[Mosaic] Source '${source.id.description}' threw an exception. See below:`));
|
|
114
82
|
console.error(error);
|
|
115
83
|
});
|
|
116
84
|
source.onExit(() => {
|
|
117
|
-
|
|
118
|
-
if (
|
|
85
|
+
this.#ufs.fss.splice(this.#ufs.fss.indexOf(source.filesystem), 1);
|
|
86
|
+
if (this.#ufs.fss.length < 1) {
|
|
119
87
|
console.debug("[Mosaic] All of my source have been terminated. That's sad :-(");
|
|
120
88
|
}
|
|
121
89
|
});
|
|
122
|
-
|
|
90
|
+
this.#ufs.use(source.filesystem);
|
|
123
91
|
return source;
|
|
124
|
-
}
|
|
125
|
-
|
|
92
|
+
}
|
|
93
|
+
async stopSource(name) {
|
|
94
|
+
return this.#sourceManager.destroySource(name);
|
|
95
|
+
}
|
|
96
|
+
async restartSource(name) {
|
|
97
|
+
const sourceDef = this.#sourceManager.getSourceDefinition(name);
|
|
98
|
+
if (sourceDef) {
|
|
99
|
+
console.log(`[Mosaic][Source] ${name} restarting as requested`);
|
|
100
|
+
await this.stopSource(name);
|
|
101
|
+
await this.addSource(sourceDef);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
throw new Error(`[Mosaic] source ${name} was not found so can't be restarted`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async listSources() {
|
|
108
|
+
return this.#sourceManager.listSources();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
126
111
|
//# sourceMappingURL=PullDocs.js.map
|
package/dist/PullDocs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PullDocs.js","sourceRoot":"","sources":["../src/PullDocs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PullDocs.js","sourceRoot":"","sources":["../src/PullDocs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAQ/B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAEzF,QAAQ;AACR,gCAAgC;AAChC,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,eAAe,MAAM,kCAAkC,CAAC;AAC/D,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,4BAA4B,MAAM,2CAA2C,CAAC;AAErF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,kBAAkB,CAA2B;IAC7C,cAAc,CAAgB;IAC9B,IAAI,GAAG,IAAI,KAAK,EAAyC,CAAC;IAC1D,IAAI,CAAe;IAEnB;;;;;;;;OAQG;IACH,YAAY,MAAoB;QAC9B,MAAM,EACJ,WAAW,GAAG,EAAE,EAChB,OAAO,GAAG,EAAE,E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Ac,CAAC,WAAW,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/Source.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import type { IUnionVolume, IVolumeImmutable, MutableData, PluginErrors, PluginModuleDefinition, SendSourceWorkflowMessage, Serialiser, SerialiserModuleDefinition, SourceModuleDefinition, SourceWorkflow } from '@jpmorganchase/mosaic-types';
|
|
3
|
+
import MutableVolume from './filesystems/MutableVolume.js';
|
|
4
|
+
export default class Source {
|
|
5
|
+
#private;
|
|
6
|
+
pluginErrors: any;
|
|
7
|
+
config: MutableData<Record<string, unknown>>;
|
|
8
|
+
serialiser: Serialiser;
|
|
9
|
+
namespace: string;
|
|
10
|
+
id: symbol;
|
|
11
|
+
filesystem: MutableVolume;
|
|
12
|
+
moduleDefinition: SourceModuleDefinition;
|
|
13
|
+
constructor(moduleDefinition: SourceModuleDefinition, mergedOptions: Record<string, unknown>, pageExtensions: string[], ignorePages: string[], globalFilesystem: IUnionVolume, workflows?: SourceWorkflow[]);
|
|
14
|
+
onUpdate(callback: any): () => EventEmitter<[never]>;
|
|
15
|
+
onError(callback: any): () => EventEmitter<[never]>;
|
|
16
|
+
onStart(callback: any): () => EventEmitter<[never]>;
|
|
17
|
+
onExit(callback: any): () => EventEmitter<[never]>;
|
|
18
|
+
stop(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Called when another source (not this one) has changed.
|
|
21
|
+
* This source can then ask its plugins if they also want to clear their cache in response to the other source's change.
|
|
22
|
+
*/
|
|
23
|
+
requestCacheClear(updatedSourceFilesystem: IVolumeImmutable): Promise<void>;
|
|
24
|
+
requestNamespaceSourceUpdate(namespaceSourceDesc: string, updatedSourceFilesystem: IVolumeImmutable, sharedFilesystem: IVolumeImmutable, globalConfig: MutableData<unknown>): Promise<void>;
|
|
25
|
+
use(plugins?: PluginModuleDefinition[], serialisers?: SerialiserModuleDefinition[]): Promise<void>;
|
|
26
|
+
invokeAfterUpdate(sharedFilesystem: any, globalConfig: any, lifecycleMethod?: string): Promise<void>;
|
|
27
|
+
start(): Promise<void>;
|
|
28
|
+
isOwner(filePath: string): Promise<any>;
|
|
29
|
+
triggerWorkflow(sendWorkflowProgressMessage: SendSourceWorkflowMessage, name: string, filePath: string, data: unknown): void;
|
|
30
|
+
trackPluginErrors(errors: PluginErrors, lifecycleMethod: string): void;
|
|
31
|
+
}
|