create-disposabl-app 0.20.0 → 0.20.2

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/disposabl.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // ../cli/auth.ts
4
4
  import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
- var version = "0.20.0";
6
+ var version = "0.20.2";
7
7
  var package_default = {
8
8
  name: "@disposabl/cli",
9
9
  version,
package/dist/index.js CHANGED
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
1563
1563
  import { Command, CommanderError } from "commander";
1564
1564
  import * as p2 from "@clack/prompts";
1565
1565
  // package.json
1566
- var version = "0.20.0";
1566
+ var version = "0.20.2";
1567
1567
 
1568
1568
  // ../cli/telemetry.ts
1569
1569
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
@@ -62,6 +62,16 @@ A cancellation before dispatch creates a local tombstone; a later purchase canno
62
62
 
63
63
  Operators can inspect private `revenuecat:inspect` by state and `revenuecat:inspectTransfers` and `revenuecat:inspectConflicts`. `revenuecat:confirmUnknown` records a provider-confirmed grant or refund with a nonsecret evidence reference, without issuing another write. An aggregate customer balance alone is not proof of an individual operation. There is no automatic reissue of a failed or uncertain dispatch. For an existing queued grant, `revenuecat:redispatchQueued` accepts the exact balance, route and customer, and schedules dispatch only if the customer exists and no active transfer holds remain. Dispatch rechecks current configuration and claim state, customer and holds; a later transfer can still block it. Unknown, refund and review states are not redispatched by this tool.
64
64
 
65
+ ### Recover a queued native purchase after payments are re-enabled
66
+
67
+ A worker scheduled while payments were on can run after a payments-off deployment. It returns without claiming the purchase, leaving it `queued`. Re-enabling payments does not reschedule it. Webhooks rejected while payments were off are a separate missed-delivery problem; this procedure only covers an already persisted purchase. Use it only on a deployment that has the internal `revenuecat:redispatchQueued` operation; the published 0.19.6 behavior alone does not establish that this operator operation is available.
68
+
69
+ 1. Identify the exact deployment and verify that payments are enabled in its deployed configuration, its custom owner and routes match the original project, app, environment, store and product, and its Autumn key targets the intended organization and environment. Confirm the custom product is not also managed by another integration. Restore the correct configuration before scheduling anything.
70
+ 2. From the deployment's backend directory, inspect queued purchases with the appropriate explicit target. For example, use `bun x --no-install convex run --preview-name <channel> revenuecat:inspect '{"state":"queued"}'` for a preview, or replace `--preview-name <channel>` with `--prod` for production. The query returns at most 100 rows, so it is not a complete inventory when the limit is reached. Establish the affected purchase and its stored `balanceId`, `project`, `app`, `environment`, `store`, `product`, and `customer` from trusted records. Investigate conflicts and transfers with `revenuecat:inspectConflicts '{}'` and `revenuecat:inspectTransfers '{}'` on the same target; each is also limited to 100 rows. A missing item in those results is not proof of no conflict or hold.
71
+ 3. Verify the purchase and owner against provider records and review any cancellation, transfer or uncertain write before acting. Do not change or delete history, release holds, or retry unknown/refund/review states. A `grant_unknown` requires provider-specific evidence and `revenuecat:confirmUnknown` when a grant is confirmed; an aggregate balance alone is insufficient. Retain transfer holds until a separate release policy is established.
72
+ 4. For each verified eligible row, invoke the internal mutation on that same target with the exact stored values, e.g. `bun x --no-install convex run --preview-name <channel> revenuecat:redispatchQueued '{"balanceId":"<balanceId>","project":"<project>","app":"<app>","environment":"<environment>","store":"<store>","product":"<product>","customer":"<customer>"}'`. A `true` result means only that dispatch was scheduled; `false` means the row or scope did not qualify. The mutation rejects pending review/refund flags, active holds, missing customers, mismatched scope and non-queued states. Dispatch independently rechecks configuration, route, customer, hold and claim state, so a later change may still block it.
73
+ 5. Inspect the resulting state and corroborate the individual operation with provider records. `granted` reflects a successful response; `grant_unknown` requires reconciliation, not another grant. A row still `queued` needs investigation of configuration, holds and customer before any further targeted scheduling. Preserve the evidence and do not treat scheduling as proof of credit. No provider exactly-once guarantee or automatic recovery is implied.
74
+
65
75
  Private `revenuecat:recordTransferReview` records a `retain_hold` decision, a nonsecret provider evidence reference and review time against an exact transfer scope and its original from/to lists. Repeating the same decision is idempotent; conflicting evidence or scope is rejected. It does not release holds, resolve purchase states, transfer ownership, or move balances. The remaining policy question is what provider evidence and account-ownership conditions make every affected queued grant safe for its stored customer after a transfer; until that is defined and verified, keep the holds.
66
76
 
67
77
  Autumn documents a caller-supplied `balance_id`, not its atomic uniqueness and retry semantics. This code does not claim exactly-once behavior across providers. Before enabling or offering the consumable, verify stable ID behavior and balance targeting, event ownership, concurrent delivery, response loss, crashes, refunds and partial refunds in isolated Apple and Google sandboxes; establish a documented provider reconciliation contract and a missed-webhook process. A successful local test or a callback does not prove a purchase or provider write. Native product IDs, pricing, RevenueCat offerings and both stores still need verification; do not set the verification flag until those checks pass. A store purchase remains pending until the authoritative Autumn balance updates; the app never grants credits locally.
@@ -102,7 +102,10 @@ export const createHandoff = (eligibility?: BillingEligibility) =>
102
102
  },
103
103
  });
104
104
  export const create = createHandoff();
105
- export const inspectHandoff = (eligibility?: BillingEligibility) =>
105
+ export const inspectHandoff = (
106
+ eligibility?: BillingEligibility,
107
+ enabled = paymentsEnabled,
108
+ ) =>
106
109
  query({
107
110
  args: { code: v.string() },
108
111
  returns: v.union(
@@ -110,6 +113,7 @@ export const inspectHandoff = (eligibility?: BillingEligibility) =>
110
113
  v.object({ name: v.union(v.string(), v.null()) }),
111
114
  ),
112
115
  handler: async (ctx, { code }) => {
116
+ if (!enabled) return null;
113
117
  try {
114
118
  const row = await lookup(ctx, code);
115
119
  await eligibility?.(ctx, row.userId);
@@ -137,7 +141,10 @@ export const inspectHandoff = (eligibility?: BillingEligibility) =>
137
141
  },
138
142
  });
139
143
  export const inspect = inspectHandoff();
140
- export const redeemHandoff = (eligibility?: BillingEligibility) =>
144
+ export const redeemHandoff = (
145
+ eligibility?: BillingEligibility,
146
+ enabled = paymentsEnabled,
147
+ ) =>
141
148
  mutation({
142
149
  args: { code: v.string() },
143
150
  returns: v.object({
@@ -150,6 +157,7 @@ export const redeemHandoff = (eligibility?: BillingEligibility) =>
150
157
  returnClaim: v.union(v.string(), v.null()),
151
158
  }),
152
159
  handler: async (ctx, { code }) => {
160
+ if (!enabled) throw new ConvexError("Website checkout is unavailable.");
153
161
  const row = await lookup(ctx, code);
154
162
  await eligibility?.(ctx, row.userId);
155
163
  const tokens = await exchangeBrowserSession(
@@ -1,11 +1,14 @@
1
1
  import { test } from "node:test";
2
2
  import assert from "node:assert/strict";
3
3
  import {
4
- redeem,
4
+ redeemHandoff,
5
+ inspectHandoff,
5
6
  cleanup,
6
7
  returnTarget,
7
8
  } from "../disposabl-kit/server/billing-handoff";
8
9
 
10
+ const redeem = redeemHandoff(undefined, true);
11
+
9
12
  test("billing handoff expires and a redeemed link cannot be replayed", async () => {
10
13
  let row: any = {
11
14
  _id: "one",
@@ -181,3 +184,50 @@ test("return target is bound to a redeemed browser session and an allowlisted ch
181
184
  else process.env.BILLING_IOS_RETURN_CHANNELS = previous;
182
185
  }
183
186
  });
187
+
188
+ test("disabled payments preserve existing handoffs without identity reads or session exchange", async () => {
189
+ const row = {
190
+ _id: "retained",
191
+ userId: "alice",
192
+ sessionId: "source",
193
+ purchase: "topup",
194
+ expiresAt: Date.now() + 120_000,
195
+ };
196
+ const original = structuredClone(row);
197
+ let reads = 0;
198
+ let exchanges = 0;
199
+ let writes = 0;
200
+ const ctx = {
201
+ db: {
202
+ query: () => {
203
+ reads++;
204
+ return { withIndex: () => ({ unique: async () => row }) };
205
+ },
206
+ normalizeId: () => null,
207
+ delete: async () => {
208
+ writes++;
209
+ },
210
+ },
211
+ runQuery: async () => {
212
+ reads++;
213
+ return { userId: "alice" };
214
+ },
215
+ runMutation: async () => {
216
+ exchanges++;
217
+ return { userId: "alice" };
218
+ },
219
+ };
220
+ const code = "Q".repeat(43);
221
+ const inspectOff = inspectHandoff(undefined, false) as any;
222
+ const redeemOff = redeemHandoff(undefined, false) as any;
223
+ assert.equal(await inspectOff._handler(ctx, { code }), null);
224
+ await assert.rejects(redeemOff._handler(ctx, { code }), /unavailable/);
225
+ assert.deepEqual(
226
+ { reads, exchanges, writes },
227
+ { reads: 0, exchanges: 0, writes: 0 },
228
+ );
229
+ assert.deepEqual(row, original);
230
+ await (redeem as any)._handler(ctx, { code });
231
+ assert.equal(exchanges, 1);
232
+ assert.equal(writes, 1);
233
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",