eas-cli 3.18.0 → 3.18.2

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 (63) hide show
  1. package/README.md +55 -55
  2. package/build/branch/actions/SelectBranch.d.ts +33 -0
  3. package/build/branch/actions/SelectBranch.js +67 -0
  4. package/build/build/local.js +1 -1
  5. package/build/build/runBuildAndSubmit.js +0 -2
  6. package/build/channel/actions/SelectChannel.d.ts +16 -0
  7. package/build/channel/actions/SelectChannel.js +42 -24
  8. package/build/channel/branch-mapping.d.ts +17 -1
  9. package/build/channel/branch-mapping.js +48 -7
  10. package/build/channel/queries.d.ts +1 -6
  11. package/build/channel/queries.js +1 -25
  12. package/build/commands/build/version/get.js +0 -1
  13. package/build/commands/build/version/sync.js +0 -1
  14. package/build/commands/channel/rollout-preview.d.ts +32 -0
  15. package/build/commands/channel/rollout-preview.js +109 -0
  16. package/build/commands/metadata/lint.js +0 -1
  17. package/build/commands/metadata/pull.js +0 -1
  18. package/build/commands/metadata/push.js +0 -1
  19. package/build/commands/submit.js +0 -1
  20. package/build/commands/update/republish.js +23 -74
  21. package/build/graphql/generated.d.ts +192 -18
  22. package/build/graphql/generated.js +8 -2
  23. package/build/graphql/queries/BranchQuery.d.ts +3 -2
  24. package/build/graphql/queries/BranchQuery.js +43 -1
  25. package/build/graphql/queries/ChannelQuery.d.ts +3 -2
  26. package/build/graphql/queries/ChannelQuery.js +19 -5
  27. package/build/graphql/queries/RuntimeQuery.d.ts +6 -0
  28. package/build/graphql/queries/RuntimeQuery.js +70 -0
  29. package/build/graphql/types/Runtime.d.ts +1 -0
  30. package/build/graphql/types/Runtime.js +11 -0
  31. package/build/graphql/types/UpdateBranch.js +3 -1
  32. package/build/graphql/types/UpdateBranchBasicInfo.d.ts +1 -0
  33. package/build/graphql/types/UpdateBranchBasicInfo.js +11 -0
  34. package/build/metadata/apple/config/reader.js +1 -1
  35. package/build/rollout/actions/CreateRollout.d.ts +23 -0
  36. package/build/rollout/actions/CreateRollout.js +153 -0
  37. package/build/rollout/actions/EditRollout.d.ts +17 -0
  38. package/build/rollout/actions/EditRollout.js +79 -0
  39. package/build/rollout/actions/EndRollout.d.ts +24 -0
  40. package/build/rollout/actions/EndRollout.js +164 -0
  41. package/build/rollout/actions/ManageRollout.d.ts +24 -0
  42. package/build/rollout/actions/ManageRollout.js +78 -0
  43. package/build/rollout/actions/NonInteractiveRollout.d.ts +18 -0
  44. package/build/rollout/actions/NonInteractiveRollout.js +46 -0
  45. package/build/rollout/actions/RolloutMainMenu.d.ts +28 -0
  46. package/build/rollout/actions/RolloutMainMenu.js +110 -0
  47. package/build/rollout/actions/SelectRollout.js +18 -8
  48. package/build/rollout/actions/SelectRuntime.d.ts +36 -0
  49. package/build/rollout/actions/SelectRuntime.js +167 -0
  50. package/build/rollout/branch-mapping.d.ts +52 -4
  51. package/build/rollout/branch-mapping.js +68 -19
  52. package/build/rollout/utils.d.ts +9 -2
  53. package/build/rollout/utils.js +66 -21
  54. package/build/update/configure.d.ts +6 -1
  55. package/build/update/configure.js +18 -8
  56. package/build/update/republish.d.ts +26 -0
  57. package/build/update/republish.js +83 -0
  58. package/build/utils/profiles.d.ts +1 -2
  59. package/build/utils/profiles.js +3 -35
  60. package/build/utils/relay.d.ts +80 -15
  61. package/build/utils/relay.js +211 -28
  62. package/oclif.manifest.json +1 -1
  63. package/package.json +2 -2
@@ -1,36 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printBranch = exports.printRollout = void 0;
3
+ exports.promptForRolloutPercentAsync = exports.formatRuntimeWithUpdateGroup = exports.formatBranchWithUpdateGroup = exports.displayRolloutDetails = exports.printRollout = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const log_1 = tslib_1.__importDefault(require("../log"));
7
+ const prompts_1 = require("../prompts");
8
+ const utils_1 = require("../update/utils");
7
9
  const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
8
10
  const branch_mapping_1 = require("./branch-mapping");
9
11
  function printRollout(channel) {
10
12
  const rollout = (0, branch_mapping_1.getRollout)(channel);
11
- const rolledOutPercent = rollout.percentRolledOut;
12
- log_1.default.addNewLineIfNone();
13
- log_1.default.log(chalk_1.default.bold('Rollout:'));
14
- log_1.default.log((0, formatFields_1.default)([
15
- { label: 'Channel', value: channel.name },
16
- ...((0, branch_mapping_1.isConstrainedRollout)(rollout)
17
- ? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
18
- : []),
19
- {
20
- label: 'Branches',
21
- value: `${rollout.rolledOutBranch.name} (${rolledOutPercent}%), ${rollout.defaultBranch.name} (${100 - rolledOutPercent}%)`,
22
- },
23
- ]));
24
- log_1.default.addNewLineIfNone();
13
+ displayRolloutDetails(channel.name, rollout);
25
14
  }
26
15
  exports.printRollout = printRollout;
27
- function printBranch(channel) {
28
- const rollout = (0, branch_mapping_1.getRollout)(channel);
16
+ function displayRolloutDetails(channelName, rollout) {
29
17
  const rolledOutPercent = rollout.percentRolledOut;
30
- log_1.default.addNewLineIfNone();
31
- log_1.default.log(chalk_1.default.bold('Rollout:'));
18
+ log_1.default.newLine();
19
+ log_1.default.log(chalk_1.default.bold('🚀 Rollout:'));
32
20
  log_1.default.log((0, formatFields_1.default)([
33
- { label: 'Channel', value: channel.name },
21
+ { label: 'Channel', value: channelName },
34
22
  ...((0, branch_mapping_1.isConstrainedRollout)(rollout)
35
23
  ? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
36
24
  : []),
@@ -41,4 +29,61 @@ function printBranch(channel) {
41
29
  ]));
42
30
  log_1.default.addNewLineIfNone();
43
31
  }
44
- exports.printBranch = printBranch;
32
+ exports.displayRolloutDetails = displayRolloutDetails;
33
+ function formatBranchWithUpdateGroup(maybeUpdateGroup, branch, percentRolledOut) {
34
+ const lines = [];
35
+ lines.push(chalk_1.default.bold(`🍽️ Served by branch ${chalk_1.default.bold(branch.name)} (${percentRolledOut}%)`));
36
+ if (!maybeUpdateGroup) {
37
+ lines.push(`No updates for target runtime`);
38
+ }
39
+ else {
40
+ const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([maybeUpdateGroup]);
41
+ lines.push(...formatUpdateGroup(updateGroupDescription));
42
+ }
43
+ return lines.join('\n ');
44
+ }
45
+ exports.formatBranchWithUpdateGroup = formatBranchWithUpdateGroup;
46
+ function formatRuntimeWithUpdateGroup(maybeUpdateGroup, runtime) {
47
+ const lines = [];
48
+ lines.push(chalk_1.default.bold(`🍽️ Served by runtime ${chalk_1.default.bold(runtime.version)}:`));
49
+ if (!maybeUpdateGroup) {
50
+ lines.push(`No updates published for this runtime`);
51
+ }
52
+ else {
53
+ const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([maybeUpdateGroup]);
54
+ lines.push(...formatUpdateGroup(updateGroupDescription));
55
+ }
56
+ return lines.join('\n ');
57
+ }
58
+ exports.formatRuntimeWithUpdateGroup = formatRuntimeWithUpdateGroup;
59
+ function formatUpdateGroup(updateGroup) {
60
+ var _a, _b, _c, _d;
61
+ const lines = [];
62
+ const formattedLines = (0, formatFields_1.default)([
63
+ { label: 'Message', value: (_a = updateGroup.message) !== null && _a !== void 0 ? _a : 'N/A' },
64
+ { label: 'Runtime Version', value: (_b = updateGroup.runtimeVersion) !== null && _b !== void 0 ? _b : 'N/A' },
65
+ { label: 'Platforms', value: (_c = updateGroup.platforms) !== null && _c !== void 0 ? _c : 'N/A' },
66
+ { label: 'Group ID', value: (_d = updateGroup.group) !== null && _d !== void 0 ? _d : 'N/A' },
67
+ ]).split('\n');
68
+ lines.push(...formattedLines);
69
+ return lines;
70
+ }
71
+ async function promptForRolloutPercentAsync({ promptMessage, }) {
72
+ const { name: rolloutPercent } = await (0, prompts_1.promptAsync)({
73
+ type: 'text',
74
+ name: 'name',
75
+ format: value => {
76
+ return parseInt(value, 10);
77
+ },
78
+ message: promptMessage,
79
+ initial: 0,
80
+ validate: (rolloutPercent) => {
81
+ const floatValue = parseFloat(rolloutPercent);
82
+ return Number.isInteger(floatValue) && floatValue >= 0 && floatValue <= 100
83
+ ? true
84
+ : 'The rollout percentage must be an integer between 0 and 100 inclusive.';
85
+ },
86
+ });
87
+ return rolloutPercent;
88
+ }
89
+ exports.promptForRolloutPercentAsync = promptForRolloutPercentAsync;
@@ -1,10 +1,15 @@
1
1
  import { ExpoConfig } from '@expo/config-types';
2
+ import { Workflow } from '@expo/eas-build-job';
2
3
  import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
3
4
  import { RequestedPlatform } from '../platform';
4
- export declare const DEFAULT_MANAGED_RUNTIME_VERSION: {
5
+ export declare const DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49: {
6
+ readonly policy: "appVersion";
7
+ };
8
+ export declare const DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48: {
5
9
  readonly policy: "sdkVersion";
6
10
  };
7
11
  export declare const DEFAULT_BARE_RUNTIME_VERSION: "1.0.0";
12
+ export declare function getDefaultRuntimeVersion(workflow: Workflow, sdkVersion: string | undefined): NonNullable<ExpoConfig['runtimeVersion']>;
8
13
  /**
9
14
  * Make sure EAS Build profiles are configured to work with EAS Update by adding channels to build profiles.
10
15
  */
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureUseClassicUpdatesIsRemovedAsync = exports.ensureEASUpdateIsConfiguredAsync = exports.ensureEASUpdateIsConfiguredInEasJsonAsync = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.DEFAULT_MANAGED_RUNTIME_VERSION = void 0;
3
+ exports.ensureUseClassicUpdatesIsRemovedAsync = exports.ensureEASUpdateIsConfiguredAsync = exports.ensureEASUpdateIsConfiguredInEasJsonAsync = exports.getDefaultRuntimeVersion = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48 = exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49 = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
6
  const eas_json_1 = require("@expo/eas-json");
7
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
8
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
+ const semver_1 = tslib_1.__importDefault(require("semver"));
9
10
  const api_1 = require("../api");
10
11
  const generated_1 = require("../graphql/generated");
11
12
  const log_1 = tslib_1.__importStar(require("../log"));
@@ -16,13 +17,20 @@ const workflow_1 = require("../project/workflow");
16
17
  const prompts_1 = require("../prompts");
17
18
  const UpdatesModule_1 = require("./android/UpdatesModule");
18
19
  const UpdatesModule_2 = require("./ios/UpdatesModule");
19
- exports.DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' };
20
+ exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49 = { policy: 'appVersion' };
21
+ exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48 = { policy: 'sdkVersion' };
20
22
  exports.DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
21
- function getDefaultRuntimeVersion(workflow) {
22
- return workflow === eas_build_job_1.Workflow.GENERIC
23
- ? exports.DEFAULT_BARE_RUNTIME_VERSION
24
- : exports.DEFAULT_MANAGED_RUNTIME_VERSION;
23
+ function getDefaultRuntimeVersion(workflow, sdkVersion) {
24
+ if (workflow === eas_build_job_1.Workflow.GENERIC) {
25
+ return exports.DEFAULT_BARE_RUNTIME_VERSION;
26
+ }
27
+ // Expo Go supports loading appVersion SDK 49 and above
28
+ const hasSupportedSdk = sdkVersion && semver_1.default.satisfies(sdkVersion, '>= 49.0.0');
29
+ return hasSupportedSdk
30
+ ? exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
31
+ : exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48;
25
32
  }
33
+ exports.getDefaultRuntimeVersion = getDefaultRuntimeVersion;
26
34
  function isRuntimeEqual(runtimeVersionA, runtimeVersionB) {
27
35
  if (typeof runtimeVersionA === 'string' && typeof runtimeVersionB === 'string') {
28
36
  return runtimeVersionA === runtimeVersionB;
@@ -81,8 +89,10 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({ exp, projectId, p
81
89
  let iosRuntimeVersion = (_e = (_d = exp.ios) === null || _d === void 0 ? void 0 : _d.runtimeVersion) !== null && _e !== void 0 ? _e : exp.runtimeVersion;
82
90
  if ((['all', 'android'].includes(platform) && !androidRuntimeVersion) ||
83
91
  (['all', 'ios'].includes(platform) && !iosRuntimeVersion)) {
84
- androidRuntimeVersion = androidRuntimeVersion !== null && androidRuntimeVersion !== void 0 ? androidRuntimeVersion : getDefaultRuntimeVersion(workflows.android);
85
- iosRuntimeVersion = iosRuntimeVersion !== null && iosRuntimeVersion !== void 0 ? iosRuntimeVersion : getDefaultRuntimeVersion(workflows.ios);
92
+ androidRuntimeVersion =
93
+ androidRuntimeVersion !== null && androidRuntimeVersion !== void 0 ? androidRuntimeVersion : getDefaultRuntimeVersion(workflows.android, exp.sdkVersion);
94
+ iosRuntimeVersion =
95
+ iosRuntimeVersion !== null && iosRuntimeVersion !== void 0 ? iosRuntimeVersion : getDefaultRuntimeVersion(workflows.ios, exp.sdkVersion);
86
96
  if (platform === 'all' && isRuntimeEqual(androidRuntimeVersion, iosRuntimeVersion)) {
87
97
  modifyConfig.runtimeVersion = androidRuntimeVersion;
88
98
  }
@@ -0,0 +1,26 @@
1
+ import { ExpoConfig } from '@expo/config';
2
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
3
+ import { Update } from '../graphql/generated';
4
+ export type UpdateToRepublish = {
5
+ groupId: string;
6
+ branchId: string;
7
+ branchName: string;
8
+ } & Pick<Update, 'message' | 'runtimeVersion' | 'manifestFragment' | 'platform' | 'gitCommitHash' | 'codeSigningInfo'>;
9
+ /**
10
+ * @param updatesToPublish The update group to republish
11
+ * @param targetBranch The branch to repubish the update group on
12
+ */
13
+ export declare function republishAsync({ graphqlClient, app, updatesToPublish, targetBranch, updateMessage, json, }: {
14
+ graphqlClient: ExpoGraphqlClient;
15
+ app: {
16
+ exp: ExpoConfig;
17
+ projectId: string;
18
+ };
19
+ updatesToPublish: UpdateToRepublish[];
20
+ targetBranch: {
21
+ branchName: string;
22
+ branchId: string;
23
+ };
24
+ updateMessage: string;
25
+ json?: boolean;
26
+ }): Promise<void>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.republishAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const assert_1 = tslib_1.__importDefault(require("assert"));
6
+ const url_1 = require("../build/utils/url");
7
+ const PublishMutation_1 = require("../graphql/mutations/PublishMutation");
8
+ const log_1 = tslib_1.__importStar(require("../log"));
9
+ const ora_1 = require("../ora");
10
+ const projectUtils_1 = require("../project/projectUtils");
11
+ const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
12
+ const json_1 = require("../utils/json");
13
+ /**
14
+ * @param updatesToPublish The update group to republish
15
+ * @param targetBranch The branch to repubish the update group on
16
+ */
17
+ async function republishAsync({ graphqlClient, app, updatesToPublish, targetBranch, updateMessage, json, }) {
18
+ const { branchName: targetBranchName, branchId: targetBranchId } = targetBranch;
19
+ // The update group properties are the same for all updates
20
+ (0, assert_1.default)(updatesToPublish.length > 0, 'Updates to republish must be provided');
21
+ const arbitraryUpdate = updatesToPublish[0];
22
+ const isSameGroup = (update) => update.groupId === arbitraryUpdate.groupId &&
23
+ update.branchId === arbitraryUpdate.branchId &&
24
+ update.branchName === arbitraryUpdate.branchName &&
25
+ update.runtimeVersion === arbitraryUpdate.runtimeVersion;
26
+ (0, assert_1.default)(updatesToPublish.every(isSameGroup), 'All updates must belong to the same update group');
27
+ const { runtimeVersion } = arbitraryUpdate;
28
+ // If codesigning was created for the original update, we need to add it to the republish
29
+ const shouldRepublishWithCodesigning = updatesToPublish.some(update => update.codeSigningInfo);
30
+ if (shouldRepublishWithCodesigning) {
31
+ log_1.default.withTick(`The republished update will be signed with the same codesigning as the original update.`);
32
+ }
33
+ const publishIndicator = (0, ora_1.ora)('Republishing...').start();
34
+ let updatesRepublished;
35
+ try {
36
+ updatesRepublished = await PublishMutation_1.PublishMutation.publishUpdateGroupAsync(graphqlClient, [
37
+ {
38
+ branchId: targetBranchId,
39
+ runtimeVersion,
40
+ message: updateMessage,
41
+ updateInfoGroup: Object.fromEntries(updatesToPublish.map(update => [update.platform, JSON.parse(update.manifestFragment)])),
42
+ gitCommitHash: updatesToPublish[0].gitCommitHash,
43
+ awaitingCodeSigningInfo: shouldRepublishWithCodesigning,
44
+ },
45
+ ]);
46
+ if (shouldRepublishWithCodesigning) {
47
+ const codeSigningByPlatform = Object.fromEntries(updatesToPublish.map(update => [update.platform, update.codeSigningInfo]));
48
+ await Promise.all(updatesRepublished.map(async (update) => {
49
+ const codeSigning = codeSigningByPlatform[update.platform];
50
+ if (codeSigning) {
51
+ await PublishMutation_1.PublishMutation.setCodeSigningInfoAsync(graphqlClient, update.id, codeSigning);
52
+ }
53
+ }));
54
+ }
55
+ publishIndicator.succeed('Republished update');
56
+ }
57
+ catch (error) {
58
+ publishIndicator.fail('Failed to republish update');
59
+ throw error;
60
+ }
61
+ if (json) {
62
+ return (0, json_1.printJsonOnlyOutput)(updatesRepublished);
63
+ }
64
+ const updatesRepublishedByPlatform = Object.fromEntries(updatesRepublished.map(update => [update.platform, update]));
65
+ const arbitraryRepublishedUpdate = updatesRepublished[0];
66
+ const updateGroupUrl = (0, url_1.getUpdateGroupUrl)((await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, app.projectId)).name, app.exp.slug, arbitraryRepublishedUpdate.group);
67
+ log_1.default.addNewLineIfNone();
68
+ log_1.default.log((0, formatFields_1.default)([
69
+ { label: 'Branch', value: targetBranchName },
70
+ { label: 'Runtime version', value: arbitraryRepublishedUpdate.runtimeVersion },
71
+ { label: 'Platform', value: updatesRepublished.map(update => update.platform).join(', ') },
72
+ { label: 'Update Group ID', value: arbitraryRepublishedUpdate.group },
73
+ ...(updatesRepublishedByPlatform.android
74
+ ? [{ label: 'Android update ID', value: updatesRepublishedByPlatform.android.id }]
75
+ : []),
76
+ ...(updatesRepublishedByPlatform.ios
77
+ ? [{ label: 'iOS update ID', value: updatesRepublishedByPlatform.ios.id }]
78
+ : []),
79
+ { label: 'Message', value: updateMessage },
80
+ { label: 'Website link', value: (0, log_1.link)(updateGroupUrl, { dim: false }) },
81
+ ]));
82
+ }
83
+ exports.republishAsync = republishAsync;
@@ -6,11 +6,10 @@ export type ProfileData<T extends ProfileType> = {
6
6
  platform: Platform;
7
7
  profileName: string;
8
8
  };
9
- export declare function getProfilesAsync<T extends ProfileType>({ easJsonAccessor, platforms, profileName, type, projectDir, }: {
9
+ export declare function getProfilesAsync<T extends ProfileType>({ easJsonAccessor, platforms, profileName, type, }: {
10
10
  easJsonAccessor: EasJsonAccessor;
11
11
  platforms: Platform[];
12
12
  profileName?: string;
13
- projectDir: string;
14
13
  type: T;
15
14
  }): Promise<ProfileData<T>[]>;
16
15
  /**
@@ -3,18 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.maybePrintBuildProfileDeprecationWarningsAsync = exports.clearHasPrintedDeprecationWarnings = exports.getProfilesAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_json_1 = require("@expo/eas-json");
6
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const semver_1 = tslib_1.__importDefault(require("semver"));
9
6
  const log_1 = tslib_1.__importStar(require("../log"));
10
- async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type, projectDir, }) {
7
+ async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type, }) {
11
8
  const results = platforms.map(async function (platform) {
12
- const profile = await readProfileWithOverridesAsync({
9
+ const profile = await readProfileAsync({
13
10
  easJsonAccessor,
14
11
  platform,
15
12
  type,
16
13
  profileName,
17
- projectDir,
18
14
  });
19
15
  return {
20
16
  profile,
@@ -25,38 +21,10 @@ async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type,
25
21
  return await Promise.all(results);
26
22
  }
27
23
  exports.getProfilesAsync = getProfilesAsync;
28
- async function setNodeVersionFromFileAsync(projectDir, profile) {
29
- if (profile === null || profile === void 0 ? void 0 : profile.node) {
30
- return;
31
- }
32
- const nodeVersion = await getNodeVersionFromFileAsync(projectDir);
33
- if (nodeVersion) {
34
- log_1.default.log(`The EAS build profile does not specify a Node.js version. Using the version specified in .nvmrc: ${nodeVersion} `);
35
- profile.node = nodeVersion;
36
- }
37
- }
38
- async function getNodeVersionFromFileAsync(projectDir) {
39
- const nvmrcPath = path_1.default.join(projectDir, '.nvmrc');
40
- if (!(await fs_extra_1.default.pathExists(nvmrcPath))) {
41
- return;
42
- }
43
- let nodeVersion;
44
- try {
45
- nodeVersion = (await fs_extra_1.default.readFile(nvmrcPath, 'utf8')).toString().trim();
46
- }
47
- catch {
48
- return undefined;
49
- }
50
- if (!semver_1.default.valid(nodeVersion)) {
51
- throw new Error(`Invalid node version in .nvmrc: ${nodeVersion}`);
52
- }
53
- return nodeVersion;
54
- }
55
- async function readProfileWithOverridesAsync({ easJsonAccessor, platform, type, profileName, projectDir, }) {
24
+ async function readProfileAsync({ easJsonAccessor, platform, type, profileName, }) {
56
25
  if (type === 'build') {
57
26
  const buildProfile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(easJsonAccessor, platform, profileName);
58
27
  await maybePrintBuildProfileDeprecationWarningsAsync(easJsonAccessor, platform, profileName);
59
- await setNodeVersionFromFileAsync(projectDir, buildProfile);
60
28
  return buildProfile;
61
29
  }
62
30
  else {
@@ -3,31 +3,96 @@ export type Connection<T> = {
3
3
  edges: Edge<T>[];
4
4
  pageInfo: PageInfo;
5
5
  };
6
- type Edge<T> = {
6
+ export type Edge<T> = {
7
+ cursor: string;
7
8
  node: T;
8
9
  };
9
10
  export type QueryParams = {
10
- first: number;
11
+ first?: number;
11
12
  after?: string;
13
+ last?: number;
14
+ before?: string;
12
15
  };
13
16
  /**
14
- * Fetches dataset in paginated manner (batch by batch) using GraphQL queries.
15
17
  *
18
+ * Pagination that performs client side filtering on the nodes returned from a relay compliant datasource.
19
+ *
20
+ * @param queryParams The query params for the pagination.
16
21
  * @param queryAsync A promise based function for querying.
22
+ * @param filterPredicate A predicate function to filter the node.
23
+ * @param beforeEachQuery Optional. A callback function to be called before each query
24
+ * @param afterEachQuery Optional. A callback function to be called after each query.
25
+ * @param internalBatchSize Optional. The batch size of queryAsync. Defaults to 100.
26
+ * @param maxNodesFetched Optional. The maximum number of nodes to fetch. Defaults to 10_000.
17
27
  * @param beforeEachQuery Optional. A callback function to be called before each query
28
+ * @args externalQueryParams The query params for the pagination.
29
+ * @args totalNodesFetched The total number of nodes fetched so far.
30
+ * @args dataset The dataset so far.
18
31
  * @param afterEachQuery Optional. A callback function to be called after each query.
19
- * @param filterPredicate Optional. A predicate function to filter the node.
20
- * @param batchSize Optional. The batch size of the pagination. Defaults to 100.
32
+ * @args externalQueryParams The query params for the pagination.
33
+ * @args totalNodesFetched The total number of nodes fetched so far.
34
+ * @args dataset The dataset so far.
35
+ * @args willFetchAgain If the query will fetch again to get a complete page.
21
36
  *
22
- * @return {Promise<T[]>} - A promise that resolves to an array (the dataset).
23
37
  * @throws {Error} - If an error occurs during execution of the query or pagination.
24
38
  */
25
- export declare function getPaginatedDatasetAsync<T>({ queryAsync, beforeEachQuery, afterEachQuery, filterPredicate, batchSize, maxNodesFetched, }: {
26
- queryAsync: ({ first, after }: QueryParams) => Promise<Connection<T>>;
27
- beforeEachQuery?: (totalNodesFetched: number, dataset: T[]) => void;
28
- afterEachQuery?: (totalNodesFetched: number, dataset: T[], batch: T[], pageInfo: PageInfo) => void;
29
- filterPredicate?: (node: T) => boolean;
30
- batchSize?: number;
31
- maxNodesFetched?: number;
32
- }): Promise<T[]>;
33
- export {};
39
+ export declare class FilterPagination {
40
+ static getPageAsync<T>({ queryParams, queryAsync, filterPredicate, internalBatchSize, maxNodesFetched, beforeEachQuery, afterEachQuery, }: {
41
+ queryParams: QueryParams;
42
+ queryAsync: (queryParams: QueryParams) => Promise<Connection<T>>;
43
+ filterPredicate: (node: T) => boolean;
44
+ internalBatchSize?: number;
45
+ maxNodesFetched?: number;
46
+ beforeEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[]) => void;
47
+ afterEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[], willFetchAgain: boolean) => void;
48
+ }): Promise<Connection<T>>;
49
+ static isFirstAfter(connectionArgs: QueryParams): connectionArgs is {
50
+ first: number;
51
+ after?: string;
52
+ };
53
+ static isLastBefore(connectionArgs: {
54
+ first?: number;
55
+ after?: string;
56
+ last?: number;
57
+ before?: string;
58
+ }): connectionArgs is {
59
+ last: number;
60
+ before?: string;
61
+ };
62
+ static getFirstItemsAsync<T>({ first, after }: {
63
+ first: number;
64
+ after?: string;
65
+ }, { internalBatchSize, maxNodesFetched, filterPredicate, queryAsync, beforeEachQuery, afterEachQuery, }: {
66
+ internalBatchSize?: number;
67
+ maxNodesFetched: number;
68
+ filterPredicate: (node: T) => boolean;
69
+ queryAsync: (queryParams: QueryParams) => Promise<Connection<T>>;
70
+ beforeEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[]) => void;
71
+ afterEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[], willFetchAgain: boolean) => void;
72
+ }): Promise<Connection<T>>;
73
+ static getLastItemsAsync<T>({ last, before }: {
74
+ last: number;
75
+ before?: string;
76
+ }, { internalBatchSize, maxNodesFetched, filterPredicate, queryAsync, beforeEachQuery, afterEachQuery, }: {
77
+ internalBatchSize?: number;
78
+ maxNodesFetched: number;
79
+ filterPredicate: (node: T) => boolean;
80
+ queryAsync: (queryParams: QueryParams) => Promise<Connection<T>>;
81
+ beforeEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[]) => void;
82
+ afterEachQuery?: (externalQueryParams: QueryParams, totalNodesFetched: number, dataset: Edge<T>[], willFetchAgain: boolean) => void;
83
+ }): Promise<Connection<T>>;
84
+ }
85
+ export declare function selectPaginatedAsync<T>({ queryAsync, getTitleAsync, printedType, pageSize, }: {
86
+ pageSize: number;
87
+ queryAsync: (queryParams: QueryParams) => Promise<Connection<T>>;
88
+ getTitleAsync: (node: T) => Promise<string>;
89
+ printedType: string;
90
+ }): Promise<T | null>;
91
+ export declare const PREV_PAGE_OPTION: {
92
+ value: symbol;
93
+ title: string;
94
+ };
95
+ export declare const NEXT_PAGE_OPTION: {
96
+ value: symbol;
97
+ title: string;
98
+ };