@dxos/cli 0.6.10 → 0.6.11-staging.32b42e4

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.
@@ -839,16 +839,10 @@
839
839
  "stop.js"
840
840
  ]
841
841
  },
842
- "app:create": {
842
+ "config": {
843
843
  "aliases": [],
844
- "args": {
845
- "name": {
846
- "description": "App name.",
847
- "name": "name",
848
- "required": true
849
- }
850
- },
851
- "description": "Create template applications.",
844
+ "args": {},
845
+ "description": "Show config file.",
852
846
  "flags": {
853
847
  "json": {
854
848
  "description": "Output as JSON.",
@@ -932,56 +926,35 @@
932
926
  "hasDynamicHelp": false,
933
927
  "multiple": false,
934
928
  "type": "option"
935
- },
936
- "tag": {
937
- "description": "Git tag or branch of the DXOS repo to checkout.",
938
- "name": "tag",
939
- "hasDynamicHelp": false,
940
- "multiple": false,
941
- "type": "option"
942
- },
943
- "template": {
944
- "char": "t",
945
- "description": "Template to use when creating the project.",
946
- "name": "template",
947
- "default": "hello",
948
- "hasDynamicHelp": false,
949
- "multiple": false,
950
- "options": [
951
- "hello",
952
- "bare",
953
- "tasks"
954
- ],
955
- "type": "option"
956
- },
957
- "interactive": {
958
- "char": "i",
959
- "description": "Customize app template options via interactive prompt.",
960
- "name": "interactive",
961
- "allowNo": false,
962
- "type": "boolean"
963
929
  }
964
930
  },
965
931
  "hasDynamicHelp": false,
966
932
  "hiddenAliases": [],
967
- "id": "app:create",
933
+ "id": "config",
968
934
  "pluginAlias": "@dxos/cli",
969
935
  "pluginName": "@dxos/cli",
970
936
  "pluginType": "core",
971
937
  "strict": true,
938
+ "enableJsonFlag": true,
972
939
  "isESM": false,
973
940
  "relativePath": [
974
941
  "dist",
975
942
  "src",
976
943
  "commands",
977
- "app",
978
- "create.js"
944
+ "config",
945
+ "index.js"
979
946
  ]
980
947
  },
981
- "app:list": {
948
+ "app:create": {
982
949
  "aliases": [],
983
- "args": {},
984
- "description": "List apps (deprecated).",
950
+ "args": {
951
+ "name": {
952
+ "description": "App name.",
953
+ "name": "name",
954
+ "required": true
955
+ }
956
+ },
957
+ "description": "Create template applications.",
985
958
  "flags": {
986
959
  "json": {
987
960
  "description": "Output as JSON.",
@@ -1066,41 +1039,55 @@
1066
1039
  "multiple": false,
1067
1040
  "type": "option"
1068
1041
  },
1069
- "extended": {
1070
- "description": "Show extended table columns.",
1071
- "name": "extended",
1042
+ "tag": {
1043
+ "description": "Git tag or branch of the DXOS repo to checkout.",
1044
+ "name": "tag",
1045
+ "hasDynamicHelp": false,
1046
+ "multiple": false,
1047
+ "type": "option"
1048
+ },
1049
+ "template": {
1050
+ "char": "t",
1051
+ "description": "Template to use when creating the project.",
1052
+ "name": "template",
1053
+ "default": "hello",
1054
+ "hasDynamicHelp": false,
1055
+ "multiple": false,
1056
+ "options": [
1057
+ "hello",
1058
+ "bare",
1059
+ "tasks"
1060
+ ],
1061
+ "type": "option"
1062
+ },
1063
+ "interactive": {
1064
+ "char": "i",
1065
+ "description": "Customize app template options via interactive prompt.",
1066
+ "name": "interactive",
1072
1067
  "allowNo": false,
1073
1068
  "type": "boolean"
1074
1069
  }
1075
1070
  },
1076
1071
  "hasDynamicHelp": false,
1077
1072
  "hiddenAliases": [],
1078
- "id": "app:list",
1073
+ "id": "app:create",
1079
1074
  "pluginAlias": "@dxos/cli",
1080
1075
  "pluginName": "@dxos/cli",
1081
1076
  "pluginType": "core",
1082
- "state": "deprecated",
1083
1077
  "strict": true,
1084
- "enableJsonFlag": true,
1085
1078
  "isESM": false,
1086
1079
  "relativePath": [
1087
1080
  "dist",
1088
1081
  "src",
1089
1082
  "commands",
1090
1083
  "app",
1091
- "list.js"
1084
+ "create.js"
1092
1085
  ]
1093
1086
  },
1094
- "app:open": {
1087
+ "app:list": {
1095
1088
  "aliases": [],
1096
- "args": {
1097
- "url": {
1098
- "description": "App URL.",
1099
- "name": "url",
1100
- "required": true
1101
- }
1102
- },
1103
- "description": "Opens app with provided url and process device invitation.",
1089
+ "args": {},
1090
+ "description": "List apps (deprecated).",
1104
1091
  "flags": {
1105
1092
  "json": {
1106
1093
  "description": "Output as JSON.",
@@ -1185,27 +1172,20 @@
1185
1172
  "multiple": false,
1186
1173
  "type": "option"
1187
1174
  },
1188
- "instances": {
1189
- "description": "Amount of test instances.",
1190
- "name": "instances",
1191
- "default": 1,
1192
- "hasDynamicHelp": false,
1193
- "multiple": false,
1194
- "type": "option"
1195
- },
1196
- "invite": {
1197
- "description": "If `true` proceed device invitation for all instances.",
1198
- "name": "invite",
1175
+ "extended": {
1176
+ "description": "Show extended table columns.",
1177
+ "name": "extended",
1199
1178
  "allowNo": false,
1200
1179
  "type": "boolean"
1201
1180
  }
1202
1181
  },
1203
1182
  "hasDynamicHelp": false,
1204
1183
  "hiddenAliases": [],
1205
- "id": "app:open",
1184
+ "id": "app:list",
1206
1185
  "pluginAlias": "@dxos/cli",
1207
1186
  "pluginName": "@dxos/cli",
1208
1187
  "pluginType": "core",
1188
+ "state": "deprecated",
1209
1189
  "strict": true,
1210
1190
  "enableJsonFlag": true,
1211
1191
  "isESM": false,
@@ -1214,13 +1194,19 @@
1214
1194
  "src",
1215
1195
  "commands",
1216
1196
  "app",
1217
- "open.js"
1197
+ "list.js"
1218
1198
  ]
1219
1199
  },
1220
- "app:publish": {
1200
+ "app:open": {
1221
1201
  "aliases": [],
1222
- "args": {},
1223
- "description": "Publish apps (deprecated).",
1202
+ "args": {
1203
+ "url": {
1204
+ "description": "App URL.",
1205
+ "name": "url",
1206
+ "required": true
1207
+ }
1208
+ },
1209
+ "description": "Opens app with provided url and process device invitation.",
1224
1210
  "flags": {
1225
1211
  "json": {
1226
1212
  "description": "Output as JSON.",
@@ -1305,55 +1291,42 @@
1305
1291
  "multiple": false,
1306
1292
  "type": "option"
1307
1293
  },
1308
- "configPath": {
1309
- "description": "Path to dx.yml",
1310
- "name": "configPath",
1311
- "hasDynamicHelp": false,
1312
- "multiple": false,
1313
- "type": "option"
1314
- },
1315
- "accessToken": {
1316
- "description": "Access token for publishing.",
1317
- "name": "accessToken",
1294
+ "instances": {
1295
+ "description": "Amount of test instances.",
1296
+ "name": "instances",
1297
+ "default": 1,
1318
1298
  "hasDynamicHelp": false,
1319
1299
  "multiple": false,
1320
1300
  "type": "option"
1321
1301
  },
1322
- "skipExisting": {
1323
- "description": "Do not update content on KUBE if version already exists.",
1324
- "name": "skipExisting",
1302
+ "invite": {
1303
+ "description": "If `true` proceed device invitation for all instances.",
1304
+ "name": "invite",
1325
1305
  "allowNo": false,
1326
1306
  "type": "boolean"
1327
- },
1328
- "version": {
1329
- "description": "Version of modules to publish.",
1330
- "name": "version",
1331
- "hasDynamicHelp": false,
1332
- "multiple": false,
1333
- "type": "option"
1334
1307
  }
1335
1308
  },
1336
1309
  "hasDynamicHelp": false,
1337
1310
  "hiddenAliases": [],
1338
- "id": "app:publish",
1311
+ "id": "app:open",
1339
1312
  "pluginAlias": "@dxos/cli",
1340
1313
  "pluginName": "@dxos/cli",
1341
1314
  "pluginType": "core",
1342
- "state": "deprecated",
1343
1315
  "strict": true,
1316
+ "enableJsonFlag": true,
1344
1317
  "isESM": false,
1345
1318
  "relativePath": [
1346
1319
  "dist",
1347
1320
  "src",
1348
1321
  "commands",
1349
1322
  "app",
1350
- "publish.js"
1323
+ "open.js"
1351
1324
  ]
1352
1325
  },
1353
- "config": {
1326
+ "app:publish": {
1354
1327
  "aliases": [],
1355
1328
  "args": {},
1356
- "description": "Show config file.",
1329
+ "description": "Publish apps (deprecated).",
1357
1330
  "flags": {
1358
1331
  "json": {
1359
1332
  "description": "Output as JSON.",
@@ -1437,23 +1410,50 @@
1437
1410
  "hasDynamicHelp": false,
1438
1411
  "multiple": false,
1439
1412
  "type": "option"
1413
+ },
1414
+ "configPath": {
1415
+ "description": "Path to dx.yml",
1416
+ "name": "configPath",
1417
+ "hasDynamicHelp": false,
1418
+ "multiple": false,
1419
+ "type": "option"
1420
+ },
1421
+ "accessToken": {
1422
+ "description": "Access token for publishing.",
1423
+ "name": "accessToken",
1424
+ "hasDynamicHelp": false,
1425
+ "multiple": false,
1426
+ "type": "option"
1427
+ },
1428
+ "skipExisting": {
1429
+ "description": "Do not update content on KUBE if version already exists.",
1430
+ "name": "skipExisting",
1431
+ "allowNo": false,
1432
+ "type": "boolean"
1433
+ },
1434
+ "version": {
1435
+ "description": "Version of modules to publish.",
1436
+ "name": "version",
1437
+ "hasDynamicHelp": false,
1438
+ "multiple": false,
1439
+ "type": "option"
1440
1440
  }
1441
1441
  },
1442
1442
  "hasDynamicHelp": false,
1443
1443
  "hiddenAliases": [],
1444
- "id": "config",
1444
+ "id": "app:publish",
1445
1445
  "pluginAlias": "@dxos/cli",
1446
1446
  "pluginName": "@dxos/cli",
1447
1447
  "pluginType": "core",
1448
+ "state": "deprecated",
1448
1449
  "strict": true,
1449
- "enableJsonFlag": true,
1450
1450
  "isESM": false,
1451
1451
  "relativePath": [
1452
1452
  "dist",
1453
1453
  "src",
1454
1454
  "commands",
1455
- "config",
1456
- "index.js"
1455
+ "app",
1456
+ "publish.js"
1457
1457
  ]
1458
1458
  },
1459
1459
  "debug:diagnostics": {
@@ -2395,159 +2395,6 @@
2395
2395
  "update.js"
2396
2396
  ]
2397
2397
  },
2398
- "function:dev": {
2399
- "aliases": [
2400
- "function:dev-server"
2401
- ],
2402
- "args": {},
2403
- "description": "Functions development server.",
2404
- "examples": [
2405
- {
2406
- "description": "Run with TypeScript support.",
2407
- "command": "dx function dev -r ts-node/register --verbose"
2408
- }
2409
- ],
2410
- "flags": {
2411
- "json": {
2412
- "description": "Output as JSON.",
2413
- "name": "json",
2414
- "allowNo": false,
2415
- "type": "boolean"
2416
- },
2417
- "verbose": {
2418
- "char": "v",
2419
- "description": "Verbose output",
2420
- "name": "verbose",
2421
- "allowNo": false,
2422
- "type": "boolean"
2423
- },
2424
- "dry-run": {
2425
- "description": "Dry run.",
2426
- "name": "dry-run",
2427
- "allowNo": false,
2428
- "type": "boolean"
2429
- },
2430
- "profile": {
2431
- "description": "User profile.",
2432
- "env": "DX_PROFILE",
2433
- "name": "profile",
2434
- "default": "default",
2435
- "hasDynamicHelp": false,
2436
- "multiple": false,
2437
- "type": "option"
2438
- },
2439
- "config": {
2440
- "aliases": [
2441
- "c"
2442
- ],
2443
- "dependsOn": [
2444
- "profile"
2445
- ],
2446
- "description": "Config file.",
2447
- "env": "DX_CONFIG",
2448
- "name": "config",
2449
- "default": "/home/runner/.config/dx/profile/default.yml",
2450
- "hasDynamicHelp": false,
2451
- "helpValue": "path",
2452
- "multiple": false,
2453
- "type": "option"
2454
- },
2455
- "timeout": {
2456
- "aliases": [
2457
- "t"
2458
- ],
2459
- "description": "Timeout (ms).",
2460
- "name": "timeout",
2461
- "default": 60000,
2462
- "hasDynamicHelp": false,
2463
- "multiple": false,
2464
- "type": "option"
2465
- },
2466
- "target": {
2467
- "description": "Target websocket server.",
2468
- "name": "target",
2469
- "hasDynamicHelp": false,
2470
- "multiple": false,
2471
- "type": "option"
2472
- },
2473
- "agent": {
2474
- "description": "Run command with agent.",
2475
- "env": "DX_NO_AGENT",
2476
- "name": "agent",
2477
- "allowNo": true,
2478
- "type": "boolean"
2479
- },
2480
- "json-log": {
2481
- "description": "When running in foreground, log JSON format",
2482
- "name": "json-log",
2483
- "allowNo": false,
2484
- "type": "boolean"
2485
- },
2486
- "json-logfile": {
2487
- "description": "JSON log file destination, or 'stdout' or 'stderr'",
2488
- "name": "json-logfile",
2489
- "default": "stderr",
2490
- "hasDynamicHelp": false,
2491
- "multiple": false,
2492
- "type": "option"
2493
- },
2494
- "key": {
2495
- "description": "Space key(s) head in hex.",
2496
- "name": "key",
2497
- "hasDynamicHelp": false,
2498
- "multiple": true,
2499
- "type": "option"
2500
- },
2501
- "require": {
2502
- "aliases": [
2503
- "r"
2504
- ],
2505
- "name": "require",
2506
- "default": [
2507
- "ts-node/register"
2508
- ],
2509
- "hasDynamicHelp": false,
2510
- "multiple": true,
2511
- "type": "option"
2512
- },
2513
- "manifest": {
2514
- "description": "Functions manifest file.",
2515
- "name": "manifest",
2516
- "hasDynamicHelp": false,
2517
- "multiple": false,
2518
- "type": "option"
2519
- },
2520
- "baseDir": {
2521
- "description": "Base directory for function handlers.",
2522
- "name": "baseDir",
2523
- "hasDynamicHelp": false,
2524
- "multiple": false,
2525
- "type": "option"
2526
- },
2527
- "reload": {
2528
- "description": "Reload functions on change.",
2529
- "name": "reload",
2530
- "allowNo": false,
2531
- "type": "boolean"
2532
- }
2533
- },
2534
- "hasDynamicHelp": false,
2535
- "hiddenAliases": [],
2536
- "id": "function:dev",
2537
- "pluginAlias": "@dxos/cli",
2538
- "pluginName": "@dxos/cli",
2539
- "pluginType": "core",
2540
- "strict": true,
2541
- "enableJsonFlag": true,
2542
- "isESM": false,
2543
- "relativePath": [
2544
- "dist",
2545
- "src",
2546
- "commands",
2547
- "function",
2548
- "dev.js"
2549
- ]
2550
- },
2551
2398
  "function:list": {
2552
2399
  "aliases": [],
2553
2400
  "args": {},
@@ -5233,7 +5080,7 @@
5233
5080
  "name": {
5234
5081
  "description": "Tunnel name",
5235
5082
  "name": "name",
5236
- "default": "fifteen-spaghetti-four-berlin",
5083
+ "default": "purple-lima-social-sixteen",
5237
5084
  "hasDynamicHelp": false,
5238
5085
  "multiple": false,
5239
5086
  "type": "option"
@@ -6005,5 +5852,5 @@
6005
5852
  ]
6006
5853
  }
6007
5854
  },
6008
- "version": "0.6.10"
5855
+ "version": "0.6.11-staging.32b42e4"
6009
5856
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/cli",
3
- "version": "0.6.10",
3
+ "version": "0.6.11-staging.32b42e4",
4
4
  "description": "DXOS CLI",
5
5
  "keywords": [
6
6
  "dxos",
@@ -50,34 +50,34 @@
50
50
  "react": "~18.2.0",
51
51
  "ws": "^8.14.2",
52
52
  "wtfnode": "^0.9.1",
53
- "@dxos/agent": "0.6.10",
54
- "@dxos/async": "0.6.10",
55
- "@dxos/bare-template": "0.6.10",
56
- "@dxos/cli-composer": "0.6.10",
57
- "@dxos/cli-base": "0.6.10",
58
- "@dxos/client-protocol": "0.6.10",
59
- "@dxos/client": "0.6.10",
60
- "@dxos/client-services": "0.6.10",
61
- "@dxos/context": "0.6.10",
62
- "@dxos/config": "0.6.10",
63
- "@dxos/functions": "0.6.10",
64
- "@dxos/debug": "0.6.10",
65
- "@dxos/echo-schema": "0.6.10",
66
- "@dxos/hello-template": "0.6.10",
67
- "@dxos/log": "0.6.10",
68
- "@dxos/invariant": "0.6.10",
69
- "@dxos/node-std": "0.6.10",
70
- "@dxos/observability": "0.6.10",
71
- "@dxos/plate": "0.6.10",
72
- "@dxos/plugin-markdown": "0.6.10",
73
- "@dxos/network-manager": "0.6.10",
74
- "@dxos/plugin-script": "0.6.10",
75
- "@dxos/process": "0.6.10",
76
- "@dxos/random": "0.6.10",
77
- "@dxos/protocols": "0.6.10",
78
- "@dxos/rpc": "0.6.10",
79
- "@dxos/tasks-template": "0.6.10",
80
- "@dxos/util": "0.6.10"
53
+ "@dxos/agent": "0.6.11-staging.32b42e4",
54
+ "@dxos/bare-template": "0.6.11-staging.32b42e4",
55
+ "@dxos/cli-base": "0.6.11-staging.32b42e4",
56
+ "@dxos/cli-composer": "0.6.11-staging.32b42e4",
57
+ "@dxos/client": "0.6.11-staging.32b42e4",
58
+ "@dxos/async": "0.6.11-staging.32b42e4",
59
+ "@dxos/client-protocol": "0.6.11-staging.32b42e4",
60
+ "@dxos/client-services": "0.6.11-staging.32b42e4",
61
+ "@dxos/config": "0.6.11-staging.32b42e4",
62
+ "@dxos/context": "0.6.11-staging.32b42e4",
63
+ "@dxos/debug": "0.6.11-staging.32b42e4",
64
+ "@dxos/echo-schema": "0.6.11-staging.32b42e4",
65
+ "@dxos/functions": "0.6.11-staging.32b42e4",
66
+ "@dxos/hello-template": "0.6.11-staging.32b42e4",
67
+ "@dxos/log": "0.6.11-staging.32b42e4",
68
+ "@dxos/invariant": "0.6.11-staging.32b42e4",
69
+ "@dxos/network-manager": "0.6.11-staging.32b42e4",
70
+ "@dxos/node-std": "0.6.11-staging.32b42e4",
71
+ "@dxos/plate": "0.6.11-staging.32b42e4",
72
+ "@dxos/observability": "0.6.11-staging.32b42e4",
73
+ "@dxos/plugin-markdown": "0.6.11-staging.32b42e4",
74
+ "@dxos/process": "0.6.11-staging.32b42e4",
75
+ "@dxos/plugin-script": "0.6.11-staging.32b42e4",
76
+ "@dxos/protocols": "0.6.11-staging.32b42e4",
77
+ "@dxos/random": "0.6.11-staging.32b42e4",
78
+ "@dxos/rpc": "0.6.11-staging.32b42e4",
79
+ "@dxos/util": "0.6.11-staging.32b42e4",
80
+ "@dxos/tasks-template": "0.6.11-staging.32b42e4"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@oclif/test": "^4.0.3",
@@ -1,29 +0,0 @@
1
- import { BaseCommand } from '../../base';
2
- export default class Dev extends BaseCommand<typeof Dev> {
3
- static enableJsonFlag: boolean;
4
- static description: string;
5
- static aliases: string[];
6
- static examples: {
7
- description: string;
8
- command: string;
9
- }[];
10
- static flags: {
11
- require: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
12
- manifest: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
- baseDir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
- reload: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
- key: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
- json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
- verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
- 'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
- profile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
- config: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
21
- timeout: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
22
- target: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
23
- agent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
24
- 'json-log': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
25
- 'json-logfile': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
26
- };
27
- run(): Promise<any>;
28
- }
29
- //# sourceMappingURL=dev.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,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;;;;;;;;;;;;;;;;MAOnB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAwE1B"}
@@ -1,100 +0,0 @@
1
- "use strict";
2
- //
3
- // Copyright 2023 DXOS.org
4
- //
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const core_1 = require("@oclif/core");
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const js_yaml_1 = require("js-yaml");
12
- const node_fs_1 = require("node:fs");
13
- const promises_1 = require("node:fs/promises");
14
- const node_path_1 = require("node:path");
15
- const async_1 = require("@dxos/async");
16
- const cli_base_1 = require("@dxos/cli-base");
17
- const client_protocol_1 = require("@dxos/client-protocol");
18
- const config_1 = require("@dxos/config");
19
- const functions_1 = require("@dxos/functions");
20
- const base_1 = require("../../base");
21
- class Dev extends base_1.BaseCommand {
22
- async run() {
23
- var _a;
24
- // TODO(burdon): Move into server?
25
- for (const requirePath of (_a = this.flags.require) !== null && _a !== void 0 ? _a : []) {
26
- require(requirePath);
27
- }
28
- await this.execWithClient(async ({ client }) => {
29
- var _a, _b, _c, _d, _e, _f, _g;
30
- client.addTypes(functions_1.FUNCTION_SCHEMA);
31
- // TODO(dmaretskyi): Move into system service?
32
- const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
33
- 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');
34
- // Local files.
35
- const manifest = (_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');
36
- const baseDir = (_g = this.flags.baseDir) !== null && _g !== void 0 ? _g : (0, node_path_1.join)((0, node_path_1.dirname)(manifest), 'src/functions');
37
- // Start Dev server.
38
- const functionRegistry = new functions_1.FunctionRegistry(client);
39
- const server = new functions_1.DevServer(client, functionRegistry, {
40
- baseDir,
41
- reload: this.flags.reload,
42
- dataDir: (0, client_protocol_1.getProfilePath)(client_protocol_1.DX_DATA, this.flags.profile),
43
- });
44
- await server.start();
45
- // Start scheduler.
46
- // TODO(burdon): Move to agent's FunctionsPlugin.
47
- const triggerRegistry = new functions_1.TriggerRegistry(client);
48
- const scheduler = new functions_1.Scheduler(functionRegistry, triggerRegistry, { endpoint: server.proxy });
49
- await scheduler.start();
50
- // Load manifest.
51
- if (manifest && (0, node_fs_1.existsSync)(manifest)) {
52
- this.log(`Loading manifest: ${chalk_1.default.blue(manifest)}`);
53
- const { functions, triggers } = (0, js_yaml_1.load)(await (0, promises_1.readFile)(manifest, 'utf8'));
54
- const update = async (space) => {
55
- await scheduler.register(space, { functions, triggers });
56
- };
57
- // TODO(burdon): Subscribe for new spaces.
58
- for (const space of await this.getSpaces(client, { spaceKeys: this.flags.key, wait: true })) {
59
- await update(space);
60
- }
61
- }
62
- this.log(`DevServer running: ${chalk_1.default.blue(server.endpoint)} (ctrl-c to exit)`);
63
- const run = new async_1.Trigger();
64
- process.on('SIGINT', async () => {
65
- await scheduler.stop();
66
- await server.stop();
67
- run.wake();
68
- });
69
- if (this.flags.verbose) {
70
- // TODO(burdon): Get list of functions from plugin API endpoint.
71
- this.log(`Plugin proxy: ${chalk_1.default.blue(server.proxy)}`);
72
- this.log('Functions:\n' +
73
- server.functions
74
- .map(({ def: { uri, route } }) => (0, chalk_1.default) `- ${uri.padEnd(40)} {blue ${(0, node_path_1.join)(server.proxy, route)}}`)
75
- .join('\n'));
76
- }
77
- // Wait until exit (via SIGINT).
78
- await run.wait();
79
- });
80
- }
81
- }
82
- Dev.enableJsonFlag = true;
83
- Dev.description = 'Functions development server.';
84
- Dev.aliases = ['function:dev-server'];
85
- Dev.examples = [
86
- {
87
- description: 'Run with TypeScript support.',
88
- command: 'dx function dev -r ts-node/register --verbose',
89
- },
90
- ];
91
- Dev.flags = {
92
- ...base_1.BaseCommand.flags,
93
- ...cli_base_1.FLAG_SPACE_KEYS,
94
- require: core_1.Flags.string({ multiple: true, aliases: ['r'], default: ['ts-node/register'] }),
95
- manifest: core_1.Flags.string({ description: 'Functions manifest file.' }),
96
- baseDir: core_1.Flags.string({ description: 'Base directory for function handlers.' }),
97
- reload: core_1.Flags.boolean({ description: 'Reload functions on change.' }),
98
- };
99
- exports.default = Dev;
100
- //# sourceMappingURL=dev.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":";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