eas-cli 20.3.0 → 20.5.0

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.
Files changed (37) hide show
  1. package/README.md +136 -113
  2. package/build/build/utils/url.d.ts +1 -0
  3. package/build/build/utils/url.js +4 -0
  4. package/build/commandUtils/new/templates/AGENTS.md +25 -146
  5. package/build/commandUtils/new/templates/CLAUDE.md +1 -9
  6. package/build/commands/integrations/posthog/connect.d.ts +3 -0
  7. package/build/commands/integrations/posthog/connect.js +66 -12
  8. package/build/commands/observe/session.d.ts +18 -0
  9. package/build/commands/observe/session.js +65 -0
  10. package/build/commands/simulator/get.js +8 -10
  11. package/build/commands/simulator/list.js +7 -13
  12. package/build/commands/simulator/start.js +27 -27
  13. package/build/commands/simulator/stop.js +5 -5
  14. package/build/graphql/generated.d.ts +353 -78
  15. package/build/graphql/generated.js +41 -5
  16. package/build/graphql/mutations/PostHogMutation.d.ts +2 -2
  17. package/build/graphql/mutations/PostHogMutation.js +13 -7
  18. package/build/graphql/queries/AccountQuery.js +5 -0
  19. package/build/graphql/queries/PostHogQuery.d.ts +3 -1
  20. package/build/graphql/queries/PostHogQuery.js +5 -2
  21. package/build/graphql/types/Observe.js +1 -0
  22. package/build/graphql/types/PostHogConnection.d.ts +8 -0
  23. package/build/observe/fetchCustomEvents.d.ts +2 -2
  24. package/build/observe/fetchCustomEvents.js +2 -2
  25. package/build/observe/fetchEvents.d.ts +4 -3
  26. package/build/observe/fetchEvents.js +4 -3
  27. package/build/observe/fetchSessions.d.ts +51 -0
  28. package/build/observe/fetchSessions.js +86 -0
  29. package/build/observe/formatEvents.d.ts +1 -0
  30. package/build/observe/formatEvents.js +1 -0
  31. package/build/observe/formatSessions.d.ts +15 -0
  32. package/build/observe/formatSessions.js +100 -0
  33. package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js +23 -26
  34. package/build/utils/usage/checkForOverages.d.ts +13 -3
  35. package/build/utils/usage/checkForOverages.js +72 -21
  36. package/oclif.manifest.json +1644 -1549
  37. package/package.json +4 -3
@@ -5,6 +5,7 @@ export declare function getArtifactUrl(artifactId: string): string;
5
5
  export declare function getInternalDistributionInstallUrl(build: BuildFragment): string;
6
6
  export declare function getUpdateGroupUrl(accountName: string, projectName: string, updateGroupId: string): string;
7
7
  export declare function getWorkflowRunUrl(accountName: string, projectName: string, workflowRunId: string): string;
8
+ export declare function getDeviceRunSessionUrl(accountName: string, projectName: string, deviceRunSessionId: string): string;
8
9
  /**
9
10
  * @deprecated Links to the raw job-run page; prefer a higher-level URL (e.g. the workflow run
10
11
  * or the feature-specific dashboard) that gives users more context. Use this only for internal
@@ -6,6 +6,7 @@ exports.getArtifactUrl = getArtifactUrl;
6
6
  exports.getInternalDistributionInstallUrl = getInternalDistributionInstallUrl;
7
7
  exports.getUpdateGroupUrl = getUpdateGroupUrl;
8
8
  exports.getWorkflowRunUrl = getWorkflowRunUrl;
9
+ exports.getDeviceRunSessionUrl = getDeviceRunSessionUrl;
9
10
  exports.getBareJobRunUrl = getBareJobRunUrl;
10
11
  exports.getProjectGitHubSettingsUrl = getProjectGitHubSettingsUrl;
11
12
  exports.getHostingDeploymentsUrl = getHostingDeploymentsUrl;
@@ -39,6 +40,9 @@ function getUpdateGroupUrl(accountName, projectName, updateGroupId) {
39
40
  function getWorkflowRunUrl(accountName, projectName, workflowRunId) {
40
41
  return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/workflows/${workflowRunId}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
41
42
  }
43
+ function getDeviceRunSessionUrl(accountName, projectName, deviceRunSessionId) {
44
+ return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/simulator-sessions/${encodeURIComponent(deviceRunSessionId)}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
45
+ }
42
46
  /**
43
47
  * @deprecated Links to the raw job-run page; prefer a higher-level URL (e.g. the workflow run
44
48
  * or the feature-specific dashboard) that gives users more context. Use this only for internal
@@ -1,162 +1,41 @@
1
- # AGENTS.md
2
-
3
- ## Project Overview
4
-
5
1
  This is an Expo/React Native mobile application. Prioritize mobile-first patterns, performance, and cross-platform compatibility.
6
2
 
7
- ## Documentation Resources
8
-
9
- When working on this project, **always consult the official Expo documentation** available at:
10
-
11
- - **https://docs.expo.dev/llms.txt** - Index of all available documentation files
12
- - **https://docs.expo.dev/llms-full.txt** - Complete Expo documentation including Expo Router, Expo Modules API, development process
13
- - **https://docs.expo.dev/llms-eas.txt** - Complete EAS (Expo Application Services) documentation
14
- - **https://docs.expo.dev/llms-sdk.txt** - Complete Expo SDK documentation
15
- - **https://reactnative.dev/docs/getting-started** - Complete React Native documentation
16
-
17
- These documentation files are specifically formatted for AI agents and should be your **primary reference** for:
3
+ ## Expo has changed — do not trust your training data
18
4
 
19
- - Expo APIs and best practices
20
- - Expo Router navigation patterns
21
- - EAS Build, Submit, and Update workflows
22
- - Expo SDK modules and their usage
23
- - Development and deployment processes
5
+ Expo ships breaking changes every SDK release. APIs you remember are likely renamed, moved, or removed. Before writing any code that touches an Expo, EAS, or React Native API:
24
6
 
25
- ## Project Structure
7
+ 1. Read the major version of the `expo` package in `package.json`.
8
+ 2. Fetch the matching versioned docs: `https://docs.expo.dev/versions/v<major>.0.0/`
9
+ 3. For anything else, fetch https://docs.expo.dev/llms.txt — an index of all Expo docs with corrections to common LLM misconceptions. Follow its links to the specific page you need; never answer from memory.
26
10
 
27
- ```
28
- /
29
- ├── app/ # Expo Router file-based routing
30
- │ ├── (tabs)/ # Tab-based navigation screens
31
- │ │ ├── index.tsx # Home screen
32
- │ │ ├── explore.tsx # Explore screen
33
- │ │ └── _layout.tsx # Tabs layout
34
- │ ├── _layout.tsx # Root layout with theme provider
35
- │ └── modal.tsx # Modal screen example
36
- ├── components/ # Reusable React components
37
- │ ├── ui/ # UI primitives (IconSymbol, Collapsible)
38
- │ └── ... # Feature components (themed, haptic, parallax)
39
- ├── constants/ # App-wide constants (theme, colors)
40
- ├── hooks/ # Custom React hooks (color scheme, theme)
41
- ├── assets/ # Static assets (images, fonts)
42
- ├── scripts/ # Utility scripts (reset-project)
43
- ├── .eas/workflows/ # EAS Workflows (CI/CD automation)
44
- ├── app.json # Expo configuration
45
- ├── eas.json # EAS Build/Submit configuration
46
- └── package.json # Dependencies and scripts
47
- ```
48
-
49
- ## Essential Commands
11
+ ## Commands
50
12
 
51
- ### Development
13
+ Use `bunx` instead of `npx` if the project uses bun (`bun.lock` present).
52
14
 
53
15
  ```bash
54
- npx expo start # Start dev server
55
- npx expo start --clear # Clear cache and start dev server
56
- npx expo install <package> # Install packages with compatible versions
57
- npx expo install --check # Check which installed packages need to be updated
58
- npx expo install --fix # Automatically update any invalid package versions
59
- npm run development-builds # Create development builds (workflow)
60
- npm run reset-project # Reset to blank template
16
+ npx expo install <package> # ALWAYS use instead of npm/yarn/pnpm/bun add — resolves SDK-compatible versions
17
+ npx expo start # start the dev server
18
+ npx expo lint # lint
19
+ npx tsc --noEmit # typecheck
20
+ npx expo-doctor # diagnose dependency and config issues
21
+ npx expo install --fix # fix incompatible package versions
61
22
  ```
62
23
 
63
- ### Building & Testing
64
-
65
- ```bash
66
- npx expo doctor # Check project health and dependencies
67
- npx expo lint # Run ESLint
68
- npm run draft # Publish preview update and website (workflow)
69
- ```
70
-
71
- ### Production
72
-
73
- ```bash
74
- npx eas-cli@latest build --platform ios -s # Use EAS to build for iOS platform and submit to App Store
75
- npx eas-cli@latest build --platform android -s # Use EAS to build for Android platform and submit to Google Play Store
76
- npm run deploy # Deploy to production (workflow)
77
- ```
78
-
79
- ## Development Guidelines
80
-
81
- ### Code Style & Standards
82
-
83
- - **TypeScript First**: Use TypeScript for all new code with strict type checking
84
- - **Naming Conventions**: Use meaningful, descriptive names for variables, functions, and components
85
- - **Self-Documenting Code**: Write clear, readable code that explains itself; only add comments for complex business logic or design decisions
86
- - **React 19 Patterns**: Follow modern React patterns including:
87
- - Function components with hooks
88
- - Enable React Compiler
89
- - Proper dependency arrays in useEffect
90
- - Memoization when appropriate (useMemo, useCallback)
91
- - Error boundaries for better error handling
92
-
93
- ### Navigation & Routing
94
-
95
- - Use **Expo Router** for all navigation
96
- - Import `Link`, `router`, and `useLocalSearchParams` from `expo-router`
97
- - Docs: https://docs.expo.dev/router/introduction/
98
-
99
- ### Recommended Libraries
100
-
101
- - **Navigation**: `expo-router` for navigation
102
- - **Images**: `expo-image` for optimized image handling and caching
103
- - **Animations**: `react-native-reanimated` for performant animations on native thread
104
- - **Gestures**: `react-native-gesture-handler` for native gesture recognition
105
- - **Storage**: Use `expo-sqlite` for persistent storage, `expo-sqlite/kv-store` for simple key-value storage
106
-
107
- ## Debugging & Development Tools
108
-
109
- ### DevTools Integration
110
-
111
- - **React Native DevTools**: Use MCP `open_devtools` command to launch debugging tools
112
- - **Network Inspection**: Monitor API calls and network requests in DevTools
113
- - **Element Inspector**: Debug component hierarchy and styles
114
- - **Performance Profiler**: Identify performance bottlenecks
115
- - **Logging**: Use `console.log` for debugging (remove before production), `console.warn` for deprecation notices, `console.error` for actual errors, and implement error boundaries for production error handling
116
-
117
- ### Testing & Quality Assurance
118
-
119
- #### Automated Testing with MCP Tools
120
-
121
- Developers can configure the Expo MCP server with the following doc: https://docs.expo.dev/eas/ai/mcp/
122
-
123
- - **Component Testing**: Add `testID` props to components for automation
124
- - **Visual Testing**: Use MCP `automation_take_screenshot` to verify UI appearance
125
- - **Interaction Testing**: Use MCP `automation_tap_by_testid` to simulate user interactions
126
- - **View Verification**: Use MCP `automation_find_view_by_testid` to validate component rendering
127
-
128
- ## EAS Workflows CI/CD
129
-
130
- This project is pre-configured with **EAS Workflows** for automating development and release processes. Workflows are defined in `.eas/workflows/` directory.
131
-
132
- When working with EAS Workflows, **always refer to**:
133
-
134
- - https://docs.expo.dev/eas/workflows/ for workflow examples
135
- - The `.eas/workflows/` directory for existing workflow configurations
136
- - You can check that a workflow YAML is valid using the workflows schema: https://exp.host/--/api/v2/workflows/schema
137
-
138
- ### Build Profiles (eas.json)
139
-
140
- - **development**: Development builds with dev client
141
- - **development-simulator**: Development builds for iOS simulator
142
- - **preview**: Internal distribution preview builds
143
- - **production**: Production builds with auto-increment
144
-
145
- ## Troubleshooting
146
-
147
- ### Expo Go Errors & Development Builds
24
+ Run lint and typecheck before declaring any task done.
148
25
 
149
- If there are errors in **Expo Go** or the project is not running, create a **development build**. **Expo Go** is a sandbox environment with a limited set of native modules. To create development builds, run `eas build:dev`. Additionally, after installing new packages or adding config plugins, new development builds are often required.
26
+ ## Navigation & Routing
150
27
 
151
- ## AI Agent Instructions
28
+ - Use **Expo Router** for all navigation. Routes live in `src/app/` — every file there is a screen, `_layout.tsx` files define navigators. Keep non-route code (components, hooks, utils) outside `src/app/`.
29
+ - Import `Link`, `router`, and `useLocalSearchParams` from `expo-router`.
30
+ - Docs: https://docs.expo.dev/router/introduction.md
152
31
 
153
- When working on this project:
32
+ ## Building with EAS
154
33
 
155
- 1. **Always start by consulting the appropriate documentation**:
156
- - For general Expo questions: https://docs.expo.dev/llms-full.txt
157
- - For EAS/deployment questions: https://docs.expo.dev/llms-eas.txt
158
- - For SDK/API questions: https://docs.expo.dev/llms-sdk.txt
34
+ Use EAS to build, sign, and submit the app in the cloud (`eas build`, `eas submit`) and to ship over-the-air updates (`eas update`) — no local Xcode or Android Studio required. Run EAS CLI as `bunx eas-cli <command>` in Bun projects, or `npx eas-cli@latest <command>` otherwise; substitute that for bare `eas` in docs examples.
35
+ Docs: https://docs.expo.dev/eas/index.md
159
36
 
160
- 2. **Understand before implementing**: Read the relevant docs section before writing code
37
+ ## Rules
161
38
 
162
- 3. **Follow existing patterns**: Look at existing components and screens for patterns to follow
39
+ - If `ios/` and `android/` directories do not exist, they are generated (Continuous Native Generation). Never create or edit them by hand — configure native behavior in `app.json` and config plugins.
40
+ - Expo Go only includes its bundled native modules. After adding a library with native code, the app needs a development build: `npx expo run:ios|android` locally, or `eas build --profile development`.
41
+ - Prefer recommended Expo modules over third-party libraries, and check your available skills before adding dependencies. Docs: https://docs.expo.dev/versions/latest/index.md
@@ -1,9 +1 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- **Note**: This project uses `AGENTS.md` files for detailed guidance.
6
-
7
- ## Primary Reference
8
-
9
- Please see `AGENTS.md` in this same directory for the main project documentation and guidance.
1
+ @AGENTS.md
@@ -15,6 +15,9 @@ export default class IntegrationsPostHogConnect extends EasCommand {
15
15
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  };
17
17
  runAsync(): Promise<void>;
18
+ private startConnectionAsync;
19
+ private completePendingConnectionViaBrowserAsync;
20
+ private pollForConnectionAsync;
18
21
  private resolveFeaturesAsync;
19
22
  private resolveCliApiKeyAsync;
20
23
  private resolveRegionAsync;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
5
5
  const core_1 = require("@oclif/core");
6
+ const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
6
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
8
  const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
8
9
  const fs = tslib_1.__importStar(require("fs-extra"));
@@ -45,6 +46,10 @@ const EAS_POSTHOG_HOST_ENV_VAR_NAME = 'EXPO_PUBLIC_POSTHOG_HOST';
45
46
  const POSTHOG_CLI_API_KEY_ENV_VAR_NAME = 'POSTHOG_CLI_API_KEY';
46
47
  const POSTHOG_CLI_PROJECT_ID_ENV_VAR_NAME = 'POSTHOG_CLI_PROJECT_ID';
47
48
  const POSTHOG_CLI_HOST_ENV_VAR_NAME = 'POSTHOG_CLI_HOST';
49
+ // Match the server's 15-minute pending-row TTL — timing out sooner would strand an approval
50
+ // the user completes within the window.
51
+ const CONNECTION_POLL_INTERVAL_MS = 2_000;
52
+ const CONNECTION_POLL_TIMEOUT_MS = 15 * 60 * 1_000;
48
53
  const PERSONAL_API_KEY_SETTINGS_PATH = '/settings/user-api-keys';
49
54
  const ERROR_TRACKING_NEEDS_KEY_MESSAGE = `Error tracking needs a PostHog personal API key in non-interactive mode. Pass --posthog-cli-api-key (create one in PostHog under Settings → Personal API keys (${PERSONAL_API_KEY_SETTINGS_PATH}) with the "Source map upload" preset), or drop --error-tracking.`;
50
55
  function getSpawnErrorOutput(error) {
@@ -104,18 +109,7 @@ class IntegrationsPostHogConnect extends EasCommand_1.default {
104
109
  }
105
110
  else {
106
111
  const region = await this.resolveRegionAsync(regionFlag, nonInteractive);
107
- const spinner = (0, ora_1.ora)('Creating PostHog organization').start();
108
- try {
109
- connection = await PostHogMutation_1.PostHogMutation.createPostHogAccountRequestAsync(graphqlClient, {
110
- accountId: account.id,
111
- region,
112
- });
113
- spinner.succeed(`Created PostHog organization ${chalk_1.default.bold(connection.posthogOrganizationName)}`);
114
- }
115
- catch (error) {
116
- spinner.fail('Failed to create PostHog organization');
117
- throw error;
118
- }
112
+ connection = await this.startConnectionAsync(graphqlClient, account, region, nonInteractive);
119
113
  }
120
114
  let project = await PostHogQuery_1.PostHogQuery.getPostHogProjectByAppIdAsync(graphqlClient, projectId);
121
115
  if (project) {
@@ -213,6 +207,66 @@ class IntegrationsPostHogConnect extends EasCommand_1.default {
213
207
  }
214
208
  this.printNextSteps(project, features, manualSteps);
215
209
  }
210
+ async startConnectionAsync(graphqlClient, account, region, nonInteractive) {
211
+ const spinner = (0, ora_1.ora)('Creating PostHog organization').start();
212
+ let result;
213
+ try {
214
+ result = await PostHogMutation_1.PostHogMutation.startPostHogConnectionAsync(graphqlClient, {
215
+ accountId: account.id,
216
+ region,
217
+ });
218
+ }
219
+ catch (error) {
220
+ spinner.fail('Failed to create PostHog organization');
221
+ throw error;
222
+ }
223
+ if (result.__typename === 'PostHogOrganizationConnection') {
224
+ spinner.succeed(`Created PostHog organization ${chalk_1.default.bold(result.posthogOrganizationName)}`);
225
+ return result;
226
+ }
227
+ spinner.stop();
228
+ if (nonInteractive) {
229
+ throw new Error(`The email on the ${chalk_1.default.bold(account.name)} account already has a PostHog account, which must be connected by approving it in a browser. Re-run \`eas integrations:posthog:connect\` interactively to finish connecting.`);
230
+ }
231
+ return await this.completePendingConnectionViaBrowserAsync(graphqlClient, account, result);
232
+ }
233
+ async completePendingConnectionViaBrowserAsync(graphqlClient, account, pending) {
234
+ log_1.default.addNewLineIfNone();
235
+ log_1.default.log(`The email on the ${chalk_1.default.bold(account.name)} account already has a PostHog account. Approve connecting it to Expo in your browser.`);
236
+ const opened = await (0, better_opn_1.default)(pending.url).catch(() => false);
237
+ log_1.default.log(opened
238
+ ? `Opened ${(0, log_1.link)(pending.url)}`
239
+ : `Open this URL to approve the connection: ${(0, log_1.link)(pending.url)}`);
240
+ const spinner = (0, ora_1.ora)('Waiting for you to approve the connection in PostHog (up to 15 minutes; press Ctrl-C to cancel)').start();
241
+ try {
242
+ const connection = await this.pollForConnectionAsync(graphqlClient, account.id);
243
+ spinner.succeed(`Connected PostHog organization ${chalk_1.default.bold(connection.posthogOrganizationName)}`);
244
+ return connection;
245
+ }
246
+ catch (error) {
247
+ spinner.fail("Couldn't confirm the PostHog connection");
248
+ throw error;
249
+ }
250
+ }
251
+ async pollForConnectionAsync(graphqlClient, accountId) {
252
+ const deadline = Date.now() + CONNECTION_POLL_TIMEOUT_MS;
253
+ while (true) {
254
+ let connection = null;
255
+ try {
256
+ connection = await PostHogQuery_1.PostHogQuery.getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient, accountId, { useCache: false });
257
+ }
258
+ catch (error) {
259
+ log_1.default.debug(`Polling for the PostHog connection failed, will retry: ${error}`);
260
+ }
261
+ if (connection) {
262
+ return connection;
263
+ }
264
+ if (Date.now() >= deadline) {
265
+ throw new Error('Timed out waiting for the PostHog connection. If you approved it in your browser, re-run `eas integrations:posthog:connect` — it will pick up the connection. If not, approve it and try again.');
266
+ }
267
+ await new Promise(resolve => setTimeout(resolve, CONNECTION_POLL_INTERVAL_MS));
268
+ }
269
+ }
216
270
  async resolveFeaturesAsync(flags, cliApiKey, nonInteractive) {
217
271
  const sessionReplayFlag = flags['session-replay'];
218
272
  const errorTrackingFlag = flags['error-tracking'];
@@ -0,0 +1,18 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class ObserveSession extends EasCommand {
3
+ static description: string;
4
+ static args: {
5
+ sessionId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'project-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ static contextDefinition: {
13
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
14
+ projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
15
+ };
16
+ private static loggedInOnlyContextDefinition;
17
+ runAsync(): Promise<void>;
18
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
+ const flags_1 = require("../../commandUtils/flags");
7
+ const log_1 = tslib_1.__importDefault(require("../../log"));
8
+ const fetchSessions_1 = require("../../observe/fetchSessions");
9
+ const flags_2 = require("../../observe/flags");
10
+ const formatSessions_1 = require("../../observe/formatSessions");
11
+ const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
12
+ const json_1 = require("../../utils/json");
13
+ // Fixed at 100 — the maximum page size accepted by the underlying events and
14
+ // customEventList queries. Until there's a dedicated sessions query, this
15
+ // command pulls one page of each and merges client-side.
16
+ const SESSION_PAGE_SIZE = 100;
17
+ class ObserveSession extends EasCommand_1.default {
18
+ static description = 'display the timeline of metric and log events for a specific session';
19
+ static args = {
20
+ sessionId: core_1.Args.string({
21
+ description: 'Session ID to inspect',
22
+ required: true,
23
+ }),
24
+ };
25
+ static flags = {
26
+ ...flags_2.ObserveProjectIdFlag,
27
+ ...flags_1.EasNonInteractiveAndJsonFlags,
28
+ };
29
+ static contextDefinition = {
30
+ ...this.ContextOptions.ProjectId,
31
+ ...this.ContextOptions.LoggedIn,
32
+ };
33
+ static loggedInOnlyContextDefinition = {
34
+ ...this.ContextOptions.LoggedIn,
35
+ };
36
+ async runAsync() {
37
+ const { flags, args } = await this.parse(ObserveSession);
38
+ const { projectId, graphqlClient } = await (0, resolveProjectContext_1.resolveObserveCommandContextAsync)({
39
+ command: this,
40
+ commandClass: ObserveSession,
41
+ loggedInOnlyContextDefinition: ObserveSession.loggedInOnlyContextDefinition,
42
+ projectIdOverride: flags['project-id'],
43
+ nonInteractive: flags['non-interactive'],
44
+ });
45
+ if (flags.json) {
46
+ (0, json_1.enableJsonOutput)();
47
+ }
48
+ const { entries, metadata, hasMoreMetricEvents, hasMoreLogEvents } = await (0, fetchSessions_1.fetchObserveSessionEventsAsync)(graphqlClient, projectId, {
49
+ sessionId: args.sessionId,
50
+ limit: SESSION_PAGE_SIZE,
51
+ });
52
+ if (flags.json) {
53
+ (0, json_1.printJsonOnlyOutput)((0, formatSessions_1.buildObserveSessionEventsJson)(entries, args.sessionId, metadata, hasMoreMetricEvents, hasMoreLogEvents));
54
+ }
55
+ else {
56
+ log_1.default.addNewLineIfNone();
57
+ log_1.default.log((0, formatSessions_1.buildObserveSessionEventsTable)(entries, {
58
+ metadata,
59
+ hasMoreMetricEvents,
60
+ hasMoreLogEvents,
61
+ }));
62
+ }
63
+ }
64
+ }
65
+ exports.default = ObserveSession;
@@ -14,10 +14,10 @@ const utils_1 = require("../../simulator/utils");
14
14
  const json_1 = require("../../utils/json");
15
15
  class SimulatorGet extends EasCommand_1.default {
16
16
  static hidden = true;
17
- static description = '[EXPERIMENTAL] get info about a remote simulator session on EAS by its device run session ID';
17
+ static description = '[EXPERIMENTAL] get info about a remote simulator session on EAS by its simulator session ID';
18
18
  static flags = {
19
19
  id: core_1.Flags.string({
20
- description: `Device run session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
20
+ description: `Simulator session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
21
21
  }),
22
22
  ...flags_1.EasNonInteractiveAndJsonFlags,
23
23
  };
@@ -39,25 +39,23 @@ class SimulatorGet extends EasCommand_1.default {
39
39
  if (!flagId) {
40
40
  throw new Error(`No simulator session ID provided. Pass --id, or run \`eas simulator:start\` first to write ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`);
41
41
  }
42
- const fetchSpinner = (0, ora_1.ora)(`Fetching device run session ${flagId}`).start();
42
+ const fetchSpinner = (0, ora_1.ora)(`Fetching simulator session ${flagId}`).start();
43
43
  let session;
44
44
  try {
45
45
  session = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.byIdAsync(graphqlClient, flagId);
46
- fetchSpinner.succeed(`Fetched device run session ${session.id}`);
46
+ fetchSpinner.succeed(`Fetched simulator session ${session.id}`);
47
47
  }
48
48
  catch (err) {
49
- fetchSpinner.fail(`Failed to fetch device run session ${flagId}`);
49
+ fetchSpinner.fail(`Failed to fetch simulator session ${flagId}`);
50
50
  throw err;
51
51
  }
52
- const jobRunUrl = session.turtleJobRun
53
- ? (0, url_1.getBareJobRunUrl)(session.app.ownerAccount.name, session.app.slug, session.turtleJobRun.id)
54
- : '';
52
+ const deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, session.id);
55
53
  if (jsonFlag) {
56
54
  (0, json_1.printJsonOnlyOutput)({
57
55
  id: session.id,
58
56
  type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
59
57
  status: session.status,
60
- jobRunUrl: jobRunUrl || undefined,
58
+ deviceRunSessionUrl,
61
59
  remoteConfig: session.remoteConfig,
62
60
  });
63
61
  return;
@@ -66,7 +64,7 @@ class SimulatorGet extends EasCommand_1.default {
66
64
  log_1.default.log(`ID: ${session.id}`);
67
65
  log_1.default.log(`Type: ${session.type}`);
68
66
  log_1.default.log(`Status: ${session.status}`);
69
- log_1.default.log(`URL: ${jobRunUrl ? (0, log_1.link)(jobRunUrl) : ''}`);
67
+ log_1.default.log(`URL: ${(0, log_1.link)(deviceRunSessionUrl)}`);
70
68
  if (session.status === generated_1.DeviceRunSessionStatus.InProgress) {
71
69
  log_1.default.newLine();
72
70
  if (session.remoteConfig) {
@@ -80,7 +80,7 @@ class SimulatorList extends EasCommand_1.default {
80
80
  filter.platforms = flags.platform.map(value => PLATFORM_BY_FLAG_VALUE[value]);
81
81
  }
82
82
  const limit = flags.limit ?? DEFAULT_LIMIT;
83
- const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Fetching device run sessions').start();
83
+ const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Fetching simulator sessions').start();
84
84
  let connection;
85
85
  try {
86
86
  connection = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.listByAppIdAsync(graphqlClient, {
@@ -89,10 +89,10 @@ class SimulatorList extends EasCommand_1.default {
89
89
  after: flags.after,
90
90
  filter: Object.keys(filter).length > 0 ? filter : undefined,
91
91
  });
92
- fetchSpinner?.succeed(`Fetched ${connection.edges.length} device run session(s)`);
92
+ fetchSpinner?.succeed(`Fetched ${connection.edges.length} simulator session(s)`);
93
93
  }
94
94
  catch (err) {
95
- fetchSpinner?.fail('Failed to fetch device run sessions');
95
+ fetchSpinner?.fail('Failed to fetch simulator sessions');
96
96
  throw err;
97
97
  }
98
98
  const sessions = connection.edges.map(edge => edge.node);
@@ -106,9 +106,7 @@ class SimulatorList extends EasCommand_1.default {
106
106
  createdAt: session.createdAt,
107
107
  startedAt: session.startedAt ?? undefined,
108
108
  finishedAt: session.finishedAt ?? undefined,
109
- jobRunUrl: session.turtleJobRun
110
- ? (0, url_1.getBareJobRunUrl)(session.app.ownerAccount.name, session.app.slug, session.turtleJobRun.id)
111
- : undefined,
109
+ deviceRunSessionUrl: (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, session.id),
112
110
  })),
113
111
  pageInfo: connection.pageInfo,
114
112
  });
@@ -116,24 +114,20 @@ class SimulatorList extends EasCommand_1.default {
116
114
  }
117
115
  if (sessions.length === 0) {
118
116
  log_1.default.newLine();
119
- log_1.default.log('No device run sessions found.');
117
+ log_1.default.log('No simulator sessions found.');
120
118
  return;
121
119
  }
122
120
  log_1.default.newLine();
123
121
  const formattedEntries = sessions.map(session => {
124
- const jobRunUrl = session.turtleJobRun
125
- ? (0, url_1.getBareJobRunUrl)(session.app.ownerAccount.name, session.app.slug, session.turtleJobRun.id)
126
- : null;
122
+ const deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, session.id);
127
123
  const lines = [
128
124
  `ID: ${session.id}`,
129
125
  `Type: ${session.type}`,
130
126
  `Status: ${session.status}`,
131
127
  `Platform: ${session.platform}`,
132
128
  `Created: ${(0, date_1.fromNow)(new Date(session.createdAt))} ago`,
129
+ `URL: ${(0, log_1.link)(deviceRunSessionUrl)}`,
133
130
  ];
134
- if (jobRunUrl) {
135
- lines.push(`URL: ${(0, log_1.link)(jobRunUrl)}`);
136
- }
137
131
  return lines.join('\n');
138
132
  });
139
133
  log_1.default.log(formattedEntries.join(`\n\n${chalk_1.default.dim('———')}\n\n`));