@axtrabase/cli 0.1.1 → 0.1.3
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 +43 -8
- package/dist/api-types.d.ts +34 -0
- package/dist/api-types.d.ts.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +38 -3
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context.d.ts +91 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +116 -9
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/events.d.ts +56 -0
- package/dist/commands/events.d.ts.map +1 -0
- package/dist/commands/events.js +202 -0
- package/dist/commands/events.js.map +1 -0
- package/dist/commands/keys.js +16 -0
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/login.js +14 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/status.js +22 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tables.js +69 -12
- package/dist/commands/tables.js.map +1 -1
- package/dist/config/environments.d.ts +43 -0
- package/dist/config/environments.d.ts.map +1 -0
- package/dist/config/environments.js +43 -0
- package/dist/config/environments.js.map +1 -0
- package/dist/config/resolve.d.ts +34 -4
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +71 -11
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/store.d.ts +4 -2
- package/dist/config/store.d.ts.map +1 -1
- package/dist/config/store.js +1 -0
- package/dist/config/store.js.map +1 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +9 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/generators/typescript.d.ts.map +1 -1
- package/dist/generators/typescript.js +23 -6
- package/dist/generators/typescript.js.map +1 -1
- package/dist/http/authenticated-client.d.ts +14 -0
- package/dist/http/authenticated-client.d.ts.map +1 -1
- package/dist/http/authenticated-client.js +38 -1
- package/dist/http/authenticated-client.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/output/print.d.ts +8 -0
- package/dist/output/print.d.ts.map +1 -1
- package/dist/output/print.js +10 -0
- package/dist/output/print.js.map +1 -1
- package/dist/prompt-masked.d.ts +3 -1
- package/dist/prompt-masked.d.ts.map +1 -1
- package/dist/prompt-masked.js +23 -2
- package/dist/prompt-masked.js.map +1 -1
- package/dist/report-error.d.ts.map +1 -1
- package/dist/report-error.js +14 -0
- package/dist/report-error.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -10
package/dist/config/resolve.d.ts
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type AxtraEnvironment, type AxtraEnvironmentName } from "./environments.js";
|
|
2
|
+
/**
|
|
3
|
+
* Kept as the *default environment's* origins rather than hard-coded
|
|
4
|
+
* production ones, so nothing can reintroduce the Sprint #11 P0-2 split
|
|
5
|
+
* where the API defaulted to one environment and the dashboard to another.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_API_URL: string;
|
|
8
|
+
export declare const DEFAULT_DASHBOARD_URL: string;
|
|
9
|
+
/** explicit flag > AXTRABASE_ENV > saved config > DEFAULT_ENVIRONMENT. */
|
|
10
|
+
export declare function resolveEnvironmentName(flagValue?: string): AxtraEnvironmentName;
|
|
11
|
+
export declare function resolveEnvironment(flagValue?: string): AxtraEnvironment;
|
|
12
|
+
/** explicit flag > AXTRABASE_API_URL > saved config > the active environment's API origin. */
|
|
4
13
|
export declare function resolveApiUrl(flagValue?: string): string;
|
|
5
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Resolved as one half of a PAIR, never independently (Sprint #11 P0-2).
|
|
16
|
+
*
|
|
17
|
+
* After the usual explicit sources, the dashboard follows whichever
|
|
18
|
+
* environment the resolved API URL belongs to — so configuring only the API
|
|
19
|
+
* can never again leave the dashboard pointing at a different (or
|
|
20
|
+
* undeployed) environment. A custom API origin with no dashboard override
|
|
21
|
+
* falls back to the active environment's dashboard.
|
|
22
|
+
*
|
|
23
|
+
* An explicit dashboard that belongs to a *different* known environment than
|
|
24
|
+
* the resolved API is a mismatch and throws rather than being silently
|
|
25
|
+
* accepted: that combination cannot produce a working login.
|
|
26
|
+
*/
|
|
6
27
|
export declare function resolveDashboardUrl(flagValue?: string): string;
|
|
7
28
|
/** explicit flag > AXTRABASE_PROJECT environment variable > saved config (build brief §9, §26). */
|
|
8
29
|
export declare function resolveProjectId(flagValue?: string): string | undefined;
|
|
@@ -19,4 +40,13 @@ export interface ResolvedToken {
|
|
|
19
40
|
* never written to disk.
|
|
20
41
|
*/
|
|
21
42
|
export declare function resolveToken(): ResolvedToken | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* AXTRABASE_API_KEY environment variable — the ONLY source for a data-plane
|
|
45
|
+
* API key (Events Sprint Item #10 §1). Unlike the CLI token, a raw API key
|
|
46
|
+
* has no saved-config/credential-file fallback to check here: `keys create`
|
|
47
|
+
* shows it exactly once (see commands/keys.ts) and this CLI never persists
|
|
48
|
+
* it, so there is nothing on disk that could ever supply one. Read fresh on
|
|
49
|
+
* every call, same as resolveToken's env branch — never cached or logged.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveApiKey(): string | undefined;
|
|
22
52
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAA2C,CAAC;AACxE,eAAO,MAAM,qBAAqB,QAAiD,CAAC;AAMpF,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAa/E;AAED,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAEvE;AAED,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CA4B9D;AAED,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5E;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,aAAa,GAAG,SAAS,CAMxD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAGlD"}
|
package/dist/config/resolve.js
CHANGED
|
@@ -1,22 +1,70 @@
|
|
|
1
1
|
import { CredentialStore } from "./credentials.js";
|
|
2
2
|
import { ConfigStore } from "./store.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
3
|
+
import { CliError } from "../http/errors.js";
|
|
4
|
+
import { DEFAULT_ENVIRONMENT, ENVIRONMENTS, environmentForApiUrl, environmentForDashboardUrl, isEnvironmentName } from "./environments.js";
|
|
5
|
+
/**
|
|
6
|
+
* Kept as the *default environment's* origins rather than hard-coded
|
|
7
|
+
* production ones, so nothing can reintroduce the Sprint #11 P0-2 split
|
|
8
|
+
* where the API defaulted to one environment and the dashboard to another.
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_API_URL = ENVIRONMENTS[DEFAULT_ENVIRONMENT].apiUrl;
|
|
11
|
+
export const DEFAULT_DASHBOARD_URL = ENVIRONMENTS[DEFAULT_ENVIRONMENT].dashboardUrl;
|
|
12
|
+
function trimTrailingSlash(value) {
|
|
13
|
+
return value.replace(/\/$/, "");
|
|
14
|
+
}
|
|
15
|
+
/** explicit flag > AXTRABASE_ENV > saved config > DEFAULT_ENVIRONMENT. */
|
|
16
|
+
export function resolveEnvironmentName(flagValue) {
|
|
17
|
+
const raw = flagValue ?? process.env.AXTRABASE_ENV ?? new ConfigStore().read().environment;
|
|
18
|
+
if (raw === undefined)
|
|
19
|
+
return DEFAULT_ENVIRONMENT;
|
|
20
|
+
const value = raw.trim().toLowerCase();
|
|
21
|
+
if (!isEnvironmentName(value)) {
|
|
22
|
+
throw new CliError("AXTRA_CLI_VALIDATION_ERROR", `Unknown AxtraBase environment "${raw}". Expected one of: ${Object.keys(ENVIRONMENTS).join(", ")}.`, { status: 0 });
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
export function resolveEnvironment(flagValue) {
|
|
27
|
+
return ENVIRONMENTS[resolveEnvironmentName(flagValue)];
|
|
28
|
+
}
|
|
29
|
+
/** explicit flag > AXTRABASE_API_URL > saved config > the active environment's API origin. */
|
|
6
30
|
export function resolveApiUrl(flagValue) {
|
|
7
31
|
const value = flagValue ??
|
|
8
32
|
process.env.AXTRABASE_API_URL ??
|
|
9
33
|
new ConfigStore().read().apiUrl ??
|
|
10
|
-
|
|
11
|
-
return value
|
|
34
|
+
resolveEnvironment().apiUrl;
|
|
35
|
+
return trimTrailingSlash(value);
|
|
12
36
|
}
|
|
13
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Resolved as one half of a PAIR, never independently (Sprint #11 P0-2).
|
|
39
|
+
*
|
|
40
|
+
* After the usual explicit sources, the dashboard follows whichever
|
|
41
|
+
* environment the resolved API URL belongs to — so configuring only the API
|
|
42
|
+
* can never again leave the dashboard pointing at a different (or
|
|
43
|
+
* undeployed) environment. A custom API origin with no dashboard override
|
|
44
|
+
* falls back to the active environment's dashboard.
|
|
45
|
+
*
|
|
46
|
+
* An explicit dashboard that belongs to a *different* known environment than
|
|
47
|
+
* the resolved API is a mismatch and throws rather than being silently
|
|
48
|
+
* accepted: that combination cannot produce a working login.
|
|
49
|
+
*/
|
|
14
50
|
export function resolveDashboardUrl(flagValue) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
51
|
+
const apiUrl = resolveApiUrl();
|
|
52
|
+
const apiEnvironment = environmentForApiUrl(apiUrl);
|
|
53
|
+
const explicit = flagValue ?? process.env.AXTRABASE_DASHBOARD_URL ?? new ConfigStore().read().dashboardUrl;
|
|
54
|
+
if (explicit !== undefined) {
|
|
55
|
+
const dashboardUrl = trimTrailingSlash(explicit);
|
|
56
|
+
const dashboardEnvironment = environmentForDashboardUrl(dashboardUrl);
|
|
57
|
+
if (apiEnvironment &&
|
|
58
|
+
dashboardEnvironment &&
|
|
59
|
+
dashboardEnvironment.name !== apiEnvironment.name) {
|
|
60
|
+
throw new CliError("AXTRA_CLI_ENVIRONMENT_MISMATCH", `The configured API (${apiUrl}) is AxtraBase ${apiEnvironment.name}, but the configured dashboard (${dashboardUrl}) is ${dashboardEnvironment.name}. ` +
|
|
61
|
+
`Logging in against mismatched origins cannot work. Set both to one environment — "axtrabase config set environment ${apiEnvironment.name}" pairs them for you.`, { status: 0 });
|
|
62
|
+
}
|
|
63
|
+
return dashboardUrl;
|
|
64
|
+
}
|
|
65
|
+
// No explicit dashboard: pair it to the API's environment when the API is
|
|
66
|
+
// a known origin, otherwise fall back to the active environment.
|
|
67
|
+
return trimTrailingSlash((apiEnvironment ?? resolveEnvironment()).dashboardUrl);
|
|
20
68
|
}
|
|
21
69
|
/** explicit flag > AXTRABASE_PROJECT environment variable > saved config (build brief §9, §26). */
|
|
22
70
|
export function resolveProjectId(flagValue) {
|
|
@@ -38,4 +86,16 @@ export function resolveToken() {
|
|
|
38
86
|
const stored = new CredentialStore().read();
|
|
39
87
|
return stored ? { token: stored.token, source: "file" } : undefined;
|
|
40
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* AXTRABASE_API_KEY environment variable — the ONLY source for a data-plane
|
|
91
|
+
* API key (Events Sprint Item #10 §1). Unlike the CLI token, a raw API key
|
|
92
|
+
* has no saved-config/credential-file fallback to check here: `keys create`
|
|
93
|
+
* shows it exactly once (see commands/keys.ts) and this CLI never persists
|
|
94
|
+
* it, so there is nothing on disk that could ever supply one. Read fresh on
|
|
95
|
+
* every call, same as resolveToken's env branch — never cached or logged.
|
|
96
|
+
*/
|
|
97
|
+
export function resolveApiKey() {
|
|
98
|
+
const value = process.env.AXTRABASE_API_KEY;
|
|
99
|
+
return value && value.length > 0 ? value : undefined;
|
|
100
|
+
}
|
|
41
101
|
//# sourceMappingURL=resolve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,0BAA0B,EAC1B,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,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,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACjD,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAE/E,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC;IAC5C,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC5C,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC"}
|
package/dist/config/store.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export interface CliConfig {
|
|
2
|
-
/**
|
|
2
|
+
/** Selects a whole AxtraBase environment (api + dashboard + docs origins together) — see config/environments.ts. Preferred over setting apiUrl/dashboardUrl by hand. */
|
|
3
|
+
environment?: string;
|
|
4
|
+
/** Overrides the active environment's API origin — see http/base-url.ts for the full precedence order. */
|
|
3
5
|
apiUrl?: string;
|
|
4
|
-
/**
|
|
6
|
+
/** Overrides the dashboard origin `axtrabase login` sends a user to. Normally unnecessary: the dashboard is paired to the API's environment automatically (Sprint #11 P0-2), and an override belonging to a different environment is rejected rather than silently used. */
|
|
5
7
|
dashboardUrl?: string;
|
|
6
8
|
organisationId?: string;
|
|
7
9
|
organisationSlug?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/config/store.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/config/store.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,wKAAwK;IACxK,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4QAA4Q;IAC5Q,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,IAAI,IAAI,SAAS;IAiBjB,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAK9B,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS;IAM5C,+GAA+G;IAC/G,KAAK,CAAC,GAAG,EAAE,MAAM,SAAS,GAAG,SAAS;CAMvC"}
|
package/dist/config/store.js
CHANGED
package/dist/config/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/config/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/config/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAe5C,MAA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M,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;CAQb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE,qLAAqL;AACrL,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAgC3D"}
|
package/dist/exit-codes.js
CHANGED
|
@@ -20,6 +20,12 @@ export function exitCodeForErrorCode(code) {
|
|
|
20
20
|
case "AXTRA_CLI_TOKEN_EXPIRED":
|
|
21
21
|
case "AXTRA_API_KEY_REVOKED":
|
|
22
22
|
case "AXTRA_CLI_NOT_LOGGED_IN":
|
|
23
|
+
case "AXTRA_CLI_NO_API_KEY":
|
|
24
|
+
case "AXTRA_CLI_NON_INTERACTIVE":
|
|
25
|
+
// AXTRA_CLI_NON_INTERACTIVE is `login` with no terminal to prompt at.
|
|
26
|
+
// Its remedy is supplying a credential (AXTRABASE_CLI_TOKEN), so agents
|
|
27
|
+
// and CI get the same "authentication required" signal they already
|
|
28
|
+
// branch on. See prompt-masked.ts (Sprint #11 P1-10).
|
|
23
29
|
return EXIT_CODES.AUTHENTICATION_REQUIRED;
|
|
24
30
|
case "AXTRA_AUTHORISATION_ERROR":
|
|
25
31
|
case "AXTRA_TABLE_PERMISSION_DENIED":
|
|
@@ -32,6 +38,9 @@ export function exitCodeForErrorCode(code) {
|
|
|
32
38
|
case "AXTRA_VALIDATION_ERROR":
|
|
33
39
|
case "AXTRA_CLI_VALIDATION_ERROR":
|
|
34
40
|
case "AXTRA_CLI_NO_ACTIVE_PROJECT":
|
|
41
|
+
case "AXTRA_CLI_ENVIRONMENT_MISMATCH":
|
|
42
|
+
// A mismatched API/dashboard pair is misconfiguration the caller can
|
|
43
|
+
// fix, not a server-side failure — see config/environments.ts.
|
|
35
44
|
return EXIT_CODES.INVALID_ARGUMENTS;
|
|
36
45
|
default:
|
|
37
46
|
return EXIT_CODES.GENERIC_FAILURE;
|
package/dist/exit-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,CAAC;IAClB,uBAAuB,EAAE,CAAC;IAC1B,oBAAoB,EAAE,CAAC;IACvB,SAAS,EAAE,CAAC;IACZ,oBAAoB,EAAE,CAAC;IACvB,iBAAiB,EAAE,CAAC;CACZ,CAAC;AAIX,qLAAqL;AACrL,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,4BAA4B,CAAC;QAClC,KAAK,yBAAyB,CAAC;QAC/B,KAAK,yBAAyB,CAAC;QAC/B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,yBAAyB;
|
|
1
|
+
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,CAAC;IACV,eAAe,EAAE,CAAC;IAClB,uBAAuB,EAAE,CAAC;IAC1B,oBAAoB,EAAE,CAAC;IACvB,SAAS,EAAE,CAAC;IACZ,oBAAoB,EAAE,CAAC;IACvB,iBAAiB,EAAE,CAAC;CACZ,CAAC;AAIX,qLAAqL;AACrL,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,4BAA4B,CAAC;QAClC,KAAK,yBAAyB,CAAC;QAC/B,KAAK,yBAAyB,CAAC;QAC/B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,yBAAyB,CAAC;QAC/B,KAAK,sBAAsB,CAAC;QAC5B,KAAK,2BAA2B;YAC9B,sEAAsE;YACtE,wEAAwE;YACxE,oEAAoE;YACpE,sDAAsD;YACtD,OAAO,UAAU,CAAC,uBAAuB,CAAC;QAC5C,KAAK,2BAA2B,CAAC;QACjC,KAAK,+BAA+B;YAClC,OAAO,UAAU,CAAC,oBAAoB,CAAC;QACzC,KAAK,wBAAwB,CAAC;QAC9B,KAAK,uBAAuB;YAC1B,OAAO,UAAU,CAAC,SAAS,CAAC;QAC9B,KAAK,4BAA4B;YAC/B,OAAO,UAAU,CAAC,oBAAoB,CAAC;QACzC,KAAK,wBAAwB,CAAC;QAC9B,KAAK,4BAA4B,CAAC;QAClC,KAAK,6BAA6B,CAAC;QACnC,KAAK,gCAAgC;YACnC,qEAAqE;YACrE,+DAA+D;YAC/D,OAAO,UAAU,CAAC,iBAAiB,CAAC;QACtC;YACE,OAAO,UAAU,CAAC,eAAe,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA4D1E,gIAAgI;AAChI,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAItE;AAwBD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAGhF"}
|
|
@@ -23,6 +23,10 @@ const TS_TYPE_BY_COLUMN_TYPE = {
|
|
|
23
23
|
owner: "string",
|
|
24
24
|
state: "number",
|
|
25
25
|
status: "number",
|
|
26
|
+
// Dataverse serves File/Image content as a base64 string (or a file id) —
|
|
27
|
+
// never a structured object — over the Web API.
|
|
28
|
+
file: "string",
|
|
29
|
+
image: "string",
|
|
26
30
|
unknown: "unknown"
|
|
27
31
|
};
|
|
28
32
|
function toPascalCase(logicalName) {
|
|
@@ -32,10 +36,21 @@ function toPascalCase(logicalName) {
|
|
|
32
36
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
33
37
|
.join("");
|
|
34
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Requiredness is part of the schema contract, so it survives into the
|
|
41
|
+
* generated type: a Dataverse-required column is emitted as present and
|
|
42
|
+
* non-nullable, everything else stays optional + nullable (a Dataverse read
|
|
43
|
+
* need not return every column). Emitting required business fields as
|
|
44
|
+
* optional silently told every consumer a value might be absent when the
|
|
45
|
+
* platform guarantees it (Sprint #11 P1-8).
|
|
46
|
+
*/
|
|
35
47
|
function fieldLine(column) {
|
|
36
48
|
const tsType = TS_TYPE_BY_COLUMN_TYPE[column.type] ?? "unknown";
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
// The primary key is always present; a required column is guaranteed by
|
|
50
|
+
// Dataverse to hold a value.
|
|
51
|
+
const alwaysPresent = column.isPrimaryId || column.isRequired;
|
|
52
|
+
const optional = alwaysPresent ? "" : "?";
|
|
53
|
+
const nullable = alwaysPresent ? "" : " | null";
|
|
39
54
|
return ` ${column.logicalName}${optional}: ${tsType}${nullable};`;
|
|
40
55
|
}
|
|
41
56
|
/** Generates a single `export interface` for one table's columns, over metadata fetched via HTTP (never Dataverse directly). */
|
|
@@ -55,10 +70,12 @@ function generatedHeader(tableNames) {
|
|
|
55
70
|
" * Generated by `axtrabase schema export --format typescript` — do not edit by hand.",
|
|
56
71
|
` * Tables: ${tableNames.join(", ")}`,
|
|
57
72
|
" *",
|
|
58
|
-
" *
|
|
59
|
-
" *
|
|
60
|
-
" *
|
|
61
|
-
" *
|
|
73
|
+
" * What these interfaces do NOT encode. AxtraBase resolves all of it —",
|
|
74
|
+
" * run `axtrabase tables describe <table>` to see it — it is simply not",
|
|
75
|
+
" * expressed in the generated types:",
|
|
76
|
+
" * - Relationships (many-to-one, one-to-many, many-to-many).",
|
|
77
|
+
" * - Choice option values: a choice column is typed `number` (the",
|
|
78
|
+
" * underlying option value), not a literal union of its known options.",
|
|
62
79
|
" */",
|
|
63
80
|
""
|
|
64
81
|
].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,sBAAsB,GAA2B;IACrD,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,SAAS,YAAY,CAAC,WAAmB;IACvC,OAAO,WAAW;SACf,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,MAAmB;IACpC,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;IAChE,MAAM,
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG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AC;AACrE,CAAC;AAED,gIAAgI;AAChI,MAAM,UAAU,iBAAiB,CAAC,KAA4B;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,oBAAoB,IAAI,IAAI,EAAE,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,UAAoB;IAC3C,OAAO;QACL,KAAK;QACL,sFAAsF;QACtF,cAAc,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACrC,IAAI;QACJ,wEAAwE;QACxE,yEAAyE;QACzE,sCAAsC;QACtC,8DAA8D;QAC9D,mEAAmE;QACnE,0EAA0E;QAC1E,KAAK;QACL,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAA+B;IACtE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AAC9F,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EventsClient } from "@axtrabase/sdk";
|
|
1
2
|
import { ControlPlaneClient } from "./client.js";
|
|
2
3
|
export interface ClientOverrides {
|
|
3
4
|
apiUrl?: string;
|
|
@@ -7,4 +8,17 @@ export interface ClientOverrides {
|
|
|
7
8
|
export declare function createControlPlaneClient(overrides?: ClientOverrides): ControlPlaneClient;
|
|
8
9
|
/** Every command that needs to act as a signed-in user calls this — throws a clear, exit-code-2 error rather than letting an unauthenticated request 401 confusingly deep inside a command. */
|
|
9
10
|
export declare function requireControlPlaneClient(overrides?: ClientOverrides): ControlPlaneClient;
|
|
11
|
+
/**
|
|
12
|
+
* Events (Events Sprint Item #10) — and any future consumer of AxtraBase's
|
|
13
|
+
* Public Data API — are project-scoped data-plane resources authenticated
|
|
14
|
+
* by an API key, never the control-plane CLI token. ADR-013 draws this
|
|
15
|
+
* boundary deliberately: an API key is meant to be safe to embed in a
|
|
16
|
+
* server-side app's environment, scoped to exactly one project's data,
|
|
17
|
+
* while a CLI token can enumerate organisations and manage keys — the two
|
|
18
|
+
* must never share a credential namespace. This wraps @axtrabase/sdk's own
|
|
19
|
+
* `AxtraBase` client rather than hand-building HTTP calls, so the CLI
|
|
20
|
+
* exercises exactly the same public SDK customers use (§18) — never
|
|
21
|
+
* `ControlPlaneClient` for this, and never a third credential model.
|
|
22
|
+
*/
|
|
23
|
+
export declare function requireEventsClient(overrides?: ClientOverrides): EventsClient;
|
|
10
24
|
//# sourceMappingURL=authenticated-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-client.d.ts","sourceRoot":"","sources":["../../src/http/authenticated-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authenticated-client.d.ts","sourceRoot":"","sources":["../../src/http/authenticated-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yJAAyJ;AACzJ,wBAAgB,wBAAwB,CAAC,SAAS,GAAE,eAAoB,GAAG,kBAAkB,CAM5F;AAED,+LAA+L;AAC/L,wBAAgB,yBAAyB,CAAC,SAAS,GAAE,eAAoB,GAAG,kBAAkB,CAc7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,eAAoB,GAAG,YAAY,CA+BjF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxtraBase } from "@axtrabase/sdk";
|
|
2
|
+
import { resolveApiKey, resolveApiUrl, resolveOrganisationId, resolveToken } from "../config/resolve.js";
|
|
2
3
|
import { ControlPlaneClient } from "./client.js";
|
|
3
4
|
import { CliError } from "./errors.js";
|
|
4
5
|
/** For the rare command that works whether or not the caller is logged in (none in v1, but keeps the option open) — never throws for a missing token. */
|
|
@@ -21,4 +22,40 @@ export function requireControlPlaneClient(overrides = {}) {
|
|
|
21
22
|
organisationId: resolveOrganisationId(overrides.organisationId)
|
|
22
23
|
});
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Events (Events Sprint Item #10) — and any future consumer of AxtraBase's
|
|
27
|
+
* Public Data API — are project-scoped data-plane resources authenticated
|
|
28
|
+
* by an API key, never the control-plane CLI token. ADR-013 draws this
|
|
29
|
+
* boundary deliberately: an API key is meant to be safe to embed in a
|
|
30
|
+
* server-side app's environment, scoped to exactly one project's data,
|
|
31
|
+
* while a CLI token can enumerate organisations and manage keys — the two
|
|
32
|
+
* must never share a credential namespace. This wraps @axtrabase/sdk's own
|
|
33
|
+
* `AxtraBase` client rather than hand-building HTTP calls, so the CLI
|
|
34
|
+
* exercises exactly the same public SDK customers use (§18) — never
|
|
35
|
+
* `ControlPlaneClient` for this, and never a third credential model.
|
|
36
|
+
*/
|
|
37
|
+
export function requireEventsClient(overrides = {}) {
|
|
38
|
+
const apiKey = resolveApiKey();
|
|
39
|
+
if (!apiKey) {
|
|
40
|
+
throw new CliError("AXTRA_CLI_NO_API_KEY", "No API key available. Events are data-plane resources authenticated by a project API key, not your CLI login.\n\n" +
|
|
41
|
+
"Create one if you don't have one yet:\n" +
|
|
42
|
+
" axtrabase keys create --name <name>\n\n" +
|
|
43
|
+
"Then set it for this shell (never persisted or logged by this CLI):\n" +
|
|
44
|
+
" export AXTRABASE_API_KEY=<the printed key>", { status: 0 });
|
|
45
|
+
}
|
|
46
|
+
const events = new AxtraBase({ apiKey, baseUrl: resolveApiUrl(overrides.apiUrl) }).events;
|
|
47
|
+
if (!events) {
|
|
48
|
+
// Defends against an out-of-date installed @axtrabase/sdk that
|
|
49
|
+
// predates its Events surface (the `.events` getter didn't exist
|
|
50
|
+
// before it): a real `npm install` can resolve an older published
|
|
51
|
+
// version than this CLI was built/tested against. Without this check,
|
|
52
|
+
// the very next `.list()`/`.get()`/`.stream()` call throws a raw
|
|
53
|
+
// TypeError ("Cannot read properties of undefined") instead of a
|
|
54
|
+
// clean, actionable error (build brief §16 — no stack trace for an
|
|
55
|
+
// expected condition).
|
|
56
|
+
throw new CliError("AXTRA_CLI_SDK_OUT_OF_DATE", "The installed @axtrabase/sdk does not support Events. Update it:\n\n" +
|
|
57
|
+
" npm install @axtrabase/sdk@latest", { status: 0 });
|
|
58
|
+
}
|
|
59
|
+
return events;
|
|
60
|
+
}
|
|
24
61
|
//# sourceMappingURL=authenticated-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-client.js","sourceRoot":"","sources":["../../src/http/authenticated-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"authenticated-client.js","sourceRoot":"","sources":["../../src/http/authenticated-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,yJAAyJ;AACzJ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C/D,iEAAiE;QACjE,kEAAkE;QAClE,sEAAsE;QACtE,iEAAiE;QACjE,iEAAiE;QACjE,mEAAmE;QACnE,uBAAuB;QACvB,MAAM,IAAI,QAAQ,CAChB,2BAA2B,EAC3B,sEAAsE;YACpE,qCAAqC,EACvC,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { registerConfigCommand } from "./commands/config.js";
|
|
|
4
4
|
import { registerConnectionCommand } from "./commands/connection.js";
|
|
5
5
|
import { registerContextCommand } from "./commands/context.js";
|
|
6
6
|
import { registerDocsCommand } from "./commands/docs.js";
|
|
7
|
+
import { registerEventsCommand } from "./commands/events.js";
|
|
7
8
|
import { registerKeysCommand } from "./commands/keys.js";
|
|
8
9
|
import { registerLoginCommand } from "./commands/login.js";
|
|
9
10
|
import { registerLogoutCommand } from "./commands/logout.js";
|
|
@@ -41,6 +42,7 @@ registerSchemaCommand(program);
|
|
|
41
42
|
registerPermissionsCommand(program);
|
|
42
43
|
registerKeysCommand(program);
|
|
43
44
|
registerRequestsCommand(program);
|
|
45
|
+
registerEventsCommand(program);
|
|
44
46
|
registerConfigCommand(program);
|
|
45
47
|
registerDocsCommand(program);
|
|
46
48
|
registerOpenApiCommand(program);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC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CAAC,CAAC;AAC9B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,4BAA4B,CAAC,OAAO,CAAC,CAAC;AACtC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,yBAAyB,CAAC,OAAO,CAAC,CAAC;AACnC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACpC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAEhC,IAAI,CAAC;IACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,uEAAuE;QACvE,sEAAsE;QACtE,iEAAiE;QACjE,oEAAoE;QACpE,mEAAmE;QACnE,mCAAmC;QACnC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC"}
|
package/dist/output/print.d.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* shells don't glue the next prompt onto the output.
|
|
7
7
|
*/
|
|
8
8
|
export declare function printJson(data: unknown): void;
|
|
9
|
+
/**
|
|
10
|
+
* One compact JSON object per call, deliberately not pretty-printed — the
|
|
11
|
+
* NDJSON contract `events tail --json` needs (Events Sprint Item #10 §13):
|
|
12
|
+
* exactly one line per event, safe to pipe into `jq`/a shell loop. Never
|
|
13
|
+
* use `printJson` for a streaming command — its 2-space pretty-print would
|
|
14
|
+
* break "one object per line."
|
|
15
|
+
*/
|
|
16
|
+
export declare function printJsonLine(data: unknown): void;
|
|
9
17
|
/** Progress/warnings never belong on stdout when --json is active — see build brief §22 ("stdout = machine-readable result only"). */
|
|
10
18
|
export declare function printProgress(message: string): void;
|
|
11
19
|
/** A sanitized single line of human-facing stdout output. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../src/output/print.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,sIAAsI;AACtI,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAW,GAAG,IAAI,CAEjD;AAED,qKAAqK;AACrK,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAKtE"}
|
|
1
|
+
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../src/output/print.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED,sIAAsI;AACtI,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAW,GAAG,IAAI,CAEjD;AAED,qKAAqK;AACrK,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAKtE"}
|
package/dist/output/print.js
CHANGED
|
@@ -9,6 +9,16 @@ import { sanitizeForTerminal } from "./sanitize.js";
|
|
|
9
9
|
export function printJson(data) {
|
|
10
10
|
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* One compact JSON object per call, deliberately not pretty-printed — the
|
|
14
|
+
* NDJSON contract `events tail --json` needs (Events Sprint Item #10 §13):
|
|
15
|
+
* exactly one line per event, safe to pipe into `jq`/a shell loop. Never
|
|
16
|
+
* use `printJson` for a streaming command — its 2-space pretty-print would
|
|
17
|
+
* break "one object per line."
|
|
18
|
+
*/
|
|
19
|
+
export function printJsonLine(data) {
|
|
20
|
+
process.stdout.write(`${JSON.stringify(data)}\n`);
|
|
21
|
+
}
|
|
12
22
|
/** Progress/warnings never belong on stdout when --json is active — see build brief §22 ("stdout = machine-readable result only"). */
|
|
13
23
|
export function printProgress(message) {
|
|
14
24
|
process.stderr.write(`${message}\n`);
|
package/dist/output/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/output/print.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,sIAAsI;AACtI,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC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e,EAAE;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,qKAAqK;AACrK,MAAM,UAAU,kBAAkB,CAAC,IAA6B;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;QAClC,SAAS,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
package/dist/prompt-masked.d.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* brief §5 treats the token as sensitive from the moment it's entered).
|
|
5
5
|
* Falls back to an unmasked `readline` prompt when stdin isn't a TTY (piped
|
|
6
6
|
* input, most test environments) since there's no terminal to mask against
|
|
7
|
-
* and raw mode isn't available there anyway.
|
|
7
|
+
* and raw mode isn't available there anyway. That fallback rejects with
|
|
8
|
+
* `AXTRA_CLI_NON_INTERACTIVE` if stdin closes without an answer, rather than
|
|
9
|
+
* hanging — see promptUnmasked.
|
|
8
10
|
*
|
|
9
11
|
* Control characters (Enter, Backspace, Ctrl-C, Ctrl-D) are matched via
|
|
10
12
|
* `String.fromCharCode` rather than escape-sequence literals in this file's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-masked.d.ts","sourceRoot":"","sources":["../src/prompt-masked.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-masked.d.ts","sourceRoot":"","sources":["../src/prompt-masked.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDhE"}
|
package/dist/prompt-masked.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createInterface } from "node:readline";
|
|
2
|
+
import { CliError } from "./http/errors.js";
|
|
2
3
|
const ENTER_CHARS = new Set(["\n", "\r"]);
|
|
3
4
|
const BACKSPACE_CHARS = new Set([String.fromCharCode(127), "\b"]);
|
|
4
5
|
const CTRL_C = String.fromCharCode(3);
|
|
@@ -9,7 +10,9 @@ const CTRL_D = String.fromCharCode(4);
|
|
|
9
10
|
* brief §5 treats the token as sensitive from the moment it's entered).
|
|
10
11
|
* Falls back to an unmasked `readline` prompt when stdin isn't a TTY (piped
|
|
11
12
|
* input, most test environments) since there's no terminal to mask against
|
|
12
|
-
* and raw mode isn't available there anyway.
|
|
13
|
+
* and raw mode isn't available there anyway. That fallback rejects with
|
|
14
|
+
* `AXTRA_CLI_NON_INTERACTIVE` if stdin closes without an answer, rather than
|
|
15
|
+
* hanging — see promptUnmasked.
|
|
13
16
|
*
|
|
14
17
|
* Control characters (Enter, Backspace, Ctrl-C, Ctrl-D) are matched via
|
|
15
18
|
* `String.fromCharCode` rather than escape-sequence literals in this file's
|
|
@@ -64,12 +67,30 @@ export function promptMasked(promptText) {
|
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
function promptUnmasked(promptText) {
|
|
67
|
-
return new Promise((resolve) => {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
68
71
|
const rl = createInterface({ input: process.stdin, output: process.stdout, terminal: false });
|
|
72
|
+
// readline's `question` callback only ever fires on a completed line, so
|
|
73
|
+
// a stdin that reaches EOF with nothing on it (an agent or CI job running
|
|
74
|
+
// `axtrabase login` with no terminal and no piped answer) would otherwise
|
|
75
|
+
// leave this promise pending forever — the command hung and the caller
|
|
76
|
+
// saw raw Node runtime output instead of an AxtraBase error. Settling on
|
|
77
|
+
// `close` makes that case deliberate. See Sprint #11 P1-10.
|
|
78
|
+
let answered = false;
|
|
69
79
|
rl.question(promptText, (answer) => {
|
|
80
|
+
answered = true;
|
|
70
81
|
rl.close();
|
|
71
82
|
resolve(answer.trim());
|
|
72
83
|
});
|
|
84
|
+
rl.on("close", () => {
|
|
85
|
+
if (answered)
|
|
86
|
+
return;
|
|
87
|
+
reject(new CliError("AXTRA_CLI_NON_INTERACTIVE", "axtrabase login needs an interactive terminal to accept a pasted CLI token, and stdin provided none.\n\n" +
|
|
88
|
+
"For an agent or CI environment, supply the token directly instead of logging in:\n" +
|
|
89
|
+
" export AXTRABASE_CLI_TOKEN=axcli_...\n\n" +
|
|
90
|
+
"The token is read fresh on every command and is never written to disk. " +
|
|
91
|
+
"Create one from the dashboard (`axtrabase config get dashboard-url` shows which environment you are on), " +
|
|
92
|
+
"and revoke it with `axtrabase logout --revoke` when the session is done.", { status: 0 }));
|
|
93
|
+
});
|
|
73
94
|
});
|
|
74
95
|
}
|
|
75
96
|
//# sourceMappingURL=prompt-masked.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-masked.js","sourceRoot":"","sources":["../src/prompt-masked.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt-masked.js","sourceRoot":"","sources":["../src/prompt-masked.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,MAAM,GAAG,MAAM,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OAAO,EAAE,GAAG,EAAE;YAClB,IAAI,QAAQ;gBAAE,OAAO;YACrB,MAAM,CACJ,IAAI,QAAQ,CACV,2BAA2B,EAC3B,0GAA0G;gBACxG,oFAAoF;gBACpF,4CAA4C;gBAC5C,yEAAyE;gBACzE,2GAA2G;gBAC3G,0EAA0E,EAC5E,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-error.d.ts","sourceRoot":"","sources":["../src/report-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report-error.d.ts","sourceRoot":"","sources":["../src/report-error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAGnE,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sHAAsH;IACtH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,kBAAuB,GAAG,KAAK,CA8BnF;AA4BD,sNAAsN;AACtN,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC3B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/report-error.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxtraBaseError } from "@axtrabase/sdk";
|
|
1
2
|
import { CliError } from "./http/errors.js";
|
|
2
3
|
import { EXIT_CODES, exitCodeForErrorCode } from "./exit-codes.js";
|
|
3
4
|
import { printJson, printLine } from "./output/print.js";
|
|
@@ -40,6 +41,19 @@ export function reportError(error, options = {}) {
|
|
|
40
41
|
function toCliError(error) {
|
|
41
42
|
if (error instanceof CliError)
|
|
42
43
|
return error;
|
|
44
|
+
// Events commands call @axtrabase/sdk directly (build brief §18) rather
|
|
45
|
+
// than ControlPlaneClient, so a server-side failure arrives as an
|
|
46
|
+
// AxtraBaseError, not a CliError. Map it across field-for-field rather
|
|
47
|
+
// than falling into the generic Error branch below, which would collapse
|
|
48
|
+
// its real .code/.status/.requestId into AXTRA_CLI_UNEXPECTED_ERROR and
|
|
49
|
+
// break both exit-code mapping and "preserve typed API errors" (§3/§16).
|
|
50
|
+
if (error instanceof AxtraBaseError) {
|
|
51
|
+
return new CliError(error.code, error.message, {
|
|
52
|
+
status: error.status,
|
|
53
|
+
requestId: error.requestId,
|
|
54
|
+
cause: error.cause
|
|
55
|
+
});
|
|
56
|
+
}
|
|
43
57
|
if (error instanceof Error) {
|
|
44
58
|
return new CliError("AXTRA_CLI_UNEXPECTED_ERROR", error.message, { status: 0, cause: error });
|
|
45
59
|
}
|