@onesub/server 0.21.1 → 0.22.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.
@@ -24,6 +24,35 @@ export type GoogleWebhookWork = {
24
24
  kind: 'subscription';
25
25
  notification: DecodedGoogleSubscriptionNotification;
26
26
  };
27
+ /**
28
+ * Whether this config serves Google Play at all — top-level `google`, or any
29
+ * entry in `apps[]` with a `google` block.
30
+ *
31
+ * Single source of truth for two decisions that have to agree: whether
32
+ * `createWebhookRouter` mounts `POST /onesub/webhook/google`, and whether
33
+ * `warnIfGoogleWebhookOpen` has anything to warn about. If they disagreed, a
34
+ * deployment would either be warned about a route it does not expose, or expose
35
+ * one nothing warned about.
36
+ */
37
+ export declare function servesGoogle(config: OneSubServerConfig): boolean;
38
+ /**
39
+ * Startup check for the two conditions that leave `POST /onesub/webhook/google`
40
+ * open. Called once from `createOneSubMiddleware`; warns rather than throws
41
+ * because rejecting would break deployments that front the route with their own
42
+ * Pub/Sub verification.
43
+ *
44
+ * Gated on `NODE_ENV=production` for the same reason the mockMode guard is:
45
+ * neither condition is meaningful locally, where no real RTDN arrives, and
46
+ * warning unconditionally would fire on nearly every test and drown itself out.
47
+ *
48
+ * Why it matters. The subscription paths re-fetch state from Google before
49
+ * writing, so a forged notification cannot fabricate an entitlement. The voided
50
+ * path does not: it acts on the payload alone, setting a subscription to
51
+ * `canceled` by `purchaseToken` or deleting a one-time purchase row by
52
+ * `orderId`. So the exposure is entitlement *revocation* for a caller who knows
53
+ * or guesses one of those ids — not free entitlement.
54
+ */
55
+ export declare function warnIfGoogleWebhookOpen(config: OneSubServerConfig): void;
27
56
  /**
28
57
  * State-mutating half of the Google webhook: everything AFTER the gate
29
58
  * (push-token auth, body validation, idempotency markIfNew, packageName
@@ -1 +1 @@
1
- {"version":3,"file":"webhook-google.d.ts","sourceRoot":"","sources":["../../src/routes/webhook-google.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EA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M,EAAE,kBAAkB,GAAG,OAAO,CAEhE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CA4BxE;AAuBD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB,EACxB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,IAAI,CAAC,CAmIf;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB,EACxB,aAAa,EAAE,aAAa,EAC5B,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,IAAI,CAAC,CAmIf"}
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/routes/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMxD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB,EACxB,aAAa,EAAE,aAAa,EAC5B,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,YAAY,CAAC,EAAE,YAAY,GAC1B,MAAM,CAyBR"}
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/routes/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMxD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,iBAAiB,EACxB,aAAa,EAAE,aAAa,EAC5B,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,YAAY,CAAC,EAAE,YAAY,GAC1B,MAAM,CAuCR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesub/server",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "description": "Server-side receipt validation middleware for react-native-iap. Apple StoreKit 2 + Google Play Billing. One line.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",