@waitcher/cli 0.2.8 → 0.2.9

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +94 -10
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -870,11 +870,13 @@ var init_limits = __esm({
870
870
  artifactBytes: 16 * 1024 * 1024,
871
871
  artifactFileBytes: 8 * 1024 * 1024,
872
872
  artifactFiles: 32,
873
- storedBytes: 512 * 1024 * 1024,
873
+ // Production keeps evidence on its own disk (docs/STORAGE.md).
874
+ storedBytes: 64 * 1024 * 1024 * 1024,
874
875
  minFreeBytes: 256 * 1024 * 1024,
875
876
  scanIntervalMs: 200,
876
- artifactDays: 7,
877
- metadataDays: 14,
877
+ // The longest any plan keeps; Store.retentionDays gives each owner's.
878
+ artifactDays: 30,
879
+ metadataDays: 30,
878
880
  cleanupBatch: 50
879
881
  });
880
882
  StorageError = class extends Error {
@@ -55859,6 +55861,72 @@ import { createServer } from "node:http";
55859
55861
  // ../../src/contracts/execution-policy.ts
55860
55862
  var import_ipaddr2 = __toESM(require_ipaddr(), 1);
55861
55863
 
55864
+ // ../../src/contracts/plans.ts
55865
+ var ACCOUNT_PLANS = Object.freeze({
55866
+ starter: Object.freeze({
55867
+ monitors: 5,
55868
+ // HTTP, certificate and heartbeat checks.
55869
+ checkMinInterval: 1800,
55870
+ scriptMonitors: 1,
55871
+ scriptMinInterval: 7200,
55872
+ scriptDailyRuns: 12,
55873
+ // Days evidence files and run history are kept (docs/STORAGE.md).
55874
+ artifactDays: 7,
55875
+ historyDays: 14
55876
+ }),
55877
+ // Design partners, assigned by the administrator: the pro limits, unpaid.
55878
+ pilot: Object.freeze({
55879
+ monitors: 25,
55880
+ checkMinInterval: 300,
55881
+ scriptMonitors: 5,
55882
+ scriptMinInterval: 300,
55883
+ scriptDailyRuns: 480,
55884
+ artifactDays: 30,
55885
+ historyDays: 30
55886
+ }),
55887
+ // Paid plan (docs/PRICING.md): more monitors checked every 5 minutes and a
55888
+ // month of evidence. Scripts may run every 5 minutes; what bounds our cost
55889
+ // is the daily run budget their schedules must fit (monitoring.ts), at the
55890
+ // runner cost measured in docs/PRICING.md.
55891
+ pro: Object.freeze({
55892
+ monitors: 25,
55893
+ checkMinInterval: 300,
55894
+ scriptMonitors: 5,
55895
+ scriptMinInterval: 300,
55896
+ scriptDailyRuns: 480,
55897
+ artifactDays: 30,
55898
+ historyDays: 30
55899
+ }),
55900
+ // Volume for one account (docs/PRICING.md): 1 minute checks and 2,500
55901
+ // script runs a day, about 18 USD of runner cost a month when fully used.
55902
+ business: Object.freeze({
55903
+ monitors: 100,
55904
+ checkMinInterval: 60,
55905
+ scriptMonitors: 25,
55906
+ scriptMinInterval: 120,
55907
+ scriptDailyRuns: 2500,
55908
+ artifactDays: 30,
55909
+ historyDays: 30
55910
+ })
55911
+ });
55912
+ var SCRIPT_MIN_INTERVAL = Math.min(
55913
+ ...Object.values(ACCOUNT_PLANS).map((plan) => plan.scriptMinInterval)
55914
+ );
55915
+ var PRO_PRICES_USD = Object.freeze({ month: 12, year: 120 });
55916
+ var BUSINESS_PRICES_USD = Object.freeze({ month: 49, year: 490 });
55917
+ var PAID_PLANS = ["pro", "business"];
55918
+ var billingCheckoutSchema = external_exports.object({
55919
+ interval: external_exports.enum(["month", "year"]).default("month"),
55920
+ plan: external_exports.enum(PAID_PLANS).default("pro"),
55921
+ trial: external_exports.boolean().default(false)
55922
+ }).strict();
55923
+ var accountPlanSchema = external_exports.enum(
55924
+ Object.keys(ACCOUNT_PLANS)
55925
+ );
55926
+ var accountPlanWriteSchema = external_exports.object({ plan: accountPlanSchema }).strict();
55927
+ var accountOwnerSchema = external_exports.string().regex(/^clerk:user_[A-Za-z0-9]{8,64}$/, "Use an owner like clerk:user_ID");
55928
+ var accountSuspensionWriteSchema = external_exports.object({ reason: external_exports.string().trim().min(3).max(200) }).strict();
55929
+
55862
55930
  // ../../src/public-http.ts
55863
55931
  var import_ipaddr3 = __toESM(require_ipaddr(), 1);
55864
55932
  var import_undici = __toESM(require_undici(), 1);
@@ -58549,6 +58617,12 @@ var entries = {
58549
58617
  meaning: "The referenced project, environment, monitor, run, target or credential does not exist for this account.",
58550
58618
  fix: "A referenced project, environment, target or credential is missing. List it first and use the exact ID."
58551
58619
  },
58620
+ PAYMENT_REQUIRED: {
58621
+ title: "Plan change not paid",
58622
+ meaning: "Moving the subscription to a larger plan needs a payment that did not go through, so the plan did not change.",
58623
+ fix: "Add or update a card with waitcher account billing-portal, then run the upgrade again.",
58624
+ exitCode: 8
58625
+ },
58552
58626
  SERVICE_UNAVAILABLE: {
58553
58627
  title: "Server unavailable",
58554
58628
  meaning: "The server is restoring, restarting or unreachable behind its proxy.",
@@ -61486,8 +61560,8 @@ var ACCOUNT_EXPORT_LIMITS = {
61486
61560
 
61487
61561
  // ../../src/contracts/account.ts
61488
61562
  var ACCOUNT_LIMITS = {
61489
- artifactDays: 7,
61490
- metadataDays: 14,
61563
+ artifactDays: 30,
61564
+ metadataDays: 30,
61491
61565
  auditPerOwner: 500,
61492
61566
  auditGlobal: 5e3,
61493
61567
  activityPage: 50
@@ -62040,7 +62114,9 @@ Authentication
62040
62114
 
62041
62115
  Plans and billing
62042
62116
  account billing Plan, limits and subscription status
62043
- account upgrade [--yearly] [--trial] Stripe Checkout URL for the pro plan; --trial: 14 days, once, no card
62117
+ account upgrade [--plan pro|business] [--yearly] [--trial]
62118
+ Stripe Checkout URL for a paid plan (default pro; --trial: pro,
62119
+ 14 days, once, no card); a subscribed account moves in place
62044
62120
  account billing-portal Stripe portal URL to change payment or cancel
62045
62121
  The plan changes only when Stripe confirms the payment, never on the return page.
62046
62122
  Billing appears when the server reports features.billing.
@@ -62507,7 +62583,7 @@ ${exitCodes}
62507
62583
  // package.json
62508
62584
  var package_default = {
62509
62585
  name: "@waitcher/cli",
62510
- version: "0.2.8",
62586
+ version: "0.2.9",
62511
62587
  description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API and browser monitors from waitcher.json.",
62512
62588
  license: "SEE LICENSE IN LICENSE.txt",
62513
62589
  author: "S\u0142awomir Radzymi\u0144ski",
@@ -62796,7 +62872,7 @@ async function main() {
62796
62872
  "account budget": ["daily-invocations", "expected-revision"],
62797
62873
  "account settings": [],
62798
62874
  "account billing": [],
62799
- "account upgrade": ["yearly", "trial"],
62875
+ "account upgrade": ["yearly", "trial", "plan"],
62800
62876
  "account billing-portal": [],
62801
62877
  "account configure": ["file", "expected-revision"],
62802
62878
  "account activity": ["before"],
@@ -64679,17 +64755,25 @@ async function main() {
64679
64755
  result2 = await api("system/suspensions");
64680
64756
  else if (command === "account billing") result2 = await api("billing");
64681
64757
  else if (command === "account upgrade" || command === "account billing-portal") {
64682
- const { url: url3 } = await api(
64758
+ const plan = v.plan === void 0 ? void 0 : String(v.plan);
64759
+ if (command === "account upgrade" && plan && !["pro", "business"].includes(plan))
64760
+ usage2("--plan must be pro or business");
64761
+ const { url: url3, changed } = await api(
64683
64762
  command === "account upgrade" ? "billing/checkout" : "billing/portal",
64684
64763
  {
64685
64764
  method: "POST",
64686
64765
  body: command === "account upgrade" ? {
64687
64766
  ...v.yearly ? { interval: "year" } : {},
64767
+ ...plan ? { plan } : {},
64688
64768
  ...v.trial ? { trial: true } : {}
64689
64769
  } : {}
64690
64770
  }
64691
64771
  );
64692
- result2 = {
64772
+ result2 = changed ? {
64773
+ event: "plan_changed",
64774
+ plan,
64775
+ next: ["waitcher account billing"]
64776
+ } : {
64693
64777
  event: command === "account upgrade" ? "checkout_created" : "portal_created",
64694
64778
  url: url3,
64695
64779
  next: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waitcher/cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API and browser monitors from waitcher.json.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Sławomir Radzymiński",