eas-cli 2.5.0 → 2.6.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 (120) hide show
  1. package/README.md +89 -49
  2. package/build/branch/queries.js +3 -22
  3. package/build/build/queries.d.ts +11 -1
  4. package/build/build/queries.js +39 -1
  5. package/build/channel/queries.js +5 -8
  6. package/build/channel/utils.js +22 -22
  7. package/build/commandUtils/context/LoggedInContextField.d.ts +3 -0
  8. package/build/commandUtils/context/LoggedInContextField.js +9 -1
  9. package/build/commandUtils/context/MaybeLoggedInContextField.d.ts +3 -0
  10. package/build/commandUtils/context/MaybeLoggedInContextField.js +9 -1
  11. package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +2 -2
  12. package/build/commandUtils/gating/FeatureGateEnvOverrides.d.ts +7 -0
  13. package/build/commandUtils/gating/FeatureGateEnvOverrides.js +35 -0
  14. package/build/commandUtils/gating/FeatureGateKey.d.ts +4 -0
  15. package/build/commandUtils/gating/FeatureGateKey.js +11 -0
  16. package/build/commandUtils/gating/FeatureGateTestOverrides.d.ts +5 -0
  17. package/build/commandUtils/gating/FeatureGateTestOverrides.js +17 -0
  18. package/build/commandUtils/gating/FeatureGating.d.ts +16 -0
  19. package/build/commandUtils/gating/FeatureGating.js +55 -0
  20. package/build/commandUtils/pagination.d.ts +4 -3
  21. package/build/commands/branch/list.d.ts +1 -1
  22. package/build/commands/branch/view.d.ts +1 -1
  23. package/build/commands/build/configure.d.ts +1 -1
  24. package/build/commands/build/index.d.ts +2 -2
  25. package/build/commands/build/list.d.ts +4 -4
  26. package/build/commands/build/list.js +2 -15
  27. package/build/commands/build/run.d.ts +21 -0
  28. package/build/commands/build/run.js +149 -0
  29. package/build/commands/build/version/set.d.ts +1 -1
  30. package/build/commands/build/version/sync.d.ts +1 -1
  31. package/build/commands/channel/list.d.ts +1 -1
  32. package/build/commands/channel/view.d.ts +1 -1
  33. package/build/commands/config.d.ts +1 -1
  34. package/build/commands/credentials.d.ts +1 -1
  35. package/build/commands/device/list.d.ts +1 -1
  36. package/build/commands/metadata/lint.d.ts +12 -0
  37. package/build/commands/metadata/lint.js +72 -0
  38. package/build/commands/metadata/pull.js +20 -9
  39. package/build/commands/metadata/push.js +20 -9
  40. package/build/commands/secret/create.d.ts +1 -1
  41. package/build/commands/secret/list.js +12 -17
  42. package/build/commands/submit.d.ts +1 -1
  43. package/build/commands/update/configure.js +2 -0
  44. package/build/commands/update/list.d.ts +1 -1
  45. package/build/commands/webhook/create.d.ts +1 -1
  46. package/build/commands/webhook/list.d.ts +1 -1
  47. package/build/commands/webhook/update.d.ts +1 -1
  48. package/build/devices/actions/create/inputMethod.js +2 -15
  49. package/build/devices/utils/formatDevice.d.ts +2 -0
  50. package/build/devices/utils/formatDevice.js +32 -7
  51. package/build/env.d.ts +8 -0
  52. package/build/env.js +8 -0
  53. package/build/graphql/generated.d.ts +74 -6
  54. package/build/graphql/generated.js +10 -2
  55. package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +1 -1
  56. package/build/graphql/queries/UserQuery.js +2 -2
  57. package/build/graphql/types/Build.js +1 -0
  58. package/build/metadata/apple/rules/index.d.ts +1 -0
  59. package/build/metadata/apple/rules/index.js +6 -0
  60. package/build/metadata/apple/rules/infoKeywordLength.d.ts +6 -0
  61. package/build/metadata/apple/rules/infoKeywordLength.js +35 -0
  62. package/build/metadata/apple/rules/infoRestrictedWords.d.ts +6 -0
  63. package/build/metadata/apple/rules/infoRestrictedWords.js +57 -0
  64. package/build/metadata/apple/tasks/index.d.ts +1 -2
  65. package/build/metadata/apple/tasks/index.js +1 -1
  66. package/build/metadata/auth.d.ts +21 -0
  67. package/build/metadata/auth.js +33 -0
  68. package/build/metadata/config/issue.d.ts +21 -0
  69. package/build/metadata/config/issue.js +9 -0
  70. package/build/metadata/config/resolve.d.ts +27 -0
  71. package/build/metadata/{config.js → config/resolve.js} +24 -25
  72. package/build/metadata/config/schema.d.ts +7 -0
  73. package/build/metadata/config/schema.js +2 -0
  74. package/build/metadata/config/validate.d.ts +3 -0
  75. package/build/metadata/config/validate.js +47 -0
  76. package/build/metadata/download.d.ts +11 -2
  77. package/build/metadata/download.js +14 -9
  78. package/build/metadata/errors.d.ts +3 -3
  79. package/build/metadata/errors.js +3 -1
  80. package/build/metadata/upload.d.ts +11 -2
  81. package/build/metadata/upload.js +16 -11
  82. package/build/metadata/utils/ajv.d.ts +10 -0
  83. package/build/metadata/utils/ajv.js +30 -0
  84. package/build/metadata/utils/telemetry.js +6 -6
  85. package/build/project/publish.js +8 -14
  86. package/build/run/android/run.d.ts +1 -0
  87. package/build/run/android/run.js +9 -0
  88. package/build/run/ios/run.d.ts +1 -0
  89. package/build/run/ios/run.js +31 -0
  90. package/build/run/ios/simctl.d.ts +2 -0
  91. package/build/run/ios/simctl.js +8 -0
  92. package/build/run/ios/simulator.d.ts +21 -0
  93. package/build/run/ios/simulator.js +161 -0
  94. package/build/run/ios/systemRequirements.d.ts +1 -0
  95. package/build/run/ios/systemRequirements.js +82 -0
  96. package/build/run/ios/xcode.d.ts +4 -0
  97. package/build/run/ios/xcode.js +41 -0
  98. package/build/run/ios/xcrun.d.ts +4 -0
  99. package/build/run/ios/xcrun.js +68 -0
  100. package/build/run/run.d.ts +8 -0
  101. package/build/run/run.js +15 -0
  102. package/build/submit/utils/summary.d.ts +1 -1
  103. package/build/update/queries.js +30 -39
  104. package/build/update/utils.d.ts +8 -1
  105. package/build/update/utils.js +35 -1
  106. package/build/utils/buildDistribution.d.ts +3 -0
  107. package/build/utils/buildDistribution.js +20 -0
  108. package/build/utils/download.d.ts +2 -0
  109. package/build/utils/download.js +114 -0
  110. package/build/utils/expoCli.d.ts +0 -1
  111. package/build/utils/expoCli.js +1 -8
  112. package/build/utils/expodash/filter.d.ts +2 -0
  113. package/build/utils/expodash/filter.js +8 -0
  114. package/build/utils/formatFields.d.ts +3 -2
  115. package/oclif.manifest.json +1 -1
  116. package/package.json +32 -30
  117. package/schema/metadata-0.json +1 -1
  118. package/build/metadata/config.d.ts +0 -41
  119. package/build/metadata/context.d.ts +0 -50
  120. package/build/metadata/context.js +0 -47
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logChannelDetails = exports.getBranchMapping = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
- const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const log_1 = tslib_1.__importDefault(require("../log"));
8
8
  const utils_1 = require("../update/utils");
9
9
  /**
@@ -57,31 +57,31 @@ function getBranchMapping(branchMappingString) {
57
57
  exports.getBranchMapping = getBranchMapping;
58
58
  function logChannelDetails(channel) {
59
59
  const { branchMapping, isRollout, rolloutPercent } = getBranchMapping(channel.branchMapping);
60
- const updateChannelsTable = new cli_table3_1.default({
61
- head: ['branch', ...(isRollout ? ['rollout percent'] : []), ...utils_1.UPDATE_COLUMNS],
62
- wordWrap: true,
63
- });
64
60
  if (branchMapping.data.length > 2) {
65
61
  throw new Error('Branch Mapping data must have length less than or equal to 2.');
66
62
  }
67
63
  const rolloutBranchIds = branchMapping.data.map(data => data.branchId);
68
- for (const currentBranch of channel.updateBranches) {
69
- const updateGroupDescriptions = (0, utils_1.getUpdateGroupDescriptionsWithBranch)(currentBranch.updateGroups);
70
- const isRolloutBranch = isRollout && rolloutBranchIds.includes(currentBranch.id);
71
- const isBaseBranch = rolloutBranchIds.length > 0 && rolloutBranchIds[0] === currentBranch.id;
72
- updateGroupDescriptions.forEach(({ branch, message, runtimeVersion, group, platforms }) => {
73
- updateChannelsTable.push([
74
- branch,
75
- ...(isRolloutBranch
76
- ? [isBaseBranch ? `${rolloutPercent * 100}%` : `${(1 - rolloutPercent) * 100}%`]
77
- : []),
78
- message,
79
- runtimeVersion,
80
- group,
81
- platforms,
82
- ]);
83
- });
64
+ const branchDescription = channel.updateBranches.flatMap(branch => {
65
+ const updateGroupWithBranchDescriptions = (0, utils_1.getUpdateGroupDescriptionsWithBranch)(branch.updateGroups);
66
+ const isRolloutBranch = isRollout && rolloutBranchIds.includes(branch.id);
67
+ const isBaseBranch = rolloutBranchIds.length > 0 && rolloutBranchIds[0] === branch.id;
68
+ let rolloutPercentNumber = undefined;
69
+ if (isRolloutBranch) {
70
+ rolloutPercentNumber = isBaseBranch ? rolloutPercent * 100 : (1 - rolloutPercent) * 100;
71
+ }
72
+ return updateGroupWithBranchDescriptions.map(({ branch, ...updateGroup }) => ({
73
+ branch,
74
+ branchRolloutPercentage: rolloutPercentNumber,
75
+ update: updateGroup,
76
+ }));
77
+ });
78
+ if (branchDescription.length === 0) {
79
+ log_1.default.log(chalk_1.default.dim('No branches are pointed to this channel.'));
80
+ }
81
+ else {
82
+ log_1.default.log(branchDescription
83
+ .map(description => (0, utils_1.formatBranch)(description))
84
+ .join(`\n\n${chalk_1.default.dim('———')}\n\n`));
84
85
  }
85
- log_1.default.log(updateChannelsTable.toString());
86
86
  }
87
87
  exports.logChannelDetails = logChannelDetails;
@@ -1,12 +1,15 @@
1
1
  import { Actor } from '../../user/User';
2
+ import FeatureGating from '../gating/FeatureGating';
2
3
  import ContextField, { ContextOptions } from './ContextField';
3
4
  import { ExpoGraphqlClient } from './contextUtils/createGraphqlClient';
4
5
  export default class LoggedInContextField extends ContextField<{
5
6
  actor: Actor;
7
+ featureGating: FeatureGating;
6
8
  graphqlClient: ExpoGraphqlClient;
7
9
  }> {
8
10
  getValueAsync({ nonInteractive, sessionManager }: ContextOptions): Promise<{
9
11
  actor: Actor;
12
+ featureGating: FeatureGating;
10
13
  graphqlClient: ExpoGraphqlClient;
11
14
  }>;
12
15
  }
@@ -1,15 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
5
+ const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
4
6
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
5
7
  const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
8
  class LoggedInContextField extends ContextField_1.default {
7
9
  async getValueAsync({ nonInteractive, sessionManager }) {
10
+ var _a;
8
11
  const { actor, authenticationInfo } = await sessionManager.ensureLoggedInAsync({
9
12
  nonInteractive,
10
13
  });
14
+ const featureGateServerValues = (_a = actor === null || actor === void 0 ? void 0 : actor.featureGates) !== null && _a !== void 0 ? _a : {};
11
15
  const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
12
- return { actor, graphqlClient };
16
+ return {
17
+ actor,
18
+ featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
19
+ graphqlClient,
20
+ };
13
21
  }
14
22
  }
15
23
  exports.default = LoggedInContextField;
@@ -1,12 +1,15 @@
1
1
  import { Actor } from '../../user/User';
2
+ import FeatureGating from '../gating/FeatureGating';
2
3
  import ContextField, { ContextOptions } from './ContextField';
3
4
  import { ExpoGraphqlClient } from './contextUtils/createGraphqlClient';
4
5
  export default class MaybeLoggedInContextField extends ContextField<{
5
6
  actor: Actor | null;
7
+ featureGating: FeatureGating;
6
8
  graphqlClient: ExpoGraphqlClient;
7
9
  }> {
8
10
  getValueAsync({ sessionManager }: ContextOptions): Promise<{
9
11
  actor: Actor | null;
12
+ featureGating: FeatureGating;
10
13
  graphqlClient: ExpoGraphqlClient;
11
14
  }>;
12
15
  }
@@ -1,17 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const FeatureGateEnvOverrides_1 = tslib_1.__importDefault(require("../gating/FeatureGateEnvOverrides"));
5
+ const FeatureGating_1 = tslib_1.__importDefault(require("../gating/FeatureGating"));
4
6
  const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
5
7
  const createGraphqlClient_1 = require("./contextUtils/createGraphqlClient");
6
8
  class MaybeLoggedInContextField extends ContextField_1.default {
7
9
  async getValueAsync({ sessionManager }) {
10
+ var _a;
8
11
  const authenticationInfo = {
9
12
  accessToken: sessionManager.getAccessToken(),
10
13
  sessionSecret: sessionManager.getSessionSecret(),
11
14
  };
12
15
  const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
13
16
  const actor = await sessionManager.getUserAsync();
14
- return { actor: actor !== null && actor !== void 0 ? actor : null, graphqlClient };
17
+ const featureGateServerValues = (_a = actor === null || actor === void 0 ? void 0 : actor.featureGates) !== null && _a !== void 0 ? _a : {};
18
+ return {
19
+ actor: actor !== null && actor !== void 0 ? actor : null,
20
+ featureGating: new FeatureGating_1.default(featureGateServerValues, new FeatureGateEnvOverrides_1.default()),
21
+ graphqlClient,
22
+ };
15
23
  }
16
24
  }
17
25
  exports.default = MaybeLoggedInContextField;
@@ -1,7 +1,7 @@
1
- import { Client, OperationContext, OperationResult, PromisifiedSource, TypedDocumentNode } from '@urql/core';
1
+ import { AnyVariables, Client, OperationContext, OperationResult, PromisifiedSource, TypedDocumentNode } from '@urql/core';
2
2
  import { DocumentNode } from 'graphql';
3
3
  export interface ExpoGraphqlClient extends Client {
4
- query<Data = any, Variables extends object = object>(query: DocumentNode | TypedDocumentNode<Data, Variables> | string, variables: Variables | undefined, context: Partial<OperationContext> & {
4
+ query<Data = any, Variables extends AnyVariables = AnyVariables>(query: DocumentNode | TypedDocumentNode<Data, Variables> | string, variables: Variables, context: Partial<OperationContext> & {
5
5
  additionalTypenames: string[];
6
6
  }): PromisifiedSource<OperationResult<Data, Variables>>;
7
7
  }
@@ -0,0 +1,7 @@
1
+ import { FeatureGateKey } from './FeatureGateKey';
2
+ export default class FeatureGateEnvOverrides {
3
+ private readonly map;
4
+ constructor();
5
+ isOverridden(key: FeatureGateKey): boolean;
6
+ getOverride(key: FeatureGateKey): boolean;
7
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
5
+ const env_1 = tslib_1.__importDefault(require("../../env"));
6
+ function parseFeatureGateEnvVariableValue(value) {
7
+ if (!value) {
8
+ return [];
9
+ }
10
+ return value.split(',').map(v => v.trim());
11
+ }
12
+ class FeatureGateEnvOverrides {
13
+ constructor() {
14
+ this.map = new Map();
15
+ const overrideEnableGateKeys = new Set(parseFeatureGateEnvVariableValue(env_1.default.featureGateEnable));
16
+ const overrideDisableGateKeys = new Set(parseFeatureGateEnvVariableValue(env_1.default.featureGateDisable));
17
+ for (const overrideEnableKey of overrideEnableGateKeys) {
18
+ if (overrideDisableGateKeys.has(overrideEnableKey)) {
19
+ continue;
20
+ }
21
+ this.map.set(overrideEnableKey, true);
22
+ }
23
+ for (const overrideDisableGateKey of overrideDisableGateKeys) {
24
+ this.map.set(overrideDisableGateKey, false);
25
+ }
26
+ }
27
+ isOverridden(key) {
28
+ var _a;
29
+ return (_a = this.map.has(key)) !== null && _a !== void 0 ? _a : false;
30
+ }
31
+ getOverride(key) {
32
+ return (0, nullthrows_1.default)(this.map.get(key));
33
+ }
34
+ }
35
+ exports.default = FeatureGateEnvOverrides;
@@ -0,0 +1,4 @@
1
+ export declare enum FeatureGateKey {
2
+ TEST = "test"
3
+ }
4
+ export declare const featureGateDefaultValueWhenNoServerValue: Record<FeatureGateKey, boolean>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.featureGateDefaultValueWhenNoServerValue = exports.FeatureGateKey = void 0;
4
+ var FeatureGateKey;
5
+ (function (FeatureGateKey) {
6
+ // for tests
7
+ FeatureGateKey["TEST"] = "test";
8
+ })(FeatureGateKey = exports.FeatureGateKey || (exports.FeatureGateKey = {}));
9
+ exports.featureGateDefaultValueWhenNoServerValue = {
10
+ [FeatureGateKey.TEST]: true,
11
+ };
@@ -0,0 +1,5 @@
1
+ import { FeatureGateKey } from './FeatureGateKey';
2
+ export declare const setOverride: (_key: FeatureGateKey, _enabled: boolean) => void;
3
+ export declare const removeOverride: (_key: FeatureGateKey) => void;
4
+ export declare const isOverridden: (_key: FeatureGateKey) => boolean;
5
+ export declare const getOverride: (_key: FeatureGateKey) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOverride = exports.isOverridden = exports.removeOverride = exports.setOverride = void 0;
4
+ const setOverride = (_key, _enabled) => {
5
+ throw new Error('Must use mocked FeatureGateTestOverrides');
6
+ };
7
+ exports.setOverride = setOverride;
8
+ const removeOverride = (_key) => {
9
+ throw new Error('Must use mocked FeatureGateTestOverrides');
10
+ };
11
+ exports.removeOverride = removeOverride;
12
+ const isOverridden = (_key) => false;
13
+ exports.isOverridden = isOverridden;
14
+ const getOverride = (_key) => {
15
+ throw new Error('Must use mocked FeatureGateTestOverrides');
16
+ };
17
+ exports.getOverride = getOverride;
@@ -0,0 +1,16 @@
1
+ import FeatureGateEnvOverrides from './FeatureGateEnvOverrides';
2
+ import { FeatureGateKey } from './FeatureGateKey';
3
+ export default class FeatureGating {
4
+ private readonly serverValues;
5
+ private readonly envOverrides;
6
+ constructor(serverValues: {
7
+ [key: string]: boolean;
8
+ }, envOverrides: FeatureGateEnvOverrides);
9
+ isEnabled(experimentKey: FeatureGateKey): boolean;
10
+ /**
11
+ * Test gate override methods
12
+ */
13
+ static overrideKeyForScope(key: FeatureGateKey, enabled: boolean, scope: () => void): void;
14
+ static overrideKeyForScopeAsync(key: FeatureGateKey, enabled: boolean, scope: () => Promise<void>): Promise<void>;
15
+ static overrideKeyForEachInTest(key: FeatureGateKey, enabled: boolean): void;
16
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const FeatureGateKey_1 = require("./FeatureGateKey");
5
+ const FeatureGateTestOverrides = tslib_1.__importStar(require("./FeatureGateTestOverrides"));
6
+ class FeatureGating {
7
+ constructor(serverValues, envOverrides) {
8
+ this.serverValues = serverValues;
9
+ this.envOverrides = envOverrides;
10
+ }
11
+ isEnabled(experimentKey) {
12
+ if (process.env.NODE_ENV === 'test' && FeatureGateTestOverrides.isOverridden(experimentKey)) {
13
+ return FeatureGateTestOverrides.getOverride(experimentKey);
14
+ }
15
+ if (this.envOverrides.isOverridden(experimentKey)) {
16
+ return this.envOverrides.getOverride(experimentKey);
17
+ }
18
+ if (experimentKey in this.serverValues) {
19
+ return this.serverValues[experimentKey];
20
+ }
21
+ return FeatureGateKey_1.featureGateDefaultValueWhenNoServerValue[experimentKey];
22
+ }
23
+ /**
24
+ * Test gate override methods
25
+ */
26
+ static overrideKeyForScope(key, enabled, scope) {
27
+ if (process.env.NODE_ENV !== 'test') {
28
+ throw new Error(`Cannot overrideKeyForScope outside of test environment`);
29
+ }
30
+ FeatureGateTestOverrides.setOverride(key, enabled);
31
+ try {
32
+ scope();
33
+ }
34
+ finally {
35
+ FeatureGateTestOverrides.removeOverride(key);
36
+ }
37
+ }
38
+ static async overrideKeyForScopeAsync(key, enabled, scope) {
39
+ if (process.env.NODE_ENV !== 'test') {
40
+ throw new Error(`Cannot overrideKeyForScopeAsync outside of test environment`);
41
+ }
42
+ FeatureGateTestOverrides.setOverride(key, enabled);
43
+ try {
44
+ await scope();
45
+ }
46
+ finally {
47
+ FeatureGateTestOverrides.removeOverride(key);
48
+ }
49
+ }
50
+ static overrideKeyForEachInTest(key, enabled) {
51
+ beforeEach(() => FeatureGateTestOverrides.setOverride(key, enabled));
52
+ afterEach(() => FeatureGateTestOverrides.removeOverride(key));
53
+ }
54
+ }
55
+ exports.default = FeatureGating;
@@ -1,12 +1,13 @@
1
+ import { OptionFlag } from '@oclif/core/lib/interfaces';
1
2
  import { EasNonInteractiveAndJsonFlags } from './flags';
2
3
  export declare const getPaginatedQueryOptions: (flags: Partial<Record<keyof typeof EasPaginatedQueryFlags | keyof typeof EasNonInteractiveAndJsonFlags, any>>) => PaginatedQueryOptions;
3
4
  export declare const getLimitFlagWithCustomValues: ({ defaultTo, limit, }: {
4
5
  defaultTo: number;
5
6
  limit: number;
6
- }) => any;
7
+ }) => OptionFlag<number | undefined>;
7
8
  export declare const EasPaginatedQueryFlags: {
8
- offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
9
- limit: any;
9
+ offset: OptionFlag<number | undefined>;
10
+ limit: OptionFlag<number | undefined>;
10
11
  };
11
12
  export declare type PaginatedQueryOptions = {
12
13
  nonInteractive: boolean;
@@ -5,7 +5,7 @@ export default class BranchList extends EasCommand {
5
5
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
8
- limit: any;
8
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
9
9
  };
10
10
  static contextDefinition: {
11
11
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
@@ -7,7 +7,7 @@ export default class BranchView extends EasCommand {
7
7
  description: string;
8
8
  }[];
9
9
  static flags: {
10
- limit: any;
10
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
11
11
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
13
  offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
@@ -2,7 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class BuildConfigure extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
6
  };
7
7
  static contextDefinition: {
8
8
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
@@ -5,7 +5,7 @@ export default class Build extends EasCommand {
5
5
  static flags: {
6
6
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
8
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
9
9
  'skip-credentials-check': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
10
  'skip-project-configuration': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
11
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -15,7 +15,7 @@ export default class Build extends EasCommand {
15
15
  'clear-cache': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  'auto-submit': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  'auto-submit-with-profile': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
- 'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<UserInputResourceClass>;
18
+ 'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<UserInputResourceClass | undefined>;
19
19
  message: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
20
20
  };
21
21
  static contextDefinition: {
@@ -6,11 +6,11 @@ export default class BuildList extends EasCommand {
6
6
  static flags: {
7
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
8
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- limit: any;
9
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
10
10
  offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
11
- platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform>;
12
- status: import("@oclif/core/lib/interfaces").OptionFlag<BuildStatus>;
13
- distribution: import("@oclif/core/lib/interfaces").OptionFlag<BuildDistributionType>;
11
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<RequestedPlatform | undefined>;
12
+ status: import("@oclif/core/lib/interfaces").OptionFlag<BuildStatus | undefined>;
13
+ distribution: import("@oclif/core/lib/interfaces").OptionFlag<BuildDistributionType | undefined>;
14
14
  channel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
15
15
  appVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
16
16
  appBuildVersion: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -11,6 +11,7 @@ const pagination_1 = require("../../commandUtils/pagination");
11
11
  const generated_1 = require("../../graphql/generated");
12
12
  const platform_1 = require("../../platform");
13
13
  const projectUtils_1 = require("../../project/projectUtils");
14
+ const buildDistribution_1 = require("../../utils/buildDistribution");
14
15
  const json_1 = require("../../utils/json");
15
16
  class BuildList extends EasCommand_1.default {
16
17
  async runAsync() {
@@ -25,7 +26,7 @@ class BuildList extends EasCommand_1.default {
25
26
  }
26
27
  const platform = toAppPlatform(requestedPlatform);
27
28
  const graphqlBuildStatus = toGraphQLBuildStatus(buildStatus);
28
- const graphqlBuildDistribution = toGraphQLBuildDistribution(buildDistribution);
29
+ const graphqlBuildDistribution = (0, buildDistribution_1.buildDistributionTypeToGraphQLDistributionType)(buildDistribution);
29
30
  const displayName = await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId);
30
31
  await (0, queries_1.listAndRenderBuildsOnAppAsync)(graphqlClient, {
31
32
  projectId,
@@ -121,17 +122,3 @@ const toGraphQLBuildStatus = (buildStatus) => {
121
122
  return generated_1.BuildStatus.Canceled;
122
123
  }
123
124
  };
124
- const toGraphQLBuildDistribution = (buildDistribution) => {
125
- if (buildDistribution === types_1.BuildDistributionType.STORE) {
126
- return generated_1.DistributionType.Store;
127
- }
128
- else if (buildDistribution === types_1.BuildDistributionType.INTERNAL) {
129
- return generated_1.DistributionType.Internal;
130
- }
131
- else if (buildDistribution === types_1.BuildDistributionType.SIMULATOR) {
132
- return generated_1.DistributionType.Simulator;
133
- }
134
- else {
135
- return undefined;
136
- }
137
- };
@@ -0,0 +1,21 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class Run extends EasCommand {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static flags: {
6
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
7
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
8
+ latest: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ url: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
+ path: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
12
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
13
+ };
14
+ static contextDefinition: {
15
+ projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
16
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
17
+ projectConfig: import("../../commandUtils/context/ProjectConfigContextField").default;
18
+ };
19
+ runAsync(): Promise<void>;
20
+ private sanitizeFlagsAsync;
21
+ }
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const fs_extra_1 = require("fs-extra");
7
+ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
8
+ const queries_1 = require("../../build/queries");
9
+ const types_1 = require("../../build/types");
10
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
11
+ const pagination_1 = require("../../commandUtils/pagination");
12
+ const generated_1 = require("../../graphql/generated");
13
+ const BuildQuery_1 = require("../../graphql/queries/BuildQuery");
14
+ const projectUtils_1 = require("../../project/projectUtils");
15
+ const prompts_1 = require("../../prompts");
16
+ const run_1 = require("../../run/run");
17
+ const buildDistribution_1 = require("../../utils/buildDistribution");
18
+ const download_1 = require("../../utils/download");
19
+ class Run extends EasCommand_1.default {
20
+ async runAsync() {
21
+ const { flags: rawFlags } = await this.parse(Run);
22
+ const flags = await this.sanitizeFlagsAsync(rawFlags);
23
+ const queryOptions = (0, pagination_1.getPaginatedQueryOptions)(flags);
24
+ const { loggedIn: { graphqlClient }, projectConfig: { projectId }, } = await this.getContextAsync(Run, {
25
+ nonInteractive: false,
26
+ });
27
+ const simulatorBuildPath = await getPathToSimulatorBuildAppAsync(graphqlClient, projectId, flags, queryOptions);
28
+ await (0, run_1.runAsync)(simulatorBuildPath, flags.selectedPlatform);
29
+ }
30
+ async sanitizeFlagsAsync(flags) {
31
+ const { platform, limit, offset, ...runArchiveFlags } = flags;
32
+ const selectedPlatform = await resolvePlatformAsync(platform);
33
+ if (runArchiveFlags.path &&
34
+ !((runArchiveFlags.path.endsWith('.tar.gz') ||
35
+ runArchiveFlags.path.endsWith('.app') ||
36
+ runArchiveFlags.path.endsWith('.apk')) &&
37
+ (0, fs_extra_1.existsSync)(runArchiveFlags.path))) {
38
+ core_1.Errors.error('The path must point to a .tar.gz archive, .apk file, or .app directory', {
39
+ exit: 1,
40
+ });
41
+ }
42
+ return {
43
+ selectedPlatform,
44
+ runArchiveFlags,
45
+ limit,
46
+ offset,
47
+ };
48
+ }
49
+ }
50
+ exports.default = Run;
51
+ _a = Run;
52
+ Run.hidden = true;
53
+ Run.description = 'run simulator/emulator builds from eas-cli';
54
+ Run.flags = {
55
+ latest: core_1.Flags.boolean({
56
+ description: 'Run the latest simulator/emulator build for specified platform',
57
+ exclusive: ['id', 'path', 'url'],
58
+ }),
59
+ url: core_1.Flags.string({
60
+ description: 'Simulator/Emulator build archive url',
61
+ exclusive: ['latest', 'id', 'path'],
62
+ }),
63
+ path: core_1.Flags.string({
64
+ description: 'Path to the simulator/emulator build archive or simulator build app',
65
+ exclusive: ['latest', 'id', 'url'],
66
+ }),
67
+ id: core_1.Flags.string({
68
+ description: 'ID of the simulator/emulator build to run',
69
+ exclusive: ['latest, path, url'],
70
+ }),
71
+ platform: core_1.Flags.enum({
72
+ char: 'p',
73
+ options: ['android', 'ios'],
74
+ }),
75
+ ...pagination_1.EasPaginatedQueryFlags,
76
+ };
77
+ Run.contextDefinition = {
78
+ ..._a.ContextOptions.LoggedIn,
79
+ ..._a.ContextOptions.ProjectConfig,
80
+ ..._a.ContextOptions.ProjectDir,
81
+ };
82
+ async function resolvePlatformAsync(platform) {
83
+ if (platform && Object.values(generated_1.AppPlatform).includes(platform.toUpperCase())) {
84
+ return platform.toUpperCase();
85
+ }
86
+ const { selectedPlatform } = await (0, prompts_1.promptAsync)({
87
+ type: 'select',
88
+ message: 'Select platform',
89
+ name: 'selectedPlatform',
90
+ choices: [
91
+ { title: 'Android', value: generated_1.AppPlatform.Android },
92
+ { title: 'iOS', value: generated_1.AppPlatform.Ios },
93
+ ],
94
+ });
95
+ return selectedPlatform;
96
+ }
97
+ async function maybeGetBuildAsync(graphqlClient, flags, projectId, paginatedQueryOptions) {
98
+ if (flags.runArchiveFlags.id) {
99
+ return BuildQuery_1.BuildQuery.byIdAsync(graphqlClient, flags.runArchiveFlags.id);
100
+ }
101
+ else if (!flags.runArchiveFlags.id &&
102
+ !flags.runArchiveFlags.path &&
103
+ !flags.runArchiveFlags.url &&
104
+ !flags.runArchiveFlags.latest) {
105
+ return await (0, queries_1.listAndSelectBuildsOnAppAsync)(graphqlClient, {
106
+ projectId,
107
+ projectDisplayName: await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId),
108
+ filter: {
109
+ platform: flags.selectedPlatform,
110
+ distribution: (0, buildDistribution_1.buildDistributionTypeToGraphQLDistributionType)(types_1.BuildDistributionType.SIMULATOR),
111
+ status: generated_1.BuildStatus.Finished,
112
+ },
113
+ queryOptions: paginatedQueryOptions,
114
+ });
115
+ }
116
+ else if (flags.runArchiveFlags.latest) {
117
+ return await (0, queries_1.getLatestBuildAsync)(graphqlClient, {
118
+ projectId,
119
+ filter: {
120
+ platform: flags.selectedPlatform,
121
+ distribution: (0, buildDistribution_1.buildDistributionTypeToGraphQLDistributionType)(types_1.BuildDistributionType.SIMULATOR),
122
+ status: generated_1.BuildStatus.Finished,
123
+ },
124
+ });
125
+ }
126
+ else {
127
+ return null;
128
+ }
129
+ }
130
+ async function getPathToSimulatorBuildAppAsync(graphqlClient, projectId, flags, queryOptions) {
131
+ var _b, _c;
132
+ const maybeBuild = await maybeGetBuildAsync(graphqlClient, flags, projectId, queryOptions);
133
+ const appExtension = flags.selectedPlatform === generated_1.AppPlatform.Ios ? 'app' : 'apk';
134
+ if (maybeBuild) {
135
+ if (!((_b = maybeBuild.artifacts) === null || _b === void 0 ? void 0 : _b.applicationArchiveUrl)) {
136
+ throw new Error('Build does not have an application archive url');
137
+ }
138
+ return await (0, download_1.downloadAndExtractAppAsync)(maybeBuild.artifacts.applicationArchiveUrl, appExtension);
139
+ }
140
+ if (flags.runArchiveFlags.url) {
141
+ return await (0, download_1.downloadAndExtractAppAsync)(flags.runArchiveFlags.url, appExtension);
142
+ }
143
+ if ((_c = flags.runArchiveFlags.path) === null || _c === void 0 ? void 0 : _c.endsWith('.tar.gz')) {
144
+ return await (0, download_1.extractAppFromLocalArchiveAsync)(flags.runArchiveFlags.path, appExtension);
145
+ }
146
+ // this should never fail, due to the validation in sanitizeFlagsAsync
147
+ (0, node_assert_1.default)(flags.runArchiveFlags.path);
148
+ return flags.runArchiveFlags.path;
149
+ }
@@ -2,7 +2,7 @@ import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSetView extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
7
  };
8
8
  static contextDefinition: {
@@ -2,7 +2,7 @@ import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSyncView extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
7
  };
8
8
  static contextDefinition: {