@vention/vention-cli 0.38.37 → 0.38.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/vention-cli",
3
- "version": "0.38.37",
3
+ "version": "0.38.39",
4
4
  "description": "CLI tool for Vention applications",
5
5
  "type": "module",
6
6
  "engines": {
@@ -0,0 +1 @@
1
+ export declare const openInBrowser: (url: string) => void;
@@ -2,7 +2,10 @@ import { SessionData } from "./config";
2
2
  import { Application } from "./digital-twin-client";
3
3
  import { MachineCodeAppDirectoryInfo } from "./machine-code-app-directory-info";
4
4
  import { DigitalTwinConnection } from "./digital-twin-connection";
5
- export declare const getAppFromDigitalTwin: (connection: DigitalTwinConnection, machineCodeAppDirectoryInfo: MachineCodeAppDirectoryInfo) => Promise<Application>;
5
+ export declare const getAppFromDigitalTwins: (session: SessionData, designId: number, { applicationId, appName }: Pick<MachineCodeAppDirectoryInfo, "applicationId" | "appName">) => Promise<{
6
+ app: Application;
7
+ connection: DigitalTwinConnection;
8
+ }>;
6
9
  export declare const getAvailableAppsFromDigitalTwin: (connection: DigitalTwinConnection) => Promise<Application[]>;
7
10
  export declare const createNewAppDirectory: (session: SessionData, currentDir: string) => Promise<void>;
8
11
  export declare const updateExistingAppDirectory: (session: SessionData, machineCodeAppDirectoryInfo: MachineCodeAppDirectoryInfo, currentDir: string) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function createIoCommand(): import("commander").Command;
@@ -0,0 +1 @@
1
+ export declare function createOpenCommand(): import("commander").Command;
@@ -0,0 +1 @@
1
+ export declare const createStateCommand: () => import("commander").Command;
@@ -0,0 +1 @@
1
+ export declare const createStopCommand: () => import("commander").Command;
package/src/config.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import type { StoredGatewayToken } from "@ventionco/auth-strategy-bearer";
2
+ export interface FeatureFlagCache {
3
+ fetchedAt: number;
4
+ values: Record<string, boolean>;
5
+ }
2
6
  export interface SessionData {
3
7
  environment: "local" | "demo" | "prod";
8
+ email?: string;
9
+ featureFlags?: FeatureFlagCache;
4
10
  gatewayToken?: StoredGatewayToken & {
5
11
  environment: SessionData["environment"];
6
12
  };
@@ -20,8 +20,28 @@ export interface GetMmConfigurationSuccessResponse {
20
20
  mmConfiguration: unknown;
21
21
  }
22
22
  export type PushApplicationRequest = Application;
23
+ export type IoStates = Record<string, Record<string, Record<string, number>>>;
24
+ export interface LogEntry {
25
+ id: number;
26
+ level: string;
27
+ message: string;
28
+ timestamp: number;
29
+ }
30
+ export interface ExecutionState {
31
+ state: string;
32
+ error?: {
33
+ message: string;
34
+ };
35
+ logging?: {
36
+ logs: LogEntry[];
37
+ }[] | null;
38
+ inputs?: IoStates | null;
39
+ outputs?: IoStates | null;
40
+ }
23
41
  export declare const getAllApplicationsWithSourceCode: (connection: DigitalTwinConnection) => Promise<Application[]>;
24
42
  export declare const getLibraryAssets: (connection: DigitalTwinConnection) => Promise<Asset[] | undefined>;
25
43
  export declare const getMmConfiguration: (connection: DigitalTwinConnection) => Promise<unknown>;
26
44
  export declare const pushApplicationToDigitalTwin: <T = unknown>(connection: DigitalTwinConnection, application: PushApplicationRequest) => Promise<T>;
45
+ export declare const getExecutionState: (connection: DigitalTwinConnection, applicationId: string) => Promise<ExecutionState>;
46
+ export declare const stopApplication: (connection: DigitalTwinConnection, applicationId: string) => Promise<ExecutionState>;
27
47
  export declare const getApplicationLogs: (connection: DigitalTwinConnection, applicationId: string) => Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import { type HttpHandler, type RequestHandlerOptions, type HttpResponseResolver } from "msw";
2
- import { Application, Asset, GetLibrarySuccessResponse, GetLibraryAssetsSuccessResponse, GetMmConfigurationSuccessResponse, PushApplicationRequest } from "./digital-twin-client";
2
+ import { Application, Asset, ExecutionState, GetLibrarySuccessResponse, GetLibraryAssetsSuccessResponse, GetMmConfigurationSuccessResponse, PushApplicationRequest } from "./digital-twin-client";
3
3
  import { HandlerParams, RawRequestSpyOptions } from "./test-setup/msw-helpers";
4
4
  export type GetLibraryTypes = {
5
5
  Request: never;
@@ -61,3 +61,33 @@ export declare const GetApplicationLogs: {
61
61
  } & RawRequestSpyOptions) => GetApplicationLogs["Resolver"];
62
62
  readonly NotFoundResolver: () => GetApplicationLogs["Resolver"];
63
63
  };
64
+ type LauncherResponse = ExecutionState | {
65
+ applicationId: string;
66
+ error: string;
67
+ };
68
+ export type GetExecutionStateTypes = {
69
+ Request: never;
70
+ Response: LauncherResponse;
71
+ Resolver: HttpResponseResolver<{
72
+ applicationId: string;
73
+ }, GetExecutionStateTypes["Request"], GetExecutionStateTypes["Response"]>;
74
+ };
75
+ export declare const GetExecutionState: {
76
+ readonly Handler: ({ resolver, remoteHost }: HandlerParams<GetExecutionStateTypes["Resolver"]>, mswOptions?: RequestHandlerOptions) => HttpHandler;
77
+ readonly SuccessResolver: ({ executionStates, requestSpy, }: {
78
+ executionStates: ExecutionState[];
79
+ } & RawRequestSpyOptions) => GetExecutionStateTypes["Resolver"];
80
+ readonly ApplicationNotFoundResolver: () => GetExecutionStateTypes["Resolver"];
81
+ };
82
+ export type StopApplicationTypes = {
83
+ Request: never;
84
+ Response: LauncherResponse;
85
+ Resolver: HttpResponseResolver<{
86
+ applicationId: string;
87
+ }, StopApplicationTypes["Request"], StopApplicationTypes["Response"]>;
88
+ };
89
+ export declare const StopApplication: {
90
+ readonly Handler: ({ resolver, remoteHost }: HandlerParams<StopApplicationTypes["Resolver"]>, mswOptions?: RequestHandlerOptions) => HttpHandler;
91
+ readonly SuccessResolver: ({ requestSpy }?: RawRequestSpyOptions) => StopApplicationTypes["Resolver"];
92
+ };
93
+ export {};
@@ -2,4 +2,4 @@ import { SessionData } from "../config";
2
2
  import type { DigitalTwinApiOrigins, DigitalTwinConnection, Design } from "./types";
3
3
  export declare const getOrigin: (environment: SessionData["environment"]) => string | undefined;
4
4
  export declare const listDesigns: (session: SessionData, origins: DigitalTwinApiOrigins) => Promise<Design[]>;
5
- export declare const resolveConnection: (session: SessionData, origins: DigitalTwinApiOrigins, designId: number) => Promise<DigitalTwinConnection | undefined>;
5
+ export declare const resolveConnections: (session: SessionData, origins: DigitalTwinApiOrigins, designId: number) => Promise<DigitalTwinConnection[]>;
@@ -1,2 +1,2 @@
1
- export { listDesigns, resolveDigitalTwinConnection } from "./resolve-connection";
1
+ export { listDesigns, resolveDigitalTwinConnections } from "./resolve-connection";
2
2
  export type { DigitalTwinConnection, Design } from "./types";
@@ -1,4 +1,4 @@
1
1
  import { SessionData } from "../config";
2
2
  import type { DigitalTwinConnection, Design } from "./types";
3
- export declare const resolveDigitalTwinConnection: (session: SessionData, designId: number) => Promise<DigitalTwinConnection | undefined>;
3
+ export declare const resolveDigitalTwinConnections: (session: SessionData, designId: number) => Promise<DigitalTwinConnection[]>;
4
4
  export declare const listDesigns: (session: SessionData) => Promise<Design[]>;
@@ -0,0 +1,9 @@
1
+ import { SessionData } from "./config";
2
+ export interface FeatureFlag {
3
+ key: string;
4
+ override?: string;
5
+ defaultValue: boolean;
6
+ }
7
+ export declare const TWIN_RUN: FeatureFlag;
8
+ export declare const refreshFeatureFlags: () => Promise<void>;
9
+ export declare const isFeatureEnabled: (session: SessionData, flag: FeatureFlag) => boolean;
@@ -0,0 +1,21 @@
1
+ import { Command } from "commander";
2
+ import { type SessionData } from "./config";
3
+ import { type MachineCodeAppDirectoryInfo } from "./machine-code-app-directory-info";
4
+ import { type DigitalTwinConnection } from "./digital-twin-connection";
5
+ import { type ExecutionState } from "./digital-twin-client";
6
+ export type RunState = "playing" | "stopped" | "error";
7
+ export declare const describeRunState: (engineState: string) => RunState;
8
+ export declare const stripControlCharacters: (text: string) => string;
9
+ export declare const twinRunCommand: (name: string) => Command;
10
+ export declare const requireSession: (session: SessionData | null) => SessionData;
11
+ export declare const loadTwinRunSession: (commandName: string) => Promise<SessionData>;
12
+ export declare const readLinkedApp: () => Promise<MachineCodeAppDirectoryInfo>;
13
+ export declare const exitWithoutTwin: (designId: number) => never;
14
+ export declare const handleTwinRunError: (error: unknown, context: string) => void;
15
+ export interface AppTwin {
16
+ connection: DigitalTwinConnection;
17
+ executionState: ExecutionState;
18
+ }
19
+ export declare const findAppTwins: (session: SessionData, linkedApp: MachineCodeAppDirectoryInfo) => Promise<AppTwin[]>;
20
+ export declare const printRunState: (linkedApp: MachineCodeAppDirectoryInfo, executionState: ExecutionState | undefined, json: boolean) => void;
21
+ export declare const runStateCommand: (name: "state" | "stop", description: string, failureMessage: string, act: (appTwins: AppTwin[], applicationId: string) => Promise<ExecutionState | undefined>) => Command;