@mochabug/adaptkit 0.1.0-alpha.13 → 0.1.0-alpha.16

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 +4 -4
  2. package/package.json +11 -11
package/bin/index.js CHANGED
@@ -41,13 +41,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
41
41
  });
42
42
  }
43
43
 
44
- var actionTemplate = "import { ExecutorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents an action 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 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', '/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 };";
44
+ var actionTemplate = "import { ExecutorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents an action 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);\n if (!(await api.authorize()).ok) {\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', '/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 };";
45
45
 
46
- var configTemplate = "import { ConfiguratorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents a configurator of a vertex.\n * All requests coming from an external source (i.e. browsers) are\n * getting routed onto this endpoint. See the configurator API specification\n * for details and best practices regarding authorization and security.\n * See the configurator API specifications for details on how to interact with the runtime.\n *\n * @property {Function} fetch - A function that takes a Request, ConfiguratorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst external = {\n async fetch(\n req: Request,\n env: ConfiguratorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ConfiguratorApi(env, req.headers.get(\"Authorization\"));\n\n const router = new Router();\n router.add('GET', '(.*)', async () => {\n const authorized = await api.authorize(req);\n return authorized ? new Response(\"Hello Authorized!\") : new Response(\"Hello Unauthorized!\");\n });\n\n return router.route(req)\n },\n};\n\n/**\n * The internal endpoint of a configurator fires events from the platform\n * during configuration.\n */\nconst internal = {\n async fetch(\n req: Request,\n env: ConfiguratorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n return new Response();\n },\n};\n\nexport { external, internal };\n";
46
+ var configTemplate = "import { ConfiguratorApi } from \"@mochabug/adapt-plugin-toolkit/api\";\nimport { Router } from \"@mochabug/adapt-plugin-toolkit/router\";\n\n/**\n * Represents a configurator of a vertex.\n * All requests coming from an external source (i.e. browsers) are\n * getting routed onto this endpoint. See the configurator API specification\n * for details and best practices regarding authorization and security.\n * See the configurator API specifications for details on how to interact with the runtime.\n *\n * @property {Function} fetch - A function that takes a Request, ConfiguratorEnvironment, and ExecutionContext\n * and returns a Promise resolving to a Response.\n */\nconst external = {\n async fetch(\n req: Request,\n env: ConfiguratorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n const api = new ConfiguratorApi(env, req);\n\n const router = new Router();\n router.add('GET', '(.*)', async () => {\n const authorized = await api.authorize();\n return authorized.ok ? new Response(\"Hello Authorized!\") : new Response(\"Hello Unauthorized!\");\n });\n\n return router.route(req)\n },\n};\n\n/**\n * The internal endpoint of a configurator fires events from the platform\n * during configuration.\n */\nconst internal = {\n async fetch(\n req: Request,\n env: ConfiguratorEnvironment,\n ctx: ExecutionContext\n ): Promise<Response> {\n return new Response();\n },\n};\n\nexport { external, internal };\n";
47
47
 
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 };";
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);\n if (!(await api.authorize()).ok) {\n return new Response(\"Should never happen\", { status: 401 });\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 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 };";
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);\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);\n if (!(await api.authorize()).ok) {\n return new Response(\"Should never happen\", { status: 401 });\n \n }\n const router = new Router();\n router.add('POST', '/start', 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 { 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adaptkit",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.16",
4
4
  "description": "A cmd to create, emulate and publish Mochabug Adapt plugins",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",
@@ -33,31 +33,31 @@
33
33
  "author": "Mikael Hedberg",
34
34
  "license": "Apache-2.0",
35
35
  "devDependencies": {
36
- "@jest/globals": "^29.5.0",
37
- "@rollup/plugin-typescript": "^11.1.1",
36
+ "@jest/globals": "^29.6.1",
37
+ "@rollup/plugin-typescript": "^11.1.2",
38
38
  "@types/figlet": "^1.5.6",
39
39
  "@types/glob": "^8.1.0",
40
40
  "@types/inquirer": "^9.0.3",
41
41
  "@types/jest": "^29.5.2",
42
42
  "@types/mkdirp": "^1.0.2",
43
43
  "@types/mustache": "^4.2.2",
44
- "@types/node": "^20.2.5",
44
+ "@types/node": "^20.4.0",
45
45
  "@types/sharp": "^0.31.1",
46
- "jest": "^29.5.0",
47
- "rollup": "^3.24.0",
46
+ "jest": "^29.6.1",
47
+ "rollup": "^3.26.2",
48
48
  "rollup-plugin-string": "^3.0.0",
49
- "ts-jest": "^29.1.0",
49
+ "ts-jest": "^29.1.1",
50
50
  "ts-node": "^10.9.1",
51
- "typescript": "^5.1.3"
51
+ "typescript": "^5.1.6"
52
52
  },
53
53
  "dependencies": {
54
54
  "@protobuf-ts/grpc-transport": "^2.9.0",
55
55
  "@protobuf-ts/runtime": "^2.9.0",
56
56
  "@protobuf-ts/runtime-rpc": "^2.9.0",
57
- "chalk": "^5.2.0",
58
- "commander": "^10.0.1",
57
+ "chalk": "^5.3.0",
58
+ "commander": "^11.0.0",
59
59
  "figlet": "^1.6.0",
60
- "glob": "^10.2.7",
60
+ "glob": "^10.3.1",
61
61
  "inquirer": "^9.2.7",
62
62
  "mkdirp": "^3.0.1",
63
63
  "mustache": "^4.2.0",