@mochabug/adaptkit 1.0.0-rc.4 → 1.0.0-rc.40
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/README.md +50 -45
- package/assets/build.js +2 -57
- package/assets/configurator.html +14 -0
- package/assets/configurator.ssg.tsx +2 -16
- package/assets/configurator_none.ts +8 -8
- package/assets/configurator_react.tsx +14 -11
- package/assets/executor.html +14 -0
- package/assets/executor.ssg.tsx +2 -16
- package/assets/executor_action.ts +4 -8
- package/assets/{executor_cron_trigger.ts → executor_action_cron.ts} +4 -8
- package/assets/executor_browser_none.ts +9 -13
- package/assets/executor_browser_none_cron.ts +119 -0
- package/assets/executor_browser_react.tsx +15 -16
- package/assets/executor_browser_react_cron.tsx +55 -0
- package/assets/{executor_external_trigger.ts → executor_external.ts} +8 -12
- package/assets/executor_external_cron.ts +45 -0
- package/assets/gitignore +3 -1
- package/assets/tsconf.json +4 -7
- package/bin/add.d.ts +3 -0
- package/bin/add.d.ts.map +1 -0
- package/bin/genproto/buf/validate/validate_pb.d.ts +8491 -0
- package/bin/genproto/buf/validate/validate_pb.d.ts.map +1 -0
- package/bin/genproto/google/api/annotations_pb.d.ts +14 -0
- package/bin/genproto/google/api/annotations_pb.d.ts.map +1 -0
- package/bin/genproto/google/api/client_pb.d.ts +1432 -0
- package/bin/genproto/google/api/client_pb.d.ts.map +1 -0
- package/bin/genproto/google/api/http_pb.d.ts +843 -0
- package/bin/genproto/google/api/http_pb.d.ts.map +1 -0
- package/bin/genproto/google/api/launch_stage_pb.d.ts +94 -0
- package/bin/genproto/google/api/launch_stage_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts +77 -0
- package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts +401 -0
- package/bin/genproto/mochabugapis/adapt/graph/jtd_schema_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts +69 -0
- package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +430 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_data_pb.d.ts +198 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_data_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +161 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_format_pb.d.ts +305 -0
- package/bin/genproto/mochabugapis/adapt/graph/signal_format_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts +77 -0
- package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts +120 -0
- package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts +99 -0
- package/bin/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts +347 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/compound_services_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts +64 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/file_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts +1282 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/http_proxy_service_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts +388 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts +805 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts +238 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/plugins_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts +241 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts +539 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_settings_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts +190 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/variable_service_pb.d.ts.map +1 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts +269 -0
- package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts.map +1 -0
- package/bin/index.d.ts +12 -0
- package/bin/index.d.ts.map +1 -0
- package/bin/index.js +846 -711
- package/bin/index.js.map +4 -4
- package/bin/init.d.ts +2 -0
- package/bin/init.d.ts.map +1 -0
- package/bin/oauth2.d.ts +2 -0
- package/bin/oauth2.d.ts.map +1 -0
- package/bin/publish.d.ts +27 -0
- package/bin/publish.d.ts.map +1 -0
- package/bin/utils.d.ts +13 -0
- package/bin/utils.d.ts.map +1 -0
- package/bin/vertices.d.ts +3 -0
- package/bin/vertices.d.ts.map +1 -0
- package/package.json +21 -26
- package/assets/build-client.js +0 -111
- package/assets/global.d.ts +0 -7
- package/assets/inject.js +0 -15
- package/assets/license.md +0 -15
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectError,
|
|
3
|
+
mapConnectErrorToHttpStatus,
|
|
4
|
+
} from "@mochabug/adapt-sdk/api";
|
|
5
|
+
import {
|
|
6
|
+
ExternalExecutorRouter,
|
|
7
|
+
CronExecutorRouter
|
|
8
|
+
} from '@mochabug/adapt-sdk/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('POST', '/api/done', async (req, api, _route, ctx) => {
|
|
25
|
+
const sapi = api.getSessionApi(req.headers.get('Authorization')!);
|
|
26
|
+
ctx.waitUntil(sapi.send('output', {}));
|
|
27
|
+
return new Response();
|
|
28
|
+
})
|
|
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' }
|
|
35
|
+
});
|
|
36
|
+
}),
|
|
37
|
+
internal: new CronExecutorRouter()
|
|
38
|
+
.onStart(async (start, _api) => {
|
|
39
|
+
console.log('Start has been called');
|
|
40
|
+
console.log(start);
|
|
41
|
+
})
|
|
42
|
+
.onStop(async (stop, _api) => {
|
|
43
|
+
console.log('Stop has been called');
|
|
44
|
+
console.log(stop);
|
|
45
|
+
})
|
|
46
|
+
.onExchange(async (res, _api, name) => {
|
|
47
|
+
console.log(`Exchange ${name} has been called`);
|
|
48
|
+
console.log(res);
|
|
49
|
+
})
|
|
50
|
+
.onCron(async (cron, api, ctx) => {
|
|
51
|
+
console.log('Received cron event');
|
|
52
|
+
ctx.waitUntil(api.send('output', {}));
|
|
53
|
+
console.log(cron);
|
|
54
|
+
})
|
|
55
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from
|
|
2
|
+
ConnectError,
|
|
3
|
+
mapConnectErrorToHttpStatus,
|
|
4
|
+
} from "@mochabug/adapt-sdk/api";
|
|
5
5
|
import {
|
|
6
6
|
ExternalExecutorRouter,
|
|
7
7
|
InternalExecutorRouter
|
|
8
|
-
} from '@mochabug/adapt-
|
|
8
|
+
} from '@mochabug/adapt-sdk/router';
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
external: new ExternalExecutorRouter()
|
|
@@ -13,8 +13,8 @@ export default {
|
|
|
13
13
|
.useBearerAuthorization(['/api'])
|
|
14
14
|
.useErrorHandling(async (e) => {
|
|
15
15
|
console.error(e);
|
|
16
|
-
if (e instanceof
|
|
17
|
-
return new Response(null, { status:
|
|
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
|
-
.
|
|
37
|
-
console.log(`
|
|
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-sdk/api";
|
|
5
|
+
import {
|
|
6
|
+
ExternalExecutorRouter,
|
|
7
|
+
InternalExecutorRouter
|
|
8
|
+
} from '@mochabug/adapt-sdk/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
package/assets/tsconf.json
CHANGED
|
@@ -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
package/bin/add.d.ts.map
ADDED
|
@@ -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"}
|