@mochabug/adaptkit 0.2.0-alpha.1 → 0.2.0-alpha.2
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/bin/index.js +6 -6
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -873,17 +873,17 @@ class PluginServiceClient {
|
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
|
|
876
|
-
var externalConfigTemplate = "import { VertexConfig } from '@mochabug/adapt-plugin-toolkit/api';\nimport { ExternalConfiguratorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalConfiguratorRouter()\n .useRequestLogging()\n .useBearerAuthorization(['/api'])\n .add('GET', '/api/config', async (
|
|
876
|
+
var externalConfigTemplate = "import { VertexConfig } from '@mochabug/adapt-plugin-toolkit/api';\nimport { ExternalConfiguratorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalConfiguratorRouter()\n .useRequestLogging()\n .useBearerAuthorization(['/api'])\n .add('GET', '/api/config', async (_req, api) => {\n const res = await api.getVertexConfig<VertexConfig>();\n if (!res.ok) {\n console.error(res);\n return new Response(res.errorMessage, { status: res.errorStatus });\n }\n return new Response(JSON.stringify(res.data!), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n })\n .add('GET', '(/?)', async () => {\n return new Response(getHelloWorldPage(), {\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n });\n\nfunction getHelloWorldPage(): string {\n return `\n <html>\n <head>\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Orbitron&display=swap');\n @keyframes glow {\n 0% { text-shadow: 0 0 5px #0f0, 0 0 10px #0f0, 0 0 15px #0f0, 0 0 20px #0f0; }\n 100% { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0; }\n }\n body {\n background-color: #000;\n color: #0f0;\n font-family: 'Orbitron', sans-serif;\n text-align: center;\n overflow: hidden;\n margin: 0;\n padding: 0;\n }\n h1 {\n position: absolute;\n top: 30%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 3em;\n text-transform: uppercase;\n letter-spacing: 4px;\n animation: glow 2s infinite alternate;\n }\n #jsonOutput {\n position: absolute;\n top: 70%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 1.5em;\n text-transform: uppercase;\n letter-spacing: 2px;\n animation: glow 2s infinite alternate;\n }\n button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background-color: #0f0;\n border: none;\n color: black;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 20px; /* Increase the font size */\n margin: 4px 2px;\n cursor: pointer;\n transition-duration: 0.4s;\n animation: glow 2s infinite alternate;\n font-family: 'Orbitron', sans-serif;\n border-radius: 15px;\n transform: rotate(-10deg) skew(10deg, 10deg);\n }\n </style>\n </head>\n <body>\n <h1>Hello, World!</h1>\n <button id=\"assimilateButton\">Assimilate</button>\n <pre id=\"jsonOutput\"></pre>\n <script>\n document.getElementById('assimilateButton').addEventListener('click', function() {\n const hash = window.location.hash.substr(1).trim();\n const token = decodeURIComponent(hash); \n fetch('/api/config', {\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer ' + token\n }\n })\n .then(response => response.json())\n .then(data => {\n document.getElementById('jsonOutput').innerText = JSON.stringify(data, null, 2);\n this.style.display = 'none'; /* Hide button after being clicked */\n })\n .catch(error => {\n console.error('Error:', error);\n document.getElementById('jsonOutput').innerText = 'Error occurred while assimilating data';\n });\n });\n </script>\n </body>\n </html>\n `;\n}\n";
|
|
877
877
|
|
|
878
878
|
var internalConfigTemplate = "import { InternalConfiguratorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n/**\n * A `InternalConfiguratorRouter` instance configured to handle internal platform calls for the vertex during configuration.\n *\n * There are no events to handle at the moment\n */\nexport const router = new InternalConfiguratorRouter();\n";
|
|
879
879
|
|
|
880
|
-
var browserExecTempalte = "import { ExternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalExecutorRouter()\n .useRequestLogging()\n .useBearerAuthorization(['/api'])\n .add('POST', '/api/done', async (req, api,
|
|
880
|
+
var browserExecTempalte = "import { ExternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalExecutorRouter()\n .useRequestLogging()\n .useBearerAuthorization(['/api'])\n .add('POST', '/api/done', async (req, api, _route, ctx) => {\n const sapi = api.getSessionApi(req.headers.get('Authorization')!);\n ctx.waitUntil(sapi.complete('output', {}));\n return new Response();\n })\n .add('GET', '(/?)', async () => {\n return new Response(getSamplePage(), {\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n });\n\nfunction getSamplePage(): string {\n return `\n <html>\n <head>\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Orbitron&display=swap');\n @keyframes glow {\n 0% { text-shadow: 0 0 5px #0f0, 0 0 10px #0f0, 0 0 15px #0f0, 0 0 20px #0f0; }\n 100% { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0; }\n }\n body {\n background-color: #000;\n color: #0f0;\n font-family: 'Orbitron', sans-serif;\n text-align: center;\n overflow: hidden;\n margin: 0;\n padding: 0;\n }\n button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background-color: #0f0;\n border: none;\n color: black;\n padding: 15px 32px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 20px;\n margin: 4px 2px;\n cursor: pointer;\n transition-duration: 0.4s;\n animation: glow 2s infinite alternate;\n font-family: 'Orbitron', sans-serif;\n border-radius: 15px;\n transform: rotate(-10deg) skew(10deg, 10deg);\n }\n </style>\n </head>\n <body>\n <button id=\"doneButton\">Done</button>\n <script>\n document.getElementById('doneButton').addEventListener('click', function() {\n const hash = window.location.hash.substr(1).trim();\n const token = decodeURIComponent(hash); \n fetch('/api/done', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer ' + token\n }\n })\n .then(data => {\n this.innerText = 'Done';\n })\n .catch(error => {\n console.error('Error:', error);\n });\n });\n </script>\n </body>\n </html>\n `;\n}\n";
|
|
881
881
|
|
|
882
|
-
var cronExecTemplate = "import { CronExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new CronExecutorRouter()\n .onStart(async (req,
|
|
882
|
+
var cronExecTemplate = "import { CronExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new CronExecutorRouter()\n .onStart(async (req, _api) => {\n const start = await req.json<StartExecutionRequest>();\n console.log('Start has been called');\n console.log(start);\n })\n .onStop(async (_req, _api) => {\n console.log('Stop has been called');\n })\n .onCron(async (_req, _api) => {\n console.log('Received cron event');\n })\n .onStream(async (req, _api, name) => {\n console.log(`Stream ${name} has been called`);\n const res = await req.json<StreamResult>();\n console.log(res);\n })\n .onProcedure(async (req, _api, name) => {\n console.log(`Procedure ${name} has been called`);\n const res = await req.json<ProcedureResult>();\n console.log(res);\n });\n";
|
|
883
883
|
|
|
884
|
-
var triggerExecTemplate = "import { ExternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalExecutorRouter().add('*'
|
|
884
|
+
var triggerExecTemplate = "import { ExternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new ExternalExecutorRouter().add(\n '*',\n '(.*)',\n async (_req, _api, _route, _ctx) => {\n return new Response();\n },\n);\n";
|
|
885
885
|
|
|
886
|
-
var internalExecTemplate = "import { InternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new InternalExecutorRouter()\n .onStart(async (req,
|
|
886
|
+
var internalExecTemplate = "import { InternalExecutorRouter } from '@mochabug/adapt-plugin-toolkit/router';\n\nexport const router = new InternalExecutorRouter()\n .onStart(async (req, _api) => {\n const start = await req.json<StartExecutionRequest>();\n console.log('Start has been called');\n console.log(start);\n })\n .onStop(async (_req, _api) => {\n console.log('Stop has been called');\n })\n .onStream(async (req, _api, name) => {\n console.log(`Stream ${name} has been called`);\n const res = await req.json<StreamResult>();\n console.log(res);\n })\n .onProcedure(async (req, _api, name) => {\n console.log(`Procedure ${name} has been called`);\n const res = await req.json<ProcedureResult>();\n console.log(res);\n });\n";
|
|
887
887
|
|
|
888
888
|
var gitignoreTemplate = "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Snowpack dependency directory (https://snowpack.dev/)\nweb_modules/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional stylelint cache\n.stylelintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# Next.js build output\n.next\nout\n\n# Nuxt.js build / generate output\n.nuxt\ndist\nbuild\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and not Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# vuepress v2.x temp and cache directory\n.temp\n.cache\n\n# Stores VSCode versions used for testing VSCode extensions\n.vscode-test\n\n# yarn v2\n.yarn/cache\n.yarn/unplugged\n.yarn/build-state.yml\n.yarn/install-state.gz\n.pnp.*";
|
|
889
889
|
|
|
@@ -895,7 +895,7 @@ var readmeTemplate = "# 🐞 Mochabug Adapt's Magnificent Plugin 🐞\n\n[![Vers
|
|
|
895
895
|
|
|
896
896
|
var rollupTemplate = "import fs from 'fs';\nimport typescript from '@rollup/plugin-typescript';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport terser from '@rollup/plugin-terser';\nimport commonjs from '@rollup/plugin-commonjs';\n\nconst config = [\n {\n input: 'src/executors.ts',\n output: {\n file: 'dist/executors.js',\n format: 'esm'\n },\n plugins: [typescript(), nodeResolve(), commonjs(), terser()]\n }\n];\n\n// Check if 'src/configurators.ts' exists\nif (fs.existsSync('src/configurators.ts')) {\n config.push({\n input: 'src/configurators.ts',\n output: {\n file: 'dist/configurators.js',\n format: 'esm'\n },\n plugins: [typescript(), nodeResolve(), commonjs(), terser()]\n });\n}\n\nexport default config;\n";
|
|
897
897
|
|
|
898
|
-
var tsconfig = "{\n \"exclude\": [\n \"**/*.test.*\",\n \"**/__mocks__/*\",\n \"**/__tests__/*\"\n ],\n \"compilerOptions\": {\n \"rootDir\": \"src\",\n \"jsx\": \"react\",\n \"target\": \"esnext\",\n \"module\": \"esnext\",\n \"lib\": [\"esnext\"],\n \"moduleResolution\": \"node\",\n \"types\": [\n \"@mochabug/adapt-plugin-typings\",\n \"jest\"\n ],\n \"resolveJsonModule\": true,\n \"allowJs\": true,\n \"checkJs\": false,\n \"noEmit\": true,\n \"isolatedModules\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true\n }\n}";
|
|
898
|
+
var tsconfig = "{\n \"exclude\": [\n \"**/*.test.*\",\n \"**/__mocks__/*\",\n \"**/__tests__/*\"\n ],\n \"compilerOptions\": {\n \"rootDir\": \"src\",\n \"jsx\": \"react\",\n \"target\": \"esnext\",\n \"module\": \"esnext\",\n \"lib\": [\n \"esnext\"\n ],\n \"moduleResolution\": \"node\",\n \"types\": [\n \"@mochabug/adapt-plugin-typings\",\n \"jest\"\n ],\n \"resolveJsonModule\": true,\n \"allowJs\": true,\n \"checkJs\": false,\n \"noEmit\": true,\n \"isolatedModules\": true,\n \"allowSyntheticDefaultImports\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"strict\": true,\n \"skipLibCheck\": true,\n \"noUnusedLocals\": true,\n \"noUnusedParameters\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noImplicitReturns\": true,\n \"useUnknownInCatchVariables\": true,\n \"noUncheckedIndexedAccess\": true,\n \"noPropertyAccessFromIndexSignature\": true\n }\n}";
|
|
899
899
|
|
|
900
900
|
// Copyright 2023, mochabug AB
|
|
901
901
|
//
|