@jpmorganchase/mosaic-core 0.1.0-beta.6 → 0.1.0-beta.61
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 +67 -76
- package/dist/PullDocs.js.map +1 -1
- package/dist/Source.d.ts +32 -0
- package/dist/Source.js +168 -158
- package/dist/Source.js.map +1 -1
- package/dist/SourceManager.d.ts +41 -0
- package/dist/SourceManager.js +119 -86
- package/dist/SourceManager.js.map +1 -1
- package/dist/WorkerSubscription.d.ts +17 -0
- package/dist/WorkerSubscription.js +50 -64
- package/dist/WorkerSubscription.js.map +1 -1
- package/dist/filesystems/FileAccess.d.ts +31 -0
- package/dist/filesystems/FileAccess.js +162 -190
- 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 +17 -35
- 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 +8 -0
- package/dist/filesystems/UnionVolume.js +14 -33
- 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 +56 -58
- package/dist/plugin/createPluginAPI.js.map +1 -1
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +52 -101
- 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 -47
- 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 +47 -57
- 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 -9
- package/CHANGELOG.md +0 -58
- 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,39 +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 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';
|
|
30
5
|
// TODO:
|
|
31
6
|
// Remove $ref /index resolution
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
37
19
|
/**
|
|
38
20
|
*
|
|
39
21
|
* @param config.sources Sources are observables that emit pages
|
|
@@ -41,80 +23,89 @@ class PullDocs {
|
|
|
41
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
|
|
42
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"
|
|
43
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
|
|
44
27
|
*/
|
|
45
28
|
constructor(config) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
_PullDocs_sourceManager.set(this, void 0);
|
|
49
|
-
_PullDocs_ufs.set(this, new unionfs_1.Union());
|
|
50
|
-
_PullDocs_vfs.set(this, void 0);
|
|
51
|
-
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()), '*');
|
|
52
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
__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,
|
|
58
36
|
// Refs and aliases should be applied after all other plugins, so we add them manually with a negative priority
|
|
59
|
-
plugins
|
|
37
|
+
parsePluginModuleDefinitions(plugins)
|
|
38
|
+
.filter((plugin) => !plugin.disabled)
|
|
60
39
|
.concat({
|
|
61
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
40
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$TagPlugin'),
|
|
62
41
|
options: {}
|
|
63
42
|
}, {
|
|
64
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
43
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$CodeModPlugin'),
|
|
65
44
|
options: {},
|
|
66
45
|
// Make sure this happens as the very first plugin, so it can fix any page issues
|
|
67
46
|
priority: Number.POSITIVE_INFINITY
|
|
68
47
|
}, {
|
|
69
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
48
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$AliasPlugin'),
|
|
70
49
|
options: {},
|
|
71
50
|
priority: -1
|
|
72
51
|
}, {
|
|
73
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
52
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$RefPlugin'),
|
|
74
53
|
options: {},
|
|
75
54
|
priority: -1
|
|
76
55
|
})
|
|
77
56
|
.sort(({ priority: priorityA = 0 }, { priority: priorityB = 0 }) => priorityB - priorityA),
|
|
78
57
|
// Auto add JSON serialiser
|
|
79
58
|
serialisers.concat({
|
|
80
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/
|
|
81
|
-
filter: /\.json
|
|
82
|
-
|
|
83
|
-
}), pageExtensions, ignorePages), "f");
|
|
59
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/json'),
|
|
60
|
+
filter: /\.json$/
|
|
61
|
+
}), pageExtensions, ignorePages, schedule);
|
|
84
62
|
}
|
|
85
63
|
get filesystem() {
|
|
86
|
-
return
|
|
64
|
+
return this.#vfs;
|
|
87
65
|
}
|
|
88
66
|
onSourceUpdate(callback) {
|
|
89
|
-
return
|
|
67
|
+
return this.#sourceManager.onSourceUpdate(callback);
|
|
90
68
|
}
|
|
91
|
-
start() {
|
|
92
|
-
return
|
|
93
|
-
return Promise.all(__classPrivateFieldGet(this, _PullDocs_sourceDefinitions, "f").map(source => __classPrivateFieldGet(this, _PullDocs_instances, "m", _PullDocs_addSource).call(this, source)));
|
|
94
|
-
});
|
|
69
|
+
async start() {
|
|
70
|
+
return Promise.all(this.#sourceDefinitions.map(source => this.addSource(source)));
|
|
95
71
|
}
|
|
96
|
-
stop() {
|
|
97
|
-
return
|
|
98
|
-
return __classPrivateFieldGet(this, _PullDocs_sourceManager, "f").destroyAll();
|
|
99
|
-
});
|
|
72
|
+
async stop() {
|
|
73
|
+
return this.#sourceManager.destroyAll();
|
|
100
74
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const source =
|
|
75
|
+
triggerWorkflow(sendWorkflowProgressMessage, name, filePath, data) {
|
|
76
|
+
this.#sourceManager.triggerWorkflow(sendWorkflowProgressMessage, name, filePath, data);
|
|
77
|
+
}
|
|
78
|
+
async addSource(sourceDefinition) {
|
|
79
|
+
const source = await this.#sourceManager.addSource(sourceDefinition, {});
|
|
106
80
|
source.onError(error => {
|
|
107
|
-
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:`));
|
|
108
82
|
console.error(error);
|
|
109
83
|
});
|
|
110
84
|
source.onExit(() => {
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
console.debug("[
|
|
85
|
+
this.#ufs.fss.splice(this.#ufs.fss.indexOf(source.filesystem), 1);
|
|
86
|
+
if (this.#ufs.fss.length < 1) {
|
|
87
|
+
console.debug("[Mosaic] All of my source have been terminated. That's sad :-(");
|
|
114
88
|
}
|
|
115
89
|
});
|
|
116
|
-
|
|
90
|
+
this.#ufs.use(source.filesystem);
|
|
117
91
|
return source;
|
|
118
|
-
}
|
|
119
|
-
|
|
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
|
+
}
|
|
120
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,EAA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B,OAAO,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;aACjF;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAiC,CAAC,CAAC;QAExD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAY;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAChE,IAAI,SAAS,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,0BAA0B,CAAC,CAAC;YAChE,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC5B,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SACjC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,sCAAsC,CAAC,CAAC;SAChF;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/Source.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
import type { IUnionVolume, IVolumeImmutable, MutableData, PluginErrors, PluginModuleDefinition, SendSourceWorkflowMessage, Serialiser, SerialiserModuleDefinition, SourceModuleDefinition, SourceWorkflow } from '@jpmorganchase/mosaic-types';
|
|
4
|
+
import MutableVolume from './filesystems/MutableVolume.js';
|
|
5
|
+
export default class Source {
|
|
6
|
+
#private;
|
|
7
|
+
pluginErrors: any;
|
|
8
|
+
config: MutableData<Record<string, unknown>>;
|
|
9
|
+
serialiser: Serialiser;
|
|
10
|
+
namespace: string;
|
|
11
|
+
id: symbol;
|
|
12
|
+
filesystem: MutableVolume;
|
|
13
|
+
moduleDefinition: SourceModuleDefinition;
|
|
14
|
+
constructor(moduleDefinition: SourceModuleDefinition, mergedOptions: Record<string, unknown>, pageExtensions: string[], ignorePages: string[], globalFilesystem: IUnionVolume, workflows?: SourceWorkflow[]);
|
|
15
|
+
onUpdate(callback: any): () => EventEmitter;
|
|
16
|
+
onError(callback: any): () => EventEmitter;
|
|
17
|
+
onStart(callback: any): () => EventEmitter;
|
|
18
|
+
onExit(callback: any): () => EventEmitter;
|
|
19
|
+
stop(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Called when another source (not this one) has changed.
|
|
22
|
+
* This source can then ask its plugins if they also want to clear their cache in response to the other source's change.
|
|
23
|
+
*/
|
|
24
|
+
requestCacheClear(updatedSourceFilesystem: IVolumeImmutable): Promise<void>;
|
|
25
|
+
requestNamespaceSourceUpdate(namespaceSourceDesc: string, updatedSourceFilesystem: IVolumeImmutable, sharedFilesystem: IVolumeImmutable, globalConfig: MutableData<unknown>): Promise<void>;
|
|
26
|
+
use(plugins?: PluginModuleDefinition[], serialisers?: SerialiserModuleDefinition[]): Promise<void>;
|
|
27
|
+
invokeAfterUpdate(sharedFilesystem: any, globalConfig: any, lifecycleMethod?: string): Promise<void>;
|
|
28
|
+
start(): Promise<void>;
|
|
29
|
+
isOwner(filePath: string): Promise<any>;
|
|
30
|
+
triggerWorkflow(sendWorkflowProgressMessage: SendSourceWorkflowMessage, name: string, filePath: string, data: unknown): void;
|
|
31
|
+
trackPluginErrors(errors: PluginErrors, lifecycleMethod: string): void;
|
|
32
|
+
}
|