@tolkbot/cli 0.9.0 → 0.9.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/dist/index.js +30 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5787,7 +5787,7 @@ var require_out4 = __commonJS({
|
|
|
5787
5787
|
import { Command as Command10, CommanderError, Option as Option2 } from "commander";
|
|
5788
5788
|
|
|
5789
5789
|
// package.json
|
|
5790
|
-
var version = "0.9.
|
|
5790
|
+
var version = "0.9.1";
|
|
5791
5791
|
|
|
5792
5792
|
// src/commands/auth/index.ts
|
|
5793
5793
|
import { Command } from "commander";
|
|
@@ -29218,7 +29218,6 @@ var analyticsEventNames = [
|
|
|
29218
29218
|
"github_connect_started",
|
|
29219
29219
|
"github_install_initiated",
|
|
29220
29220
|
"plan_change_initiated",
|
|
29221
|
-
"credits_purchase_initiated",
|
|
29222
29221
|
"glossary_created",
|
|
29223
29222
|
"glossary_deleted",
|
|
29224
29223
|
"glossary_imported",
|
|
@@ -29243,7 +29242,6 @@ var analyticsEventNames = [
|
|
|
29243
29242
|
"subscription_plan_changed",
|
|
29244
29243
|
"subscription_canceled",
|
|
29245
29244
|
"trial_ended",
|
|
29246
|
-
"credits_purchased",
|
|
29247
29245
|
"credits_exhausted",
|
|
29248
29246
|
"usage_limit_reached",
|
|
29249
29247
|
"cta_clicked",
|
|
@@ -31836,6 +31834,7 @@ async function runJobsList(opts) {
|
|
|
31836
31834
|
}
|
|
31837
31835
|
|
|
31838
31836
|
// ../shared/src/conditions/index.ts
|
|
31837
|
+
var TRIAL_ENDING_WINDOW_MS = 3 * 24 * 60 * 60 * 1e3;
|
|
31839
31838
|
var BILLING_BLOCKED = "BILLING_BLOCKED";
|
|
31840
31839
|
|
|
31841
31840
|
// ../shared/src/projects/localeSetup.ts
|
|
@@ -31900,6 +31899,23 @@ function readInUse(candidate) {
|
|
|
31900
31899
|
};
|
|
31901
31900
|
}
|
|
31902
31901
|
var PROJECT_ARCHIVED = "PROJECT_ARCHIVED";
|
|
31902
|
+
var PROJECT_LIMIT_REACHED = "PROJECT_LIMIT_REACHED";
|
|
31903
|
+
function findProjectLimitReached(error62) {
|
|
31904
|
+
return readLimit(error62) ?? readLimit(readProperty2(error62, "data"));
|
|
31905
|
+
}
|
|
31906
|
+
function readLimit(candidate) {
|
|
31907
|
+
if (readProperty2(candidate, "code") !== PROJECT_LIMIT_REACHED) {
|
|
31908
|
+
return null;
|
|
31909
|
+
}
|
|
31910
|
+
const message = readProperty2(candidate, "message");
|
|
31911
|
+
const plan = readProperty2(candidate, "plan");
|
|
31912
|
+
const limit = readProperty2(candidate, "limit");
|
|
31913
|
+
const href = readProperty2(candidate, "href");
|
|
31914
|
+
if (typeof message !== "string" || plan !== "starter" && plan !== "pro" || typeof limit !== "number" || typeof href !== "string") {
|
|
31915
|
+
return null;
|
|
31916
|
+
}
|
|
31917
|
+
return { code: PROJECT_LIMIT_REACHED, message, plan, limit, href };
|
|
31918
|
+
}
|
|
31903
31919
|
|
|
31904
31920
|
// src/utils/error-codes.ts
|
|
31905
31921
|
var EXIT_CODES = {
|
|
@@ -31947,6 +31963,7 @@ var ERROR_CODES = {
|
|
|
31947
31963
|
no_subscription: EXIT_CODES.billing,
|
|
31948
31964
|
out_of_credits: EXIT_CODES.billing,
|
|
31949
31965
|
payment_failed: EXIT_CODES.billing,
|
|
31966
|
+
project_limit_reached: EXIT_CODES.billing,
|
|
31950
31967
|
// 5: could not reach TolkBot
|
|
31951
31968
|
network: EXIT_CODES.network
|
|
31952
31969
|
};
|
|
@@ -31967,7 +31984,8 @@ function billingHint() {
|
|
|
31967
31984
|
var BILLING_MESSAGES = [
|
|
31968
31985
|
{ startsWith: "No billing account", code: "no_subscription" },
|
|
31969
31986
|
{ startsWith: "Insufficient credits", code: "out_of_credits" },
|
|
31970
|
-
{ startsWith: "Overage limit", code: "out_of_credits" }
|
|
31987
|
+
{ startsWith: "Overage limit", code: "out_of_credits" },
|
|
31988
|
+
{ startsWith: "Your trial", code: "out_of_credits" }
|
|
31971
31989
|
];
|
|
31972
31990
|
function fromConvexError(data) {
|
|
31973
31991
|
if (typeof data === "string") {
|
|
@@ -32002,6 +32020,14 @@ function fromConvexError(data) {
|
|
|
32002
32020
|
"repository_path_in_use"
|
|
32003
32021
|
);
|
|
32004
32022
|
}
|
|
32023
|
+
const limit = findProjectLimitReached(data);
|
|
32024
|
+
if (limit) {
|
|
32025
|
+
return new CliError(
|
|
32026
|
+
limit.message,
|
|
32027
|
+
`Change plan or archive a project at ${env.TOLKBOT_WEB_URL}${limit.href}.`,
|
|
32028
|
+
"project_limit_reached"
|
|
32029
|
+
);
|
|
32030
|
+
}
|
|
32005
32031
|
return typeof message === "string" ? new CliError(message) : null;
|
|
32006
32032
|
}
|
|
32007
32033
|
function serverMessage(message) {
|
package/package.json
CHANGED