@jpmorganchase/mosaic-types 0.1.0-beta.89 → 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/IFileAccess.d.ts +3 -12
- package/dist/Meta.d.ts +1 -1
- package/dist/Mode.d.ts +1 -1
- package/dist/MutableData.d.ts +2 -2
- package/dist/Page.d.ts +1 -1
- package/dist/Plugin.d.ts +6 -6
- package/dist/Serialiser.d.ts +3 -3
- package/dist/Session.d.ts +2 -2
- package/dist/Source.d.ts +2 -2
- package/dist/SourceWorkflow.d.ts +5 -5
- package/dist/Volume.d.ts +5 -12
- package/dist/WorkerData.d.ts +1 -1
- package/package.json +3 -3
package/dist/IFileAccess.d.ts
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
import type { Options, Pattern, Entry } from 'fast-glob';
|
|
3
|
-
import type { DirectoryJSON,
|
|
4
|
-
import type { PathLike
|
|
2
|
+
import type { DirectoryJSON, IFs } from 'memfs';
|
|
3
|
+
import type { PathLike } from 'fs';
|
|
5
4
|
import type { Page } from './Page.js';
|
|
6
5
|
/**
|
|
7
6
|
* This is the core underlying filesystem, which directly interfaces with a memfs Volume to mutate the filesystem
|
|
8
7
|
*/
|
|
9
|
-
export interface IFileAccess {
|
|
8
|
+
export interface IFileAccess extends Pick<IFs['promises'], 'mkdir' | 'readdir' | 'readFile' | 'realpath' | 'stat' | 'unlink' | 'symlink' | 'writeFile'> {
|
|
10
9
|
glob(pattern: Pattern, options?: Omit<Options, 'absolute' | 'fs'>): Promise<string[] | Entry[]>;
|
|
11
|
-
mkdir(dir: PathLike, options?: TMode | IMkdirOptions): Promise<void>;
|
|
12
|
-
readdir(dir: PathLike, options?: string | IReaddirOptions): Promise<TDataOut[] | Dirent[]>;
|
|
13
|
-
readFile(file: PathLike): Promise<TDataOut>;
|
|
14
|
-
realpath(target: string, options?: string | IRealpathOptions): Promise<TDataOut>;
|
|
15
|
-
stat(file: PathLike, options?: IStatOptions): Promise<Stats<TStatNumber>>;
|
|
16
|
-
unlink(target: PathLike): Promise<void>;
|
|
17
|
-
symlink(target: PathLike, alias: PathLike, type?: symlink.Type): Promise<void>;
|
|
18
|
-
writeFile(file: PathLike, data: TData): Promise<void>;
|
|
19
10
|
toJSON(): DirectoryJSON;
|
|
20
11
|
fromJSON(json: DirectoryJSON): void;
|
|
21
12
|
exists(file: PathLike): Promise<boolean>;
|
package/dist/Meta.d.ts
CHANGED
package/dist/Mode.d.ts
CHANGED
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
|
@@ -3,9 +3,9 @@ import type { PluginModuleDefinition } from './index.js';
|
|
|
3
3
|
import type { Serialiser } from './Serialiser.js';
|
|
4
4
|
import type { Page } from './Page.js';
|
|
5
5
|
import type { MutableData, ImmutableData } from './MutableData.js';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
6
|
+
export type LoadedPlugin = Partial<Plugin<Page>> & PluginModuleDefinition;
|
|
7
|
+
export type LifecycleMethod = keyof Plugin<Page>;
|
|
8
|
+
export type PluginErrorDescriptor = {
|
|
9
9
|
/**
|
|
10
10
|
* The plugin lifecycle method running when the error occurred
|
|
11
11
|
*/
|
|
@@ -27,14 +27,14 @@ export declare type PluginErrorDescriptor = {
|
|
|
27
27
|
*/
|
|
28
28
|
fullPath?: string;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type PluginErrors = Array<PluginErrorDescriptor>;
|
|
31
|
+
export type TrackPluginErrorCallback = (errors: Array<PluginErrorDescriptor>, lifecycleMethod: string) => void;
|
|
32
32
|
/**
|
|
33
33
|
* Plugins are lifecycle-based hooks that are called on every source at different stages.
|
|
34
34
|
* Consumers will never need to invoke a lifecycle method; but for technical clarity - when a lifecycle method is called,
|
|
35
35
|
* it will trigger `pluginRunner` which executes it on every source automatically.
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export type Plugin<TPage extends Page = Page, TOptions = Record<string, unknown>, ConfigData = Record<string, unknown>, GlobalConfigData = ConfigData> = {
|
|
38
38
|
/**
|
|
39
39
|
* Plugin lifecycle method that triggers inside child processes.
|
|
40
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
|
package/dist/Serialiser.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { TDataOut } from 'memfs';
|
|
2
1
|
import type { SerialiserModuleDefinition } from './index.js';
|
|
3
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;
|
package/dist/Session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type JWT = {
|
|
2
2
|
exp: number;
|
|
3
3
|
UserID?: string;
|
|
4
4
|
JPMCIdentifier?: string;
|
|
@@ -16,7 +16,7 @@ export declare type JWT = {
|
|
|
16
16
|
LOB?: string;
|
|
17
17
|
LocationCode?: string;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type Session<TUserProfile> = {
|
|
20
20
|
isLoggedIn: boolean;
|
|
21
21
|
user?: TUserProfile;
|
|
22
22
|
};
|
package/dist/Source.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { SourceSchedule } from './index.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Provided by Mosaic to a Source
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type SourceConfig = {
|
|
9
9
|
/**
|
|
10
10
|
* The allowed page extensions Mosaic has been configured to use
|
|
11
11
|
*/
|
|
@@ -19,6 +19,6 @@ export declare type SourceConfig = {
|
|
|
19
19
|
*/
|
|
20
20
|
schedule: SourceSchedule;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type Source<TOptions = Record<string, unknown>, TPage extends Page = Page> = {
|
|
23
23
|
create(options: TOptions, helpers: SourceConfig): Observable<TPage[]>;
|
|
24
24
|
};
|
package/dist/SourceWorkflow.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type SourceWorkflowMessageStatus = 'SUCCESS' | 'ERROR' | 'IN_PROGRESS' | 'COMPLETE';
|
|
8
|
+
export type SendSourceWorkflowMessage = (message: any, status: SourceWorkflowMessageStatus) => void;
|
|
9
|
+
export type SourceWorkflowMessageEvent = {
|
|
10
10
|
status: SourceWorkflowMessageStatus;
|
|
11
11
|
message: any;
|
|
12
12
|
channel?: string;
|
package/dist/Volume.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { PathLike, symlink } from 'fs';
|
|
1
|
+
import type { DirectoryJSON, IFs } from 'memfs';
|
|
2
|
+
import type { PathLike } from 'fs';
|
|
4
3
|
import type { Options, Pattern, Entry } from 'fast-glob';
|
|
4
|
+
type TDataOut = string | Buffer;
|
|
5
|
+
export type { TDataOut };
|
|
5
6
|
/**
|
|
6
7
|
* Volumes are lightweight decorators which wrap `FileAccess` and limit access to the underlying API for different use-cases
|
|
7
8
|
* Examples include disallowing mutation or allowing underlying functions like resetting
|
|
@@ -17,17 +18,9 @@ export interface IVolume {
|
|
|
17
18
|
}[];
|
|
18
19
|
};
|
|
19
20
|
fromJSON?(json: DirectoryJSON): void;
|
|
20
|
-
promises: {
|
|
21
|
+
promises: Pick<IFs['promises'], 'mkdir' | 'readdir' | 'readFile' | 'realpath' | 'stat' | 'symlink' | 'unlink' | 'writeFile'> & {
|
|
21
22
|
exists(file: PathLike): Promise<boolean>;
|
|
22
23
|
glob(pattern: Pattern, options?: Options): Promise<string[] | Entry[]>;
|
|
23
|
-
mkdir(dir: PathLike, options?: TMode | IMkdirOptions): Promise<void>;
|
|
24
|
-
readdir(dir: PathLike, options?: string | IReaddirOptions): Promise<TDataOut[] | Dirent[]>;
|
|
25
|
-
readFile(file: PathLike): Promise<TDataOut>;
|
|
26
|
-
realpath(target: string, options?: string | IRealpathOptions): Promise<TDataOut>;
|
|
27
|
-
stat(file: PathLike, options?: IStatOptions): Promise<Stats<TStatNumber>>;
|
|
28
|
-
symlink(target: PathLike, alias: PathLike, type?: symlink.Type): Promise<void>;
|
|
29
|
-
unlink(target: PathLike): Promise<void>;
|
|
30
|
-
writeFile(file: PathLike, data: TData): Promise<void>;
|
|
31
24
|
};
|
|
32
25
|
}
|
|
33
26
|
export interface IVolumePartiallyMutable extends Omit<IVolume, 'reset' | 'fromJSON'> {
|
package/dist/WorkerData.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SerialiserModuleDefinition, PluginModuleDefinition, SourceModuleDefinition, SourceSchedule } from './index.js';
|
|
2
|
-
export
|
|
2
|
+
export type WorkerData<Options = {}> = {
|
|
3
3
|
options: Options & Pick<PluginModuleDefinition, 'options'> & Pick<SourceModuleDefinition, 'options'> & {
|
|
4
4
|
pageExtensions: string[];
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-types",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.90",
|
|
4
4
|
"description": "Mosaic BitBucket source for core file system",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint": "eslint --ignore-pattern \"**/__tests__/**\""
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.
|
|
32
|
-
"memfs": "^
|
|
31
|
+
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.90",
|
|
32
|
+
"memfs": "^4.0.0",
|
|
33
33
|
"rxjs": "^7.5.5",
|
|
34
34
|
"zod": "^3.22.3"
|
|
35
35
|
}
|