@gr4vy/sdk 1.8.0 → 1.9.1

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.
Files changed (81) hide show
  1. package/README.md +32 -32
  2. package/examples/package-lock.json +2 -2
  3. package/jsr.json +1 -1
  4. package/lib/config.d.ts +3 -3
  5. package/lib/config.js +3 -3
  6. package/lib/encodings.d.ts +1 -0
  7. package/lib/encodings.d.ts.map +1 -1
  8. package/lib/encodings.js +9 -0
  9. package/lib/encodings.js.map +1 -1
  10. package/models/components/accountsreceivablesreportspec.d.ts +1 -1
  11. package/models/components/accountsreceivablesreportspec.d.ts.map +1 -1
  12. package/models/components/accountsreceivablesreportspec.js +1 -1
  13. package/models/components/accountsreceivablesreportspec.js.map +1 -1
  14. package/models/components/accountupdateroptions.d.ts +1 -1
  15. package/models/components/accountupdateroptions.d.ts.map +1 -1
  16. package/models/components/accountupdateroptions.js +1 -1
  17. package/models/components/accountupdateroptions.js.map +1 -1
  18. package/models/components/applepaypaymentmethodcreate.d.ts +1 -1
  19. package/models/components/applepaypaymentmethodcreate.d.ts.map +1 -1
  20. package/models/components/clicktopayfpanpaymentmethodcreate.d.ts +1 -1
  21. package/models/components/clicktopayfpanpaymentmethodcreate.d.ts.map +1 -1
  22. package/models/components/clicktopaypaymentmethodcreate.d.ts +1 -1
  23. package/models/components/clicktopaypaymentmethodcreate.d.ts.map +1 -1
  24. package/models/components/detailedsettlementreportspec.d.ts +1 -1
  25. package/models/components/detailedsettlementreportspec.d.ts.map +1 -1
  26. package/models/components/detailedsettlementreportspec.js +1 -1
  27. package/models/components/detailedsettlementreportspec.js.map +1 -1
  28. package/models/components/googlepayfpanpaymentmethodcreate.d.ts +1 -1
  29. package/models/components/googlepayfpanpaymentmethodcreate.d.ts.map +1 -1
  30. package/models/components/googlepaypaymentmethodcreate.d.ts +1 -1
  31. package/models/components/googlepaypaymentmethodcreate.d.ts.map +1 -1
  32. package/models/components/networktokenpaymentmethodcreate.d.ts +1 -1
  33. package/models/components/networktokenpaymentmethodcreate.d.ts.map +1 -1
  34. package/models/components/paymentlink.d.ts +8 -0
  35. package/models/components/paymentlink.d.ts.map +1 -1
  36. package/models/components/paymentlink.js +3 -0
  37. package/models/components/paymentlink.js.map +1 -1
  38. package/models/components/paymentlinkcreate.d.ts +10 -0
  39. package/models/components/paymentlinkcreate.d.ts.map +1 -1
  40. package/models/components/paymentlinkcreate.js +3 -0
  41. package/models/components/paymentlinkcreate.js.map +1 -1
  42. package/models/components/reportcreate.d.ts +4 -36
  43. package/models/components/reportcreate.d.ts.map +1 -1
  44. package/models/components/reportcreate.js +8 -8
  45. package/models/components/reportcreate.js.map +1 -1
  46. package/models/components/transactionretriesreportspec.d.ts +1 -1
  47. package/models/components/transactionretriesreportspec.d.ts.map +1 -1
  48. package/models/components/transactionretriesreportspec.js +1 -1
  49. package/models/components/transactionretriesreportspec.js.map +1 -1
  50. package/models/components/transactionsreportspec.d.ts +1 -1
  51. package/models/components/transactionsreportspec.d.ts.map +1 -1
  52. package/models/components/transactionsreportspec.js +1 -1
  53. package/models/components/transactionsreportspec.js.map +1 -1
  54. package/models/operations/listbuyerpaymentmethods.d.ts +1 -1
  55. package/models/operations/listbuyerpaymentmethods.d.ts.map +1 -1
  56. package/models/operations/listbuyerpaymentmethods.js +1 -1
  57. package/models/operations/listbuyerpaymentmethods.js.map +1 -1
  58. package/package.json +2 -2
  59. package/src/lib/config.ts +3 -3
  60. package/src/lib/encodings.ts +13 -0
  61. package/src/models/components/accountsreceivablesreportspec.ts +2 -4
  62. package/src/models/components/accountupdateroptions.ts +2 -2
  63. package/src/models/components/applepaypaymentmethodcreate.ts +1 -1
  64. package/src/models/components/clicktopayfpanpaymentmethodcreate.ts +1 -1
  65. package/src/models/components/clicktopaypaymentmethodcreate.ts +1 -1
  66. package/src/models/components/detailedsettlementreportspec.ts +2 -4
  67. package/src/models/components/googlepayfpanpaymentmethodcreate.ts +1 -1
  68. package/src/models/components/googlepaypaymentmethodcreate.ts +1 -1
  69. package/src/models/components/networktokenpaymentmethodcreate.ts +1 -1
  70. package/src/models/components/paymentlink.ts +11 -0
  71. package/src/models/components/paymentlinkcreate.ts +13 -0
  72. package/src/models/components/reportcreate.ts +24 -42
  73. package/src/models/components/transactionretriesreportspec.ts +2 -4
  74. package/src/models/components/transactionsreportspec.ts +2 -2
  75. package/src/models/operations/listbuyerpaymentmethods.ts +2 -2
  76. package/src/types/unrecognized.ts +9 -1
  77. package/tsconfig.json +1 -2
  78. package/types/unrecognized.d.ts +7 -1
  79. package/types/unrecognized.d.ts.map +1 -1
  80. package/types/unrecognized.js +9 -1
  81. package/types/unrecognized.js.map +1 -1
@@ -115,6 +115,14 @@ export type PaymentLinkCreate = {
115
115
  * The way payment method information made it to this transaction.
116
116
  */
117
117
  paymentSource?: TransactionPaymentSource | undefined;
118
+ /**
119
+ * Whether to store the payment method for future use.
120
+ */
121
+ store?: boolean | undefined;
122
+ /**
123
+ * The ID of the buyer to associate the payment method with. Note: When `buyer_id` is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer.
124
+ */
125
+ buyerId?: string | null | undefined;
118
126
  };
119
127
 
120
128
  /** @internal */
@@ -140,6 +148,8 @@ export type PaymentLinkCreate$Outbound = {
140
148
  cart_items?: Array<CartItem$Outbound> | null | undefined;
141
149
  metadata?: { [k: string]: any } | null | undefined;
142
150
  payment_source?: string | undefined;
151
+ store: boolean;
152
+ buyer_id?: string | null | undefined;
143
153
  };
144
154
 
145
155
  /** @internal */
@@ -171,6 +181,8 @@ export const PaymentLinkCreate$outboundSchema: z.ZodType<
171
181
  cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
172
182
  metadata: z.nullable(z.record(z.any())).optional(),
173
183
  paymentSource: TransactionPaymentSource$outboundSchema.optional(),
184
+ store: z.boolean().default(false),
185
+ buyerId: z.nullable(z.string()).optional(),
174
186
  }).transform((v) => {
175
187
  return remap$(v, {
176
188
  expiresAt: "expires_at",
@@ -187,6 +199,7 @@ export const PaymentLinkCreate$outboundSchema: z.ZodType<
187
199
  returnUrl: "return_url",
188
200
  cartItems: "cart_items",
189
201
  paymentSource: "payment_source",
202
+ buyerId: "buyer_id",
190
203
  });
191
204
  });
192
205
 
@@ -33,10 +33,10 @@ import {
33
33
  * The report specification.
34
34
  */
35
35
  export type Spec =
36
- | (AccountsReceivablesReportSpec & { model: "accounts_receivables" })
37
- | (DetailedSettlementReportSpec & { model: "detailed_settlement" })
38
- | (TransactionRetriesReportSpec & { model: "transaction_retries" })
39
- | (TransactionsReportSpec & { model: "transactions" });
36
+ | AccountsReceivablesReportSpec
37
+ | DetailedSettlementReportSpec
38
+ | TransactionRetriesReportSpec
39
+ | TransactionsReportSpec;
40
40
 
41
41
  export type ReportCreate = {
42
42
  /**
@@ -60,34 +60,26 @@ export type ReportCreate = {
60
60
  * The report specification.
61
61
  */
62
62
  spec:
63
- | (AccountsReceivablesReportSpec & { model: "accounts_receivables" })
64
- | (DetailedSettlementReportSpec & { model: "detailed_settlement" })
65
- | (TransactionRetriesReportSpec & { model: "transaction_retries" })
66
- | (TransactionsReportSpec & { model: "transactions" });
63
+ | AccountsReceivablesReportSpec
64
+ | DetailedSettlementReportSpec
65
+ | TransactionRetriesReportSpec
66
+ | TransactionsReportSpec;
67
67
  };
68
68
 
69
69
  /** @internal */
70
70
  export type Spec$Outbound =
71
- | (AccountsReceivablesReportSpec$Outbound & { model: "accounts_receivables" })
72
- | (DetailedSettlementReportSpec$Outbound & { model: "detailed_settlement" })
73
- | (TransactionRetriesReportSpec$Outbound & { model: "transaction_retries" })
74
- | (TransactionsReportSpec$Outbound & { model: "transactions" });
71
+ | AccountsReceivablesReportSpec$Outbound
72
+ | DetailedSettlementReportSpec$Outbound
73
+ | TransactionRetriesReportSpec$Outbound
74
+ | TransactionsReportSpec$Outbound;
75
75
 
76
76
  /** @internal */
77
77
  export const Spec$outboundSchema: z.ZodType<Spec$Outbound, z.ZodTypeDef, Spec> =
78
78
  z.union([
79
- AccountsReceivablesReportSpec$outboundSchema.and(
80
- z.object({ model: z.literal("accounts_receivables") }),
81
- ),
82
- DetailedSettlementReportSpec$outboundSchema.and(
83
- z.object({ model: z.literal("detailed_settlement") }),
84
- ),
85
- TransactionRetriesReportSpec$outboundSchema.and(
86
- z.object({ model: z.literal("transaction_retries") }),
87
- ),
88
- TransactionsReportSpec$outboundSchema.and(
89
- z.object({ model: z.literal("transactions") }),
90
- ),
79
+ AccountsReceivablesReportSpec$outboundSchema,
80
+ DetailedSettlementReportSpec$outboundSchema,
81
+ TransactionRetriesReportSpec$outboundSchema,
82
+ TransactionsReportSpec$outboundSchema,
91
83
  ]);
92
84
 
93
85
  export function specToJSON(spec: Spec): string {
@@ -102,12 +94,10 @@ export type ReportCreate$Outbound = {
102
94
  schedule_enabled: boolean;
103
95
  schedule_timezone: string;
104
96
  spec:
105
- | (AccountsReceivablesReportSpec$Outbound & {
106
- model: "accounts_receivables";
107
- })
108
- | (DetailedSettlementReportSpec$Outbound & { model: "detailed_settlement" })
109
- | (TransactionRetriesReportSpec$Outbound & { model: "transaction_retries" })
110
- | (TransactionsReportSpec$Outbound & { model: "transactions" });
97
+ | AccountsReceivablesReportSpec$Outbound
98
+ | DetailedSettlementReportSpec$Outbound
99
+ | TransactionRetriesReportSpec$Outbound
100
+ | TransactionsReportSpec$Outbound;
111
101
  };
112
102
 
113
103
  /** @internal */
@@ -122,18 +112,10 @@ export const ReportCreate$outboundSchema: z.ZodType<
122
112
  scheduleEnabled: z.boolean(),
123
113
  scheduleTimezone: z.string().default("Etc/UTC"),
124
114
  spec: z.union([
125
- AccountsReceivablesReportSpec$outboundSchema.and(
126
- z.object({ model: z.literal("accounts_receivables") }),
127
- ),
128
- DetailedSettlementReportSpec$outboundSchema.and(
129
- z.object({ model: z.literal("detailed_settlement") }),
130
- ),
131
- TransactionRetriesReportSpec$outboundSchema.and(
132
- z.object({ model: z.literal("transaction_retries") }),
133
- ),
134
- TransactionsReportSpec$outboundSchema.and(
135
- z.object({ model: z.literal("transactions") }),
136
- ),
115
+ AccountsReceivablesReportSpec$outboundSchema,
116
+ DetailedSettlementReportSpec$outboundSchema,
117
+ TransactionRetriesReportSpec$outboundSchema,
118
+ TransactionsReportSpec$outboundSchema,
137
119
  ]),
138
120
  }).transform((v) => {
139
121
  return remap$(v, {
@@ -8,7 +8,7 @@ export type TransactionRetriesReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "transaction_retries" | undefined;
11
+ model: "transaction_retries";
12
12
  /**
13
13
  * The parameters for the transaction retries report model.
14
14
  */
@@ -27,9 +27,7 @@ export const TransactionRetriesReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  TransactionRetriesReportSpec
29
29
  > = z.object({
30
- model: z.literal("transaction_retries").default(
31
- "transaction_retries" as const,
32
- ),
30
+ model: z.literal("transaction_retries"),
33
31
  params: z.record(z.any()),
34
32
  });
35
33
 
@@ -8,7 +8,7 @@ export type TransactionsReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "transactions" | undefined;
11
+ model: "transactions";
12
12
  /**
13
13
  * The parameters for the transactions report model.
14
14
  */
@@ -27,7 +27,7 @@ export const TransactionsReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  TransactionsReportSpec
29
29
  > = z.object({
30
- model: z.literal("transactions").default("transactions" as const),
30
+ model: z.literal("transactions"),
31
31
  params: z.record(z.any()),
32
32
  });
33
33
 
@@ -62,7 +62,7 @@ export const OrderBy$outboundSchema: z.ZodType<string, z.ZodTypeDef, OrderBy> =
62
62
  export type ListBuyerPaymentMethodsRequest$Outbound = {
63
63
  buyer_id?: string | null | undefined;
64
64
  buyer_external_identifier?: string | null | undefined;
65
- sort_by: "last_used_at" | null;
65
+ sort_by?: "last_used_at" | null | undefined;
66
66
  order_by: string;
67
67
  country?: string | null | undefined;
68
68
  currency?: string | null | undefined;
@@ -77,7 +77,7 @@ export const ListBuyerPaymentMethodsRequest$outboundSchema: z.ZodType<
77
77
  > = z.object({
78
78
  buyerId: z.nullable(z.string()).optional(),
79
79
  buyerExternalIdentifier: z.nullable(z.string()).optional(),
80
- sortBy: z.nullable(z.literal("last_used_at")),
80
+ sortBy: z.nullable(z.literal("last_used_at")).optional(),
81
81
  orderBy: OrderBy$outboundSchema.default("desc"),
82
82
  country: z.nullable(z.string()).optional(),
83
83
  currency: z.nullable(z.string()).optional(),
@@ -16,8 +16,16 @@ export function startCountingUnrecognized() {
16
16
  refCount++;
17
17
  const start = globalCount;
18
18
  return {
19
- end: () => {
19
+ /**
20
+ * Ends counting and returns the delta.
21
+ * @param delta - If provided, only this amount is added to the parent counter
22
+ * (used for nested unions where we only want to record the winning option's count).
23
+ * If not provided, records all counts since start().
24
+ */
25
+ end: (delta?: number) => {
20
26
  const count = globalCount - start;
27
+ // Reset globalCount back to start, then add only the specified delta
28
+ globalCount = start + (delta ?? count);
21
29
  if (--refCount === 0) globalCount = 0;
22
30
  return count;
23
31
  },
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "incremental": true,
4
- "tsBuildInfoFile": ".tsbuildinfo",
3
+ "incremental": false,
5
4
  "target": "ES2020",
6
5
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
6
  "jsx": "react-jsx",
@@ -4,7 +4,13 @@ export type Unrecognized<T> = T & {
4
4
  };
5
5
  declare function unrecognized<T>(value: T): Unrecognized<T>;
6
6
  export declare function startCountingUnrecognized(): {
7
- end: () => number;
7
+ /**
8
+ * Ends counting and returns the delta.
9
+ * @param delta - If provided, only this amount is added to the parent counter
10
+ * (used for nested unions where we only want to record the winning option's count).
11
+ * If not provided, records all counts since start().
12
+ */
13
+ end: (delta?: number) => number;
8
14
  };
9
15
  export { unrecognized };
10
16
  //# sourceMappingURL=unrecognized.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB;;EAUxC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB;IAIrC;;;;;OAKG;kBACW,MAAM;EAQvB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -15,8 +15,16 @@ function startCountingUnrecognized() {
15
15
  refCount++;
16
16
  const start = globalCount;
17
17
  return {
18
- end: () => {
18
+ /**
19
+ * Ends counting and returns the delta.
20
+ * @param delta - If provided, only this amount is added to the parent counter
21
+ * (used for nested unions where we only want to record the winning option's count).
22
+ * If not provided, records all counts since start().
23
+ */
24
+ end: (delta) => {
19
25
  const count = globalCount - start;
26
+ // Reset globalCount back to start, then add only the specified delta
27
+ globalCount = start + (delta ?? count);
20
28
  if (--refCount === 0)
21
29
  globalCount = 0;
22
30
  return count;
@@ -1 +1 @@
1
- {"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../src/types/unrecognized.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAYH,8DAUC;AAEQ,oCAAY;AAnBrB,SAAS,YAAY,CAAI,KAAQ;IAC/B,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAClC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,SAAgB,yBAAyB;IACvC,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE;YACR,MAAM,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;YAClC,IAAI,EAAE,QAAQ,KAAK,CAAC;gBAAE,WAAW,GAAG,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../src/types/unrecognized.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAYH,8DAkBC;AAEQ,oCAAY;AA3BrB,SAAS,YAAY,CAAI,KAAQ;IAC/B,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAClC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,SAAgB,yBAAyB;IACvC,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL;;;;;WAKG;QACH,GAAG,EAAE,CAAC,KAAc,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;YAClC,qEAAqE;YACrE,WAAW,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;YACvC,IAAI,EAAE,QAAQ,KAAK,CAAC;gBAAE,WAAW,GAAG,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}