@jpmorganchase/mosaic-cli 0.1.0-beta.51 → 0.1.0-beta.52
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/build.mjs +1 -1
- package/dist/chunk-6E5PQQKS.mjs +1 -0
- package/dist/chunk-DYNA3PMW.mjs +1 -0
- package/dist/{chunk-K55TON6E.mjs → chunk-MEMUPS54.mjs} +1 -1
- package/dist/{chunk-J73DKLHI.mjs → chunk-ND7PMTGH.mjs} +1 -1
- package/dist/chunk-V6V27SIB.mjs +1 -0
- package/dist/{chunk-CJK4LE4J.mjs → chunk-Y6WPZ5AX.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugins/mosaicAdminPlugin.mjs +1 -1
- package/dist/plugins/mosaicFastifyPlugin.mjs +1 -1
- package/dist/plugins/mosaicWorkflowsPlugin.d.ts +2 -2
- package/dist/plugins/mosaicWorkflowsPlugin.mjs +1 -1
- package/dist/serve.mjs +1 -1
- package/dist/upload-s3-snapshot.mjs +1 -1
- package/dist/vercel-snapshot.mjs +1 -1
- package/package.json +10 -7
- package/dist/chunk-AY5WSHSM.mjs +0 -1
- package/dist/chunk-KZGMXFBX.mjs +0 -1
- package/dist/chunk-WXWWLCIL.mjs +0 -1
package/dist/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-ND7PMTGH.mjs";import"./chunk-DYNA3PMW.mjs";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,c as p}from"./chunk-DYNA3PMW.mjs";import l from"fastify-plugin";import y from"path";import R from"md5";import S from"@fastify/websocket";async function O(r,W){await r.register(S);let{fs:t,core:u}=r.mosaic;r.get("/workflows",{websocket:!0},s=>{s.socket.on("message",async w=>{if(s.socket.OPEN)try{let m=JSON.parse(w.toString()),{type:c,route:e,name:o,user:a}=m,k=p(m,["type","route","name","user"]);o||s.socket.send(JSON.stringify({status:"ERROR",message:"Workflow name is required"})),a||s.socket.send(JSON.stringify({status:"ERROR",message:"Workflow must be run for a user"}));let d=R(`${a.sid.toLowerCase()} - ${o.toLowerCase()}`),i=(n,f)=>s.socket.send(JSON.stringify({status:f,message:n,channel:d}));if(await t.promises.exists(e)){let n=(await t.promises.stat(e)).isDirectory()?y.posix.join(e,"index"):e,f=await t.promises.realpath(n);u.triggerWorkflow(i,o,f,g({user:a},k)),i(`Workflow ${o} has started`,"SUCCESS")}else i(`${e} not found`,"ERROR")}catch(c){console.error(c),s.socket.send(JSON.stringify({status:"ERROR",message:"e.message"}))}})})}var P=l(O,{fastify:"4.x",name:"fastify-mosaic-workflows",dependencies:["fastify-mosaic"]});export{P as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty,j=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var e=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var f=(a,b,c)=>b in a?i(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c,l=(a,b)=>{for(var c in b||(b={}))g.call(b,c)&&f(a,c,b[c]);if(e)for(var c of e(b))h.call(b,c)&&f(a,c,b[c]);return a},m=(a,b)=>j(a,k(b));var n=(a,b)=>{var c={};for(var d in a)g.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&e)for(var d of e(a))b.indexOf(d)<0&&h.call(a,d)&&(c[d]=a[d]);return c};export{l as a,m as b,n as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-Y6WPZ5AX.mjs";import{a as s}from"./chunk-V6V27SIB.mjs";import{a as e}from"./chunk-6E5PQQKS.mjs";import n from"fastify";import c from"cors";import m from"@fastify/middie";var g="_mosaic_",r=n({logger:!1});async function l(i,t,o){await r.register(m),await r.register(s,{config:i,scope:o}),await r.register(e),await r.register(a,{prefix:g,enableSourcePush:i.enableSourcePush}),r.use(c()),await(async()=>{try{await r.listen({port:t}),console.log(`[Mosaic] Listening on port ${t}${Array.isArray(o)?` (scoped to ${o.join(", ")})`:""}`)}catch(f){r.log.error(f),process.exit(1)}})()}export{r as a,l as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d,b as w}from"./chunk-
|
|
1
|
+
import{a as d,b as w}from"./chunk-DYNA3PMW.mjs";import n from"fs";import e from"path";import k from"deepmerge";import h from"fs-extra";import b from"@jpmorganchase/mosaic-core";async function F(r,y,u){r.plugins=r.plugins.filter(({runTimeOnly:i})=>!i),r.sources=r.sources.map(i=>w(d({},i),{options:w(d({},i.options),{cache:!1})}));let p=u.scope&&u.scope.split(","),l=new b(r),s=e.posix.join(y,u.name??new Date().toISOString());await h.emptyDir(s),await l.start();let f=Array.isArray(p)?l.filesystem.scope(p):l.filesystem,g=0;l.onSourceUpdate(async()=>{try{if(++g===r.sources.length){let i=f.symlinksToJSON(),S=await f.promises.glob("**",{cwd:"/",onlyFiles:!0});for(let t of S){let o=await f.promises.readFile(String(t),{includeConflicts:!0}),c=o[0];if(o.length>1)if(e.posix.extname(String(t))===".json"){console.warn(`'${t}' returned multiple files at the same location. Since the files were JSON dot files, they were merged using \`deepmerge\`.`);let a=o.map(m=>JSON.parse(String(m)));c=Buffer.from(JSON.stringify(k(a[0],a[1])))}else throw new Error(`'${t}' returned multiple files at the same location, this will result in overwritten data in the output. Aborting build.
|
|
2
2
|
|
|
3
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 n.promises.mkdir(e.dirname(e.join(s,String(t))),{recursive:!0}),await n.promises.writeFile(e.join(s,String(t)),c)}let x=process.cwd();for(let t in i)if(!t.startsWith("/.tags")){for(let{target:o}of i[t])if(!o.startsWith("/.tags")){await h.ensureDir(e.join(s,e.dirname(t)));try{!!await n.promises.stat(e.join(s,t))&&(console.error(new Error(`Symlink at '${e.join(s,t)}' already exists. Aborting build.`)),process.exit(1))}catch{let c=e.join(s,o),a=e.join(s,t),m=e.basename(a),j=e.relative(e.dirname(a),c);process.chdir(e.dirname(a)),n.existsSync(m)&&n.unlinkSync(m),await n.promises.symlink(j,m)}}}process.chdir(x),console.log(`[Mosaic] filesystem for ${Array.isArray(p)?p.length:r.sources.length} source(s) written to disk at '${s}'`),l.stop()}}catch(i){console.error(i),process.exit(1)}})}export{F as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"fastify-plugin";import l from"@jpmorganchase/mosaic-core";import a from"path";async function u(n,r){let{config:c,scope:f}=r,o=new l(c);await o.start();let t=Array.isArray(f)?o.filesystem.scope(f):o.filesystem;n.decorate("mosaic",{config:c,core:o,fs:t}),n.get("/*",async(i,s)=>{try{if(await t.promises.exists(i.url))if((await t.promises.stat(i.url)).isDirectory())await t.promises.exists(a.join(i.url,"index"))?(s.header("Content-Type","application/json"),s.status(302).send({redirect:a.join(i.url,"index")})):s.status(404);else{let e=String(await t.promises.realpath(i.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 t.promises.readFile(i.url);s.send(m)}else s.status(404)}catch(e){console.error(e),s.status(500)}})}var g=p(u,{fastify:"4.x",name:"fastify-mosaic"});export{g as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,b as p}from"./chunk-
|
|
1
|
+
import{a as u,b as p}from"./chunk-DYNA3PMW.mjs";import g from"fastify-plugin";function F(a,y,m){let{prefix:r}=y,{config:l,fs:h,core:f}=a.mosaic;a.get(`/${r}/config`,async(i,e)=>{e.header("Content-Type","application/json");let s=l.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=p(u({},n),{credentials:`${d[0]}: ********`}))}return t}),o=p(u({},l),{sources:s});e.send(o)}),a.get(`/${r}/content/dump`,(i,e)=>{e.header("Content-Type","application/json"),e.send(h.toJSON())}),a.get(`/${r}/sources/list`,async(i,e)=>{e.header("Content-Type","application/json");let o=(await f.listSources()).map(t=>{let n=l.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=p(u({},c),{credentials:`${d[0]}: ********`}))}return p(u({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 f.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 f.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"),!y.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 f.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)}}),m()}var S=g(F,{fastify:"4.x",name:"fastify-mosaic-admin",dependencies:["fastify-mosaic"]});export{S as a};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e}from"./chunk-
|
|
2
|
+
import{a as e}from"./chunk-ND7PMTGH.mjs";import{b as s}from"./chunk-MEMUPS54.mjs";import{a as p}from"./chunk-P3RXN7HU.mjs";import{a as n}from"./chunk-VIYGD5XX.mjs";import"./chunk-Y6WPZ5AX.mjs";import"./chunk-V6V27SIB.mjs";import"./chunk-6E5PQQKS.mjs";import"./chunk-DYNA3PMW.mjs";import{program as r}from"commander";import i from"path";import{pathToFileURL as a}from"url";r.option("-c, --config <string>","Config path").option("-o, --out <string>","Output directory",".tmp/.mosaic-build").option("-s, --scope <strings>","Command separated namespaces").option("-p, --port <number>","Port to serve on","8080").option("-n, --name <string>","Snapshot name").option("-S, --snapshot <string>","Snapshot path");r.parse();var o=r.opts(),t;if(o.config!==void 0){if(t=await import(a(i.resolve(process.cwd(),o.config)).toString()),!t)throw new Error(`[Mosaic] could not find config file at ${i.resolve(process.cwd(),o.config)}.`)}else throw new Error("[Mosaic] no config file provided");r.args[0]==="build"&&e(t.default,i.resolve(process.cwd(),o.out),o);r.args[0]==="serve"&&s(t.default,o.port,o.scope&&o.scope.split(","));r.args[0]==="upload"&&p(i.resolve(process.cwd(),o.snapshot));r.args[0]==="deploy"&&n(t.default,o);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-Y6WPZ5AX.mjs";import"../chunk-DYNA3PMW.mjs";export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-V6V27SIB.mjs";import"../chunk-DYNA3PMW.mjs";export{a as default};
|
|
@@ -9,9 +9,9 @@ export interface WorkflowRequestBodyType {
|
|
|
9
9
|
markdown: string;
|
|
10
10
|
name: string;
|
|
11
11
|
}
|
|
12
|
-
declare function mosaicWorkflows(fastify: FastifyInstance, _options: any
|
|
12
|
+
declare function mosaicWorkflows(fastify: FastifyInstance, _options: any): Promise<void>;
|
|
13
13
|
/**
|
|
14
|
-
* Fastify plugin that adds support for the Mosaic
|
|
14
|
+
* Fastify plugin that adds support for the Mosaic Workflows
|
|
15
15
|
* https://mosaic-mosaic-dev-team.vercel.app/mosaic/configure/admin/index
|
|
16
16
|
*/
|
|
17
17
|
declare const _default: typeof mosaicWorkflows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-6E5PQQKS.mjs";import"../chunk-DYNA3PMW.mjs";export{a as default};
|
package/dist/serve.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-MEMUPS54.mjs";import"./chunk-Y6WPZ5AX.mjs";import"./chunk-V6V27SIB.mjs";import"./chunk-6E5PQQKS.mjs";import"./chunk-DYNA3PMW.mjs";export{b as default,a as server};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-P3RXN7HU.mjs";import"./chunk-
|
|
1
|
+
import{a}from"./chunk-P3RXN7HU.mjs";import"./chunk-DYNA3PMW.mjs";export{a as default};
|
package/dist/vercel-snapshot.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-VIYGD5XX.mjs";import"./chunk-
|
|
1
|
+
import{a}from"./chunk-VIYGD5XX.mjs";import"./chunk-DYNA3PMW.mjs";export{a as updateTraceFile};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.52",
|
|
4
4
|
"author": "",
|
|
5
5
|
"description": "Mosaic command line scripts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,18 +37,20 @@
|
|
|
37
37
|
"directory": "packages/cli"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@jpmorganchase/mosaic-types": "^0.1.0-beta.
|
|
40
|
+
"@jpmorganchase/mosaic-types": "^0.1.0-beta.52",
|
|
41
41
|
"esbuild": "0.14.35",
|
|
42
42
|
"esbuild-node-externals": "^1.0.2",
|
|
43
|
-
"fast-glob": "^3.2.7"
|
|
43
|
+
"fast-glob": "^3.2.7",
|
|
44
|
+
"@types/ws": "^8.5.7"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@jpmorganchase/mosaic-core": "^0.1.0-beta.
|
|
47
|
-
"@jpmorganchase/mosaic-plugins": "^0.1.0-beta.
|
|
48
|
-
"@jpmorganchase/mosaic-standard-generator": "^0.1.0-beta.
|
|
49
|
-
"@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.
|
|
47
|
+
"@jpmorganchase/mosaic-core": "^0.1.0-beta.52",
|
|
48
|
+
"@jpmorganchase/mosaic-plugins": "^0.1.0-beta.52",
|
|
49
|
+
"@jpmorganchase/mosaic-standard-generator": "^0.1.0-beta.52",
|
|
50
|
+
"@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.52",
|
|
50
51
|
"@aws-sdk/client-s3": "^3.359.0",
|
|
51
52
|
"@fastify/middie": "^8.3.0",
|
|
53
|
+
"@fastify/websocket": "^8.2.0",
|
|
52
54
|
"commander": "^9.4.1",
|
|
53
55
|
"cors": "^2.8.5",
|
|
54
56
|
"deepmerge": "^4.2.2",
|
|
@@ -56,6 +58,7 @@
|
|
|
56
58
|
"fastify-plugin": "^4.5.1",
|
|
57
59
|
"fs-extra": "^10.1.0",
|
|
58
60
|
"globby": "^13.1.3",
|
|
61
|
+
"md5": "*",
|
|
59
62
|
"mkdirp": "^1.0.4"
|
|
60
63
|
}
|
|
61
64
|
}
|
package/dist/chunk-AY5WSHSM.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty,g=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var i=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var e=(c,a,b)=>a in c?f(c,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):c[a]=b,k=(c,a)=>{for(var b in a||(a={}))i.call(a,b)&&e(c,b,a[b]);if(d)for(var b of d(a))j.call(a,b)&&e(c,b,a[b]);return c},l=(c,a)=>g(c,h(a));export{k as a,l as b};
|
package/dist/chunk-KZGMXFBX.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import p from"fastify-plugin";import l from"@jpmorganchase/mosaic-core";import e from"path";async function u(n,f){let{config:c,scope:r}=f,o=new l(c);await o.start();let i=Array.isArray(r)?o.filesystem.scope(r):o.filesystem;n.decorate("mosaic",{config:c,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(e.join(t.url,"index"))?(s.header("Content-Type","application/json"),s.status(302).send({redirect:e.join(t.url,"index")})):s.status(404);else{let a=await i.promises.realpath(t.url);e.extname(a)===".mdx"?s.header("Content-Type","text/mdx"):e.extname(a)===".json"?s.header("Content-Type","application/json"):e.extname(a)===".xml"&&s.header("Content-Type","application/xml");let m=await i.promises.readFile(t.url);s.send(m)}else s.status(404)}catch(a){console.error(a),s.status(500)}})}var g=p(u,{fastify:"4.x",name:"fastify-mosaic"});export{g as a};
|
package/dist/chunk-WXWWLCIL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import w from"fastify-plugin";import d from"path";function y(r,l,a){let{fs:s,core:n}=r.mosaic;r.post("/workflows",async(f,t)=>{try{let{user:o,route:e,markdown:c,name:i}=f.body;if(!i)throw new Error("Workflow name is required");if(await s.promises.exists(e)){let p=(await s.promises.stat(e)).isDirectory()?d.posix.join(e,"index"):e,m=await s.promises.realpath(p),u=await n.triggerWorkflow(i,m,{user:o,markdown:c});t.header("Content-Type","application/json"),t.send(u)}}catch(o){console.error(o),t.status(500).send(o.message)}}),a()}var x=w(y,{fastify:"4.x",name:"fastify-mosaic-workflows",dependencies:["fastify-mosaic"]});export{x as a};
|