@onesub/server 0.15.0 → 0.17.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.
Files changed (40) hide show
  1. package/dist/__tests__/apple-cert-chain.test.d.ts +17 -0
  2. package/dist/__tests__/apple-cert-chain.test.d.ts.map +1 -0
  3. package/dist/__tests__/openapi.test.d.ts +14 -0
  4. package/dist/__tests__/openapi.test.d.ts.map +1 -1
  5. package/dist/__tests__/receipt-age.test.d.ts +7 -0
  6. package/dist/__tests__/receipt-age.test.d.ts.map +1 -0
  7. package/dist/__tests__/secret-compare.test.d.ts +2 -0
  8. package/dist/__tests__/secret-compare.test.d.ts.map +1 -0
  9. package/dist/__tests__/webhook-queue-integration.test.d.ts +20 -0
  10. package/dist/__tests__/webhook-queue-integration.test.d.ts.map +1 -0
  11. package/dist/index.cjs +922 -446
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +19 -5
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +922 -449
  16. package/dist/index.js.map +1 -1
  17. package/dist/openapi.d.ts +4 -2
  18. package/dist/openapi.d.ts.map +1 -1
  19. package/dist/providers/apple.d.ts +20 -0
  20. package/dist/providers/apple.d.ts.map +1 -1
  21. package/dist/providers/google.d.ts.map +1 -1
  22. package/dist/providers/mock.d.ts.map +1 -1
  23. package/dist/routes/admin.d.ts.map +1 -1
  24. package/dist/routes/apple-offer.d.ts.map +1 -1
  25. package/dist/routes/metrics.d.ts.map +1 -1
  26. package/dist/routes/secret-compare.d.ts +11 -0
  27. package/dist/routes/secret-compare.d.ts.map +1 -0
  28. package/dist/routes/webhook-apple.d.ts +26 -1
  29. package/dist/routes/webhook-apple.d.ts.map +1 -1
  30. package/dist/routes/webhook-google.d.ts +33 -1
  31. package/dist/routes/webhook-google.d.ts.map +1 -1
  32. package/dist/routes/webhook.d.ts +9 -2
  33. package/dist/routes/webhook.d.ts.map +1 -1
  34. package/dist/stores/postgres.d.ts.map +1 -1
  35. package/dist/stores/redis.d.ts.map +1 -1
  36. package/dist/webhook-events.d.ts +15 -0
  37. package/dist/webhook-events.d.ts.map +1 -1
  38. package/dist/webhook-queue.d.ts +11 -3
  39. package/dist/webhook-queue.d.ts.map +1 -1
  40. package/package.json +5 -3
@@ -0,0 +1,17 @@
1
+ /**
2
+ * BasicConstraints enforcement for x5c issuer certificates.
3
+ *
4
+ * `verifyAppleCertChain` walks the JWS x5c chain and every certificate that
5
+ * SIGNS another one (index >= 1, plus the bundled Apple root when used as
6
+ * issuer) must carry basicConstraints CA=true — otherwise an Apple-issued
7
+ * leaf certificate could sign a forged leaf and splice it into a chain that
8
+ * still terminates at the trusted root.
9
+ *
10
+ * Node's crypto module cannot mint X.509 certificates, so building a real
11
+ * malicious chain in-test would require an external CA dependency. Instead
12
+ * the constraint check lives in the exported pure function
13
+ * `assertIssuerCanSign`, unit-tested here directly (mock-shaped objects for
14
+ * the negative path, the real bundled Apple root for the positive path).
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=apple-cert-chain.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-cert-chain.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/apple-cert-chain.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,2 +1,16 @@
1
+ /**
2
+ * OpenAPI parity tests.
3
+ *
4
+ * The spec (openapi.ts) is hand-maintained, so the guard here has to be
5
+ * mechanical: mount EVERY router via `createOneSubMiddleware` (adminSecret +
6
+ * entitlements + both mock platforms + offer keys + a DLQ-capable queue so
7
+ * every conditional router mounts), walk the express router stack to extract
8
+ * each registered path+method, and assert both directions:
9
+ *
10
+ * 1. every mounted route is documented (no undocumented endpoints)
11
+ * 2. every documented path is actually mounted (no stale spec entries)
12
+ *
13
+ * Express params (`:userId`) are normalized to OpenAPI form (`{userId}`).
14
+ */
1
15
  export {};
2
16
  //# sourceMappingURL=openapi.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/openapi.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"openapi.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/openapi.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * productReceiptMaxAgeHours — the one-time-purchase replay window is
3
+ * configurable (default 72h) so historical receipts can be validated on
4
+ * purpose (backend migrations, e2e against real store transactions).
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=receipt-age.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt-age.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/receipt-age.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=secret-compare.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-compare.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/secret-compare.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Integration tests for the webhook queue wiring (config.webhookQueue).
3
+ *
4
+ * Covers:
5
+ * - Queue mode: gating runs inline, decoded work is enqueued, the handler
6
+ * registered in createWebhookRouter applies the state change (Apple + Google)
7
+ * - Queue mode gating: invalid payloads 400 inline and are never enqueued;
8
+ * duplicate event ids are deduped without a second job
9
+ * - Job payloads survive a JSON round-trip (BullMQ ships them through Redis)
10
+ * - Enqueue failure → 500 + unmark, so the source retry is processed
11
+ * - Handler (job) failure does NOT unmark — the queue's retries/dead-letter
12
+ * own recovery, and a source retry must stay deduped
13
+ * - InProcessWebhookQueue works as a configured queue (synchronous inline run)
14
+ * - Full middleware wiring via createOneSubMiddleware, including the admin
15
+ * dead-letter endpoint reading from the configured queue
16
+ * - BullMQWebhookQueue.setHandler without bullmq installed: no unhandled
17
+ * rejection; the startup error surfaces on the next enqueue()
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=webhook-queue-integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-queue-integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/webhook-queue-integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}