@zonastery/bursar 2.0.3 → 2.0.4
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/billing/auto-recharge-port.d.ts +3 -2
- package/dist/billing/auto-recharge-port.d.ts.map +1 -1
- package/dist/billing/auto-recharge-port.js.map +1 -1
- package/dist/billing/auto-recharge-service.js +3 -3
- package/dist/billing/auto-recharge-service.js.map +1 -1
- package/dist/billing/billing-service.d.ts +3 -2
- package/dist/billing/billing-service.d.ts.map +1 -1
- package/dist/billing/billing-service.js +2 -10
- package/dist/billing/billing-service.js.map +1 -1
- package/dist/billing/billing-store.d.ts +6 -6
- package/dist/billing/billing-store.d.ts.map +1 -1
- package/dist/billing/billing-store.js.map +1 -1
- package/dist/billing/contracts.d.ts +8 -7
- package/dist/billing/contracts.d.ts.map +1 -1
- package/dist/billing/contracts.js.map +1 -1
- package/dist/billing/event-handlers.d.ts +5 -9
- package/dist/billing/event-handlers.d.ts.map +1 -1
- package/dist/billing/event-handlers.js +191 -285
- package/dist/billing/event-handlers.js.map +1 -1
- package/dist/billing/event-processor.d.ts +1 -1
- package/dist/billing/event-processor.d.ts.map +1 -1
- package/dist/billing/event-processor.js +32 -23
- package/dist/billing/event-processor.js.map +1 -1
- package/dist/billing/financial-event-handlers.d.ts +3 -9
- package/dist/billing/financial-event-handlers.d.ts.map +1 -1
- package/dist/billing/financial-event-handlers.js +10 -12
- package/dist/billing/financial-event-handlers.js.map +1 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/management.d.ts +3 -2
- package/dist/billing/management.d.ts.map +1 -1
- package/dist/billing/management.js.map +1 -1
- package/dist/billing/postgres/repositories/auto-recharge.d.ts +2 -1
- package/dist/billing/postgres/repositories/auto-recharge.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/auto-recharge.js +58 -40
- package/dist/billing/postgres/repositories/auto-recharge.js.map +1 -1
- package/dist/billing/postgres/repositories/dispute.d.ts +2 -1
- package/dist/billing/postgres/repositories/dispute.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/dispute.js.map +1 -1
- package/dist/billing/postgres/repositories/event.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/event.js.map +1 -1
- package/dist/billing/postgres/repositories/invoice.d.ts +2 -1
- package/dist/billing/postgres/repositories/invoice.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/invoice.js +8 -12
- package/dist/billing/postgres/repositories/invoice.js.map +1 -1
- package/dist/billing/postgres/repositories/offer.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/offer.js +5 -0
- package/dist/billing/postgres/repositories/offer.js.map +1 -1
- package/dist/billing/postgres/repositories/payment.d.ts +1 -1
- package/dist/billing/postgres/repositories/payment.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/payment.js +1 -1
- package/dist/billing/postgres/repositories/payment.js.map +1 -1
- package/dist/billing/postgres/repositories/subscription-change.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/subscription-change.js +1 -9
- package/dist/billing/postgres/repositories/subscription-change.js.map +1 -1
- package/dist/billing/postgres/repositories/subscription.d.ts +6 -6
- package/dist/billing/postgres/repositories/subscription.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/subscription.js +29 -30
- package/dist/billing/postgres/repositories/subscription.js.map +1 -1
- package/dist/billing/postgres/store.d.ts +6 -5
- package/dist/billing/postgres/store.d.ts.map +1 -1
- package/dist/billing/postgres/store.js +15 -13
- package/dist/billing/postgres/store.js.map +1 -1
- package/dist/billing/types/auto-recharge.d.ts +2 -1
- package/dist/billing/types/auto-recharge.d.ts.map +1 -1
- package/dist/billing/types/auto-recharge.js.map +1 -1
- package/dist/billing/types/documents.d.ts +2 -1
- package/dist/billing/types/documents.d.ts.map +1 -1
- package/dist/billing/types/documents.js.map +1 -1
- package/dist/billing/types/events.d.ts +3 -2
- package/dist/billing/types/events.d.ts.map +1 -1
- package/dist/billing/types/events.js +73 -39
- package/dist/billing/types/events.js.map +1 -1
- package/dist/billing/types/subscriptions.d.ts +4 -1
- package/dist/billing/types/subscriptions.d.ts.map +1 -1
- package/dist/billing/types/subscriptions.js.map +1 -1
- package/dist/breakdown.d.ts +3 -2
- package/dist/breakdown.d.ts.map +1 -1
- package/dist/breakdown.js.map +1 -1
- package/dist/bursar.d.ts.map +1 -1
- package/dist/bursar.js +4 -3
- package/dist/bursar.js.map +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +45 -42
- package/dist/catalog.js.map +1 -1
- package/dist/commerce/provider-registry.d.ts.map +1 -1
- package/dist/commerce/provider-registry.js +11 -6
- package/dist/commerce/provider-registry.js.map +1 -1
- package/dist/commerce/service.d.ts.map +1 -1
- package/dist/commerce/service.js +16 -22
- package/dist/commerce/service.js.map +1 -1
- package/dist/commerce/types.d.ts.map +1 -1
- package/dist/commerce/types.js.map +1 -1
- package/dist/config/parse-access.d.ts +5 -2
- package/dist/config/parse-access.d.ts.map +1 -1
- package/dist/config/parse-access.js +60 -41
- package/dist/config/parse-access.js.map +1 -1
- package/dist/config/parse-commerce.d.ts +2 -1
- package/dist/config/parse-commerce.d.ts.map +1 -1
- package/dist/config/parse-commerce.js +49 -29
- package/dist/config/parse-commerce.js.map +1 -1
- package/dist/config/parse-credits.d.ts +2 -1
- package/dist/config/parse-credits.d.ts.map +1 -1
- package/dist/config/parse-credits.js +39 -23
- package/dist/config/parse-credits.js.map +1 -1
- package/dist/config/parse-plans.d.ts +7 -2
- package/dist/config/parse-plans.d.ts.map +1 -1
- package/dist/config/parse-plans.js +49 -22
- package/dist/config/parse-plans.js.map +1 -1
- package/dist/config/parse-pricing.d.ts +2 -1
- package/dist/config/parse-pricing.d.ts.map +1 -1
- package/dist/config/parse-pricing.js +41 -31
- package/dist/config/parse-pricing.js.map +1 -1
- package/dist/config/parse-utils.d.ts +15 -11
- package/dist/config/parse-utils.d.ts.map +1 -1
- package/dist/config/parse-utils.js +90 -27
- package/dist/config/parse-utils.js.map +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +6 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -35
- package/dist/config.js.map +1 -1
- package/dist/credits/amount.d.ts +1 -1
- package/dist/credits/amount.d.ts.map +1 -1
- package/dist/credits/amount.js +5 -4
- package/dist/credits/amount.js.map +1 -1
- package/dist/credits/catalog-runtime.d.ts.map +1 -1
- package/dist/credits/catalog-runtime.js +2 -3
- package/dist/credits/catalog-runtime.js.map +1 -1
- package/dist/credits/events.d.ts +12 -1
- package/dist/credits/events.d.ts.map +1 -1
- package/dist/credits/events.js +35 -21
- package/dist/credits/events.js.map +1 -1
- package/dist/credits/lease-workflow.d.ts +2 -1
- package/dist/credits/lease-workflow.d.ts.map +1 -1
- package/dist/credits/lease-workflow.js +3 -2
- package/dist/credits/lease-workflow.js.map +1 -1
- package/dist/credits/low-balance-monitor.d.ts +2 -1
- package/dist/credits/low-balance-monitor.d.ts.map +1 -1
- package/dist/credits/low-balance-monitor.js.map +1 -1
- package/dist/credits/postgres/repositories/analytics.d.ts +2 -2
- package/dist/credits/postgres/repositories/analytics.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/analytics.js +14 -6
- package/dist/credits/postgres/repositories/analytics.js.map +1 -1
- package/dist/credits/postgres/repositories/balance.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/balance.js +6 -6
- package/dist/credits/postgres/repositories/balance.js.map +1 -1
- package/dist/credits/postgres/repositories/catalog.d.ts +4 -3
- package/dist/credits/postgres/repositories/catalog.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/catalog.js +4 -3
- package/dist/credits/postgres/repositories/catalog.js.map +1 -1
- package/dist/credits/postgres/repositories/deduction.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/deduction.js +2 -2
- package/dist/credits/postgres/repositories/deduction.js.map +1 -1
- package/dist/credits/postgres/repositories/plan.d.ts +1 -1
- package/dist/credits/postgres/store.d.ts +3 -2
- package/dist/credits/postgres/store.d.ts.map +1 -1
- package/dist/credits/postgres/store.js +17 -10
- package/dist/credits/postgres/store.js.map +1 -1
- package/dist/credits/postgres/value-mappers.d.ts +4 -3
- package/dist/credits/postgres/value-mappers.d.ts.map +1 -1
- package/dist/credits/postgres/value-mappers.js +10 -11
- package/dist/credits/postgres/value-mappers.js.map +1 -1
- package/dist/credits/service.d.ts.map +1 -1
- package/dist/credits/service.js +10 -5
- package/dist/credits/service.js.map +1 -1
- package/dist/credits/store.d.ts +5 -4
- package/dist/credits/store.d.ts.map +1 -1
- package/dist/credits/store.js.map +1 -1
- package/dist/credits/types/account.d.ts +5 -4
- package/dist/credits/types/account.d.ts.map +1 -1
- package/dist/credits/types/account.js.map +1 -1
- package/dist/credits/types/catalog.d.ts +2 -1
- package/dist/credits/types/catalog.d.ts.map +1 -1
- package/dist/credits/types/catalog.js.map +1 -1
- package/dist/credits/types/grants.d.ts.map +1 -1
- package/dist/credits/types/grants.js.map +1 -1
- package/dist/credits/types/ledger.d.ts +3 -2
- package/dist/credits/types/ledger.d.ts.map +1 -1
- package/dist/credits/types/ledger.js.map +1 -1
- package/dist/engine.d.ts +2 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +39 -10
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +7 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -11
- package/dist/errors.js.map +1 -1
- package/dist/expr/ast.d.ts.map +1 -1
- package/dist/expr/ast.js.map +1 -1
- package/dist/expr/parser.d.ts.map +1 -1
- package/dist/expr/parser.js.map +1 -1
- package/dist/expr/tokenizer.d.ts.map +1 -1
- package/dist/expr/tokenizer.js +34 -12
- package/dist/expr/tokenizer.js.map +1 -1
- package/dist/expr.d.ts.map +1 -1
- package/dist/expr.js +12 -6
- package/dist/expr.js.map +1 -1
- package/dist/generated/pricing-config.types.d.ts.map +1 -1
- package/dist/generated/pricing-config.types.js.map +1 -1
- package/dist/integrations/better-auth.d.ts +4 -1
- package/dist/integrations/better-auth.d.ts.map +1 -1
- package/dist/integrations/better-auth.js +7 -4
- package/dist/integrations/better-auth.js.map +1 -1
- package/dist/load-config-file.d.ts +2 -1
- package/dist/load-config-file.d.ts.map +1 -1
- package/dist/load-config-file.js +19 -13
- package/dist/load-config-file.js.map +1 -1
- package/dist/metrics.d.ts +2 -1
- package/dist/metrics.d.ts.map +1 -1
- package/dist/metrics.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js.map +1 -1
- package/dist/providers/_shared.d.ts +8 -5
- package/dist/providers/_shared.d.ts.map +1 -1
- package/dist/providers/_shared.js +15 -11
- package/dist/providers/_shared.js.map +1 -1
- package/dist/providers/dodo/better-auth-core.d.ts +32 -0
- package/dist/providers/dodo/better-auth-core.d.ts.map +1 -0
- package/dist/providers/dodo/better-auth-core.js +14 -0
- package/dist/providers/dodo/better-auth-core.js.map +1 -0
- package/dist/providers/dodo/better-auth.d.ts +5 -7
- package/dist/providers/dodo/better-auth.d.ts.map +1 -1
- package/dist/providers/dodo/better-auth.js +16 -13
- package/dist/providers/dodo/better-auth.js.map +1 -1
- package/dist/providers/dodo/client-contract.d.ts +11 -10
- package/dist/providers/dodo/client-contract.d.ts.map +1 -1
- package/dist/providers/dodo/client-contract.js.map +1 -1
- package/dist/providers/dodo/event-mapper.d.ts +7 -4
- package/dist/providers/dodo/event-mapper.d.ts.map +1 -1
- package/dist/providers/dodo/event-mapper.js +121 -113
- package/dist/providers/dodo/event-mapper.js.map +1 -1
- package/dist/providers/dodo/nextjs-core.d.ts +22 -0
- package/dist/providers/dodo/nextjs-core.d.ts.map +1 -0
- package/dist/providers/dodo/nextjs-core.js +14 -0
- package/dist/providers/dodo/nextjs-core.js.map +1 -0
- package/dist/providers/dodo/nextjs.d.ts +5 -7
- package/dist/providers/dodo/nextjs.d.ts.map +1 -1
- package/dist/providers/dodo/nextjs.js +11 -10
- package/dist/providers/dodo/nextjs.js.map +1 -1
- package/dist/providers/dodo/provider.d.ts +3 -3
- package/dist/providers/dodo/provider.d.ts.map +1 -1
- package/dist/providers/dodo/provider.js +42 -35
- package/dist/providers/dodo/provider.js.map +1 -1
- package/dist/providers/dodo/react-native-core.d.ts +56 -0
- package/dist/providers/dodo/react-native-core.d.ts.map +1 -0
- package/dist/providers/dodo/react-native-core.js +56 -0
- package/dist/providers/dodo/react-native-core.js.map +1 -0
- package/dist/providers/dodo/react-native.d.ts +6 -50
- package/dist/providers/dodo/react-native.d.ts.map +1 -1
- package/dist/providers/dodo/react-native.js +5 -49
- package/dist/providers/dodo/react-native.js.map +1 -1
- package/dist/providers/dodo/webhook-bridge.d.ts +4 -2
- package/dist/providers/dodo/webhook-bridge.d.ts.map +1 -1
- package/dist/providers/dodo/webhook-bridge.js.map +1 -1
- package/dist/providers/environment.d.ts +1 -1
- package/dist/providers/environment.d.ts.map +1 -1
- package/dist/providers/environment.js +4 -2
- package/dist/providers/environment.js.map +1 -1
- package/dist/providers/mock/provider.d.ts.map +1 -1
- package/dist/providers/mock/provider.js +5 -10
- package/dist/providers/mock/provider.js.map +1 -1
- package/dist/providers/stripe/event-mapper.d.ts.map +1 -1
- package/dist/providers/stripe/event-mapper.js +33 -9
- package/dist/providers/stripe/event-mapper.js.map +1 -1
- package/dist/providers/stripe/provider.d.ts.map +1 -1
- package/dist/providers/stripe/provider.js +100 -60
- package/dist/providers/stripe/provider.js.map +1 -1
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js.map +1 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +16 -9
- package/dist/retry.js.map +1 -1
- package/dist/shared/diagnostics.d.ts +5 -5
- package/dist/shared/diagnostics.d.ts.map +1 -1
- package/dist/shared/diagnostics.js +32 -22
- package/dist/shared/diagnostics.js.map +1 -1
- package/dist/shared/idempotency.d.ts +4 -3
- package/dist/shared/idempotency.d.ts.map +1 -1
- package/dist/shared/idempotency.js +21 -10
- package/dist/shared/idempotency.js.map +1 -1
- package/dist/shared/json.d.ts +28 -0
- package/dist/shared/json.d.ts.map +1 -0
- package/dist/shared/json.js +41 -0
- package/dist/shared/json.js.map +1 -0
- package/dist/shared/logger.d.ts +10 -4
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/logger.js.map +1 -1
- package/dist/shared/postgres-client.d.ts +8 -6
- package/dist/shared/postgres-client.d.ts.map +1 -1
- package/dist/shared/postgres-client.js +69 -47
- package/dist/shared/postgres-client.js.map +1 -1
- package/dist/shared/postgres-errors.d.ts +1 -1
- package/dist/shared/postgres-errors.d.ts.map +1 -1
- package/dist/shared/postgres-errors.js +32 -31
- package/dist/shared/postgres-errors.js.map +1 -1
- package/dist/shared/postgres-types.d.ts +3 -2
- package/dist/shared/postgres-types.d.ts.map +1 -1
- package/dist/shared/postgres-types.js.map +1 -1
- package/dist/shared/postgres-validation.d.ts +7 -6
- package/dist/shared/postgres-validation.d.ts.map +1 -1
- package/dist/shared/postgres-validation.js +17 -10
- package/dist/shared/postgres-validation.js.map +1 -1
- package/dist/storage/adapters/clickhouse.d.ts +11 -4
- package/dist/storage/adapters/clickhouse.d.ts.map +1 -1
- package/dist/storage/adapters/clickhouse.js +8 -6
- package/dist/storage/adapters/clickhouse.js.map +1 -1
- package/dist/storage/adapters/s3.d.ts +28 -5
- package/dist/storage/adapters/s3.d.ts.map +1 -1
- package/dist/storage/adapters/s3.js +48 -33
- package/dist/storage/adapters/s3.js.map +1 -1
- package/dist/storage/diagnostics.d.ts +1 -1
- package/dist/storage/diagnostics.js +13 -12
- package/dist/storage/diagnostics.js.map +1 -1
- package/dist/storage/maintenance.d.ts.map +1 -1
- package/dist/storage/maintenance.js +31 -25
- package/dist/storage/maintenance.js.map +1 -1
- package/dist/storage/outbox-worker.d.ts +1 -1
- package/dist/storage/outbox-worker.js +18 -18
- package/dist/storage/outbox-worker.js.map +1 -1
- package/dist/storage/ports.d.ts +10 -7
- package/dist/storage/ports.d.ts.map +1 -1
- package/dist/storage/ports.js.map +1 -1
- package/dist/storage/postgres-repository.d.ts +3 -1
- package/dist/storage/postgres-repository.d.ts.map +1 -1
- package/dist/storage/postgres-repository.js +10 -4
- package/dist/storage/postgres-repository.js.map +1 -1
- package/dist/storage/runtime.d.ts +1 -1
- package/dist/storage/runtime.d.ts.map +1 -1
- package/dist/storage/runtime.js +165 -182
- package/dist/storage/runtime.js.map +1 -1
- package/dist/telemetry/index.d.ts +10 -6
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +26 -23
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/opentelemetry.js +3 -3
- package/dist/telemetry/opentelemetry.js.map +1 -1
- package/package.json +14 -14
package/dist/load-config-file.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { readFileSync, statSync } from "fs";
|
|
2
2
|
import { extname } from "path";
|
|
3
3
|
import { load as parseYaml } from "js-yaml";
|
|
4
|
+
import { z } from "zod";
|
|
4
5
|
import { ConfigError } from "./errors.js";
|
|
6
|
+
import { isJsonObject } from "./shared/json.js";
|
|
5
7
|
function parseJsonWithUniqueKeys(content) {
|
|
6
|
-
const parsed = JSON.parse(content);
|
|
8
|
+
const parsed = z.json().parse(JSON.parse(content));
|
|
7
9
|
// JSON is a strict subset of YAML. js-yaml retains source-level mapping
|
|
8
10
|
// keys and rejects duplicates, including nested and escape-equivalent keys;
|
|
9
11
|
// native JSON.parse above remains the authority for strict JSON syntax and
|
|
@@ -22,12 +24,13 @@ function readFileClean(filepath) {
|
|
|
22
24
|
stat = statSync(filepath);
|
|
23
25
|
}
|
|
24
26
|
catch (cause) {
|
|
25
|
-
const code = cause.code;
|
|
27
|
+
const code = z.object({ code: z.string().optional() }).safeParse(cause).data?.code;
|
|
26
28
|
if (code === "ENOENT")
|
|
27
29
|
throw new ConfigError(`Config file not found: ${filepath}`);
|
|
28
30
|
if (code === "EACCES")
|
|
29
31
|
throw new ConfigError(`Permission denied: ${filepath}`);
|
|
30
|
-
|
|
32
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
33
|
+
throw new ConfigError(`Could not read ${filepath}: ${message}`, [], { cause });
|
|
31
34
|
}
|
|
32
35
|
if (stat.isDirectory()) {
|
|
33
36
|
throw new ConfigError(`Not a file (is a directory): ${filepath}`);
|
|
@@ -36,7 +39,8 @@ function readFileClean(filepath) {
|
|
|
36
39
|
return readFileSync(filepath, "utf-8");
|
|
37
40
|
}
|
|
38
41
|
catch (cause) {
|
|
39
|
-
|
|
42
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
43
|
+
throw new ConfigError(`Could not read ${filepath}: ${message}`, [], { cause });
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
/** Guard against an empty file or a non-object parse result (e.g. an empty YAML document). */
|
|
@@ -44,8 +48,8 @@ function assertNonEmptyObject(data, filepath) {
|
|
|
44
48
|
if (data == null) {
|
|
45
49
|
throw new ConfigError(`Bursar config is empty: ${filepath}`);
|
|
46
50
|
}
|
|
47
|
-
if (
|
|
48
|
-
throw new ConfigError(`Bursar config must be a JSON/YAML object
|
|
51
|
+
if (!isJsonObject(data)) {
|
|
52
|
+
throw new ConfigError(`Bursar config must be a JSON/YAML object: ${filepath}`);
|
|
49
53
|
}
|
|
50
54
|
if (Object.keys(data).length === 0) {
|
|
51
55
|
throw new ConfigError(`Bursar config is empty: ${filepath}`);
|
|
@@ -70,12 +74,15 @@ export async function loadConfigFile(filepath) {
|
|
|
70
74
|
const content = readFileClean(filepath);
|
|
71
75
|
let parsed;
|
|
72
76
|
try {
|
|
73
|
-
|
|
77
|
+
const yamlValue = parseYaml(content, { json: false });
|
|
78
|
+
const jsonValue = z.json().safeParse(yamlValue);
|
|
79
|
+
if (!jsonValue.success)
|
|
80
|
+
throw new ConfigError("YAML document must contain JSON values");
|
|
81
|
+
parsed = jsonValue.data;
|
|
74
82
|
}
|
|
75
83
|
catch (cause) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
84
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
85
|
+
throw new ConfigError(`Invalid YAML in ${filepath}: ${message}`, [], { cause });
|
|
79
86
|
}
|
|
80
87
|
return assertNonEmptyObject(parsed, filepath);
|
|
81
88
|
}
|
|
@@ -85,9 +92,8 @@ export async function loadConfigFile(filepath) {
|
|
|
85
92
|
parsed = parseJsonWithUniqueKeys(content);
|
|
86
93
|
}
|
|
87
94
|
catch (cause) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
95
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
96
|
+
throw new ConfigError(`Invalid JSON in ${filepath}: ${message}`, [], { cause });
|
|
91
97
|
}
|
|
92
98
|
return assertNonEmptyObject(parsed, filepath);
|
|
93
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config-file.js","sourceRoot":"","sources":["../src/load-config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"load-config-file.js","sourceRoot":"","sources":["../src/load-config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAmC,MAAM,kBAAkB,CAAC;AAEjF,SAAS,uBAAuB,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E,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import { readFileSync, statSync } from \"fs\";\nimport { extname } from \"path\";\nimport { load as parseYaml } from \"js-yaml\";\nimport { z } from \"zod\";\nimport { ConfigError } from \"./errors.js\";\nimport { isJsonObject, type JsonObject, type JsonValue } from \"./shared/json.js\";\n\nfunction parseJsonWithUniqueKeys(content: string): JsonValue {\n const parsed = z.json().parse(JSON.parse(content));\n // JSON is a strict subset of YAML. js-yaml retains source-level mapping\n // keys and rejects duplicates, including nested and escape-equivalent keys;\n // native JSON.parse above remains the authority for strict JSON syntax and\n // for the returned JavaScript value.\n parseYaml(content, { json: false });\n return parsed;\n}\n\n/**\n * Read a file's contents, converting missing-file/directory/permission\n * failures into a clean {@link ConfigError} instead of a raw Node `fs` error\n * (mirrors the Python CLI's `_load_config_file`).\n */\nfunction readFileClean(filepath: string): string {\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(filepath);\n } catch (cause) {\n const code = z.object({ code: z.string().optional() }).safeParse(cause).data?.code;\n if (code === \"ENOENT\") throw new ConfigError(`Config file not found: ${filepath}`);\n if (code === \"EACCES\") throw new ConfigError(`Permission denied: ${filepath}`);\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new ConfigError(`Could not read ${filepath}: ${message}`, [], { cause });\n }\n if (stat.isDirectory()) {\n throw new ConfigError(`Not a file (is a directory): ${filepath}`);\n }\n try {\n return readFileSync(filepath, \"utf-8\");\n } catch (cause) {\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new ConfigError(`Could not read ${filepath}: ${message}`, [], { cause });\n }\n}\n\n/** Guard against an empty file or a non-object parse result (e.g. an empty YAML document). */\nfunction assertNonEmptyObject(data: JsonValue | undefined, filepath: string): JsonObject {\n if (data == null) {\n throw new ConfigError(`Bursar config is empty: ${filepath}`);\n }\n if (!isJsonObject(data)) {\n throw new ConfigError(`Bursar config must be a JSON/YAML object: ${filepath}`);\n }\n if (Object.keys(data).length === 0) {\n throw new ConfigError(`Bursar config is empty: ${filepath}`);\n }\n return data;\n}\n\n/**\n * Read a JSON or YAML Bursar config file from disk.\n *\n * Returns the raw parsed dict (suitable for ``loadConfigFromDict`` or\n * ``PricingEngine.fromDict``).\n *\n * JSON syntax is validated by the platform parser and mapping keys are also\n * checked by js-yaml so duplicate config fields cannot silently overwrite.\n */\nexport async function loadConfigFile(filepath: string): Promise<JsonObject> {\n const extension = extname(filepath).toLowerCase();\n if (!new Set([\".json\", \".yaml\", \".yml\"]).has(extension)) {\n throw new ConfigError(\n `Unsupported config file format: ${extension || \"<none>\"}. Expected .json, .yaml, or .yml`,\n );\n }\n\n if (extension === \".yaml\" || extension === \".yml\") {\n const content = readFileClean(filepath);\n let parsed: JsonValue | undefined;\n try {\n const yamlValue = parseYaml(content, { json: false });\n const jsonValue = z.json().safeParse(yamlValue);\n if (!jsonValue.success) throw new ConfigError(\"YAML document must contain JSON values\");\n parsed = jsonValue.data;\n } catch (cause) {\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new ConfigError(`Invalid YAML in ${filepath}: ${message}`, [], { cause });\n }\n return assertNonEmptyObject(parsed, filepath);\n }\n\n const content = readFileClean(filepath);\n let parsed: JsonValue;\n try {\n parsed = parseJsonWithUniqueKeys(content);\n } catch (cause) {\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new ConfigError(`Invalid JSON in ${filepath}: ${message}`, [], { cause });\n }\n return assertNonEmptyObject(parsed, filepath);\n}\n"]}
|
package/dist/metrics.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Decimal } from "decimal.js";
|
|
2
|
+
import type { StructuredObject } from "./shared/json.js";
|
|
2
3
|
/** One provider-neutral billable operation. */
|
|
3
4
|
export interface UsageMetrics {
|
|
4
5
|
operation: string;
|
|
5
6
|
measures?: Record<string, number | string>;
|
|
6
7
|
dimensions?: Record<string, string | number | boolean | Decimal.Value>;
|
|
7
|
-
metadata?:
|
|
8
|
+
metadata?: StructuredObject;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=metrics.d.ts.map
|
package/dist/metrics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACvE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B"}
|
package/dist/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"","sourcesContent":["import type { Decimal } from \"decimal.js\";\n\n/** One provider-neutral billable operation. */\nexport interface UsageMetrics {\n operation: string;\n measures?: Record<string, number | string>;\n dimensions?: Record<string, string | number | boolean | Decimal.Value>;\n metadata?:
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"","sourcesContent":["import type { Decimal } from \"decimal.js\";\nimport type { StructuredObject } from \"./shared/json.js\";\n\n/** One provider-neutral billable operation. */\nexport interface UsageMetrics {\n operation: string;\n measures?: Record<string, number | string>;\n dimensions?: Record<string, string | number | boolean | Decimal.Value>;\n metadata?: StructuredObject;\n}\n"]}
|
package/dist/node.d.ts
CHANGED
|
@@ -20,6 +20,6 @@ export type { OutboxClaimLossPhase, OutboxEventOutcome, OutboxEventOutcomeStatus
|
|
|
20
20
|
export { ClickHouseUsageStore } from "./storage/adapters/clickhouse.js";
|
|
21
21
|
export type { ClickHouseClient, ClickHouseQueryResult, ClickHouseUsageStoreOptions, } from "./storage/adapters/clickhouse.js";
|
|
22
22
|
export { S3BillingArchive } from "./storage/adapters/s3.js";
|
|
23
|
-
export type { S3ArchiveClient, S3ArchiveClientFactory, S3BillingArchiveOptions, S3Credentials, S3PutObjectOptions, } from "./storage/adapters/s3.js";
|
|
23
|
+
export type { S3ArchiveCommand, S3ArchiveCommandInput, S3ArchiveClient, S3ArchiveCommandResult, S3ArchiveClientFactory, S3BillingArchiveOptions, S3Credentials, S3PutObjectOptions, } from "./storage/adapters/s3.js";
|
|
24
24
|
export type { BillingEventPayloadExport, BillingPayloadArchive, BillingPayloadArchiveResult, OutboxClaimRenewalStore, OutboxDeadLetter, OutboxDeadLetterCursor, OutboxDeadLetterListOptions, OutboxDeadLetterPage, OutboxEvent, OutboxHandler, OutboxRecoveryStore, OutboxStats, OutboxStore, UsageChargeExport, UsageEventSink, } from "./storage/ports.js";
|
|
25
25
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,sBAAsB,CA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AClC,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC"}
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAqB1E,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAexF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAMxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/**\n * Node.js-only bursar exports.\n *\n * These modules depend on Node built-ins (`crypto`, `fs`) and are not\n * compatible with Edge Runtime environments. Import them from the\n * ``@zonastery/bursar/node`` subpath when you need Node-specific behaviour:\n *\n * ```ts\n * import { loadConfigFile } from \"@zonastery/bursar/node\";\n * ```\n */\n\nexport { loadConfigFile } from \"./load-config-file.js\";\n\n// Optional high-volume storage infrastructure. These adapters are Node-only;\n// the main package remains the PostgreSQL-first application API.\nexport { BursarRuntime, createBursarRuntime } from \"./storage/runtime.js\";\nexport type {\n BursarRuntimeBursarOptions,\n BursarRuntimeHealth,\n BursarRuntimeOptions,\n BursarRuntimeStartOptions,\n} from \"./storage/runtime.js\";\nexport type {\n BursarRuntimeDiagnostics,\n BursarRuntimeState,\n CatalogDependencyCheck,\n CheckDependenciesOptions,\n DependencyCheck,\n DependencyStatus,\n OutboxDependencyCheck,\n OutboxStatusSnapshot,\n WorkerErrorSnapshot,\n WorkerLifecycle,\n WorkerRunSnapshot,\n WorkerState,\n} from \"./storage/diagnostics.js\";\nexport { BursarMaintenance, BursarOperatorMaintenance } from \"./storage/maintenance.js\";\nexport type {\n MaintenanceRunOptions,\n MaintenanceRunResult,\n MaintenanceRunStatus,\n MaintenanceOperations,\n MaintenanceTaskResult,\n MaintenanceTaskStatus,\n OperatorMaintenanceRunOptions,\n PartitionMaintenanceResult,\n StorageMaintenanceCounts,\n StorageMaintenanceResult,\n StorageMaintenanceStatus,\n StoragePartition,\n} from \"./storage/maintenance.js\";\nexport { OutboxWorker } from \"./storage/outbox-worker.js\";\nexport type {\n OutboxClaimLossPhase,\n OutboxEventOutcome,\n OutboxEventOutcomeStatus,\n OutboxRunResult,\n OutboxWorkerOptions,\n} from \"./storage/outbox-worker.js\";\nexport { ClickHouseUsageStore } from \"./storage/adapters/clickhouse.js\";\nexport type {\n ClickHouseClient,\n ClickHouseQueryResult,\n ClickHouseUsageStoreOptions,\n} from \"./storage/adapters/clickhouse.js\";\nexport { S3BillingArchive } from \"./storage/adapters/s3.js\";\nexport type {\n S3ArchiveClient,\n S3ArchiveClientFactory,\n S3BillingArchiveOptions,\n S3Credentials,\n S3PutObjectOptions,\n} from \"./storage/adapters/s3.js\";\nexport type {\n BillingEventPayloadExport,\n BillingPayloadArchive,\n BillingPayloadArchiveResult,\n OutboxClaimRenewalStore,\n OutboxDeadLetter,\n OutboxDeadLetterCursor,\n OutboxDeadLetterListOptions,\n OutboxDeadLetterPage,\n OutboxEvent,\n OutboxHandler,\n OutboxRecoveryStore,\n OutboxStats,\n OutboxStore,\n UsageChargeExport,\n UsageEventSink,\n} from \"./storage/ports.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAqB1E,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAexF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAMxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/**\n * Node.js-only bursar exports.\n *\n * These modules depend on Node built-ins (`crypto`, `fs`) and are not\n * compatible with Edge Runtime environments. Import them from the\n * ``@zonastery/bursar/node`` subpath when you need Node-specific behaviour:\n *\n * ```ts\n * import { loadConfigFile } from \"@zonastery/bursar/node\";\n * ```\n */\n\nexport { loadConfigFile } from \"./load-config-file.js\";\n\n// Optional high-volume storage infrastructure. These adapters are Node-only;\n// the main package remains the PostgreSQL-first application API.\nexport { BursarRuntime, createBursarRuntime } from \"./storage/runtime.js\";\nexport type {\n BursarRuntimeBursarOptions,\n BursarRuntimeHealth,\n BursarRuntimeOptions,\n BursarRuntimeStartOptions,\n} from \"./storage/runtime.js\";\nexport type {\n BursarRuntimeDiagnostics,\n BursarRuntimeState,\n CatalogDependencyCheck,\n CheckDependenciesOptions,\n DependencyCheck,\n DependencyStatus,\n OutboxDependencyCheck,\n OutboxStatusSnapshot,\n WorkerErrorSnapshot,\n WorkerLifecycle,\n WorkerRunSnapshot,\n WorkerState,\n} from \"./storage/diagnostics.js\";\nexport { BursarMaintenance, BursarOperatorMaintenance } from \"./storage/maintenance.js\";\nexport type {\n MaintenanceRunOptions,\n MaintenanceRunResult,\n MaintenanceRunStatus,\n MaintenanceOperations,\n MaintenanceTaskResult,\n MaintenanceTaskStatus,\n OperatorMaintenanceRunOptions,\n PartitionMaintenanceResult,\n StorageMaintenanceCounts,\n StorageMaintenanceResult,\n StorageMaintenanceStatus,\n StoragePartition,\n} from \"./storage/maintenance.js\";\nexport { OutboxWorker } from \"./storage/outbox-worker.js\";\nexport type {\n OutboxClaimLossPhase,\n OutboxEventOutcome,\n OutboxEventOutcomeStatus,\n OutboxRunResult,\n OutboxWorkerOptions,\n} from \"./storage/outbox-worker.js\";\nexport { ClickHouseUsageStore } from \"./storage/adapters/clickhouse.js\";\nexport type {\n ClickHouseClient,\n ClickHouseQueryResult,\n ClickHouseUsageStoreOptions,\n} from \"./storage/adapters/clickhouse.js\";\nexport { S3BillingArchive } from \"./storage/adapters/s3.js\";\nexport type {\n S3ArchiveCommand,\n S3ArchiveCommandInput,\n S3ArchiveClient,\n S3ArchiveCommandResult,\n S3ArchiveClientFactory,\n S3BillingArchiveOptions,\n S3Credentials,\n S3PutObjectOptions,\n} from \"./storage/adapters/s3.js\";\nexport type {\n BillingEventPayloadExport,\n BillingPayloadArchive,\n BillingPayloadArchiveResult,\n OutboxClaimRenewalStore,\n OutboxDeadLetter,\n OutboxDeadLetterCursor,\n OutboxDeadLetterListOptions,\n OutboxDeadLetterPage,\n OutboxEvent,\n OutboxHandler,\n OutboxRecoveryStore,\n OutboxStats,\n OutboxStore,\n UsageChargeExport,\n UsageEventSink,\n} from \"./storage/ports.js\";\n"]}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { BillingEvent, BillingEventResult } from "../billing/index.js";
|
|
2
2
|
import type { BillingEventSink } from "../bursar.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
3
|
+
import type { ExternalValue } from "../shared/json.js";
|
|
4
|
+
type ProviderValue = ExternalValue;
|
|
5
|
+
export declare function requireProviderString(value: ProviderValue, field: string): string;
|
|
6
|
+
export declare function optionalProviderString(value: ProviderValue, field: string): string | undefined;
|
|
7
|
+
export declare function optionalProviderBoolean(value: ProviderValue, field: string): boolean | undefined;
|
|
8
|
+
export declare function requireMinorUnits(value: ProviderValue, field: string, positive?: boolean): number;
|
|
9
|
+
export declare function requireCurrency(value: ProviderValue, field: string): string;
|
|
8
10
|
/**
|
|
9
11
|
* Wrapper around the facade event sink that throws on retryable or unexpected
|
|
10
12
|
* failures. Permanent claim outcomes are returned so the provider can
|
|
11
13
|
* acknowledge them without scheduling another delivery.
|
|
12
14
|
*/
|
|
13
15
|
export declare function callBillingEventSink(sink: BillingEventSink, event: BillingEvent): Promise<BillingEventResult>;
|
|
16
|
+
export {};
|
|
14
17
|
//# sourceMappingURL=_shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/providers/_shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/providers/_shared.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAcvD,KAAK,aAAa,GAAG,aAAa,CAAC;AAEnC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG9F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAOhG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAS/F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAwC7B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pRetry from "p-retry";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { BursarError, StoreUnavailableError } from "../errors.js";
|
|
3
4
|
class BillingClaimBusyError extends Error {
|
|
4
5
|
name = "BillingClaimBusyError";
|
|
@@ -11,10 +12,11 @@ const ACKNOWLEDGED_BILLING_EVENT_ERRORS = new Set([
|
|
|
11
12
|
"max_retries_exceeded",
|
|
12
13
|
]);
|
|
13
14
|
export function requireProviderString(value, field) {
|
|
14
|
-
|
|
15
|
+
const parsed = z.string().safeParse(value);
|
|
16
|
+
if (!parsed.success || parsed.data.trim().length === 0) {
|
|
15
17
|
throw new TypeError(`${field} must be a non-empty string`);
|
|
16
18
|
}
|
|
17
|
-
return
|
|
19
|
+
return parsed.data.trim();
|
|
18
20
|
}
|
|
19
21
|
export function optionalProviderString(value, field) {
|
|
20
22
|
if (value === null || value === undefined)
|
|
@@ -24,27 +26,29 @@ export function optionalProviderString(value, field) {
|
|
|
24
26
|
export function optionalProviderBoolean(value, field) {
|
|
25
27
|
if (value === null || value === undefined)
|
|
26
28
|
return undefined;
|
|
27
|
-
|
|
29
|
+
const parsed = z.boolean().safeParse(value);
|
|
30
|
+
if (!parsed.success) {
|
|
28
31
|
throw new TypeError(`${field} must be a boolean`);
|
|
29
32
|
}
|
|
30
|
-
return
|
|
33
|
+
return parsed.data;
|
|
31
34
|
}
|
|
32
35
|
export function requireMinorUnits(value, field, positive = false) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
: typeof value === "string" && /^\d+$/.test(value)
|
|
36
|
-
? Number(value)
|
|
37
|
-
: Number.NaN;
|
|
36
|
+
const parsed = z.union([z.number(), z.string().regex(/^\d+$/u)]).safeParse(value);
|
|
37
|
+
const amount = parsed.success ? Number(parsed.data) : Number.NaN;
|
|
38
38
|
if (!Number.isSafeInteger(amount) || amount < (positive ? 1 : 0)) {
|
|
39
39
|
throw new TypeError(`${field} must be a ${positive ? "positive" : "non-negative"} safe integer`);
|
|
40
40
|
}
|
|
41
41
|
return amount;
|
|
42
42
|
}
|
|
43
43
|
export function requireCurrency(value, field) {
|
|
44
|
-
|
|
44
|
+
const parsed = z
|
|
45
|
+
.string()
|
|
46
|
+
.regex(/^[A-Za-z]{3}$/u)
|
|
47
|
+
.safeParse(value);
|
|
48
|
+
if (!parsed.success) {
|
|
45
49
|
throw new TypeError(`${field} must be a three-letter currency code`);
|
|
46
50
|
}
|
|
47
|
-
return
|
|
51
|
+
return parsed.data.toUpperCase();
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Wrapper around the facade event sink that throws on retryable or unexpected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../src/providers/_shared.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../src/providers/_shared.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGlE,MAAM,qBAAsB,SAAQ,KAAK;IACrB,IAAI,GAAG,uBAAuB,CAAC;CAClD;AAED,MAAM,iCAAiC,GAAG,IAAI,GAAG,CAAC;IAChD,sBAAsB;IACtB,mBAAmB;IACnB,iBAAiB;IACjB,sBAAsB;IACtB,sBAAsB;CACvB,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,KAAoB,EAAE,KAAa;IACvE,MAAM,MAAM,GAAG,CAAC,CA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,EAAE,KAAK;YACnB,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,YAAY,qBAAqB;SACnE,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;YAC3C,MAAM,IAAI,qBAAqB,CAAC,mCAAmC,EAAE;gBACnE,KAAK;gBACL,OAAO,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;aAClC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,KAAK,oBAAoB,EAAE,CAAC;QAC1C,MAAM,IAAI,qBAAqB,CAAC,2CAA2C,EAAE;YAC3E,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE;SAClC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,iCAAiC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QAClF,MAAM,IAAI,WAAW,CAAC,2CAA2C,EAAE;YACjE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,SAAS,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import pRetry from \"p-retry\";\nimport { z } from \"zod\";\n\nimport type { BillingEvent, BillingEventResult } from \"../billing/index.js\";\nimport type { BillingEventSink } from \"../bursar.js\";\nimport { BursarError, StoreUnavailableError } from \"../errors.js\";\nimport type { ExternalValue } from \"../shared/json.js\";\n\nclass BillingClaimBusyError extends Error {\n override readonly name = \"BillingClaimBusyError\";\n}\n\nconst ACKNOWLEDGED_BILLING_EVENT_ERRORS = new Set([\n \"unhandled_event_type\",\n \"account_not_found\",\n \"invalid_request\",\n \"idempotency_conflict\",\n \"max_retries_exceeded\",\n]);\n\ntype ProviderValue = ExternalValue;\n\nexport function requireProviderString(value: ProviderValue, field: string): string {\n const parsed = z.string().safeParse(value);\n if (!parsed.success || parsed.data.trim().length === 0) {\n throw new TypeError(`${field} must be a non-empty string`);\n }\n return parsed.data.trim();\n}\n\nexport function optionalProviderString(value: ProviderValue, field: string): string | undefined {\n if (value === null || value === undefined) return undefined;\n return requireProviderString(value, field);\n}\n\nexport function optionalProviderBoolean(value: ProviderValue, field: string): boolean | undefined {\n if (value === null || value === undefined) return undefined;\n const parsed = z.boolean().safeParse(value);\n if (!parsed.success) {\n throw new TypeError(`${field} must be a boolean`);\n }\n return parsed.data;\n}\n\nexport function requireMinorUnits(value: ProviderValue, field: string, positive = false): number {\n const parsed = z.union([z.number(), z.string().regex(/^\\d+$/u)]).safeParse(value);\n const amount = parsed.success ? Number(parsed.data) : Number.NaN;\n if (!Number.isSafeInteger(amount) || amount < (positive ? 1 : 0)) {\n throw new TypeError(\n `${field} must be a ${positive ? \"positive\" : \"non-negative\"} safe integer`,\n );\n }\n return amount;\n}\n\nexport function requireCurrency(value: ProviderValue, field: string): string {\n const parsed = z\n .string()\n .regex(/^[A-Za-z]{3}$/u)\n .safeParse(value);\n if (!parsed.success) {\n throw new TypeError(`${field} must be a three-letter currency code`);\n }\n return parsed.data.toUpperCase();\n}\n\n/**\n * Wrapper around the facade event sink that throws on retryable or unexpected\n * failures. Permanent claim outcomes are returned so the provider can\n * acknowledge them without scheduling another delivery.\n */\nexport async function callBillingEventSink(\n sink: BillingEventSink,\n event: BillingEvent,\n): Promise<BillingEventResult> {\n let result: BillingEventResult;\n try {\n result = await pRetry(\n async () => {\n const attempted = await sink.ingestBillingEvent(event);\n if (attempted.error === \"claim_busy\") throw new BillingClaimBusyError();\n return attempted;\n },\n {\n retries: 6,\n minTimeout: 25,\n maxTimeout: 800,\n factor: 2,\n randomize: true,\n maxRetryTime: 5_000,\n shouldRetry: ({ error }) => error instanceof BillingClaimBusyError,\n },\n );\n } catch (cause) {\n if (cause instanceof BillingClaimBusyError) {\n throw new StoreUnavailableError(\"Billing event claim remained busy\", {\n cause,\n details: { reason: \"claim_busy\" },\n });\n }\n throw cause;\n }\n\n if (result.error === \"claim_failed_retry\") {\n throw new StoreUnavailableError(\"Billing event claim could not be acquired\", {\n details: { reason: result.error },\n });\n }\n if (!result.handled && !ACKNOWLEDGED_BILLING_EVENT_ERRORS.has(result.error ?? \"\")) {\n throw new BursarError(\"Bursar failed to ingest the billing event\", {\n details: { reason: result.error ?? \"unknown\" },\n });\n }\n return result;\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { WebhookResult } from "../types.js";
|
|
2
|
+
import { type DodoWebhookBridgeOptions } from "./webhook-bridge.js";
|
|
3
|
+
type OfficialDodoWebhooks = typeof import("@dodopayments/better-auth").webhooks;
|
|
4
|
+
type OfficialWebhookConfig = Parameters<OfficialDodoWebhooks>[0];
|
|
5
|
+
type OfficialOnPayload = NonNullable<OfficialWebhookConfig["onPayload"]>;
|
|
6
|
+
export type DodoBetterAuthWebhookPlugin = ReturnType<OfficialDodoWebhooks>;
|
|
7
|
+
export type DodoBetterAuthWebhookPayload = Parameters<OfficialOnPayload>[0];
|
|
8
|
+
export interface DodoBetterAuthWebhookAdapterConfig {
|
|
9
|
+
webhookKey: string;
|
|
10
|
+
eventHandlers?: Omit<OfficialWebhookConfig, "webhookKey" | "onPayload">;
|
|
11
|
+
onPayload(payload: DodoBetterAuthWebhookPayload): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export type DodoBetterAuthWebhookAdapter = (config: DodoBetterAuthWebhookAdapterConfig) => DodoBetterAuthWebhookPlugin;
|
|
14
|
+
export interface DodoBetterAuthWebhookCoreOptions extends DodoWebhookBridgeOptions {
|
|
15
|
+
webhookKey: string;
|
|
16
|
+
eventHandlers?: Omit<OfficialWebhookConfig, "webhookKey" | "onPayload">;
|
|
17
|
+
onProcessed?: (result: WebhookResult, payload: DodoBetterAuthWebhookPayload) => void | Promise<void>;
|
|
18
|
+
adapter: DodoBetterAuthWebhookAdapter;
|
|
19
|
+
}
|
|
20
|
+
export declare function dodoBetterAuthWebhooksCore(options: DodoBetterAuthWebhookCoreOptions): (_options: import("@dodopayments/better-auth").DodoPaymentsOptions) => {
|
|
21
|
+
dodopaymentsWebhooks: import("better-call").StrictEndpoint<"/dodopayments/webhooks", {
|
|
22
|
+
method: "POST";
|
|
23
|
+
metadata: {
|
|
24
|
+
isAction: false;
|
|
25
|
+
};
|
|
26
|
+
cloneRequest: true;
|
|
27
|
+
} & {
|
|
28
|
+
use: any[];
|
|
29
|
+
}, import("@dodopayments/better-auth").WebhookResponse>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=better-auth-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-auth-core.d.ts","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,KAAK,oBAAoB,GAAG,cAAc,2BAA2B,EAAE,QAAQ,CAAC;AAChF,KAAK,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,iBAAiB,GAAG,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5E,MAAM,WAAW,kCAAkC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,YAAY,GAAG,WAAW,CAAC,CAAC;IACxE,SAAS,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,4BAA4B,GAAG,CACzC,MAAM,EAAE,kCAAkC,KACvC,2BAA2B,CAAC;AAEjC,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,YAAY,GAAG,WAAW,CAAC,CAAC;IACxE,WAAW,CAAC,EAAE,CACZ,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,4BAA4B,KAClC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,EAAE,4BAA4B,CAAC;CACvC;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,gCAAgC;;;;;;;;;;EAWnF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createDodoWebhookBridge } from "./webhook-bridge.js";
|
|
2
|
+
export function dodoBetterAuthWebhooksCore(options) {
|
|
3
|
+
const { webhookKey, eventHandlers, onProcessed, adapter, ...bridgeOptions } = options;
|
|
4
|
+
const processPayload = createDodoWebhookBridge(bridgeOptions);
|
|
5
|
+
return adapter({
|
|
6
|
+
webhookKey,
|
|
7
|
+
eventHandlers,
|
|
8
|
+
onPayload: async (payload) => {
|
|
9
|
+
const result = await processPayload(payload);
|
|
10
|
+
await onProcessed?.(result, payload);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=better-auth-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-auth-core.js","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAiC,MAAM,qBAAqB,CAAC;AA4B7F,MAAM,UAAU,0BAA0B,CAAC,OAAyC;IAClF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;IACtF,MAAM,cAAc,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC;QACb,UAAU;QACV,aAAa;QACb,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC7C,MAAM,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { WebhookResult } from \"../types.js\";\nimport { createDodoWebhookBridge, type DodoWebhookBridgeOptions } from \"./webhook-bridge.js\";\n\ntype OfficialDodoWebhooks = typeof import(\"@dodopayments/better-auth\").webhooks;\ntype OfficialWebhookConfig = Parameters<OfficialDodoWebhooks>[0];\ntype OfficialOnPayload = NonNullable<OfficialWebhookConfig[\"onPayload\"]>;\nexport type DodoBetterAuthWebhookPlugin = ReturnType<OfficialDodoWebhooks>;\nexport type DodoBetterAuthWebhookPayload = Parameters<OfficialOnPayload>[0];\n\nexport interface DodoBetterAuthWebhookAdapterConfig {\n webhookKey: string;\n eventHandlers?: Omit<OfficialWebhookConfig, \"webhookKey\" | \"onPayload\">;\n onPayload(payload: DodoBetterAuthWebhookPayload): Promise<void>;\n}\n\nexport type DodoBetterAuthWebhookAdapter = (\n config: DodoBetterAuthWebhookAdapterConfig,\n) => DodoBetterAuthWebhookPlugin;\n\nexport interface DodoBetterAuthWebhookCoreOptions extends DodoWebhookBridgeOptions {\n webhookKey: string;\n eventHandlers?: Omit<OfficialWebhookConfig, \"webhookKey\" | \"onPayload\">;\n onProcessed?: (\n result: WebhookResult,\n payload: DodoBetterAuthWebhookPayload,\n ) => void | Promise<void>;\n adapter: DodoBetterAuthWebhookAdapter;\n}\n\nexport function dodoBetterAuthWebhooksCore(options: DodoBetterAuthWebhookCoreOptions) {\n const { webhookKey, eventHandlers, onProcessed, adapter, ...bridgeOptions } = options;\n const processPayload = createDodoWebhookBridge(bridgeOptions);\n return adapter({\n webhookKey,\n eventHandlers,\n onPayload: async (payload) => {\n const result = await processPayload(payload);\n await onProcessed?.(result, payload);\n },\n });\n}\n"]}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { webhooks as officialDodoWebhooks } from "@dodopayments/better-auth";
|
|
2
1
|
import type { BetterAuthBursarUser, BetterAuthProviderCustomer } from "../../integrations/better-auth.js";
|
|
3
2
|
import type { WebhookResult } from "../types.js";
|
|
4
|
-
import { type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
export type
|
|
8
|
-
export type DodoBetterAuthWebhookEventHandlers = Omit<OfficialWebhookConfig, "webhookKey" | "onPayload">;
|
|
3
|
+
import { type DodoBetterAuthWebhookAdapter, type DodoBetterAuthWebhookAdapterConfig, type DodoBetterAuthWebhookPayload, type DodoBetterAuthWebhookPlugin } from "./better-auth-core.js";
|
|
4
|
+
import type { DodoWebhookBridgeOptions } from "./webhook-bridge.js";
|
|
5
|
+
export type { DodoBetterAuthWebhookAdapter, DodoBetterAuthWebhookAdapterConfig, DodoBetterAuthWebhookPayload, DodoBetterAuthWebhookPlugin, };
|
|
6
|
+
export type DodoBetterAuthWebhookEventHandlers = NonNullable<DodoBetterAuthWebhookAdapterConfig["eventHandlers"]>;
|
|
9
7
|
export interface DodoBetterAuthWebhookOptions extends DodoWebhookBridgeOptions {
|
|
10
8
|
webhookKey: string;
|
|
11
9
|
eventHandlers?: DodoBetterAuthWebhookEventHandlers;
|
|
12
10
|
onProcessed?: (result: WebhookResult, payload: DodoBetterAuthWebhookPayload) => void | Promise<void>;
|
|
11
|
+
adapter?: DodoBetterAuthWebhookAdapter;
|
|
13
12
|
}
|
|
14
13
|
/** Build a Better Auth Dodo webhook plugin backed by Bursar ingestion. */
|
|
15
14
|
export declare function dodoBetterAuthWebhooks(options: DodoBetterAuthWebhookOptions): (_options: import("@dodopayments/better-auth").DodoPaymentsOptions) => {
|
|
@@ -25,5 +24,4 @@ export declare function dodoBetterAuthWebhooks(options: DodoBetterAuthWebhookOpt
|
|
|
25
24
|
};
|
|
26
25
|
/** Resolve the customer field maintained by `@dodopayments/better-auth`. */
|
|
27
26
|
export declare function dodoBetterAuthCustomer(user: BetterAuthBursarUser): BetterAuthProviderCustomer | null;
|
|
28
|
-
export {};
|
|
29
27
|
//# sourceMappingURL=better-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-auth.d.ts","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"better-auth.d.ts","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACvC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,YAAY,EACV,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,2BAA2B,GAC5B,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG,WAAW,CAC1D,kCAAkC,CAAC,eAAe,CAAC,CACpD,CAAC;AAEF,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,kCAAkC,CAAC;IACnD,WAAW,CAAC,EAAE,CACZ,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,4BAA4B,KAClC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,4BAA4B,CAAC;CACxC;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,4BAA4B;;;;;;;;;;EAe3E;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,oBAAoB,GACzB,0BAA0B,GAAG,IAAI,CAInC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { webhooks as officialDodoWebhooks } from "@dodopayments/better-auth";
|
|
2
|
-
import {
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { dodoBetterAuthWebhooksCore, } from "./better-auth-core.js";
|
|
3
4
|
/** Build a Better Auth Dodo webhook plugin backed by Bursar ingestion. */
|
|
4
5
|
export function dodoBetterAuthWebhooks(options) {
|
|
5
|
-
const {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
6
|
+
const { adapter, ...coreOptions } = options;
|
|
7
|
+
const createPlugin = adapter ??
|
|
8
|
+
((config) => {
|
|
9
|
+
return officialDodoWebhooks({
|
|
10
|
+
...config.eventHandlers,
|
|
11
|
+
webhookKey: config.webhookKey,
|
|
12
|
+
onPayload: config.onPayload,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return dodoBetterAuthWebhooksCore({
|
|
16
|
+
...coreOptions,
|
|
17
|
+
adapter: createPlugin,
|
|
14
18
|
});
|
|
15
19
|
}
|
|
16
20
|
/** Resolve the customer field maintained by `@dodopayments/better-auth`. */
|
|
17
21
|
export function dodoBetterAuthCustomer(user) {
|
|
18
22
|
const customerId = user.dodoCustomerId;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: null;
|
|
23
|
+
const parsed = z.string().trim().min(1).safeParse(customerId);
|
|
24
|
+
return parsed.success ? { provider: "dodo", customerId: parsed.data } : null;
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=better-auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-auth.js","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"better-auth.js","sourceRoot":"","sources":["../../../src/providers/dodo/better-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EACL,0BAA0B,GAK3B,MAAM,uBAAuB,CAAC;AAuB/B,0EAA0E;AAC1E,MAAM,UAAU,sBAAsB,CAAC,OAAqC;IAC1E,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,YAAY,GAChB,OAAO;QACP,CAAC,CAAC,MAAM,EAAE,EAAE;YACV,OAAO,oBAAoB,CAAC;gBAC1B,GAAG,MAAM,CAAC,aAAa;gBACvB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,OAAO,0BAA0B,CAAC;QAChC,GAAG,WAAW;QACd,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,sBAAsB,CACpC,IAA0B;IAE1B,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/E,CAAC","sourcesContent":["import { webhooks as officialDodoWebhooks } from \"@dodopayments/better-auth\";\nimport { z } from \"zod\";\n\nimport type {\n BetterAuthBursarUser,\n BetterAuthProviderCustomer,\n} from \"../../integrations/better-auth.js\";\nimport type { WebhookResult } from \"../types.js\";\nimport {\n dodoBetterAuthWebhooksCore,\n type DodoBetterAuthWebhookAdapter,\n type DodoBetterAuthWebhookAdapterConfig,\n type DodoBetterAuthWebhookPayload,\n type DodoBetterAuthWebhookPlugin,\n} from \"./better-auth-core.js\";\nimport type { DodoWebhookBridgeOptions } from \"./webhook-bridge.js\";\n\nexport type {\n DodoBetterAuthWebhookAdapter,\n DodoBetterAuthWebhookAdapterConfig,\n DodoBetterAuthWebhookPayload,\n DodoBetterAuthWebhookPlugin,\n};\nexport type DodoBetterAuthWebhookEventHandlers = NonNullable<\n DodoBetterAuthWebhookAdapterConfig[\"eventHandlers\"]\n>;\n\nexport interface DodoBetterAuthWebhookOptions extends DodoWebhookBridgeOptions {\n webhookKey: string;\n eventHandlers?: DodoBetterAuthWebhookEventHandlers;\n onProcessed?: (\n result: WebhookResult,\n payload: DodoBetterAuthWebhookPayload,\n ) => void | Promise<void>;\n adapter?: DodoBetterAuthWebhookAdapter;\n}\n\n/** Build a Better Auth Dodo webhook plugin backed by Bursar ingestion. */\nexport function dodoBetterAuthWebhooks(options: DodoBetterAuthWebhookOptions) {\n const { adapter, ...coreOptions } = options;\n const createPlugin: DodoBetterAuthWebhookAdapter =\n adapter ??\n ((config) => {\n return officialDodoWebhooks({\n ...config.eventHandlers,\n webhookKey: config.webhookKey,\n onPayload: config.onPayload,\n });\n });\n return dodoBetterAuthWebhooksCore({\n ...coreOptions,\n adapter: createPlugin,\n });\n}\n\n/** Resolve the customer field maintained by `@dodopayments/better-auth`. */\nexport function dodoBetterAuthCustomer(\n user: BetterAuthBursarUser,\n): BetterAuthProviderCustomer | null {\n const customerId = user.dodoCustomerId;\n const parsed = z.string().trim().min(1).safeParse(customerId);\n return parsed.success ? { provider: \"dodo\", customerId: parsed.data } : null;\n}\n"]}
|
|
@@ -11,6 +11,7 @@ type DodoCheckoutPreview = Awaited<ReturnType<DodoPayments["checkoutSessions"]["
|
|
|
11
11
|
type DodoPayment = Awaited<ReturnType<DodoPayments["payments"]["retrieve"]>>;
|
|
12
12
|
type DodoPlanChangePreview = Awaited<ReturnType<DodoPayments["subscriptions"]["previewChangePlan"]>>;
|
|
13
13
|
type DodoPaymentMethodUpdate = Awaited<ReturnType<DodoPayments["subscriptions"]["updatePaymentMethod"]>>;
|
|
14
|
+
type DodoSubscription = Awaited<ReturnType<DodoPayments["subscriptions"]["update"]>>;
|
|
14
15
|
type DodoCustomer = Awaited<ReturnType<DodoPayments["customers"]["create"]>>;
|
|
15
16
|
type DodoCustomerPortalSession = Awaited<ReturnType<DodoPayments["customers"]["customerPortal"]["create"]>>;
|
|
16
17
|
type DodoPaymentMethods = Awaited<ReturnType<DodoPayments["customers"]["retrievePaymentMethods"]>>;
|
|
@@ -19,16 +20,16 @@ type DodoSdkWebhookPayload = ReturnType<DodoPayments["webhooks"]["unwrap"]>;
|
|
|
19
20
|
/**
|
|
20
21
|
* Payload returned by an official Dodo adapter after signature verification.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* SDK-derived and treat only the resource payload as untrusted input; Bursar's
|
|
25
|
-
* mapper validates every field it consumes.
|
|
23
|
+
* This stays SDK-derived so an actual `DodoPayments` client is structurally
|
|
24
|
+
* assignable to `DodoClient` without casts or weakened return types.
|
|
26
25
|
*/
|
|
27
|
-
export type DodoWebhookPayload =
|
|
28
|
-
|
|
26
|
+
export type DodoWebhookPayload = DodoSdkWebhookPayload;
|
|
27
|
+
/** Common verified envelope shared by Dodo's framework-specific adapters. */
|
|
28
|
+
export interface DodoWebhookEnvelope<TData> {
|
|
29
|
+
data: TData;
|
|
29
30
|
timestamp: string | Date;
|
|
30
31
|
type: string;
|
|
31
|
-
}
|
|
32
|
+
}
|
|
32
33
|
export interface DodoClient {
|
|
33
34
|
webhooks: {
|
|
34
35
|
unwrap(body: string, options: {
|
|
@@ -52,10 +53,10 @@ export interface DodoClient {
|
|
|
52
53
|
retrieve(paymentId: Parameters<DodoPayments["payments"]["retrieve"]>[0]): Promise<DodoPayment>;
|
|
53
54
|
};
|
|
54
55
|
subscriptions: {
|
|
55
|
-
cancelChangePlan(subscriptionId: Parameters<DodoPayments["subscriptions"]["cancelChangePlan"]>[0], options?: DodoMutationRequestOptions): Promise<
|
|
56
|
-
changePlan(subscriptionId: Parameters<DodoPayments["subscriptions"]["changePlan"]>[0], body: Parameters<DodoPayments["subscriptions"]["changePlan"]>[1], options?: DodoMutationRequestOptions): Promise<
|
|
56
|
+
cancelChangePlan(subscriptionId: Parameters<DodoPayments["subscriptions"]["cancelChangePlan"]>[0], options?: DodoMutationRequestOptions): Promise<void>;
|
|
57
|
+
changePlan(subscriptionId: Parameters<DodoPayments["subscriptions"]["changePlan"]>[0], body: Parameters<DodoPayments["subscriptions"]["changePlan"]>[1], options?: DodoMutationRequestOptions): Promise<void>;
|
|
57
58
|
previewChangePlan(subscriptionId: Parameters<DodoPayments["subscriptions"]["previewChangePlan"]>[0], body: Parameters<DodoPayments["subscriptions"]["previewChangePlan"]>[1]): Promise<DodoPlanChangePreview>;
|
|
58
|
-
update(subscriptionId: Parameters<DodoPayments["subscriptions"]["update"]>[0], body: Parameters<DodoPayments["subscriptions"]["update"]>[1], options?: DodoMutationRequestOptions): Promise<
|
|
59
|
+
update(subscriptionId: Parameters<DodoPayments["subscriptions"]["update"]>[0], body: Parameters<DodoPayments["subscriptions"]["update"]>[1], options?: DodoMutationRequestOptions): Promise<DodoSubscription>;
|
|
59
60
|
updatePaymentMethod(subscriptionId: Parameters<DodoPayments["subscriptions"]["updatePaymentMethod"]>[0], body: Parameters<DodoPayments["subscriptions"]["updatePaymentMethod"]>[1]): Promise<DodoPaymentMethodUpdate>;
|
|
60
61
|
};
|
|
61
62
|
}
|
|
@@ -1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../src/providers/dodo/client-contract.ts"],"names":[],"mappings":"","sourcesContent":["import type DodoPayments from \"dodopayments\";\n\n/**\n * The public Dodo SDK surface used by Bursar.\n *\n * This structural boundary prevents compatible Dodo SDK installations from\n * becoming nominally incompatible through private class and APIPromise fields.\n */\ntype DodoCheckoutSession = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"create\"]>>;\ntype DodoCheckoutSessionStatus = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"retrieve\"]>>;\ntype DodoCheckoutPreview = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"preview\"]>>;\ntype DodoPayment = Awaited<ReturnType<DodoPayments[\"payments\"][\"retrieve\"]>>;\ntype DodoPlanChangePreview = Awaited<\n ReturnType<DodoPayments[\"subscriptions\"][\"previewChangePlan\"]>\n>;\ntype DodoPaymentMethodUpdate = Awaited<\n ReturnType<DodoPayments[\"subscriptions\"][\"updatePaymentMethod\"]>\n>;\ntype DodoCustomer = Awaited<ReturnType<DodoPayments[\"customers\"][\"create\"]>>;\ntype DodoCustomerPortalSession = Awaited<\n ReturnType<DodoPayments[\"customers\"][\"customerPortal\"][\"create\"]>\n>;\ntype DodoPaymentMethods = Awaited<ReturnType<DodoPayments[\"customers\"][\"retrievePaymentMethods\"]>>;\ntype DodoMutationRequestOptions = Pick<\n NonNullable<Parameters<DodoPayments[\"checkoutSessions\"][\"create\"]>[1]>,\n \"headers\"\n>;\n\ntype DodoSdkWebhookPayload = ReturnType<DodoPayments[\"webhooks\"][\"unwrap\"]>;\n\n/**\n * Payload returned by an official Dodo adapter after signature verification.\n *\n *
|
|
1
|
+
{"version":3,"file":"client-contract.js","sourceRoot":"","sources":["../../../src/providers/dodo/client-contract.ts"],"names":[],"mappings":"","sourcesContent":["import type DodoPayments from \"dodopayments\";\n\n/**\n * The public Dodo SDK surface used by Bursar.\n *\n * This structural boundary prevents compatible Dodo SDK installations from\n * becoming nominally incompatible through private class and APIPromise fields.\n */\ntype DodoCheckoutSession = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"create\"]>>;\ntype DodoCheckoutSessionStatus = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"retrieve\"]>>;\ntype DodoCheckoutPreview = Awaited<ReturnType<DodoPayments[\"checkoutSessions\"][\"preview\"]>>;\ntype DodoPayment = Awaited<ReturnType<DodoPayments[\"payments\"][\"retrieve\"]>>;\ntype DodoPlanChangePreview = Awaited<\n ReturnType<DodoPayments[\"subscriptions\"][\"previewChangePlan\"]>\n>;\ntype DodoPaymentMethodUpdate = Awaited<\n ReturnType<DodoPayments[\"subscriptions\"][\"updatePaymentMethod\"]>\n>;\ntype DodoSubscription = Awaited<ReturnType<DodoPayments[\"subscriptions\"][\"update\"]>>;\ntype DodoCustomer = Awaited<ReturnType<DodoPayments[\"customers\"][\"create\"]>>;\ntype DodoCustomerPortalSession = Awaited<\n ReturnType<DodoPayments[\"customers\"][\"customerPortal\"][\"create\"]>\n>;\ntype DodoPaymentMethods = Awaited<ReturnType<DodoPayments[\"customers\"][\"retrievePaymentMethods\"]>>;\ntype DodoMutationRequestOptions = Pick<\n NonNullable<Parameters<DodoPayments[\"checkoutSessions\"][\"create\"]>[1]>,\n \"headers\"\n>;\n\ntype DodoSdkWebhookPayload = ReturnType<DodoPayments[\"webhooks\"][\"unwrap\"]>;\n\n/**\n * Payload returned by an official Dodo adapter after signature verification.\n *\n * This stays SDK-derived so an actual `DodoPayments` client is structurally\n * assignable to `DodoClient` without casts or weakened return types.\n */\nexport type DodoWebhookPayload = DodoSdkWebhookPayload;\n\n/** Common verified envelope shared by Dodo's framework-specific adapters. */\nexport interface DodoWebhookEnvelope<TData> {\n data: TData;\n timestamp: string | Date;\n type: string;\n}\n\nexport interface DodoClient {\n webhooks: {\n unwrap(\n body: string,\n options: { headers: Record<string, string>; key?: string },\n ): DodoWebhookPayload;\n };\n checkoutSessions: {\n create(\n body: Parameters<DodoPayments[\"checkoutSessions\"][\"create\"]>[0],\n options?: DodoMutationRequestOptions,\n ): Promise<DodoCheckoutSession>;\n preview(\n body: Parameters<DodoPayments[\"checkoutSessions\"][\"preview\"]>[0],\n ): Promise<DodoCheckoutPreview>;\n retrieve(\n sessionId: Parameters<DodoPayments[\"checkoutSessions\"][\"retrieve\"]>[0],\n ): Promise<DodoCheckoutSessionStatus>;\n };\n customers: {\n create(\n body: Parameters<DodoPayments[\"customers\"][\"create\"]>[0],\n options?: DodoMutationRequestOptions,\n ): Promise<DodoCustomer>;\n customerPortal: {\n create(\n customerId: Parameters<DodoPayments[\"customers\"][\"customerPortal\"][\"create\"]>[0],\n body: Parameters<DodoPayments[\"customers\"][\"customerPortal\"][\"create\"]>[1],\n ): Promise<DodoCustomerPortalSession>;\n };\n retrievePaymentMethods(\n customerId: Parameters<DodoPayments[\"customers\"][\"retrievePaymentMethods\"]>[0],\n ): Promise<DodoPaymentMethods>;\n };\n payments: {\n retrieve(paymentId: Parameters<DodoPayments[\"payments\"][\"retrieve\"]>[0]): Promise<DodoPayment>;\n };\n subscriptions: {\n cancelChangePlan(\n subscriptionId: Parameters<DodoPayments[\"subscriptions\"][\"cancelChangePlan\"]>[0],\n options?: DodoMutationRequestOptions,\n ): Promise<void>;\n changePlan(\n subscriptionId: Parameters<DodoPayments[\"subscriptions\"][\"changePlan\"]>[0],\n body: Parameters<DodoPayments[\"subscriptions\"][\"changePlan\"]>[1],\n options?: DodoMutationRequestOptions,\n ): Promise<void>;\n previewChangePlan(\n subscriptionId: Parameters<DodoPayments[\"subscriptions\"][\"previewChangePlan\"]>[0],\n body: Parameters<DodoPayments[\"subscriptions\"][\"previewChangePlan\"]>[1],\n ): Promise<DodoPlanChangePreview>;\n update(\n subscriptionId: Parameters<DodoPayments[\"subscriptions\"][\"update\"]>[0],\n body: Parameters<DodoPayments[\"subscriptions\"][\"update\"]>[1],\n options?: DodoMutationRequestOptions,\n ): Promise<DodoSubscription>;\n updatePaymentMethod(\n subscriptionId: Parameters<DodoPayments[\"subscriptions\"][\"updatePaymentMethod\"]>[0],\n body: Parameters<DodoPayments[\"subscriptions\"][\"updatePaymentMethod\"]>[1],\n ): Promise<DodoPaymentMethodUpdate>;\n };\n}\n"]}
|