@dxos/cli 0.5.3-main.c3feabc → 0.5.3-main.cb47aab
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/dist/src/commands/function/dev.d.ts.map +1 -1
- package/dist/src/commands/function/dev.js +18 -10
- package/dist/src/commands/function/dev.js.map +1 -1
- package/dist/src/commands/function/list.d.ts.map +1 -1
- package/dist/src/commands/function/list.js +8 -6
- package/dist/src/commands/function/list.js.map +1 -1
- package/oclif.manifest.json +2 -125
- package/package.json +26 -23
- package/dist/src/commands/function/exec.d.ts +0 -13
- package/dist/src/commands/function/exec.d.ts.map +0 -1
- package/dist/src/commands/function/exec.js +0 -48
- package/dist/src/commands/function/exec.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAmC;IAC9D,OAAgB,OAAO,WAA2B;IAClD,OAAgB,QAAQ;;;QAKtB;IAEF,OAAgB,KAAK;;;;;;;;;;;;;;;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CA8D1B"}
|
|
@@ -11,6 +11,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
11
11
|
const js_yaml_1 = require("js-yaml");
|
|
12
12
|
const promises_1 = require("node:fs/promises");
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
|
+
const async_1 = require("@dxos/async");
|
|
14
15
|
const client_protocol_1 = require("@dxos/client-protocol");
|
|
15
16
|
const config_1 = require("@dxos/config");
|
|
16
17
|
const functions_1 = require("@dxos/functions");
|
|
@@ -27,37 +28,44 @@ class Dev extends base_command_1.BaseCommand {
|
|
|
27
28
|
// TODO(dmaretskyi): Move into system service?
|
|
28
29
|
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
29
30
|
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
31
|
+
// Local files.
|
|
30
32
|
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
31
33
|
const manifest = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
32
34
|
const directory = (_g = this.flags.baseDir) !== null && _g !== void 0 ? _g : (0, node_path_1.join)((0, node_path_1.dirname)(file), 'src/functions');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// Local dev server.
|
|
36
|
+
const registry = new functions_1.FunctionRegistry(client);
|
|
37
|
+
const server = new functions_1.DevServer(client, registry, {
|
|
35
38
|
baseDir: directory,
|
|
36
39
|
reload: this.flags.reload,
|
|
37
40
|
dataDir: (0, client_protocol_1.getProfilePath)(client_protocol_1.DX_DATA, this.flags.profile),
|
|
38
41
|
});
|
|
39
|
-
await server.initialize();
|
|
40
42
|
await server.start();
|
|
41
|
-
// TODO(burdon): Move to
|
|
42
|
-
const
|
|
43
|
+
// TODO(burdon): Move to agent's FunctionsPlugin.
|
|
44
|
+
const triggerRegistry = new functions_1.TriggerRegistry(client);
|
|
45
|
+
const scheduler = new functions_1.Scheduler(registry, triggerRegistry, { endpoint: server.proxy });
|
|
43
46
|
await scheduler.start();
|
|
47
|
+
// TODO(burdon): Register for all spaces; add import command.
|
|
48
|
+
client.addSchema(functions_1.FunctionTrigger);
|
|
49
|
+
const space = client.spaces.default;
|
|
50
|
+
await registry.register(space, manifest);
|
|
51
|
+
await scheduler.register(space, manifest);
|
|
44
52
|
this.log(`DevServer running: ${chalk_1.default.blue(server.endpoint)} (ctrl-c to exit)`);
|
|
53
|
+
const run = new async_1.Trigger();
|
|
45
54
|
process.on('SIGINT', async () => {
|
|
46
55
|
await scheduler.stop();
|
|
47
56
|
await server.stop();
|
|
48
|
-
|
|
57
|
+
run.wake();
|
|
49
58
|
});
|
|
50
|
-
// TODO(burdon): Command to print table.
|
|
51
|
-
// TODO(burdon): Get from server API.
|
|
52
59
|
if (this.flags.verbose) {
|
|
60
|
+
// TODO(burdon): Get list of functions from plugin API endpoint.
|
|
53
61
|
this.log(`Plugin proxy: ${chalk_1.default.blue(server.proxy)}`);
|
|
54
62
|
this.log('Functions:\n' +
|
|
55
63
|
server.functions
|
|
56
|
-
.map(({ def: {
|
|
64
|
+
.map(({ def: { uri, route } }) => (0, chalk_1.default) `- ${uri.padEnd(40)} {blue ${(0, node_path_1.join)(server.proxy, route)}}`)
|
|
57
65
|
.join('\n'));
|
|
58
66
|
}
|
|
59
67
|
// Wait until exit (via SIGINT).
|
|
60
|
-
await
|
|
68
|
+
await run.wait();
|
|
61
69
|
});
|
|
62
70
|
}
|
|
63
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;AAEF,sCAAoC;AACpC,kDAA0B;AAC1B,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAA0C;AAE1C,2DAAgE;AAChE,yCAAsC;AACtC,+
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":";AAA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,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAC/E,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;CACtE,CAAC;kBAjBiB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,eAAO,MAAM,cAAc,cAAe,WAAW,EAAE,qBAsBtD,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAqB;IAE1C,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAgB1B"}
|
|
@@ -11,11 +11,12 @@ const node_path_1 = require("node:path");
|
|
|
11
11
|
const config_1 = require("@dxos/config");
|
|
12
12
|
const base_command_1 = require("../../base-command");
|
|
13
13
|
// TODO(burdon): List stats.
|
|
14
|
-
// TODO(burdon): List triggers.
|
|
15
14
|
const printFunctions = (functions, flags = {}) => {
|
|
16
|
-
core_1.ux.table(
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
core_1.ux.table(
|
|
16
|
+
// TODO(burdon): Cast util.
|
|
17
|
+
functions, {
|
|
18
|
+
uri: {
|
|
19
|
+
header: 'uri',
|
|
19
20
|
},
|
|
20
21
|
path: {
|
|
21
22
|
header: 'path',
|
|
@@ -38,10 +39,11 @@ class List extends base_command_1.BaseCommand {
|
|
|
38
39
|
// TODO(dmaretskyi): Move into system service?
|
|
39
40
|
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
40
41
|
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
42
|
+
// TODO(burdon): ???
|
|
41
43
|
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
42
44
|
const manifest = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
43
|
-
const { functions } = manifest;
|
|
44
|
-
|
|
45
|
+
// const { functions } = manifest;
|
|
46
|
+
// printFunctions(functions);
|
|
45
47
|
return manifest;
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;AACjC,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAAiC;AAEjC,yCAAsC;AAGtC,qDAAiD;AAEjD,4BAA4B;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;AACjC,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAAiC;AAEjC,yCAAsC;AAGtC,qDAAiD;AAEjD,4BAA4B;AACrB,MAAM,cAAc,GAAG,CAAC,SAAwB,EAAE,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,6BAA6B;YAC7B,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;;AAlBe,mBAAc,GAAG,IAAI,CAAC;AACtB,gBAAW,GAAG,iBAAiB,CAAC;kBAF7B,IAAI"}
|
package/oclif.manifest.json
CHANGED
|
@@ -2794,129 +2794,6 @@
|
|
|
2794
2794
|
"dev.js"
|
|
2795
2795
|
]
|
|
2796
2796
|
},
|
|
2797
|
-
"function:exec": {
|
|
2798
|
-
"aliases": [],
|
|
2799
|
-
"args": {
|
|
2800
|
-
"name": {
|
|
2801
|
-
"description": "Function name.",
|
|
2802
|
-
"name": "name",
|
|
2803
|
-
"required": true
|
|
2804
|
-
}
|
|
2805
|
-
},
|
|
2806
|
-
"description": "Invoke function.",
|
|
2807
|
-
"flags": {
|
|
2808
|
-
"json": {
|
|
2809
|
-
"description": "Output as JSON.",
|
|
2810
|
-
"name": "json",
|
|
2811
|
-
"allowNo": false,
|
|
2812
|
-
"type": "boolean"
|
|
2813
|
-
},
|
|
2814
|
-
"dry-run": {
|
|
2815
|
-
"description": "Dry run.",
|
|
2816
|
-
"name": "dry-run",
|
|
2817
|
-
"allowNo": false,
|
|
2818
|
-
"type": "boolean"
|
|
2819
|
-
},
|
|
2820
|
-
"verbose": {
|
|
2821
|
-
"char": "v",
|
|
2822
|
-
"description": "Verbose output",
|
|
2823
|
-
"name": "verbose",
|
|
2824
|
-
"allowNo": false,
|
|
2825
|
-
"type": "boolean"
|
|
2826
|
-
},
|
|
2827
|
-
"profile": {
|
|
2828
|
-
"description": "User profile.",
|
|
2829
|
-
"env": "DX_PROFILE",
|
|
2830
|
-
"name": "profile",
|
|
2831
|
-
"default": "default",
|
|
2832
|
-
"hasDynamicHelp": false,
|
|
2833
|
-
"multiple": false,
|
|
2834
|
-
"type": "option"
|
|
2835
|
-
},
|
|
2836
|
-
"config": {
|
|
2837
|
-
"aliases": [
|
|
2838
|
-
"c"
|
|
2839
|
-
],
|
|
2840
|
-
"dependsOn": [
|
|
2841
|
-
"profile"
|
|
2842
|
-
],
|
|
2843
|
-
"description": "Config file.",
|
|
2844
|
-
"env": "DX_CONFIG",
|
|
2845
|
-
"name": "config",
|
|
2846
|
-
"default": "/home/runner/.config/dx/profile/default.yml",
|
|
2847
|
-
"hasDynamicHelp": false,
|
|
2848
|
-
"helpValue": "path",
|
|
2849
|
-
"multiple": false,
|
|
2850
|
-
"type": "option"
|
|
2851
|
-
},
|
|
2852
|
-
"target": {
|
|
2853
|
-
"description": "Target websocket server.",
|
|
2854
|
-
"name": "target",
|
|
2855
|
-
"hasDynamicHelp": false,
|
|
2856
|
-
"multiple": false,
|
|
2857
|
-
"type": "option"
|
|
2858
|
-
},
|
|
2859
|
-
"no-agent": {
|
|
2860
|
-
"description": "Run command without using an agent.",
|
|
2861
|
-
"name": "no-agent",
|
|
2862
|
-
"allowNo": false,
|
|
2863
|
-
"type": "boolean"
|
|
2864
|
-
},
|
|
2865
|
-
"no-start-agent": {
|
|
2866
|
-
"description": "Do not automatically start an agent if one is not running.",
|
|
2867
|
-
"name": "no-start-agent",
|
|
2868
|
-
"allowNo": false,
|
|
2869
|
-
"type": "boolean"
|
|
2870
|
-
},
|
|
2871
|
-
"timeout": {
|
|
2872
|
-
"aliases": [
|
|
2873
|
-
"t"
|
|
2874
|
-
],
|
|
2875
|
-
"description": "Timeout (ms).",
|
|
2876
|
-
"name": "timeout",
|
|
2877
|
-
"default": 60000,
|
|
2878
|
-
"hasDynamicHelp": false,
|
|
2879
|
-
"multiple": false,
|
|
2880
|
-
"type": "option"
|
|
2881
|
-
},
|
|
2882
|
-
"no-wait": {
|
|
2883
|
-
"description": "Do not wait for space to be ready.",
|
|
2884
|
-
"name": "no-wait",
|
|
2885
|
-
"allowNo": false,
|
|
2886
|
-
"type": "boolean"
|
|
2887
|
-
},
|
|
2888
|
-
"json-log": {
|
|
2889
|
-
"description": "When running in foreground, log JSON format",
|
|
2890
|
-
"name": "json-log",
|
|
2891
|
-
"allowNo": false,
|
|
2892
|
-
"type": "boolean"
|
|
2893
|
-
},
|
|
2894
|
-
"json-logfile": {
|
|
2895
|
-
"description": "JSON log file destination, or 'stdout' or 'stderr'",
|
|
2896
|
-
"name": "json-logfile",
|
|
2897
|
-
"default": "stderr",
|
|
2898
|
-
"hasDynamicHelp": false,
|
|
2899
|
-
"multiple": false,
|
|
2900
|
-
"type": "option"
|
|
2901
|
-
}
|
|
2902
|
-
},
|
|
2903
|
-
"hasDynamicHelp": false,
|
|
2904
|
-
"hiddenAliases": [],
|
|
2905
|
-
"id": "function:exec",
|
|
2906
|
-
"pluginAlias": "@dxos/cli",
|
|
2907
|
-
"pluginName": "@dxos/cli",
|
|
2908
|
-
"pluginType": "core",
|
|
2909
|
-
"strict": true,
|
|
2910
|
-
"enableJsonFlag": true,
|
|
2911
|
-
"isESM": false,
|
|
2912
|
-
"relativePath": [
|
|
2913
|
-
"dist",
|
|
2914
|
-
"src",
|
|
2915
|
-
"commands",
|
|
2916
|
-
"function",
|
|
2917
|
-
"exec.js"
|
|
2918
|
-
]
|
|
2919
|
-
},
|
|
2920
2797
|
"function:list": {
|
|
2921
2798
|
"aliases": [],
|
|
2922
2799
|
"args": {},
|
|
@@ -5718,7 +5595,7 @@
|
|
|
5718
5595
|
"name": {
|
|
5719
5596
|
"description": "Tunnel name",
|
|
5720
5597
|
"name": "name",
|
|
5721
|
-
"default": "
|
|
5598
|
+
"default": "undress-solar-alabama-spring",
|
|
5722
5599
|
"hasDynamicHelp": false,
|
|
5723
5600
|
"multiple": false,
|
|
5724
5601
|
"type": "option"
|
|
@@ -6190,5 +6067,5 @@
|
|
|
6190
6067
|
]
|
|
6191
6068
|
}
|
|
6192
6069
|
},
|
|
6193
|
-
"version": "0.5.3-main.
|
|
6070
|
+
"version": "0.5.3-main.cb47aab"
|
|
6194
6071
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/cli",
|
|
3
|
-
"version": "0.5.3-main.
|
|
3
|
+
"version": "0.5.3-main.cb47aab",
|
|
4
4
|
"description": "DXOS CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dxos",
|
|
@@ -49,28 +49,28 @@
|
|
|
49
49
|
"uuid": "^8.3.2",
|
|
50
50
|
"ws": "^8.14.2",
|
|
51
51
|
"wtfnode": "^0.9.1",
|
|
52
|
-
"@dxos/agent": "0.5.3-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/client-protocol": "0.5.3-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/client-services": "0.5.3-main.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/config": "0.5.3-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
52
|
+
"@dxos/agent": "0.5.3-main.cb47aab",
|
|
53
|
+
"@dxos/async": "0.5.3-main.cb47aab",
|
|
54
|
+
"@dxos/bare-template": "0.5.3-main.cb47aab",
|
|
55
|
+
"@dxos/client-protocol": "0.5.3-main.cb47aab",
|
|
56
|
+
"@dxos/client": "0.5.3-main.cb47aab",
|
|
57
|
+
"@dxos/client-services": "0.5.3-main.cb47aab",
|
|
58
|
+
"@dxos/context": "0.5.3-main.cb47aab",
|
|
59
|
+
"@dxos/config": "0.5.3-main.cb47aab",
|
|
60
|
+
"@dxos/functions": "0.5.3-main.cb47aab",
|
|
61
|
+
"@dxos/debug": "0.5.3-main.cb47aab",
|
|
62
|
+
"@dxos/invariant": "0.5.3-main.cb47aab",
|
|
63
|
+
"@dxos/hello-template": "0.5.3-main.cb47aab",
|
|
64
|
+
"@dxos/log": "0.5.3-main.cb47aab",
|
|
65
|
+
"@dxos/network-manager": "0.5.3-main.cb47aab",
|
|
66
|
+
"@dxos/plate": "0.5.3-main.cb47aab",
|
|
67
|
+
"@dxos/observability": "0.5.3-main.cb47aab",
|
|
68
|
+
"@dxos/process": "0.5.3-main.cb47aab",
|
|
69
|
+
"@dxos/protocols": "0.5.3-main.cb47aab",
|
|
70
|
+
"@dxos/rpc": "0.5.3-main.cb47aab",
|
|
71
|
+
"@dxos/random": "0.5.3-main.cb47aab",
|
|
72
|
+
"@dxos/util": "0.5.3-main.cb47aab",
|
|
73
|
+
"@dxos/tasks-template": "0.5.3-main.cb47aab"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@oclif/test": "^3.2.15",
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"plugins": [
|
|
110
110
|
"@oclif/plugin-help"
|
|
111
111
|
],
|
|
112
|
+
"devPlugins": [
|
|
113
|
+
"@oclif/plugin-help"
|
|
114
|
+
],
|
|
112
115
|
"helpClass": "./dist/src/help",
|
|
113
116
|
"topicSeparator": " ",
|
|
114
117
|
"topics": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../base-command';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated
|
|
4
|
-
*/
|
|
5
|
-
export default class Exec extends BaseCommand<typeof Exec> {
|
|
6
|
-
static enableJsonFlag: boolean;
|
|
7
|
-
static description: string;
|
|
8
|
-
static args: {
|
|
9
|
-
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<any>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/exec.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAsB;IAEjD,OAAgB,IAAI;;MAElB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CA8B1B"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const core_1 = require("@oclif/core");
|
|
7
|
-
const js_yaml_1 = require("js-yaml");
|
|
8
|
-
const promises_1 = require("node:fs/promises");
|
|
9
|
-
const node_path_1 = require("node:path");
|
|
10
|
-
const config_1 = require("@dxos/config");
|
|
11
|
-
const base_command_1 = require("../../base-command");
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
*/
|
|
15
|
-
class Exec extends base_command_1.BaseCommand {
|
|
16
|
-
async run() {
|
|
17
|
-
return await this.execWithClient(async (client) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19
|
-
// TODO(dmaretskyi): Move into system service?
|
|
20
|
-
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
21
|
-
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
22
|
-
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
23
|
-
const { functions } = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
24
|
-
const fn = functions.find((fn) => fn.id === this.args.name);
|
|
25
|
-
if (!fn) {
|
|
26
|
-
this.warn(`Function not found: ${this.args.name}`);
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const { handler } = fn;
|
|
30
|
-
// TODO(burdon): Get endpoint.
|
|
31
|
-
const url = `http:/localhost:7100/dev/${handler}`;
|
|
32
|
-
this.log(`Calling: ${url}`);
|
|
33
|
-
const { status, statusText } = await fetch(url, {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
});
|
|
36
|
-
if (status !== 200) {
|
|
37
|
-
this.warn(`Error(${status}): ${statusText}`);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
Exec.enableJsonFlag = true;
|
|
43
|
-
Exec.description = 'Invoke function.';
|
|
44
|
-
Exec.args = {
|
|
45
|
-
name: core_1.Args.string({ required: true, description: 'Function name.' }),
|
|
46
|
-
};
|
|
47
|
-
exports.default = Exec;
|
|
48
|
-
//# sourceMappingURL=exec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../../src/commands/function/exec.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;AAEF,sCAAmC;AACnC,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAAiC;AAEjC,yCAAsC;AAGtC,qDAAiD;AAEjD;;GAEG;AACH,MAAqB,IAAK,SAAQ,0BAAwB;IAQxD,KAAK,CAAC,GAAG;QACP,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;;YAChD,8CAA8C;YAC9C,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAa,CAAC,SA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