@jpmorganchase/mosaic-cli 0.1.0-beta.98 → 1.0.0-beta.99

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +1768 -0
  2. package/dist/build.mjs +1 -1
  3. package/dist/chunk-4YKZMY2L.mjs +1 -0
  4. package/dist/chunk-5FTIHMJH.mjs +1 -0
  5. package/dist/chunk-6VZ6ETYU.mjs +1 -0
  6. package/dist/chunk-C62I76OF.mjs +7 -0
  7. package/dist/chunk-JZTJ6KFK.mjs +1 -0
  8. package/dist/chunk-LBGQJ2IK.mjs +1 -0
  9. package/dist/chunk-LSSCO4BP.mjs +1 -0
  10. package/dist/chunk-O4CA7KYW.mjs +1 -0
  11. package/dist/chunk-S7JRZ4XU.mjs +1 -0
  12. package/dist/chunk-VGWN7S77.mjs +2 -0
  13. package/dist/chunk-XWU2QBWI.mjs +1 -0
  14. package/dist/chunk-YQNXGMWC.mjs +5 -0
  15. package/dist/chunk-ZOJ3LTWN.mjs +1 -0
  16. package/dist/env.d.ts +49 -0
  17. package/dist/env.mjs +1 -0
  18. package/dist/index.mjs +1 -1
  19. package/dist/plugins/bitbucketRepoUrl.d.ts +23 -0
  20. package/dist/plugins/bitbucketRepoUrl.mjs +1 -0
  21. package/dist/plugins/mosaicAdminPlugin.mjs +1 -1
  22. package/dist/plugins/mosaicFastifyPlugin.d.ts +1 -0
  23. package/dist/plugins/mosaicFastifyPlugin.mjs +1 -1
  24. package/dist/plugins/mosaicWebhooksPlugin.d.ts +16 -0
  25. package/dist/plugins/mosaicWebhooksPlugin.mjs +1 -0
  26. package/dist/plugins/mosaicWorkflowsPlugin.d.ts +9 -10
  27. package/dist/plugins/mosaicWorkflowsPlugin.mjs +1 -1
  28. package/dist/plugins/resolveRawSourcePath.d.ts +102 -0
  29. package/dist/plugins/resolveRawSourcePath.mjs +1 -0
  30. package/dist/plugins/security.d.ts +24 -0
  31. package/dist/plugins/security.mjs +1 -0
  32. package/dist/plugins/workflowJobs.d.ts +91 -0
  33. package/dist/plugins/workflowJobs.mjs +1 -0
  34. package/dist/revalidateNotifier.d.ts +50 -0
  35. package/dist/revalidateNotifier.mjs +1 -0
  36. package/dist/routeInventory.d.ts +15 -0
  37. package/dist/routeInventory.mjs +1 -0
  38. package/dist/serve.d.ts +2 -1
  39. package/dist/serve.mjs +1 -1
  40. package/fs.config.js +16 -1
  41. package/package.json +19 -21
  42. package/dist/chunk-5Q7PLJAC.mjs +0 -3
  43. package/dist/chunk-A623VBSD.mjs +0 -1
  44. package/dist/chunk-JEFKQLCN.mjs +0 -1
  45. package/dist/chunk-KX3ED265.mjs +0 -1
  46. package/dist/chunk-P3RXN7HU.mjs +0 -1
  47. package/dist/chunk-XZI6BLBY.mjs +0 -1
  48. package/dist/upload-s3-snapshot.d.ts +0 -1
  49. package/dist/upload-s3-snapshot.mjs +0 -1
package/fs.config.js CHANGED
@@ -30,7 +30,18 @@ export default {
30
30
  {
31
31
  modulePath: '@jpmorganchase/mosaic-plugins/SearchIndexPlugin',
32
32
  previewDisabled: true,
33
- options: { maxLineLength: 240, maxLineCount: 240 }
33
+ // After `$RefPlugin` (-1), so titles and fields that come from `$ref`s
34
+ // are resolved, and before `LazyPagePlugin` (-2) moves page content out.
35
+ priority: -1.5,
36
+ options: {}
37
+ },
38
+ {
39
+ modulePath: '@jpmorganchase/mosaic-plugins/LlmsTxtPlugin',
40
+ previewDisabled: true,
41
+ // After `$RefPlugin` (-1), so `$ref`s are resolved, and before
42
+ // `LazyPagePlugin` (-2) moves page content out.
43
+ priority: -1.5,
44
+ options: {}
34
45
  },
35
46
  {
36
47
  modulePath: '@jpmorganchase/mosaic-plugins/BreadcrumbsPlugin',
@@ -72,6 +83,10 @@ export default {
72
83
  },
73
84
  {
74
85
  modulePath: '@jpmorganchase/mosaic-plugins/TableOfContentsPlugin',
86
+ // Between `$RefPlugin` (-1) and `LazyPagePlugin` (-2): headings that
87
+ // read `$ref` values can only be resolved after `$RefPlugin`, and page
88
+ // content must still be in the filesystem.
89
+ priority: -1.5,
75
90
  options: {
76
91
  minRank: 2,
77
92
  maxRank: 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpmorganchase/mosaic-cli",
3
- "version": "0.1.0-beta.98",
3
+ "version": "1.0.0-beta.99",
4
4
  "author": "",
5
5
  "description": "Mosaic command line scripts",
6
6
  "license": "Apache-2.0",
@@ -16,7 +16,7 @@
16
16
  "./fs.config.js": "./fs.config.js"
17
17
  },
18
18
  "engines": {
19
- "node": ">=18.0.0 || >=20.0.0"
19
+ "node": ">=24"
20
20
  },
21
21
  "bin": {
22
22
  "mosaic": "./dist/index.mjs"
@@ -32,34 +32,32 @@
32
32
  "clean": "rm -fr dist",
33
33
  "docker:build": "docker build . --tag mosaic-fs:latest",
34
34
  "docker:start": "docker run -it --rm --ipc=host -p 8080:8080 --mount source=docs,destination=/app/docs --network mosaic-net --name mosaic-fs mosaic-fs:latest",
35
- "lint": "eslint --ignore-pattern \"**/__tests__/**\""
35
+ "lint": "eslint ."
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "git@github.com:jpmorganchase/mosaic.git",
39
+ "url": "git+https://github.com/jpmorganchase/mosaic.git",
40
40
  "directory": "packages/cli"
41
41
  },
42
42
  "devDependencies": {
43
- "@jpmorganchase/mosaic-types": "^0.1.0-beta.98",
44
- "@types/ws": "^8.5.7",
45
- "esbuild": "0.25.0",
46
- "esbuild-node-externals": "^1.18.0",
47
- "fast-glob": "^3.2.7"
43
+ "@jpmorganchase/mosaic-types": "^1.0.0-beta.99",
44
+ "concurrently": "^7.1.0",
45
+ "esbuild": "0.28.1",
46
+ "esbuild-node-externals": "^1.23.1",
47
+ "tinyglobby": "^0.2.17"
48
48
  },
49
49
  "dependencies": {
50
- "@aws-sdk/client-s3": "^3.859.0",
51
- "@fastify/middie": "^9.1.0",
52
- "@fastify/websocket": "^11.0.0",
53
- "@jpmorganchase/mosaic-core": "^0.1.0-beta.98",
54
- "@jpmorganchase/mosaic-plugins": "^0.1.0-beta.98",
55
- "@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.98",
50
+ "@fastify/middie": "^9.3.6",
51
+ "@jpmorganchase/mosaic-core": "^1.0.0-beta.99",
52
+ "@jpmorganchase/mosaic-plugins": "^1.0.0-beta.99",
53
+ "@jpmorganchase/mosaic-schemas": "^1.0.0-beta.99",
54
+ "@jpmorganchase/mosaic-source-git-repo": "^1.0.0-beta.99",
55
+ "@jpmorganchase/mosaic-source-local-folder": "^1.0.0-beta.99",
56
56
  "commander": "^9.4.1",
57
57
  "cors": "^2.8.5",
58
58
  "deepmerge": "^4.2.2",
59
- "fastify": "^5.7.3",
60
- "fastify-plugin": "^5.0.0",
61
- "globby": "^13.1.3",
62
- "md5": "*",
63
- "mkdirp": "^1.0.4"
59
+ "fastify": "^5.12.8",
60
+ "fastify-plugin": "^6.0.0",
61
+ "zod": "^4.6.7"
64
62
  }
65
- }
63
+ }
@@ -1,3 +0,0 @@
1
- import r from"node:fs";import e from"node:path";import S from"deepmerge";import j from"@jpmorganchase/mosaic-core";async function x(o,w,u){o.plugins=o.plugins.filter(({runTimeOnly:i})=>!i),o.sources=o.sources.map(i=>({...i,options:{...i.options,cache:!1}}));let p=u.scope&&u.scope.split(","),l=new j(o),t=e.posix.join(w,u.name??new Date().toISOString());try{let i=await r.promises.readdir(t);await Promise.all(i.map(f=>r.promises.rm(e.join(t,f))))}catch{await r.promises.mkdir(t,{recursive:!0})}await l.start();let d=Array.isArray(p)?l.filesystem.scope(p):l.filesystem,h=0;l.onSourceUpdate(async()=>{try{if(++h===o.sources.length){let i=d.symlinksToJSON(),f=await d.promises.glob("**",{cwd:"/",onlyFiles:!0});for(let s of f){let a=await d.promises.readFile(String(s),{includeConflicts:!0}),c=a[0];if(a.length>1)if(e.posix.extname(String(s))===".json"){console.warn(`'${s}' returned multiple files at the same location. Since the files were JSON dot files, they were merged using \`deepmerge\`.`);let n=a.map(m=>JSON.parse(String(m)));c=Buffer.from(JSON.stringify(S(n[0],n[1])))}else throw new Error(`'${s}' returned multiple files at the same location, this will result in overwritten data in the output. Aborting build.
2
-
3
- Try using \`--scope\` to just output certain namespaced sources, or adding a \`prefixDir\` to the source options to move the source files into a separate folder.`);await r.promises.mkdir(e.dirname(e.join(t,String(s))),{recursive:!0}),await r.promises.writeFile(e.join(t,String(s)),c)}let y=process.cwd();for(let s in i)if(!s.startsWith("/.tags")){for(let{target:a}of i[s])if(!a.startsWith("/.tags")){await r.promises.mkdir(e.join(t,e.dirname(s)),{recursive:!0});try{!!await r.promises.stat(e.join(t,s))&&(console.error(new Error(`Symlink at '${e.join(t,s)}' already exists. Aborting build.`)),process.exit(1))}catch{let c=e.join(t,a),n=e.join(t,s),m=e.basename(n),g=e.relative(e.dirname(n),c);process.chdir(e.dirname(n)),r.existsSync(m)&&r.unlinkSync(m),await r.promises.symlink(g,m)}}}process.chdir(y),console.log(`[Mosaic] filesystem for ${Array.isArray(p)?p.length:o.sources.length} source(s) written to disk at '${t}'`),l.stop()}}catch(i){console.error(i),process.exit(1)}})}export{x as a};
@@ -1 +0,0 @@
1
- import m from"fastify-plugin";function h(a,f,l){let{prefix:r}=f,{config:p,fs:y,core:u}=a.mosaic;a.get(`/${r}/config`,async(i,e)=>{e.header("Content-Type","application/json");let s=p.sources.map(t=>{let n=t?.options,c=n?.credentials;if(c&&t.modulePath==="@jpmorganchase/mosaic-source-git-repo"){let d=c.split(":")||[];d.length>0&&(t.options={...n,credentials:`${d[0]}: ********`})}return t}),o={...p,sources:s};e.send(o)}),a.get(`/${r}/content/dump`,(i,e)=>{e.header("Content-Type","application/json"),e.send(y.toJSON())}),a.get(`/${r}/sources/list`,async(i,e)=>{e.header("Content-Type","application/json");let o=(await u.listSources()).map(t=>{let n=p.sources[t.index],c=n?.options;if(c?.credentials&&n.modulePath==="@jpmorganchase/mosaic-source-git-repo"){let d=c.credentials?.split(":")||[];d.length>0&&(n.options={...c,credentials:`${d[0]}: ********`})}return{name:t.name,...n,pluginErrors:t.pluginErrors}});e.send(o)}),a.put(`/${r}/source/stop`,async(i,e)=>{e.header("Content-Type","application/text");let{name:s}=i.body;if(s)try{await u.stopSource(String(s)),e.send(`${s} stopped successfully.`)}catch(o){console.error(o),e.status(500).send(`${s} not stopped. Check you have the right name!`)}else e.status(500).send("No source name provided.")}),a.put(`/${r}/source/restart`,async(i,e)=>{e.header("Content-Type","application/text");let{name:s}=i.body;if(s)try{await u.restartSource(String(s)),e.send(`${s} restarted successfully.`)}catch(o){console.error(o),e.status(500).send(`${s} not restarted. Check you have the right name!`)}else e.status(500).send("No source name provided.")}),a.post(`/${r}/source/add`,async(i,e)=>{try{let{definition:s,isPreview:o=!0}=i.body;if(e.header("Content-Type","application/text"),!f.enableSourcePush)throw new Error("Source push is disabled.");if(!s)throw new Error("Source definition is required");if(o){let n=`preview-${s.namespace}`;s.namespace=n}let t=await u.addSource(s);e.send(t!==void 0?`Source ${t.id.description} added successfully`:"Unable to add source")}catch(s){console.error(s),e.status(500).send(s.message)}}),l()}var F=m(h,{fastify:"5.x",name:"fastify-mosaic-admin",dependencies:["fastify-mosaic"]});export{F as a};
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk-FCNWFPGR.mjs";import{a as s}from"./chunk-A623VBSD.mjs";import{a}from"./chunk-KX3ED265.mjs";import{a as c}from"./chunk-XZI6BLBY.mjs";import p from"fastify";import u from"cors";import g from"@fastify/middie";var l="_mosaic_",r=p({logger:!1,pluginTimeout:2e4});async function y(t,i,o){let m=await n(t);await r.register(g),await r.register(a,{config:t,scope:o,mosaic:m}),await r.register(c),await r.register(s,{prefix:l,enableSourcePush:t.enableSourcePush}),r.get("/actuator/keepalive",async(e,f)=>f.code(200).send("OK")),r.use(u()),await(async()=>{try{await r.listen({port:i}),console.log(`[Mosaic] Listening on port ${i}${Array.isArray(o)?` (scoped to ${o.join(", ")})`:""}`)}catch(e){r.log.error(e),process.exit(1)}})()}export{r as a,y as b};
@@ -1 +0,0 @@
1
- import p from"fastify-plugin";import a from"node:path";async function l(n,f){let{config:r,scope:c,mosaic:o}=f,i=Array.isArray(c)?o.filesystem.scope(c):o.filesystem;n.decorate("mosaic",{config:r,core:o,fs:i}),n.get("/*",async(t,s)=>{try{if(await i.promises.exists(t.url))if((await i.promises.stat(t.url)).isDirectory())await i.promises.exists(a.join(t.url,"index"))?(s.header("Content-Type","application/json"),s.status(302).send({redirect:a.posix.join(t.url,"index")})):s.status(404);else{let e=String(await i.promises.realpath(t.url));a.extname(e)===".mdx"?s.header("Content-Type","text/mdx"):a.extname(e)===".json"?s.header("Content-Type","application/json"):a.extname(e)===".xml"&&s.header("Content-Type","application/xml");let m=await i.promises.readFile(t.url);s.send(m)}else s.status(404)}catch(e){console.error(e),s.status(500)}})}var x=p(l,{fastify:"5.x",name:"fastify-mosaic"});export{x as a};
@@ -1 +0,0 @@
1
- import{globby as _}from"globby";import m from"path";import E from"fs";import{S3Client as p,CreateBucketCommand as A,PutObjectCommand as I}from"@aws-sdk/client-s3";import s from"assert";function d(n,e,t){return new p({region:n,credentials:{accessKeyId:e,secretAccessKey:t}})}async function u(n){s(process.env.MOSAIC_S3_BUCKET,"Cannot read S3 bucket - MOSAIC_S3_BUCKET environment var is missing"),s(process.env.MOSAIC_S3_REGION,"Cannot read S3 bucket - MOSAIC_S3_REGION environment var is missing"),s(process.env.MOSAIC_S3_ACCESS_KEY_ID,"Cannot read S3 bucket - MOSAIC_S3_ACCESS_KEY_ID environment var is missing"),s(process.env.MOSAIC_S3_SECRET_ACCESS_KEY,"Cannot read S3 bucket - MOSAIC_S3_SECRET_ACCESS_KEY environment var is missing");let e=process.env.MOSAIC_S3_BUCKET,t=process.env.MOSAIC_S3_REGION,c=process.env.MOSAIC_S3_ACCESS_KEY_ID,C=process.env.MOSAIC_S3_SECRET_ACCESS_KEY,o=d(t,c,C);await o.send(new A({Bucket:e})),(await _(n)).forEach(async S=>{let r=S.replace(`${n}${m.sep}`,"");console.log(`Upload ${r} to bucket ${e}`);let a=await E.promises.readFile(S,{encoding:"utf-8"}),i=new I({Bucket:e,Key:r,Body:a});await o.send(i)})}export{u as a};
@@ -1 +0,0 @@
1
- import d from"fastify-plugin";import l from"node:path";import y from"md5";import R from"@fastify/websocket";async function S(t,O){await t.register(R);let{fs:a,core:c}=t.mosaic;t.get("/workflows",{websocket:!0},s=>{s.on("message",async g=>{if(s.OPEN)try{let{type:i,route:e,name:o,user:r,...p}=JSON.parse(g.toString());o||s.send(JSON.stringify({status:"ERROR",message:"Workflow name is required"})),r||s.send(JSON.stringify({status:"ERROR",message:"Workflow must be run for a user"}));let u=r.id||r.sid,w=y(`${u.toLowerCase()} - ${o.toLowerCase()}`),n=(f,m)=>s.send(JSON.stringify({status:m,message:f,channel:w}));if(await a.promises.exists(e)){let f=(await a.promises.stat(e)).isDirectory()?l.posix.join(e,"index"):e,m=await a.promises.realpath(f);c.triggerWorkflow(n,o,m,{user:r,...p}),n(`Workflow ${o} has started`,"SUCCESS")}else n(`${e} not found`,"ERROR")}catch(i){console.error(i),s.send(JSON.stringify({status:"ERROR",message:i.message}))}})})}var E=d(S,{fastify:"5.x",name:"fastify-mosaic-workflows",dependencies:["fastify-mosaic"]});export{E as a};
@@ -1 +0,0 @@
1
- export default function uploadS3Snapshot(targetDir: any): Promise<void>;
@@ -1 +0,0 @@
1
- import{a}from"./chunk-P3RXN7HU.mjs";export{a as default};