create-disposabl-app 0.19.8 → 0.20.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/dist/disposabl.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/default/packages/backend/convex/revenuecat.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/server/revenuecat-functions.ts +32 -2
- package/dist/templates/default/packages/disposabl-kit/server/revenuecat-validator.ts +1 -0
- package/dist/templates/default/packages/tests/README.md +4 -0
- package/dist/templates/default/packages/tests/revenuecat-inbox.test.ts +88 -0
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
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.
|
|
1566
|
+
var version = "0.20.0";
|
|
1567
1567
|
|
|
1568
1568
|
// ../cli/telemetry.ts
|
|
1569
1569
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
docValidator,
|
|
3
|
+
httpActionGeneric,
|
|
4
|
+
makeFunctionReference,
|
|
5
|
+
paginationOptsValidator,
|
|
6
|
+
paginationResultValidator,
|
|
7
|
+
} from "convex/server";
|
|
2
8
|
import { v } from "convex/values";
|
|
3
9
|
import {
|
|
4
10
|
internalAction,
|
|
@@ -19,7 +25,10 @@ import {
|
|
|
19
25
|
type PurchaseEvent,
|
|
20
26
|
type RevenueCatConfig,
|
|
21
27
|
} from "./revenuecat-contract";
|
|
22
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
purchaseEventFields,
|
|
30
|
+
revenueCatDeliveries,
|
|
31
|
+
} from "./revenuecat-validator";
|
|
23
32
|
|
|
24
33
|
const receiveRef = makeFunctionReference<
|
|
25
34
|
"mutation",
|
|
@@ -240,6 +249,27 @@ export const inspectConflicts = internalQuery({
|
|
|
240
249
|
.take(100),
|
|
241
250
|
});
|
|
242
251
|
|
|
252
|
+
// Historical delivery archive, not a queue of unresolved reviews.
|
|
253
|
+
export const inspectReviewDeliveries = internalQuery({
|
|
254
|
+
args: { paginationOpts: paginationOptsValidator },
|
|
255
|
+
returns: paginationResultValidator(
|
|
256
|
+
docValidator("revenueCatDeliveries", revenueCatDeliveries),
|
|
257
|
+
),
|
|
258
|
+
handler: async (ctx, { paginationOpts }) => {
|
|
259
|
+
if (
|
|
260
|
+
!Number.isInteger(paginationOpts.numItems) ||
|
|
261
|
+
paginationOpts.numItems < 1 ||
|
|
262
|
+
paginationOpts.numItems > 100
|
|
263
|
+
)
|
|
264
|
+
throw new Error("Page size must be between 1 and 100");
|
|
265
|
+
return ctx.db
|
|
266
|
+
.query("revenueCatDeliveries")
|
|
267
|
+
.withIndex("by_type", (q) => q.eq("type", "review"))
|
|
268
|
+
.order("desc")
|
|
269
|
+
.paginate(paginationOpts);
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
|
|
243
273
|
export const receive = internalMutation({
|
|
244
274
|
args: { event: v.object(purchaseEventFields), balanceId: v.string() },
|
|
245
275
|
returns: v.string(),
|
|
@@ -22,6 +22,7 @@ export const revenueCatDeliveries = defineTable({
|
|
|
22
22
|
conflict: v.boolean(),
|
|
23
23
|
})
|
|
24
24
|
.index("by_delivery", ["project", "app", "environment", "deliveryId"])
|
|
25
|
+
.index("by_type", ["type"])
|
|
25
26
|
.index("by_conflict", ["conflict"]);
|
|
26
27
|
export const revenueCatPurchases = defineTable({
|
|
27
28
|
balanceId: v.string(),
|
|
@@ -29,6 +29,10 @@ The storage fallback flow (`flows/files.e2e.ts`) uses the same loopback/admin re
|
|
|
29
29
|
|
|
30
30
|
The connections browser flow additionally exercises invalid Autumn key submission when `E2E_CONNECTIONS_ENABLED=1`. Set a temporary `CONNECTIONS_ENCRYPTION_KEY` on the isolated backend for that run; the invalid input is rejected before any Autumn request. Restore the backend setting afterward.
|
|
31
31
|
|
|
32
|
+
## Published CLI OAuth qualification
|
|
33
|
+
|
|
34
|
+
The opt-in `cli-oauth.e2e.ts` flow defaults to a locally bundled CLI. To qualify a previously verified installed artifact, set `E2E_CLI_EXECUTABLE` to its absolute exported executable path and `E2E_CLI_OAUTH=1`, and use an owned fresh backend on 3530/3531 with `E2E_SDK_OWNERSHIP_FILE` as described in `helpers/sdk-auth/README.md`. The executable receives the loopback `DISPOSABL_API_ORIGIN` and a private credential directory. The caller must supervise the isolated web server, enforce outbound isolation and telemetry settings, verify artifact provenance and bytes, and ensure resources are free and exclusively owned. The flow launches login with `--no-browser`, checks the actual loopback callback binding, owner and release, and uses the consent UI. It checks logout and rejection of the revoked token; it does not test expiry or independently invalid tokens. Do not run this against shared or production infrastructure.
|
|
35
|
+
|
|
32
36
|
## Email provider verification
|
|
33
37
|
|
|
34
38
|
`bun run e2e run email-delivery.e2e.ts --target backend --retries 0` tests signup, email verification, a new login, and the verified account. It requires an isolated loopback backend configured with `RESEND_API_KEY` and `RESEND_FROM_EMAIL`, plus `E2E_RESEND_API_KEY` for reading the test message. This explicit provider test sends to a unique `delivered+…@resend.dev` address and polls Resend for that message and consumes one email from the sending quota. It never sends to a person. It skips when the test credential is absent. Keep credentials in the process environment and restore the backend configuration after this run before running username-based fixtures.
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
dispatchBalance,
|
|
25
25
|
dispatch,
|
|
26
26
|
routing,
|
|
27
|
+
inspectReviewDeliveries,
|
|
27
28
|
} from "../disposabl-kit/server/revenuecat-functions";
|
|
28
29
|
|
|
29
30
|
import { creditQuantity } from "../disposabl-kit/payments/config";
|
|
@@ -78,6 +79,27 @@ function fixture() {
|
|
|
78
79
|
};
|
|
79
80
|
filter(q);
|
|
80
81
|
return {
|
|
82
|
+
order: (direction: string) => ({
|
|
83
|
+
paginate: async (opts: {
|
|
84
|
+
cursor: string | null;
|
|
85
|
+
numItems: number;
|
|
86
|
+
}) => {
|
|
87
|
+
assert.equal(_index, "by_type");
|
|
88
|
+
assert.equal(direction, "desc");
|
|
89
|
+
const rows = tables[table]!.filter((row) =>
|
|
90
|
+
Object.entries(fields).every(
|
|
91
|
+
([key, value]) => row[key] === value,
|
|
92
|
+
),
|
|
93
|
+
).reverse();
|
|
94
|
+
const offset = Number(opts.cursor ?? 0);
|
|
95
|
+
const next = offset + opts.numItems;
|
|
96
|
+
return {
|
|
97
|
+
page: rows.slice(offset, next),
|
|
98
|
+
isDone: next >= rows.length,
|
|
99
|
+
continueCursor: String(next),
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
81
103
|
take: async (n: number) =>
|
|
82
104
|
tables[table]!.filter((row) =>
|
|
83
105
|
Object.entries(fields).every(
|
|
@@ -126,6 +148,72 @@ const scopedClaim = (balanceId: string) => ({
|
|
|
126
148
|
});
|
|
127
149
|
|
|
128
150
|
describe("RevenueCat consumable inbox", () => {
|
|
151
|
+
test("review delivery archive paginates independently of purchase state", async () => {
|
|
152
|
+
const f = fixture();
|
|
153
|
+
const id = await balanceId(event);
|
|
154
|
+
await call(receive, f.ctx, {
|
|
155
|
+
event: { ...event, type: "cancel" },
|
|
156
|
+
balanceId: id,
|
|
157
|
+
});
|
|
158
|
+
await call(receive, f.ctx, {
|
|
159
|
+
event: { ...event, deliveryId: "review-1", type: "review" },
|
|
160
|
+
balanceId: id,
|
|
161
|
+
});
|
|
162
|
+
await call(receive, f.ctx, {
|
|
163
|
+
event: { ...event, deliveryId: "review-2", type: "review" },
|
|
164
|
+
balanceId: id,
|
|
165
|
+
});
|
|
166
|
+
assert.equal(f.tables.revenueCatPurchases![0].state, "tombstone");
|
|
167
|
+
const first = await call(inspectReviewDeliveries, f.ctx, {
|
|
168
|
+
paginationOpts: { numItems: 1, cursor: null },
|
|
169
|
+
});
|
|
170
|
+
assert.deepEqual(
|
|
171
|
+
first.page.map((row: PurchaseEvent) => row.deliveryId),
|
|
172
|
+
["review-2"],
|
|
173
|
+
);
|
|
174
|
+
assert.equal(first.isDone, false);
|
|
175
|
+
const second = await call(inspectReviewDeliveries, f.ctx, {
|
|
176
|
+
paginationOpts: { numItems: 1, cursor: first.continueCursor },
|
|
177
|
+
});
|
|
178
|
+
assert.deepEqual(
|
|
179
|
+
second.page.map((row: PurchaseEvent) => row.deliveryId),
|
|
180
|
+
["review-1"],
|
|
181
|
+
);
|
|
182
|
+
assert.equal(second.isDone, true);
|
|
183
|
+
const refunded = fixture();
|
|
184
|
+
await call(receive, refunded.ctx, { event, balanceId: id });
|
|
185
|
+
await call(claim, refunded.ctx, scopedClaim(id));
|
|
186
|
+
await call(complete, refunded.ctx, { balanceId: id, kind: "grant" });
|
|
187
|
+
await call(receive, refunded.ctx, {
|
|
188
|
+
event: { ...event, deliveryId: "cancel", type: "cancel" },
|
|
189
|
+
balanceId: id,
|
|
190
|
+
});
|
|
191
|
+
await call(confirmFullRefund, refunded.ctx, {
|
|
192
|
+
balanceId: id,
|
|
193
|
+
evidence: "case 123",
|
|
194
|
+
});
|
|
195
|
+
await call(claim, refunded.ctx, scopedClaim(id));
|
|
196
|
+
await call(complete, refunded.ctx, { balanceId: id, kind: "refund" });
|
|
197
|
+
await call(receive, refunded.ctx, {
|
|
198
|
+
event: { ...event, deliveryId: "reversal", type: "review" },
|
|
199
|
+
balanceId: id,
|
|
200
|
+
});
|
|
201
|
+
assert.equal(refunded.tables.revenueCatPurchases![0].state, "refunded");
|
|
202
|
+
assert.equal(
|
|
203
|
+
refunded.tables.revenueCatPurchases![0].refundEvidence,
|
|
204
|
+
"case 123",
|
|
205
|
+
);
|
|
206
|
+
const archive = await call(inspectReviewDeliveries, refunded.ctx, {
|
|
207
|
+
paginationOpts: { numItems: 1, cursor: null },
|
|
208
|
+
});
|
|
209
|
+
assert.equal(archive.page[0].deliveryId, "reversal");
|
|
210
|
+
await assert.rejects(
|
|
211
|
+
call(inspectReviewDeliveries, f.ctx, {
|
|
212
|
+
paginationOpts: { numItems: 101, cursor: null },
|
|
213
|
+
}),
|
|
214
|
+
/Page size/,
|
|
215
|
+
);
|
|
216
|
+
});
|
|
129
217
|
test("managed monthly events are acknowledged only for valid, disjoint configured routes", async () => {
|
|
130
218
|
const monthly = { app: "app", store: "APP_STORE", product: "monthly" };
|
|
131
219
|
const env = {
|