@waitcher/cli 0.2.7 → 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 +100 -13
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -870,12 +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,
878
- maxRuns: 1e4,
877
+ // The longest any plan keeps; Store.retentionDays gives each owner's.
878
+ artifactDays: 30,
879
+ metadataDays: 30,
879
880
  cleanupBatch: 50
880
881
  });
881
882
  StorageError = class extends Error {
@@ -55860,6 +55861,72 @@ import { createServer } from "node:http";
55860
55861
  // ../../src/contracts/execution-policy.ts
55861
55862
  var import_ipaddr2 = __toESM(require_ipaddr(), 1);
55862
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
+
55863
55930
  // ../../src/public-http.ts
55864
55931
  var import_ipaddr3 = __toESM(require_ipaddr(), 1);
55865
55932
  var import_undici = __toESM(require_undici(), 1);
@@ -58550,6 +58617,12 @@ var entries = {
58550
58617
  meaning: "The referenced project, environment, monitor, run, target or credential does not exist for this account.",
58551
58618
  fix: "A referenced project, environment, target or credential is missing. List it first and use the exact ID."
58552
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
+ },
58553
58626
  SERVICE_UNAVAILABLE: {
58554
58627
  title: "Server unavailable",
58555
58628
  meaning: "The server is restoring, restarting or unreachable behind its proxy.",
@@ -61487,8 +61560,8 @@ var ACCOUNT_EXPORT_LIMITS = {
61487
61560
 
61488
61561
  // ../../src/contracts/account.ts
61489
61562
  var ACCOUNT_LIMITS = {
61490
- artifactDays: 7,
61491
- metadataDays: 14,
61563
+ artifactDays: 30,
61564
+ metadataDays: 30,
61492
61565
  auditPerOwner: 500,
61493
61566
  auditGlobal: 5e3,
61494
61567
  activityPage: 50
@@ -62041,7 +62114,9 @@ Authentication
62041
62114
 
62042
62115
  Plans and billing
62043
62116
  account billing Plan, limits and subscription status
62044
- account upgrade [--yearly] Stripe Checkout URL for the pro plan (human session)
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
62045
62120
  account billing-portal Stripe portal URL to change payment or cancel
62046
62121
  The plan changes only when Stripe confirms the payment, never on the return page.
62047
62122
  Billing appears when the server reports features.billing.
@@ -62508,7 +62583,7 @@ ${exitCodes}
62508
62583
  // package.json
62509
62584
  var package_default = {
62510
62585
  name: "@waitcher/cli",
62511
- version: "0.2.7",
62586
+ version: "0.2.9",
62512
62587
  description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API and browser monitors from waitcher.json.",
62513
62588
  license: "SEE LICENSE IN LICENSE.txt",
62514
62589
  author: "S\u0142awomir Radzymi\u0144ski",
@@ -62701,6 +62776,7 @@ async function main() {
62701
62776
  "dry-run": { type: "boolean" },
62702
62777
  yes: { type: "boolean" },
62703
62778
  yearly: { type: "boolean" },
62779
+ trial: { type: "boolean" },
62704
62780
  browser: { type: "boolean" },
62705
62781
  global: { type: "boolean" },
62706
62782
  wait: { type: "boolean" },
@@ -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"],
62875
+ "account upgrade": ["yearly", "trial", "plan"],
62800
62876
  "account billing-portal": [],
62801
62877
  "account configure": ["file", "expected-revision"],
62802
62878
  "account activity": ["before"],
@@ -64679,18 +64755,29 @@ 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
- body: command === "account upgrade" && v.yearly ? { interval: "year" } : {}
64765
+ body: command === "account upgrade" ? {
64766
+ ...v.yearly ? { interval: "year" } : {},
64767
+ ...plan ? { plan } : {},
64768
+ ...v.trial ? { trial: true } : {}
64769
+ } : {}
64687
64770
  }
64688
64771
  );
64689
- result2 = {
64772
+ result2 = changed ? {
64773
+ event: "plan_changed",
64774
+ plan,
64775
+ next: ["waitcher account billing"]
64776
+ } : {
64690
64777
  event: command === "account upgrade" ? "checkout_created" : "portal_created",
64691
64778
  url: url3,
64692
64779
  next: [
64693
- command === "account upgrade" ? "Open the URL in a browser and pay there; the plan changes when Stripe confirms the payment" : "Open the URL in a browser to change or cancel the subscription",
64780
+ command === "account upgrade" ? v.trial ? "Open the URL in a browser to start the trial; no card is needed, and without one the plan returns to starter when it ends" : "Open the URL in a browser and pay there; the plan changes when Stripe confirms the payment" : "Open the URL in a browser to change or cancel the subscription",
64694
64781
  "waitcher account billing"
64695
64782
  ]
64696
64783
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waitcher/cli",
3
- "version": "0.2.7",
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",