@jpmorganchase/mosaic-source-local-folder 0.1.0-beta.5 → 0.1.0-beta.7
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/CHANGELOG.md +27 -0
- package/dist/fromFsWatch.d.ts +2 -2
- package/dist/fromFsWatch.js +3 -2
- package/dist/fromFsWatch.js.map +1 -1
- package/dist/index.d.ts +23 -4
- package/dist/index.js +35 -12
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @jpmorganchase/mosaic-source-local-folder
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 46adaec: Initial release of theme and client side search
|
|
8
|
+
|
|
9
|
+
We are iterating towards deploying our site code.
|
|
10
|
+
|
|
11
|
+
This release includes
|
|
12
|
+
|
|
13
|
+
- initial work for client-side search support
|
|
14
|
+
- Mosaic theme.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [46adaec]
|
|
19
|
+
- @jpmorganchase/mosaic-schemas@0.1.0-beta.7
|
|
20
|
+
- @jpmorganchase/mosaic-types@0.1.0-beta.7
|
|
21
|
+
|
|
22
|
+
## 0.1.0-beta.6
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- c103b24: Release fixes for snapshot serve
|
|
27
|
+
- Updated dependencies [c103b24]
|
|
28
|
+
- @jpmorganchase/mosaic-types@0.1.0-beta.6
|
|
29
|
+
|
|
3
30
|
## 0.1.0-beta.5
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/fromFsWatch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import {
|
|
3
|
+
import { WatchOptions } from 'fs';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
|
-
export default function fromFsWatch(filename:
|
|
5
|
+
export default function fromFsWatch(filename: string, options?: WatchOptions | BufferEncoding | string | null | (WatchOptions & {
|
|
6
6
|
encoding: 'buffer';
|
|
7
7
|
}) | 'buffer'): Observable<unknown>;
|
package/dist/fromFsWatch.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs_1 = require("fs");
|
|
4
3
|
const rxjs_1 = require("rxjs");
|
|
4
|
+
const chokidar_1 = require("chokidar");
|
|
5
5
|
function fromFsWatch(filename, options) {
|
|
6
6
|
return new rxjs_1.Observable(subscriber => {
|
|
7
|
-
const watcher = (0,
|
|
7
|
+
const watcher = (0, chokidar_1.watch)(filename, options);
|
|
8
|
+
watcher.on('all', (_eventType, filename) => {
|
|
8
9
|
subscriber.next(filename);
|
|
9
10
|
});
|
|
10
11
|
watcher.once('error', (error) => {
|
package/dist/fromFsWatch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromFsWatch.js","sourceRoot":"","sources":["../src/fromFsWatch.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fromFsWatch.js","sourceRoot":"","sources":["../src/fromFsWatch.ts"],"names":[],"mappings":";;AACA,+BAAkC;AAClC,uCAAiC;AAEjC,SAAwB,WAAW,CACjC,QAAgB,EAChB,OAMY;IAEZ,OAAO,IAAI,iBAAU,CAAC,UAAU,CAAC,EAAE;QACjC,MAAM,OAAO,GAAG,IAAA,gBAAK,EAAC,QAAQ,EAAE,OAAc,CAAC,CAAC;QAEhD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;YACzC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YACrC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;YACzB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,WAAW;YACzB,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA7BD,8BA6BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import type { Source } from '@jpmorganchase/mosaic-types';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export declare const schema: z.ZodObject<{
|
|
4
|
+
/**
|
|
5
|
+
* Collection of file extensions to look for
|
|
6
|
+
*/
|
|
7
|
+
extensions: z.ZodArray<z.ZodString, "atleastone">;
|
|
8
|
+
/**
|
|
9
|
+
* Add to use a folder prefix
|
|
10
|
+
*/
|
|
11
|
+
prefixDir: z.ZodString;
|
|
12
|
+
/**
|
|
13
|
+
* The root directory containing docs
|
|
14
|
+
*/
|
|
15
|
+
rootDir: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
extensions: [string, ...string[]];
|
|
18
|
+
prefixDir: string;
|
|
5
19
|
rootDir: string;
|
|
6
|
-
}
|
|
20
|
+
}, {
|
|
21
|
+
extensions: [string, ...string[]];
|
|
22
|
+
prefixDir: string;
|
|
23
|
+
rootDir: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare type LocalFolderSourceOptions = z.infer<typeof schema>;
|
|
7
26
|
declare const LocalFolderSource: Source<LocalFolderSourceOptions>;
|
|
8
27
|
export default LocalFolderSource;
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.schema = void 0;
|
|
6
7
|
const rxjs_1 = require("rxjs");
|
|
7
8
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const fs_1 = __importDefault(require("fs"));
|
|
10
11
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const mosaic_schemas_1 = require("@jpmorganchase/mosaic-schemas");
|
|
11
14
|
const fromFsWatch_1 = __importDefault(require("./fromFsWatch"));
|
|
15
|
+
async function getLastModifiedDate(fullPath) {
|
|
16
|
+
const resolvedRoute = await fs_1.default.promises.realpath(fullPath);
|
|
17
|
+
const stats = await fs_1.default.promises.stat(resolvedRoute);
|
|
18
|
+
return (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) ? stats.mtimeMs : 0;
|
|
19
|
+
}
|
|
20
|
+
function createFileGlob(url, pageExtensions) {
|
|
21
|
+
if (pageExtensions.length === 1) {
|
|
22
|
+
return `${url}${pageExtensions[0]}`;
|
|
23
|
+
}
|
|
24
|
+
return `${url}{${pageExtensions.join(',')}}`;
|
|
25
|
+
}
|
|
26
|
+
exports.schema = zod_1.z.object({
|
|
27
|
+
/**
|
|
28
|
+
* Collection of file extensions to look for
|
|
29
|
+
*/
|
|
30
|
+
extensions: zod_1.z
|
|
31
|
+
.string({ required_error: 'Please provide the collection of file extensions to look for' })
|
|
32
|
+
.array()
|
|
33
|
+
.nonempty(),
|
|
34
|
+
/**
|
|
35
|
+
* Add to use a folder prefix
|
|
36
|
+
*/
|
|
37
|
+
prefixDir: zod_1.z.string({ required_error: 'Please provide a prefix directory name' }),
|
|
38
|
+
/**
|
|
39
|
+
* The root directory containing docs
|
|
40
|
+
*/
|
|
41
|
+
rootDir: zod_1.z.string({ required_error: 'Please provide a root directory name' })
|
|
42
|
+
});
|
|
12
43
|
const LocalFolderSource = {
|
|
13
44
|
create(options, { serialiser }) {
|
|
45
|
+
(0, mosaic_schemas_1.validateMosaicSchema)(exports.schema, options);
|
|
14
46
|
return (0, rxjs_1.merge)((0, rxjs_1.of)(null), (0, fromFsWatch_1.default)(options.rootDir, { recursive: true })).pipe((0, rxjs_1.delay)(1000), (0, rxjs_1.switchMap)(() => (0, fast_glob_1.default)(createFileGlob('**', options.extensions), {
|
|
15
47
|
cwd: options.rootDir,
|
|
16
48
|
onlyFiles: true
|
|
17
|
-
})), (0, rxjs_1.concatMap)(async (filepaths) =>
|
|
49
|
+
})), (0, rxjs_1.concatMap)(async (filepaths) =>
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/return-await
|
|
51
|
+
await Promise.all(filepaths.map(async (filepath) => {
|
|
18
52
|
const fullPath = path_1.default.join(options.rootDir, filepath);
|
|
19
53
|
return (0, merge_1.default)({}, await serialiser.deserialise(fullPath, await fs_1.default.promises.readFile(fullPath)), {
|
|
20
54
|
lastModified: new Date(await getLastModifiedDate(fullPath)).getTime(),
|
|
@@ -23,16 +57,5 @@ const LocalFolderSource = {
|
|
|
23
57
|
}))));
|
|
24
58
|
}
|
|
25
59
|
};
|
|
26
|
-
async function getLastModifiedDate(fullPath) {
|
|
27
|
-
const resolvedRoute = await fs_1.default.promises.realpath(fullPath);
|
|
28
|
-
const stats = await fs_1.default.promises.stat(resolvedRoute);
|
|
29
|
-
return (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) ? stats.mtimeMs : 0;
|
|
30
|
-
}
|
|
31
|
-
function createFileGlob(url, pageExtensions) {
|
|
32
|
-
if (pageExtensions.length === 1) {
|
|
33
|
-
return `${url}${pageExtensions[0]}`;
|
|
34
|
-
}
|
|
35
|
-
return `${url}{${pageExtensions.join(',')}}`;
|
|
36
|
-
}
|
|
37
60
|
exports.default = LocalFolderSource;
|
|
38
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0E;AAC1E,0DAA6B;AAC7B,gDAAwB;AACxB,4CAAoB;AACpB,yDAAuC;AACvC,6BAAwB;AAExB,kEAAqE;AAErE,gEAAwC;AAExC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACjD,MAAM,aAAa,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,cAAc,CAAC,GAAW,EAAE,cAAwB;IAC3D,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/B,OAAO,GAAG,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;KACrC;IACD,OAAO,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAC/C,CAAC;AAEY,QAAA,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7B;;OAEG;IACH,UAAU,EAAE,OAAC;SACV,MAAM,CAAC,EAAE,cAAc,EAAE,8DAA8D,EAAE,CAAC;SAC1F,KAAK,EAAE;SACP,QAAQ,EAAE;IACb;;OAEG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,wCAAwC,EAAE,CAAC;IACjF;;OAEG;IACH,OAAO,EAAE,OA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,CAAC,CAAC,CAAC,QAC/D,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;aAC3B,CACF,CAAC;QACJ,CAAC,CAAC,CACH,CACJ,CACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-source-local-folder",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
4
|
"author": "",
|
|
5
5
|
"description": "Mosaic local folder source for core file system",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
"url": "git@github.com:jpmorganchase/mosaic.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jpmorganchase/mosaic-
|
|
25
|
-
"
|
|
24
|
+
"@jpmorganchase/mosaic-schemas": "^0.1.0-beta.7",
|
|
25
|
+
"@jpmorganchase/mosaic-types": "^0.1.0-beta.7",
|
|
26
|
+
"chokidar": "^3.5.3",
|
|
27
|
+
"fast-glob": "^3.2.12",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"rxjs": "^7.5.5",
|
|
30
|
+
"zod": "^3.19.1"
|
|
26
31
|
}
|
|
27
32
|
}
|