@engini/cli 0.8.1 → 0.10.1
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 +1 -1
- package/dist/cli.js +53 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ engini tools list | get | call | result # discover, execute & drill into resul
|
|
|
31
31
|
engini applications list | get # browse connector apps
|
|
32
32
|
engini connect [<app>] # create a connection (interactive / agent-resumable)
|
|
33
33
|
engini connections list | get # inspect connections
|
|
34
|
-
engini connections create | check | refresh | objects | select-objects #
|
|
34
|
+
engini connections create | delete | check | refresh | objects | select-objects # primitives
|
|
35
35
|
engini connections sign-in-url | oauth-complete # OAuth2 start / finish primitives
|
|
36
36
|
```
|
|
37
37
|
|
package/dist/cli.js
CHANGED
|
@@ -135,9 +135,6 @@ function fail(code, message, hint2) {
|
|
|
135
135
|
}
|
|
136
136
|
throw new CliError(code);
|
|
137
137
|
}
|
|
138
|
-
function notImplemented(commandName) {
|
|
139
|
-
return fail(1 /* GENERIC */, `Command '${commandName}' is scaffolded but not yet implemented`);
|
|
140
|
-
}
|
|
141
138
|
function maskSecret(value) {
|
|
142
139
|
return value.length > 8 ? `${value.slice(0, 4)}\u2026${value.slice(-4)}` : "****";
|
|
143
140
|
}
|
|
@@ -377,7 +374,26 @@ function registerApplications(program) {
|
|
|
377
374
|
}
|
|
378
375
|
|
|
379
376
|
// src/connections/shared.ts
|
|
380
|
-
import { refreshFailed } from "@engini/sdk";
|
|
377
|
+
import { EnginiNetworkError, EnginiServerError, refreshFailed } from "@engini/sdk";
|
|
378
|
+
var GATEWAY_TIMEOUT_MARKERS = ["502", "503", "504", "gateway", "timeout"];
|
|
379
|
+
async function safeTrigger(action, what) {
|
|
380
|
+
try {
|
|
381
|
+
await action();
|
|
382
|
+
} catch (err) {
|
|
383
|
+
if (err instanceof EnginiNetworkError) {
|
|
384
|
+
progress(`${what} request timed out; the job may be running \u2014 checking status\u2026`);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (err instanceof EnginiServerError) {
|
|
388
|
+
const msg = err.message.toLowerCase();
|
|
389
|
+
if (GATEWAY_TIMEOUT_MARKERS.some((m) => msg.includes(m))) {
|
|
390
|
+
progress(`${what} hit a gateway timeout; the job may be running \u2014 checking status\u2026`);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
throw err;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
381
397
|
var OAUTH_DONE = /* @__PURE__ */ new Set(["completed", "complete", "success", "succeeded"]);
|
|
382
398
|
var OAUTH_FAILED = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "canceled", "denied"]);
|
|
383
399
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -510,12 +526,13 @@ async function connectBody(application, opts) {
|
|
|
510
526
|
);
|
|
511
527
|
const connectionId = created.connectionId;
|
|
512
528
|
progress(`Checking connection ${connectionId}\u2026`);
|
|
513
|
-
|
|
529
|
+
let alive = checkAlive(await client.connections.check(connectionId));
|
|
514
530
|
if (alive === false) {
|
|
515
531
|
fail(1 /* GENERIC */, `Connection ${connectionId} failed its liveness check.`);
|
|
516
532
|
}
|
|
517
|
-
await client.connections.refresh(connectionId);
|
|
518
|
-
await pollRefresh(client, connectionId, timing);
|
|
533
|
+
await safeTrigger(() => client.connections.refresh(connectionId), "Refresh");
|
|
534
|
+
const refreshStatus = await pollRefresh(client, connectionId, timing);
|
|
535
|
+
if (refreshStatus === "completed") alive = true;
|
|
519
536
|
const objectsSelected = await selectObjectStep(client, application, connectionId, opts.object, {
|
|
520
537
|
...timing,
|
|
521
538
|
noObjects,
|
|
@@ -612,7 +629,7 @@ async function selectObjectStep(client, application, connectionId, objectSpecs,
|
|
|
612
629
|
ids = await resolveObjects(objs, connectionId, application);
|
|
613
630
|
}
|
|
614
631
|
if (ids.length === 0) return 0;
|
|
615
|
-
await client.connections.selectObjects(connectionId, ids);
|
|
632
|
+
await safeTrigger(() => client.connections.selectObjects(connectionId, ids), "Object selection");
|
|
616
633
|
await pollRefresh(client, connectionId, opts);
|
|
617
634
|
return ids.length;
|
|
618
635
|
}
|
|
@@ -787,6 +804,29 @@ function registerConnectionsCreate(connections) {
|
|
|
787
804
|
});
|
|
788
805
|
}
|
|
789
806
|
|
|
807
|
+
// src/connections/delete.ts
|
|
808
|
+
async function deleteBody(connectionId, opts) {
|
|
809
|
+
const id = parseId(connectionId);
|
|
810
|
+
if (dryRun()) {
|
|
811
|
+
printOutput({ would_delete: id });
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
await confirmOrFail(`Delete connection ${id}?`, { force: Boolean(opts.force) });
|
|
815
|
+
await apiErrors(async () => {
|
|
816
|
+
const client = buildClient();
|
|
817
|
+
return client.connections.delete(id);
|
|
818
|
+
});
|
|
819
|
+
printOutput({ deleted: id });
|
|
820
|
+
}
|
|
821
|
+
function registerConnectionsDelete(connections) {
|
|
822
|
+
const cmd = connections.command("delete").description("Remove a connection.").argument("[connection_id]", "Connection id").option("--force", "Delete without confirming");
|
|
823
|
+
cmd.addHelpText("after", "\nExamples:\n engini connections delete 42 --force");
|
|
824
|
+
addUniversalOptions(cmd, { mutating: true });
|
|
825
|
+
cmd.action(async (id, opts, command) => {
|
|
826
|
+
await runCommand(command, opts, true, () => deleteBody(id, opts));
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
|
|
790
830
|
// src/connections/get.ts
|
|
791
831
|
function detail2(c) {
|
|
792
832
|
return {
|
|
@@ -948,7 +988,7 @@ async function refreshBody(connectionId, opts) {
|
|
|
948
988
|
}
|
|
949
989
|
const status = await apiErrors(async () => {
|
|
950
990
|
const client = buildClient();
|
|
951
|
-
await client.connections.refresh(id);
|
|
991
|
+
await safeTrigger(() => client.connections.refresh(id), "Refresh");
|
|
952
992
|
return pollRefresh(client, id, {
|
|
953
993
|
wait: opts.wait !== false,
|
|
954
994
|
timeout: Number(opts.timeout ?? 300),
|
|
@@ -984,7 +1024,7 @@ async function selectBody(connectionId, opts) {
|
|
|
984
1024
|
}
|
|
985
1025
|
const status = await apiErrors(async () => {
|
|
986
1026
|
const client = buildClient();
|
|
987
|
-
await client.connections.selectObjects(id, objectIds);
|
|
1027
|
+
await safeTrigger(() => client.connections.selectObjects(id, objectIds), "Object selection");
|
|
988
1028
|
return pollRefresh(client, id, {
|
|
989
1029
|
wait: opts.wait !== false,
|
|
990
1030
|
timeout: Number(opts.timeout ?? 300),
|
|
@@ -1046,17 +1086,13 @@ function registerConnections(program) {
|
|
|
1046
1086
|
registerConnectionsList(connections);
|
|
1047
1087
|
registerConnectionsGet(connections);
|
|
1048
1088
|
registerConnectionsCreate(connections);
|
|
1089
|
+
registerConnectionsDelete(connections);
|
|
1049
1090
|
registerConnectionsCheck(connections);
|
|
1050
1091
|
registerConnectionsRefresh(connections);
|
|
1051
1092
|
registerConnectionsObjects(connections);
|
|
1052
1093
|
registerConnectionsSelectObjects(connections);
|
|
1053
1094
|
registerConnectionsSignInUrl(connections);
|
|
1054
1095
|
registerConnectionsOauthComplete(connections);
|
|
1055
|
-
const del = connections.command("delete").description("Remove a connection.").argument("[connection_id]", "Connection id");
|
|
1056
|
-
addUniversalOptions(del, { mutating: true });
|
|
1057
|
-
del.action(async (_id, opts, command) => {
|
|
1058
|
-
await runCommand(command, opts, true, () => notImplemented("connections delete"));
|
|
1059
|
-
});
|
|
1060
1096
|
}
|
|
1061
1097
|
|
|
1062
1098
|
// src/help.ts
|
|
@@ -1128,7 +1164,7 @@ CONNECTIONS
|
|
|
1128
1164
|
connections refresh <id> [--no-wait] Refresh a connection's objects (async).
|
|
1129
1165
|
connections objects <id> List the objects a connection exposes.
|
|
1130
1166
|
connections select-objects <id> --object <id> Choose which objects to sync (async).
|
|
1131
|
-
connections delete <id>
|
|
1167
|
+
connections delete <id> [--force] Remove a connection.
|
|
1132
1168
|
|
|
1133
1169
|
OUTPUT & EXIT CODES
|
|
1134
1170
|
Output adapts to context: human-readable on a TTY, compact JSON when piped, pretty
|
|
@@ -1910,7 +1946,7 @@ function registerWhoami(program) {
|
|
|
1910
1946
|
}
|
|
1911
1947
|
|
|
1912
1948
|
// src/version.ts
|
|
1913
|
-
var VERSION = true ? "0.
|
|
1949
|
+
var VERSION = true ? "0.10.1" : "0.0.0";
|
|
1914
1950
|
|
|
1915
1951
|
// src/main.ts
|
|
1916
1952
|
function buildProgram() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@engini/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Engini CLI — machine-first command line over the Engini Public API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@engini/sdk": "^0.
|
|
24
|
+
"@engini/sdk": "^0.10.1",
|
|
25
25
|
"commander": "^12.1.0",
|
|
26
26
|
"smol-toml": "^1.3.0"
|
|
27
27
|
},
|