@vention/vention-cli 0.38.24 → 0.38.25

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/main.esm.js CHANGED
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  import fs, { promises } from 'fs';
6
6
  import path$2 from 'path';
7
7
  import { createRequire } from 'module';
8
- import { select, password } from '@inquirer/prompts';
8
+ import { select } from '@inquirer/prompts';
9
9
  import { exec as exec$9, execFileSync } from 'child_process';
10
10
  import http from 'http';
11
11
  import { URLSearchParams as URLSearchParams$2 } from 'url';
@@ -7448,14 +7448,8 @@ function createLoginCommand() {
7448
7448
  }]
7449
7449
  }) : "prod";
7450
7450
  if (environment === "local") {
7451
- const ventionSession = await password({
7452
- message: "Enter vention_session cookie value:",
7453
- mask: "",
7454
- validate: input => input.length > 0 || "vention_session is required"
7455
- });
7456
7451
  await saveSession({
7457
- environment,
7458
- ventionSession
7452
+ environment
7459
7453
  });
7460
7454
  console.log();
7461
7455
  console.log(chalk.green("Successfully logged in!"));
@@ -11080,14 +11074,6 @@ const getAuthHeaders = async session => {
11080
11074
  Origin: baseUrl,
11081
11075
  Referer: `${baseUrl}/`
11082
11076
  };
11083
- if (session.environment === "local") {
11084
- if (!session.ventionSession) {
11085
- throw new Error("Local environment requires vention_session. Please run 'vention login' and provide the cookie value.");
11086
- }
11087
- return Object.assign(Object.assign({}, baseHeaders), {
11088
- Cookie: `vention_session=${session.ventionSession}`
11089
- });
11090
- }
11091
11077
  if (!((_a = session.oauth) === null || _a === void 0 ? void 0 : _a.accessToken)) {
11092
11078
  throw new Error("Not authenticated. Please run 'vention login' to authenticate via SSO.");
11093
11079
  }
@@ -11128,7 +11114,7 @@ const buildConnection$1 = (environment, designId, sessionId) => ({
11128
11114
  },
11129
11115
  fetch: sessionId ? fetchWithUserAgent : rejectMissingSession
11130
11116
  });
11131
- const resolveConnection$1 = async (session, designId) => {
11117
+ const resolveConnection$2 = async (session, designId) => {
11132
11118
  const allocations = await getUserAllocations(session);
11133
11119
  const allocation = allocations.find(candidate => candidate.designId === designId);
11134
11120
  if (!allocation) {
@@ -11136,7 +11122,7 @@ const resolveConnection$1 = async (session, designId) => {
11136
11122
  }
11137
11123
  return buildConnection$1(session.environment, designId, allocation.sessionId);
11138
11124
  };
11139
- const listDesigns$2 = async session => {
11125
+ const listDesigns$3 = async session => {
11140
11126
  const allocations = await getUserAllocations(session);
11141
11127
  return allocations.map(allocation => ({
11142
11128
  id: allocation.designId,
@@ -12271,7 +12257,7 @@ const buildConnection = (engineUrl, fetch) => ({
12271
12257
  headers: {},
12272
12258
  fetch
12273
12259
  });
12274
- const listDesigns$1 = async (session, origins) => {
12260
+ const listDesigns$2 = async (session, origins) => {
12275
12261
  const {
12276
12262
  api,
12277
12263
  fetch
@@ -12287,12 +12273,24 @@ const listDesigns$1 = async (session, origins) => {
12287
12273
  }] : [];
12288
12274
  });
12289
12275
  };
12290
- const resolveConnection = async (session, origins, designId) => {
12276
+ const resolveConnection$1 = async (session, origins, designId) => {
12291
12277
  var _a;
12292
- const designs = await listDesigns$1(session, origins);
12278
+ const designs = await listDesigns$2(session, origins);
12293
12279
  return (_a = designs.find(design => design.id === designId)) === null || _a === void 0 ? void 0 : _a.connection;
12294
12280
  };
12295
12281
 
12282
+ const connection = {
12283
+ baseUrl: "http://localhost:3101",
12284
+ headers: {},
12285
+ fetch: fetchWithUserAgent
12286
+ };
12287
+ const resolveConnection = async () => connection;
12288
+ const listDesigns$1 = async () => [{
12289
+ id: 0,
12290
+ name: "Local digital twin",
12291
+ connection
12292
+ }];
12293
+
12296
12294
  const findDigitalTwinApiOrigins = session => {
12297
12295
  if (!isDigitalTwinV3Enabled(session)) {
12298
12296
  return undefined;
@@ -12309,12 +12307,18 @@ const findDigitalTwinApiOrigins = session => {
12309
12307
  };
12310
12308
  };
12311
12309
  const resolveDigitalTwinConnection = async (session, designId) => {
12310
+ if (session.environment === "local") {
12311
+ return resolveConnection();
12312
+ }
12312
12313
  const origins = findDigitalTwinApiOrigins(session);
12313
- return origins ? resolveConnection(session, origins, designId) : resolveConnection$1(session, designId);
12314
+ return origins ? resolveConnection$1(session, origins, designId) : resolveConnection$2(session, designId);
12314
12315
  };
12315
12316
  const listDesigns = async session => {
12317
+ if (session.environment === "local") {
12318
+ return listDesigns$1();
12319
+ }
12316
12320
  const origins = findDigitalTwinApiOrigins(session);
12317
- return origins ? listDesigns$1(session, origins) : listDesigns$2(session);
12321
+ return origins ? listDesigns$2(session, origins) : listDesigns$3(session);
12318
12322
  };
12319
12323
 
12320
12324
  const getAppFromDigitalTwin = async (connection, machineCodeAppDirectoryInfo) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/vention-cli",
3
- "version": "0.38.24",
3
+ "version": "0.38.25",
4
4
  "description": "CLI tool for Vention applications",
5
5
  "type": "module",
6
6
  "engines": {
package/src/config.d.ts CHANGED
@@ -5,7 +5,6 @@ export interface FeatureFlagCache {
5
5
  }
6
6
  export interface SessionData {
7
7
  environment: "local" | "demo" | "prod";
8
- ventionSession?: string;
9
8
  stytchSessionJwt?: string;
10
9
  ventionIdpSession?: string;
11
10
  oauth?: {
@@ -0,0 +1,3 @@
1
+ import type { DigitalTwinConnection, Design } from "./types";
2
+ export declare const resolveConnection: () => Promise<DigitalTwinConnection>;
3
+ export declare const listDesigns: () => Promise<Design[]>;