@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.
- package/dist/__tests__/apple-cert-chain.test.d.ts +17 -0
- package/dist/__tests__/apple-cert-chain.test.d.ts.map +1 -0
- package/dist/__tests__/openapi.test.d.ts +14 -0
- package/dist/__tests__/openapi.test.d.ts.map +1 -1
- package/dist/__tests__/receipt-age.test.d.ts +7 -0
- package/dist/__tests__/receipt-age.test.d.ts.map +1 -0
- package/dist/__tests__/secret-compare.test.d.ts +2 -0
- package/dist/__tests__/secret-compare.test.d.ts.map +1 -0
- package/dist/__tests__/webhook-queue-integration.test.d.ts +20 -0
- package/dist/__tests__/webhook-queue-integration.test.d.ts.map +1 -0
- package/dist/index.cjs +922 -446
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +922 -449
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +4 -2
- package/dist/openapi.d.ts.map +1 -1
- package/dist/providers/apple.d.ts +20 -0
- package/dist/providers/apple.d.ts.map +1 -1
- package/dist/providers/google.d.ts.map +1 -1
- package/dist/providers/mock.d.ts.map +1 -1
- package/dist/routes/admin.d.ts.map +1 -1
- package/dist/routes/apple-offer.d.ts.map +1 -1
- package/dist/routes/metrics.d.ts.map +1 -1
- package/dist/routes/secret-compare.d.ts +11 -0
- package/dist/routes/secret-compare.d.ts.map +1 -0
- package/dist/routes/webhook-apple.d.ts +26 -1
- package/dist/routes/webhook-apple.d.ts.map +1 -1
- package/dist/routes/webhook-google.d.ts +33 -1
- package/dist/routes/webhook-google.d.ts.map +1 -1
- package/dist/routes/webhook.d.ts +9 -2
- package/dist/routes/webhook.d.ts.map +1 -1
- package/dist/stores/postgres.d.ts.map +1 -1
- package/dist/stores/redis.d.ts.map +1 -1
- package/dist/webhook-events.d.ts +15 -0
- package/dist/webhook-events.d.ts.map +1 -1
- package/dist/webhook-queue.d.ts +11 -3
- package/dist/webhook-queue.d.ts.map +1 -1
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -34,10 +34,20 @@ export interface OneSubMiddlewareConfig extends OneSubServerConfig {
|
|
|
34
34
|
*/
|
|
35
35
|
webhookEventStore?: WebhookEventStore;
|
|
36
36
|
/**
|
|
37
|
-
* Async webhook queue. Default:
|
|
38
|
-
* route latency = handler latency
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* Async webhook queue. Default: none — webhook routes process notifications
|
|
38
|
+
* synchronously inside the request (route latency = handler latency;
|
|
39
|
+
* Apple/Google source retries on 5xx are the durability layer).
|
|
40
|
+
*
|
|
41
|
+
* When set, the webhook routes keep the cheap gating inline (validation,
|
|
42
|
+
* JWS/push-token verification, bundleId/packageName checks, idempotency
|
|
43
|
+
* dedup) and `enqueue()` the decoded work, acking 200 as soon as the job is
|
|
44
|
+
* accepted. The state-mutating processing runs in the queue handler, which
|
|
45
|
+
* is registered once here at middleware creation via `setHandler()`.
|
|
46
|
+
*
|
|
47
|
+
* Pass a `BullMQWebhookQueue` for durable retries with backoff; jobs that
|
|
48
|
+
* exhaust their attempts land in the dead-letter list, accessible via
|
|
49
|
+
* `GET /onesub/admin/webhook-deadletters` and replayable via
|
|
50
|
+
* `POST /onesub/admin/webhook-replay/:id` (requires `adminSecret`).
|
|
41
51
|
*/
|
|
42
52
|
webhookQueue?: WebhookQueue;
|
|
43
53
|
}
|
|
@@ -75,9 +85,13 @@ export { RedisSubscriptionStore, RedisPurchaseStore, RedisCacheAdapter, RedisWeb
|
|
|
75
85
|
export type { CacheAdapter } from './cache.js';
|
|
76
86
|
export { InMemoryCacheAdapter, getDefaultCache, setDefaultCache } from './cache.js';
|
|
77
87
|
export type { WebhookEventStore } from './webhook-events.js';
|
|
78
|
-
export { InMemoryWebhookEventStore, CacheWebhookEventStore } from './webhook-events.js';
|
|
88
|
+
export { InMemoryWebhookEventStore, CacheWebhookEventStore, unmarkWebhookEvent } from './webhook-events.js';
|
|
79
89
|
export type { WebhookQueue, WebhookJob, WebhookHandler, DeadLetterRecord } from './webhook-queue.js';
|
|
80
90
|
export { InProcessWebhookQueue, BullMQWebhookQueue } from './webhook-queue.js';
|
|
91
|
+
export { processAppleNotification } from './routes/webhook-apple.js';
|
|
92
|
+
export type { AppleWebhookWork } from './routes/webhook-apple.js';
|
|
93
|
+
export { processGoogleNotification } from './routes/webhook-google.js';
|
|
94
|
+
export type { GoogleWebhookWork } from './routes/webhook-google.js';
|
|
81
95
|
export { ONESUB_OPENAPI, openapiHandler } from './openapi.js';
|
|
82
96
|
export type { OpenAPIDoc } from './openapi.js';
|
|
83
97
|
export { withSpan } from './tracing.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sour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