eas-cli 23.2.0 → 24.1.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.
- package/README.md +636 -331
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/channel/protection.d.ts +4 -0
- package/build/channel/protection.js +49 -0
- package/build/channel/queries.d.ts +6 -0
- package/build/channel/queries.js +5 -1
- package/build/commands/channel/protect.d.ts +16 -0
- package/build/commands/channel/protect.js +68 -0
- package/build/commands/channel/unprotect.d.ts +16 -0
- package/build/commands/channel/unprotect.js +78 -0
- package/build/commands/observe/errors.d.ts +27 -0
- package/build/commands/observe/errors.js +122 -0
- package/build/commands/observe/event.d.ts +18 -0
- package/build/commands/observe/event.js +149 -0
- package/build/commands/observe/events.d.ts +2 -0
- package/build/commands/observe/events.js +10 -4
- package/build/commands/observe/metrics-summary.d.ts +1 -0
- package/build/commands/observe/metrics-summary.js +3 -2
- package/build/commands/observe/metrics.d.ts +2 -0
- package/build/commands/observe/metrics.js +8 -4
- package/build/commands/observe/routes.d.ts +2 -1
- package/build/commands/observe/routes.js +5 -5
- package/build/commands/observe/session.d.ts +1 -0
- package/build/commands/observe/session.js +14 -8
- package/build/commands/observe/versions.d.ts +1 -0
- package/build/commands/observe/versions.js +3 -2
- package/build/commands/project/status.d.ts +16 -0
- package/build/commands/project/status.js +47 -0
- package/build/commands/simulator/egress.d.ts +13 -0
- package/build/commands/simulator/egress.js +60 -0
- package/build/commands/simulator/get.js +3 -1
- package/build/commands/simulator/index.d.ts +2 -0
- package/build/commands/simulator/index.js +81 -11
- package/build/credentials/ios/credentials.d.ts +5 -3
- package/build/credentials/ios/utils/printCredentials.js +6 -1
- package/build/graphql/generated.d.ts +2388 -1092
- package/build/graphql/generated.js +64 -17
- package/build/graphql/mutations/RealtimeLogsMutation.d.ts +2 -2
- package/build/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +1 -1
- package/build/graphql/queries/AppStoreConnectApiKeyQuery.js +1 -1
- package/build/graphql/queries/ChannelQuery.js +2 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +25 -0
- package/build/graphql/queries/ObserveQuery.d.ts +62 -30
- package/build/graphql/queries/ObserveQuery.js +276 -121
- package/build/graphql/queries/SubmissionQuery.d.ts +6 -1
- package/build/graphql/queries/SubmissionQuery.js +41 -0
- package/build/graphql/types/Observe.d.ts +5 -3
- package/build/graphql/types/Observe.js +80 -21
- package/build/graphql/types/UpdateChannelBasicInfo.js +1 -0
- package/build/observe/fetchCustomEvents.d.ts +6 -4
- package/build/observe/fetchCustomEvents.js +4 -2
- package/build/observe/fetchErrors.d.ts +32 -0
- package/build/observe/fetchErrors.js +42 -0
- package/build/observe/fetchEvents.d.ts +9 -6
- package/build/observe/fetchEvents.js +16 -17
- package/build/observe/fetchMetrics.d.ts +2 -2
- package/build/observe/fetchMetrics.js +9 -9
- package/build/observe/fetchNavigationRoutes.d.ts +7 -5
- package/build/observe/fetchNavigationRoutes.js +8 -8
- package/build/observe/fetchSessions.d.ts +13 -11
- package/build/observe/fetchSessions.js +59 -30
- package/build/observe/fetchVersions.d.ts +4 -3
- package/build/observe/fetchVersions.js +7 -11
- package/build/observe/flags.d.ts +6 -0
- package/build/observe/flags.js +12 -2
- package/build/observe/formatCustomEvents.d.ts +16 -10
- package/build/observe/formatCustomEvents.js +61 -28
- package/build/observe/formatErrors.d.ts +97 -0
- package/build/observe/formatErrors.js +203 -0
- package/build/observe/formatEvents.d.ts +11 -5
- package/build/observe/formatEvents.js +46 -18
- package/build/observe/formatMetrics.d.ts +4 -4
- package/build/observe/formatMetrics.js +2 -2
- package/build/observe/formatNavigationRoutes.d.ts +4 -4
- package/build/observe/formatNavigationRoutes.js +3 -3
- package/build/observe/formatSessions.d.ts +3 -3
- package/build/observe/formatSessions.js +8 -8
- package/build/observe/formatVersions.js +2 -2
- package/build/observe/platforms.d.ts +10 -19
- package/build/observe/platforms.js +42 -40
- package/build/project/projectStatus.d.ts +96 -0
- package/build/project/projectStatus.js +314 -0
- package/build/simulator/egress.d.ts +121 -0
- package/build/simulator/egress.js +865 -0
- package/build/simulator/env.d.ts +5 -0
- package/build/simulator/env.js +42 -1
- package/build/simulator/utils.d.ts +53 -2
- package/build/simulator/utils.js +158 -10
- package/build/submit/utils/urls.js +2 -3
- package/build/utils/centrifuge.d.ts +2 -2
- package/oclif.manifest.json +1162 -546
- package/package.json +7 -7
- package/build/chat/chatClient.d.ts +0 -37
- package/build/chat/chatClient.js +0 -359
- package/build/chat/detectProject.d.ts +0 -5
- package/build/chat/detectProject.js +0 -41
- package/build/chat/renderMarkdown.d.ts +0 -7
- package/build/chat/renderMarkdown.js +0 -47
- package/build/chat/replInput.d.ts +0 -10
- package/build/chat/replInput.js +0 -52
- package/build/commands/chat.d.ts +0 -18
- package/build/commands/chat.js +0 -221
package/build/simulator/env.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare const SIMULATOR_DOTENV_FILE_NAME = ".env.eas-simulator";
|
|
2
2
|
export declare const EAS_SIMULATOR_SESSION_ID = "EAS_SIMULATOR_SESSION_ID";
|
|
3
|
+
export declare const EAS_SIMULATOR_EGRESS_URL = "EAS_SIMULATOR_EGRESS_URL";
|
|
4
|
+
export declare const EAS_SIMULATOR_EGRESS_TOKEN = "EAS_SIMULATOR_EGRESS_TOKEN";
|
|
5
|
+
export declare const EAS_SIMULATOR_EGRESS_FINGERPRINT = "EAS_SIMULATOR_EGRESS_FINGERPRINT";
|
|
6
|
+
export declare const EAS_SIMULATOR_EGRESS_PORT = "EAS_SIMULATOR_EGRESS_PORT";
|
|
7
|
+
export declare const EAS_SIMULATOR_EGRESS_ALLOW = "EAS_SIMULATOR_EGRESS_ALLOW";
|
|
3
8
|
export declare const SIMULATOR_DOTENV_FILE_HEADER = "# Do not commit this file.\n# Do not modify these values manually. They are managed by eas-cli.\n# It holds configuration only for the current simulator session.\n\n";
|
|
4
9
|
export declare function getSimulatorEnvFilePath(projectDir: string): string;
|
|
5
10
|
export declare function loadSimulatorEnvAsync(projectDir: string): Promise<void>;
|
package/build/simulator/env.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SIMULATOR_DOTENV_FILE_HEADER = exports.EAS_SIMULATOR_SESSION_ID = exports.SIMULATOR_DOTENV_FILE_NAME = void 0;
|
|
3
|
+
exports.SIMULATOR_DOTENV_FILE_HEADER = exports.EAS_SIMULATOR_EGRESS_ALLOW = exports.EAS_SIMULATOR_EGRESS_PORT = exports.EAS_SIMULATOR_EGRESS_FINGERPRINT = exports.EAS_SIMULATOR_EGRESS_TOKEN = exports.EAS_SIMULATOR_EGRESS_URL = exports.EAS_SIMULATOR_SESSION_ID = exports.SIMULATOR_DOTENV_FILE_NAME = void 0;
|
|
4
4
|
exports.getSimulatorEnvFilePath = getSimulatorEnvFilePath;
|
|
5
5
|
exports.loadSimulatorEnvAsync = loadSimulatorEnvAsync;
|
|
6
6
|
exports.writeSimulatorEnvAsync = writeSimulatorEnvAsync;
|
|
@@ -13,6 +13,13 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
13
13
|
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
14
14
|
exports.SIMULATOR_DOTENV_FILE_NAME = '.env.eas-simulator';
|
|
15
15
|
exports.EAS_SIMULATOR_SESSION_ID = 'EAS_SIMULATOR_SESSION_ID';
|
|
16
|
+
// Written for sessions started with `--egress local`; read by `eas simulator:egress`.
|
|
17
|
+
exports.EAS_SIMULATOR_EGRESS_URL = 'EAS_SIMULATOR_EGRESS_URL';
|
|
18
|
+
exports.EAS_SIMULATOR_EGRESS_TOKEN = 'EAS_SIMULATOR_EGRESS_TOKEN';
|
|
19
|
+
exports.EAS_SIMULATOR_EGRESS_FINGERPRINT = 'EAS_SIMULATOR_EGRESS_FINGERPRINT';
|
|
20
|
+
exports.EAS_SIMULATOR_EGRESS_PORT = 'EAS_SIMULATOR_EGRESS_PORT';
|
|
21
|
+
// Comma-separated host:port destinations from `--egress-allow`.
|
|
22
|
+
exports.EAS_SIMULATOR_EGRESS_ALLOW = 'EAS_SIMULATOR_EGRESS_ALLOW';
|
|
16
23
|
exports.SIMULATOR_DOTENV_FILE_HEADER = '# Do not commit this file.\n# Do not modify these values manually. They are managed by eas-cli.\n# It holds configuration only for the current simulator session.\n\n';
|
|
17
24
|
function getSimulatorEnvFilePath(projectDir) {
|
|
18
25
|
return path_1.default.join(projectDir, exports.SIMULATOR_DOTENV_FILE_NAME);
|
|
@@ -20,6 +27,40 @@ function getSimulatorEnvFilePath(projectDir) {
|
|
|
20
27
|
async function loadSimulatorEnvAsync(projectDir) {
|
|
21
28
|
const simulatorDotenvFilePath = getSimulatorEnvFilePath(projectDir);
|
|
22
29
|
(0, env_1.loadProjectEnv)(projectDir, { silent: true });
|
|
30
|
+
try {
|
|
31
|
+
const simulatorEnv = (0, dotenv_1.parse)(await fs.readFile(simulatorDotenvFilePath, 'utf8'));
|
|
32
|
+
if (simulatorEnv[exports.EAS_SIMULATOR_SESSION_ID] || simulatorEnv[exports.EAS_SIMULATOR_EGRESS_URL]) {
|
|
33
|
+
// loadEnvFiles never replaces existing variables, even with force: true.
|
|
34
|
+
// Keep this session's credentials and destination policy together rather
|
|
35
|
+
// than combining them with values exported for an older session.
|
|
36
|
+
for (const key of [
|
|
37
|
+
exports.EAS_SIMULATOR_SESSION_ID,
|
|
38
|
+
'AGENT_DEVICE_DAEMON_BASE_URL',
|
|
39
|
+
'AGENT_DEVICE_DAEMON_AUTH_TOKEN',
|
|
40
|
+
'ARGENT_TOOLS_URL',
|
|
41
|
+
'ARGENT_AUTH_TOKEN',
|
|
42
|
+
'APPIUM_URL',
|
|
43
|
+
'APPIUM_CAPS',
|
|
44
|
+
exports.EAS_SIMULATOR_EGRESS_URL,
|
|
45
|
+
exports.EAS_SIMULATOR_EGRESS_TOKEN,
|
|
46
|
+
exports.EAS_SIMULATOR_EGRESS_FINGERPRINT,
|
|
47
|
+
exports.EAS_SIMULATOR_EGRESS_PORT,
|
|
48
|
+
]) {
|
|
49
|
+
if (simulatorEnv[key] === undefined) {
|
|
50
|
+
delete process.env[key];
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
process.env[key] = simulatorEnv[key];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
process.env[exports.EAS_SIMULATOR_EGRESS_ALLOW] = simulatorEnv[exports.EAS_SIMULATOR_EGRESS_ALLOW] ?? '';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
if (!(typeof err === 'object' && err !== null && 'code' in err && err.code === 'ENOENT')) {
|
|
61
|
+
throw err;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
23
64
|
(0, env_1.loadEnvFiles)([simulatorDotenvFilePath], { force: true });
|
|
24
65
|
}
|
|
25
66
|
async function writeSimulatorEnvAsync(projectDir, environmentVariables) {
|
|
@@ -13,7 +13,58 @@ export declare const DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE: Record<string, Devic
|
|
|
13
13
|
export declare function deviceRunSessionTypeToFlagValue(type: DeviceRunSessionType): string;
|
|
14
14
|
export declare const DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES: Record<DeviceRunSessionResourceClass, string>;
|
|
15
15
|
export declare const DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE: Record<string, DeviceRunSessionResourceClass>;
|
|
16
|
-
export
|
|
16
|
+
export type LocalEgressConfig = {
|
|
17
|
+
url: string;
|
|
18
|
+
/** Secret for the tunnel server; the client pairs it with the fixed egress username. */
|
|
19
|
+
token: string;
|
|
20
|
+
fingerprint: string;
|
|
21
|
+
port: number;
|
|
22
|
+
/**
|
|
23
|
+
* Normalized `host:port` destinations on the developer's machine or network
|
|
24
|
+
* that the simulator may reach through the proxy (`--egress-allow`).
|
|
25
|
+
*/
|
|
26
|
+
allow: string[];
|
|
27
|
+
};
|
|
28
|
+
export type LocalEgressOptions = {
|
|
29
|
+
egressAllow?: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Connection details for the local egress client, present only for sessions
|
|
33
|
+
* started with `--egress local`. `allow` comes from the developer's flags, not
|
|
34
|
+
* from the worker.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getLocalEgressConfig(remoteConfig: DeviceRunSessionRemoteConfig, allow?: readonly string[]): LocalEgressConfig | null;
|
|
37
|
+
export type LoopbackForwardPlan = {
|
|
38
|
+
/** Ports the tunnel client forwards on the device host's loopback interface. */
|
|
39
|
+
ports: number[];
|
|
40
|
+
/** Loopback allow entries that stay reachable by name through the proxy only. */
|
|
41
|
+
skipped: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Which `--egress-allow` entries also become loopback port forwards. iOS never
|
|
45
|
+
* sends loopback-literal requests to the system proxy, and Expo CLI rewrites
|
|
46
|
+
* `localhost` to `127.0.0.1` in manifests, so the proxy alone cannot serve a dev
|
|
47
|
+
* server allowed as `localhost:<port>`. For each entry naming `localhost` or
|
|
48
|
+
* `127.0.0.1`, the tunnel client opens a reverse remote that makes
|
|
49
|
+
* `127.0.0.1:<port>` on the device host reach the same port here, like
|
|
50
|
+
* `adb reverse`. The device host only permits unprivileged ports, and the proxy
|
|
51
|
+
* port is already taken by the tunnel server, so those entries are skipped.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getLoopbackForwardPlan(allow: readonly string[], proxyPort: number): LoopbackForwardPlan;
|
|
54
|
+
export declare function formatLoopbackForwardNotice({ ports, skipped }: LoopbackForwardPlan): string[];
|
|
55
|
+
export declare function getLocalEgressEnvironmentVariables(egress: LocalEgressConfig | null): Record<string, string>;
|
|
56
|
+
export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig, { egressAllow }?: LocalEgressOptions): Record<string, string>;
|
|
17
57
|
type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
|
|
18
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
|
|
60
|
+
* a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatPreviewUrl(url: string, token: string | null | undefined): string;
|
|
63
|
+
/**
|
|
64
|
+
* Remote config for `--json`. The preview URL carries the token and the standalone token field is
|
|
65
|
+
* dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
|
|
66
|
+
* it has to know to combine.
|
|
67
|
+
*/
|
|
68
|
+
export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
|
|
69
|
+
export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow }?: LocalEgressOptions): string;
|
|
19
70
|
export {};
|
package/build/simulator/utils.js
CHANGED
|
@@ -3,10 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE = exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES = exports.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE = exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES = exports.EAS_SIMULATOR_WAITLIST_URL = void 0;
|
|
4
4
|
exports.formatSimulatorUnavailableMessage = formatSimulatorUnavailableMessage;
|
|
5
5
|
exports.deviceRunSessionTypeToFlagValue = deviceRunSessionTypeToFlagValue;
|
|
6
|
+
exports.getLocalEgressConfig = getLocalEgressConfig;
|
|
7
|
+
exports.getLoopbackForwardPlan = getLoopbackForwardPlan;
|
|
8
|
+
exports.formatLoopbackForwardNotice = formatLoopbackForwardNotice;
|
|
9
|
+
exports.getLocalEgressEnvironmentVariables = getLocalEgressEnvironmentVariables;
|
|
6
10
|
exports.getRemoteSessionEnvironmentVariables = getRemoteSessionEnvironmentVariables;
|
|
11
|
+
exports.formatPreviewUrl = formatPreviewUrl;
|
|
12
|
+
exports.sanitizeRemoteConfigForJson = sanitizeRemoteConfigForJson;
|
|
7
13
|
exports.formatRemoteSessionInstructions = formatRemoteSessionInstructions;
|
|
8
14
|
const generated_1 = require("../graphql/generated");
|
|
9
15
|
const log_1 = require("../log");
|
|
16
|
+
const env_1 = require("./env");
|
|
10
17
|
/** Landing page where accounts without access can request it. */
|
|
11
18
|
exports.EAS_SIMULATOR_WAITLIST_URL = 'https://expo.dev/services/simulators';
|
|
12
19
|
/**
|
|
@@ -37,7 +44,84 @@ exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES = {
|
|
|
37
44
|
[generated_1.DeviceRunSessionResourceClass.Medium]: 'medium',
|
|
38
45
|
};
|
|
39
46
|
exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE = Object.fromEntries(Object.entries(exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES).map(([resourceClass, value]) => [value, resourceClass]));
|
|
40
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Connection details for the local egress client, present only for sessions
|
|
49
|
+
* started with `--egress local`. `allow` comes from the developer's flags, not
|
|
50
|
+
* from the worker.
|
|
51
|
+
*/
|
|
52
|
+
function getLocalEgressConfig(remoteConfig, allow = []) {
|
|
53
|
+
const { egressUrl, egressToken, egressFingerprint, egressPort } = remoteConfig;
|
|
54
|
+
if (!egressUrl || !egressToken || !egressFingerprint || egressPort == null) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
url: egressUrl,
|
|
59
|
+
token: egressToken,
|
|
60
|
+
fingerprint: egressFingerprint,
|
|
61
|
+
port: egressPort,
|
|
62
|
+
allow: [...allow],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Which `--egress-allow` entries also become loopback port forwards. iOS never
|
|
67
|
+
* sends loopback-literal requests to the system proxy, and Expo CLI rewrites
|
|
68
|
+
* `localhost` to `127.0.0.1` in manifests, so the proxy alone cannot serve a dev
|
|
69
|
+
* server allowed as `localhost:<port>`. For each entry naming `localhost` or
|
|
70
|
+
* `127.0.0.1`, the tunnel client opens a reverse remote that makes
|
|
71
|
+
* `127.0.0.1:<port>` on the device host reach the same port here, like
|
|
72
|
+
* `adb reverse`. The device host only permits unprivileged ports, and the proxy
|
|
73
|
+
* port is already taken by the tunnel server, so those entries are skipped.
|
|
74
|
+
*/
|
|
75
|
+
function getLoopbackForwardPlan(allow, proxyPort) {
|
|
76
|
+
const ports = new Set();
|
|
77
|
+
const skipped = [];
|
|
78
|
+
for (const destination of allow) {
|
|
79
|
+
const match = /^(?:localhost|127\.0\.0\.1):(\d+)$/.exec(destination);
|
|
80
|
+
if (!match) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const port = Number(match[1]);
|
|
84
|
+
if (port < 1024 || port === proxyPort) {
|
|
85
|
+
skipped.push(destination);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
ports.add(port);
|
|
89
|
+
}
|
|
90
|
+
return { ports: [...ports].sort((a, b) => a - b), skipped };
|
|
91
|
+
}
|
|
92
|
+
function formatLoopbackForwardNotice({ ports, skipped }) {
|
|
93
|
+
const lines = [];
|
|
94
|
+
if (ports.length > 0) {
|
|
95
|
+
const addresses = ports.map(port => `127.0.0.1:${port}`).join(', ');
|
|
96
|
+
lines.push(`${addresses} in the simulator ${ports.length === 1 ? 'reaches' : 'reach'} the same ` +
|
|
97
|
+
`${ports.length === 1 ? 'port' : 'ports'} on this machine (like adb reverse), so dev server ` +
|
|
98
|
+
'URLs that use 127.0.0.1 work.');
|
|
99
|
+
}
|
|
100
|
+
if (skipped.length > 0) {
|
|
101
|
+
lines.push(`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
|
|
102
|
+
'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.');
|
|
103
|
+
}
|
|
104
|
+
return lines;
|
|
105
|
+
}
|
|
106
|
+
function getLocalEgressEnvironmentVariables(egress) {
|
|
107
|
+
if (!egress) {
|
|
108
|
+
return {};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
[env_1.EAS_SIMULATOR_EGRESS_URL]: egress.url,
|
|
112
|
+
[env_1.EAS_SIMULATOR_EGRESS_TOKEN]: egress.token,
|
|
113
|
+
[env_1.EAS_SIMULATOR_EGRESS_FINGERPRINT]: egress.fingerprint,
|
|
114
|
+
[env_1.EAS_SIMULATOR_EGRESS_PORT]: String(egress.port),
|
|
115
|
+
[env_1.EAS_SIMULATOR_EGRESS_ALLOW]: egress.allow.join(','),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function getRemoteSessionEnvironmentVariables(remoteConfig, { egressAllow } = {}) {
|
|
119
|
+
return {
|
|
120
|
+
...getControllerEnvironmentVariables(remoteConfig),
|
|
121
|
+
...getLocalEgressEnvironmentVariables(getLocalEgressConfig(remoteConfig, egressAllow)),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function getControllerEnvironmentVariables(remoteConfig) {
|
|
41
125
|
switch (remoteConfig.__typename) {
|
|
42
126
|
case 'AgentDeviceRunSessionRemoteConfig':
|
|
43
127
|
return {
|
|
@@ -59,10 +143,74 @@ function getRemoteSessionEnvironmentVariables(remoteConfig) {
|
|
|
59
143
|
return {};
|
|
60
144
|
}
|
|
61
145
|
}
|
|
62
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
|
|
148
|
+
* a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
|
|
149
|
+
*/
|
|
150
|
+
function formatPreviewUrl(url, token) {
|
|
151
|
+
if (!token) {
|
|
152
|
+
return url;
|
|
153
|
+
}
|
|
154
|
+
const withToken = new URL(url);
|
|
155
|
+
withToken.searchParams.set('token', token);
|
|
156
|
+
return withToken.toString();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Remote config for `--json`. The preview URL carries the token and the standalone token field is
|
|
160
|
+
* dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
|
|
161
|
+
* it has to know to combine.
|
|
162
|
+
*/
|
|
163
|
+
function sanitizeRemoteConfigForJson(remoteConfig) {
|
|
164
|
+
switch (remoteConfig.__typename) {
|
|
165
|
+
case 'ServeSimRunSessionRemoteConfig':
|
|
166
|
+
case 'WebPreviewOnlyRunSessionRemoteConfig': {
|
|
167
|
+
const { previewToken, ...rest } = remoteConfig;
|
|
168
|
+
return { ...rest, previewUrl: formatPreviewUrl(remoteConfig.previewUrl, previewToken) };
|
|
169
|
+
}
|
|
170
|
+
case 'AgentDeviceRunSessionRemoteConfig':
|
|
171
|
+
case 'ArgentRunSessionRemoteConfig':
|
|
172
|
+
case 'AppiumRunSessionRemoteConfig': {
|
|
173
|
+
const { webPreviewToken, ...rest } = remoteConfig;
|
|
174
|
+
return {
|
|
175
|
+
...rest,
|
|
176
|
+
webPreviewUrl: remoteConfig.webPreviewUrl
|
|
177
|
+
? formatPreviewUrl(remoteConfig.webPreviewUrl, webPreviewToken)
|
|
178
|
+
: remoteConfig.webPreviewUrl,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow } = {}) {
|
|
184
|
+
const instructions = formatControllerInstructions(remoteConfig, configType);
|
|
185
|
+
const egress = getLocalEgressConfig(remoteConfig, egressAllow);
|
|
186
|
+
if (!egress) {
|
|
187
|
+
return instructions;
|
|
188
|
+
}
|
|
189
|
+
return [
|
|
190
|
+
instructions,
|
|
191
|
+
'',
|
|
192
|
+
'🔀 This session can route proxied HTTP(S) requests through this machine.',
|
|
193
|
+
...(configType === 'env'
|
|
194
|
+
? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(([key, value]) => `export ${key}='${value}'`)
|
|
195
|
+
: []),
|
|
196
|
+
'Run the egress client to connect the tunnel:',
|
|
197
|
+
'',
|
|
198
|
+
configType === 'env' ? 'eas simulator:egress --config-type env' : 'eas simulator:egress',
|
|
199
|
+
'',
|
|
200
|
+
'Keep it running for the life of the session.',
|
|
201
|
+
...(egress.allow.length > 0
|
|
202
|
+
? [
|
|
203
|
+
'',
|
|
204
|
+
`The simulator may reach ${egress.allow.join(', ')} on this machine's network.`,
|
|
205
|
+
...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
|
|
206
|
+
]
|
|
207
|
+
: []),
|
|
208
|
+
].join('\n');
|
|
209
|
+
}
|
|
210
|
+
function formatControllerInstructions(remoteConfig, configType) {
|
|
63
211
|
switch (remoteConfig.__typename) {
|
|
64
212
|
case 'AgentDeviceRunSessionRemoteConfig': {
|
|
65
|
-
const environmentVariables =
|
|
213
|
+
const environmentVariables = getControllerEnvironmentVariables(remoteConfig);
|
|
66
214
|
const lines = configType === 'dotenv'
|
|
67
215
|
? [
|
|
68
216
|
'🔑 Run the following to use agent-device with the simulator:',
|
|
@@ -75,12 +223,12 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
75
223
|
...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
|
|
76
224
|
];
|
|
77
225
|
if (remoteConfig.webPreviewUrl) {
|
|
78
|
-
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', remoteConfig.webPreviewUrl);
|
|
226
|
+
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
79
227
|
}
|
|
80
228
|
return lines.join('\n');
|
|
81
229
|
}
|
|
82
230
|
case 'ArgentRunSessionRemoteConfig': {
|
|
83
|
-
const environmentVariables =
|
|
231
|
+
const environmentVariables = getControllerEnvironmentVariables(remoteConfig);
|
|
84
232
|
const lines = configType === 'dotenv'
|
|
85
233
|
? [
|
|
86
234
|
'🔑 Run the following to link your local Argent client to this simulator session:',
|
|
@@ -105,12 +253,12 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
105
253
|
...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
|
|
106
254
|
];
|
|
107
255
|
if (remoteConfig.webPreviewUrl) {
|
|
108
|
-
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', remoteConfig.webPreviewUrl);
|
|
256
|
+
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
109
257
|
}
|
|
110
258
|
return lines.join('\n');
|
|
111
259
|
}
|
|
112
260
|
case 'AppiumRunSessionRemoteConfig': {
|
|
113
|
-
const environmentVariables =
|
|
261
|
+
const environmentVariables = getControllerEnvironmentVariables(remoteConfig);
|
|
114
262
|
const lines = configType === 'dotenv'
|
|
115
263
|
? [
|
|
116
264
|
'Run an Appium client with the simulator session environment:',
|
|
@@ -125,7 +273,7 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
125
273
|
'<appium-client> [args...]',
|
|
126
274
|
];
|
|
127
275
|
if (remoteConfig.webPreviewUrl) {
|
|
128
|
-
lines.push('', 'Open the simulator preview:', '', remoteConfig.webPreviewUrl);
|
|
276
|
+
lines.push('', 'Open the simulator preview:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
129
277
|
}
|
|
130
278
|
return lines.join('\n');
|
|
131
279
|
}
|
|
@@ -133,13 +281,13 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
133
281
|
return [
|
|
134
282
|
'🌐 Open the following URL in your browser to access the simulator:',
|
|
135
283
|
'',
|
|
136
|
-
remoteConfig.previewUrl,
|
|
284
|
+
formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
|
|
137
285
|
].join('\n');
|
|
138
286
|
case 'WebPreviewOnlyRunSessionRemoteConfig':
|
|
139
287
|
return [
|
|
140
288
|
'🌐 Open the following URL in your browser to access the simulator:',
|
|
141
289
|
'',
|
|
142
|
-
remoteConfig.previewUrl,
|
|
290
|
+
formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
|
|
143
291
|
].join('\n');
|
|
144
292
|
}
|
|
145
293
|
}
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.printSubmissionDetailsUrls = printSubmissionDetailsUrls;
|
|
4
4
|
exports.getSubmissionDetailsUrl = getSubmissionDetailsUrl;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const url_1 = require("url");
|
|
7
|
-
const api_1 = require("../../api");
|
|
6
|
+
const url_1 = require("../../build/utils/url");
|
|
8
7
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
9
8
|
const platform_1 = require("../../platform");
|
|
10
9
|
function printSubmissionDetailsUrls(submissions) {
|
|
@@ -20,5 +19,5 @@ function printSubmissionDetailsUrls(submissions) {
|
|
|
20
19
|
}
|
|
21
20
|
function getSubmissionDetailsUrl(submission) {
|
|
22
21
|
const { id, app } = submission;
|
|
23
|
-
return
|
|
22
|
+
return (0, url_1.getSubmissionUrl)(app.ownerAccount.name, app.slug, id);
|
|
24
23
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import {
|
|
2
|
+
import { RealtimeLogsMutation_GenerateCentrifugoSubscriptionTokenArgs } from '../graphql/generated';
|
|
3
3
|
export type RealtimeLogsSubscription = {
|
|
4
4
|
close: () => void;
|
|
5
5
|
};
|
|
6
6
|
export type RealtimeLogsClient = {
|
|
7
|
-
subscribeAsync: (args:
|
|
7
|
+
subscribeAsync: (args: RealtimeLogsMutation_GenerateCentrifugoSubscriptionTokenArgs, onPublication: (data: unknown) => void) => Promise<RealtimeLogsSubscription | null>;
|
|
8
8
|
close: () => void;
|
|
9
9
|
};
|
|
10
10
|
export declare function createRealtimeLogsClient(graphqlClient: ExpoGraphqlClient): RealtimeLogsClient | null;
|