eas-cli 21.2.0 → 21.4.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 +343 -148
- package/build/build/build.js +102 -17
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +31 -16
- package/build/commands/observe/events.js +10 -6
- package/build/commands/observe/metrics-summary.js +2 -1
- package/build/commands/observe/metrics.js +3 -2
- package/build/commands/observe/routes.js +3 -2
- package/build/commands/observe/session.js +8 -2
- package/build/commands/project/icon/set.d.ts +15 -0
- package/build/commands/project/icon/set.js +93 -0
- package/build/commands/project/init.d.ts +3 -0
- package/build/commands/project/init.js +34 -7
- package/build/commands/simulator/events.d.ts +16 -0
- package/build/commands/simulator/events.js +136 -0
- package/build/commands/simulator/get.js +2 -0
- package/build/commands/simulator/list.js +2 -0
- package/build/commands/simulator/start.d.ts +1 -0
- package/build/commands/simulator/start.js +8 -0
- package/build/commands/testflight/crashes.d.ts +23 -0
- package/build/commands/testflight/crashes.js +82 -0
- package/build/commands/testflight/feedback.d.ts +23 -0
- package/build/commands/testflight/feedback.js +82 -0
- package/build/graphql/generated.d.ts +370 -254
- package/build/graphql/generated.js +18 -23
- package/build/graphql/mutations/UploadSessionMutation.d.ts +5 -1
- package/build/graphql/mutations/UploadSessionMutation.js +15 -0
- package/build/graphql/queries/AppQuery.d.ts +1 -0
- package/build/graphql/queries/AppQuery.js +19 -0
- package/build/graphql/queries/DeviceRunSessionQuery.d.ts +2 -1
- package/build/graphql/queries/DeviceRunSessionQuery.js +22 -0
- package/build/observe/fetchEvents.js +7 -1
- package/build/observe/fetchMetrics.js +6 -0
- package/build/observe/fetchNavigationRoutes.js +6 -0
- package/build/observe/fetchSessions.d.ts +7 -0
- package/build/observe/fetchSessions.js +16 -0
- package/build/observe/planGating.d.ts +15 -0
- package/build/observe/planGating.js +48 -0
- package/build/project/accountSelection.d.ts +4 -0
- package/build/project/accountSelection.js +56 -0
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -3
- package/build/project/projectInitialization.d.ts +13 -3
- package/build/project/projectInitialization.js +52 -80
- package/build/simulator/events.d.ts +7 -0
- package/build/simulator/events.js +95 -0
- package/build/simulator/utils.js +1 -1
- package/build/testflight/app.d.ts +18 -0
- package/build/testflight/app.js +124 -0
- package/build/testflight/fetch.d.ts +56 -0
- package/build/testflight/fetch.js +116 -0
- package/build/testflight/format.d.ts +4 -0
- package/build/testflight/format.js +104 -0
- package/build/testflight/queries.d.ts +16 -0
- package/build/testflight/queries.js +123 -0
- package/build/testflight/target.d.ts +15 -0
- package/build/testflight/target.js +32 -0
- package/build/uploads.d.ts +7 -1
- package/build/uploads.js +9 -0
- package/build/user/User.d.ts +6 -0
- package/build/user/User.js +18 -0
- package/oclif.manifest.json +2185 -1728
- package/package.json +8 -5
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatTestFlightFeedback = formatTestFlightFeedback;
|
|
4
|
+
exports.formatTestFlightCrash = formatTestFlightCrash;
|
|
5
|
+
exports.formatTestFlightCrashDetails = formatTestFlightCrashDetails;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
|
|
9
|
+
const date_1 = require("../utils/date");
|
|
10
|
+
function formatCreatedDate(createdDate) {
|
|
11
|
+
const date = new Date(createdDate);
|
|
12
|
+
if (isNaN(date.getTime())) {
|
|
13
|
+
return createdDate;
|
|
14
|
+
}
|
|
15
|
+
return `${date.toLocaleString()} (${(0, date_1.fromNow)(date)} ago)`;
|
|
16
|
+
}
|
|
17
|
+
function formatDevice(submission) {
|
|
18
|
+
return [submission.deviceModel, `iOS ${submission.osVersion}`].join(', ');
|
|
19
|
+
}
|
|
20
|
+
function formatTester(submission) {
|
|
21
|
+
if (submission.testerName && submission.testerEmail) {
|
|
22
|
+
return `${submission.testerName} <${submission.testerEmail}>`;
|
|
23
|
+
}
|
|
24
|
+
return submission.testerName ?? submission.testerEmail ?? null;
|
|
25
|
+
}
|
|
26
|
+
function formatBytes(bytes) {
|
|
27
|
+
const gigabytes = bytes / 1024 ** 3;
|
|
28
|
+
if (gigabytes >= 1) {
|
|
29
|
+
return `${gigabytes.toFixed(1)} GB`;
|
|
30
|
+
}
|
|
31
|
+
return `${(bytes / 1024 ** 2).toFixed(0)} MB`;
|
|
32
|
+
}
|
|
33
|
+
function formatDeviceState(submission) {
|
|
34
|
+
const parts = [];
|
|
35
|
+
if (submission.batteryPercentage !== null) {
|
|
36
|
+
parts.push(`battery ${submission.batteryPercentage}%`);
|
|
37
|
+
}
|
|
38
|
+
if (submission.diskBytesAvailable !== null && submission.diskBytesTotal !== null) {
|
|
39
|
+
parts.push(`disk ${formatBytes(submission.diskBytesAvailable)} free of ${formatBytes(submission.diskBytesTotal)}`);
|
|
40
|
+
}
|
|
41
|
+
if (submission.connectionType) {
|
|
42
|
+
parts.push(submission.connectionType.toLowerCase().replace('_', ' '));
|
|
43
|
+
}
|
|
44
|
+
return parts.length > 0 ? parts.join(', ') : null;
|
|
45
|
+
}
|
|
46
|
+
/** Indent every line of a possibly multi-line value so it lines up under its label. */
|
|
47
|
+
function indentValue(value, indent) {
|
|
48
|
+
return value.split('\n').join(`\n${' '.repeat(indent)}`);
|
|
49
|
+
}
|
|
50
|
+
function commonFields(submission) {
|
|
51
|
+
const tester = formatTester(submission);
|
|
52
|
+
const deviceState = formatDeviceState(submission);
|
|
53
|
+
return [
|
|
54
|
+
{ label: 'Submitted', value: formatCreatedDate(submission.createdDate) },
|
|
55
|
+
...(submission.buildVersion ? [{ label: 'Build', value: submission.buildVersion }] : []),
|
|
56
|
+
{ label: 'Device', value: formatDevice(submission) },
|
|
57
|
+
...(tester ? [{ label: 'Tester', value: tester }] : []),
|
|
58
|
+
...(submission.locale ? [{ label: 'Locale', value: submission.locale }] : []),
|
|
59
|
+
...(deviceState ? [{ label: 'State', value: deviceState }] : []),
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function formatBlock(heading, fields) {
|
|
63
|
+
// `formatFields` pads labels to the widest one, so multi-line values must be indented by that
|
|
64
|
+
// width plus the two spaces it puts between label and value.
|
|
65
|
+
const labelWidth = Math.max(...fields.map(field => field.label.length)) + 2;
|
|
66
|
+
return [
|
|
67
|
+
chalk_1.default.bold(heading),
|
|
68
|
+
(0, formatFields_1.default)(fields.map(field => ({ ...field, value: indentValue(field.value, labelWidth) }))),
|
|
69
|
+
].join('\n');
|
|
70
|
+
}
|
|
71
|
+
/** Prefix list entries with their absolute position, so `--offset` numbering stays meaningful. */
|
|
72
|
+
function heading(kind, id, position) {
|
|
73
|
+
return position === undefined ? `${kind} ${id}` : `${position}. ${kind} ${id}`;
|
|
74
|
+
}
|
|
75
|
+
function formatTestFlightFeedback(feedback, position) {
|
|
76
|
+
const screenshots = feedback.screenshots.map(screenshot => `${screenshot.url} (${screenshot.width}x${screenshot.height})`);
|
|
77
|
+
return formatBlock(heading('Feedback', feedback.id, position), [
|
|
78
|
+
...commonFields(feedback),
|
|
79
|
+
{ label: 'Comment', value: feedback.comment ?? chalk_1.default.dim('(no comment)') },
|
|
80
|
+
...(screenshots.length > 0 ? [{ label: 'Screenshots', value: screenshots.join('\n') }] : []),
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
function formatTestFlightCrash(crash, position) {
|
|
84
|
+
return formatBlock(heading('Crash', crash.id, position), [
|
|
85
|
+
...commonFields(crash),
|
|
86
|
+
...(crash.comment ? [{ label: 'Comment', value: crash.comment }] : []),
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
function formatTestFlightCrashDetails(crash, logText) {
|
|
90
|
+
const details = formatBlock(heading('Crash', crash.id), [
|
|
91
|
+
...commonFields(crash),
|
|
92
|
+
...(crash.architecture ? [{ label: 'Arch', value: crash.architecture }] : []),
|
|
93
|
+
...(crash.appUptimeInMilliseconds !== null
|
|
94
|
+
? [{ label: 'Uptime', value: `${(crash.appUptimeInMilliseconds / 1000).toFixed(1)}s` }]
|
|
95
|
+
: []),
|
|
96
|
+
...(crash.comment ? [{ label: 'Comment', value: crash.comment }] : []),
|
|
97
|
+
]);
|
|
98
|
+
return [
|
|
99
|
+
details,
|
|
100
|
+
'',
|
|
101
|
+
chalk_1.default.bold('Crash log'),
|
|
102
|
+
logText ?? chalk_1.default.dim('No crash log is available for this submission yet.'),
|
|
103
|
+
].join('\n');
|
|
104
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from '@expo/apple-utils';
|
|
2
|
+
import { BetaFeedbackTarget } from './target';
|
|
3
|
+
import { PaginatedQueryOptions } from '../commandUtils/pagination';
|
|
4
|
+
/** Feedback and crashes render as multi-line blocks, so default to a smaller page than lists do. */
|
|
5
|
+
export declare const TESTFLIGHT_PAGE_SIZE = 20;
|
|
6
|
+
/** List screenshot feedback submitted by TestFlight testers. */
|
|
7
|
+
export declare function listAndRenderTestFlightFeedbackAsync(app: App, paginatedQueryOptions: PaginatedQueryOptions): Promise<void>;
|
|
8
|
+
/** List crashes reported by TestFlight testers. */
|
|
9
|
+
export declare function listAndRenderTestFlightCrashesAsync(app: App, paginatedQueryOptions: PaginatedQueryOptions): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Render a single submission identified by an EAS workflow trigger's
|
|
12
|
+
* `app_store_connect.beta_feedback` payload. Crashes are rendered with their full crash log.
|
|
13
|
+
*/
|
|
14
|
+
export declare function viewAndRenderBetaFeedbackAsync(app: App, target: BetaFeedbackTarget, { json }: {
|
|
15
|
+
json: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TESTFLIGHT_PAGE_SIZE = void 0;
|
|
4
|
+
exports.listAndRenderTestFlightFeedbackAsync = listAndRenderTestFlightFeedbackAsync;
|
|
5
|
+
exports.listAndRenderTestFlightCrashesAsync = listAndRenderTestFlightCrashesAsync;
|
|
6
|
+
exports.viewAndRenderBetaFeedbackAsync = viewAndRenderBetaFeedbackAsync;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
+
const fetch_1 = require("./fetch");
|
|
10
|
+
const format_1 = require("./format");
|
|
11
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
12
|
+
const json_1 = require("../utils/json");
|
|
13
|
+
const queries_1 = require("../utils/queries");
|
|
14
|
+
/** Feedback and crashes render as multi-line blocks, so default to a smaller page than lists do. */
|
|
15
|
+
exports.TESTFLIGHT_PAGE_SIZE = 20;
|
|
16
|
+
const FEEDBACK_RENDERING = {
|
|
17
|
+
jsonKey: 'feedback',
|
|
18
|
+
formatItem: format_1.formatTestFlightFeedback,
|
|
19
|
+
emptyMessage: bundleId => `No TestFlight feedback has been submitted for ${chalk_1.default.bold(bundleId)}.`,
|
|
20
|
+
loadMorePrompt: 'Load more feedback?',
|
|
21
|
+
moreAvailableHint: (shown, total) => `Showing ${shown} of ${total} feedback submissions. Use --offset and --limit to see more.`,
|
|
22
|
+
};
|
|
23
|
+
const CRASHES_RENDERING = {
|
|
24
|
+
jsonKey: 'crashes',
|
|
25
|
+
formatItem: format_1.formatTestFlightCrash,
|
|
26
|
+
emptyMessage: bundleId => `No TestFlight crashes have been reported for ${chalk_1.default.bold(bundleId)}.`,
|
|
27
|
+
loadMorePrompt: 'Load more crashes?',
|
|
28
|
+
moreAvailableHint: (shown, total) => `Showing ${shown} of ${total} crashes. Use --offset and --limit to see more.`,
|
|
29
|
+
};
|
|
30
|
+
async function listAndRenderAsync({ bundleId, query, rendering, paginatedQueryOptions, }) {
|
|
31
|
+
const { json, nonInteractive, offset } = paginatedQueryOptions;
|
|
32
|
+
const limit = paginatedQueryOptions.limit ?? exports.TESTFLIGHT_PAGE_SIZE;
|
|
33
|
+
if (json) {
|
|
34
|
+
const [items, total] = await Promise.all([
|
|
35
|
+
query.queryAsync(limit, offset),
|
|
36
|
+
query.getTotalAsync(),
|
|
37
|
+
]);
|
|
38
|
+
(0, json_1.printJsonOnlyOutput)({
|
|
39
|
+
[rendering.jsonKey]: items,
|
|
40
|
+
total,
|
|
41
|
+
offset,
|
|
42
|
+
limit,
|
|
43
|
+
hasNextPage: offset + items.length < total,
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const renderPage = (items, pageOffset) => {
|
|
48
|
+
log_1.default.addNewLineIfNone();
|
|
49
|
+
if (items.length === 0) {
|
|
50
|
+
log_1.default.log(pageOffset === 0
|
|
51
|
+
? rendering.emptyMessage(bundleId)
|
|
52
|
+
: chalk_1.default.dim('No items past this offset.'));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
log_1.default.log(items.map((item, index) => rendering.formatItem(item, pageOffset + index + 1)).join('\n\n'));
|
|
56
|
+
};
|
|
57
|
+
if (nonInteractive) {
|
|
58
|
+
const items = await query.queryAsync(limit, offset);
|
|
59
|
+
renderPage(items, offset);
|
|
60
|
+
const total = await query.getTotalAsync();
|
|
61
|
+
if (offset + items.length < total) {
|
|
62
|
+
log_1.default.newLine();
|
|
63
|
+
log_1.default.log(chalk_1.default.dim(rendering.moreAvailableHint(offset + items.length, total)));
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// `paginatedQueryWithConfirmPromptAsync` renders one page at a time without reporting the offset
|
|
68
|
+
// it used, so track how many items have been rendered to keep the numbering absolute.
|
|
69
|
+
let renderedCount = 0;
|
|
70
|
+
await (0, queries_1.paginatedQueryWithConfirmPromptAsync)({
|
|
71
|
+
limit,
|
|
72
|
+
offset,
|
|
73
|
+
queryToPerform: (pageLimit, pageOffset) => query.queryAsync(pageLimit, pageOffset),
|
|
74
|
+
promptOptions: {
|
|
75
|
+
title: rendering.loadMorePrompt,
|
|
76
|
+
renderListItems: items => {
|
|
77
|
+
renderPage(items, offset + renderedCount);
|
|
78
|
+
renderedCount += items.length;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** List screenshot feedback submitted by TestFlight testers. */
|
|
84
|
+
async function listAndRenderTestFlightFeedbackAsync(app, paginatedQueryOptions) {
|
|
85
|
+
await listAndRenderAsync({
|
|
86
|
+
bundleId: app.attributes.bundleId,
|
|
87
|
+
query: (0, fetch_1.getTestFlightFeedbackQuery)(app),
|
|
88
|
+
rendering: FEEDBACK_RENDERING,
|
|
89
|
+
paginatedQueryOptions,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** List crashes reported by TestFlight testers. */
|
|
93
|
+
async function listAndRenderTestFlightCrashesAsync(app, paginatedQueryOptions) {
|
|
94
|
+
await listAndRenderAsync({
|
|
95
|
+
bundleId: app.attributes.bundleId,
|
|
96
|
+
query: (0, fetch_1.getTestFlightCrashesQuery)(app),
|
|
97
|
+
rendering: CRASHES_RENDERING,
|
|
98
|
+
paginatedQueryOptions,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Render a single submission identified by an EAS workflow trigger's
|
|
103
|
+
* `app_store_connect.beta_feedback` payload. Crashes are rendered with their full crash log.
|
|
104
|
+
*/
|
|
105
|
+
async function viewAndRenderBetaFeedbackAsync(app, target, { json }) {
|
|
106
|
+
if (target.type === 'crash') {
|
|
107
|
+
const { crash, logText } = await (0, fetch_1.fetchTestFlightCrashAsync)(app, target.id);
|
|
108
|
+
if (json) {
|
|
109
|
+
(0, json_1.printJsonOnlyOutput)({ crash, logText });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
log_1.default.addNewLineIfNone();
|
|
113
|
+
log_1.default.log((0, format_1.formatTestFlightCrashDetails)(crash, logText));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const feedback = await (0, fetch_1.fetchTestFlightFeedbackAsync)(app, target.id);
|
|
117
|
+
if (json) {
|
|
118
|
+
(0, json_1.printJsonOnlyOutput)({ feedback });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
log_1.default.addNewLineIfNone();
|
|
122
|
+
log_1.default.log((0, format_1.formatTestFlightFeedback)(feedback));
|
|
123
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BetaFeedbackType } from './fetch';
|
|
2
|
+
export type BetaFeedbackTarget = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: BetaFeedbackType;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a single submission to look up from what an EAS workflow trigger provides in
|
|
8
|
+
* `app_store_connect.beta_feedback`: either the `url` (which encodes both `id` and `type`) or the
|
|
9
|
+
* bare `id` alongside `type`. Without either, the command's own kind of feedback is assumed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveBetaFeedbackTarget({ idOrUrl, type, defaultType, }: {
|
|
12
|
+
idOrUrl: string;
|
|
13
|
+
type?: BetaFeedbackType;
|
|
14
|
+
defaultType: BetaFeedbackType;
|
|
15
|
+
}): BetaFeedbackTarget;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveBetaFeedbackTarget = resolveBetaFeedbackTarget;
|
|
4
|
+
/**
|
|
5
|
+
* App Store Connect self-links, which are what EAS workflow triggers put in
|
|
6
|
+
* `app_store_connect.beta_feedback.url`:
|
|
7
|
+
*
|
|
8
|
+
* https://api.appstoreconnect.apple.com/v1/betaFeedbackCrashSubmissions/<id>
|
|
9
|
+
* https://api.appstoreconnect.apple.com/v1/betaFeedbackScreenshotSubmissions/<id>
|
|
10
|
+
*/
|
|
11
|
+
const FEEDBACK_URL_PATTERN = /\/(betaFeedbackCrashSubmissions|betaFeedbackScreenshotSubmissions)\/([^/?#]+)/i;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a single submission to look up from what an EAS workflow trigger provides in
|
|
14
|
+
* `app_store_connect.beta_feedback`: either the `url` (which encodes both `id` and `type`) or the
|
|
15
|
+
* bare `id` alongside `type`. Without either, the command's own kind of feedback is assumed.
|
|
16
|
+
*/
|
|
17
|
+
function resolveBetaFeedbackTarget({ idOrUrl, type, defaultType, }) {
|
|
18
|
+
const match = idOrUrl.match(FEEDBACK_URL_PATTERN);
|
|
19
|
+
if (match) {
|
|
20
|
+
const urlType = match[1].toLowerCase().startsWith('betafeedbackcrash')
|
|
21
|
+
? 'crash'
|
|
22
|
+
: 'screenshot';
|
|
23
|
+
if (type && type !== urlType) {
|
|
24
|
+
throw new Error(`--type ${type} does not match the URL, which points at ${urlType} feedback. Omit --type when passing a URL.`);
|
|
25
|
+
}
|
|
26
|
+
return { id: decodeURIComponent(match[2]), type: urlType };
|
|
27
|
+
}
|
|
28
|
+
if (/^[a-z][a-z\d+\-.]*:\/\//i.test(idOrUrl)) {
|
|
29
|
+
throw new Error(`Could not tell whether "${idOrUrl}" points at crash or screenshot feedback. Pass the App Store Connect API URL from \${{ app_store_connect.beta_feedback.url }}, or pass the ID with --type.`);
|
|
30
|
+
}
|
|
31
|
+
return { id: idOrUrl, type: type ?? defaultType };
|
|
32
|
+
}
|
package/build/uploads.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Response } from 'node-fetch';
|
|
2
2
|
import { ExpoGraphqlClient } from './commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
-
import { AccountUploadSessionType, UploadSessionType } from './graphql/generated';
|
|
3
|
+
import { AccountUploadSessionType, AppUploadSessionType, UploadSessionType } from './graphql/generated';
|
|
4
4
|
import { ProgressHandler } from './utils/progress';
|
|
5
5
|
export interface PresignedPost {
|
|
6
6
|
url: string;
|
|
@@ -13,4 +13,10 @@ export declare function uploadAccountScopedFileAtPathToGCSAsync(graphqlClient: E
|
|
|
13
13
|
path: string;
|
|
14
14
|
handleProgressEvent: ProgressHandler;
|
|
15
15
|
}): Promise<string>;
|
|
16
|
+
export declare function uploadAppScopedFileAtPathToGCSAsync(graphqlClient: ExpoGraphqlClient, { type, appId, path, handleProgressEvent, }: {
|
|
17
|
+
type: AppUploadSessionType;
|
|
18
|
+
appId: string;
|
|
19
|
+
path: string;
|
|
20
|
+
handleProgressEvent?: ProgressHandler;
|
|
21
|
+
}): Promise<string>;
|
|
16
22
|
export declare function uploadWithPresignedPostWithRetryAsync(file: string, presignedPost: PresignedPost, onAssetUploadBegin: () => void): Promise<Response>;
|
package/build/uploads.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadFileAtPathToGCSAsync = uploadFileAtPathToGCSAsync;
|
|
4
4
|
exports.uploadAccountScopedFileAtPathToGCSAsync = uploadAccountScopedFileAtPathToGCSAsync;
|
|
5
|
+
exports.uploadAppScopedFileAtPathToGCSAsync = uploadAppScopedFileAtPathToGCSAsync;
|
|
5
6
|
exports.uploadWithPresignedPostWithRetryAsync = uploadWithPresignedPostWithRetryAsync;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
@@ -20,6 +21,14 @@ async function uploadAccountScopedFileAtPathToGCSAsync(graphqlClient, { type, ac
|
|
|
20
21
|
await uploadWithSignedUrlWithProgressAsync(path, signedUrl, handleProgressEvent);
|
|
21
22
|
return signedUrl.bucketKey;
|
|
22
23
|
}
|
|
24
|
+
async function uploadAppScopedFileAtPathToGCSAsync(graphqlClient, { type, appId, path, handleProgressEvent = () => { }, }) {
|
|
25
|
+
const signedUrl = await UploadSessionMutation_1.UploadSessionMutation.createAppScopedUploadSessionAsync(graphqlClient, {
|
|
26
|
+
type,
|
|
27
|
+
appID: appId,
|
|
28
|
+
});
|
|
29
|
+
await uploadWithSignedUrlWithProgressAsync(path, signedUrl, handleProgressEvent);
|
|
30
|
+
return signedUrl.bucketKey;
|
|
31
|
+
}
|
|
23
32
|
async function uploadWithPresignedPostWithRetryAsync(file, presignedPost, onAssetUploadBegin) {
|
|
24
33
|
return await (0, promise_retry_1.default)(async (retry) => {
|
|
25
34
|
// retry fetch errors (usually connection or DNS errors)
|
package/build/user/User.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { CurrentUserQuery, PartnerActor, Robot, SsoUser, User } from '../graphql/generated';
|
|
2
2
|
export type Actor = NonNullable<CurrentUserQuery['meActor']>;
|
|
3
|
+
/**
|
|
4
|
+
* Names of the accounts where the actor can create projects (non-ViewOnly role), listed in the
|
|
5
|
+
* same order as account selection prompts: the personal account first, then team accounts,
|
|
6
|
+
* then organization accounts.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCreatableAccountNames(actor: Actor): string[];
|
|
3
9
|
/**
|
|
4
10
|
* Resolve the name of the actor, either normal user, sso user or robot user.
|
|
5
11
|
* This should be used whenever the "current user" needs to be displayed.
|
package/build/user/User.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCreatableAccountNames = getCreatableAccountNames;
|
|
3
4
|
exports.getActorDisplayName = getActorDisplayName;
|
|
4
5
|
exports.getActorUsername = getActorUsername;
|
|
6
|
+
const generated_1 = require("../graphql/generated");
|
|
7
|
+
/**
|
|
8
|
+
* Names of the accounts where the actor can create projects (non-ViewOnly role), listed in the
|
|
9
|
+
* same order as account selection prompts: the personal account first, then team accounts,
|
|
10
|
+
* then organization accounts.
|
|
11
|
+
*/
|
|
12
|
+
function getCreatableAccountNames(actor) {
|
|
13
|
+
const creatableAccounts = actor.accounts.filter(a => a.users.find(it => it.actor.id === actor.id)?.role !== generated_1.Role.ViewOnly);
|
|
14
|
+
if (actor.__typename === 'Robot') {
|
|
15
|
+
return creatableAccounts.map(it => it.name);
|
|
16
|
+
}
|
|
17
|
+
return [
|
|
18
|
+
...creatableAccounts.filter(a => a.ownerUserActor?.id === actor.id),
|
|
19
|
+
...creatableAccounts.filter(a => a.ownerUserActor && a.ownerUserActor.id !== actor.id),
|
|
20
|
+
...creatableAccounts.filter(a => !a.ownerUserActor),
|
|
21
|
+
].map(it => it.name);
|
|
22
|
+
}
|
|
5
23
|
/**
|
|
6
24
|
* Resolve the name of the actor, either normal user, sso user or robot user.
|
|
7
25
|
* This should be used whenever the "current user" needs to be displayed.
|