@jpmorganchase/mosaic-cli 0.1.0-beta.46 → 0.1.0-beta.48
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/chunk-JVO4K3RX.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/serve.mjs +1 -1
- package/package.json +6 -6
- package/dist/chunk-V3BJTQ7D.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as y,b as f}from"./chunk-AY5WSHSM.mjs";import w from"express";import x from"cors";import p from"path";import _ from"@jpmorganchase/mosaic-core";var n=w();async function j(m,h,u){n.listen(h,()=>{console.log(`[Mosaic] Listening on port ${h}${Array.isArray(u)?` (scoped to ${u.join(", ")})`:""}`)});let r=new _(m);await r.start();let a=Array.isArray(u)?r.filesystem.scope(u):r.filesystem;n.use(x(),w.json()),n.get("/_mosaic_/sources/list",async(s,e)=>{e.contentType("application/json");let o=(await r.listSources()).map(c=>{let i=m.sources[c.index],d=i.options;if(d?.credentials&&i.modulePath==="@jpmorganchase/mosaic-source-git-repo"){let l=d.credentials?.split(":")||[];l.length>0&&(i.options=f(y({},d),{credentials:`${l[0]}: ********`}))}return f(y({name:c.name},i),{pluginErrors:c.pluginErrors})});e.send(o)}),n.get("/_mosaic_/config",async(s,e)=>{e.contentType("application/json"),e.send(m)}),n.get("/_mosaic_/content/dump",async(s,e)=>{e.contentType("application/json"),e.send(a.toJSON())}),n.put("/_mosaic_/source/stop",async(s,e)=>{e.contentType("application/text");let{name:t}=s.body;if(t)try{await r.stopSource(String(t)),e.send(`${t} stopped successfully.`)}catch(o){console.error(o),e.status(500).send(`${t} not stopped. Check you have the right name!`)}}),n.put("/_mosaic_/source/restart",async(s,e)=>{e.contentType("application/text");let{name:t}=s.body;if(t)try{await r.restartSource(String(t)),e.send(`${t} restarted successfully.`)}catch(o){console.error(o),e.status(500).send(`${t} not restarted. Check you have the right name!`)}}),n.get("/**",async(s,e)=>{try{if(await a.promises.exists(s.path))if((await a.promises.stat(s.path)).isDirectory())await a.promises.exists(p.join(s.path,"index"))?e.status(302).json({redirect:p.join(s.path,"index")}):e.status(404).end();else{let t=await a.promises.realpath(s.path);p.extname(t)===".mdx"?e.contentType("text/mdx"):p.extname(t)===".json"?e.contentType("application/json"):p.extname(t)===".xml"&&e.contentType("application/xml");let o=await a.promises.readFile(s.path);e.send(o)}else e.status(404).end()}catch(t){console.error(t),e.status(500).end()}}),n.post("/workflows",async(s,e)=>{try{let{user:t,route:o,markdown:c,name:i}=s.body;if(!i)throw new Error("Workflow name is required");if(await a.promises.exists(o)){let d=(await a.promises.stat(o)).isDirectory()?p.posix.join(o,"index"):o,l=await a.promises.realpath(d),g=await r.triggerWorkflow(i,l,{user:t,markdown:c});e.contentType("application/json"),e.send(g)}}catch(t){console.error(t),e.status(500).send(t.message).end()}}),n.post("/sources/add",async(s,e)=>{try{let{definition:t,isPreview:o=!0}=s.body;if(process.env.MOSAIC_ENABLE_SOURCE_PUSH!=="true")throw new Error("Source push is disabled.");if(!t)throw new Error("Source definition is required");if(o){let i=`preview-${t.namespace}`;t.namespace=i}let c=await r.addSource(t);e.send(c!==void 0?`Source ${c.id.description} added successfully`:"Unable to add source")}catch(t){console.error(t),e.status(500).send(t.message).end()}})}export{j as a};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e}from"./chunk-J73DKLHI.mjs";import{a as s}from"./chunk-
|
|
2
|
+
import{a as e}from"./chunk-J73DKLHI.mjs";import{a as s}from"./chunk-JVO4K3RX.mjs";import{a as p}from"./chunk-P3RXN7HU.mjs";import{a as n}from"./chunk-VIYGD5XX.mjs";import"./chunk-AY5WSHSM.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);
|
package/dist/serve.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-JVO4K3RX.mjs";import"./chunk-AY5WSHSM.mjs";export{a as default};
|
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.48",
|
|
4
4
|
"author": "",
|
|
5
5
|
"description": "Mosaic command line scripts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,16 +37,16 @@
|
|
|
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.48",
|
|
41
41
|
"esbuild": "0.14.35",
|
|
42
42
|
"esbuild-node-externals": "^1.0.2",
|
|
43
43
|
"fast-glob": "^3.2.7"
|
|
44
44
|
},
|
|
45
45
|
"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.
|
|
46
|
+
"@jpmorganchase/mosaic-core": "^0.1.0-beta.48",
|
|
47
|
+
"@jpmorganchase/mosaic-plugins": "^0.1.0-beta.48",
|
|
48
|
+
"@jpmorganchase/mosaic-standard-generator": "^0.1.0-beta.48",
|
|
49
|
+
"@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.48",
|
|
50
50
|
"@aws-sdk/client-s3": "^3.359.0",
|
|
51
51
|
"commander": "^9.4.1",
|
|
52
52
|
"cors": "^2.8.5",
|
package/dist/chunk-V3BJTQ7D.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y,b as f}from"./chunk-AY5WSHSM.mjs";import w from"express";import x from"cors";import p from"path";import _ from"@jpmorganchase/mosaic-core";var a=w();async function j(m,h,u){a.listen(h,()=>{console.log(`[Mosaic] Listening on port ${h}${Array.isArray(u)?` (scoped to ${u.join(", ")})`:""}`)});let i=new _(m);await i.start();let r=Array.isArray(u)?i.filesystem.scope(u):i.filesystem;a.use(x(),w.json()),a.get("/_mosaic_/sources/list",async(s,e)=>{e.contentType("application/json");let o=(await i.listSources()).map(c=>{let n=m.sources[c.index],d=n.options;if(d?.credentials&&n.modulePath==="@jpmorganchase/mosaic-source-git-repo"){let l=d.credentials?.split(":")||[];l.length>0&&(n.options=f(y({},d),{credentials:`${l[0]}: ********`}))}return f(y({name:c.name},n),{pluginErrors:c.pluginErrors})});e.send(o)}),a.get("/_mosaic_/config",async(s,e)=>{e.contentType("application/json"),e.send(m)}),a.put("/_mosaic_/source/stop",async(s,e)=>{e.contentType("application/text");let{name:t}=s.body;if(t)try{await i.stopSource(String(t)),e.send(`${t} stopped successfully.`)}catch(o){console.error(o),e.status(500).send(`${t} not stopped. Check you have the right name!`).end()}}),a.put("/_mosaic_/source/restart",async(s,e)=>{e.contentType("application/text");let{name:t}=s.body;if(t)try{await i.restartSource(String(t)),e.send(`${t} restarted successfully.`)}catch(o){console.error(o),e.status(500).send(`${t} not restarted. Check you have the right name!`).end()}}),a.get("/**",async(s,e)=>{try{if(await r.promises.exists(s.path))if((await r.promises.stat(s.path)).isDirectory())await r.promises.exists(p.join(s.path,"index"))?e.status(302).json({redirect:p.join(s.path,"index")}):e.status(404).end();else{let t=await r.promises.realpath(s.path);p.extname(t)===".mdx"?e.contentType("text/mdx"):p.extname(t)===".json"?e.contentType("application/json"):p.extname(t)===".xml"&&e.contentType("application/xml");let o=await r.promises.readFile(s.path);e.send(o)}else e.status(404).end()}catch(t){console.error(t),e.status(500).end()}}),a.post("/workflows",async(s,e)=>{try{let{user:t,route:o,markdown:c,name:n}=s.body;if(!n)throw new Error("Workflow name is required");if(await r.promises.exists(o)){let d=(await r.promises.stat(o)).isDirectory()?p.posix.join(o,"index"):o,l=await r.promises.realpath(d),g=await i.triggerWorkflow(n,l,{user:t,markdown:c});e.contentType("application/json"),e.send(g)}}catch(t){console.error(t),e.status(500).send(t.message).end()}}),a.post("/sources/add",async(s,e)=>{try{let{definition:t,isPreview:o=!0}=s.body;if(process.env.MOSAIC_ENABLE_SOURCE_PUSH!=="true")throw new Error("Source push is disabled.");if(!t)throw new Error("Source definition is required");if(o){let n=`preview-${t.namespace}`;t.namespace=n}let c=await i.addSource(t);e.send(c!==void 0?`Source ${c.id.description} added successfully`:"Unable to add source")}catch(t){console.error(t),e.status(500).send(t.message).end()}})}export{j as a};
|