eas-cli 16.30.0 → 16.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -87
- package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +1 -5
- package/build/commandUtils/usageUtils.d.ts +58 -0
- package/build/commandUtils/usageUtils.js +204 -0
- package/build/commands/account/usage.d.ts +16 -0
- package/build/commands/account/usage.js +326 -0
- package/build/commands/submit/upload-to-asc.d.ts +12 -0
- package/build/commands/submit/upload-to-asc.js +217 -0
- package/build/commands/update/index.js +0 -54
- package/build/graphql/generated.d.ts +1063 -39
- package/build/graphql/generated.js +78 -11
- package/build/graphql/queries/AccountQuery.d.ts +15 -0
- package/build/graphql/queries/AccountQuery.js +197 -0
- package/build/graphql/types/Account.d.ts +11 -0
- package/build/graphql/types/Account.js +142 -1
- package/build/submit/ios/AscApiClient.d.ts +247 -0
- package/build/submit/ios/AscApiClient.js +287 -0
- package/build/utils/usage/checkForOverages.js +2 -2
- package/oclif.manifest.json +80 -1
- package/package.json +2 -2
- package/build/graphql/queries/AccountUsageQuery.d.ts +0 -5
- package/build/graphql/queries/AccountUsageQuery.js +0 -40
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const GetApi: {
|
|
3
|
+
'/v1/apps/:id': {
|
|
4
|
+
path: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
request: z.ZodObject<{
|
|
8
|
+
'fields[apps]': z.ZodArray<z.ZodEnum<{
|
|
9
|
+
name: "name";
|
|
10
|
+
bundleId: "bundleId";
|
|
11
|
+
}>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
response: z.ZodObject<{
|
|
14
|
+
data: z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"apps">;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
attributes: z.ZodObject<{
|
|
18
|
+
bundleId: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
};
|
|
24
|
+
'/v1/buildUploadFiles/:id': {
|
|
25
|
+
path: z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
request: z.ZodObject<{
|
|
29
|
+
'fields[buildUploadFiles]': z.ZodArray<z.ZodEnum<{
|
|
30
|
+
assetDeliveryState: "assetDeliveryState";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
response: z.ZodObject<{
|
|
34
|
+
data: z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"buildUploadFiles">;
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
attributes: z.ZodObject<{
|
|
38
|
+
assetDeliveryState: z.ZodObject<{
|
|
39
|
+
state: z.ZodEnum<{
|
|
40
|
+
FAILED: "FAILED";
|
|
41
|
+
AWAITING_UPLOAD: "AWAITING_UPLOAD";
|
|
42
|
+
UPLOAD_COMPLETE: "UPLOAD_COMPLETE";
|
|
43
|
+
COMPLETE: "COMPLETE";
|
|
44
|
+
}>;
|
|
45
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
code: z.ZodString;
|
|
47
|
+
description: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>>;
|
|
49
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
code: z.ZodString;
|
|
51
|
+
description: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
};
|
|
58
|
+
'/v1/buildUploads/:id': {
|
|
59
|
+
path: z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
request: z.ZodObject<{
|
|
63
|
+
'fields[buildUploads]': z.ZodArray<z.ZodEnum<{
|
|
64
|
+
build: "build";
|
|
65
|
+
state: "state";
|
|
66
|
+
}>>;
|
|
67
|
+
include: z.ZodArray<z.ZodEnum<{
|
|
68
|
+
build: "build";
|
|
69
|
+
}>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
response: z.ZodObject<{
|
|
72
|
+
data: z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"buildUploads">;
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
attributes: z.ZodObject<{
|
|
76
|
+
state: z.ZodObject<{
|
|
77
|
+
state: z.ZodEnum<{
|
|
78
|
+
FAILED: "FAILED";
|
|
79
|
+
AWAITING_UPLOAD: "AWAITING_UPLOAD";
|
|
80
|
+
COMPLETE: "COMPLETE";
|
|
81
|
+
PROCESSING: "PROCESSING";
|
|
82
|
+
}>;
|
|
83
|
+
infos: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
code: z.ZodString;
|
|
85
|
+
description: z.ZodString;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
+
code: z.ZodString;
|
|
89
|
+
description: z.ZodString;
|
|
90
|
+
}, z.core.$strip>>>;
|
|
91
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
+
code: z.ZodString;
|
|
93
|
+
description: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
declare const PostApi: {
|
|
102
|
+
'/v1/buildUploads': {
|
|
103
|
+
request: z.ZodObject<{
|
|
104
|
+
data: z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"buildUploads">;
|
|
106
|
+
attributes: z.ZodObject<{
|
|
107
|
+
cfBundleShortVersionString: z.ZodString;
|
|
108
|
+
cfBundleVersion: z.ZodString;
|
|
109
|
+
platform: z.ZodEnum<{
|
|
110
|
+
IOS: "IOS";
|
|
111
|
+
MAC_OS: "MAC_OS";
|
|
112
|
+
TV_OS: "TV_OS";
|
|
113
|
+
VISION_OS: "VISION_OS";
|
|
114
|
+
}>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
relationships: z.ZodObject<{
|
|
117
|
+
app: z.ZodObject<{
|
|
118
|
+
data: z.ZodObject<{
|
|
119
|
+
type: z.ZodLiteral<"apps">;
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
response: z.ZodObject<{
|
|
127
|
+
data: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
type: z.ZodLiteral<"buildUploads">;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
};
|
|
133
|
+
'/v1/buildUploadFiles': {
|
|
134
|
+
request: z.ZodObject<{
|
|
135
|
+
data: z.ZodObject<{
|
|
136
|
+
type: z.ZodLiteral<"buildUploadFiles">;
|
|
137
|
+
attributes: z.ZodObject<{
|
|
138
|
+
assetType: z.ZodEnum<{
|
|
139
|
+
ASSET: "ASSET";
|
|
140
|
+
ASSET_DESCRIPTION: "ASSET_DESCRIPTION";
|
|
141
|
+
ASSET_SPI: "ASSET_SPI";
|
|
142
|
+
}>;
|
|
143
|
+
fileName: z.ZodString;
|
|
144
|
+
fileSize: z.ZodNumber;
|
|
145
|
+
uti: z.ZodEnum<{
|
|
146
|
+
"com.apple.binary-property-list": "com.apple.binary-property-list";
|
|
147
|
+
"com.apple.ipa": "com.apple.ipa";
|
|
148
|
+
"com.apple.pkg": "com.apple.pkg";
|
|
149
|
+
"com.apple.xml-property-list": "com.apple.xml-property-list";
|
|
150
|
+
"com.pkware.zip-archive": "com.pkware.zip-archive";
|
|
151
|
+
}>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
relationships: z.ZodObject<{
|
|
154
|
+
buildUpload: z.ZodObject<{
|
|
155
|
+
data: z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"buildUploads">;
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
response: z.ZodObject<{
|
|
164
|
+
data: z.ZodObject<{
|
|
165
|
+
type: z.ZodLiteral<"buildUploadFiles">;
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
attributes: z.ZodObject<{
|
|
168
|
+
uploadOperations: z.ZodArray<z.ZodObject<{
|
|
169
|
+
length: z.ZodNumber;
|
|
170
|
+
method: z.ZodString;
|
|
171
|
+
offset: z.ZodNumber;
|
|
172
|
+
partNumber: z.ZodNumber;
|
|
173
|
+
requestHeaders: z.ZodArray<z.ZodObject<{
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
value: z.ZodString;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
url: z.ZodString;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
declare const PatchApi: {
|
|
185
|
+
'/v1/buildUploadFiles/:id': {
|
|
186
|
+
path: z.ZodObject<{
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
request: z.ZodObject<{
|
|
190
|
+
data: z.ZodObject<{
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
type: z.ZodLiteral<"buildUploadFiles">;
|
|
193
|
+
attributes: z.ZodObject<{
|
|
194
|
+
uploaded: z.ZodBoolean;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
response: z.ZodObject<{
|
|
199
|
+
data: z.ZodObject<{
|
|
200
|
+
type: z.ZodLiteral<"buildUploadFiles">;
|
|
201
|
+
id: z.ZodString;
|
|
202
|
+
attributes: z.ZodObject<{
|
|
203
|
+
assetDeliveryState: z.ZodObject<{
|
|
204
|
+
state: z.ZodEnum<{
|
|
205
|
+
FAILED: "FAILED";
|
|
206
|
+
AWAITING_UPLOAD: "AWAITING_UPLOAD";
|
|
207
|
+
UPLOAD_COMPLETE: "UPLOAD_COMPLETE";
|
|
208
|
+
COMPLETE: "COMPLETE";
|
|
209
|
+
}>;
|
|
210
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
code: z.ZodString;
|
|
212
|
+
description: z.ZodString;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
214
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
215
|
+
code: z.ZodString;
|
|
216
|
+
description: z.ZodString;
|
|
217
|
+
}, z.core.$strip>>>;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
export type AscApiClientPostApi = {
|
|
225
|
+
[Path in keyof typeof PostApi]: {
|
|
226
|
+
request: z.input<(typeof PostApi)[Path]['request']>;
|
|
227
|
+
response: z.output<(typeof PostApi)[Path]['response']>;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
export type AscApiClientPatchApi = {
|
|
231
|
+
[Path in keyof typeof PatchApi]: {
|
|
232
|
+
request: z.input<(typeof PatchApi)[Path]['request']>;
|
|
233
|
+
response: z.output<(typeof PatchApi)[Path]['response']>;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
export declare class AscApiClient {
|
|
237
|
+
private readonly baseUrl;
|
|
238
|
+
private readonly token;
|
|
239
|
+
constructor({ token }: {
|
|
240
|
+
token: string;
|
|
241
|
+
});
|
|
242
|
+
getAsync<TPath extends keyof typeof GetApi>(path: TPath, body: z.input<(typeof GetApi)[TPath]['request']>, params?: z.input<(typeof GetApi)[TPath]['path']>): Promise<z.output<(typeof GetApi)[TPath]['response']>>;
|
|
243
|
+
postAsync<TPath extends keyof typeof PostApi>(path: TPath, body: z.input<(typeof PostApi)[TPath]['request']>): Promise<z.output<(typeof PostApi)[TPath]['response']>>;
|
|
244
|
+
patchAsync<TPath extends keyof typeof PatchApi>(path: TPath, body: z.input<(typeof PatchApi)[TPath]['request']>, params: z.input<(typeof PatchApi)[TPath]['path']>): Promise<z.output<(typeof PatchApi)[TPath]['response']>>;
|
|
245
|
+
private sendRequestAsync;
|
|
246
|
+
}
|
|
247
|
+
export {};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AscApiClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const results_1 = require("@expo/results");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
9
|
+
const GetApi = {
|
|
10
|
+
'/v1/apps/:id': {
|
|
11
|
+
path: zod_1.z.object({
|
|
12
|
+
id: zod_1.z.string(),
|
|
13
|
+
}),
|
|
14
|
+
request: zod_1.z.object({
|
|
15
|
+
'fields[apps]': zod_1.z.array(zod_1.z.enum(['bundleId', 'name'])).refine(opts => {
|
|
16
|
+
// Let's say we currently require fetching these two and nothing else.
|
|
17
|
+
return opts.includes('bundleId') && opts.includes('name');
|
|
18
|
+
}),
|
|
19
|
+
}),
|
|
20
|
+
response: zod_1.z.object({
|
|
21
|
+
data: zod_1.z.object({
|
|
22
|
+
type: zod_1.z.literal('apps'),
|
|
23
|
+
id: zod_1.z.string(),
|
|
24
|
+
attributes: zod_1.z.object({
|
|
25
|
+
bundleId: zod_1.z.string(),
|
|
26
|
+
name: zod_1.z.string(),
|
|
27
|
+
}),
|
|
28
|
+
}),
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
'/v1/buildUploadFiles/:id': {
|
|
32
|
+
path: zod_1.z.object({
|
|
33
|
+
id: zod_1.z.string(),
|
|
34
|
+
}),
|
|
35
|
+
request: zod_1.z.object({
|
|
36
|
+
'fields[buildUploadFiles]': zod_1.z.array(zod_1.z.enum(['assetDeliveryState'])).refine(opts => {
|
|
37
|
+
return opts.includes('assetDeliveryState');
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
response: zod_1.z.object({
|
|
41
|
+
data: zod_1.z.object({
|
|
42
|
+
type: zod_1.z.literal('buildUploadFiles'),
|
|
43
|
+
id: zod_1.z.string(),
|
|
44
|
+
attributes: zod_1.z.object({
|
|
45
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/appmediaassetstate
|
|
46
|
+
assetDeliveryState: zod_1.z.object({
|
|
47
|
+
state: zod_1.z.enum(['AWAITING_UPLOAD', 'UPLOAD_COMPLETE', 'COMPLETE', 'FAILED']),
|
|
48
|
+
errors: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
49
|
+
warnings: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
50
|
+
}),
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
'/v1/buildUploads/:id': {
|
|
56
|
+
path: zod_1.z.object({
|
|
57
|
+
id: zod_1.z.string(),
|
|
58
|
+
}),
|
|
59
|
+
request: zod_1.z.object({
|
|
60
|
+
'fields[buildUploads]': zod_1.z.array(zod_1.z.enum(['build', 'state'])).refine(opts => {
|
|
61
|
+
return opts.includes('build') && opts.includes('state');
|
|
62
|
+
}),
|
|
63
|
+
include: zod_1.z.array(zod_1.z.enum(['build'])).refine(opts => {
|
|
64
|
+
return opts.includes('build');
|
|
65
|
+
}),
|
|
66
|
+
}),
|
|
67
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadresponse
|
|
68
|
+
response: zod_1.z.object({
|
|
69
|
+
data: zod_1.z.object({
|
|
70
|
+
type: zod_1.z.literal('buildUploads'),
|
|
71
|
+
id: zod_1.z.string(),
|
|
72
|
+
attributes: zod_1.z.object({
|
|
73
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/buildupload/attributes-data.dictionary/state-data.dictionary
|
|
74
|
+
state: zod_1.z.object({
|
|
75
|
+
state: zod_1.z.enum(['AWAITING_UPLOAD', 'PROCESSING', 'COMPLETE', 'FAILED']),
|
|
76
|
+
infos: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
77
|
+
errors: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
78
|
+
warnings: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
79
|
+
}),
|
|
80
|
+
}),
|
|
81
|
+
}),
|
|
82
|
+
}),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const PostApi = {
|
|
86
|
+
'/v1/buildUploads': {
|
|
87
|
+
request: zod_1.z.object({
|
|
88
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadcreaterequest/data-data.dictionary
|
|
89
|
+
data: zod_1.z.object({
|
|
90
|
+
type: zod_1.z.literal('buildUploads'),
|
|
91
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadcreaterequest/data-data.dictionary/attributes-data.dictionary
|
|
92
|
+
attributes: zod_1.z.object({
|
|
93
|
+
cfBundleShortVersionString: zod_1.z.string(),
|
|
94
|
+
cfBundleVersion: zod_1.z.string(),
|
|
95
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/platform
|
|
96
|
+
platform: zod_1.z.enum(['IOS', 'MAC_OS', 'TV_OS', 'VISION_OS']),
|
|
97
|
+
}),
|
|
98
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadcreaterequest/data-data.dictionary/relationships-data.dictionary
|
|
99
|
+
relationships: zod_1.z.object({
|
|
100
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadcreaterequest/data-data.dictionary/relationships-data.dictionary/app-data.dictionary
|
|
101
|
+
app: zod_1.z.object({
|
|
102
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadcreaterequest/data-data.dictionary/relationships-data.dictionary/app-data.dictionary/data-data.dictionary
|
|
103
|
+
data: zod_1.z.object({
|
|
104
|
+
type: zod_1.z.literal('apps'),
|
|
105
|
+
id: zod_1.z.string(),
|
|
106
|
+
}),
|
|
107
|
+
}),
|
|
108
|
+
}),
|
|
109
|
+
}),
|
|
110
|
+
}),
|
|
111
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadresponse
|
|
112
|
+
response: zod_1.z.object({
|
|
113
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/buildupload
|
|
114
|
+
data: zod_1.z.object({
|
|
115
|
+
id: zod_1.z.string(),
|
|
116
|
+
type: zod_1.z.literal('buildUploads'),
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
},
|
|
120
|
+
'/v1/buildUploadFiles': {
|
|
121
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest
|
|
122
|
+
request: zod_1.z.object({
|
|
123
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest/data-data.dictionary
|
|
124
|
+
data: zod_1.z.object({
|
|
125
|
+
type: zod_1.z.literal('buildUploadFiles'),
|
|
126
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest/data-data.dictionary/attributes-data.dictionary
|
|
127
|
+
attributes: zod_1.z.object({
|
|
128
|
+
assetType: zod_1.z.enum(['ASSET', 'ASSET_DESCRIPTION', 'ASSET_SPI']),
|
|
129
|
+
fileName: zod_1.z.string(),
|
|
130
|
+
fileSize: zod_1.z.number().min(1).max(9007199254740991),
|
|
131
|
+
uti: zod_1.z.enum([
|
|
132
|
+
'com.apple.binary-property-list',
|
|
133
|
+
'com.apple.ipa',
|
|
134
|
+
'com.apple.pkg',
|
|
135
|
+
'com.apple.xml-property-list',
|
|
136
|
+
'com.pkware.zip-archive',
|
|
137
|
+
]),
|
|
138
|
+
}),
|
|
139
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest/data-data.dictionary/relationships-data.dictionary
|
|
140
|
+
relationships: zod_1.z.object({
|
|
141
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest/data-data.dictionary/relationships-data.dictionary/buildupload-data.dictionary
|
|
142
|
+
buildUpload: zod_1.z.object({
|
|
143
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfilecreaterequest/data-data.dictionary/relationships-data.dictionary/buildupload-data.dictionary/data-data.dictionary
|
|
144
|
+
data: zod_1.z.object({
|
|
145
|
+
type: zod_1.z.literal('buildUploads'),
|
|
146
|
+
id: zod_1.z.string(),
|
|
147
|
+
}),
|
|
148
|
+
}),
|
|
149
|
+
}),
|
|
150
|
+
}),
|
|
151
|
+
}),
|
|
152
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfileresponse
|
|
153
|
+
response: zod_1.z.object({
|
|
154
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfile
|
|
155
|
+
data: zod_1.z.object({
|
|
156
|
+
type: zod_1.z.literal('buildUploadFiles'),
|
|
157
|
+
id: zod_1.z.string(),
|
|
158
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfile/attributes-data.dictionary
|
|
159
|
+
attributes: zod_1.z.object({
|
|
160
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/appmediaassetstate
|
|
161
|
+
uploadOperations: zod_1.z.array(
|
|
162
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/deliveryfileuploadoperation
|
|
163
|
+
zod_1.z.object({
|
|
164
|
+
length: zod_1.z.number().min(1).max(9007199254740991),
|
|
165
|
+
method: zod_1.z.string(),
|
|
166
|
+
offset: zod_1.z.number().min(0).max(9007199254740991),
|
|
167
|
+
partNumber: zod_1.z.number().min(1).max(9007199254740991),
|
|
168
|
+
requestHeaders: zod_1.z.array(zod_1.z.object({
|
|
169
|
+
name: zod_1.z.string(),
|
|
170
|
+
value: zod_1.z.string(),
|
|
171
|
+
})),
|
|
172
|
+
url: zod_1.z.string(),
|
|
173
|
+
})),
|
|
174
|
+
}),
|
|
175
|
+
}),
|
|
176
|
+
}),
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
const PatchApi = {
|
|
180
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/patch-v1-builduploadfiles-_id_
|
|
181
|
+
'/v1/buildUploadFiles/:id': {
|
|
182
|
+
path: zod_1.z.object({
|
|
183
|
+
id: zod_1.z.string(),
|
|
184
|
+
}),
|
|
185
|
+
request: zod_1.z.object({
|
|
186
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfileupdaterequest/data-data.dictionary
|
|
187
|
+
data: zod_1.z.object({
|
|
188
|
+
id: zod_1.z.string(),
|
|
189
|
+
type: zod_1.z.literal('buildUploadFiles'),
|
|
190
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfileupdaterequest/data-data.dictionary/attributes-data.dictionary
|
|
191
|
+
attributes: zod_1.z.object({
|
|
192
|
+
uploaded: zod_1.z.boolean(),
|
|
193
|
+
}),
|
|
194
|
+
}),
|
|
195
|
+
}),
|
|
196
|
+
response: zod_1.z.object({
|
|
197
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfile
|
|
198
|
+
data: zod_1.z.object({
|
|
199
|
+
type: zod_1.z.literal('buildUploadFiles'),
|
|
200
|
+
id: zod_1.z.string(),
|
|
201
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/builduploadfile/attributes-data.dictionary
|
|
202
|
+
attributes: zod_1.z.object({
|
|
203
|
+
// https://developer.apple.com/documentation/appstoreconnectapi/appmediaassetstate
|
|
204
|
+
assetDeliveryState: zod_1.z.object({
|
|
205
|
+
state: zod_1.z.enum(['AWAITING_UPLOAD', 'UPLOAD_COMPLETE', 'COMPLETE', 'FAILED']),
|
|
206
|
+
errors: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
207
|
+
warnings: zod_1.z.array(zod_1.z.object({ code: zod_1.z.string(), description: zod_1.z.string() })).optional(),
|
|
208
|
+
}),
|
|
209
|
+
}),
|
|
210
|
+
}),
|
|
211
|
+
}),
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
class AscApiClient {
|
|
215
|
+
baseUrl = 'https://api.appstoreconnect.apple.com';
|
|
216
|
+
token;
|
|
217
|
+
constructor({ token }) {
|
|
218
|
+
this.token = token;
|
|
219
|
+
}
|
|
220
|
+
async getAsync(path, body, params) {
|
|
221
|
+
const schema = GetApi[path];
|
|
222
|
+
let effectivePath = path;
|
|
223
|
+
for (const [key, value] of Object.entries(params ?? {})) {
|
|
224
|
+
effectivePath = effectivePath.replace(`:${key}`, String(value));
|
|
225
|
+
}
|
|
226
|
+
return await this.sendRequestAsync({
|
|
227
|
+
method: 'GET',
|
|
228
|
+
path: `${effectivePath}?${new URLSearchParams(body).toString()}`,
|
|
229
|
+
body,
|
|
230
|
+
requestSchema: schema.request,
|
|
231
|
+
responseSchema: schema.response,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
async postAsync(path, body) {
|
|
235
|
+
const schema = PostApi[path];
|
|
236
|
+
return await this.sendRequestAsync({
|
|
237
|
+
method: 'POST',
|
|
238
|
+
path,
|
|
239
|
+
body,
|
|
240
|
+
requestSchema: schema.request,
|
|
241
|
+
responseSchema: schema.response,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async patchAsync(path, body, params) {
|
|
245
|
+
const schema = PatchApi[path];
|
|
246
|
+
let effectivePath = path;
|
|
247
|
+
for (const [key, value] of Object.entries(params)) {
|
|
248
|
+
effectivePath = effectivePath.replace(`:${key}`, String(value));
|
|
249
|
+
}
|
|
250
|
+
return await this.sendRequestAsync({
|
|
251
|
+
method: 'PATCH',
|
|
252
|
+
path: effectivePath,
|
|
253
|
+
body,
|
|
254
|
+
requestSchema: schema.request,
|
|
255
|
+
responseSchema: schema.response,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
async sendRequestAsync({ path, method, body, requestSchema, responseSchema, }) {
|
|
259
|
+
const url = new URL(path, this.baseUrl).toString();
|
|
260
|
+
const parsedBody = await (0, results_1.asyncResult)((async () => requestSchema.parse(body))());
|
|
261
|
+
if (!parsedBody.ok) {
|
|
262
|
+
throw new Error(`Malformed request to App Store Connect: ${zod_1.z.prettifyError(parsedBody.enforceError())}`);
|
|
263
|
+
}
|
|
264
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
265
|
+
method,
|
|
266
|
+
headers: {
|
|
267
|
+
'Content-Type': 'application/json',
|
|
268
|
+
Authorization: `Bearer ${this.token}`,
|
|
269
|
+
},
|
|
270
|
+
body: method === 'GET' ? undefined : JSON.stringify(parsedBody.value),
|
|
271
|
+
});
|
|
272
|
+
if (!response.ok) {
|
|
273
|
+
const text = await response.text();
|
|
274
|
+
throw new Error(`Unexpected response (${response.status}) from App Store Connect: ${text}`, {
|
|
275
|
+
cause: response,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
const json = await response.json();
|
|
279
|
+
log_1.default.debug(`Response from App Store Connect: ${JSON.stringify(json, null, 2)}`);
|
|
280
|
+
const parsedResponse = await (0, results_1.asyncResult)((async () => responseSchema.parse(json))());
|
|
281
|
+
if (!parsedResponse.ok) {
|
|
282
|
+
throw new Error(`Malformed response from App Store Connect: ${zod_1.z.prettifyError(parsedResponse.enforceError())}`);
|
|
283
|
+
}
|
|
284
|
+
return parsedResponse.value;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.AscApiClient = AscApiClient;
|
|
@@ -6,13 +6,13 @@ exports.createProgressBar = createProgressBar;
|
|
|
6
6
|
exports.displayOverageWarning = displayOverageWarning;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
-
const
|
|
9
|
+
const AccountQuery_1 = require("../../graphql/queries/AccountQuery");
|
|
10
10
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
11
11
|
const THRESHOLD_PERCENT = 85;
|
|
12
12
|
async function maybeWarnAboutUsageOveragesAsync({ graphqlClient, accountId, }) {
|
|
13
13
|
try {
|
|
14
14
|
const currentDate = new Date();
|
|
15
|
-
const { name, subscription, usageMetrics: { EAS_BUILD }, } = await
|
|
15
|
+
const { name, subscription, usageMetrics: { EAS_BUILD }, } = await AccountQuery_1.AccountQuery.getUsageForOverageWarningAsync(graphqlClient, accountId, currentDate);
|
|
16
16
|
const planMetric = EAS_BUILD?.planMetrics?.[0];
|
|
17
17
|
if (!planMetric || !subscription) {
|
|
18
18
|
return;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "16.
|
|
2
|
+
"version": "16.32.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"analytics": {
|
|
5
5
|
"id": "analytics",
|
|
@@ -322,6 +322,38 @@
|
|
|
322
322
|
"sessionManager": {}
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
|
+
"account:usage": {
|
|
326
|
+
"id": "account:usage",
|
|
327
|
+
"description": "view account usage and billing for the current cycle",
|
|
328
|
+
"strict": true,
|
|
329
|
+
"pluginName": "eas-cli",
|
|
330
|
+
"pluginAlias": "eas-cli",
|
|
331
|
+
"pluginType": "core",
|
|
332
|
+
"aliases": [],
|
|
333
|
+
"flags": {
|
|
334
|
+
"json": {
|
|
335
|
+
"name": "json",
|
|
336
|
+
"type": "boolean",
|
|
337
|
+
"description": "Enable JSON output, non-JSON messages will be printed to stderr.",
|
|
338
|
+
"allowNo": false
|
|
339
|
+
},
|
|
340
|
+
"non-interactive": {
|
|
341
|
+
"name": "non-interactive",
|
|
342
|
+
"type": "boolean",
|
|
343
|
+
"description": "Run the command in non-interactive mode.",
|
|
344
|
+
"allowNo": false
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"args": {
|
|
348
|
+
"ACCOUNT_NAME": {
|
|
349
|
+
"name": "ACCOUNT_NAME",
|
|
350
|
+
"description": "Account name to view usage for. If not provided, the account will be selected interactively (or defaults to the only account if there is just one)"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"contextDefinition": {
|
|
354
|
+
"loggedIn": {}
|
|
355
|
+
}
|
|
356
|
+
},
|
|
325
357
|
"account:view": {
|
|
326
358
|
"id": "account:view",
|
|
327
359
|
"description": "show the username you are logged in as",
|
|
@@ -3255,6 +3287,53 @@
|
|
|
3255
3287
|
"vcsClient": {}
|
|
3256
3288
|
}
|
|
3257
3289
|
},
|
|
3290
|
+
"submit:upload-to-asc": {
|
|
3291
|
+
"id": "submit:upload-to-asc",
|
|
3292
|
+
"strict": true,
|
|
3293
|
+
"pluginName": "eas-cli",
|
|
3294
|
+
"pluginAlias": "eas-cli",
|
|
3295
|
+
"pluginType": "core",
|
|
3296
|
+
"hidden": true,
|
|
3297
|
+
"aliases": [],
|
|
3298
|
+
"flags": {
|
|
3299
|
+
"path": {
|
|
3300
|
+
"name": "path",
|
|
3301
|
+
"type": "option",
|
|
3302
|
+
"description": "Path to the IPA file",
|
|
3303
|
+
"required": true,
|
|
3304
|
+
"multiple": false
|
|
3305
|
+
},
|
|
3306
|
+
"key": {
|
|
3307
|
+
"name": "key",
|
|
3308
|
+
"type": "option",
|
|
3309
|
+
"description": "Path to the ASC API Key JSON file",
|
|
3310
|
+
"required": true,
|
|
3311
|
+
"multiple": false
|
|
3312
|
+
},
|
|
3313
|
+
"app-id": {
|
|
3314
|
+
"name": "app-id",
|
|
3315
|
+
"type": "option",
|
|
3316
|
+
"description": "App Store Connect App ID (e.g. 1491144534)",
|
|
3317
|
+
"required": true,
|
|
3318
|
+
"multiple": false
|
|
3319
|
+
},
|
|
3320
|
+
"bundle-version": {
|
|
3321
|
+
"name": "bundle-version",
|
|
3322
|
+
"type": "option",
|
|
3323
|
+
"description": "CFBundleVersion (Build Version, e.g. 13)",
|
|
3324
|
+
"required": true,
|
|
3325
|
+
"multiple": false
|
|
3326
|
+
},
|
|
3327
|
+
"bundle-short-version": {
|
|
3328
|
+
"name": "bundle-short-version",
|
|
3329
|
+
"type": "option",
|
|
3330
|
+
"description": "CFBundleShortVersionString (Marketing Version, e.g. 1.0.0)",
|
|
3331
|
+
"required": true,
|
|
3332
|
+
"multiple": false
|
|
3333
|
+
}
|
|
3334
|
+
},
|
|
3335
|
+
"args": {}
|
|
3336
|
+
},
|
|
3258
3337
|
"update:configure": {
|
|
3259
3338
|
"id": "update:configure",
|
|
3260
3339
|
"description": "configure the project to support EAS Update",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eas-cli",
|
|
3
3
|
"description": "EAS command line tool",
|
|
4
|
-
"version": "16.
|
|
4
|
+
"version": "16.32.0",
|
|
5
5
|
"author": "Expo <support@expo.dev>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eas": "./bin/run"
|
|
@@ -245,5 +245,5 @@
|
|
|
245
245
|
"clean": "rimraf dist build tmp node_modules yarn-error.log",
|
|
246
246
|
"copy-new-templates": "rimraf build/commandUtils/new/templates && mkdir -p build/commandUtils/new && cp -r src/commandUtils/new/templates build/commandUtils/new"
|
|
247
247
|
},
|
|
248
|
-
"gitHead": "
|
|
248
|
+
"gitHead": "079aa5dc666f1888b7867c64ef63f8df27c391a7"
|
|
249
249
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import { AccountUsageForOverageWarningQuery } from '../generated';
|
|
3
|
-
export declare const AccountUsageQuery: {
|
|
4
|
-
getUsageForOverageWarningAsync(graphqlClient: ExpoGraphqlClient, accountId: string, currentDate: Date): Promise<AccountUsageForOverageWarningQuery["account"]["byId"]>;
|
|
5
|
-
};
|