@revos/cli 0.3.0 → 0.3.2
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 +30 -4
- package/dist/adapters/oclif/commands/action-runs/get.mjs +1 -1
- package/dist/adapters/oclif/commands/action-runs/list.mjs +1 -1
- package/dist/adapters/oclif/commands/actions/get-input-schema.mjs +2 -2
- package/dist/adapters/oclif/commands/actions/get-params-schema.mjs +2 -2
- package/dist/adapters/oclif/commands/actions/get.mjs +1 -1
- package/dist/adapters/oclif/commands/actions/list.mjs +2 -2
- package/dist/adapters/oclif/commands/ai-instructions/create.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/get.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/list.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/update.mjs +1 -1
- package/dist/adapters/oclif/commands/api.mjs +2 -2
- package/dist/adapters/oclif/commands/apply.d.mts +1 -1
- package/dist/adapters/oclif/commands/apply.mjs +2 -2
- package/dist/adapters/oclif/commands/auth/login.mjs +10 -30
- package/dist/adapters/oclif/commands/auth/logout.mjs +2 -2
- package/dist/adapters/oclif/commands/auth/status.mjs +2 -2
- package/dist/adapters/oclif/commands/connections/create.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/get.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/list.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/update.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/create.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/get.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/list.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/meta.d.mts +6 -0
- package/dist/adapters/oclif/commands/cubes/meta.mjs +45 -0
- package/dist/adapters/oclif/commands/cubes/query.d.mts +6 -0
- package/dist/adapters/oclif/commands/cubes/query.mjs +51 -0
- package/dist/adapters/oclif/commands/cubes/update.mjs +1 -1
- package/dist/adapters/oclif/commands/diff.d.mts +1 -1
- package/dist/adapters/oclif/commands/diff.mjs +2 -2
- package/dist/adapters/oclif/commands/gservice-account-keys/get.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-account-keys/reveal.mjs +2 -2
- package/dist/adapters/oclif/commands/gservice-accounts/create.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/get.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/list.mjs +1 -1
- package/dist/adapters/oclif/commands/init.mjs +12 -3
- package/dist/adapters/oclif/commands/org/create.mjs +1 -1
- package/dist/adapters/oclif/commands/org/current.mjs +2 -2
- package/dist/adapters/oclif/commands/org/get.mjs +1 -1
- package/dist/adapters/oclif/commands/org/list.mjs +2 -2
- package/dist/adapters/oclif/commands/org/switch.mjs +2 -2
- package/dist/adapters/oclif/commands/pull.d.mts +1 -1
- package/dist/adapters/oclif/commands/pull.mjs +2 -2
- package/dist/adapters/oclif/commands/score-groups/create.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/get.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/list.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/update.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/create.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/list.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/update.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/create.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/evaluate.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get-evaluation-history.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get-version.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/list-versions.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/list.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/restore-version.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/update.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/create.mjs +2 -2
- package/dist/adapters/oclif/commands/sources/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/get.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/list-streams.mjs +2 -2
- package/dist/adapters/oclif/commands/sources/list.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/update.mjs +2 -2
- package/dist/adapters/oclif/commands/status.d.mts +1 -1
- package/dist/adapters/oclif/commands/status.mjs +3 -3
- package/dist/adapters/oclif/commands/table-views/create.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/list.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/update.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/create.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/get.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/list.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/update.mjs +1 -1
- package/dist/{base.command-BLken6pU.mjs → base.command-CnVb4RG6.mjs} +1 -1
- package/dist/{core-DsGA_HuL.mjs → core-CY9pC37x.mjs} +37 -2
- package/dist/{factory-eslVs9tN.mjs → factory-DTqayaCF.mjs} +2 -2
- package/dist/{index-Blr5iiwc.d.mts → index-Cbb9pLt6.d.mts} +14 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{presets-D0AIVsGO.mjs → presets-mJzFGMhG.mjs} +2 -2
- package/dist/templates/.devcontainer/post-start.sh +4 -8
- package/dist/templates/.devcontainer/welcome.sh +8 -9
- package/dist/templates/README.md +4 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -87,11 +87,11 @@ If the destination already exists and is not empty, you will be prompted to conf
|
|
|
87
87
|
|
|
88
88
|
**What it does (in-project — re-run inside an existing `revos.yaml` tree):**
|
|
89
89
|
|
|
90
|
-
`revos init` becomes idempotent: it skips the org prompt, skips scaffolding (no overwriting of existing files), skips IaC discovery, and only provisions the GCP service account key if `~/.revos/{project-name}-gsa-creds.json` is missing. Useful inside the Dev Container
|
|
90
|
+
`revos init` becomes idempotent: it skips the org prompt, skips scaffolding (no overwriting of existing files), skips IaC discovery, and only provisions the GCP service account key if `~/.revos/{project-name}-gsa-creds.json` is missing. If you aren't authenticated yet, it opens the browser to sign in first — the org is taken from `revos.yaml`, so no picker is shown. Useful inside the Dev Container, where the named credentials volume starts empty: a single `revos init` both signs you in and materializes the GSA key. Outside the container, re-running is a safe no-op if everything is already in place.
|
|
91
91
|
|
|
92
|
-
**Dev Container onboarding flow:** open project in VS Code → "Reopen in Container" → run `revos
|
|
92
|
+
**Dev Container onboarding flow:** open project in VS Code → "Reopen in Container" → run `revos init`. The first run signs you in via the browser and provisions the GSA key. Subsequent container starts auto-activate the service account via `postStartCommand`.
|
|
93
93
|
|
|
94
|
-
**Requires:** `revos auth login` first (greenfield
|
|
94
|
+
**Requires:** `revos auth login` first (greenfield, since the multi-org picker and `--dev` selection live there). In-project init handles login itself.
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
@@ -406,7 +406,7 @@ The CLI exposes every method of `@revos/api-client` as a topic-prefixed command.
|
|
|
406
406
|
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
407
407
|
| `tables` | `list`, `get`, `create`, `update`, `delete` |
|
|
408
408
|
| `table-views` | `list`, `create`, `update`, `delete` |
|
|
409
|
-
| `cubes` | `list`, `get`, `create`, `update`, `delete`
|
|
409
|
+
| `cubes` | `list`, `get`, `create`, `update`, `delete`, `query`, `meta` |
|
|
410
410
|
| `connections` | `list`, `get`, `create`, `update`, `delete` |
|
|
411
411
|
| `scores` | `list`, `create`, `update`, `delete` |
|
|
412
412
|
| `score-groups` | `list`, `get`, `create`, `update`, `delete` |
|
|
@@ -463,6 +463,32 @@ revos actions get-params-schema act_789
|
|
|
463
463
|
revos gservice-account-keys reveal key_abc
|
|
464
464
|
```
|
|
465
465
|
|
|
466
|
+
#### Query the semantic model (`cubes query` / `cubes meta`)
|
|
467
|
+
|
|
468
|
+
`revos cubes meta` lists every cube and view exposed by the org's semantic
|
|
469
|
+
model along with its measures, dimensions, and segments — use it to discover
|
|
470
|
+
the member names you can reference in a query.
|
|
471
|
+
|
|
472
|
+
`revos cubes query` runs a Cube.js query and prints the resulting rows.
|
|
473
|
+
`--query` accepts inline JSON, `@path/to/file.json`, or `-` to read from
|
|
474
|
+
stdin. The payload may either be a bare query object or wrapped as
|
|
475
|
+
`{ "query": { ... } }`. Rows render as a table by default; pass `--json`
|
|
476
|
+
for the full response payload.
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
revos cubes meta
|
|
480
|
+
revos cubes meta --json | jq '.cubes[0]'
|
|
481
|
+
|
|
482
|
+
# inline
|
|
483
|
+
revos cubes query --query '{"measures":["Orders.count"]}'
|
|
484
|
+
|
|
485
|
+
# file
|
|
486
|
+
revos cubes query --query @./query.json --json
|
|
487
|
+
|
|
488
|
+
# stdin
|
|
489
|
+
echo '{"measures":["Orders.count"],"dimensions":["Orders.status"]}' | revos cubes query
|
|
490
|
+
```
|
|
491
|
+
|
|
466
492
|
---
|
|
467
493
|
|
|
468
494
|
### Raw API access (`revos api`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/actions/get-input-schema.ts
|
|
5
5
|
var get_input_schema_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/actions/get-params-schema.ts
|
|
5
5
|
var get_params_schema_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { n as createListRender, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { n as createListRender, r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import { Flags } from "@oclif/core";
|
|
4
4
|
var list_default = defineApiCommand({
|
|
5
5
|
description: "List available actions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCommand } from "../../../../presets-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/create.ts
|
|
3
3
|
var create_default = createCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as deleteCommand } from "../../../../presets-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/delete.ts
|
|
3
3
|
var delete_default = deleteCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as updateCommand } from "../../../../presets-
|
|
1
|
+
import { a as updateCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/update.ts
|
|
3
3
|
var update_default = updateCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as defineApiCommand, t as bodyFlag } from "../../../factory-
|
|
1
|
+
import { G as ApiError } from "../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { r as defineApiCommand, t as bodyFlag } from "../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import { client } from "@revos/api-client";
|
|
4
4
|
import { Args, Flags } from "@oclif/core";
|
|
5
5
|
//#region src/adapters/oclif/commands/api.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as AppliedResource } from "../../../index-
|
|
1
|
+
import { f as AppliedResource } from "../../../index-Cbb9pLt6.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, m as apply, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, m as apply, v as discoverProject, y as projectRoot } from "../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import { n as renderIacErrors, t as APPLY_ACTION_LABELS } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { D as resolveApiUrl, I as setAuthConfig, L as setAuthEnv, O as performOAuthLogin, V as getCredentialsPath, W as saveCredentials, b as createApiClient, k as AUTH_ENVS, l as resolveProjectContext, n as selectOrganization, x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { Flags } from "@oclif/core";
|
|
5
|
-
import open from "open";
|
|
6
5
|
//#region src/adapters/oclif/commands/auth/login.ts
|
|
7
6
|
var AuthLogin = class extends BaseCommand {
|
|
8
7
|
static projectContextMode = "relaxed";
|
|
@@ -24,42 +23,23 @@ var AuthLogin = class extends BaseCommand {
|
|
|
24
23
|
authClientId: flags["auth-client-id"]
|
|
25
24
|
});
|
|
26
25
|
if (!this.jsonEnabled()) this.log("Starting authentication...\n");
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
this.log(` ${authorizationUrl}\n`);
|
|
35
|
-
this.log("Waiting for authentication... (Press Ctrl+C to cancel)\n");
|
|
36
|
-
}
|
|
37
|
-
await open(authorizationUrl);
|
|
38
|
-
const callbackResult = await server.waitForCallback();
|
|
39
|
-
if (callbackResult.state !== pkce.state) throw new Error("Invalid state parameter. Authentication may have been tampered with.");
|
|
40
|
-
if (!this.jsonEnabled()) this.log("Received authorization code, exchanging for tokens...\n");
|
|
41
|
-
const tokenResponse = await exchangeCodeForTokens(callbackResult.code, redirectUri, pkce.codeVerifier);
|
|
42
|
-
const userInfo = await getUserInfo(tokenResponse.access_token);
|
|
43
|
-
const credentials = tokenResponseToCredentials(tokenResponse, userInfo);
|
|
44
|
-
const apiUrl = apiUrlOverride ?? process.env.REVOS_API_URL ?? "https://api.revos.ai";
|
|
45
|
-
const activeAuth = getActiveAuthConfig();
|
|
46
|
-
credentials.apiUrl = apiUrl;
|
|
47
|
-
credentials.authUrl = activeAuth.authUrl;
|
|
48
|
-
credentials.authClientId = activeAuth.authClientId;
|
|
49
|
-
saveCredentials(credentials);
|
|
26
|
+
const apiUrl = apiUrlOverride ?? resolveApiUrl();
|
|
27
|
+
const projectCtx = resolveProjectContext();
|
|
28
|
+
const { credentials, userInfo } = await performOAuthLogin({
|
|
29
|
+
apiUrl,
|
|
30
|
+
organizationId: projectCtx?.orgId,
|
|
31
|
+
log: this.jsonEnabled() ? void 0 : (msg) => this.log(msg)
|
|
32
|
+
});
|
|
50
33
|
if (!this.jsonEnabled()) {
|
|
51
34
|
this.log(chalk.green(`\nAuthenticated as ${userInfo.email || userInfo.sub}`));
|
|
52
35
|
this.log(`\nCredentials saved to ${getCredentialsPath()}`);
|
|
53
36
|
}
|
|
54
|
-
const projectCtx = resolveProjectContext();
|
|
55
37
|
if (projectCtx) {
|
|
56
|
-
credentials.organizationId = projectCtx.orgId;
|
|
57
|
-
saveCredentials(credentials);
|
|
58
38
|
if (!this.jsonEnabled()) this.log(chalk.green(`\nUsing organization from revos.yaml: ${projectCtx.orgId}`));
|
|
59
39
|
} else try {
|
|
60
40
|
const orgs = unwrap(await createApiClient({
|
|
61
41
|
apiUrl,
|
|
62
|
-
token:
|
|
42
|
+
token: credentials.accessToken
|
|
63
43
|
}).organizations.list());
|
|
64
44
|
if (orgs.length === 1) {
|
|
65
45
|
credentials.organizationId = orgs[0].id;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { B as deleteCredentials } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
//#region src/adapters/oclif/commands/auth/logout.ts
|
|
5
5
|
var AuthLogout = class extends BaseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { H as isTokenExpired, U as loadCredentials, V as getCredentialsPath, l as resolveProjectContext } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
//#region src/adapters/oclif/commands/auth/status.ts
|
|
5
5
|
var AuthStatus = class extends BaseCommand {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
//#region src/adapters/oclif/commands/cubes/meta.ts
|
|
5
|
+
var meta_default = defineApiCommand({
|
|
6
|
+
description: "List cubes and views in the semantic model with their measures, dimensions, and segments.",
|
|
7
|
+
examples: ["<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --json"],
|
|
8
|
+
call: async ({ api }) => {
|
|
9
|
+
return unwrap(await api.cubes.meta());
|
|
10
|
+
},
|
|
11
|
+
render: (data, command) => {
|
|
12
|
+
const cubes = data?.cubes ?? [];
|
|
13
|
+
if (cubes.length === 0) {
|
|
14
|
+
command.log("(no cubes)");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
for (const cube of cubes) {
|
|
18
|
+
const heading = cube.title ? `${cube.name} — ${cube.title}` : cube.name;
|
|
19
|
+
command.log(chalk.bold(heading));
|
|
20
|
+
const members = [
|
|
21
|
+
...(cube.measures ?? []).map((m) => ({
|
|
22
|
+
kind: "measure",
|
|
23
|
+
...m
|
|
24
|
+
})),
|
|
25
|
+
...(cube.dimensions ?? []).map((m) => ({
|
|
26
|
+
kind: "dimension",
|
|
27
|
+
...m
|
|
28
|
+
})),
|
|
29
|
+
...(cube.segments ?? []).map((m) => ({
|
|
30
|
+
kind: "segment",
|
|
31
|
+
...m
|
|
32
|
+
}))
|
|
33
|
+
];
|
|
34
|
+
if (members.length === 0) command.log(" (no members)");
|
|
35
|
+
else for (const m of members) {
|
|
36
|
+
const suffix = m.type ? ` :${m.type}` : "";
|
|
37
|
+
const title = m.title ? ` ${chalk.dim(m.title)}` : "";
|
|
38
|
+
command.log(` ${chalk.gray(m.kind.padEnd(9))} ${m.name}${suffix}${title}`);
|
|
39
|
+
}
|
|
40
|
+
command.log("");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
export { meta_default as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { i as renderList, r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { Flags } from "@oclif/core";
|
|
6
|
+
//#region src/adapters/oclif/commands/cubes/query.ts
|
|
7
|
+
var query_default = defineApiCommand({
|
|
8
|
+
description: "Run a Cube.js query against the semantic model and print the resulting rows.",
|
|
9
|
+
examples: [
|
|
10
|
+
"<%= config.bin %> <%= command.id %> --query '{\"measures\":[\"Orders.count\"]}'",
|
|
11
|
+
"<%= config.bin %> <%= command.id %> --query @./query.json --json",
|
|
12
|
+
"echo '{\"measures\":[\"Orders.count\"]}' | <%= config.bin %> <%= command.id %>"
|
|
13
|
+
],
|
|
14
|
+
flags: { query: Flags.string({
|
|
15
|
+
description: "Cube.js query. Inline JSON, '@path' to read from a file, or '-' / omitted to read from stdin.",
|
|
16
|
+
helpValue: "JSON|@file|-"
|
|
17
|
+
}) },
|
|
18
|
+
call: async ({ api, flags }) => {
|
|
19
|
+
const parsed = parseQueryJson(await readQueryInput(flags.query));
|
|
20
|
+
const query = typeof parsed === "object" && parsed !== null && "query" in parsed ? parsed.query : parsed;
|
|
21
|
+
return unwrap(await api.cubes.query({ body: { query } }));
|
|
22
|
+
},
|
|
23
|
+
render: (data, command) => {
|
|
24
|
+
renderList(command, data ?? []);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
async function readQueryInput(flagValue) {
|
|
28
|
+
if (flagValue === void 0 || flagValue === "-") {
|
|
29
|
+
if (process.stdin.isTTY && flagValue !== "-") throw new Error("--query is required (inline JSON, '@path' for file, or '-' for stdin)");
|
|
30
|
+
return readStdin();
|
|
31
|
+
}
|
|
32
|
+
if (flagValue.startsWith("@")) {
|
|
33
|
+
const filePath = path.resolve(process.cwd(), flagValue.slice(1));
|
|
34
|
+
return fs.readFileSync(filePath, "utf8");
|
|
35
|
+
}
|
|
36
|
+
return flagValue;
|
|
37
|
+
}
|
|
38
|
+
function parseQueryJson(raw) {
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(raw);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
throw new Error(`--query is not valid JSON: ${err.message}`, { cause: err });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function readStdin() {
|
|
46
|
+
const chunks = [];
|
|
47
|
+
for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
48
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { query_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as AppliedResource } from "../../../index-
|
|
1
|
+
import { f as AppliedResource } from "../../../index-Cbb9pLt6.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, h as formatDiffLine, m as apply, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, h as formatDiffLine, m as apply, v as discoverProject, y as projectRoot } from "../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import { n as renderIacErrors, t as APPLY_ACTION_LABELS } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getCommand } from "../../../../presets-
|
|
1
|
+
import { r as getCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-account-keys/get.ts
|
|
3
3
|
var get_default = getCommand({
|
|
4
4
|
resource: "gserviceAccountKeys",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import { Args } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/gservice-account-keys/reveal.ts
|
|
5
5
|
var reveal_default = defineApiCommand({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCommand } from "../../../../presets-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-accounts/create.ts
|
|
3
3
|
var create_default = createCommand({
|
|
4
4
|
resource: "gserviceAccounts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as deleteCommand } from "../../../../presets-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-accounts/delete.ts
|
|
3
3
|
var delete_default = deleteCommand({
|
|
4
4
|
resource: "gserviceAccounts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as listCommand } from "../../../../presets-
|
|
1
|
+
import { i as listCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-accounts/list.ts
|
|
3
3
|
var list_default = listCommand({
|
|
4
4
|
resource: "gserviceAccounts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as getConfig,
|
|
1
|
+
import { D as resolveApiUrl, E as getConfig, G as ApiError, O as performOAuthLogin, U as loadCredentials, l as resolveProjectContext, t as InitService } from "../../../core-CY9pC37x.mjs";
|
|
2
2
|
import { TEMPLATES_DIR } from "../../../templates/index.mjs";
|
|
3
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
3
|
+
import { t as BaseCommand } from "../../../base.command-CnVb4RG6.mjs";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import chalk from "chalk";
|
|
@@ -34,10 +34,19 @@ var Init = class extends BaseCommand {
|
|
|
34
34
|
})
|
|
35
35
|
};
|
|
36
36
|
async run() {
|
|
37
|
-
const { apiUrl, token, organizationId } = await getConfig();
|
|
38
37
|
const projectDir = this.args.destination ? path.resolve(this.args.destination) : process.cwd();
|
|
39
38
|
const service = new InitService(TEMPLATES_DIR);
|
|
40
39
|
const projectCtx = fs.existsSync(projectDir) ? resolveProjectContext({ cwd: projectDir }) : null;
|
|
40
|
+
if (projectCtx && !this.flags["dry-run"] && !loadCredentials()) {
|
|
41
|
+
this.log("Not authenticated. Opening browser to sign in...\n");
|
|
42
|
+
const { userInfo } = await performOAuthLogin({
|
|
43
|
+
apiUrl: resolveApiUrl(),
|
|
44
|
+
organizationId: projectCtx.orgId,
|
|
45
|
+
log: (msg) => this.log(msg)
|
|
46
|
+
});
|
|
47
|
+
this.log(chalk.green(`\nAuthenticated as ${userInfo.email || userInfo.sub}`));
|
|
48
|
+
}
|
|
49
|
+
const { apiUrl, token, organizationId } = await getConfig();
|
|
41
50
|
if (projectCtx) {
|
|
42
51
|
await this.runInProject({
|
|
43
52
|
apiUrl,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig,
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, U as loadCredentials, b as createApiClient, l as resolveProjectContext, x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
//#region src/adapters/oclif/commands/org/current.ts
|
|
5
5
|
var OrgCurrent = class extends BaseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveProjectContext, x as unwrap } from "../../../../core-
|
|
2
|
-
import { a as resolveColumns, i as renderList, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { l as resolveProjectContext, x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { a as resolveColumns, i as renderList, r as defineApiCommand } from "../../../../factory-DTqayaCF.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { Flags } from "@oclif/core";
|
|
5
5
|
//#region src/adapters/oclif/commands/org/list.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig,
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, U as loadCredentials, W as saveCredentials, a as formatInProjectSwitchWarning, b as createApiClient, l as resolveProjectContext, n as selectOrganization, x as unwrap } from "../../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as PulledResource } from "../../../index-
|
|
1
|
+
import { d as PulledResource } from "../../../index-Cbb9pLt6.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, p as pull, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, p as pull, v as discoverProject, y as projectRoot } from "../../../core-CY9pC37x.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-CnVb4RG6.mjs";
|
|
3
3
|
import { n as renderIacErrors } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCommand } from "../../../../presets-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/create.ts
|
|
3
3
|
var create_default = createCommand({
|
|
4
4
|
resource: "scoreGroups",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as deleteCommand } from "../../../../presets-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-mJzFGMhG.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/delete.ts
|
|
3
3
|
var delete_default = deleteCommand({
|
|
4
4
|
resource: "scoreGroups",
|