@automate.ax/integration-contracts 0.87.2 → 0.87.3
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/stripe/schemas.d.ts +9 -1
- package/package.json +2 -2
- package/src/stripe/schemas.ts +15 -1
package/dist/stripe/schemas.d.ts
CHANGED
|
@@ -3,8 +3,15 @@ import type Stripe from "stripe";
|
|
|
3
3
|
import type { CamelCasedPropertiesDeep } from "type-fest";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
export declare const STRIPE_SEMANTIC_EVENT_TYPES: readonly ["charge.dispute.closed", "charge.dispute.created", "checkout.session.async_payment_failed", "checkout.session.async_payment_succeeded", "checkout.session.completed", "checkout.session.expired", "customer.created", "customer.deleted", "customer.subscription.created", "customer.subscription.deleted", "customer.subscription.trial_will_end", "customer.subscription.updated", "customer.updated", "invoice.finalized", "invoice.overdue", "invoice.paid", "invoice.payment_failed", "invoice.voided", "payment_intent.canceled", "payment_intent.payment_failed", "payment_intent.succeeded", "payout.failed", "payout.paid", "refund.created", "refund.failed"];
|
|
6
|
+
type StringifiedStripeDecimals<T> = T extends ReturnType<(typeof Stripe.Decimal)["from"]> ? string : T extends readonly unknown[] ? {
|
|
7
|
+
[TIndex in keyof T]: StringifiedStripeDecimals<T[TIndex]>;
|
|
8
|
+
} : T extends object ? {
|
|
9
|
+
[TKey in keyof T]: StringifiedStripeDecimals<T[TKey]>;
|
|
10
|
+
} : T;
|
|
11
|
+
/** Camel-cased, JSON-safe representation of an official Stripe SDK type. */
|
|
12
|
+
export type StripePublicValue<T> = CamelCasedPropertiesDeep<StringifiedStripeDecimals<T>>;
|
|
6
13
|
/** Public camelCase representation of an official Stripe event type. */
|
|
7
|
-
export type StripeEvent<TEvent extends Stripe.Event = Stripe.Event> =
|
|
14
|
+
export type StripeEvent<TEvent extends Stripe.Event = Stripe.Event> = StripePublicValue<TEvent> & Encodable;
|
|
8
15
|
/** Public event type for one exact Stripe event name. */
|
|
9
16
|
export type StripeSemanticEvent<TType extends Stripe.Event.Type> = StripeEvent<Extract<Stripe.Event, {
|
|
10
17
|
type: TType;
|
|
@@ -24,3 +31,4 @@ export declare function normalizeStripeEvent(event: unknown): StripeEvent;
|
|
|
24
31
|
* @returns Runtime schema for the semantic event.
|
|
25
32
|
*/
|
|
26
33
|
export declare function stripeSemanticEventSchema<TType extends (typeof STRIPE_SEMANTIC_EVENT_TYPES)[number]>(type: TType): z.ZodType<StripeSemanticEvent<TType>>;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.3",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@automate.ax/codec": "0.87.
|
|
48
|
+
"@automate.ax/codec": "0.87.3",
|
|
49
49
|
"@googleapis/calendar": "^15.0.0",
|
|
50
50
|
"@googleapis/forms": "^6.0.1",
|
|
51
51
|
"@googleapis/gmail": "^12.0.0",
|
package/src/stripe/schemas.ts
CHANGED
|
@@ -48,9 +48,23 @@ const STRIPE_EVENT_BASE_SCHEMA = z.looseObject({
|
|
|
48
48
|
type: z.string().min(1),
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
+
type StringifiedStripeDecimals<T> =
|
|
52
|
+
T extends ReturnType<(typeof Stripe.Decimal)["from"]>
|
|
53
|
+
? string
|
|
54
|
+
: T extends readonly unknown[]
|
|
55
|
+
? { [TIndex in keyof T]: StringifiedStripeDecimals<T[TIndex]> }
|
|
56
|
+
: T extends object
|
|
57
|
+
? { [TKey in keyof T]: StringifiedStripeDecimals<T[TKey]> }
|
|
58
|
+
: T
|
|
59
|
+
|
|
60
|
+
/** Camel-cased, JSON-safe representation of an official Stripe SDK type. */
|
|
61
|
+
export type StripePublicValue<T> = CamelCasedPropertiesDeep<
|
|
62
|
+
StringifiedStripeDecimals<T>
|
|
63
|
+
>
|
|
64
|
+
|
|
51
65
|
/** Public camelCase representation of an official Stripe event type. */
|
|
52
66
|
export type StripeEvent<TEvent extends Stripe.Event = Stripe.Event> =
|
|
53
|
-
|
|
67
|
+
StripePublicValue<TEvent> & Encodable
|
|
54
68
|
|
|
55
69
|
/** Public event type for one exact Stripe event name. */
|
|
56
70
|
export type StripeSemanticEvent<TType extends Stripe.Event.Type> = StripeEvent<
|