@nimbase/cli 0.1.1 → 0.2.0
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/chunk-2BYB6W4B.js +44 -0
- package/dist/chunk-2BYB6W4B.js.map +1 -0
- package/dist/chunk-6MCLE65K.js +46 -0
- package/dist/chunk-6MCLE65K.js.map +1 -0
- package/dist/chunk-IJCEQQWX.js +150 -0
- package/dist/chunk-IJCEQQWX.js.map +1 -0
- package/dist/chunk-KKZVWJDK.js +528 -0
- package/dist/chunk-KKZVWJDK.js.map +1 -0
- package/dist/commands/auth/login.js +8 -44
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/logout.js +14 -15
- package/dist/commands/auth/logout.js.map +1 -1
- package/dist/commands/auth/signup.js +18 -0
- package/dist/commands/auth/signup.js.map +1 -0
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/connector/connect.js +93 -0
- package/dist/commands/connector/connect.js.map +1 -0
- package/dist/commands/connector/list.js +42 -0
- package/dist/commands/connector/list.js.map +1 -0
- package/dist/commands/connector/revoke.js +50 -0
- package/dist/commands/connector/revoke.js.map +1 -0
- package/dist/commands/connector/status.js +46 -0
- package/dist/commands/connector/status.js.map +1 -0
- package/dist/commands/connector/sync.js +57 -0
- package/dist/commands/connector/sync.js.map +1 -0
- package/dist/commands/workspace/create.js +2 -4
- package/dist/commands/workspace/create.js.map +1 -1
- package/dist/commands/workspace/current.js +2 -4
- package/dist/commands/workspace/current.js.map +1 -1
- package/dist/commands/workspace/list.js +2 -4
- package/dist/commands/workspace/list.js.map +1 -1
- package/dist/commands/workspace/select.js +2 -4
- package/dist/commands/workspace/select.js.map +1 -1
- package/package.json +13 -3
- package/dist/chunk-47FIFCKS.js +0 -292
- package/dist/chunk-47FIFCKS.js.map +0 -1
- package/dist/chunk-O5PHWVZD.js +0 -35
- package/dist/chunk-O5PHWVZD.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/auth/login.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/auth/login.ts"],"sourcesContent":["import { BrowserAuthCommand } from \"../../browser-auth-command.js\";\n\nexport default class Login extends BrowserAuthCommand {\n static description = \"Sign in to the CLI through the Nimbase web app\";\n\n async run(): Promise<void> {\n await this.parse(Login);\n await this.authenticateInBrowser(\"login\");\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAqB,QAArB,MAAqB,eAAc,mBAAmB;AAAA,EACpD,OAAO,cAAc;AAAA,EAErB,MAAM,MAAqB;AACzB,UAAM,KAAK,MAAM,MAAK;AACtB,UAAM,KAAK,sBAAsB,OAAO;AAAA,EAC1C;AACF;","names":[]}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
clearWorkspaceId
|
|
3
|
-
} from "../../chunk-O5PHWVZD.js";
|
|
4
1
|
import {
|
|
5
2
|
NimbaseCommand,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
clearSession,
|
|
4
|
+
clearWorkspaceId,
|
|
5
|
+
readSession
|
|
6
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
9
7
|
|
|
10
8
|
// src/commands/auth/logout.ts
|
|
11
9
|
var Logout = class _Logout extends NimbaseCommand {
|
|
12
10
|
static description = "Sign out of Nimbase";
|
|
13
11
|
async run() {
|
|
14
12
|
await this.parse(_Logout);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
13
|
+
const session = await readSession();
|
|
14
|
+
if (!session) {
|
|
17
15
|
this.log("Already signed out.");
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
|
-
let remoteFailed;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
let remoteFailed = session.origin !== this.origin;
|
|
19
|
+
if (!remoteFailed) {
|
|
20
|
+
try {
|
|
21
|
+
await this.api.signOut(session.token);
|
|
22
|
+
} catch {
|
|
23
|
+
remoteFailed = true;
|
|
24
|
+
}
|
|
26
25
|
}
|
|
27
|
-
await Promise.all([
|
|
26
|
+
await Promise.all([clearSession(), clearWorkspaceId()]);
|
|
28
27
|
this.log(
|
|
29
28
|
remoteFailed ? "Signed out locally; the server session could not be revoked." : "Signed out."
|
|
30
29
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/auth/logout.ts"],"sourcesContent":["import { NimbaseCommand } from \"../../base-command.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/auth/logout.ts"],"sourcesContent":["import { NimbaseCommand } from \"../../base-command.js\";\nimport { clearSession, readSession } from \"../../credentials.js\";\nimport { clearWorkspaceId } from \"../../preferences.js\";\n\nexport default class Logout extends NimbaseCommand {\n static description = \"Sign out of Nimbase\";\n\n async run(): Promise<void> {\n await this.parse(Logout);\n const session = await readSession();\n if (!session) {\n this.log(\"Already signed out.\");\n return;\n }\n\n // Never send a token to an origin that did not issue it; a session for\n // another origin can only be discarded locally.\n let remoteFailed = session.origin !== this.origin;\n if (!remoteFailed) {\n try {\n await this.api.signOut(session.token);\n } catch {\n remoteFailed = true;\n }\n }\n await Promise.all([clearSession(), clearWorkspaceId()]);\n this.log(\n remoteFailed\n ? \"Signed out locally; the server session could not be revoked.\"\n : \"Signed out.\",\n );\n }\n}\n"],"mappings":";;;;;;;;AAIA,IAAqB,SAArB,MAAqB,gBAAe,eAAe;AAAA,EACjD,OAAO,cAAc;AAAA,EAErB,MAAM,MAAqB;AACzB,UAAM,KAAK,MAAM,OAAM;AACvB,UAAM,UAAU,MAAM,YAAY;AAClC,QAAI,CAAC,SAAS;AACZ,WAAK,IAAI,qBAAqB;AAC9B;AAAA,IACF;AAIA,QAAI,eAAe,QAAQ,WAAW,KAAK;AAC3C,QAAI,CAAC,cAAc;AACjB,UAAI;AACF,cAAM,KAAK,IAAI,QAAQ,QAAQ,KAAK;AAAA,MACtC,QAAQ;AACN,uBAAe;AAAA,MACjB;AAAA,IACF;AACA,UAAM,QAAQ,IAAI,CAAC,aAAa,GAAG,iBAAiB,CAAC,CAAC;AACtD,SAAK;AAAA,MACH,eACI,iEACA;AAAA,IACN;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BrowserAuthCommand
|
|
3
|
+
} from "../../chunk-2BYB6W4B.js";
|
|
4
|
+
import "../../chunk-IJCEQQWX.js";
|
|
5
|
+
import "../../chunk-KKZVWJDK.js";
|
|
6
|
+
|
|
7
|
+
// src/commands/auth/signup.ts
|
|
8
|
+
var Signup = class _Signup extends BrowserAuthCommand {
|
|
9
|
+
static description = "Create an account and sign in through the web app";
|
|
10
|
+
async run() {
|
|
11
|
+
await this.parse(_Signup);
|
|
12
|
+
await this.authenticateInBrowser("signup");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
Signup as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/auth/signup.ts"],"sourcesContent":["import { BrowserAuthCommand } from \"../../browser-auth-command.js\";\n\nexport default class Signup extends BrowserAuthCommand {\n static description = \"Create an account and sign in through the web app\";\n\n async run(): Promise<void> {\n await this.parse(Signup);\n await this.authenticateInBrowser(\"signup\");\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAqB,SAArB,MAAqB,gBAAe,mBAAmB;AAAA,EACrD,OAAO,cAAc;AAAA,EAErB,MAAM,MAAqB;AACzB,UAAM,KAAK,MAAM,OAAM;AACvB,UAAM,KAAK,sBAAsB,QAAQ;AAAA,EAC3C;AACF;","names":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openInBrowser
|
|
3
|
+
} from "../../chunk-IJCEQQWX.js";
|
|
4
|
+
import {
|
|
5
|
+
waitForConnectorConnection
|
|
6
|
+
} from "../../chunk-6MCLE65K.js";
|
|
7
|
+
import {
|
|
8
|
+
NimbaseCommand
|
|
9
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
10
|
+
|
|
11
|
+
// src/commands/connector/connect.ts
|
|
12
|
+
import { Args, Flags } from "@oclif/core";
|
|
13
|
+
var Connect = class _Connect extends NimbaseCommand {
|
|
14
|
+
static description = "Connect a provider account through browser OAuth";
|
|
15
|
+
static args = {
|
|
16
|
+
provider: Args.string({
|
|
17
|
+
description: "connector provider",
|
|
18
|
+
required: true,
|
|
19
|
+
options: ["slack", "gmail"]
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
static flags = {
|
|
23
|
+
browser: Flags.boolean({
|
|
24
|
+
description: "open the provider authorization page",
|
|
25
|
+
default: true,
|
|
26
|
+
allowNo: true
|
|
27
|
+
}),
|
|
28
|
+
wait: Flags.boolean({
|
|
29
|
+
description: "wait for authorization to complete",
|
|
30
|
+
default: true,
|
|
31
|
+
allowNo: true
|
|
32
|
+
}),
|
|
33
|
+
timeout: Flags.integer({
|
|
34
|
+
description: "seconds to wait for authorization",
|
|
35
|
+
default: 300
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
async run() {
|
|
39
|
+
const { args, flags } = await this.parse(_Connect);
|
|
40
|
+
if (flags.timeout < 1 || flags.timeout > 1800) {
|
|
41
|
+
this.error("Timeout must be between 1 and 1800 seconds.");
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const token = await this.requireToken();
|
|
45
|
+
const workspaceId = await this.requireWorkspaceId();
|
|
46
|
+
const before = await this.api.listConnectors(token, workspaceId);
|
|
47
|
+
const provider = before.providers.find(
|
|
48
|
+
(candidate) => candidate.provider === args.provider
|
|
49
|
+
);
|
|
50
|
+
if (!provider) {
|
|
51
|
+
this.error(`Connector provider is not available: ${args.provider}`);
|
|
52
|
+
}
|
|
53
|
+
const url = await this.api.beginConnectorAuthorization(
|
|
54
|
+
token,
|
|
55
|
+
workspaceId,
|
|
56
|
+
provider.provider
|
|
57
|
+
);
|
|
58
|
+
if (flags.browser) {
|
|
59
|
+
this.log(
|
|
60
|
+
`Opening ${provider.displayName} authorization in your browser.`
|
|
61
|
+
);
|
|
62
|
+
await openInBrowser(url).catch(() => {
|
|
63
|
+
this.warn(`Could not open a browser. Visit ${url}`);
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
this.log(url);
|
|
67
|
+
}
|
|
68
|
+
if (!flags.wait) {
|
|
69
|
+
this.log("Run `nimbase connector list` after finishing authorization.");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.log("Waiting for authorization to complete\u2026");
|
|
73
|
+
const connection = await waitForConnectorConnection(
|
|
74
|
+
async () => (await this.api.listConnectors(token, workspaceId)).connections,
|
|
75
|
+
before.connections,
|
|
76
|
+
provider.provider,
|
|
77
|
+
{ timeoutMs: flags.timeout * 1e3 }
|
|
78
|
+
);
|
|
79
|
+
if (!connection) {
|
|
80
|
+
this.error(
|
|
81
|
+
"Authorization was not completed before the timeout. Run the command again to retry."
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
this.log(`Connected ${connection.displayName} (${connection.id}).`);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
await this.handleError(error);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
Connect as default
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/connector/connect.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { openInBrowser } from \"../../browser.js\";\nimport { waitForConnectorConnection } from \"../../connectors.js\";\n\nexport default class Connect extends NimbaseCommand {\n static description = \"Connect a provider account through browser OAuth\";\n static args = {\n provider: Args.string({\n description: \"connector provider\",\n required: true,\n options: [\"slack\", \"gmail\"],\n }),\n };\n static flags = {\n browser: Flags.boolean({\n description: \"open the provider authorization page\",\n default: true,\n allowNo: true,\n }),\n wait: Flags.boolean({\n description: \"wait for authorization to complete\",\n default: true,\n allowNo: true,\n }),\n timeout: Flags.integer({\n description: \"seconds to wait for authorization\",\n default: 300,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Connect);\n if (flags.timeout < 1 || flags.timeout > 1_800) {\n this.error(\"Timeout must be between 1 and 1800 seconds.\");\n }\n\n try {\n const token = await this.requireToken();\n const workspaceId = await this.requireWorkspaceId();\n const before = await this.api.listConnectors(token, workspaceId);\n const provider = before.providers.find(\n (candidate) => candidate.provider === args.provider,\n );\n if (!provider) {\n this.error(`Connector provider is not available: ${args.provider}`);\n }\n const url = await this.api.beginConnectorAuthorization(\n token,\n workspaceId,\n provider.provider,\n );\n\n if (flags.browser) {\n this.log(\n `Opening ${provider.displayName} authorization in your browser.`,\n );\n await openInBrowser(url).catch(() => {\n this.warn(`Could not open a browser. Visit ${url}`);\n });\n } else {\n this.log(url);\n }\n if (!flags.wait) {\n this.log(\"Run `nimbase connector list` after finishing authorization.\");\n return;\n }\n\n this.log(\"Waiting for authorization to complete…\");\n const connection = await waitForConnectorConnection(\n async () =>\n (await this.api.listConnectors(token, workspaceId)).connections,\n before.connections,\n provider.provider,\n { timeoutMs: flags.timeout * 1_000 },\n );\n if (!connection) {\n this.error(\n \"Authorization was not completed before the timeout. Run the command again to retry.\",\n );\n }\n this.log(`Connected ${connection.displayName} (${connection.id}).`);\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,aAAa;AAM5B,IAAqB,UAArB,MAAqB,iBAAgB,eAAe;AAAA,EAClD,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,UAAU,KAAK,OAAO;AAAA,MACpB,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS,CAAC,SAAS,OAAO;AAAA,IAC5B,CAAC;AAAA,EACH;AAAA,EACA,OAAO,QAAQ;AAAA,IACb,SAAS,MAAM,QAAQ;AAAA,MACrB,aAAa;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,IACX,CAAC;AAAA,IACD,MAAM,MAAM,QAAQ;AAAA,MAClB,aAAa;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,IACX,CAAC;AAAA,IACD,SAAS,MAAM,QAAQ;AAAA,MACrB,aAAa;AAAA,MACb,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,QAAO;AAChD,QAAI,MAAM,UAAU,KAAK,MAAM,UAAU,MAAO;AAC9C,WAAK,MAAM,6CAA6C;AAAA,IAC1D;AAEA,QAAI;AACF,YAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,YAAM,cAAc,MAAM,KAAK,mBAAmB;AAClD,YAAM,SAAS,MAAM,KAAK,IAAI,eAAe,OAAO,WAAW;AAC/D,YAAM,WAAW,OAAO,UAAU;AAAA,QAChC,CAAC,cAAc,UAAU,aAAa,KAAK;AAAA,MAC7C;AACA,UAAI,CAAC,UAAU;AACb,aAAK,MAAM,wCAAwC,KAAK,QAAQ,EAAE;AAAA,MACpE;AACA,YAAM,MAAM,MAAM,KAAK,IAAI;AAAA,QACzB;AAAA,QACA;AAAA,QACA,SAAS;AAAA,MACX;AAEA,UAAI,MAAM,SAAS;AACjB,aAAK;AAAA,UACH,WAAW,SAAS,WAAW;AAAA,QACjC;AACA,cAAM,cAAc,GAAG,EAAE,MAAM,MAAM;AACnC,eAAK,KAAK,mCAAmC,GAAG,EAAE;AAAA,QACpD,CAAC;AAAA,MACH,OAAO;AACL,aAAK,IAAI,GAAG;AAAA,MACd;AACA,UAAI,CAAC,MAAM,MAAM;AACf,aAAK,IAAI,6DAA6D;AACtE;AAAA,MACF;AAEA,WAAK,IAAI,6CAAwC;AACjD,YAAM,aAAa,MAAM;AAAA,QACvB,aACG,MAAM,KAAK,IAAI,eAAe,OAAO,WAAW,GAAG;AAAA,QACtD,OAAO;AAAA,QACP,SAAS;AAAA,QACT,EAAE,WAAW,MAAM,UAAU,IAAM;AAAA,MACrC;AACA,UAAI,CAAC,YAAY;AACf,aAAK;AAAA,UACH;AAAA,QACF;AAAA,MACF;AACA,WAAK,IAAI,aAAa,WAAW,WAAW,KAAK,WAAW,EAAE,IAAI;AAAA,IACpE,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NimbaseCommand
|
|
3
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
4
|
+
|
|
5
|
+
// src/commands/connector/list.ts
|
|
6
|
+
import { Flags } from "@oclif/core";
|
|
7
|
+
var List = class _List extends NimbaseCommand {
|
|
8
|
+
static description = "List connector providers and connections";
|
|
9
|
+
static flags = {
|
|
10
|
+
json: Flags.boolean({ description: "output JSON" })
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(_List);
|
|
14
|
+
try {
|
|
15
|
+
const token = await this.requireToken();
|
|
16
|
+
const workspaceId = await this.requireWorkspaceId();
|
|
17
|
+
const overview = await this.api.listConnectors(token, workspaceId);
|
|
18
|
+
if (flags.json) {
|
|
19
|
+
this.log(JSON.stringify(overview, null, 2));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.log(
|
|
23
|
+
`Available: ${overview.providers.map((item) => item.displayName).join(", ") || "none"}`
|
|
24
|
+
);
|
|
25
|
+
if (overview.connections.length === 0) {
|
|
26
|
+
this.log("No connector accounts connected.");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
for (const connection of overview.connections) {
|
|
30
|
+
this.log(
|
|
31
|
+
`${connection.provider} ${connection.displayName} ${connection.status} ${connection.id}`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
} catch (error) {
|
|
35
|
+
await this.handleError(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
List as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/connector/list.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\n\nexport default class List extends NimbaseCommand {\n static description = \"List connector providers and connections\";\n static flags = {\n json: Flags.boolean({ description: \"output JSON\" }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n try {\n const token = await this.requireToken();\n const workspaceId = await this.requireWorkspaceId();\n const overview = await this.api.listConnectors(token, workspaceId);\n if (flags.json) {\n this.log(JSON.stringify(overview, null, 2));\n return;\n }\n\n this.log(\n `Available: ${overview.providers.map((item) => item.displayName).join(\", \") || \"none\"}`,\n );\n if (overview.connections.length === 0) {\n this.log(\"No connector accounts connected.\");\n return;\n }\n for (const connection of overview.connections) {\n this.log(\n `${connection.provider}\\t${connection.displayName}\\t${connection.status}\\t${connection.id}`,\n );\n }\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAItB,IAAqB,OAArB,MAAqB,cAAa,eAAe;AAAA,EAC/C,OAAO,cAAc;AAAA,EACrB,OAAO,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,EAAE,aAAa,cAAc,CAAC;AAAA,EACpD;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,IAAI,MAAM,KAAK,MAAM,KAAI;AACvC,QAAI;AACF,YAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,YAAM,cAAc,MAAM,KAAK,mBAAmB;AAClD,YAAM,WAAW,MAAM,KAAK,IAAI,eAAe,OAAO,WAAW;AACjE,UAAI,MAAM,MAAM;AACd,aAAK,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC1C;AAAA,MACF;AAEA,WAAK;AAAA,QACH,cAAc,SAAS,UAAU,IAAI,CAAC,SAAS,KAAK,WAAW,EAAE,KAAK,IAAI,KAAK,MAAM;AAAA,MACvF;AACA,UAAI,SAAS,YAAY,WAAW,GAAG;AACrC,aAAK,IAAI,kCAAkC;AAC3C;AAAA,MACF;AACA,iBAAW,cAAc,SAAS,aAAa;AAC7C,aAAK;AAAA,UACH,GAAG,WAAW,QAAQ,IAAK,WAAW,WAAW,IAAK,WAAW,MAAM,IAAK,WAAW,EAAE;AAAA,QAC3F;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveConnector
|
|
3
|
+
} from "../../chunk-6MCLE65K.js";
|
|
4
|
+
import {
|
|
5
|
+
NimbaseCommand
|
|
6
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
7
|
+
|
|
8
|
+
// src/commands/connector/revoke.ts
|
|
9
|
+
import { Args } from "@oclif/core";
|
|
10
|
+
var Revoke = class _Revoke extends NimbaseCommand {
|
|
11
|
+
static description = "Revoke a connector connection";
|
|
12
|
+
static args = {
|
|
13
|
+
connection: Args.string({
|
|
14
|
+
description: "connection ID, provider, or display name",
|
|
15
|
+
required: true
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { args } = await this.parse(_Revoke);
|
|
20
|
+
try {
|
|
21
|
+
const token = await this.requireToken();
|
|
22
|
+
const workspaceId = await this.requireWorkspaceId();
|
|
23
|
+
const overview = await this.api.listConnectors(token, workspaceId);
|
|
24
|
+
const resolved = resolveConnector(overview.connections, args.connection);
|
|
25
|
+
if (resolved.kind === "not_found") {
|
|
26
|
+
this.error(`Connector connection not found: ${args.connection}`);
|
|
27
|
+
}
|
|
28
|
+
if (resolved.kind === "ambiguous") {
|
|
29
|
+
this.error("More than one connection matched; use a connection ID.");
|
|
30
|
+
}
|
|
31
|
+
const result = await this.api.revokeConnector(
|
|
32
|
+
token,
|
|
33
|
+
workspaceId,
|
|
34
|
+
resolved.connection.id
|
|
35
|
+
);
|
|
36
|
+
this.log(`Revoked ${resolved.connection.displayName}.`);
|
|
37
|
+
if (!result.providerRevoked) {
|
|
38
|
+
this.warn(
|
|
39
|
+
"Local access and credentials were removed, but the provider grant could not be confirmed revoked."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
await this.handleError(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
Revoke as default
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=revoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/connector/revoke.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { resolveConnector } from \"../../connectors.js\";\n\nexport default class Revoke extends NimbaseCommand {\n static description = \"Revoke a connector connection\";\n static args = {\n connection: Args.string({\n description: \"connection ID, provider, or display name\",\n required: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Revoke);\n try {\n const token = await this.requireToken();\n const workspaceId = await this.requireWorkspaceId();\n const overview = await this.api.listConnectors(token, workspaceId);\n const resolved = resolveConnector(overview.connections, args.connection);\n if (resolved.kind === \"not_found\") {\n this.error(`Connector connection not found: ${args.connection}`);\n }\n if (resolved.kind === \"ambiguous\") {\n this.error(\"More than one connection matched; use a connection ID.\");\n }\n const result = await this.api.revokeConnector(\n token,\n workspaceId,\n resolved.connection.id,\n );\n this.log(`Revoked ${resolved.connection.displayName}.`);\n if (!result.providerRevoked) {\n this.warn(\n \"Local access and credentials were removed, but the provider grant could not be confirmed revoked.\",\n );\n }\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,YAAY;AAKrB,IAAqB,SAArB,MAAqB,gBAAe,eAAe;AAAA,EACjD,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,YAAY,KAAK,OAAO;AAAA,MACtB,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,MAAM,OAAM;AACxC,QAAI;AACF,YAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,YAAM,cAAc,MAAM,KAAK,mBAAmB;AAClD,YAAM,WAAW,MAAM,KAAK,IAAI,eAAe,OAAO,WAAW;AACjE,YAAM,WAAW,iBAAiB,SAAS,aAAa,KAAK,UAAU;AACvE,UAAI,SAAS,SAAS,aAAa;AACjC,aAAK,MAAM,mCAAmC,KAAK,UAAU,EAAE;AAAA,MACjE;AACA,UAAI,SAAS,SAAS,aAAa;AACjC,aAAK,MAAM,wDAAwD;AAAA,MACrE;AACA,YAAM,SAAS,MAAM,KAAK,IAAI;AAAA,QAC5B;AAAA,QACA;AAAA,QACA,SAAS,WAAW;AAAA,MACtB;AACA,WAAK,IAAI,WAAW,SAAS,WAAW,WAAW,GAAG;AACtD,UAAI,CAAC,OAAO,iBAAiB;AAC3B,aAAK;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NimbaseCommand
|
|
3
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
4
|
+
|
|
5
|
+
// src/commands/connector/status.ts
|
|
6
|
+
import { Args, Flags } from "@oclif/core";
|
|
7
|
+
var Status = class _Status extends NimbaseCommand {
|
|
8
|
+
static description = "Show a connector sync job";
|
|
9
|
+
static args = {
|
|
10
|
+
job: Args.string({ description: "sync job ID", required: true })
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
json: Flags.boolean({ description: "output JSON" })
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(_Status);
|
|
17
|
+
try {
|
|
18
|
+
const status = await this.api.getConnectorSync(
|
|
19
|
+
await this.requireToken(),
|
|
20
|
+
await this.requireWorkspaceId(),
|
|
21
|
+
args.job
|
|
22
|
+
);
|
|
23
|
+
if (flags.json) {
|
|
24
|
+
this.log(JSON.stringify(status, null, 2));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.log(`${status.status} ${status.jobId}`);
|
|
28
|
+
if (status.activeJobId !== status.jobId) {
|
|
29
|
+
this.log(`Active continuation: ${status.activeJobId}`);
|
|
30
|
+
}
|
|
31
|
+
this.log(
|
|
32
|
+
`Attempt ${status.attemptCount}/${status.maxAttempts} ${status.trigger}`
|
|
33
|
+
);
|
|
34
|
+
if (status.failureCode) this.log(`Failure: ${status.failureCode}`);
|
|
35
|
+
if (status.lastFailureCode) {
|
|
36
|
+
this.log(`Last attempt: ${status.lastFailureCode}`);
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
await this.handleError(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
Status as default
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/connector/status.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\n\nexport default class Status extends NimbaseCommand {\n static description = \"Show a connector sync job\";\n static args = {\n job: Args.string({ description: \"sync job ID\", required: true }),\n };\n static flags = {\n json: Flags.boolean({ description: \"output JSON\" }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Status);\n try {\n const status = await this.api.getConnectorSync(\n await this.requireToken(),\n await this.requireWorkspaceId(),\n args.job,\n );\n if (flags.json) {\n this.log(JSON.stringify(status, null, 2));\n return;\n }\n this.log(`${status.status}\\t${status.jobId}`);\n if (status.activeJobId !== status.jobId) {\n this.log(`Active continuation: ${status.activeJobId}`);\n }\n this.log(\n `Attempt ${status.attemptCount}/${status.maxAttempts}\\t${status.trigger}`,\n );\n if (status.failureCode) this.log(`Failure: ${status.failureCode}`);\n if (status.lastFailureCode) {\n this.log(`Last attempt: ${status.lastFailureCode}`);\n }\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,MAAM,aAAa;AAI5B,IAAqB,SAArB,MAAqB,gBAAe,eAAe;AAAA,EACjD,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,KAAK,KAAK,OAAO,EAAE,aAAa,eAAe,UAAU,KAAK,CAAC;AAAA,EACjE;AAAA,EACA,OAAO,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,EAAE,aAAa,cAAc,CAAC;AAAA,EACpD;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,OAAM;AAC/C,QAAI;AACF,YAAM,SAAS,MAAM,KAAK,IAAI;AAAA,QAC5B,MAAM,KAAK,aAAa;AAAA,QACxB,MAAM,KAAK,mBAAmB;AAAA,QAC9B,KAAK;AAAA,MACP;AACA,UAAI,MAAM,MAAM;AACd,aAAK,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AACxC;AAAA,MACF;AACA,WAAK,IAAI,GAAG,OAAO,MAAM,IAAK,OAAO,KAAK,EAAE;AAC5C,UAAI,OAAO,gBAAgB,OAAO,OAAO;AACvC,aAAK,IAAI,wBAAwB,OAAO,WAAW,EAAE;AAAA,MACvD;AACA,WAAK;AAAA,QACH,WAAW,OAAO,YAAY,IAAI,OAAO,WAAW,IAAK,OAAO,OAAO;AAAA,MACzE;AACA,UAAI,OAAO,YAAa,MAAK,IAAI,YAAY,OAAO,WAAW,EAAE;AACjE,UAAI,OAAO,iBAAiB;AAC1B,aAAK,IAAI,iBAAiB,OAAO,eAAe,EAAE;AAAA,MACpD;AAAA,IACF,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveConnector
|
|
3
|
+
} from "../../chunk-6MCLE65K.js";
|
|
4
|
+
import {
|
|
5
|
+
NimbaseCommand
|
|
6
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
7
|
+
|
|
8
|
+
// src/commands/connector/sync.ts
|
|
9
|
+
import { Args, Flags } from "@oclif/core";
|
|
10
|
+
var Sync = class _Sync extends NimbaseCommand {
|
|
11
|
+
static description = "Schedule a connector sync";
|
|
12
|
+
static args = {
|
|
13
|
+
connection: Args.string({
|
|
14
|
+
description: "connection ID, provider, or display name",
|
|
15
|
+
required: true
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
static flags = {
|
|
19
|
+
json: Flags.boolean({ description: "output JSON" })
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { args, flags } = await this.parse(_Sync);
|
|
23
|
+
try {
|
|
24
|
+
const token = await this.requireToken();
|
|
25
|
+
const workspaceId = await this.requireWorkspaceId();
|
|
26
|
+
const overview = await this.api.listConnectors(token, workspaceId);
|
|
27
|
+
const resolved = resolveConnector(overview.connections, args.connection);
|
|
28
|
+
if (resolved.kind === "not_found") {
|
|
29
|
+
this.error(`Connector connection not found: ${args.connection}`);
|
|
30
|
+
}
|
|
31
|
+
if (resolved.kind === "ambiguous") {
|
|
32
|
+
this.error("More than one connection matched; use a connection ID.");
|
|
33
|
+
}
|
|
34
|
+
if (resolved.connection.status !== "active") {
|
|
35
|
+
this.error(`Connector connection is ${resolved.connection.status}.`);
|
|
36
|
+
}
|
|
37
|
+
const sync = await this.api.requestConnectorSync(
|
|
38
|
+
token,
|
|
39
|
+
workspaceId,
|
|
40
|
+
resolved.connection.id
|
|
41
|
+
);
|
|
42
|
+
if (flags.json) {
|
|
43
|
+
this.log(JSON.stringify(sync, null, 2));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.log(
|
|
47
|
+
`Scheduled ${resolved.connection.displayName} sync (${sync.jobId}).`
|
|
48
|
+
);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
await this.handleError(error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
Sync as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/connector/sync.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { resolveConnector } from \"../../connectors.js\";\n\nexport default class Sync extends NimbaseCommand {\n static description = \"Schedule a connector sync\";\n static args = {\n connection: Args.string({\n description: \"connection ID, provider, or display name\",\n required: true,\n }),\n };\n static flags = {\n json: Flags.boolean({ description: \"output JSON\" }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Sync);\n try {\n const token = await this.requireToken();\n const workspaceId = await this.requireWorkspaceId();\n const overview = await this.api.listConnectors(token, workspaceId);\n const resolved = resolveConnector(overview.connections, args.connection);\n if (resolved.kind === \"not_found\") {\n this.error(`Connector connection not found: ${args.connection}`);\n }\n if (resolved.kind === \"ambiguous\") {\n this.error(\"More than one connection matched; use a connection ID.\");\n }\n if (resolved.connection.status !== \"active\") {\n this.error(`Connector connection is ${resolved.connection.status}.`);\n }\n const sync = await this.api.requestConnectorSync(\n token,\n workspaceId,\n resolved.connection.id,\n );\n if (flags.json) {\n this.log(JSON.stringify(sync, null, 2));\n return;\n }\n this.log(\n `Scheduled ${resolved.connection.displayName} sync (${sync.jobId}).`,\n );\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,aAAa;AAK5B,IAAqB,OAArB,MAAqB,cAAa,eAAe;AAAA,EAC/C,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,YAAY,KAAK,OAAO;AAAA,MACtB,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AAAA,EACA,OAAO,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,EAAE,aAAa,cAAc,CAAC;AAAA,EACpD;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,KAAI;AAC7C,QAAI;AACF,YAAM,QAAQ,MAAM,KAAK,aAAa;AACtC,YAAM,cAAc,MAAM,KAAK,mBAAmB;AAClD,YAAM,WAAW,MAAM,KAAK,IAAI,eAAe,OAAO,WAAW;AACjE,YAAM,WAAW,iBAAiB,SAAS,aAAa,KAAK,UAAU;AACvE,UAAI,SAAS,SAAS,aAAa;AACjC,aAAK,MAAM,mCAAmC,KAAK,UAAU,EAAE;AAAA,MACjE;AACA,UAAI,SAAS,SAAS,aAAa;AACjC,aAAK,MAAM,wDAAwD;AAAA,MACrE;AACA,UAAI,SAAS,WAAW,WAAW,UAAU;AAC3C,aAAK,MAAM,2BAA2B,SAAS,WAAW,MAAM,GAAG;AAAA,MACrE;AACA,YAAM,OAAO,MAAM,KAAK,IAAI;AAAA,QAC1B;AAAA,QACA;AAAA,QACA,SAAS,WAAW;AAAA,MACtB;AACA,UAAI,MAAM,MAAM;AACd,aAAK,IAAI,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AACtC;AAAA,MACF;AACA,WAAK;AAAA,QACH,aAAa,SAAS,WAAW,WAAW,UAAU,KAAK,KAAK;AAAA,MAClE;AAAA,IACF,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NimbaseCommand,
|
|
2
3
|
writeWorkspaceId
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import {
|
|
5
|
-
NimbaseCommand
|
|
6
|
-
} from "../../chunk-47FIFCKS.js";
|
|
4
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
7
5
|
|
|
8
6
|
// src/commands/workspace/create.ts
|
|
9
7
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/workspace/create.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { writeWorkspaceId } from \"../../preferences.js\";\n\nexport default class Create extends NimbaseCommand {\n static description = \"Create a workspace\";\n static args = {\n name: Args.string({ description: \"workspace name\", required: true }),\n };\n static flags = {\n select: Flags.boolean({\n description: \"select the new workspace\",\n default: true,\n allowNo: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Create);\n try {\n const workspace = await this.api.createWorkspace(\n await this.requireToken(),\n args.name.trim(),\n );\n if (flags.select) await writeWorkspaceId(workspace.id);\n this.log(`Created ${workspace.name} (${workspace.slug}).`);\n if (flags.select) this.log(\"Selected the new workspace.\");\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/workspace/create.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { writeWorkspaceId } from \"../../preferences.js\";\n\nexport default class Create extends NimbaseCommand {\n static description = \"Create a workspace\";\n static args = {\n name: Args.string({ description: \"workspace name\", required: true }),\n };\n static flags = {\n select: Flags.boolean({\n description: \"select the new workspace\",\n default: true,\n allowNo: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Create);\n try {\n const workspace = await this.api.createWorkspace(\n await this.requireToken(),\n args.name.trim(),\n );\n if (flags.select) await writeWorkspaceId(workspace.id);\n this.log(`Created ${workspace.name} (${workspace.slug}).`);\n if (flags.select) this.log(\"Selected the new workspace.\");\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,MAAM,aAAa;AAK5B,IAAqB,SAArB,MAAqB,gBAAe,eAAe;AAAA,EACjD,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,MAAM,KAAK,OAAO,EAAE,aAAa,kBAAkB,UAAU,KAAK,CAAC;AAAA,EACrE;AAAA,EACA,OAAO,QAAQ;AAAA,IACb,QAAQ,MAAM,QAAQ;AAAA,MACpB,aAAa;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,OAAM;AAC/C,QAAI;AACF,YAAM,YAAY,MAAM,KAAK,IAAI;AAAA,QAC/B,MAAM,KAAK,aAAa;AAAA,QACxB,KAAK,KAAK,KAAK;AAAA,MACjB;AACA,UAAI,MAAM,OAAQ,OAAM,iBAAiB,UAAU,EAAE;AACrD,WAAK,IAAI,WAAW,UAAU,IAAI,KAAK,UAAU,IAAI,IAAI;AACzD,UAAI,MAAM,OAAQ,MAAK,IAAI,6BAA6B;AAAA,IAC1D,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NimbaseCommand,
|
|
2
3
|
readWorkspaceId
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import {
|
|
5
|
-
NimbaseCommand
|
|
6
|
-
} from "../../chunk-47FIFCKS.js";
|
|
4
|
+
} from "../../chunk-KKZVWJDK.js";
|
|
7
5
|
|
|
8
6
|
// src/commands/workspace/current.ts
|
|
9
7
|
var Current = class _Current extends NimbaseCommand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/workspace/current.ts"],"sourcesContent":["import { NimbaseCommand } from \"../../base-command.js\";\nimport { readWorkspaceId } from \"../../preferences.js\";\n\nexport default class Current extends NimbaseCommand {\n static description = \"Show the selected workspace\";\n\n async run(): Promise<void> {\n await this.parse(Current);\n const selectedId = await readWorkspaceId();\n if (!selectedId)\n this.error(\n \"No workspace selected. Run `nimbase workspace select <workspace>`.\",\n );\n let workspaces;\n try {\n workspaces = await this.api.listWorkspaces(await this.requireToken());\n } catch (error) {\n return this.handleError(error);\n }\n const workspace = workspaces.find(\n (candidate) => candidate.id === selectedId,\n );\n if (!workspace)\n this.error(\"The selected workspace is no longer available.\");\n this.log(`${workspace.slug}\\t${workspace.name}\\t${workspace.id}`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/workspace/current.ts"],"sourcesContent":["import { NimbaseCommand } from \"../../base-command.js\";\nimport { readWorkspaceId } from \"../../preferences.js\";\n\nexport default class Current extends NimbaseCommand {\n static description = \"Show the selected workspace\";\n\n async run(): Promise<void> {\n await this.parse(Current);\n const selectedId = await readWorkspaceId();\n if (!selectedId)\n this.error(\n \"No workspace selected. Run `nimbase workspace select <workspace>`.\",\n );\n let workspaces;\n try {\n workspaces = await this.api.listWorkspaces(await this.requireToken());\n } catch (error) {\n return this.handleError(error);\n }\n const workspace = workspaces.find(\n (candidate) => candidate.id === selectedId,\n );\n if (!workspace)\n this.error(\"The selected workspace is no longer available.\");\n this.log(`${workspace.slug}\\t${workspace.name}\\t${workspace.id}`);\n }\n}\n"],"mappings":";;;;;;AAGA,IAAqB,UAArB,MAAqB,iBAAgB,eAAe;AAAA,EAClD,OAAO,cAAc;AAAA,EAErB,MAAM,MAAqB;AACzB,UAAM,KAAK,MAAM,QAAO;AACxB,UAAM,aAAa,MAAM,gBAAgB;AACzC,QAAI,CAAC;AACH,WAAK;AAAA,QACH;AAAA,MACF;AACF,QAAI;AACJ,QAAI;AACF,mBAAa,MAAM,KAAK,IAAI,eAAe,MAAM,KAAK,aAAa,CAAC;AAAA,IACtE,SAAS,OAAO;AACd,aAAO,KAAK,YAAY,KAAK;AAAA,IAC/B;AACA,UAAM,YAAY,WAAW;AAAA,MAC3B,CAAC,cAAc,UAAU,OAAO;AAAA,IAClC;AACA,QAAI,CAAC;AACH,WAAK,MAAM,gDAAgD;AAC7D,SAAK,IAAI,GAAG,UAAU,IAAI,IAAK,UAAU,IAAI,IAAK,UAAU,EAAE,EAAE;AAAA,EAClE;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/workspace/list.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { readWorkspaceId } from \"../../preferences.js\";\n\nexport default class List extends NimbaseCommand {\n static description = \"List your workspaces\";\n static flags = {\n json: Flags.boolean({ description: \"output JSON\" }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n try {\n const [workspaces, selectedId] = await Promise.all([\n this.api.listWorkspaces(await this.requireToken()),\n readWorkspaceId(),\n ]);\n if (flags.json) {\n this.log(JSON.stringify(workspaces, null, 2));\n return;\n }\n if (workspaces.length === 0) {\n this.log(\"No workspaces found.\");\n return;\n }\n for (const workspace of workspaces) {\n this.log(\n `${workspace.id === selectedId ? \"*\" : \" \"} ${workspace.slug}\\t${workspace.name}`,\n );\n }\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/workspace/list.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { readWorkspaceId } from \"../../preferences.js\";\n\nexport default class List extends NimbaseCommand {\n static description = \"List your workspaces\";\n static flags = {\n json: Flags.boolean({ description: \"output JSON\" }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n try {\n const [workspaces, selectedId] = await Promise.all([\n this.api.listWorkspaces(await this.requireToken()),\n readWorkspaceId(),\n ]);\n if (flags.json) {\n this.log(JSON.stringify(workspaces, null, 2));\n return;\n }\n if (workspaces.length === 0) {\n this.log(\"No workspaces found.\");\n return;\n }\n for (const workspace of workspaces) {\n this.log(\n `${workspace.id === selectedId ? \"*\" : \" \"} ${workspace.slug}\\t${workspace.name}`,\n );\n }\n } catch (error) {\n await this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,aAAa;AAKtB,IAAqB,OAArB,MAAqB,cAAa,eAAe;AAAA,EAC/C,OAAO,cAAc;AAAA,EACrB,OAAO,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,EAAE,aAAa,cAAc,CAAC;AAAA,EACpD;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,IAAI,MAAM,KAAK,MAAM,KAAI;AACvC,QAAI;AACF,YAAM,CAAC,YAAY,UAAU,IAAI,MAAM,QAAQ,IAAI;AAAA,QACjD,KAAK,IAAI,eAAe,MAAM,KAAK,aAAa,CAAC;AAAA,QACjD,gBAAgB;AAAA,MAClB,CAAC;AACD,UAAI,MAAM,MAAM;AACd,aAAK,IAAI,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;AAC5C;AAAA,MACF;AACA,UAAI,WAAW,WAAW,GAAG;AAC3B,aAAK,IAAI,sBAAsB;AAC/B;AAAA,MACF;AACA,iBAAW,aAAa,YAAY;AAClC,aAAK;AAAA,UACH,GAAG,UAAU,OAAO,aAAa,MAAM,GAAG,IAAI,UAAU,IAAI,IAAK,UAAU,IAAI;AAAA,QACjF;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,KAAK,YAAY,KAAK;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/workspace/select.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { writeWorkspaceId } from \"../../preferences.js\";\n\nexport default class Select extends NimbaseCommand {\n static description = \"Select a workspace by slug or ID\";\n static args = {\n workspace: Args.string({\n description: \"workspace slug or ID\",\n required: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Select);\n let workspaces;\n try {\n workspaces = await this.api.listWorkspaces(await this.requireToken());\n } catch (error) {\n return this.handleError(error);\n }\n const workspace = workspaces.find(\n (candidate) =>\n candidate.id === args.workspace || candidate.slug === args.workspace,\n );\n if (!workspace) this.error(`Workspace not found: ${args.workspace}`);\n await writeWorkspaceId(workspace.id);\n this.log(`Selected ${workspace.name} (${workspace.slug}).`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/workspace/select.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\n\nimport { NimbaseCommand } from \"../../base-command.js\";\nimport { writeWorkspaceId } from \"../../preferences.js\";\n\nexport default class Select extends NimbaseCommand {\n static description = \"Select a workspace by slug or ID\";\n static args = {\n workspace: Args.string({\n description: \"workspace slug or ID\",\n required: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Select);\n let workspaces;\n try {\n workspaces = await this.api.listWorkspaces(await this.requireToken());\n } catch (error) {\n return this.handleError(error);\n }\n const workspace = workspaces.find(\n (candidate) =>\n candidate.id === args.workspace || candidate.slug === args.workspace,\n );\n if (!workspace) this.error(`Workspace not found: ${args.workspace}`);\n await writeWorkspaceId(workspace.id);\n this.log(`Selected ${workspace.name} (${workspace.slug}).`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,YAAY;AAKrB,IAAqB,SAArB,MAAqB,gBAAe,eAAe;AAAA,EACjD,OAAO,cAAc;AAAA,EACrB,OAAO,OAAO;AAAA,IACZ,WAAW,KAAK,OAAO;AAAA,MACrB,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,MAAM,OAAM;AACxC,QAAI;AACJ,QAAI;AACF,mBAAa,MAAM,KAAK,IAAI,eAAe,MAAM,KAAK,aAAa,CAAC;AAAA,IACtE,SAAS,OAAO;AACd,aAAO,KAAK,YAAY,KAAK;AAAA,IAC/B;AACA,UAAM,YAAY,WAAW;AAAA,MAC3B,CAAC,cACC,UAAU,OAAO,KAAK,aAAa,UAAU,SAAS,KAAK;AAAA,IAC/D;AACA,QAAI,CAAC,UAAW,MAAK,MAAM,wBAAwB,KAAK,SAAS,EAAE;AACnE,UAAM,iBAAiB,UAAU,EAAE;AACnC,SAAK,IAAI,YAAY,UAAU,IAAI,KAAK,UAAU,IAAI,IAAI;AAAA,EAC5D;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Command-line client for Nimbase company memory",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"typecheck": "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@inquirer/prompts": "^8.0.1",
|
|
38
37
|
"@oclif/core": "^4.5.4",
|
|
39
38
|
"@t3-oss/env-core": "^0.13.8",
|
|
40
39
|
"zod": "^4.4.3"
|
|
@@ -55,7 +54,18 @@
|
|
|
55
54
|
"bin": "nimbase",
|
|
56
55
|
"dirname": "nimbase",
|
|
57
56
|
"commands": "./dist/commands",
|
|
58
|
-
"topicSeparator": " "
|
|
57
|
+
"topicSeparator": " ",
|
|
58
|
+
"topics": {
|
|
59
|
+
"auth": {
|
|
60
|
+
"description": "Manage your Nimbase session"
|
|
61
|
+
},
|
|
62
|
+
"connector": {
|
|
63
|
+
"description": "Connect and manage external knowledge sources"
|
|
64
|
+
},
|
|
65
|
+
"workspace": {
|
|
66
|
+
"description": "Create, list, and select workspaces"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
59
69
|
},
|
|
60
70
|
"prettier": "@nimbase/prettier-config"
|
|
61
71
|
}
|