@mochabug/adaptkit 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (2) hide show
  1. package/bin/index.js +2 -2
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -47,7 +47,7 @@ var configTemplate = "import { ConfiguratorApi } from \"@mochabug/adapt-plugin-t
47
47
 
48
48
  var cronTriggerTemplate = "import { ExecutorApi } from '@mochabug/adapt-plugin-toolkit/api';\nimport { Router } from '@mochabug/adapt-plugin-toolkit/router';\n\n/**\n * Represents a executor of a vertex.\n * The internal entrypoint is called by the runtime and is never exposed to the outside world.\n * See the executor API specifications for details on how to interact with the runtime.\n *\n * POST: /start\n * - When the vertex starts executing this endpoint is called with the \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /cron\n * - When execution is trigger by a cron trigger this endpoint is called with the \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /streams/<name>\n * - If a stream has been started by the vertex, stream writes to this endpoint as \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /procedures/<name>\n * - If a procedure has been executed by the vertex, procedure writes to this endpoint as \"application/json\"\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * @property {Function} fetch - A function that takes a Request, ExecutorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst internal = {\n async fetch(\n req: Request,\n env: ExecutorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ExecutorApi(env, req.headers.get(\"Authorization\"));\n if (!await api.authorize(req)) {\n return new Response(\"Should never happen\", { status: 401 });\n\n }\n\n const router = new Router();\n router.add('POST', '/start', async () => {\n return new Response();\n });\n\n router.add('POST', '/cron', async () => {\n return new Response();\n });\n\n router.add('POST', '/streams/:name', async () => {\n return new Response();\n });\n\n router.add('POST', '/procedures/:name', async () => {\n return new Response();\n });\n\n return router.route(req)\n },\n};\n\nexport { internal };";
49
49
 
50
- var externalTriggerTemplate = "import { ExecutorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents an external executor for a vertex.\n * All requests coming from an external source (i.e. the external trigger) are\n * getting routed onto this endpoint. See the executor API specification\n * for details and best practices regarding authorization and security.\n * See the executor API specifications for details on how to interact with the runtime.\n *\n * @property {Function} fetch - A function that takes a Request, ExecutorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst external = {\n async fetch(\n req: Request,\n env: ExecutorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ExecutorApi(env, req.headers.get(\"Authorization\"));\n\n // Do your thing here\n\n // Mark the execution as complete. This will trigger downstream tasks\n ctx.waitUntil(api.complete(\"output\", []));\n\n return new Response(\"Hello World!\");\n },\n};\n\n/**\n * Represents a executor of a vertex.\n * The internal entrypoint is called by the runtime and is never exposed to the outside world.\n * See the executor API specifications for details on how to interact with the runtime.\n *\n * POST: /start\n * - When the vertex starts executing this endpoint is called with the \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /streams/<name>\n * - If a stream has been started by the vertex, stream writes to this endpoint as \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /procedures/<name>\n * - If a procedure has been executed by the vertex, procedure writes to this endpoint as \"application/json\"\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * @property {Function} fetch - A function that takes a Request, ExecutorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst internal = {\n async fetch(\n req: Request,\n env: ExecutorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ExecutorApi(env, req.headers.get(\"Authorization\"));\n const router = new Router();\n\n router.add('POST', '/start', async () => {\n api.authorize(req)\n return new Response();\n });\n\n router.add('POST', '/streams/:name', async () => {\n return new Response();\n });\n\n router.add('POST', '/procedures/:name', async () => {\n return new Response();\n });\n\n return router.route(req)\n },\n};\n\nexport { external, internal };";
50
+ var externalTriggerTemplate = "import { ExecutorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents an external executor for a vertex.\n * All requests coming from an external source (i.e. the external trigger) are\n * getting routed onto this endpoint. See the executor API specification\n * for details and best practices regarding authorization and security.\n * See the executor API specifications for details on how to interact with the runtime.\n *\n * @property {Function} fetch - A function that takes a Request, ExecutorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst external = {\n async fetch(\n req: Request,\n env: ExecutorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ExecutorApi(env, req.headers.get(\"Authorization\"));\n\n // Do your thing here\n\n // Mark the execution as complete. This will trigger downstream tasks\n ctx.waitUntil(api.complete(\"output\", []));\n\n return new Response(\"Hello World!\");\n },\n};\n\n/**\n * Represents a executor of a vertex.\n * The internal entrypoint is called by the runtime and is never exposed to the outside world.\n * See the executor API specifications for details on how to interact with the runtime.\n *\n * POST: /start\n * - When the vertex starts executing this endpoint is called with the \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /streams/<name>\n * - If a stream has been started by the vertex, stream writes to this endpoint as \"application/json\" Content-Type.\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * POST: /procedures/<name>\n * - If a procedure has been executed by the vertex, procedure writes to this endpoint as \"application/json\"\n * - Refer to the executor API documentation or the plugin-toolkit on the content of the body.\n * - Contains the instance's Bearer token in the Authorization Header\n * @property {Function} fetch - A function that takes a Request, ExecutorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst internal = {\n async fetch(\n req: Request,\n env: ExecutorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ExecutorApi(env, req.headers.get(\"Authorization\"));\n const router = new Router();\n\n router.add('POST', '/start', async () => {\n await api.authorize(req)\n return new Response();\n });\n\n router.add('POST', '/streams/:name', async () => {\n return new Response();\n });\n\n router.add('POST', '/procedures/:name', async () => {\n return new Response();\n });\n\n return router.route(req)\n },\n};\n\nexport { external, internal };";
51
51
 
52
52
  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.*";
53
53
 
@@ -57,7 +57,7 @@ var licenseTemplate = "## ISC License\n\nCopyright (c) [year] [fullname]\n\nPerm
57
57
 
58
58
  var readmeTemplate = "# 🐞 Mochabug Adapt's Magnificent Plugin 🐞\n\n[![Version](https://img.shields.io/badge/version-PLUGIN_VERSION-blue)](PLUGIN_REPOSITORY_URL)\n[![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC)\n\n## 📝 Description\n\nWelcome to the Magnificent Plugin for Mochabug Adapt! Developed by a talented third-party developer, this plugin promises to bring extra flavor to your Mochabug Adapt cloud platform experience. PLUGIN_DESCRIPTION\n\nThis plugin consists of one or more vertices. Each vertex is made up of an Executor and may optionally include a Configurator to help you tailor its behavior.\n\n## 📚 Table of Contents\n\n- [🐞 Mochabug Adapt's Magnificent Plugin 🐞](#-mochabug-adapts-magnificent-plugin-)\n - [📝 Description](#-description)\n - [📚 Table of Contents](#-table-of-contents)\n - [🚀 Getting Started](#-getting-started)\n - [🎯 Usage](#-usage)\n - [⚙️ Configuration](#️-configuration)\n - [📖 Documentation](#-documentation)\n - [🤝 Contributing](#-contributing)\n - [📜 License](#-license)\n - [👤 Author](#-author)\n\n## 🚀 Getting Started\n\nTo begin using Mochabug Adapt's Magnificent Plugin, simply start incorporating its vertices into your workflows within the Mochabug Adapt platform. No installation is required.\n\n## 🎯 Usage\n\nYou can start using the vertices by incorporating them into your workflows on the Mochabug Adapt platform. Each vertex will delight you with a specific task, and the usage will vary depending on your requirements. Consult the plugin documentation for a comprehensive guide on each vertex's usage.\n\n## ⚙️ Configuration\n\nEach vertex in the plugin may have a Configurator, which allows you to tailor the vertex's behavior to your liking. Configuration options may include settings for the Executor, input/output data formats, and other essential options.\n\n## 📖 Documentation\n\nFor more insights into the plugin, its vertices, and their features, visit the [homepage](PLUGIN_HOMEPAGE) and the [repository](PLUGIN_REPOSITORY_URL).\n\n## 🤝 Contributing\n\nReady to make the Magnificent Plugin for Mochabug Adapt even more magical? Contributions are welcome! Check the [repository](PLUGIN_REPOSITORY_URL) for open issues and guidelines on how to contribute.\n\n## 📜 License\n\nThis plugin is licensed under the [ISC License](https://opensource.org/licenses/ISC).\n\n## 👤 Author\n\nPLUGIN_AUTHOR\n";
59
59
 
60
- var rollupTemplate = "import 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\nexport default [\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 input: 'src/configurators.ts',\n output: {\n file: 'dist/configurators.js',\n format: 'esm'\n },\n plugins: [typescript(), nodeResolve(), commonjs(), terser()]\n }\n];";
60
+ 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";
61
61
 
62
62
  var tsconfig = "{\n \"exclude\": [\n \"**/*.test.*\",\n \"**/__mocks__/*\",\n \"**/__tests__/*\"\n ],\n \"compilerOptions\": {\n \"rootDir\": \"src\",\n \"target\": \"es2021\",\n \"lib\": [\n \"es2021\"\n ],\n \"jsx\": \"react\",\n \"module\": \"es2022\",\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}";
63
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adaptkit",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.12",
4
4
  "description": "A cmd to create, emulate and publish Mochabug Adapt plugins",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",