eas-cli 12.6.0 → 12.6.1

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 (143) hide show
  1. package/README.md +63 -63
  2. package/build/build/evaluateConfigWithEnvVarsAsync.js +27 -11
  3. package/build/commandUtils/EasCommand.d.ts +36 -5
  4. package/build/commandUtils/EasCommand.js +27 -2
  5. package/build/commandUtils/context/ContextField.d.ts +5 -0
  6. package/build/commandUtils/context/DynamicLoggedInContextField.d.ts +14 -0
  7. package/build/commandUtils/context/DynamicLoggedInContextField.js +25 -0
  8. package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +2 -2
  9. package/build/commandUtils/context/DynamicProjectConfigContextField.js +40 -2
  10. package/build/commandUtils/context/LoggedInContextField.d.ts +7 -7
  11. package/build/commandUtils/context/LoggedInContextField.js +2 -1
  12. package/build/commandUtils/context/MaybeLoggedInContextField.d.ts +9 -7
  13. package/build/commandUtils/context/MaybeLoggedInContextField.js +1 -0
  14. package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.d.ts +1 -1
  15. package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.js +17 -2
  16. package/build/commandUtils/context/PrivateProjectConfigContextField.d.ts +1 -1
  17. package/build/commandUtils/context/PrivateProjectConfigContextField.js +17 -2
  18. package/build/commandUtils/context/ProjectIdContextField.d.ts +4 -0
  19. package/build/commandUtils/context/ProjectIdContextField.js +19 -0
  20. package/build/commandUtils/context/ServerSideEnvironmentVariablesContextField.d.ts +6 -0
  21. package/build/commandUtils/context/ServerSideEnvironmentVariablesContextField.js +36 -0
  22. package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.d.ts +7 -0
  23. package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.js +42 -0
  24. package/build/commands/account/view.d.ts +0 -1
  25. package/build/commands/account/view.js +2 -3
  26. package/build/commands/branch/create.d.ts +1 -1
  27. package/build/commands/branch/create.js +2 -2
  28. package/build/commands/branch/delete.d.ts +1 -1
  29. package/build/commands/branch/delete.js +2 -2
  30. package/build/commands/branch/list.d.ts +1 -1
  31. package/build/commands/branch/list.js +2 -2
  32. package/build/commands/branch/rename.d.ts +1 -1
  33. package/build/commands/branch/rename.js +2 -2
  34. package/build/commands/branch/view.d.ts +1 -1
  35. package/build/commands/branch/view.js +2 -2
  36. package/build/commands/build/cancel.d.ts +1 -1
  37. package/build/commands/build/cancel.js +2 -2
  38. package/build/commands/build/configure.js +1 -0
  39. package/build/commands/build/delete.d.ts +1 -1
  40. package/build/commands/build/delete.js +2 -2
  41. package/build/commands/build/index.js +1 -0
  42. package/build/commands/build/inspect.js +1 -0
  43. package/build/commands/build/internal.js +1 -0
  44. package/build/commands/build/list.d.ts +1 -1
  45. package/build/commands/build/list.js +2 -2
  46. package/build/commands/build/resign.js +1 -0
  47. package/build/commands/build/run.d.ts +1 -2
  48. package/build/commands/build/run.js +2 -3
  49. package/build/commands/build/version/get.js +1 -0
  50. package/build/commands/build/version/set.js +1 -0
  51. package/build/commands/build/version/sync.js +1 -0
  52. package/build/commands/build/view.d.ts +1 -1
  53. package/build/commands/build/view.js +2 -2
  54. package/build/commands/channel/create.d.ts +1 -1
  55. package/build/commands/channel/create.js +2 -2
  56. package/build/commands/channel/delete.d.ts +1 -1
  57. package/build/commands/channel/delete.js +2 -2
  58. package/build/commands/channel/edit.d.ts +1 -1
  59. package/build/commands/channel/edit.js +2 -2
  60. package/build/commands/channel/list.d.ts +1 -1
  61. package/build/commands/channel/list.js +2 -2
  62. package/build/commands/channel/pause.d.ts +1 -1
  63. package/build/commands/channel/pause.js +2 -2
  64. package/build/commands/channel/resume.d.ts +1 -1
  65. package/build/commands/channel/resume.js +2 -2
  66. package/build/commands/channel/rollout.js +1 -0
  67. package/build/commands/channel/view.d.ts +1 -1
  68. package/build/commands/channel/view.js +2 -2
  69. package/build/commands/config.d.ts +1 -1
  70. package/build/commands/config.js +4 -7
  71. package/build/commands/credentials/configure-build.js +1 -0
  72. package/build/commands/credentials/index.d.ts +1 -1
  73. package/build/commands/credentials/index.js +2 -1
  74. package/build/commands/device/create.d.ts +1 -1
  75. package/build/commands/device/create.js +2 -1
  76. package/build/commands/device/delete.d.ts +1 -1
  77. package/build/commands/device/delete.js +2 -2
  78. package/build/commands/device/list.d.ts +1 -1
  79. package/build/commands/device/list.js +2 -2
  80. package/build/commands/device/rename.d.ts +1 -1
  81. package/build/commands/device/rename.js +2 -2
  82. package/build/commands/device/view.d.ts +1 -1
  83. package/build/commands/device/view.js +2 -2
  84. package/build/commands/env/create.d.ts +1 -1
  85. package/build/commands/env/create.js +8 -3
  86. package/build/commands/env/delete.d.ts +1 -1
  87. package/build/commands/env/delete.js +2 -2
  88. package/build/commands/env/exec.d.ts +1 -1
  89. package/build/commands/env/exec.js +2 -2
  90. package/build/commands/env/get.d.ts +1 -1
  91. package/build/commands/env/get.js +2 -2
  92. package/build/commands/env/link.d.ts +1 -1
  93. package/build/commands/env/link.js +2 -2
  94. package/build/commands/env/list.d.ts +1 -1
  95. package/build/commands/env/list.js +2 -2
  96. package/build/commands/env/pull.d.ts +2 -1
  97. package/build/commands/env/pull.js +22 -8
  98. package/build/commands/env/push.d.ts +1 -1
  99. package/build/commands/env/push.js +13 -2
  100. package/build/commands/env/unlink.d.ts +1 -1
  101. package/build/commands/env/unlink.js +2 -2
  102. package/build/commands/env/update.d.ts +1 -1
  103. package/build/commands/env/update.js +8 -6
  104. package/build/commands/metadata/pull.js +1 -0
  105. package/build/commands/metadata/push.js +1 -0
  106. package/build/commands/open.js +1 -0
  107. package/build/commands/project/info.d.ts +1 -1
  108. package/build/commands/project/info.js +2 -2
  109. package/build/commands/secret/create.d.ts +1 -1
  110. package/build/commands/secret/create.js +2 -2
  111. package/build/commands/secret/delete.d.ts +1 -1
  112. package/build/commands/secret/delete.js +2 -2
  113. package/build/commands/secret/list.d.ts +1 -1
  114. package/build/commands/secret/list.js +2 -2
  115. package/build/commands/secret/push.d.ts +1 -1
  116. package/build/commands/secret/push.js +2 -2
  117. package/build/commands/submit/internal.js +1 -0
  118. package/build/commands/submit.js +1 -0
  119. package/build/commands/update/configure.js +1 -0
  120. package/build/commands/update/edit.d.ts +1 -1
  121. package/build/commands/update/edit.js +2 -2
  122. package/build/commands/update/index.d.ts +2 -0
  123. package/build/commands/update/index.js +29 -3
  124. package/build/commands/update/list.d.ts +1 -1
  125. package/build/commands/update/list.js +2 -2
  126. package/build/commands/update/republish.js +1 -0
  127. package/build/commands/update/roll-back-to-embedded.js +1 -0
  128. package/build/commands/webhook/create.d.ts +1 -1
  129. package/build/commands/webhook/create.js +2 -2
  130. package/build/commands/webhook/delete.d.ts +1 -1
  131. package/build/commands/webhook/delete.js +2 -2
  132. package/build/commands/webhook/list.d.ts +1 -1
  133. package/build/commands/webhook/list.js +2 -2
  134. package/build/commands/worker/alias.js +1 -0
  135. package/build/commands/worker/deploy.js +1 -1
  136. package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +1 -0
  137. package/build/project/publish.d.ts +2 -1
  138. package/build/project/publish.js +10 -4
  139. package/build/user/SessionManager.d.ts +1 -1
  140. package/build/utils/expoCli.d.ts +2 -1
  141. package/build/utils/expoCli.js +5 -1
  142. package/oclif.manifest.json +99 -85
  143. package/package.json +2 -2
@@ -1,14 +1,18 @@
1
1
  import { Command } from '@oclif/core';
2
2
  import AnalyticsContextField from './context/AnalyticsContextField';
3
3
  import ContextField from './context/ContextField';
4
+ import DynamicLoggedInContextField from './context/DynamicLoggedInContextField';
4
5
  import { DynamicPrivateProjectConfigContextField, DynamicPublicProjectConfigContextField } from './context/DynamicProjectConfigContextField';
5
6
  import LoggedInContextField from './context/LoggedInContextField';
6
7
  import MaybeLoggedInContextField from './context/MaybeLoggedInContextField';
7
8
  import { OptionalPrivateProjectConfigContextField } from './context/OptionalPrivateProjectConfigContextField';
8
9
  import { PrivateProjectConfigContextField } from './context/PrivateProjectConfigContextField';
9
10
  import ProjectDirContextField from './context/ProjectDirContextField';
11
+ import { ProjectIdContextField } from './context/ProjectIdContextField';
12
+ import { ServerSideEnvironmentVariablesContextField } from './context/ServerSideEnvironmentVariablesContextField';
10
13
  import SessionManagementContextField from './context/SessionManagementContextField';
11
14
  import VcsClientContextField from './context/VcsClientContextField';
15
+ import { EnvironmentVariableEnvironment } from '../graphql/generated';
12
16
  import { Client } from '../vcs/vcs';
13
17
  export type ContextInput<T extends {
14
18
  [name: string]: any;
@@ -20,6 +24,19 @@ export type ContextOutput<T extends {
20
24
  } = object> = {
21
25
  [P in keyof T]: T[P];
22
26
  };
27
+ type GetContextType<Type> = {
28
+ [Property in keyof Type]: any;
29
+ };
30
+ interface BaseGetContextAsyncArgs {
31
+ nonInteractive: boolean;
32
+ vcsClientOverride?: Client;
33
+ }
34
+ interface GetContextAsyncArgsWithRequiredServerSideEnvironmentArgument extends BaseGetContextAsyncArgs {
35
+ withServerSideEnvironment: EnvironmentVariableEnvironment | null;
36
+ }
37
+ interface GetContextAsyncArgsWithoutServerSideEnvironmentArgument extends BaseGetContextAsyncArgs {
38
+ withServerSideEnvironment?: never;
39
+ }
23
40
  export default abstract class EasCommand extends Command {
24
41
  protected static readonly ContextOptions: {
25
42
  /**
@@ -36,8 +53,15 @@ export default abstract class EasCommand extends Command {
36
53
  MaybeLoggedIn: {
37
54
  maybeLoggedIn: MaybeLoggedInContextField;
38
55
  };
56
+ /**
57
+ * Specify this context if the logged-in requirement is only necessary in a particular execution of the command.
58
+ */
59
+ DynamicLoggedIn: {
60
+ getDynamicLoggedInAsync: DynamicLoggedInContextField;
61
+ };
39
62
  /**
40
63
  * Specify this context requirement if the command needs to mutate the user session.
64
+ * @deprecated Should not be used outside of session management commands, which currently only includes `login` and `logout`.
41
65
  */
42
66
  SessionManagment: {
43
67
  sessionManager: SessionManagementContextField;
@@ -47,7 +71,7 @@ export default abstract class EasCommand extends Command {
47
71
  * run within a project directory, null otherwise.
48
72
  */
49
73
  OptionalProjectConfig: {
50
- privateProjectConfig: OptionalPrivateProjectConfigContextField;
74
+ optionalPrivateProjectConfig: OptionalPrivateProjectConfigContextField;
51
75
  };
52
76
  /**
53
77
  * Require this command to be run in a project directory. Return the project directory in the context.
@@ -80,6 +104,15 @@ export default abstract class EasCommand extends Command {
80
104
  Vcs: {
81
105
  vcsClient: VcsClientContextField;
82
106
  };
107
+ ServerSideEnvironmentVariables: {
108
+ getServerSideEnvironmentVariablesAsync: ServerSideEnvironmentVariablesContextField;
109
+ };
110
+ /**
111
+ * Require the project to be identified and registered on server. Returns the project ID evaluated from the app config.
112
+ */
113
+ ProjectId: {
114
+ projectId: ProjectIdContextField;
115
+ };
83
116
  };
84
117
  /**
85
118
  * Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
@@ -108,10 +141,7 @@ export default abstract class EasCommand extends Command {
108
141
  [name: string]: any;
109
142
  } = object>(commandClass: {
110
143
  contextDefinition: ContextInput<C>;
111
- }, { nonInteractive, vcsClientOverride }: {
112
- nonInteractive: boolean;
113
- vcsClientOverride?: Client;
114
- }): Promise<ContextOutput<C>>;
144
+ }, { nonInteractive, vcsClientOverride, withServerSideEnvironment, }: C extends GetContextType<typeof EasCommand.ContextOptions.ProjectConfig> | GetContextType<typeof EasCommand.ContextOptions.DynamicProjectConfig> | GetContextType<typeof EasCommand.ContextOptions.OptionalProjectConfig> | GetContextType<typeof EasCommand.ContextOptions.ServerSideEnvironmentVariables> ? GetContextAsyncArgsWithRequiredServerSideEnvironmentArgument : GetContextAsyncArgsWithoutServerSideEnvironmentArgument): Promise<ContextOutput<C>>;
115
145
  private get sessionManager();
116
146
  private get analytics();
117
147
  protected abstract runAsync(): Promise<any>;
@@ -119,3 +149,4 @@ export default abstract class EasCommand extends Command {
119
149
  finally(err: Error): Promise<any>;
120
150
  protected catch(err: Error): Promise<any>;
121
151
  }
152
+ export {};
@@ -6,12 +6,15 @@ const core_2 = require("@urql/core");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
8
8
  const AnalyticsContextField_1 = tslib_1.__importDefault(require("./context/AnalyticsContextField"));
9
+ const DynamicLoggedInContextField_1 = tslib_1.__importDefault(require("./context/DynamicLoggedInContextField"));
9
10
  const DynamicProjectConfigContextField_1 = require("./context/DynamicProjectConfigContextField");
10
11
  const LoggedInContextField_1 = tslib_1.__importDefault(require("./context/LoggedInContextField"));
11
12
  const MaybeLoggedInContextField_1 = tslib_1.__importDefault(require("./context/MaybeLoggedInContextField"));
12
13
  const OptionalPrivateProjectConfigContextField_1 = require("./context/OptionalPrivateProjectConfigContextField");
13
14
  const PrivateProjectConfigContextField_1 = require("./context/PrivateProjectConfigContextField");
14
15
  const ProjectDirContextField_1 = tslib_1.__importDefault(require("./context/ProjectDirContextField"));
16
+ const ProjectIdContextField_1 = require("./context/ProjectIdContextField");
17
+ const ServerSideEnvironmentVariablesContextField_1 = require("./context/ServerSideEnvironmentVariablesContextField");
15
18
  const SessionManagementContextField_1 = tslib_1.__importDefault(require("./context/SessionManagementContextField"));
16
19
  const VcsClientContextField_1 = tslib_1.__importDefault(require("./context/VcsClientContextField"));
17
20
  const errors_1 = require("./errors");
@@ -23,7 +26,10 @@ class EasCommand extends core_1.Command {
23
26
  /**
24
27
  * Execute the context in the contextDefinition to satisfy command prerequisites.
25
28
  */
26
- async getContextAsync(commandClass, { nonInteractive, vcsClientOverride }) {
29
+ async getContextAsync(commandClass, { nonInteractive, vcsClientOverride,
30
+ // if specified and not null, the env vars from the selected environment will be fetched from the server
31
+ // to resolve dynamic config (if dynamic config context is used) and enable getServerSideEnvironmentVariablesAsync function (if server side environment variables context is used)
32
+ withServerSideEnvironment, }) {
27
33
  const contextDefinition = commandClass.contextDefinition;
28
34
  // do these serially so that they don't do things like ask for login twice in parallel
29
35
  const contextValuePairs = [];
@@ -35,6 +41,7 @@ class EasCommand extends core_1.Command {
35
41
  sessionManager: this.sessionManager,
36
42
  analytics: this.analytics,
37
43
  vcsClientOverride,
44
+ withServerSideEnvironment,
38
45
  }),
39
46
  ]);
40
47
  }
@@ -114,8 +121,16 @@ EasCommand.ContextOptions = {
114
121
  MaybeLoggedIn: {
115
122
  maybeLoggedIn: new MaybeLoggedInContextField_1.default(),
116
123
  },
124
+ /**
125
+ * Specify this context if the logged-in requirement is only necessary in a particular execution of the command.
126
+ */
127
+ DynamicLoggedIn: {
128
+ // eslint-disable-next-line async-protect/async-suffix
129
+ getDynamicLoggedInAsync: new DynamicLoggedInContextField_1.default(),
130
+ },
117
131
  /**
118
132
  * Specify this context requirement if the command needs to mutate the user session.
133
+ * @deprecated Should not be used outside of session management commands, which currently only includes `login` and `logout`.
119
134
  */
120
135
  SessionManagment: {
121
136
  sessionManager: new SessionManagementContextField_1.default(),
@@ -125,7 +140,7 @@ EasCommand.ContextOptions = {
125
140
  * run within a project directory, null otherwise.
126
141
  */
127
142
  OptionalProjectConfig: {
128
- privateProjectConfig: new OptionalPrivateProjectConfigContextField_1.OptionalPrivateProjectConfigContextField(),
143
+ optionalPrivateProjectConfig: new OptionalPrivateProjectConfigContextField_1.OptionalPrivateProjectConfigContextField(),
129
144
  },
130
145
  /**
131
146
  * Require this command to be run in a project directory. Return the project directory in the context.
@@ -160,6 +175,16 @@ EasCommand.ContextOptions = {
160
175
  Vcs: {
161
176
  vcsClient: new VcsClientContextField_1.default(),
162
177
  },
178
+ ServerSideEnvironmentVariables: {
179
+ // eslint-disable-next-line async-protect/async-suffix
180
+ getServerSideEnvironmentVariablesAsync: new ServerSideEnvironmentVariablesContextField_1.ServerSideEnvironmentVariablesContextField(),
181
+ },
182
+ /**
183
+ * Require the project to be identified and registered on server. Returns the project ID evaluated from the app config.
184
+ */
185
+ ProjectId: {
186
+ projectId: new ProjectIdContextField_1.ProjectIdContextField(),
187
+ },
163
188
  };
164
189
  /**
165
190
  * Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
@@ -1,4 +1,5 @@
1
1
  import { Analytics } from '../../analytics/AnalyticsManager';
2
+ import { EnvironmentVariableEnvironment } from '../../graphql/generated';
2
3
  import SessionManager from '../../user/SessionManager';
3
4
  import { Client } from '../../vcs/vcs';
4
5
  export interface ContextOptions {
@@ -6,6 +7,10 @@ export interface ContextOptions {
6
7
  analytics: Analytics;
7
8
  nonInteractive: boolean;
8
9
  vcsClientOverride?: Client;
10
+ /**
11
+ * If specified, env variables from the selected environment will be fetched from the server and used to evaluate the dynamic config.
12
+ */
13
+ withServerSideEnvironment?: EnvironmentVariableEnvironment | null;
9
14
  }
10
15
  export default abstract class ContextField<T> {
11
16
  abstract getValueAsync(options: ContextOptions): Promise<T>;
@@ -0,0 +1,14 @@
1
+ import ContextField, { ContextOptions } from './ContextField';
2
+ import { ExpoGraphqlClient } from './contextUtils/createGraphqlClient';
3
+ import { LoggedInAuthenticationInfo } from '../../user/SessionManager';
4
+ import { Actor } from '../../user/User';
5
+ import FeatureGating from '../gating/FeatureGating';
6
+ export type DynamicLoggedInContextFn = () => Promise<{
7
+ actor: Actor;
8
+ featureGating: FeatureGating;
9
+ graphqlClient: ExpoGraphqlClient;
10
+ authenticationInfo: LoggedInAuthenticationInfo;
11
+ }>;
12
+ export default class DynamicLoggedInContextField extends ContextField<DynamicLoggedInContextFn> {
13
+ getValueAsync({ nonInteractive, sessionManager, }: ContextOptions): Promise<DynamicLoggedInContextFn>;
14
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
5
+ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
+ const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
7
+ const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
8
+ class DynamicLoggedInContextField extends ContextField_1.default {
9
+ async getValueAsync({ nonInteractive, sessionManager, }) {
10
+ return async () => {
11
+ const { actor, authenticationInfo } = await sessionManager.ensureLoggedInAsync({
12
+ nonInteractive,
13
+ });
14
+ const featureGateServerValues = actor?.featureGates ?? {};
15
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
16
+ return {
17
+ actor,
18
+ featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
19
+ graphqlClient,
20
+ authenticationInfo,
21
+ };
22
+ };
23
+ }
24
+ }
25
+ exports.default = DynamicLoggedInContextField;
@@ -7,8 +7,8 @@ export type DynamicConfigContextFn = (options?: ExpoConfigOptions) => Promise<{
7
7
  projectDir: string;
8
8
  }>;
9
9
  export declare class DynamicPublicProjectConfigContextField extends ContextField<DynamicConfigContextFn> {
10
- getValueAsync({ nonInteractive, sessionManager, }: ContextOptions): Promise<DynamicConfigContextFn>;
10
+ getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<DynamicConfigContextFn>;
11
11
  }
12
12
  export declare class DynamicPrivateProjectConfigContextField extends ContextField<DynamicConfigContextFn> {
13
- getValueAsync({ nonInteractive, sessionManager, }: ContextOptions): Promise<DynamicConfigContextFn>;
13
+ getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<DynamicConfigContextFn>;
14
14
  }
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamicPrivateProjectConfigContextField = exports.DynamicPublicProjectConfigContextField = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
6
+ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
7
  const findProjectDirAndVerifyProjectSetupAsync_1 = require("./contextUtils/findProjectDirAndVerifyProjectSetupAsync");
7
8
  const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
9
+ const loadServerSideEnvironmentVariablesAsync_1 = require("./contextUtils/loadServerSideEnvironmentVariablesAsync");
8
10
  const expoConfig_1 = require("../../project/expoConfig");
9
11
  class DynamicPublicProjectConfigContextField extends ContextField_1.default {
10
- async getValueAsync({ nonInteractive, sessionManager, }) {
12
+ async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
11
13
  const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
12
14
  return async (options) => {
13
15
  const expBefore = (0, expoConfig_1.getPublicExpoConfig)(projectDir, options);
@@ -15,6 +17,24 @@ class DynamicPublicProjectConfigContextField extends ContextField_1.default {
15
17
  nonInteractive,
16
18
  env: options?.env,
17
19
  });
20
+ if (withServerSideEnvironment) {
21
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
22
+ nonInteractive,
23
+ });
24
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
25
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
26
+ environment: withServerSideEnvironment,
27
+ projectId,
28
+ graphqlClient,
29
+ });
30
+ options = {
31
+ ...options,
32
+ env: {
33
+ ...options?.env,
34
+ ...serverSideEnvironmentVariables,
35
+ },
36
+ };
37
+ }
18
38
  const exp = (0, expoConfig_1.getPublicExpoConfig)(projectDir, options);
19
39
  return {
20
40
  exp,
@@ -26,7 +46,7 @@ class DynamicPublicProjectConfigContextField extends ContextField_1.default {
26
46
  }
27
47
  exports.DynamicPublicProjectConfigContextField = DynamicPublicProjectConfigContextField;
28
48
  class DynamicPrivateProjectConfigContextField extends ContextField_1.default {
29
- async getValueAsync({ nonInteractive, sessionManager, }) {
49
+ async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
30
50
  const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
31
51
  return async (options) => {
32
52
  const expBefore = (0, expoConfig_1.getPrivateExpoConfig)(projectDir, options);
@@ -34,6 +54,24 @@ class DynamicPrivateProjectConfigContextField extends ContextField_1.default {
34
54
  nonInteractive,
35
55
  env: options?.env,
36
56
  });
57
+ if (withServerSideEnvironment) {
58
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
59
+ nonInteractive,
60
+ });
61
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
62
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
63
+ environment: withServerSideEnvironment,
64
+ projectId,
65
+ graphqlClient,
66
+ });
67
+ options = {
68
+ ...options,
69
+ env: {
70
+ ...options?.env,
71
+ ...serverSideEnvironmentVariables,
72
+ },
73
+ };
74
+ }
37
75
  const exp = (0, expoConfig_1.getPrivateExpoConfig)(projectDir, options);
38
76
  return {
39
77
  exp,
@@ -1,15 +1,15 @@
1
1
  import ContextField, { ContextOptions } from './ContextField';
2
2
  import { ExpoGraphqlClient } from './contextUtils/createGraphqlClient';
3
+ import { LoggedInAuthenticationInfo } from '../../user/SessionManager';
3
4
  import { Actor } from '../../user/User';
4
5
  import FeatureGating from '../gating/FeatureGating';
5
- export default class LoggedInContextField extends ContextField<{
6
+ type LoggedInContextType = {
6
7
  actor: Actor;
7
8
  featureGating: FeatureGating;
8
9
  graphqlClient: ExpoGraphqlClient;
9
- }> {
10
- getValueAsync({ nonInteractive, sessionManager }: ContextOptions): Promise<{
11
- actor: Actor;
12
- featureGating: FeatureGating;
13
- graphqlClient: ExpoGraphqlClient;
14
- }>;
10
+ authenticationInfo: LoggedInAuthenticationInfo;
11
+ };
12
+ export default class LoggedInContextField extends ContextField<LoggedInContextType> {
13
+ getValueAsync({ nonInteractive, sessionManager, }: ContextOptions): Promise<LoggedInContextType>;
15
14
  }
15
+ export {};
@@ -6,7 +6,7 @@ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
6
  const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
7
7
  const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
8
8
  class LoggedInContextField extends ContextField_1.default {
9
- async getValueAsync({ nonInteractive, sessionManager }) {
9
+ async getValueAsync({ nonInteractive, sessionManager, }) {
10
10
  const { actor, authenticationInfo } = await sessionManager.ensureLoggedInAsync({
11
11
  nonInteractive,
12
12
  });
@@ -16,6 +16,7 @@ class LoggedInContextField extends ContextField_1.default {
16
16
  actor,
17
17
  featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
18
18
  graphqlClient,
19
+ authenticationInfo,
19
20
  };
20
21
  }
21
22
  }
@@ -2,14 +2,16 @@ import ContextField, { ContextOptions } from './ContextField';
2
2
  import { ExpoGraphqlClient } from './contextUtils/createGraphqlClient';
3
3
  import { Actor } from '../../user/User';
4
4
  import FeatureGating from '../gating/FeatureGating';
5
- export default class MaybeLoggedInContextField extends ContextField<{
5
+ type MaybeLoggedInContextType = {
6
6
  actor: Actor | null;
7
7
  featureGating: FeatureGating;
8
8
  graphqlClient: ExpoGraphqlClient;
9
- }> {
10
- getValueAsync({ sessionManager }: ContextOptions): Promise<{
11
- actor: Actor | null;
12
- featureGating: FeatureGating;
13
- graphqlClient: ExpoGraphqlClient;
14
- }>;
9
+ authenticationInfo: {
10
+ accessToken: string | null;
11
+ sessionSecret: string | null;
12
+ };
13
+ };
14
+ export default class MaybeLoggedInContextField extends ContextField<MaybeLoggedInContextType> {
15
+ getValueAsync({ sessionManager }: ContextOptions): Promise<MaybeLoggedInContextType>;
15
16
  }
17
+ export {};
@@ -18,6 +18,7 @@ class MaybeLoggedInContextField extends ContextField_1.default {
18
18
  actor: actor ?? null,
19
19
  featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
20
20
  graphqlClient,
21
+ authenticationInfo,
21
22
  };
22
23
  }
23
24
  }
@@ -5,7 +5,7 @@ export declare class OptionalPrivateProjectConfigContextField extends ContextFie
5
5
  exp: ExpoConfig;
6
6
  projectDir: string;
7
7
  } | undefined> {
8
- getValueAsync({ nonInteractive, sessionManager }: ContextOptions): Promise<{
8
+ getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<{
9
9
  projectId: string;
10
10
  exp: ExpoConfig;
11
11
  projectDir: string;
@@ -4,11 +4,13 @@ exports.OptionalPrivateProjectConfigContextField = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const errors_1 = require("@expo/eas-json/build/errors");
6
6
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
7
+ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
7
8
  const findProjectDirAndVerifyProjectSetupAsync_1 = require("./contextUtils/findProjectDirAndVerifyProjectSetupAsync");
8
9
  const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
10
+ const loadServerSideEnvironmentVariablesAsync_1 = require("./contextUtils/loadServerSideEnvironmentVariablesAsync");
9
11
  const expoConfig_1 = require("../../project/expoConfig");
10
12
  class OptionalPrivateProjectConfigContextField extends ContextField_1.default {
11
- async getValueAsync({ nonInteractive, sessionManager }) {
13
+ async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
12
14
  let projectDir;
13
15
  try {
14
16
  projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
@@ -26,7 +28,20 @@ class OptionalPrivateProjectConfigContextField extends ContextField_1.default {
26
28
  const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
27
29
  nonInteractive,
28
30
  });
29
- const exp = (0, expoConfig_1.getPrivateExpoConfig)(projectDir);
31
+ let serverSideEnvVars;
32
+ if (withServerSideEnvironment) {
33
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
34
+ nonInteractive,
35
+ });
36
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
37
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
38
+ environment: withServerSideEnvironment,
39
+ projectId,
40
+ graphqlClient,
41
+ });
42
+ serverSideEnvVars = serverSideEnvironmentVariables;
43
+ }
44
+ const exp = (0, expoConfig_1.getPrivateExpoConfig)(projectDir, { env: serverSideEnvVars });
30
45
  return {
31
46
  exp,
32
47
  projectDir,
@@ -5,7 +5,7 @@ export declare class PrivateProjectConfigContextField extends ContextField<{
5
5
  exp: ExpoConfig;
6
6
  projectDir: string;
7
7
  }> {
8
- getValueAsync({ nonInteractive, sessionManager }: ContextOptions): Promise<{
8
+ getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<{
9
9
  projectId: string;
10
10
  exp: ExpoConfig;
11
11
  projectDir: string;
@@ -3,17 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PrivateProjectConfigContextField = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
6
+ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
7
  const findProjectDirAndVerifyProjectSetupAsync_1 = require("./contextUtils/findProjectDirAndVerifyProjectSetupAsync");
7
8
  const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
9
+ const loadServerSideEnvironmentVariablesAsync_1 = require("./contextUtils/loadServerSideEnvironmentVariablesAsync");
8
10
  const expoConfig_1 = require("../../project/expoConfig");
9
11
  class PrivateProjectConfigContextField extends ContextField_1.default {
10
- async getValueAsync({ nonInteractive, sessionManager }) {
12
+ async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
11
13
  const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
12
14
  const expBefore = (0, expoConfig_1.getPrivateExpoConfig)(projectDir);
13
15
  const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
14
16
  nonInteractive,
15
17
  });
16
- const exp = (0, expoConfig_1.getPrivateExpoConfig)(projectDir);
18
+ let serverSideEnvVars;
19
+ if (withServerSideEnvironment) {
20
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
21
+ nonInteractive,
22
+ });
23
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
24
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
25
+ environment: withServerSideEnvironment,
26
+ projectId,
27
+ graphqlClient,
28
+ });
29
+ serverSideEnvVars = serverSideEnvironmentVariables;
30
+ }
31
+ const exp = (0, expoConfig_1.getPrivateExpoConfig)(projectDir, { env: serverSideEnvVars });
17
32
  return {
18
33
  projectId,
19
34
  exp,
@@ -0,0 +1,4 @@
1
+ import ContextField, { ContextOptions } from './ContextField';
2
+ export declare class ProjectIdContextField extends ContextField<string> {
3
+ getValueAsync({ nonInteractive, sessionManager }: ContextOptions): Promise<string>;
4
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectIdContextField = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
6
+ const findProjectDirAndVerifyProjectSetupAsync_1 = require("./contextUtils/findProjectDirAndVerifyProjectSetupAsync");
7
+ const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
8
+ const expoConfig_1 = require("../../project/expoConfig");
9
+ class ProjectIdContextField extends ContextField_1.default {
10
+ async getValueAsync({ nonInteractive, sessionManager }) {
11
+ const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
12
+ const expBefore = (0, expoConfig_1.getPrivateExpoConfig)(projectDir);
13
+ const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, expBefore, {
14
+ nonInteractive,
15
+ });
16
+ return projectId;
17
+ }
18
+ }
19
+ exports.ProjectIdContextField = ProjectIdContextField;
@@ -0,0 +1,6 @@
1
+ import ContextField, { ContextOptions } from './ContextField';
2
+ type GetServerSideEnvironmentVariablesFn = (maybeEnv?: Record<string, string>) => Promise<Record<string, string>>;
3
+ export declare class ServerSideEnvironmentVariablesContextField extends ContextField<GetServerSideEnvironmentVariablesFn> {
4
+ getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }: ContextOptions): Promise<GetServerSideEnvironmentVariablesFn>;
5
+ }
6
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerSideEnvironmentVariablesContextField = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
6
+ const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
7
+ const findProjectDirAndVerifyProjectSetupAsync_1 = require("./contextUtils/findProjectDirAndVerifyProjectSetupAsync");
8
+ const getProjectIdAsync_1 = require("./contextUtils/getProjectIdAsync");
9
+ const loadServerSideEnvironmentVariablesAsync_1 = require("./contextUtils/loadServerSideEnvironmentVariablesAsync");
10
+ const expoConfig_1 = require("../../project/expoConfig");
11
+ class ServerSideEnvironmentVariablesContextField extends ContextField_1.default {
12
+ async getValueAsync({ nonInteractive, sessionManager, withServerSideEnvironment, }) {
13
+ const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
14
+ return async (maybeEnv) => {
15
+ if (!withServerSideEnvironment) {
16
+ throw new Error('withServerSideEnvironment parameter is required to evaluate ServerSideEnvironmentVariablesContextField');
17
+ }
18
+ const exp = (0, expoConfig_1.getPublicExpoConfig)(projectDir, { env: maybeEnv });
19
+ const projectId = await (0, getProjectIdAsync_1.getProjectIdAsync)(sessionManager, exp, {
20
+ nonInteractive,
21
+ env: maybeEnv,
22
+ });
23
+ const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({
24
+ nonInteractive,
25
+ });
26
+ const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
27
+ const serverSideEnvironmentVariables = await (0, loadServerSideEnvironmentVariablesAsync_1.loadServerSideEnvironmentVariablesAsync)({
28
+ environment: withServerSideEnvironment,
29
+ projectId,
30
+ graphqlClient,
31
+ });
32
+ return serverSideEnvironmentVariables;
33
+ };
34
+ }
35
+ }
36
+ exports.ServerSideEnvironmentVariablesContextField = ServerSideEnvironmentVariablesContextField;
@@ -0,0 +1,7 @@
1
+ import { ExpoGraphqlClient } from './createGraphqlClient';
2
+ import { EnvironmentVariableEnvironment } from '../../../graphql/generated';
3
+ export declare function loadServerSideEnvironmentVariablesAsync({ environment, projectId, graphqlClient, }: {
4
+ environment: EnvironmentVariableEnvironment;
5
+ projectId: string;
6
+ graphqlClient: ExpoGraphqlClient;
7
+ }): Promise<Record<string, string>>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadServerSideEnvironmentVariablesAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const generated_1 = require("../../../graphql/generated");
6
+ const EnvironmentVariablesQuery_1 = require("../../../graphql/queries/EnvironmentVariablesQuery");
7
+ const log_1 = tslib_1.__importDefault(require("../../../log"));
8
+ const cachedServerSideEnvironmentVariables = {
9
+ [generated_1.EnvironmentVariableEnvironment.Development]: null,
10
+ [generated_1.EnvironmentVariableEnvironment.Preview]: null,
11
+ [generated_1.EnvironmentVariableEnvironment.Production]: null,
12
+ };
13
+ async function loadServerSideEnvironmentVariablesAsync({ environment, projectId, graphqlClient, }) {
14
+ // don't load environment variables if they were already loaded while executing a command
15
+ const cachedEnvVarsForEnvironment = cachedServerSideEnvironmentVariables[environment];
16
+ if (cachedEnvVarsForEnvironment) {
17
+ return cachedEnvVarsForEnvironment;
18
+ }
19
+ const environmentVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
20
+ appId: projectId,
21
+ environment,
22
+ });
23
+ const serverEnvVars = Object.fromEntries(environmentVariables
24
+ .filter(({ name, value }) => name && value)
25
+ .map(({ name, value }) => [name, value]));
26
+ if (Object.keys(serverEnvVars).length > 0) {
27
+ log_1.default.log(`Environment variables loaded from the "${environment.toLowerCase()}" environment on EAS servers: ${Object.keys(serverEnvVars).join(', ')}.`);
28
+ }
29
+ else {
30
+ log_1.default.log(`No environment variables found for the "${environment.toLowerCase()}" environment on EAS servers.`);
31
+ }
32
+ const encryptedEnvVars = environmentVariables.filter(({ name, value }) => name && !value);
33
+ if (encryptedEnvVars.length > 0) {
34
+ log_1.default.warn(`Some environment variables defined in the "${environment.toLowerCase()}" environment on EAS servers are of "encrypted" type and cannot be read outside of the EAS servers (including EAS CLI): ${encryptedEnvVars
35
+ .map(({ name }) => name)
36
+ .join(', ')}. `);
37
+ }
38
+ log_1.default.newLine();
39
+ cachedServerSideEnvironmentVariables[environment] = serverEnvVars;
40
+ return serverEnvVars;
41
+ }
42
+ exports.loadServerSideEnvironmentVariablesAsync = loadServerSideEnvironmentVariablesAsync;
@@ -3,7 +3,6 @@ export default class AccountView extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
5
  static contextDefinition: {
6
- sessionManager: import("../../commandUtils/context/SessionManagementContextField").default;
7
6
  maybeLoggedIn: import("../../commandUtils/context/MaybeLoggedInContextField").default;
8
7
  };
9
8
  runAsync(): Promise<void>;
@@ -10,9 +10,9 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
10
10
  const User_1 = require("../../user/User");
11
11
  class AccountView extends EasCommand_1.default {
12
12
  async runAsync() {
13
- const { maybeLoggedIn: { actor }, sessionManager, } = await this.getContextAsync(_a, { nonInteractive: true });
13
+ const { maybeLoggedIn: { actor, authenticationInfo }, } = await this.getContextAsync(_a, { nonInteractive: true });
14
14
  if (actor) {
15
- const loggedInAs = sessionManager.getAccessToken()
15
+ const loggedInAs = authenticationInfo.accessToken
16
16
  ? `${(0, User_1.getActorDisplayName)(actor)} (authenticated using EXPO_TOKEN)`
17
17
  : (0, User_1.getActorDisplayName)(actor);
18
18
  log_1.default.log(chalk_1.default.green(loggedInAs));
@@ -61,6 +61,5 @@ AccountView.description = 'show the username you are logged in as';
61
61
  AccountView.aliases = ['whoami'];
62
62
  AccountView.contextDefinition = {
63
63
  ..._a.ContextOptions.MaybeLoggedIn,
64
- ..._a.ContextOptions.SessionManagment,
65
64
  };
66
65
  exports.default = AccountView;