eas-cli 3.16.0 → 3.17.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.
- package/README.md +55 -55
- package/build/build/build.js +1 -0
- package/build/build/errors.d.ts +2 -0
- package/build/build/errors.js +4 -1
- package/build/channel/branch-mapping.d.ts +27 -0
- package/build/channel/branch-mapping.js +49 -0
- package/build/channel/queries.d.ts +6 -1
- package/build/channel/queries.js +29 -3
- package/build/channel/utils.d.ts +3 -12
- package/build/channel/utils.js +24 -4
- package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +2 -2
- package/build/commandUtils/context/contextUtils/createGraphqlClient.js +0 -1
- package/build/commands/channel/edit.d.ts +2 -2
- package/build/commands/channel/edit.js +4 -2
- package/build/commands/channel/rollout.js +6 -1
- package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.js +2 -2
- package/build/graphql/generated.d.ts +180 -19
- package/build/graphql/generated.js +11 -2
- package/build/graphql/queries/ChannelQuery.d.ts +8 -4
- package/build/graphql/queries/ChannelQuery.js +43 -4
- package/build/graphql/types/Submission.js +1 -0
- package/build/graphql/types/UpdateChannelBasicInfo.d.ts +1 -0
- package/build/graphql/types/UpdateChannelBasicInfo.js +12 -0
- package/build/rollout/utils.d.ts +53 -0
- package/build/rollout/utils.js +105 -0
- package/build/submit/android/AndroidSubmitCommand.d.ts +1 -0
- package/build/submit/android/AndroidSubmitCommand.js +7 -1
- package/build/submit/android/AndroidSubmitter.d.ts +1 -1
- package/build/submit/android/AndroidSubmitter.js +5 -2
- package/build/utils/relay.d.ts +33 -0
- package/build/utils/relay.js +43 -0
- package/oclif.manifest.json +1 -1
- package/package.json +9 -8
package/build/channel/queries.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureChannelExistsAsync = exports.createChannelOnAppAsync = exports.listAndRenderBranchesAndUpdatesOnChannelAsync = exports.listAndRenderChannelsOnAppAsync = exports.selectChannelOnAppAsync = exports.CHANNELS_LIMIT = void 0;
|
|
3
|
+
exports.getChannelsDatasetAsync = exports.ensureChannelExistsAsync = exports.createChannelOnAppAsync = exports.listAndRenderBranchesAndUpdatesOnChannelAsync = exports.listAndRenderChannelsOnAppAsync = exports.selectChannelOnAppAsync = exports.CHANNELS_LIMIT = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const graphql_1 = require("graphql");
|
|
6
7
|
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
7
8
|
const client_1 = require("../graphql/client");
|
|
8
9
|
const BranchQuery_1 = require("../graphql/queries/BranchQuery");
|
|
9
10
|
const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
|
|
11
|
+
const UpdateChannelBasicInfo_1 = require("../graphql/types/UpdateChannelBasicInfo");
|
|
10
12
|
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
13
|
+
const ora_1 = require("../ora");
|
|
11
14
|
const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
|
|
12
15
|
const json_1 = require("../utils/json");
|
|
13
16
|
const queries_1 = require("../utils/queries");
|
|
17
|
+
const relay_1 = require("../utils/relay");
|
|
14
18
|
const utils_1 = require("./utils");
|
|
15
19
|
exports.CHANNELS_LIMIT = 25;
|
|
16
20
|
async function selectChannelOnAppAsync(graphqlClient, { projectId, selectionPromptTitle, paginatedQueryOptions, }) {
|
|
@@ -146,11 +150,11 @@ async function createChannelOnAppAsync(graphqlClient, { appId, branchId, channel
|
|
|
146
150
|
updateChannel {
|
|
147
151
|
createUpdateChannelForApp(appId: $appId, name: $name, branchMapping: $branchMapping) {
|
|
148
152
|
id
|
|
149
|
-
|
|
150
|
-
branchMapping
|
|
153
|
+
...UpdateChannelBasicInfoFragment
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
}
|
|
157
|
+
${(0, graphql_1.print)(UpdateChannelBasicInfo_1.UpdateChannelBasicInfoFragmentNode)}
|
|
154
158
|
`, {
|
|
155
159
|
appId,
|
|
156
160
|
name: channelName,
|
|
@@ -177,3 +181,25 @@ async function ensureChannelExistsAsync(graphqlClient, { appId, branchId, channe
|
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
exports.ensureChannelExistsAsync = ensureChannelExistsAsync;
|
|
184
|
+
async function getChannelsDatasetAsync(graphqlClient, { appId, filterPredicate, batchSize = 100, }) {
|
|
185
|
+
const queryAsync = async ({ first, after, }) => await ChannelQuery_1.ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync(graphqlClient, {
|
|
186
|
+
appId,
|
|
187
|
+
first,
|
|
188
|
+
after,
|
|
189
|
+
});
|
|
190
|
+
const assetSpinner = (0, ora_1.ora)().start('Fetching channels...');
|
|
191
|
+
const afterEachQuery = (totalNodesFetched, _dataset, _batch, pageInfo) => {
|
|
192
|
+
if (pageInfo.hasNextPage) {
|
|
193
|
+
assetSpinner.text = `Fetched ${totalNodesFetched} channels`;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const dataset = await (0, relay_1.getPaginatedDatasetAsync)({
|
|
197
|
+
queryAsync,
|
|
198
|
+
afterEachQuery,
|
|
199
|
+
filterPredicate,
|
|
200
|
+
batchSize,
|
|
201
|
+
});
|
|
202
|
+
assetSpinner.succeed(`Fetched all channels`);
|
|
203
|
+
return dataset;
|
|
204
|
+
}
|
|
205
|
+
exports.getChannelsDatasetAsync = getChannelsDatasetAsync;
|
package/build/channel/utils.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
2
|
-
|
|
3
|
-
version: number;
|
|
4
|
-
data: {
|
|
5
|
-
branchId: string;
|
|
6
|
-
branchMappingLogic: {
|
|
7
|
-
operand: number;
|
|
8
|
-
clientKey: string;
|
|
9
|
-
branchMappingOperator: string;
|
|
10
|
-
} & string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
1
|
+
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
2
|
+
import { BranchMapping } from './branch-mapping';
|
|
13
3
|
/**
|
|
14
4
|
* Get the branch mapping and determine whether it is a rollout.
|
|
15
5
|
* Ensure that the branch mapping is properly formatted.
|
|
@@ -20,3 +10,4 @@ export declare function getBranchMapping(branchMappingString?: string): {
|
|
|
20
10
|
rolloutPercent?: number;
|
|
21
11
|
};
|
|
22
12
|
export declare function logChannelDetails(channel: UpdateChannelObject): void;
|
|
13
|
+
export declare function getUpdateBranch(channel: UpdateChannelObject, branchId: string): UpdateBranchObject;
|
package/build/channel/utils.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logChannelDetails = exports.getBranchMapping = void 0;
|
|
3
|
+
exports.getUpdateBranch = exports.logChannelDetails = exports.getBranchMapping = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
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
|
+
const branch_mapping_1 = require("./branch-mapping");
|
|
9
10
|
/**
|
|
10
11
|
* Get the branch mapping and determine whether it is a rollout.
|
|
11
12
|
* Ensure that the branch mapping is properly formatted.
|
|
@@ -27,7 +28,12 @@ function getBranchMapping(branchMappingString) {
|
|
|
27
28
|
throw new Error('Branch mapping must be version 0.');
|
|
28
29
|
}
|
|
29
30
|
const isRollout = branchMapping.data.length === 2;
|
|
30
|
-
const
|
|
31
|
+
const branchMappingNode = (_a = branchMapping.data[0]) === null || _a === void 0 ? void 0 : _a.branchMappingLogic;
|
|
32
|
+
let rolloutPercent;
|
|
33
|
+
if ((0, branch_mapping_1.isNodeObject)(branchMappingNode)) {
|
|
34
|
+
(0, branch_mapping_1.assertNumber)(branchMappingNode.operand);
|
|
35
|
+
rolloutPercent = branchMappingNode.operand;
|
|
36
|
+
}
|
|
31
37
|
switch (branchMapping.data.length) {
|
|
32
38
|
case 0:
|
|
33
39
|
break;
|
|
@@ -37,10 +43,11 @@ function getBranchMapping(branchMappingString) {
|
|
|
37
43
|
}
|
|
38
44
|
break;
|
|
39
45
|
case 2:
|
|
40
|
-
|
|
46
|
+
(0, branch_mapping_1.assertNodeObject)(branchMappingNode);
|
|
47
|
+
if (branchMappingNode.clientKey !== 'rolloutToken') {
|
|
41
48
|
throw new Error('Client key of initial branch mapping must be "rolloutToken"');
|
|
42
49
|
}
|
|
43
|
-
if (
|
|
50
|
+
if (branchMappingNode.branchMappingOperator !== 'hash_lt') {
|
|
44
51
|
throw new Error('Branch mapping operator of initial branch mapping must be "hash_lt"');
|
|
45
52
|
}
|
|
46
53
|
if (rolloutPercent == null) {
|
|
@@ -86,3 +93,16 @@ function logChannelDetails(channel) {
|
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
exports.logChannelDetails = logChannelDetails;
|
|
96
|
+
function getUpdateBranchNullable(channel, branchId) {
|
|
97
|
+
const updateBranches = channel.updateBranches;
|
|
98
|
+
const updateBranch = updateBranches.find(branch => branch.id === branchId);
|
|
99
|
+
return updateBranch !== null && updateBranch !== void 0 ? updateBranch : null;
|
|
100
|
+
}
|
|
101
|
+
function getUpdateBranch(channel, branchId) {
|
|
102
|
+
const updateBranch = getUpdateBranchNullable(channel, branchId);
|
|
103
|
+
if (!updateBranch) {
|
|
104
|
+
throw new Error(`Could not find branch with id "${branchId}" in branch-mapping of channel "${channel.name}"`);
|
|
105
|
+
}
|
|
106
|
+
return updateBranch;
|
|
107
|
+
}
|
|
108
|
+
exports.getUpdateBranch = getUpdateBranch;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnyVariables, Client, OperationContext, OperationResult,
|
|
1
|
+
import { AnyVariables, Client, OperationContext, OperationResult, OperationResultSource, TypedDocumentNode } from '@urql/core';
|
|
2
2
|
import { DocumentNode } from 'graphql';
|
|
3
3
|
export interface ExpoGraphqlClient extends Client {
|
|
4
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
|
+
}): OperationResultSource<OperationResult<Data, Variables>>;
|
|
7
7
|
}
|
|
8
8
|
export declare function createGraphqlClient(authInfo: {
|
|
9
9
|
accessToken: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
2
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
-
import {
|
|
4
|
-
export declare function updateChannelBranchMappingAsync(graphqlClient: ExpoGraphqlClient, { channelId, branchMapping }: UpdateChannelBranchMappingMutationVariables): Promise<
|
|
3
|
+
import { UpdateChannelBasicInfoFragment, UpdateChannelBranchMappingMutationVariables } from '../../graphql/generated';
|
|
4
|
+
export declare function updateChannelBranchMappingAsync(graphqlClient: ExpoGraphqlClient, { channelId, branchMapping }: UpdateChannelBranchMappingMutationVariables): Promise<UpdateChannelBasicInfoFragment>;
|
|
5
5
|
export default class ChannelEdit extends EasCommand {
|
|
6
6
|
static description: string;
|
|
7
7
|
static args: {
|
|
@@ -5,6 +5,7 @@ exports.updateChannelBranchMappingAsync = void 0;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const core_1 = require("@oclif/core");
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const graphql_1 = require("graphql");
|
|
8
9
|
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
9
10
|
const queries_1 = require("../../branch/queries");
|
|
10
11
|
const queries_2 = require("../../channel/queries");
|
|
@@ -13,6 +14,7 @@ const flags_1 = require("../../commandUtils/flags");
|
|
|
13
14
|
const client_1 = require("../../graphql/client");
|
|
14
15
|
const BranchQuery_1 = require("../../graphql/queries/BranchQuery");
|
|
15
16
|
const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
17
|
+
const UpdateChannelBasicInfo_1 = require("../../graphql/types/UpdateChannelBasicInfo");
|
|
16
18
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
17
19
|
const json_1 = require("../../utils/json");
|
|
18
20
|
async function updateChannelBranchMappingAsync(graphqlClient, { channelId, branchMapping }) {
|
|
@@ -22,11 +24,11 @@ async function updateChannelBranchMappingAsync(graphqlClient, { channelId, branc
|
|
|
22
24
|
updateChannel {
|
|
23
25
|
editUpdateChannel(channelId: $channelId, branchMapping: $branchMapping) {
|
|
24
26
|
id
|
|
25
|
-
|
|
26
|
-
branchMapping
|
|
27
|
+
...UpdateChannelBasicInfoFragment
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
${(0, graphql_1.print)(UpdateChannelBasicInfo_1.UpdateChannelBasicInfoFragmentNode)}
|
|
30
32
|
`, { channelId, branchMapping })
|
|
31
33
|
.toPromise());
|
|
32
34
|
const channel = data.updateChannel.editUpdateChannel;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const queries_1 = require("../../branch/queries");
|
|
8
|
+
const branch_mapping_1 = require("../../channel/branch-mapping");
|
|
8
9
|
const queries_2 = require("../../channel/queries");
|
|
9
10
|
const utils_1 = require("../../channel/utils");
|
|
10
11
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
@@ -35,6 +36,7 @@ async function promptForRolloutPercentAsync({ promptMessage, }) {
|
|
|
35
36
|
return rolloutPercent;
|
|
36
37
|
}
|
|
37
38
|
function getRolloutInfo(channel) {
|
|
39
|
+
var _b;
|
|
38
40
|
const { branchMapping } = (0, utils_1.getBranchMapping)(channel.branchMapping);
|
|
39
41
|
const [newBranchId, oldBranchId] = branchMapping.data.map(d => d.branchId);
|
|
40
42
|
const newBranch = channel.updateBranches.filter(branch => branch.id === newBranchId)[0];
|
|
@@ -42,7 +44,10 @@ function getRolloutInfo(channel) {
|
|
|
42
44
|
if (!newBranch || !oldBranch) {
|
|
43
45
|
throw new Error(`Branch mapping rollout is missing a branch for channel "${channel.name}".`);
|
|
44
46
|
}
|
|
45
|
-
const
|
|
47
|
+
const branchMappingNode = (_b = branchMapping.data[0]) === null || _b === void 0 ? void 0 : _b.branchMappingLogic;
|
|
48
|
+
(0, branch_mapping_1.assertNodeObject)(branchMappingNode);
|
|
49
|
+
(0, branch_mapping_1.assertNumber)(branchMappingNode.operand);
|
|
50
|
+
const currentPercent = 100 * branchMappingNode.operand;
|
|
46
51
|
return { newBranch, oldBranch, currentPercent };
|
|
47
52
|
}
|
|
48
53
|
async function startRolloutAsync(graphqlClient, { channelName, branchName, percent, projectId, displayName, currentBranchMapping, channel, nonInteractive, }) {
|
package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.AndroidAppBuildCredentialsMutation = {
|
|
|
37
37
|
async setDefaultAndroidAppBuildCredentialsAsync(graphqlClient, androidAppBuildCredentialsId) {
|
|
38
38
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
39
39
|
.mutation((0, graphql_tag_1.default) `
|
|
40
|
-
mutation
|
|
40
|
+
mutation SetDefaultAndroidAppBuildCredentialsMutation(
|
|
41
41
|
$androidAppBuildCredentialsId: ID!
|
|
42
42
|
$isDefault: Boolean!
|
|
43
43
|
) {
|
|
@@ -55,7 +55,7 @@ exports.AndroidAppBuildCredentialsMutation = {
|
|
|
55
55
|
})
|
|
56
56
|
.toPromise());
|
|
57
57
|
(0, assert_1.default)(data, `GraphQL: 'setDefault' not defined in server response ${JSON.stringify(data)}}`);
|
|
58
|
-
return data;
|
|
58
|
+
return data.androidAppBuildCredentials.setDefault;
|
|
59
59
|
},
|
|
60
60
|
async setKeystoreAsync(graphqlClient, androidAppBuildCredentialsId, keystoreId) {
|
|
61
61
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|