@jpmorganchase/mosaic-core 0.1.0-beta.4 → 0.1.0-beta.40
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/PluginError.d.ts +2 -0
- package/dist/PluginError.js +1 -4
- package/dist/PluginError.js.map +1 -1
- package/dist/PullDocs.d.ts +21 -0
- package/dist/PullDocs.js +53 -75
- package/dist/PullDocs.js.map +1 -1
- package/dist/Source.d.ts +28 -0
- package/dist/Source.js +134 -136
- package/dist/Source.js.map +1 -1
- package/dist/SourceManager.d.ts +12 -0
- package/dist/SourceManager.js +79 -87
- package/dist/SourceManager.js.map +1 -1
- package/dist/WorkerSubscription.d.ts +16 -0
- package/dist/WorkerSubscription.js +43 -80
- package/dist/WorkerSubscription.js.map +1 -1
- package/dist/filesystems/FileAccess.d.ts +31 -0
- package/dist/filesystems/FileAccess.js +171 -185
- package/dist/filesystems/FileAccess.js.map +1 -1
- package/dist/filesystems/ImmutableVolume.d.ts +15 -0
- package/dist/filesystems/ImmutableVolume.js +15 -42
- package/dist/filesystems/ImmutableVolume.js.map +1 -1
- package/dist/filesystems/MutableVolume.d.ts +26 -0
- package/dist/filesystems/MutableVolume.js +22 -45
- package/dist/filesystems/MutableVolume.js.map +1 -1
- package/dist/filesystems/RestrictedVolume.d.ts +24 -0
- package/dist/filesystems/RestrictedVolume.js +17 -43
- 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 +24 -0
- package/dist/helpers/parsePluginModuleDefinitions.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/operators/ObservableWorker.d.ts +3 -0
- package/dist/operators/ObservableWorker.js +9 -9
- package/dist/operators/ObservableWorker.js.map +1 -1
- package/dist/plugin/createPluginAPI.d.ts +2 -0
- package/dist/plugin/createPluginAPI.js +40 -39
- package/dist/plugin/createPluginAPI.js.map +1 -1
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +79 -60
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/loadDefinitionModules.d.ts +2 -0
- package/dist/plugin/loadDefinitionModules.js +28 -38
- package/dist/plugin/loadDefinitionModules.js.map +1 -1
- package/dist/plugin/pluginRunner.d.ts +5 -0
- package/dist/plugin/pluginRunner.js +38 -45
- package/dist/plugin/pluginRunner.js.map +1 -1
- package/dist/plugin/serialiserRunner.d.ts +5 -0
- package/dist/plugin/serialiserRunner.js +26 -37
- package/dist/plugin/serialiserRunner.js.map +1 -1
- package/dist/worker/Source.worker.d.ts +1 -0
- package/dist/worker/Source.worker.js +48 -56
- package/dist/worker/Source.worker.js.map +1 -1
- package/dist/worker/helpers/createSourceObservable.d.ts +3 -0
- package/dist/worker/helpers/createSourceObservable.js +44 -64
- package/dist/worker/helpers/createSourceObservable.js.map +1 -1
- package/package.json +20 -7
- package/CHANGELOG.md +0 -42
package/dist/PluginError.js
CHANGED
package/dist/PluginError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginError.js","sourceRoot":"","sources":["../src/PluginError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginError.js","sourceRoot":"","sources":["../src/PluginError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MosaicConfig } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
import UnionVolume from './filesystems/UnionVolume.js';
|
|
3
|
+
export default class PullDocs {
|
|
4
|
+
#private;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param config.sources Sources are observables that emit pages
|
|
8
|
+
* @param config.plugins Plugins are modules with lifecycles methods for manipulating files and/or the virtual filesystem
|
|
9
|
+
* @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
|
|
10
|
+
* @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"
|
|
11
|
+
* @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
|
|
12
|
+
*/
|
|
13
|
+
constructor(config: MosaicConfig);
|
|
14
|
+
get filesystem(): UnionVolume;
|
|
15
|
+
onSourceUpdate(callback: any): () => boolean;
|
|
16
|
+
start(): Promise<import("./Source.js").default[]>;
|
|
17
|
+
stop(): Promise<void>;
|
|
18
|
+
triggerWorkflow(name: string, filePath: string, data: any): Promise<unknown>;
|
|
19
|
+
addSource(sourceDefinition: any): Promise<import("./Source.js").default>;
|
|
20
|
+
stopSource(id: symbol): Promise<void>;
|
|
21
|
+
}
|
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 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';
|
|
29
5
|
// TODO:
|
|
30
6
|
// Remove $ref /index resolution
|
|
31
|
-
|
|
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
|
|
@@ -43,77 +25,73 @@ class PullDocs {
|
|
|
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
|
|
44
26
|
*/
|
|
45
27
|
constructor(config) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_PullDocs_vfs.set(this, void 0);
|
|
51
|
-
const sharedFilesystem = new MutableVolume_1.default(new FileAccess_1.default(new memfs_1.Volume()), '*');
|
|
52
|
-
__classPrivateFieldGet(this, _PullDocs_ufs, "f").use(sharedFilesystem);
|
|
28
|
+
validateMosaicSchema(mosaicConfigSchema, config, true);
|
|
29
|
+
const sharedFilesystem = new MutableVolume(new FileAccess(new Volume()), '*');
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
this.#ufs.use(sharedFilesystem);
|
|
53
32
|
const { ignorePages = [], sources = [], plugins = [], serialisers = [], pageExtensions = ['.mdx'] } = config;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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,
|
|
57
36
|
// Refs and aliases should be applied after all other plugins, so we add them manually with a negative priority
|
|
58
|
-
plugins
|
|
37
|
+
parsePluginModuleDefinitions(plugins)
|
|
38
|
+
.filter((plugin) => !plugin.disabled)
|
|
59
39
|
.concat({
|
|
60
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
40
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$TagPlugin'),
|
|
61
41
|
options: {}
|
|
62
42
|
}, {
|
|
63
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
43
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$CodeModPlugin'),
|
|
64
44
|
options: {},
|
|
65
45
|
// Make sure this happens as the very first plugin, so it can fix any page issues
|
|
66
46
|
priority: Number.POSITIVE_INFINITY
|
|
67
47
|
}, {
|
|
68
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
48
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$AliasPlugin'),
|
|
69
49
|
options: {},
|
|
70
50
|
priority: -1
|
|
71
51
|
}, {
|
|
72
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-plugins
|
|
52
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-plugins/$RefPlugin'),
|
|
73
53
|
options: {},
|
|
74
54
|
priority: -1
|
|
75
55
|
})
|
|
76
56
|
.sort(({ priority: priorityA = 0 }, { priority: priorityB = 0 }) => priorityB - priorityA),
|
|
77
57
|
// Auto add JSON serialiser
|
|
78
58
|
serialisers.concat({
|
|
79
|
-
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/
|
|
80
|
-
filter: /\.json
|
|
81
|
-
|
|
82
|
-
}), pageExtensions, ignorePages, __classPrivateFieldGet(this, _PullDocs_vfs, "f"), sharedFilesystem), "f");
|
|
59
|
+
modulePath: require.resolve('@jpmorganchase/mosaic-serialisers/json'),
|
|
60
|
+
filter: /\.json$/
|
|
61
|
+
}), pageExtensions, ignorePages);
|
|
83
62
|
}
|
|
84
63
|
get filesystem() {
|
|
85
|
-
return
|
|
64
|
+
return this.#vfs;
|
|
86
65
|
}
|
|
87
66
|
onSourceUpdate(callback) {
|
|
88
|
-
return
|
|
67
|
+
return this.#sourceManager.onSourceUpdate(callback);
|
|
89
68
|
}
|
|
90
|
-
start() {
|
|
91
|
-
return
|
|
92
|
-
return Promise.all(__classPrivateFieldGet(this, _PullDocs_sourceDefinitions, "f").map(source => __classPrivateFieldGet(this, _PullDocs_instances, "m", _PullDocs_addSource).call(this, source)));
|
|
93
|
-
});
|
|
69
|
+
async start() {
|
|
70
|
+
return Promise.all(this.#sourceDefinitions.map(source => this.addSource(source)));
|
|
94
71
|
}
|
|
95
|
-
stop() {
|
|
96
|
-
return
|
|
97
|
-
return __classPrivateFieldGet(this, _PullDocs_sourceManager, "f").destroyAll();
|
|
98
|
-
});
|
|
72
|
+
async stop() {
|
|
73
|
+
return this.#sourceManager.destroyAll();
|
|
99
74
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const source =
|
|
75
|
+
async triggerWorkflow(name, filePath, data) {
|
|
76
|
+
return this.#sourceManager.triggerWorkflow(name, filePath, data);
|
|
77
|
+
}
|
|
78
|
+
async addSource(sourceDefinition) {
|
|
79
|
+
const source = await this.#sourceManager.addSource(sourceDefinition, {});
|
|
105
80
|
source.onError(error => {
|
|
106
|
-
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:`));
|
|
107
82
|
console.error(error);
|
|
108
83
|
});
|
|
109
84
|
source.onExit(() => {
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
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 :-(");
|
|
113
88
|
}
|
|
114
89
|
});
|
|
115
|
-
|
|
90
|
+
this.#ufs.use(source.filesystem);
|
|
116
91
|
return source;
|
|
117
|
-
}
|
|
118
|
-
|
|
92
|
+
}
|
|
93
|
+
async stopSource(id) {
|
|
94
|
+
return this.#sourceManager.destroySource(id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
119
97
|
//# 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;AAM/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,CAAc;IAElB;;;;;;;OAOG;IACH,YAAY,MAAoB;QAC9B,oBAAoB,CAAC,k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,CAAC,EAAE;YACrB,OAAO,CAAC,KAAK,CACX,IAAI,KAAK,CAAC,oBAAoB,MAAM,CAAC,EAAE,CAAC,WAAW,kCAAkC,CAAC,CACvF,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;YAElE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5B,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,EAAU;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
package/dist/Source.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
import type { IUnionVolume, IVolumeImmutable, MutableData, PluginModuleDefinition, Serialiser, SerialiserModuleDefinition, SourceModuleDefinition, SourceWorkflow } from '@jpmorganchase/mosaic-types';
|
|
4
|
+
import MutableVolume from './filesystems/MutableVolume.js';
|
|
5
|
+
export default class Source {
|
|
6
|
+
#private;
|
|
7
|
+
config: MutableData<Record<string, unknown>>;
|
|
8
|
+
serialiser: Serialiser;
|
|
9
|
+
namespace: string;
|
|
10
|
+
id: symbol;
|
|
11
|
+
filesystem: MutableVolume;
|
|
12
|
+
constructor({ modulePath, namespace }: SourceModuleDefinition, mergedOptions: Record<string, unknown>, pageExtensions: string[], ignorePages: string[], globalFilesystem: IUnionVolume, workflows?: SourceWorkflow[]);
|
|
13
|
+
onUpdate(callback: any): () => EventEmitter;
|
|
14
|
+
onError(callback: any): () => EventEmitter;
|
|
15
|
+
onStart(callback: any): () => EventEmitter;
|
|
16
|
+
onExit(callback: any): () => EventEmitter;
|
|
17
|
+
stop(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Called when another source (not this one) has changed.
|
|
20
|
+
* This source can then ask its plugins if they also want to clear their cache in response to the other source's change.
|
|
21
|
+
*/
|
|
22
|
+
requestCacheClear(updatedSourceFilesystem: IVolumeImmutable): Promise<void>;
|
|
23
|
+
use(plugins?: PluginModuleDefinition[], serialisers?: SerialiserModuleDefinition[]): Promise<void>;
|
|
24
|
+
invokeAfterUpdate(sharedFilesystem: any, globalConfig: any): Promise<void>;
|
|
25
|
+
start(): Promise<void>;
|
|
26
|
+
isOwner(filePath: string): Promise<any>;
|
|
27
|
+
triggerWorkflow(name: string, filePath: string, data: unknown): Promise<any>;
|
|
28
|
+
}
|
package/dist/Source.js
CHANGED
|
@@ -1,165 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const WorkerSubscription_2 = require("./WorkerSubscription");
|
|
35
|
-
const createConfig_1 = __importDefault(require("./helpers/createConfig"));
|
|
36
|
-
const MutableVolume_1 = __importDefault(require("./filesystems/MutableVolume"));
|
|
37
|
-
const FileAccess_1 = __importDefault(require("./filesystems/FileAccess"));
|
|
38
|
-
class Source {
|
|
39
|
-
constructor({ modulePath, namespace }, mergedOptions, pageExtensions, ignorePages, globalFilesystem) {
|
|
40
|
-
_Source_instances.add(this);
|
|
41
|
-
_Source_emitter.set(this, new events_1.default());
|
|
42
|
-
_Source_modulePath.set(this, void 0);
|
|
43
|
-
_Source_plugins.set(this, []);
|
|
44
|
-
_Source_serialisers.set(this, []);
|
|
45
|
-
_Source_worker.set(this, void 0);
|
|
46
|
-
_Source_globalFilesystem.set(this, void 0);
|
|
47
|
-
_Source_pluginApi.set(this, void 0);
|
|
48
|
-
_Source_mergedOptions.set(this, void 0);
|
|
49
|
-
_Source_pageExtensions.set(this, void 0);
|
|
50
|
-
_Source_ignorePages.set(this, void 0);
|
|
51
|
-
__classPrivateFieldSet(this, _Source_modulePath, modulePath, "f");
|
|
52
|
-
__classPrivateFieldSet(this, _Source_mergedOptions, mergedOptions, "f");
|
|
53
|
-
__classPrivateFieldSet(this, _Source_globalFilesystem, globalFilesystem, "f");
|
|
54
|
-
__classPrivateFieldSet(this, _Source_ignorePages, ignorePages, "f");
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import md5 from 'md5';
|
|
3
|
+
import { Volume } from 'memfs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import util from 'util';
|
|
6
|
+
import FileAccess from './filesystems/FileAccess.js';
|
|
7
|
+
import MutableVolume from './filesystems/MutableVolume.js';
|
|
8
|
+
import createConfig from './helpers/createConfig.js';
|
|
9
|
+
import { bindPluginMethods, bindSerialiser } from './plugin/index.js';
|
|
10
|
+
import WorkerSubscription, { EVENT } from './WorkerSubscription.js';
|
|
11
|
+
export default class Source {
|
|
12
|
+
#emitter = new EventEmitter();
|
|
13
|
+
#modulePath;
|
|
14
|
+
#plugins = [];
|
|
15
|
+
#serialisers = [];
|
|
16
|
+
#worker;
|
|
17
|
+
#globalFilesystem;
|
|
18
|
+
#pluginApi;
|
|
19
|
+
#mergedOptions;
|
|
20
|
+
#pageExtensions;
|
|
21
|
+
#ignorePages;
|
|
22
|
+
#workflows = [];
|
|
23
|
+
config;
|
|
24
|
+
serialiser;
|
|
25
|
+
namespace;
|
|
26
|
+
id;
|
|
27
|
+
filesystem;
|
|
28
|
+
constructor({ modulePath, namespace }, mergedOptions, pageExtensions, ignorePages, globalFilesystem, workflows = []) {
|
|
29
|
+
this.#modulePath = modulePath;
|
|
30
|
+
this.#mergedOptions = mergedOptions;
|
|
31
|
+
this.#globalFilesystem = globalFilesystem;
|
|
32
|
+
this.#ignorePages = ignorePages;
|
|
33
|
+
this.#workflows = workflows;
|
|
55
34
|
this.namespace = namespace;
|
|
56
|
-
this.id = Symbol(`${
|
|
57
|
-
this.filesystem = new
|
|
58
|
-
|
|
35
|
+
this.id = Symbol(`${path.basename(path.dirname(path.resolve(modulePath, '../')))}#${md5(util.inspect(this.#mergedOptions, { sorted: true })).substring(0, 8)}`);
|
|
36
|
+
this.filesystem = new MutableVolume(new FileAccess(new Volume()), this.namespace);
|
|
37
|
+
this.#pageExtensions = pageExtensions;
|
|
59
38
|
}
|
|
60
39
|
onUpdate(callback) {
|
|
61
|
-
|
|
62
|
-
return () =>
|
|
40
|
+
this.#emitter.on(EVENT.UPDATE, callback);
|
|
41
|
+
return () => this.#emitter.off(EVENT.UPDATE, callback);
|
|
63
42
|
}
|
|
64
43
|
onError(callback) {
|
|
65
|
-
|
|
66
|
-
return () =>
|
|
44
|
+
this.#emitter.once(EVENT.ERROR, callback);
|
|
45
|
+
return () => this.#emitter.off(EVENT.ERROR, callback);
|
|
67
46
|
}
|
|
68
47
|
onStart(callback) {
|
|
69
|
-
|
|
70
|
-
return () =>
|
|
48
|
+
this.#emitter.once(EVENT.START, callback);
|
|
49
|
+
return () => this.#emitter.off(EVENT.START, callback);
|
|
71
50
|
}
|
|
72
51
|
onExit(callback) {
|
|
73
|
-
|
|
74
|
-
return () =>
|
|
52
|
+
this.#emitter.once(EVENT.EXIT, callback);
|
|
53
|
+
return () => this.#emitter.off(EVENT.EXIT, callback);
|
|
75
54
|
}
|
|
76
55
|
stop() {
|
|
77
|
-
if (
|
|
56
|
+
if (this.#worker && this.#worker.closed) {
|
|
78
57
|
throw new Error('Cannot stop source that has not started');
|
|
79
58
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
59
|
+
if (this.#worker) {
|
|
60
|
+
this.#worker.stop();
|
|
82
61
|
}
|
|
83
62
|
}
|
|
84
63
|
/**
|
|
85
64
|
* Called when another source (not this one) has changed.
|
|
86
65
|
* This source can then ask its plugins if they also want to clear their cache in response to the other source's change.
|
|
87
66
|
*/
|
|
88
|
-
requestCacheClear(updatedSourceFilesystem) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
config: this.config.asReadOnly()
|
|
97
|
-
});
|
|
98
|
-
const timeTaken = new Date().getTime() - initTime;
|
|
99
|
-
if (timeTaken > 400) {
|
|
100
|
-
console.warn(`Lifecycle phase 'shouldClearCache' for source '${this.id.description}' took ${timeTaken}ms to complete. The method is async, so this may not be an accurate measurement of execution time, but consider optimising this method if it is performing intensive operations.`);
|
|
101
|
-
}
|
|
102
|
-
if (shouldInvokeAfterUpdate === true) {
|
|
103
|
-
this.filesystem.clearCache();
|
|
104
|
-
}
|
|
67
|
+
async requestCacheClear(updatedSourceFilesystem) {
|
|
68
|
+
const initTime = new Date().getTime();
|
|
69
|
+
const shouldInvokeAfterUpdate = await this.#pluginApi.shouldClearCache(updatedSourceFilesystem, {
|
|
70
|
+
globalFilesystem: this.#globalFilesystem,
|
|
71
|
+
pageExtensions: this.#pageExtensions,
|
|
72
|
+
ignorePages: this.#ignorePages,
|
|
73
|
+
serialiser: this.serialiser,
|
|
74
|
+
config: this.config.asReadOnly()
|
|
105
75
|
});
|
|
76
|
+
const timeTaken = new Date().getTime() - initTime;
|
|
77
|
+
if (timeTaken > 400) {
|
|
78
|
+
console.warn(`Lifecycle phase 'shouldClearCache' for source '${this.id.description}' took ${timeTaken}ms to complete. The method is async, so this may not be an accurate measurement of execution time, but consider optimising this method if it is performing intensive operations.`);
|
|
79
|
+
}
|
|
80
|
+
if (shouldInvokeAfterUpdate === true) {
|
|
81
|
+
this.filesystem.clearCache();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async use(plugins = [], serialisers = []) {
|
|
85
|
+
if (this.namespace.startsWith('preview-')) {
|
|
86
|
+
console.log('[Mosaic] Preview source detected, filtering plugins to use.');
|
|
87
|
+
this.#plugins.push(...plugins.filter(plugin => !plugin.previewDisabled));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.#plugins.push(...plugins);
|
|
91
|
+
}
|
|
92
|
+
this.#serialisers.push(...serialisers);
|
|
106
93
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
94
|
+
async invokeAfterUpdate(sharedFilesystem, globalConfig) {
|
|
95
|
+
const initTime = new Date().getTime();
|
|
96
|
+
await this.#pluginApi.afterUpdate(this.filesystem.asRestricted(), {
|
|
97
|
+
globalFilesystem: this.#globalFilesystem,
|
|
98
|
+
sharedFilesystem,
|
|
99
|
+
globalConfig,
|
|
100
|
+
pageExtensions: this.#pageExtensions,
|
|
101
|
+
ignorePages: this.#ignorePages,
|
|
102
|
+
serialiser: this.serialiser,
|
|
103
|
+
config: this.config.asReadOnly()
|
|
111
104
|
});
|
|
105
|
+
const timeTaken = new Date().getTime() - initTime;
|
|
106
|
+
if (timeTaken > 800) {
|
|
107
|
+
console.warn(`Lifecycle phase 'afterUpdate' for source '${this.id.description}' took ${timeTaken / 1000}s to complete. The method is async, so this may not be an accurate measurement of execution time, but consider optimising this method if it is performing intensive operations.`);
|
|
108
|
+
}
|
|
112
109
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
config: this.config.asReadOnly()
|
|
124
|
-
});
|
|
125
|
-
const timeTaken = new Date().getTime() - initTime;
|
|
126
|
-
if (timeTaken > 800) {
|
|
127
|
-
console.warn(`Lifecycle phase 'afterUpdate' for source '${this.id.description}' took ${timeTaken / 1000}s to complete. The method is async, so this may not be an accurate measurement of execution time, but consider optimising this method if it is performing intensive operations.`);
|
|
128
|
-
}
|
|
110
|
+
#createWorker() {
|
|
111
|
+
const worker = new WorkerSubscription({
|
|
112
|
+
modulePath: this.#modulePath,
|
|
113
|
+
name: this.id.description,
|
|
114
|
+
options: this.#mergedOptions,
|
|
115
|
+
namespace: this.namespace,
|
|
116
|
+
pageExtensions: this.#pageExtensions,
|
|
117
|
+
ignorePages: this.#ignorePages,
|
|
118
|
+
plugins: this.#plugins,
|
|
119
|
+
serialisers: this.#serialisers
|
|
129
120
|
});
|
|
121
|
+
worker.once(EVENT.ERROR, error => this.#emitter.emit(EVENT.ERROR, error));
|
|
122
|
+
worker.once(EVENT.EXIT, () => {
|
|
123
|
+
this.#emitter.emit(EVENT.EXIT);
|
|
124
|
+
this.#emitter.removeAllListeners();
|
|
125
|
+
// this.filesystem.reset();
|
|
126
|
+
this.filesystem = null;
|
|
127
|
+
});
|
|
128
|
+
worker.once(EVENT.START, () => this.#emitter.emit(EVENT.START));
|
|
129
|
+
return worker;
|
|
130
130
|
}
|
|
131
|
-
start() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
__classPrivateFieldGet(this, _Source_emitter, "f").emit(WorkerSubscription_2.EVENT.UPDATE, { pages, symlinks, data });
|
|
139
|
-
}));
|
|
131
|
+
async start() {
|
|
132
|
+
this.serialiser = await bindSerialiser(this.#serialisers);
|
|
133
|
+
this.#pluginApi = await bindPluginMethods(this.#plugins);
|
|
134
|
+
this.#worker = this.#createWorker();
|
|
135
|
+
this.#worker.on(EVENT.UPDATE, async ({ data: { pages, symlinks, data } }) => {
|
|
136
|
+
this.config = createConfig(data);
|
|
137
|
+
this.#emitter.emit(EVENT.UPDATE, { pages, symlinks, data });
|
|
140
138
|
});
|
|
141
139
|
}
|
|
140
|
+
async isOwner(filePath) {
|
|
141
|
+
const isFileInSource = await this.filesystem.promises.exists(filePath);
|
|
142
|
+
return isFileInSource;
|
|
143
|
+
}
|
|
144
|
+
async triggerWorkflow(name, filePath, data) {
|
|
145
|
+
const foundWorkflows = this.#workflows.filter(workflow => workflow.name === name);
|
|
146
|
+
if (foundWorkflows.length === 0) {
|
|
147
|
+
return {
|
|
148
|
+
error: `[Mosaic] Workflow ${name} not found for ${this.id.description.toString()}`
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (foundWorkflows.length > 1) {
|
|
152
|
+
return {
|
|
153
|
+
error: `[Mosaic] Multiple workflows with "${name}" found for ${this.id.description.toString()}`
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const triggeredWorkflow = foundWorkflows[0];
|
|
157
|
+
if (triggeredWorkflow) {
|
|
158
|
+
return triggeredWorkflow.action(this.#mergedOptions, triggeredWorkflow.options, filePath, data);
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
142
162
|
}
|
|
143
|
-
exports.default = Source;
|
|
144
|
-
_Source_emitter = new WeakMap(), _Source_modulePath = new WeakMap(), _Source_plugins = new WeakMap(), _Source_serialisers = new WeakMap(), _Source_worker = new WeakMap(), _Source_globalFilesystem = new WeakMap(), _Source_pluginApi = new WeakMap(), _Source_mergedOptions = new WeakMap(), _Source_pageExtensions = new WeakMap(), _Source_ignorePages = new WeakMap(), _Source_instances = new WeakSet(), _Source_createWorker = function _Source_createWorker() {
|
|
145
|
-
const worker = new WorkerSubscription_1.default({
|
|
146
|
-
modulePath: __classPrivateFieldGet(this, _Source_modulePath, "f"),
|
|
147
|
-
name: this.id.description,
|
|
148
|
-
options: __classPrivateFieldGet(this, _Source_mergedOptions, "f"),
|
|
149
|
-
namespace: this.namespace,
|
|
150
|
-
pageExtensions: __classPrivateFieldGet(this, _Source_pageExtensions, "f"),
|
|
151
|
-
ignorePages: __classPrivateFieldGet(this, _Source_ignorePages, "f"),
|
|
152
|
-
plugins: __classPrivateFieldGet(this, _Source_plugins, "f"),
|
|
153
|
-
serialisers: __classPrivateFieldGet(this, _Source_serialisers, "f")
|
|
154
|
-
});
|
|
155
|
-
worker.once(WorkerSubscription_2.EVENT.ERROR, error => __classPrivateFieldGet(this, _Source_emitter, "f").emit(WorkerSubscription_2.EVENT.ERROR, error));
|
|
156
|
-
worker.once(WorkerSubscription_2.EVENT.EXIT, () => {
|
|
157
|
-
__classPrivateFieldGet(this, _Source_emitter, "f").emit(WorkerSubscription_2.EVENT.EXIT);
|
|
158
|
-
__classPrivateFieldGet(this, _Source_emitter, "f").removeAllListeners();
|
|
159
|
-
//this.filesystem.reset();
|
|
160
|
-
this.filesystem = null;
|
|
161
|
-
});
|
|
162
|
-
worker.once(WorkerSubscription_2.EVENT.START, () => __classPrivateFieldGet(this, _Source_emitter, "f").emit(WorkerSubscription_2.EVENT.START));
|
|
163
|
-
return worker;
|
|
164
|
-
};
|
|
165
163
|
//# sourceMappingURL=Source.js.map
|
package/dist/Source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Source.js","sourceRoot":"","sources":["../src/Source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Source.js","sourceRoot":"","sources":["../src/Source.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AAcxB,OAAO,UAAU,MAAM,6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