@jpmorganchase/mosaic-types 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/Content.d.ts +11 -0
- package/dist/IFileAccess.d.ts +4 -18
- package/dist/Meta.d.ts +1 -1
- package/dist/Mode.d.ts +16 -0
- package/dist/MutableData.d.ts +2 -2
- package/dist/Page.d.ts +1 -1
- package/dist/Plugin.d.ts +74 -17
- package/dist/Serialiser.d.ts +5 -5
- package/dist/Session.d.ts +22 -0
- package/dist/Source.d.ts +22 -7
- package/dist/SourceWorkflow.d.ts +9 -2
- package/dist/Volume.d.ts +6 -18
- package/dist/WorkerData.d.ts +3 -2
- package/dist/index.d.ts +15 -11
- package/package.json +16 -7
- package/CHANGELOG.md +0 -70
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [[`ContentProps`]] specifies the page source/content
|
|
3
|
+
*/
|
|
4
|
+
export interface ContentProps {
|
|
5
|
+
/** Page source, which will be page type specific */
|
|
6
|
+
source?: Record<string, unknown>;
|
|
7
|
+
/** Page type */
|
|
8
|
+
type?: string;
|
|
9
|
+
/** Raw page content, includes markdown and frontmatter */
|
|
10
|
+
raw?: string;
|
|
11
|
+
}
|
package/dist/IFileAccess.d.ts
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { DirectoryJSON, IRealpathOptions, IMkdirOptions, IReaddirOptions, TData, TMode } from 'memfs/lib/volume';
|
|
3
|
-
import type { TDataOut } from 'memfs/lib/encoding';
|
|
4
|
-
import type Dirent from 'memfs/lib/Dirent';
|
|
5
|
-
import type Stats from 'memfs/lib/Stats';
|
|
6
|
-
import type { TStatNumber } from 'memfs/lib/Stats';
|
|
7
|
-
import type { IStatOptions } from 'memfs/lib/volume';
|
|
8
|
-
import type { PathLike, symlink } from 'fs';
|
|
9
|
-
import type { Page } from './Page';
|
|
10
1
|
import type { Options, Pattern, Entry } from 'fast-glob';
|
|
2
|
+
import type { DirectoryJSON, IFs } from 'memfs';
|
|
3
|
+
import type { PathLike } from 'fs';
|
|
4
|
+
import type { Page } from './Page.js';
|
|
11
5
|
/**
|
|
12
6
|
* This is the core underlying filesystem, which directly interfaces with a memfs Volume to mutate the filesystem
|
|
13
7
|
*/
|
|
14
|
-
export interface IFileAccess {
|
|
8
|
+
export interface IFileAccess extends Pick<IFs['promises'], 'mkdir' | 'readdir' | 'readFile' | 'realpath' | 'stat' | 'unlink' | 'symlink' | 'writeFile'> {
|
|
15
9
|
glob(pattern: Pattern, options?: Omit<Options, 'absolute' | 'fs'>): Promise<string[] | Entry[]>;
|
|
16
|
-
mkdir(dir: PathLike, options?: TMode | IMkdirOptions): Promise<void>;
|
|
17
|
-
readdir(dir: PathLike, options?: string | IReaddirOptions): Promise<TDataOut[] | Dirent[]>;
|
|
18
|
-
readFile(file: PathLike): Promise<TDataOut>;
|
|
19
|
-
realpath(target: string, options?: string | IRealpathOptions): Promise<TDataOut>;
|
|
20
|
-
stat(file: PathLike, options?: IStatOptions): Promise<Stats<TStatNumber>>;
|
|
21
|
-
unlink(target: PathLike): Promise<void>;
|
|
22
|
-
symlink(target: PathLike, alias: PathLike, type?: symlink.Type): Promise<void>;
|
|
23
|
-
writeFile(file: PathLike, data: TData): Promise<void>;
|
|
24
10
|
toJSON(): DirectoryJSON;
|
|
25
11
|
fromJSON(json: DirectoryJSON): void;
|
|
26
12
|
exists(file: PathLike): Promise<boolean>;
|
package/dist/Meta.d.ts
CHANGED
package/dist/Mode.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mosaic mode dictates how content is loaded
|
|
3
|
+
*
|
|
4
|
+
* `active`
|
|
5
|
+
* In this mode, content is pulled from configured data sources and updates in real-time.
|
|
6
|
+
* After content is updated, Mosaic plugins create an enhanced, in-memory file object, representing the content
|
|
7
|
+
*
|
|
8
|
+
* `snapshot-file`
|
|
9
|
+
* In this mode, previously created snapshot files are loaded from a local directory.
|
|
10
|
+
*
|
|
11
|
+
* `snapshot-s3`
|
|
12
|
+
* In this mode, previously created snapshot files are loaded from an S3 bucket.
|
|
13
|
+
*
|
|
14
|
+
* (A snapshot is an immutable/persisted copy of `active` content, created separately)
|
|
15
|
+
*/
|
|
16
|
+
export type MosaicMode = 'active' | 'snapshot-file' | 'snapshot-s3';
|
package/dist/MutableData.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface BaseData {
|
|
|
16
16
|
globalRefs?: GlobalRefs | [];
|
|
17
17
|
aliases?: Aliases | [];
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type MutableData<T = {}> = ImmutableData<T> & {
|
|
20
20
|
/**
|
|
21
21
|
* Set arbitrary data onto the config object. This value will persist across plugins and
|
|
22
22
|
* also be sent to the parent process when it executes plugins there as well.
|
|
@@ -63,7 +63,7 @@ export declare type MutableData<T = {}> = ImmutableData<T> & {
|
|
|
63
63
|
*/
|
|
64
64
|
asReadOnly(): ImmutableData<T>;
|
|
65
65
|
};
|
|
66
|
-
export
|
|
66
|
+
export type ImmutableData<T = {}> = {
|
|
67
67
|
readonly data: Readonly<T & {
|
|
68
68
|
readonly refs: string[];
|
|
69
69
|
readonly aliases: Set<{
|
package/dist/Page.d.ts
CHANGED
package/dist/Plugin.d.ts
CHANGED
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
import type { IUnionVolume, IVolumeImmutable, IVolumeMutable, IVolumePartiallyMutable } from './Volume.js';
|
|
2
|
+
import type { PluginModuleDefinition } from './index.js';
|
|
3
|
+
import type { Serialiser } from './Serialiser.js';
|
|
4
|
+
import type { Page } from './Page.js';
|
|
5
|
+
import type { MutableData, ImmutableData } from './MutableData.js';
|
|
6
|
+
export type LoadedPlugin = Partial<Plugin<Page>> & PluginModuleDefinition;
|
|
7
|
+
export type LifecycleMethod = keyof Plugin<Page>;
|
|
8
|
+
export 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 type PluginErrors = Array<PluginErrorDescriptor>;
|
|
31
|
+
export 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,
|
|
11
35
|
* it will trigger `pluginRunner` which executes it on every source automatically.
|
|
12
36
|
*/
|
|
13
|
-
export
|
|
37
|
+
export type Plugin<TPage extends Page = Page, TOptions = Record<string, unknown>, ConfigData = Record<string, unknown>, GlobalConfigData = ConfigData> = {
|
|
14
38
|
/**
|
|
15
39
|
* Plugin lifecycle method that triggers inside child processes.
|
|
16
40
|
* The first lifecycle hook to trigger after receiving pages from a source. The pages can safely be mutated and will be reflected in the final
|
|
@@ -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,54 @@ export declare type Plugin<TPage extends Page = Page, TOptions = Record<string,
|
|
|
86
117
|
globalFilesystem: IUnionVolume;
|
|
87
118
|
pageExtensions: string[];
|
|
88
119
|
ignorePages: string[];
|
|
120
|
+
namespace: string;
|
|
121
|
+
}, options?: TOptions) => Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Plugin lifecycle method that triggers inside the main process everytime ANY source emits new pages.
|
|
124
|
+
* This method should return a boolean that will indicate if this source should force other namespace sources to re-run afterUpdate.
|
|
125
|
+
* Returning `undefined`, false or no value, will result in no update being triggered for namespace sources
|
|
126
|
+
* @param updatedSourceFilesystem Immutable filesystem for the source that changed
|
|
127
|
+
* @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
|
|
128
|
+
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
129
|
+
* @param param.globalFilesystem Immutable union filesystem instance with all source's pages (and symlinks applied)
|
|
130
|
+
* @param param.namespace The namespace of the source running the plugin
|
|
131
|
+
* @param options The options passed in when declaring the plugin
|
|
132
|
+
* @returns {Promise<boolean>} A boolean indicating whether to clear the cache for this source
|
|
133
|
+
*/
|
|
134
|
+
shouldUpdateNamespaceSources?: (updatedSourceFilesystem: IVolumeImmutable, helpers: {
|
|
135
|
+
serialiser: Serialiser<TPage>;
|
|
136
|
+
config: ImmutableData<ConfigData>;
|
|
137
|
+
globalFilesystem: IUnionVolume;
|
|
138
|
+
pageExtensions: string[];
|
|
139
|
+
ignorePages: string[];
|
|
140
|
+
namespace: string;
|
|
89
141
|
}, options?: TOptions) => Promise<boolean>;
|
|
90
142
|
/**
|
|
91
|
-
* Plugin lifecycle method that triggers inside the main process
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
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.
|
|
97
150
|
* @param mutableFilesystem Mutable filesystem instance with all of this source's pages inside (and symlinks re-applied)
|
|
98
151
|
* @param param.serialiser A matching `Serialiser` for serialising/deserialising pages when reading/writing to the filesystem
|
|
99
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.
|
|
100
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)
|
|
101
156
|
* @param param.namespace The namespace of the source running the plugin
|
|
102
157
|
* @param options The options passed in when declaring the plugin
|
|
103
|
-
* @returns {
|
|
158
|
+
* @returns {void} No return expected
|
|
104
159
|
*/
|
|
105
|
-
|
|
160
|
+
afterNamespaceSourceUpdate?: (mutableFilesystem: IVolumePartiallyMutable, helpers: {
|
|
106
161
|
serialiser: Serialiser<TPage>;
|
|
107
162
|
config: ImmutableData<ConfigData>;
|
|
163
|
+
globalFilesystem: IUnionVolume;
|
|
108
164
|
sharedFilesystem: IVolumeMutable;
|
|
165
|
+
globalConfig: ImmutableData<GlobalConfigData>;
|
|
109
166
|
pageExtensions: string[];
|
|
110
167
|
ignorePages: string[];
|
|
111
168
|
namespace: string;
|
|
112
|
-
}, options?: TOptions)
|
|
169
|
+
}, options?: TOptions) => Promise<void>;
|
|
113
170
|
};
|
package/dist/Serialiser.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { SerialiserModuleDefinition } from './index.js';
|
|
2
|
+
import type { Page } from './Page.js';
|
|
3
|
+
import type { TDataOut } from './Volume.js';
|
|
4
4
|
/**
|
|
5
5
|
* Serialisers are a form of plugin that tells Mosaic how to turn a file from/to a storable form for the filesystem
|
|
6
6
|
* or a `Page` object.
|
|
7
7
|
* For technical clarity - when a parser method is called, it will trigger `parserRunner` which checks the `fullPath` against
|
|
8
8
|
* the `test` option that was passed in the Mosaic config file, to find a suitable parser.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type Serialiser<TPage extends Page = Page> = {
|
|
11
11
|
/**
|
|
12
12
|
* Method to turn a raw page (e.g. an MDX file) into a `Page` object
|
|
13
13
|
* @param fullPath Route on virtual disk (should be full fullPath, not an alias)
|
|
@@ -23,4 +23,4 @@ export declare type Serialiser<TPage extends Page = Page> = {
|
|
|
23
23
|
*/
|
|
24
24
|
serialise: (fullPath: string, page: TPage) => Promise<TDataOut>;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type LoadedSerialiser = Serialiser & SerialiserModuleDefinition;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type JWT = {
|
|
2
|
+
exp: number;
|
|
3
|
+
UserID?: string;
|
|
4
|
+
JPMCIdentifier?: string;
|
|
5
|
+
UID?: string;
|
|
6
|
+
EmployeeCorporateID?: string;
|
|
7
|
+
CostCenter?: string;
|
|
8
|
+
Country?: string;
|
|
9
|
+
CountryCode?: string;
|
|
10
|
+
Department?: string;
|
|
11
|
+
DisplayName?: string;
|
|
12
|
+
Email?: string;
|
|
13
|
+
EmployeeType?: string;
|
|
14
|
+
FirstName?: string;
|
|
15
|
+
LastName?: string;
|
|
16
|
+
LOB?: string;
|
|
17
|
+
LocationCode?: string;
|
|
18
|
+
};
|
|
19
|
+
export type Session<TUserProfile> = {
|
|
20
|
+
isLoggedIn: boolean;
|
|
21
|
+
user?: TUserProfile;
|
|
22
|
+
};
|
package/dist/Source.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
|
-
import type { Serialiser } from './Serialiser';
|
|
3
|
-
import type { Page } from './Page';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { Serialiser } from './Serialiser.js';
|
|
3
|
+
import type { Page } from './Page.js';
|
|
4
|
+
import { SourceSchedule } from './index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Provided by Mosaic to a Source
|
|
7
|
+
*/
|
|
8
|
+
export type SourceConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* The allowed page extensions Mosaic has been configured to use
|
|
11
|
+
*/
|
|
12
|
+
pageExtensions: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The page serialiser compatible with the pageExtensions
|
|
15
|
+
*/
|
|
16
|
+
serialiser: Serialiser;
|
|
17
|
+
/**
|
|
18
|
+
* Scheduling configuration for the source
|
|
19
|
+
*/
|
|
20
|
+
schedule: SourceSchedule;
|
|
21
|
+
};
|
|
22
|
+
export type Source<TOptions = Record<string, unknown>, TPage extends Page = Page> = {
|
|
23
|
+
create(options: TOptions, helpers: SourceConfig): Observable<TPage[]>;
|
|
9
24
|
};
|
package/dist/SourceWorkflow.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type SourceWorkflowAction<TSourceOptions, TOptions> = (sendWorkflowProgressMessage: SendSourceWorkflowMessage, sourceOptions: TSourceOptions, workflowOptions: TOptions, ...args: any[]) => Promise<unknown>;
|
|
2
|
+
export type SourceWorkflow<TSourceOptions = unknown, TOptions = Record<string, unknown>> = {
|
|
3
3
|
name: string;
|
|
4
4
|
options?: TOptions;
|
|
5
5
|
action: SourceWorkflowAction<TSourceOptions, TOptions>;
|
|
6
6
|
};
|
|
7
|
+
export type SourceWorkflowMessageStatus = 'SUCCESS' | 'ERROR' | 'IN_PROGRESS' | 'COMPLETE';
|
|
8
|
+
export type SendSourceWorkflowMessage = (message: any, status: SourceWorkflowMessageStatus) => void;
|
|
9
|
+
export type SourceWorkflowMessageEvent = {
|
|
10
|
+
status: SourceWorkflowMessageStatus;
|
|
11
|
+
message: any;
|
|
12
|
+
channel?: string;
|
|
13
|
+
};
|
package/dist/Volume.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { TDataOut } from 'memfs/lib/encoding';
|
|
4
|
-
import type Dirent from 'memfs/lib/Dirent';
|
|
5
|
-
import type Stats from 'memfs/lib/Stats';
|
|
6
|
-
import type { TStatNumber } from 'memfs/lib/Stats';
|
|
7
|
-
import type { IStatOptions } from 'memfs/lib/volume';
|
|
8
|
-
import type { PathLike, symlink } from 'fs';
|
|
1
|
+
import type { DirectoryJSON, IFs } from 'memfs';
|
|
2
|
+
import type { PathLike } from 'fs';
|
|
9
3
|
import type { Options, Pattern, Entry } from 'fast-glob';
|
|
4
|
+
type TDataOut = string | Buffer;
|
|
5
|
+
export type { TDataOut };
|
|
10
6
|
/**
|
|
11
7
|
* Volumes are lightweight decorators which wrap `FileAccess` and limit access to the underlying API for different use-cases
|
|
12
8
|
* Examples include disallowing mutation or allowing underlying functions like resetting
|
|
@@ -22,17 +18,9 @@ export interface IVolume {
|
|
|
22
18
|
}[];
|
|
23
19
|
};
|
|
24
20
|
fromJSON?(json: DirectoryJSON): void;
|
|
25
|
-
promises: {
|
|
21
|
+
promises: Pick<IFs['promises'], 'mkdir' | 'readdir' | 'readFile' | 'realpath' | 'stat' | 'symlink' | 'unlink' | 'writeFile'> & {
|
|
26
22
|
exists(file: PathLike): Promise<boolean>;
|
|
27
23
|
glob(pattern: Pattern, options?: Options): Promise<string[] | Entry[]>;
|
|
28
|
-
mkdir(dir: PathLike, options?: TMode | IMkdirOptions): Promise<void>;
|
|
29
|
-
readdir(dir: PathLike, options?: string | IReaddirOptions): Promise<TDataOut[] | Dirent[]>;
|
|
30
|
-
readFile(file: PathLike): Promise<TDataOut>;
|
|
31
|
-
realpath(target: string, options?: string | IRealpathOptions): Promise<TDataOut>;
|
|
32
|
-
stat(file: PathLike, options?: IStatOptions): Promise<Stats<TStatNumber>>;
|
|
33
|
-
symlink(target: PathLike, alias: PathLike, type?: symlink.Type): Promise<void>;
|
|
34
|
-
unlink(target: PathLike): Promise<void>;
|
|
35
|
-
writeFile(file: PathLike, data: TData): Promise<void>;
|
|
36
24
|
};
|
|
37
25
|
}
|
|
38
26
|
export interface IVolumePartiallyMutable extends Omit<IVolume, 'reset' | 'fromJSON'> {
|
|
@@ -45,7 +33,7 @@ export interface IVolumePartiallyMutable extends Omit<IVolume, 'reset' | 'fromJS
|
|
|
45
33
|
__internal_do_not_use_addReadFileHook(hook: (filepath: PathLike, fileData: TDataOut) => Promise<TDataOut>): void;
|
|
46
34
|
}
|
|
47
35
|
export interface IUnionVolume extends Omit<IVolumeImmutable, 'promises'> {
|
|
48
|
-
promises:
|
|
36
|
+
promises: Omit<IVolumeImmutable['promises'], 'readFile'> & {
|
|
49
37
|
/**
|
|
50
38
|
* Reads a file
|
|
51
39
|
* @param file Path
|
package/dist/WorkerData.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SerialiserModuleDefinition, PluginModuleDefinition, SourceModuleDefinition } from './index';
|
|
2
|
-
export
|
|
1
|
+
import type { SerialiserModuleDefinition, PluginModuleDefinition, SourceModuleDefinition, SourceSchedule } from './index.js';
|
|
2
|
+
export type WorkerData<Options = {}> = {
|
|
3
3
|
options: Options & Pick<PluginModuleDefinition, 'options'> & Pick<SourceModuleDefinition, 'options'> & {
|
|
4
4
|
pageExtensions: string[];
|
|
5
5
|
};
|
|
@@ -10,4 +10,5 @@ export declare type WorkerData<Options = {}> = {
|
|
|
10
10
|
plugins: PluginModuleDefinition[];
|
|
11
11
|
serialisers: SerialiserModuleDefinition[];
|
|
12
12
|
modulePath: string;
|
|
13
|
+
schedule: SourceSchedule;
|
|
13
14
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type { SerialiserModuleDefinition, MosaicConfig, PluginModuleDefinition, SourceModuleDefinition, SourceWorkflow } from '@jpmorganchase/mosaic-schemas';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export
|
|
1
|
+
import type { SerialiserModuleDefinition, MosaicConfig, PluginModuleDefinition, SourceModuleDefinition, SourceWorkflow, SourceSchedule } from '@jpmorganchase/mosaic-schemas';
|
|
2
|
+
export * from './Content.js';
|
|
3
|
+
export * from './IFileAccess.js';
|
|
4
|
+
export * from './Meta.js';
|
|
5
|
+
export * from './MutableData.js';
|
|
6
|
+
export * from './Page.js';
|
|
7
|
+
export * from './Plugin.js';
|
|
8
|
+
export * from './Serialiser.js';
|
|
9
|
+
export * from './Source.js';
|
|
10
|
+
export * from './Volume.js';
|
|
11
|
+
export * from './WorkerData.js';
|
|
12
|
+
export * from './Mode.js';
|
|
13
|
+
export * from './Session.js';
|
|
14
|
+
export * from './SourceWorkflow.js';
|
|
15
|
+
export { SerialiserModuleDefinition, MosaicConfig, PluginModuleDefinition, SourceModuleDefinition, SourceWorkflow, SourceSchedule };
|
package/package.json
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-types",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"author": "",
|
|
3
|
+
"version": "0.1.0-beta.90",
|
|
5
4
|
"description": "Mosaic BitBucket source for core file system",
|
|
6
5
|
"license": "Apache-2.0",
|
|
6
|
+
"author": "",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
8
14
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
15
|
+
"node": ">=18.0.0 || >=20.0.0"
|
|
10
16
|
},
|
|
11
17
|
"repository": {
|
|
12
18
|
"type": "git",
|
|
13
|
-
"url": "git@github.com:jpmorganchase/mosaic.git"
|
|
19
|
+
"url": "git@github.com:jpmorganchase/mosaic.git",
|
|
20
|
+
"directory": "packages/types"
|
|
14
21
|
},
|
|
15
22
|
"files": [
|
|
16
23
|
"dist"
|
|
17
24
|
],
|
|
18
25
|
"scripts": {
|
|
19
26
|
"build": "tsc",
|
|
20
|
-
"clean": "rm -fr dist"
|
|
27
|
+
"clean": "rm -fr dist",
|
|
28
|
+
"lint": "eslint --ignore-pattern \"**/__tests__/**\""
|
|
21
29
|
},
|
|
22
30
|
"devDependencies": {
|
|
23
|
-
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.
|
|
31
|
+
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.90",
|
|
32
|
+
"memfs": "^4.0.0",
|
|
24
33
|
"rxjs": "^7.5.5",
|
|
25
|
-
"zod": "^3.
|
|
34
|
+
"zod": "^3.22.3"
|
|
26
35
|
}
|
|
27
36
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# @jpmorganchase/mosaic-types
|
|
2
|
-
|
|
3
|
-
## 0.1.0-beta.9
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- c3fee89: initial components package
|
|
8
|
-
|
|
9
|
-
- added JSDOM testing
|
|
10
|
-
|
|
11
|
-
## 0.1.0-beta.8
|
|
12
|
-
|
|
13
|
-
### Minor Changes
|
|
14
|
-
|
|
15
|
-
- 2dca0b1: initial release of Mosaic store package
|
|
16
|
-
|
|
17
|
-
## 0.1.0-beta.7
|
|
18
|
-
|
|
19
|
-
### Minor Changes
|
|
20
|
-
|
|
21
|
-
- f82c397: Initial release of theme and client side search
|
|
22
|
-
|
|
23
|
-
We are iterating towards deploying our site code.
|
|
24
|
-
|
|
25
|
-
This release includes
|
|
26
|
-
|
|
27
|
-
- initial work for client-side search support
|
|
28
|
-
- Mosaic theme.
|
|
29
|
-
|
|
30
|
-
## 0.1.0-beta.6
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- c103b24: Release fixes for snapshot serve
|
|
35
|
-
|
|
36
|
-
## 0.1.0-beta.5
|
|
37
|
-
|
|
38
|
-
### Patch Changes
|
|
39
|
-
|
|
40
|
-
- 61a246c: This releases add support for generate / build and serve snapshots
|
|
41
|
-
|
|
42
|
-
## 0.1.0-beta.4
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- bd285df: added dist to package.json
|
|
47
|
-
|
|
48
|
-
## 0.1.0-beta.3
|
|
49
|
-
|
|
50
|
-
### Patch Changes
|
|
51
|
-
|
|
52
|
-
- 457df5e: switch to public package
|
|
53
|
-
|
|
54
|
-
## 0.1.0-beta.2
|
|
55
|
-
|
|
56
|
-
### Patch Changes
|
|
57
|
-
|
|
58
|
-
- e1bbbe7: Initial release of Mosaic Core file-system.
|
|
59
|
-
|
|
60
|
-
Mosaic is a content aggregating service which pulls content from heterogeneous data sources.
|
|
61
|
-
|
|
62
|
-
- 4b2bc51: pipped to 0.1.0-beta.1 for publishing to NPM
|
|
63
|
-
|
|
64
|
-
## 0.1.0
|
|
65
|
-
|
|
66
|
-
### Patch Changes
|
|
67
|
-
|
|
68
|
-
- e1bbbe7: Initial release of Mosaic Core file-system.
|
|
69
|
-
|
|
70
|
-
Mosaic is a content aggregating service which pulls content from heterogeneous data sources.
|