@peable.to/shared-types 0.12.0 → 0.13.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/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = exports.PEABLE_BILLING_AUTHORITY_KEYS = exports.canonicalBillingTaxQuote = exports.canonicalBillingAuthority = exports.BILLING_SUBSCRIPTION_STATUSES = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.MERCHANT_ENVIRONMENTS = exports.verifyWebhook = exports.signWebhook = exports.CATALOG_LIMITS = exports.COUPON_DURATIONS = exports.TRANSFORM_QUANTITY_ROUNDS = exports.PRICE_TAX_BEHAVIORS = exports.RECURRING_USAGE_TYPES = exports.RECURRING_INTERVALS = exports.PRICE_TYPES = exports.PRICE_TIERS_MODES = exports.PRICE_BILLING_SCHEMES = exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = exports.WEBHOOK_ENDPOINT_STATUSES = exports.PEABLE_API_VERSION = exports.SETUP_INTENT_STATUSES = exports.isValidStatusTransition = exports.canStillBePaid = exports.canExpire = exports.TERMINAL_STATUSES = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_RAILS = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.MERCHANT_CANCELLATION_REASONS = exports.EXPIRABLE_STATUSES = exports.CARD_ONLY_STATUSES = exports.isCurrencyCode = exports.decimalsFor = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = exports.isBaseUnitString = exports.UNITS_PER_COIN = void 0;
3
+ exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = exports.PEABLE_BILLING_AUTHORITY_KEYS = exports.canonicalBillingTaxQuote = exports.canonicalBillingAuthority = exports.BILLING_SUBSCRIPTION_STATUSES = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.MERCHANT_ENVIRONMENTS = exports.verifyWebhook = exports.signWebhook = exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.REQUEST_LOG_RETENTION_DAYS = exports.REQUEST_LOG_METHODS = exports.CATALOG_LIMITS = exports.COUPON_DURATIONS = exports.TRANSFORM_QUANTITY_ROUNDS = exports.PRICE_TAX_BEHAVIORS = exports.RECURRING_USAGE_TYPES = exports.RECURRING_INTERVALS = exports.PRICE_TYPES = exports.PRICE_TIERS_MODES = exports.PRICE_BILLING_SCHEMES = exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = exports.WEBHOOK_ENDPOINT_STATUSES = exports.PEABLE_API_VERSION = exports.SETUP_INTENT_STATUSES = exports.isValidStatusTransition = exports.canStillBePaid = exports.canExpire = exports.TERMINAL_STATUSES = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_RAILS = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.MERCHANT_CANCELLATION_REASONS = exports.EXPIRABLE_STATUSES = exports.CARD_ONLY_STATUSES = exports.isCurrencyCode = exports.decimalsFor = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = exports.isBaseUnitString = exports.UNITS_PER_COIN = void 0;
4
4
  // @peable.to/shared-types — public API for the Peable Gateway contract.
5
5
  var money_1 = require("./money");
6
6
  Object.defineProperty(exports, "UNITS_PER_COIN", { enumerable: true, get: function () { return money_1.UNITS_PER_COIN; } });
@@ -41,6 +41,11 @@ Object.defineProperty(exports, "PRICE_TAX_BEHAVIORS", { enumerable: true, get: f
41
41
  Object.defineProperty(exports, "TRANSFORM_QUANTITY_ROUNDS", { enumerable: true, get: function () { return catalog_1.TRANSFORM_QUANTITY_ROUNDS; } });
42
42
  Object.defineProperty(exports, "COUPON_DURATIONS", { enumerable: true, get: function () { return catalog_1.COUPON_DURATIONS; } });
43
43
  Object.defineProperty(exports, "CATALOG_LIMITS", { enumerable: true, get: function () { return catalog_1.CATALOG_LIMITS; } });
44
+ var requestLog_1 = require("./requestLog");
45
+ Object.defineProperty(exports, "REQUEST_LOG_METHODS", { enumerable: true, get: function () { return requestLog_1.REQUEST_LOG_METHODS; } });
46
+ Object.defineProperty(exports, "REQUEST_LOG_RETENTION_DAYS", { enumerable: true, get: function () { return requestLog_1.REQUEST_LOG_RETENTION_DAYS; } });
47
+ var testHelpers_1 = require("./testHelpers");
48
+ Object.defineProperty(exports, "SIMULATED_FAIRCOIN_OUTCOMES", { enumerable: true, get: function () { return testHelpers_1.SIMULATED_FAIRCOIN_OUTCOMES; } });
44
49
  var webhookSigner_1 = require("./webhookSigner");
45
50
  Object.defineProperty(exports, "signWebhook", { enumerable: true, get: function () { return webhookSigner_1.signWebhook; } });
46
51
  Object.defineProperty(exports, "verifyWebhook", { enumerable: true, get: function () { return webhookSigner_1.verifyWebhook; } });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REQUEST_LOG_RETENTION_DAYS = exports.REQUEST_LOG_METHODS = void 0;
4
+ /**
5
+ * One merchant API request, as Peable recorded it (`req_…`) — the request log
6
+ * Orbit and `peable logs tail` read.
7
+ *
8
+ * Its `id` IS the `Request-Id` that request was answered with, so the id a
9
+ * merchant quotes to support and the log row are the same thing.
10
+ *
11
+ * Deliberately thin: method, path (no query string), status, duration and the
12
+ * `Idempotency-Key` it carried. No body, no headers, no query string, no
13
+ * caller address — a log a merchant can read is a log that must not hold what
14
+ * a request carried. Kept 30 days.
15
+ */
16
+ exports.REQUEST_LOG_METHODS = ['GET', 'POST', 'DELETE', 'PATCH', 'PUT'];
17
+ /** How long a request log is kept (and served). */
18
+ exports.REQUEST_LOG_RETENTION_DAYS = 30;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Test helpers (`/v1/test_helpers/*`) — test mode only.
4
+ *
5
+ * They drive a test-mode object through the SAME state machine a real payment
6
+ * moves through, so a merchant can exercise their integration end to end
7
+ * without a wallet or a card: every transition a helper makes is one the
8
+ * gateway would make, with the same events and webhooks.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.SIMULATED_FAIRCOIN_OUTCOMES = void 0;
12
+ /**
13
+ * What `simulate_faircoin_payment` pretends the payer did.
14
+ *
15
+ * - `settled` — paid the full amount, which is then seen in the mempool and
16
+ * confirmed: `broadcast → confirming → settled`
17
+ * (`payment_intent.confirming`, then `payment_intent.settled`).
18
+ * - `underpaid` — sent less than the amount: `broadcast → failed`
19
+ * (`payment_intent.failed`).
20
+ */
21
+ exports.SIMULATED_FAIRCOIN_OUTCOMES = ['settled', 'underpaid'];
package/dist/esm/index.js CHANGED
@@ -5,6 +5,8 @@ export { SETUP_INTENT_STATUSES, } from './setupIntent.js';
5
5
  export { PEABLE_API_VERSION, } from './event.js';
6
6
  export { WEBHOOK_ENDPOINT_STATUSES, WEBHOOK_ENDPOINT_DISABLED_REASONS, WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT, WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS, } from './webhookEndpoint.js';
7
7
  export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERVALS, RECURRING_USAGE_TYPES, PRICE_TAX_BEHAVIORS, TRANSFORM_QUANTITY_ROUNDS, COUPON_DURATIONS, CATALOG_LIMITS, } from './catalog.js';
8
+ export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, } from './requestLog.js';
9
+ export { SIMULATED_FAIRCOIN_OUTCOMES, } from './testHelpers.js';
8
10
  export { signWebhook, verifyWebhook } from './webhookSigner.js';
9
11
  export { MERCHANT_ENVIRONMENTS, } from './merchant.js';
10
12
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from './social.js';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * One merchant API request, as Peable recorded it (`req_…`) — the request log
3
+ * Orbit and `peable logs tail` read.
4
+ *
5
+ * Its `id` IS the `Request-Id` that request was answered with, so the id a
6
+ * merchant quotes to support and the log row are the same thing.
7
+ *
8
+ * Deliberately thin: method, path (no query string), status, duration and the
9
+ * `Idempotency-Key` it carried. No body, no headers, no query string, no
10
+ * caller address — a log a merchant can read is a log that must not hold what
11
+ * a request carried. Kept 30 days.
12
+ */
13
+ export const REQUEST_LOG_METHODS = ['GET', 'POST', 'DELETE', 'PATCH', 'PUT'];
14
+ /** How long a request log is kept (and served). */
15
+ export const REQUEST_LOG_RETENTION_DAYS = 30;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Test helpers (`/v1/test_helpers/*`) — test mode only.
3
+ *
4
+ * They drive a test-mode object through the SAME state machine a real payment
5
+ * moves through, so a merchant can exercise their integration end to end
6
+ * without a wallet or a card: every transition a helper makes is one the
7
+ * gateway would make, with the same events and webhooks.
8
+ */
9
+ /**
10
+ * What `simulate_faircoin_payment` pretends the payer did.
11
+ *
12
+ * - `settled` — paid the full amount, which is then seen in the mempool and
13
+ * confirmed: `broadcast → confirming → settled`
14
+ * (`payment_intent.confirming`, then `payment_intent.settled`).
15
+ * - `underpaid` — sent less than the amount: `broadcast → failed`
16
+ * (`payment_intent.failed`).
17
+ */
18
+ export const SIMULATED_FAIRCOIN_OUTCOMES = ['settled', 'underpaid'];
@@ -12,6 +12,8 @@ export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERV
12
12
  export type { Dispute, DisputeEvidence, DisputeStatus } from './dispute';
13
13
  export type { CapabilityStatus, ConnectedAccount, ConnectedAccountFaircoin, ConnectedAccountFaircoinStatus, ConnectedAccountRail, Refund, RefundOrigin, RefundStatus, Settlement, Transfer, TransferReversal, TransferReversalStatus, TransferStatus, TransferWithReversal, } from './settlement';
14
14
  export type { WebhookDelivery, WebhookDeliveryStatus, } from './webhookDelivery';
15
+ export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, type RequestLog, type RequestLogListParams, type RequestLogMethod, type RequestLogStatusFilter, } from './requestLog';
16
+ export { SIMULATED_FAIRCOIN_OUTCOMES, type SimulatedFaircoinOutcome, type SimulateFaircoinPaymentParams, } from './testHelpers';
15
17
  export { signWebhook, verifyWebhook } from './webhookSigner';
16
18
  export { type MerchantEnvironment, type Merchant, MERCHANT_ENVIRONMENTS, } from './merchant';
17
19
  export type { MerchantDisplay } from './merchantDisplay';
@@ -0,0 +1,40 @@
1
+ import type { ListParams } from './list';
2
+ /**
3
+ * One merchant API request, as Peable recorded it (`req_…`) — the request log
4
+ * Orbit and `peable logs tail` read.
5
+ *
6
+ * Its `id` IS the `Request-Id` that request was answered with, so the id a
7
+ * merchant quotes to support and the log row are the same thing.
8
+ *
9
+ * Deliberately thin: method, path (no query string), status, duration and the
10
+ * `Idempotency-Key` it carried. No body, no headers, no query string, no
11
+ * caller address — a log a merchant can read is a log that must not hold what
12
+ * a request carried. Kept 30 days.
13
+ */
14
+ export declare const REQUEST_LOG_METHODS: readonly ["GET", "POST", "DELETE", "PATCH", "PUT"];
15
+ export type RequestLogMethod = (typeof REQUEST_LOG_METHODS)[number];
16
+ export interface RequestLog {
17
+ /** The request's `Request-Id` (`req_…`). */
18
+ id: string;
19
+ object: 'request_log';
20
+ livemode: boolean;
21
+ method: RequestLogMethod;
22
+ /** The path that was requested, without its query string. */
23
+ path: string;
24
+ /** The HTTP status it was answered with. */
25
+ status: number;
26
+ /** How long the gateway took to answer, in milliseconds. */
27
+ duration_ms: number;
28
+ /** The `Idempotency-Key` the request carried, if it carried a valid one. */
29
+ idempotency_key: string | null;
30
+ /** When it was answered, Unix seconds. */
31
+ created: number;
32
+ }
33
+ /** `status`: one code (`404`) or a class (`2xx`, `4xx`, `5xx`). */
34
+ export type RequestLogStatusFilter = number | '2xx' | '3xx' | '4xx' | '5xx';
35
+ export interface RequestLogListParams extends ListParams {
36
+ status?: RequestLogStatusFilter;
37
+ method?: RequestLogMethod;
38
+ }
39
+ /** How long a request log is kept (and served). */
40
+ export declare const REQUEST_LOG_RETENTION_DAYS = 30;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Test helpers (`/v1/test_helpers/*`) — test mode only.
3
+ *
4
+ * They drive a test-mode object through the SAME state machine a real payment
5
+ * moves through, so a merchant can exercise their integration end to end
6
+ * without a wallet or a card: every transition a helper makes is one the
7
+ * gateway would make, with the same events and webhooks.
8
+ */
9
+ /**
10
+ * What `simulate_faircoin_payment` pretends the payer did.
11
+ *
12
+ * - `settled` — paid the full amount, which is then seen in the mempool and
13
+ * confirmed: `broadcast → confirming → settled`
14
+ * (`payment_intent.confirming`, then `payment_intent.settled`).
15
+ * - `underpaid` — sent less than the amount: `broadcast → failed`
16
+ * (`payment_intent.failed`).
17
+ */
18
+ export declare const SIMULATED_FAIRCOIN_OUTCOMES: readonly ["settled", "underpaid"];
19
+ export type SimulatedFaircoinOutcome = (typeof SIMULATED_FAIRCOIN_OUTCOMES)[number];
20
+ export interface SimulateFaircoinPaymentParams {
21
+ /** Default `settled`. */
22
+ outcome?: SimulatedFaircoinOutcome;
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/shared-types",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Shared TypeScript types for the Peable Gateway — the wire contract shared by the backend, SDK, and frontend.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",