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

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 (85) hide show
  1. package/README.md +50 -45
  2. package/assets/build.js +2 -57
  3. package/assets/configurator.html +14 -0
  4. package/assets/configurator.ssg.tsx +2 -16
  5. package/assets/configurator_none.ts +6 -6
  6. package/assets/configurator_react.tsx +12 -9
  7. package/assets/executor.html +14 -0
  8. package/assets/executor.ssg.tsx +2 -16
  9. package/assets/executor_action.ts +3 -7
  10. package/assets/{executor_cron_trigger.ts → executor_action_cron.ts} +3 -7
  11. package/assets/executor_browser_none.ts +8 -12
  12. package/assets/executor_browser_none_cron.ts +119 -0
  13. package/assets/executor_browser_react.tsx +14 -15
  14. package/assets/executor_browser_react_cron.tsx +55 -0
  15. package/assets/{executor_external_trigger.ts → executor_external.ts} +7 -11
  16. package/assets/executor_external_cron.ts +45 -0
  17. package/assets/gitignore +3 -1
  18. package/assets/tsconf.json +4 -7
  19. package/bin/add.d.ts +3 -0
  20. package/bin/add.d.ts.map +1 -0
  21. package/bin/genproto/buf/validate/validate_pb.d.ts +8491 -0
  22. package/bin/genproto/buf/validate/validate_pb.d.ts.map +1 -0
  23. package/bin/genproto/google/api/annotations_pb.d.ts +14 -0
  24. package/bin/genproto/google/api/annotations_pb.d.ts.map +1 -0
  25. package/bin/genproto/google/api/client_pb.d.ts +1432 -0
  26. package/bin/genproto/google/api/client_pb.d.ts.map +1 -0
  27. package/bin/genproto/google/api/http_pb.d.ts +843 -0
  28. package/bin/genproto/google/api/http_pb.d.ts.map +1 -0
  29. package/bin/genproto/google/api/launch_stage_pb.d.ts +94 -0
  30. package/bin/genproto/google/api/launch_stage_pb.d.ts.map +1 -0
  31. package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts +77 -0
  32. package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts.map +1 -0
  33. package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts +227 -0
  34. package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts.map +1 -0
  35. package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts +69 -0
  36. package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts.map +1 -0
  37. package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +134 -0
  38. package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts.map +1 -0
  39. package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +91 -0
  40. package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts.map +1 -0
  41. package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts +77 -0
  42. package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts.map +1 -0
  43. package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts +120 -0
  44. package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts.map +1 -0
  45. package/bin/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts +99 -0
  46. package/bin/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts.map +1 -0
  47. package/bin/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts +347 -0
  48. package/bin/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts.map +1 -0
  49. package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts +64 -0
  50. package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts.map +1 -0
  51. package/bin/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts +1282 -0
  52. package/bin/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts.map +1 -0
  53. package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts +388 -0
  54. package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts.map +1 -0
  55. package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts +805 -0
  56. package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts.map +1 -0
  57. package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts +238 -0
  58. package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts.map +1 -0
  59. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts +241 -0
  60. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts.map +1 -0
  61. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts +539 -0
  62. package/bin/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts.map +1 -0
  63. package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts +190 -0
  64. package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts.map +1 -0
  65. package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts +269 -0
  66. package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts.map +1 -0
  67. package/bin/index.d.ts +12 -0
  68. package/bin/index.d.ts.map +1 -0
  69. package/bin/index.js +816 -848
  70. package/bin/index.js.map +4 -4
  71. package/bin/init.d.ts +2 -0
  72. package/bin/init.d.ts.map +1 -0
  73. package/bin/oauth2.d.ts +2 -0
  74. package/bin/oauth2.d.ts.map +1 -0
  75. package/bin/publish.d.ts +27 -0
  76. package/bin/publish.d.ts.map +1 -0
  77. package/bin/utils.d.ts +13 -0
  78. package/bin/utils.d.ts.map +1 -0
  79. package/bin/vertices.d.ts +3 -0
  80. package/bin/vertices.d.ts.map +1 -0
  81. package/package.json +20 -30
  82. package/assets/build-client.js +0 -111
  83. package/assets/global.d.ts +0 -7
  84. package/assets/inject.js +0 -15
  85. package/assets/license.md +0 -15
@@ -1,7 +1,7 @@
1
1
  import {
2
- mapErrorToHttpError,
3
- RpcError
4
- } from '@mochabug/adapt-plugin-toolkit/api';
2
+ ConnectError,
3
+ mapConnectErrorToHttpStatus,
4
+ } from "@mochabug/adapt-plugin-toolkit/api";
5
5
  import {
6
6
  ExternalExecutorRouter,
7
7
  InternalExecutorRouter
@@ -13,8 +13,8 @@ export default {
13
13
  .useBearerAuthorization(['/api'])
14
14
  .useErrorHandling(async (e) => {
15
15
  console.error(e);
16
- if (e instanceof RpcError) {
17
- return new Response(null, { status: mapErrorToHttpError(e.code) });
16
+ if (e instanceof ConnectError) {
17
+ return new Response(null, { status: mapConnectErrorToHttpStatus(e) });
18
18
  }
19
19
  return new Response(null, {
20
20
  status: 500,
@@ -33,12 +33,8 @@ export default {
33
33
  console.log('Stop has been called');
34
34
  console.log(stop);
35
35
  })
36
- .onStream(async (res, _api, name) => {
37
- console.log(`Stream ${name} has been called`);
38
- console.log(res);
39
- })
40
- .onProcedure(async (res, _api, name) => {
41
- console.log(`Procedure ${name} has been called`);
36
+ .onExchange(async (res, _api, name) => {
37
+ console.log(`Exchange ${name} has been called`);
42
38
  console.log(res);
43
39
  })
44
40
  };
@@ -0,0 +1,45 @@
1
+ import {
2
+ ConnectError,
3
+ mapConnectErrorToHttpStatus,
4
+ } from "@mochabug/adapt-plugin-toolkit/api";
5
+ import {
6
+ ExternalExecutorRouter,
7
+ InternalExecutorRouter
8
+ } from '@mochabug/adapt-plugin-toolkit/router';
9
+
10
+ export default {
11
+ external: new ExternalExecutorRouter()
12
+ .useRequestLogging()
13
+ .useBearerAuthorization(['/api'])
14
+ .useErrorHandling(async (e) => {
15
+ console.error(e);
16
+ if (e instanceof ConnectError) {
17
+ return new Response(null, { status: mapConnectErrorToHttpStatus(e) });
18
+ }
19
+ return new Response(null, {
20
+ status: 500,
21
+ statusText: 'Internal server error'
22
+ });
23
+ })
24
+ .add('*', '(.*)', async (_req, _api, _route, _ctx) => {
25
+ return new Response();
26
+ }),
27
+ internal: new InternalExecutorRouter()
28
+ .onStart(async (start, _api) => {
29
+ console.log('Start has been called');
30
+ console.log(start);
31
+ })
32
+ .onStop(async (stop, _api) => {
33
+ console.log('Stop has been called');
34
+ console.log(stop);
35
+ })
36
+ .onExchange(async (res, _api, name) => {
37
+ console.log(`Exchange ${name} has been called`);
38
+ console.log(res);
39
+ })
40
+ .onCron(async (cron, api, ctx) => {
41
+ console.log('Received cron event');
42
+ ctx.waitUntil(api.send('output', {}));
43
+ console.log(cron);
44
+ })
45
+ };
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
@@ -10,8 +10,7 @@
10
10
  ],
11
11
  "moduleResolution": "Bundler",
12
12
  "types": [
13
- "node",
14
- "@mochabug/adapt-plugin-typings"
13
+ "node"
15
14
  ],
16
15
  "resolveJsonModule": true,
17
16
  "allowJs": true,
@@ -33,10 +32,8 @@
33
32
  },
34
33
  "exclude": [
35
34
  "dist/**",
36
- "cdn/**",
37
- "assets/**",
38
- "build.js",
39
- "inject.js",
40
- "build-client.js"
35
+ "cdn/browser/**",
36
+ "assets/browser/**",
37
+ "build.js"
41
38
  ],
42
39
  }
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;AAIhF,wBAAsB,GAAG,CAAC,QAAQ,EAAE,QAAQ,iBA2E3C"}