@mochabug/adaptkit 1.0.0-rc.3 → 1.0.0-rc.5

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 (75) hide show
  1. package/assets/build.js +2 -57
  2. package/assets/configurator.html +14 -0
  3. package/assets/configurator.ssg.tsx +2 -16
  4. package/assets/configurator_react.tsx +6 -3
  5. package/assets/executor.html +14 -0
  6. package/assets/executor.ssg.tsx +2 -16
  7. package/assets/executor_browser_react.tsx +6 -3
  8. package/assets/gitignore +3 -1
  9. package/assets/tsconf.json +3 -5
  10. package/bin/add.d.ts +3 -0
  11. package/bin/add.d.ts.map +1 -0
  12. package/bin/genproto/buf/validate/validate_pb.d.ts +8122 -0
  13. package/bin/genproto/buf/validate/validate_pb.d.ts.map +1 -0
  14. package/bin/genproto/google/api/annotations_pb.d.ts +14 -0
  15. package/bin/genproto/google/api/annotations_pb.d.ts.map +1 -0
  16. package/bin/genproto/google/api/client_pb.d.ts +1402 -0
  17. package/bin/genproto/google/api/client_pb.d.ts.map +1 -0
  18. package/bin/genproto/google/api/http_pb.d.ts +837 -0
  19. package/bin/genproto/google/api/http_pb.d.ts.map +1 -0
  20. package/bin/genproto/google/api/launch_stage_pb.d.ts +94 -0
  21. package/bin/genproto/google/api/launch_stage_pb.d.ts.map +1 -0
  22. package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts +75 -0
  23. package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts.map +1 -0
  24. package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts +225 -0
  25. package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts.map +1 -0
  26. package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts +67 -0
  27. package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts.map +1 -0
  28. package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +133 -0
  29. package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts.map +1 -0
  30. package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +87 -0
  31. package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts.map +1 -0
  32. package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts +63 -0
  33. package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts.map +1 -0
  34. package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts +75 -0
  35. package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts.map +1 -0
  36. package/bin/genproto/mochabugapis/adapt/graph/vertex_config_pb.d.ts +109 -0
  37. package/bin/genproto/mochabugapis/adapt/graph/vertex_config_pb.d.ts.map +1 -0
  38. package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts +62 -0
  39. package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts.map +1 -0
  40. package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts +223 -0
  41. package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts.map +1 -0
  42. package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts +715 -0
  43. package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts.map +1 -0
  44. package/bin/genproto/mochabugapis/adapt/plugins/v1/oneof_service_pb.d.ts +92 -0
  45. package/bin/genproto/mochabugapis/adapt/plugins/v1/oneof_service_pb.d.ts.map +1 -0
  46. package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts +194 -0
  47. package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts.map +1 -0
  48. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_binding_pb.d.ts +134 -0
  49. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_binding_pb.d.ts.map +1 -0
  50. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts +116 -0
  51. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts.map +1 -0
  52. package/bin/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.d.ts +159 -0
  53. package/bin/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.d.ts.map +1 -0
  54. package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts +60 -0
  55. package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts.map +1 -0
  56. package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts +232 -0
  57. package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts.map +1 -0
  58. package/bin/index.d.ts +7 -0
  59. package/bin/index.d.ts.map +1 -0
  60. package/bin/index.js +355 -429
  61. package/bin/index.js.map +4 -4
  62. package/bin/init.d.ts +2 -0
  63. package/bin/init.d.ts.map +1 -0
  64. package/bin/oauth2.d.ts +2 -0
  65. package/bin/oauth2.d.ts.map +1 -0
  66. package/bin/publish.d.ts +23 -0
  67. package/bin/publish.d.ts.map +1 -0
  68. package/bin/utils.d.ts +13 -0
  69. package/bin/utils.d.ts.map +1 -0
  70. package/bin/vertices.d.ts +3 -0
  71. package/bin/vertices.d.ts.map +1 -0
  72. package/package.json +5 -17
  73. package/assets/build-client.js +0 -111
  74. package/assets/global.d.ts +0 -7
  75. package/assets/inject.js +0 -15
package/assets/build.js CHANGED
@@ -1,57 +1,2 @@
1
- import { cloudflare } from "@cloudflare/unenv-preset";
2
- import { build } from 'esbuild';
3
- import fs from 'node:fs';
4
- import { defineEnv } from 'unenv';
5
-
6
- if (!process.env.PLUGINS_CDN) {
7
- console.error('PLUGINS_CDN is required');
8
- process.exit(1);
9
- }
10
-
11
- // Load the manifest.json file and read organization, name and version of the plugin
12
- const manifest = JSON.parse(fs.readFileSync('./manifest.json', 'utf8'));
13
- if (!manifest.organization || !manifest.name || !manifest.version) {
14
- throw new Error('Manifest file is missing organization, name or version');
15
- }
16
- const CDN_PATH = `${process.env.PLUGINS_CDN}/${manifest.organization}/${manifest.name}/${manifest.version}`;
17
-
18
- const { env } = defineEnv({ nodeCompat: true, presets: [cloudflare] });
19
-
20
- const entryPoints = ['./src/executors']
21
- if (fs.existsSync('./src/configurators.ts')) {
22
- entryPoints.push('./src/configurators')
23
- }
24
-
25
- // Set up the defines, this will automatically load ssg index.html files if they exists
26
- const define = {
27
- PLUGINS_CDN: JSON.stringify(CDN_PATH)
28
- };
29
- if (fs.existsSync('./dist/configurator-index-html.json')) {
30
- const CONFIGURATOR_INDEX_HTML = fs.readFileSync('./dist/configurator-index-html.json', 'utf8');
31
- define.CONFIGURATOR_INDEX_HTML = CONFIGURATOR_INDEX_HTML;
32
- }
33
- if (fs.existsSync('./dist/executor-index-html.json')) {
34
- const EXECUTOR_INDEX_HTML = fs.readFileSync('./dist/executor-index-html.json', 'utf8');
35
- define.EXECUTOR_INDEX_HTML = EXECUTOR_INDEX_HTML;
36
- }
37
-
38
- await build({
39
- entryPoints,
40
- outdir: 'dist',
41
- bundle: true,
42
- minify: true,
43
- treeShaking: true,
44
- sourcemap: false,
45
- splitting: false,
46
- format: 'esm',
47
- platform: 'node',
48
- target: 'esnext',
49
- tsconfig: 'tsconfig.json',
50
- inject: ['./inject.js'],
51
- mainFields: ["module", "main"],
52
- conditions: ["workerd"],
53
- external: env.external,
54
- alias: env.alias,
55
- publicPath: CDN_PATH,
56
- define,
57
- });
1
+ import { build } from '@mochabug/adapt-plugin-builder';
2
+ build({ cdnBase: process.env.PLUGINS_CDN });
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>The configurator</title>
8
+ </head>
9
+
10
+ <body>
11
+ <div id="root"><%= define.content %></div>
12
+ </body>
13
+
14
+ </html>
@@ -12,20 +12,6 @@ import React from 'react';
12
12
  import { renderToString } from 'react-dom/server';
13
13
  import App from './configurator.App';
14
14
 
15
- export default function (js: string, css?: string) {
16
- return `
17
- <!DOCTYPE html>
18
- <html lang="en">
19
- <head>
20
- <meta charset="utf-8" />
21
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
22
- <title>Title</title>
23
- ${css ? `<link rel="stylesheet" href="${css}" />` : ''}
24
- </head>
25
- <body>
26
- <div id="root">${renderToString(<App />)}</div>
27
- <script type="module" src="${js}"></script>
28
- </body>
29
- </html>
30
- `;
15
+ export default function () {
16
+ return renderToString(<App />);
31
17
  }
@@ -29,9 +29,12 @@ export default {
29
29
  }
30
30
  });
31
31
  })
32
- .add('GET', '{*any}', async () => {
33
- return new Response(CONFIGURATOR_INDEX_HTML['___VERTEX_NAME___'], {
34
- headers: { 'Content-Type': 'text/html' }
32
+ .add('GET', '{/*any}', async (_, api) => {
33
+ const res = await api.readFile(
34
+ 'browser/___VERTEX_NAME___/configurator.html'
35
+ );
36
+ return new Response(res.content, {
37
+ headers: { 'Content-Type': 'text/html; charset=utf-8' }
35
38
  });
36
39
  }),
37
40
  internal: new InternalConfiguratorRouter()
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>The executor</title>
8
+ </head>
9
+
10
+ <body>
11
+ <div id="root"><%= define.content %></div>
12
+ </body>
13
+
14
+ </html>
@@ -12,20 +12,6 @@ import React from 'react';
12
12
  import { renderToString } from 'react-dom/server';
13
13
  import App from './executor.App';
14
14
 
15
- export default function (js: string, css?: string) {
16
- return `
17
- <!DOCTYPE html>
18
- <html lang="en">
19
- <head>
20
- <meta charset="utf-8" />
21
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
22
- <title>Title</title>
23
- ${css ? `<link rel="stylesheet" href="${css}" />` : ''}
24
- </head>
25
- <body>
26
- <div id="root">${renderToString(<App />)}</div>
27
- <script type="module" src="${js}"></script>
28
- </body>
29
- </html>
30
- `;
15
+ export default function () {
16
+ return renderToString(<App />);
31
17
  }
@@ -26,9 +26,12 @@ export default {
26
26
  ctx.waitUntil(sapi.complete('output', {}));
27
27
  return new Response();
28
28
  })
29
- .add('GET', '{*any}', async () => {
30
- return new Response(EXECUTOR_INDEX_HTML['___VERTEX_NAME___'], {
31
- headers: { 'Content-Type': 'text/html' }
29
+ .add('GET', '{/*any}', async (_, api) => {
30
+ const res = await api.readFile(
31
+ 'browser/___VERTEX_NAME___/executor.html'
32
+ );
33
+ return new Response(res.content, {
34
+ headers: { 'Content-Type': 'text/html; charset=utf-8' }
32
35
  });
33
36
  }),
34
37
  internal: new InternalExecutorRouter()
package/assets/gitignore CHANGED
@@ -1,5 +1,7 @@
1
1
  # Cdn files
2
- cdn/**
2
+ cdn/browser
3
+ assets/browser
4
+ dist/
3
5
 
4
6
  # Logs
5
7
  logs
@@ -33,10 +33,8 @@
33
33
  },
34
34
  "exclude": [
35
35
  "dist/**",
36
- "cdn/**",
37
- "assets/**",
38
- "build.js",
39
- "inject.js",
40
- "build-client.js"
36
+ "cdn/browser/**",
37
+ "assets/browser/**",
38
+ "build.js"
41
39
  ],
42
40
  }
package/bin/add.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { Manifest } from './genproto/mochabugapis/adapt/plugins/v1/manifest_pb';
2
+ export declare function add(manifest: Manifest): Promise<void>;
3
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,sDAAsD,CAAC;AAGhF,wBAAsB,GAAG,CAAC,QAAQ,EAAE,QAAQ,iBA+G3C"}