@revos/cli 0.2.2 → 0.2.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 +19 -7
- 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 +3 -2
- package/dist/adapters/oclif/commands/apply.mjs +2 -2
- package/dist/adapters/oclif/commands/auth/login.d.mts +3 -2
- package/dist/adapters/oclif/commands/auth/login.mjs +3 -2
- package/dist/adapters/oclif/commands/auth/logout.d.mts +2 -1
- package/dist/adapters/oclif/commands/auth/logout.mjs +3 -2
- package/dist/adapters/oclif/commands/auth/status.d.mts +4 -2
- package/dist/adapters/oclif/commands/auth/status.mjs +23 -3
- 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/update.mjs +1 -1
- package/dist/adapters/oclif/commands/diff.d.mts +3 -2
- 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.d.mts +2 -1
- package/dist/adapters/oclif/commands/init.mjs +3 -2
- package/dist/adapters/oclif/commands/org/create.mjs +3 -2
- package/dist/adapters/oclif/commands/org/current.d.mts +12 -3
- package/dist/adapters/oclif/commands/org/current.mjs +27 -2
- package/dist/adapters/oclif/commands/org/get.mjs +3 -2
- package/dist/adapters/oclif/commands/org/list.mjs +15 -6
- package/dist/adapters/oclif/commands/org/switch.d.mts +3 -2
- package/dist/adapters/oclif/commands/org/switch.mjs +8 -2
- package/dist/adapters/oclif/commands/pull.d.mts +3 -2
- 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.d.mts +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.d.mts +1 -1
- package/dist/adapters/oclif/commands/sources/update.mjs +2 -2
- package/dist/adapters/oclif/commands/status.d.mts +3 -2
- 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-D7X3ZNtY.d.mts → base.command-BmddDbHa.d.mts} +4 -0
- package/dist/{base.command-cV5d65r8.mjs → base.command-D8taHOFF.mjs} +20 -2
- package/dist/context-D5uelKLe.d.mts +62 -0
- package/dist/{core-CMrP5BQS.mjs → core-B-IdeRNl.mjs} +71 -1
- package/dist/{factory-C6XLqhT9.mjs → factory-CCcimDhl.mjs} +3 -2
- package/dist/{index-BqKwXXAo.d.mts → index-D0ax2I61.d.mts} +25 -42
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/{presets-CJbFbHlw.mjs → presets-Bb9gwgeh.mjs} +7 -2
- package/dist/templates/.devcontainer/Dockerfile +9 -0
- package/dist/templates/.devcontainer/devcontainer.json +4 -1
- package/dist/templates/gitignore +3 -1
- package/dist/{types-CGjxcj4L.d.mts → types-Bk2Cb5yt.d.mts} +6 -0
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { o as OrgSwitchResult } from "../../../../types-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { o as OrgSwitchResult } from "../../../../types-Bk2Cb5yt.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BmddDbHa.mjs";
|
|
3
3
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/oclif/commands/org/switch.d.ts
|
|
6
6
|
declare class OrgSwitch extends BaseCommand<typeof OrgSwitch> {
|
|
7
7
|
static description: string;
|
|
8
|
+
static projectContextMode: "relaxed";
|
|
8
9
|
static args: {
|
|
9
10
|
id: _$_oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
|
|
10
11
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, H as saveCredentials, V as loadCredentials, a as formatInProjectSwitchWarning, b as createApiClient, l as resolveProjectContext, n as selectOrganization, x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-D8taHOFF.mjs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args } from "@oclif/core";
|
|
6
6
|
//#region src/adapters/oclif/commands/org/switch.ts
|
|
7
7
|
var OrgSwitch = class extends BaseCommand {
|
|
8
8
|
static description = "Switch to a different organization";
|
|
9
|
+
static projectContextMode = "relaxed";
|
|
9
10
|
static args = { id: Args.string({
|
|
10
11
|
description: "Organization ID",
|
|
11
12
|
required: false
|
|
@@ -29,6 +30,11 @@ var OrgSwitch = class extends BaseCommand {
|
|
|
29
30
|
...credentials,
|
|
30
31
|
organizationId: selected.id
|
|
31
32
|
});
|
|
33
|
+
const projectContext = resolveProjectContext();
|
|
34
|
+
if (projectContext && projectContext.orgId !== selected.id && !json) this.warn(formatInProjectSwitchWarning({
|
|
35
|
+
projectName: projectContext.projectFile.metadata.name,
|
|
36
|
+
projectOrgId: projectContext.orgId
|
|
37
|
+
}));
|
|
32
38
|
if (!json) this.log(chalk.green(`Switched to organization: ${selected.name}`));
|
|
33
39
|
return {
|
|
34
40
|
success: true,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { d as PulledResource } from "../../../index-D0ax2I61.mjs";
|
|
2
|
+
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
|
+
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
3
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
4
5
|
|
|
5
6
|
//#region src/adapters/oclif/commands/pull.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-D8taHOFF.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-Bb9gwgeh.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-Bb9gwgeh.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/delete.ts
|
|
3
3
|
var delete_default = deleteCommand({
|
|
4
4
|
resource: "scoreGroups",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as updateCommand } from "../../../../presets-
|
|
1
|
+
import { a as updateCommand } from "../../../../presets-Bb9gwgeh.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/update.ts
|
|
3
3
|
var update_default = updateCommand({
|
|
4
4
|
resource: "scoreGroups",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/segments/evaluate.ts
|
|
5
5
|
var evaluate_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/segments/get-evaluation-history.ts
|
|
5
5
|
var get_evaluation_history_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/segments/get-version.ts
|
|
5
5
|
var get_version_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createListRender, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { n as createListRender, r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
var list_versions_default = defineApiCommand({
|
|
5
5
|
description: "List versions of a segment",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/segments/restore-version.ts
|
|
5
5
|
var restore_version_default = defineApiCommand({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { t as BaseCommand } from "../../../../base.command-BmddDbHa.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/oclif/commands/sources/create.d.ts
|
|
4
4
|
declare class SourcesCreate extends BaseCommand<typeof SourcesCreate> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, S as resolveAppUrl } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-D8taHOFF.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import open from "open";
|
|
5
5
|
//#region src/adapters/oclif/commands/sources/create.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createListRender, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { n as createListRender, r as defineApiCommand } from "../../../../factory-CCcimDhl.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
var list_streams_default = defineApiCommand({
|
|
5
5
|
description: "List streams the source exposes (sync modes, cursor/PK candidates, field paths)",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { t as BaseCommand } from "../../../../base.command-BmddDbHa.mjs";
|
|
2
2
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/oclif/commands/sources/update.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, S as resolveAppUrl } from "../../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-D8taHOFF.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { Args } from "@oclif/core";
|
|
5
5
|
import open from "open";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { u as ResourceStatus } from "../../../index-D0ax2I61.mjs";
|
|
2
|
+
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
|
+
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
3
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
4
5
|
|
|
5
6
|
//#region src/adapters/oclif/commands/status.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
3
|
-
import { a as resolveColumns, i as renderList } from "../../../factory-
|
|
1
|
+
import { _ as buildIacRegistry, b as createApiClient, f as describeResources, g as loadResources, v as discoverProject, y as projectRoot } from "../../../core-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-D8taHOFF.mjs";
|
|
3
|
+
import { a as resolveColumns, i as renderList } from "../../../factory-CCcimDhl.mjs";
|
|
4
4
|
import { n as renderIacErrors } from "../../../iac-render-BSZZEP0n.mjs";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { n as ProjectContext } from "./context-D5uelKLe.mjs";
|
|
1
2
|
import { Command, Interfaces } from "@oclif/core";
|
|
2
3
|
import { TableOptions } from "@oclif/table";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/oclif/base.command.d.ts
|
|
5
6
|
type Flags$1<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)["baseFlags"] & T["flags"]>;
|
|
6
7
|
type Args$1<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;
|
|
8
|
+
type ProjectContextMode = "enforce" | "relaxed";
|
|
7
9
|
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
8
10
|
static enableJsonFlag: boolean;
|
|
11
|
+
static projectContextMode: ProjectContextMode;
|
|
9
12
|
static baseFlags: {
|
|
10
13
|
org: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
11
14
|
};
|
|
12
15
|
protected flags: Flags$1<T>;
|
|
13
16
|
protected args: Args$1<T>;
|
|
17
|
+
protected projectContext: ProjectContext | null;
|
|
14
18
|
init(): Promise<void>;
|
|
15
19
|
protected table<R extends Record<string, unknown>>(data: R[], options?: Omit<TableOptions<R>, "data">): void;
|
|
16
20
|
protected catch(err: Error & {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as setAuthConfig, U as ApiError, V as loadCredentials, i as formatEnvMismatchError, l as resolveProjectContext, o as formatProjectOrgFlagError, r as formatCredentialsMismatchWarning, u as validateEnvAgainstProject } from "./core-B-IdeRNl.mjs";
|
|
2
2
|
import { Command, Flags } from "@oclif/core";
|
|
3
3
|
import { makeTable } from "@oclif/table";
|
|
4
4
|
//#region src/adapters/oclif/base.command.ts
|
|
5
5
|
var BaseCommand = class extends Command {
|
|
6
6
|
static enableJsonFlag = true;
|
|
7
|
+
static projectContextMode = "enforce";
|
|
7
8
|
static baseFlags = { org: Flags.string({
|
|
8
9
|
char: "o",
|
|
9
10
|
description: "Override organization ID for this command"
|
|
10
11
|
}) };
|
|
11
12
|
flags;
|
|
12
13
|
args;
|
|
14
|
+
projectContext = null;
|
|
13
15
|
async init() {
|
|
14
16
|
await super.init();
|
|
15
17
|
const { flags, args } = await this.parse({
|
|
@@ -22,7 +24,23 @@ var BaseCommand = class extends Command {
|
|
|
22
24
|
this.flags = flags;
|
|
23
25
|
this.args = args;
|
|
24
26
|
applyStoredEnvironment();
|
|
25
|
-
|
|
27
|
+
this.projectContext = resolveProjectContext();
|
|
28
|
+
const mode = this.ctor.projectContextMode;
|
|
29
|
+
if (this.projectContext && mode === "enforce") {
|
|
30
|
+
if (this.flags.org && this.flags.org !== this.projectContext.orgId) this.error(formatProjectOrgFlagError({
|
|
31
|
+
projectOrgId: this.projectContext.orgId,
|
|
32
|
+
projectPath: this.projectContext.projectFile.path
|
|
33
|
+
}), { exit: 1 });
|
|
34
|
+
const mismatches = validateEnvAgainstProject(this.projectContext);
|
|
35
|
+
if (mismatches.length > 0) this.error(formatEnvMismatchError(mismatches, this.projectContext.projectFile.path), { exit: 1 });
|
|
36
|
+
process.env.REVOS_ORG_ID = this.projectContext.orgId;
|
|
37
|
+
const credentials = loadCredentials();
|
|
38
|
+
if (credentials?.organizationId && credentials.organizationId !== this.projectContext.orgId && !this.jsonEnabled()) this.warn(formatCredentialsMismatchWarning({
|
|
39
|
+
credentialsOrgId: credentials.organizationId,
|
|
40
|
+
projectOrgId: this.projectContext.orgId,
|
|
41
|
+
projectPath: this.projectContext.projectFile.path
|
|
42
|
+
}));
|
|
43
|
+
} else if (this.flags.org) process.env.REVOS_ORG_ID = this.flags.org;
|
|
26
44
|
}
|
|
27
45
|
table(data, options) {
|
|
28
46
|
this.log(makeTable({
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Document } from "yaml";
|
|
2
|
+
|
|
3
|
+
//#region src/core/iac/types.d.ts
|
|
4
|
+
declare const API_VERSION = "revos/v1";
|
|
5
|
+
interface SourceLocation {
|
|
6
|
+
file: string;
|
|
7
|
+
line?: number;
|
|
8
|
+
column?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ProjectFile {
|
|
11
|
+
path: string;
|
|
12
|
+
metadata: {
|
|
13
|
+
name?: string;
|
|
14
|
+
orgId: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface ResourceMetadata {
|
|
18
|
+
name: string;
|
|
19
|
+
id?: string;
|
|
20
|
+
}
|
|
21
|
+
type ResourceState = "ok" | "drifted" | "pending" | "tampered";
|
|
22
|
+
interface ResourceDoc<TSpec = unknown> {
|
|
23
|
+
kind: string;
|
|
24
|
+
metadata: ResourceMetadata;
|
|
25
|
+
spec: TSpec;
|
|
26
|
+
rawSpec: unknown;
|
|
27
|
+
source: SourceLocation;
|
|
28
|
+
docIndex: number;
|
|
29
|
+
document: Document;
|
|
30
|
+
}
|
|
31
|
+
type IacErrorCode = "apply" | "cycle" | "duplicate" | "env.missing" | "init.pull" | "invalid-name" | "pull" | "ref" | "schema" | "tampered" | "unknown-kind" | "yaml.parse";
|
|
32
|
+
interface IacError {
|
|
33
|
+
code: IacErrorCode;
|
|
34
|
+
message: string;
|
|
35
|
+
source?: SourceLocation;
|
|
36
|
+
hint?: string;
|
|
37
|
+
}
|
|
38
|
+
declare class IacAggregateError extends Error {
|
|
39
|
+
readonly errors: IacError[];
|
|
40
|
+
constructor(errors: IacError[]);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/core/context.d.ts
|
|
44
|
+
interface ProjectContext {
|
|
45
|
+
projectFile: ProjectFile;
|
|
46
|
+
projectPath: string;
|
|
47
|
+
orgId: string;
|
|
48
|
+
}
|
|
49
|
+
interface ResolveProjectContextOptions {
|
|
50
|
+
cwd?: string;
|
|
51
|
+
projectPath?: string;
|
|
52
|
+
}
|
|
53
|
+
declare function resolveProjectContext(opts?: ResolveProjectContextOptions): ProjectContext | null;
|
|
54
|
+
interface EnvMismatch {
|
|
55
|
+
variable: string;
|
|
56
|
+
envValue: string;
|
|
57
|
+
expected: string;
|
|
58
|
+
}
|
|
59
|
+
declare function validateEnvAgainstProject(ctx: ProjectContext, env?: NodeJS.ProcessEnv): EnvMismatch[];
|
|
60
|
+
declare function isInsideProject(cwd: string, projectContext: ProjectContext): boolean;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { validateEnvAgainstProject as a, IacError as c, ResourceDoc as d, ResourceMetadata as f, resolveProjectContext as i, IacErrorCode as l, SourceLocation as m, ProjectContext as n, API_VERSION as o, ResourceState as p, isInsideProject as r, IacAggregateError as s, EnvMismatch as t, ProjectFile as u };
|
|
@@ -2120,6 +2120,76 @@ var iac_exports = /* @__PURE__ */ __exportAll({
|
|
|
2120
2120
|
writeProjectFile: () => writeProjectFile
|
|
2121
2121
|
});
|
|
2122
2122
|
//#endregion
|
|
2123
|
+
//#region src/core/context.ts
|
|
2124
|
+
function resolveProjectContext(opts = {}) {
|
|
2125
|
+
try {
|
|
2126
|
+
const projectFile = discoverProject({
|
|
2127
|
+
cwd: opts.cwd,
|
|
2128
|
+
projectPath: opts.projectPath
|
|
2129
|
+
});
|
|
2130
|
+
return {
|
|
2131
|
+
projectFile,
|
|
2132
|
+
projectPath: projectRoot(projectFile),
|
|
2133
|
+
orgId: projectFile.metadata.orgId
|
|
2134
|
+
};
|
|
2135
|
+
} catch (err) {
|
|
2136
|
+
if (err instanceof ProjectNotFoundError) return null;
|
|
2137
|
+
throw err;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
function validateEnvAgainstProject(ctx, env = process.env) {
|
|
2141
|
+
const mismatches = [];
|
|
2142
|
+
const envOrgId = env.REVOS_ORG_ID;
|
|
2143
|
+
if (envOrgId && envOrgId !== ctx.orgId) mismatches.push({
|
|
2144
|
+
variable: "REVOS_ORG_ID",
|
|
2145
|
+
envValue: envOrgId,
|
|
2146
|
+
expected: ctx.orgId
|
|
2147
|
+
});
|
|
2148
|
+
return mismatches;
|
|
2149
|
+
}
|
|
2150
|
+
function isInsideProject(cwd, projectContext) {
|
|
2151
|
+
const rel = path.relative(projectContext.projectPath, path.resolve(cwd));
|
|
2152
|
+
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
2153
|
+
}
|
|
2154
|
+
//#endregion
|
|
2155
|
+
//#region src/core/diagnostics.ts
|
|
2156
|
+
function formatEnvMismatchError(mismatches, projectPath) {
|
|
2157
|
+
if (mismatches.length === 0) throw new Error("formatEnvMismatchError called with no mismatches");
|
|
2158
|
+
const lines = [];
|
|
2159
|
+
lines.push("environment does not match this project.");
|
|
2160
|
+
lines.push("");
|
|
2161
|
+
for (const m of mismatches) {
|
|
2162
|
+
lines.push(` ${m.variable} is set to ${m.envValue}`);
|
|
2163
|
+
lines.push(` but this project is for ${m.expected} (from ${projectPath})`);
|
|
2164
|
+
lines.push("");
|
|
2165
|
+
}
|
|
2166
|
+
lines.push("This usually happens when:");
|
|
2167
|
+
lines.push(" • You opened a dev container generated for a different org");
|
|
2168
|
+
lines.push(" • You manually set REVOS_ORG_ID in your shell");
|
|
2169
|
+
lines.push("");
|
|
2170
|
+
lines.push("To fix:");
|
|
2171
|
+
lines.push(" • Open this project's own dev container, or");
|
|
2172
|
+
lines.push(" • `unset REVOS_ORG_ID GOOGLE_CLOUD_PROJECT REVOS_BQ_DATASET`");
|
|
2173
|
+
return lines.join("\n");
|
|
2174
|
+
}
|
|
2175
|
+
function formatCredentialsMismatchWarning(args) {
|
|
2176
|
+
return `Your stored credentials are for org ${args.credentialsOrgId}, but this project is anchored to ${args.projectOrgId} (from ${args.projectPath}). Project commands will use the project's org; if the token has no access there, re-run 'revos auth login'.`;
|
|
2177
|
+
}
|
|
2178
|
+
function formatProjectOrgFlagError(args) {
|
|
2179
|
+
return `--org is not allowed inside a revos project — this directory is anchored to ${args.projectOrgId} (from ${args.projectPath}). Remove --org, or run from outside the project to target a different org.`;
|
|
2180
|
+
}
|
|
2181
|
+
function formatInProjectSwitchWarning(args) {
|
|
2182
|
+
return `You are inside ${args.projectName ? `project "${args.projectName}"` : "this project"}, which is anchored to org ${args.projectOrgId}. 'revos org switch' only changes your global default org — it does NOT affect 'revos apply / pull / diff' for this project.`;
|
|
2183
|
+
}
|
|
2184
|
+
function renderProjectContextLine(args) {
|
|
2185
|
+
const lines = [];
|
|
2186
|
+
lines.push(chalk.bold("Project:") + ` ${args.projectName ?? "(unnamed)"}`);
|
|
2187
|
+
lines.push(chalk.gray(` Path: ${args.projectPath}`));
|
|
2188
|
+
lines.push(` Org: ${args.projectOrgId}`);
|
|
2189
|
+
if (args.globalOrgId && args.globalOrgId !== args.projectOrgId) lines.push(chalk.yellow(` ⚠ Global default (${args.globalOrgId}) differs from this project's org.`));
|
|
2190
|
+
return lines;
|
|
2191
|
+
}
|
|
2192
|
+
//#endregion
|
|
2123
2193
|
//#region src/core/services/org-selector.ts
|
|
2124
2194
|
async function selectOrganization(organizations) {
|
|
2125
2195
|
const answer = await search({
|
|
@@ -2375,4 +2445,4 @@ var InitService = class InitService {
|
|
|
2375
2445
|
}
|
|
2376
2446
|
};
|
|
2377
2447
|
//#endregion
|
|
2378
|
-
export {
|
|
2448
|
+
export { generatePKCEChallenge as A, isTokenExpired as B, formatError as C, AUTH_ENVS as D, getConfig as E, setAuthEnv as F, saveCredentials as H, tokenResponseToCredentials as I, startOAuthServer as L, getUserInfo as M, refreshAccessToken as N, buildAuthorizationUrl as O, setAuthConfig as P, deleteCredentials as R, resolveAppUrl as S, DEFAULT_API_URL as T, ApiError as U, loadCredentials as V, buildIacRegistry as _, formatInProjectSwitchWarning as a, createApiClient as b, isInsideProject as c, iac_exports as d, describeResources as f, loadResources as g, formatDiffLine as h, formatEnvMismatchError as i, getActiveAuthConfig as j, exchangeCodeForTokens as k, resolveProjectContext as l, apply as m, selectOrganization as n, formatProjectOrgFlagError as o, pull as p, formatCredentialsMismatchWarning as r, renderProjectContextLine as s, InitService as t, validateEnvAgainstProject as u, discoverProject as v, sanitizeFileName as w, unwrap as x, projectRoot as y, getCredentialsPath as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseCommand } from "./base.command-
|
|
1
|
+
import { E as getConfig, b as createApiClient } from "./core-B-IdeRNl.mjs";
|
|
2
|
+
import { t as BaseCommand } from "./base.command-D8taHOFF.mjs";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import chalk from "chalk";
|
|
@@ -15,6 +15,7 @@ function defineApiCommand(spec) {
|
|
|
15
15
|
static examples = spec.examples ?? [];
|
|
16
16
|
static args = spec.args ?? {};
|
|
17
17
|
static flags = spec.flags ?? {};
|
|
18
|
+
static projectContextMode = spec.projectContextMode ?? "enforce";
|
|
18
19
|
async run() {
|
|
19
20
|
const config = await getConfig();
|
|
20
21
|
const api = createApiClient(config);
|