eas-cli 20.3.0 → 20.5.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 +136 -113
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/commandUtils/new/templates/AGENTS.md +25 -146
- package/build/commandUtils/new/templates/CLAUDE.md +1 -9
- package/build/commands/integrations/posthog/connect.d.ts +3 -0
- package/build/commands/integrations/posthog/connect.js +66 -12
- package/build/commands/observe/session.d.ts +18 -0
- package/build/commands/observe/session.js +65 -0
- package/build/commands/simulator/get.js +8 -10
- package/build/commands/simulator/list.js +7 -13
- package/build/commands/simulator/start.js +27 -27
- package/build/commands/simulator/stop.js +5 -5
- package/build/graphql/generated.d.ts +353 -78
- package/build/graphql/generated.js +41 -5
- package/build/graphql/mutations/PostHogMutation.d.ts +2 -2
- package/build/graphql/mutations/PostHogMutation.js +13 -7
- package/build/graphql/queries/AccountQuery.js +5 -0
- package/build/graphql/queries/PostHogQuery.d.ts +3 -1
- package/build/graphql/queries/PostHogQuery.js +5 -2
- package/build/graphql/types/Observe.js +1 -0
- package/build/graphql/types/PostHogConnection.d.ts +8 -0
- package/build/observe/fetchCustomEvents.d.ts +2 -2
- package/build/observe/fetchCustomEvents.js +2 -2
- package/build/observe/fetchEvents.d.ts +4 -3
- package/build/observe/fetchEvents.js +4 -3
- package/build/observe/fetchSessions.d.ts +51 -0
- package/build/observe/fetchSessions.js +86 -0
- package/build/observe/formatEvents.d.ts +1 -0
- package/build/observe/formatEvents.js +1 -0
- package/build/observe/formatSessions.d.ts +15 -0
- package/build/observe/formatSessions.js +100 -0
- package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js +23 -26
- package/build/utils/usage/checkForOverages.d.ts +13 -3
- package/build/utils/usage/checkForOverages.js +72 -21
- package/oclif.manifest.json +1644 -1549
- package/package.json +4 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.maybeWarnAboutUsageOveragesAsync = maybeWarnAboutUsageOveragesAsync;
|
|
4
|
+
exports.classifyUsageTier = classifyUsageTier;
|
|
4
5
|
exports.calculatePercentUsed = calculatePercentUsed;
|
|
5
6
|
exports.createProgressBar = createProgressBar;
|
|
6
7
|
exports.displayOverageWarning = displayOverageWarning;
|
|
@@ -8,26 +9,59 @@ const tslib_1 = require("tslib");
|
|
|
8
9
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
10
|
const AccountQuery_1 = require("../../graphql/queries/AccountQuery");
|
|
10
11
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
11
|
-
const
|
|
12
|
+
const APPROACHING_THRESHOLD_PERCENT = 80;
|
|
12
13
|
async function maybeWarnAboutUsageOveragesAsync({ graphqlClient, accountId, }) {
|
|
13
14
|
try {
|
|
14
15
|
const currentDate = new Date();
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const account = await AccountQuery_1.AccountQuery.getUsageForOverageWarningAsync(graphqlClient, accountId, currentDate);
|
|
17
|
+
if (!account) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { name, subscription, usageMetrics } = account;
|
|
21
|
+
const buildMetrics = usageMetrics.EAS_BUILD;
|
|
22
|
+
const planMetric = buildMetrics?.planMetrics?.[0];
|
|
17
23
|
if (!planMetric || !subscription) {
|
|
18
24
|
return;
|
|
19
25
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const overageCount = buildMetrics.overageMetrics.reduce((sum, o) => sum + o.value, 0);
|
|
27
|
+
const overageCostCents = buildMetrics.totalCost;
|
|
28
|
+
const tier = classifyUsageTier({
|
|
29
|
+
planValue: planMetric.value,
|
|
30
|
+
limit: planMetric.limit,
|
|
31
|
+
overageCount,
|
|
32
|
+
});
|
|
33
|
+
if (!tier) {
|
|
34
|
+
return;
|
|
24
35
|
}
|
|
36
|
+
const hasFreePlan = subscription.name === 'Free';
|
|
37
|
+
displayOverageWarning({
|
|
38
|
+
tier,
|
|
39
|
+
name,
|
|
40
|
+
hasFreePlan,
|
|
41
|
+
planValue: planMetric.value,
|
|
42
|
+
limit: planMetric.limit,
|
|
43
|
+
overageCount,
|
|
44
|
+
overageCostCents,
|
|
45
|
+
});
|
|
25
46
|
}
|
|
26
47
|
catch (error) {
|
|
27
48
|
// Silently fail if we can't fetch usage data - we don't want to block the user's workflow
|
|
28
49
|
log_1.default.debug(`Failed to fetch usage data: ${error}`);
|
|
29
50
|
}
|
|
30
51
|
}
|
|
52
|
+
function classifyUsageTier({ planValue, limit, overageCount, }) {
|
|
53
|
+
if (overageCount > 0) {
|
|
54
|
+
return 'over';
|
|
55
|
+
}
|
|
56
|
+
if (limit > 0 && planValue >= limit) {
|
|
57
|
+
return 'at';
|
|
58
|
+
}
|
|
59
|
+
const percentUsed = calculatePercentUsed(planValue, limit);
|
|
60
|
+
if (percentUsed >= APPROACHING_THRESHOLD_PERCENT) {
|
|
61
|
+
return 'approaching';
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
31
65
|
function calculatePercentUsed(value, limit) {
|
|
32
66
|
if (limit === 0) {
|
|
33
67
|
return 0;
|
|
@@ -41,19 +75,36 @@ function createProgressBar(percentUsed, width = 30) {
|
|
|
41
75
|
const empty = '░'.repeat(emptyWidth);
|
|
42
76
|
return `${filled}${empty}`;
|
|
43
77
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
log_1.default.warn(message + progressBar);
|
|
78
|
+
function formatCents(cents) {
|
|
79
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
80
|
+
}
|
|
81
|
+
function displayOverageWarning({ tier, name, hasFreePlan, planValue, limit, overageCount, overageCostCents, }) {
|
|
49
82
|
const billingUrl = `https://expo.dev/accounts/${name}/settings/billing`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
if (tier === 'approaching') {
|
|
84
|
+
const percentUsed = calculatePercentUsed(planValue, limit);
|
|
85
|
+
log_1.default.warn(chalk_1.default.bold(`You've used ${percentUsed}% of your included build credits this billing period.`) +
|
|
86
|
+
' ' +
|
|
87
|
+
createProgressBar(percentUsed));
|
|
88
|
+
log_1.default.warn(hasFreePlan
|
|
89
|
+
? "You won't be able to start new builds once you reach the limit. " +
|
|
90
|
+
(0, log_1.link)(billingUrl, { text: 'Upgrade your plan to continue service.', dim: false })
|
|
91
|
+
: 'Additional usage beyond your limit will be charged at pay-as-you-go rates. ' +
|
|
92
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Free users are blocked at the limit, so they can't reach an "over" state.
|
|
96
|
+
// If we ever see Free + over (data inconsistency, mid-flight plan change), treat it as "at".
|
|
97
|
+
if (tier === 'at' || (tier === 'over' && hasFreePlan)) {
|
|
98
|
+
log_1.default.warn(chalk_1.default.bold("You've reached your included build credits this billing period."));
|
|
99
|
+
log_1.default.warn(hasFreePlan
|
|
100
|
+
? 'New builds are blocked until your billing period resets. ' +
|
|
101
|
+
(0, log_1.link)(billingUrl, { text: 'Upgrade your plan to continue building.', dim: false })
|
|
102
|
+
: 'Additional builds will be charged at pay-as-you-go rates. ' +
|
|
103
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// tier === 'over' && paid plan
|
|
107
|
+
log_1.default.warn(chalk_1.default.bold(`You've used ${overageCount} build${overageCount === 1 ? '' : 's'} beyond your included credits this billing period (${formatCents(overageCostCents)} in overages so far).`));
|
|
108
|
+
log_1.default.warn('Additional builds continue at pay-as-you-go rates. ' +
|
|
109
|
+
(0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
|
|
59
110
|
}
|