@polar-sh/sdk 0.35.1 → 0.35.2

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 (35) hide show
  1. package/bin/mcp-server.js +467 -449
  2. package/bin/mcp-server.js.map +8 -8
  3. package/dist/commonjs/lib/config.d.ts +2 -2
  4. package/dist/commonjs/lib/config.js +2 -2
  5. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  6. package/dist/commonjs/mcp-server/server.js +1 -1
  7. package/dist/commonjs/models/components/address.d.ts +670 -670
  8. package/dist/commonjs/models/components/address.js +222 -222
  9. package/dist/commonjs/models/components/addressinput.d.ts +653 -653
  10. package/dist/commonjs/models/components/addressinput.js +217 -217
  11. package/dist/commonjs/models/components/customerstatesubscription.d.ts +38 -2
  12. package/dist/commonjs/models/components/customerstatesubscription.d.ts.map +1 -1
  13. package/dist/commonjs/models/components/customerstatesubscription.js +30 -3
  14. package/dist/commonjs/models/components/customerstatesubscription.js.map +1 -1
  15. package/dist/esm/lib/config.d.ts +2 -2
  16. package/dist/esm/lib/config.js +2 -2
  17. package/dist/esm/mcp-server/mcp-server.js +1 -1
  18. package/dist/esm/mcp-server/server.js +1 -1
  19. package/dist/esm/models/components/address.d.ts +670 -670
  20. package/dist/esm/models/components/address.js +222 -222
  21. package/dist/esm/models/components/addressinput.d.ts +653 -653
  22. package/dist/esm/models/components/addressinput.js +217 -217
  23. package/dist/esm/models/components/customerstatesubscription.d.ts +38 -2
  24. package/dist/esm/models/components/customerstatesubscription.d.ts.map +1 -1
  25. package/dist/esm/models/components/customerstatesubscription.js +29 -2
  26. package/dist/esm/models/components/customerstatesubscription.js.map +1 -1
  27. package/examples/package-lock.json +1 -1
  28. package/jsr.json +1 -1
  29. package/package.json +1 -1
  30. package/src/lib/config.ts +2 -2
  31. package/src/mcp-server/mcp-server.ts +1 -1
  32. package/src/mcp-server/server.ts +1 -1
  33. package/src/models/components/address.ts +222 -222
  34. package/src/models/components/addressinput.ts +217 -217
  35. package/src/models/components/customerstatesubscription.ts +56 -4
@@ -10,250 +10,250 @@ import { Result as SafeParseResult } from "../../types/fp.js";
10
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
11
 
12
12
  export const CountryAlpha2Input = {
13
- Am: "AM",
14
- Na: "NA",
15
- Sx: "SX",
16
- Gp: "GP",
17
- Mq: "MQ",
18
- Pk: "PK",
19
- Ne: "NE",
20
- Tj: "TJ",
21
- Ws: "WS",
22
- Al: "AL",
23
- Gs: "GS",
24
- Sr: "SR",
25
- Hu: "HU",
26
- Bv: "BV",
27
- Il: "IL",
13
+ Cw: "CW",
14
+ Ms: "MS",
15
+ Ph: "PH",
16
+ Gw: "GW",
17
+ Tf: "TF",
18
+ Jm: "JM",
19
+ Ly: "LY",
20
+ Tw: "TW",
21
+ Gy: "GY",
22
+ Um: "UM",
23
+ Er: "ER",
24
+ Mv: "MV",
25
+ At: "AT",
26
+ In: "IN",
27
+ Sd: "SD",
28
28
  Vc: "VC",
29
- La: "LA",
30
- Cl: "CL",
31
- Ee: "EE",
32
- Fi: "FI",
33
- Pt: "PT",
29
+ Us: "US",
30
+ Aq: "AQ",
31
+ Ae: "AE",
32
+ Nf: "NF",
33
+ Lk: "LK",
34
+ Co: "CO",
35
+ Qa: "QA",
36
+ Nz: "NZ",
37
+ Pr: "PR",
38
+ Tl: "TL",
39
+ Mz: "MZ",
40
+ Tn: "TN",
41
+ Bm: "BM",
42
+ Ht: "HT",
43
+ Je: "JE",
34
44
  Lc: "LC",
45
+ Cy: "CY",
46
+ Lv: "LV",
47
+ Ml: "ML",
48
+ Dz: "DZ",
49
+ Ps: "PS",
50
+ Ve: "VE",
51
+ Bh: "BH",
52
+ Et: "ET",
35
53
  By: "BY",
36
- Co: "CO",
37
- Tt: "TT",
38
- Mf: "MF",
39
- De: "DE",
40
- Iq: "IQ",
41
- At: "AT",
42
- Km: "KM",
43
- Ni: "NI",
44
- Sc: "SC",
45
- Sd: "SD",
46
- Cn: "CN",
47
- Ng: "NG",
54
+ Mp: "MP",
55
+ Bo: "BO",
56
+ Sh: "SH",
57
+ Kw: "KW",
58
+ Sg: "SG",
59
+ Mx: "MX",
60
+ Pa: "PA",
61
+ Zm: "ZM",
62
+ To: "TO",
63
+ Kn: "KN",
64
+ Pt: "PT",
65
+ Ws: "WS",
66
+ Bs: "BS",
67
+ Za: "ZA",
68
+ Mo: "MO",
69
+ Ie: "IE",
48
70
  Br: "BR",
49
- Ph: "PH",
50
- Tm: "TM",
51
- Va: "VA",
52
- Ga: "GA",
71
+ As: "AS",
72
+ Es: "ES",
73
+ Pf: "PF",
74
+ Ke: "KE",
53
75
  Bb: "BB",
54
- Gt: "GT",
55
- Ps: "PS",
56
- Gd: "GD",
57
- Tn: "TN",
58
- Zw: "ZW",
59
- Ca: "CA",
76
+ Re: "RE",
77
+ Tv: "TV",
78
+ Gh: "GH",
60
79
  Tz: "TZ",
61
- Eh: "EH",
62
- Pn: "PN",
63
- Cw: "CW",
80
+ Kz: "KZ",
81
+ Sx: "SX",
82
+ Cx: "CX",
83
+ Mm: "MM",
84
+ Pk: "PK",
85
+ Na: "NA",
86
+ Be: "BE",
87
+ Fj: "FJ",
88
+ Lr: "LR",
89
+ Ua: "UA",
90
+ Me: "ME",
91
+ Mw: "MW",
92
+ Vn: "VN",
64
93
  Lu: "LU",
65
- Ug: "UG",
66
- In: "IN",
67
- Pa: "PA",
68
- Hk: "HK",
69
- Pr: "PR",
70
- Ki: "KI",
71
- Aq: "AQ",
72
- Bz: "BZ",
73
- Fr: "FR",
94
+ Mu: "MU",
95
+ Is: "IS",
96
+ Nu: "NU",
97
+ Pm: "PM",
98
+ Bw: "BW",
99
+ Td: "TD",
74
100
  Yt: "YT",
75
- Ie: "IE",
76
- Um: "UM",
77
- Gu: "GU",
78
- Jo: "JO",
79
- Cc: "CC",
80
- Vi: "VI",
81
- Nc: "NC",
82
- Do: "DO",
83
- Cr: "CR",
84
- Ar: "AR",
85
- Ai: "AI",
86
- Bf: "BF",
87
- Ec: "EC",
88
- Im: "IM",
89
- Za: "ZA",
90
- Tf: "TF",
91
- Bd: "BD",
92
- Mx: "MX",
93
- Cy: "CY",
101
+ Fo: "FO",
102
+ Tr: "TR",
103
+ Rw: "RW",
104
+ Id: "ID",
105
+ No: "NO",
106
+ Ck: "CK",
107
+ Ss: "SS",
108
+ De: "DE",
109
+ Mk: "MK",
110
+ La: "LA",
111
+ Ee: "EE",
112
+ Mn: "MN",
113
+ Gi: "GI",
94
114
  Vu: "VU",
95
- Mp: "MP",
96
- Mz: "MZ",
97
- Mu: "MU",
98
- Lk: "LK",
99
- Bo: "BO",
100
- Sa: "SA",
101
- Bn: "BN",
102
- Sl: "SL",
103
- Lr: "LR",
104
- Cz: "CZ",
105
- Et: "ET",
106
- Re: "RE",
115
+ Ro: "RO",
116
+ Ao: "AO",
117
+ Ar: "AR",
107
118
  Tk: "TK",
108
- Io: "IO",
119
+ Uy: "UY",
120
+ Kh: "KH",
121
+ Bg: "BG",
122
+ Tj: "TJ",
123
+ Ug: "UG",
124
+ Cc: "CC",
125
+ Cd: "CD",
126
+ Gd: "GD",
127
+ Cl: "CL",
128
+ Gu: "GU",
129
+ Il: "IL",
130
+ Kr: "KR",
131
+ Pe: "PE",
132
+ Sn: "SN",
109
133
  Sm: "SM",
110
- Pw: "PW",
111
- Kn: "KN",
112
- Cv: "CV",
113
- To: "TO",
114
- Tw: "TW",
115
- Nr: "NR",
116
- Ma: "MA",
117
- Gr: "GR",
118
- Bh: "BH",
119
- Th: "TH",
120
- Jm: "JM",
121
- Vn: "VN",
122
- Ch: "CH",
123
- Pl: "PL",
124
- Me: "ME",
125
- Fo: "FO",
126
- Fj: "FJ",
127
- Ve: "VE",
128
- Gw: "GW",
129
- Ck: "CK",
134
+ Nl: "NL",
135
+ Sk: "SK",
136
+ Hm: "HM",
137
+ Mq: "MQ",
138
+ Mr: "MR",
139
+ It: "IT",
140
+ Cm: "CM",
130
141
  Dm: "DM",
131
- Gy: "GY",
142
+ Sv: "SV",
132
143
  Dk: "DK",
133
- Pf: "PF",
134
- Sk: "SK",
135
- Rw: "RW",
136
- Bt: "BT",
144
+ Zw: "ZW",
145
+ Jo: "JO",
146
+ Om: "OM",
147
+ Sl: "SL",
148
+ So: "SO",
149
+ Tg: "TG",
150
+ Pw: "PW",
137
151
  Ye: "YE",
138
- Ss: "SS",
139
- Lb: "LB",
140
- Fk: "FK",
141
- Gn: "GN",
142
- Zm: "ZM",
143
- Mm: "MM",
152
+ Iq: "IQ",
153
+ Ma: "MA",
154
+ Cg: "CG",
155
+ Mf: "MF",
156
+ St: "ST",
157
+ Bi: "BI",
144
158
  Eg: "EG",
145
- Je: "JE",
146
- Hm: "HM",
147
- Be: "BE",
148
159
  Ax: "AX",
149
- Sh: "SH",
150
- Tg: "TG",
151
- Mn: "MN",
152
- Bg: "BG",
153
- It: "IT",
154
- Gh: "GH",
155
- Gl: "GL",
156
- Nu: "NU",
157
- Om: "OM",
158
- Ua: "UA",
159
- Gi: "GI",
160
- Ke: "KE",
161
- Nl: "NL",
162
- Fm: "FM",
163
- Bm: "BM",
164
- Gb: "GB",
165
- Rs: "RS",
166
- Tr: "TR",
167
- Mc: "MC",
168
- Ci: "CI",
169
- Tv: "TV",
170
- Kh: "KH",
171
- Vg: "VG",
172
- Mw: "MW",
173
- Id: "ID",
160
+ Gm: "GM",
161
+ Gr: "GR",
162
+ Az: "AZ",
163
+ Eh: "EH",
164
+ Ge: "GE",
165
+ Gt: "GT",
166
+ Cf: "CF",
167
+ Ng: "NG",
168
+ Kg: "KG",
169
+ Ag: "AG",
170
+ Ai: "AI",
171
+ Dj: "DJ",
172
+ Sr: "SR",
174
173
  Np: "NP",
175
- Lv: "LV",
176
- Si: "SI",
177
- Cx: "CX",
174
+ Hu: "HU",
175
+ Io: "IO",
176
+ Mc: "MC",
177
+ Gf: "GF",
178
+ Sj: "SJ",
179
+ Hr: "HR",
180
+ Bj: "BJ",
181
+ Fm: "FM",
182
+ Bl: "BL",
178
183
  Ls: "LS",
184
+ Mg: "MG",
185
+ Sc: "SC",
186
+ Vg: "VG",
187
+ Ci: "CI",
188
+ Gg: "GG",
179
189
  Ad: "AD",
180
- Ms: "MS",
181
- Bs: "BS",
182
- Hn: "HN",
183
- Li: "LI",
184
- Sv: "SV",
185
- Bw: "BW",
186
- Aw: "AW",
187
- Bq: "BQ",
188
- Uy: "UY",
189
- Az: "AZ",
190
- Ba: "BA",
191
- Ly: "LY",
192
- Ml: "ML",
193
- Nf: "NF",
194
- Sn: "SN",
195
- Mh: "MH",
196
- Us: "US",
197
- Pe: "PE",
198
- Uz: "UZ",
199
- Kw: "KW",
200
- Td: "TD",
201
- Kz: "KZ",
202
- Py: "PY",
203
- Dz: "DZ",
204
- Hr: "HR",
205
- Kr: "KR",
190
+ Cr: "CR",
191
+ Gp: "GP",
206
192
  Au: "AU",
207
- Tc: "TC",
208
- Mv: "MV",
193
+ Hk: "HK",
194
+ Fr: "FR",
195
+ Gs: "GS",
196
+ Si: "SI",
197
+ Mh: "MH",
198
+ Fi: "FI",
199
+ Do: "DO",
200
+ Tm: "TM",
201
+ Gl: "GL",
202
+ Ca: "CA",
209
203
  Mt: "MT",
210
- Nz: "NZ",
204
+ Rs: "RS",
205
+ Km: "KM",
206
+ Sz: "SZ",
207
+ Im: "IM",
211
208
  Jp: "JP",
212
- Lt: "LT",
213
- Cm: "CM",
214
- Ag: "AG",
215
- Ro: "RO",
216
- As: "AS",
209
+ Th: "TH",
210
+ Tt: "TT",
211
+ Sb: "SB",
212
+ Ga: "GA",
213
+ Nc: "NC",
214
+ Bv: "BV",
215
+ Fk: "FK",
216
+ Af: "AF",
217
+ Ki: "KI",
217
218
  Md: "MD",
218
- Mg: "MG",
219
- Se: "SE",
220
- Cg: "CG",
221
- Cd: "CD",
222
- Pg: "PG",
219
+ Tc: "TC",
220
+ Bn: "BN",
221
+ Hn: "HN",
222
+ Vi: "VI",
223
+ Gn: "GN",
223
224
  Wf: "WF",
225
+ Se: "SE",
226
+ Ec: "EC",
227
+ Ne: "NE",
228
+ Pl: "PL",
224
229
  Gq: "GQ",
225
- Bj: "BJ",
226
- Gg: "GG",
227
- Mr: "MR",
228
- Is: "IS",
229
- Bi: "BI",
230
- Gm: "GM",
231
- Er: "ER",
230
+ Bt: "BT",
231
+ Bz: "BZ",
232
+ Uz: "UZ",
233
+ Lt: "LT",
234
+ Cz: "CZ",
235
+ Lb: "LB",
236
+ Gb: "GB",
237
+ Pg: "PG",
238
+ Py: "PY",
239
+ Bq: "BQ",
232
240
  Ky: "KY",
233
- Gf: "GF",
234
- Ge: "GE",
235
- Sj: "SJ",
236
- Ao: "AO",
237
- Mk: "MK",
238
- St: "ST",
239
- Mo: "MO",
240
- So: "SO",
241
- Sz: "SZ",
242
- Pm: "PM",
243
- Es: "ES",
244
- Tl: "TL",
245
- Bl: "BL",
246
- Ae: "AE",
247
- Cf: "CF",
248
- Dj: "DJ",
249
- Kg: "KG",
250
- Qa: "QA",
251
- Ht: "HT",
252
- No: "NO",
253
- Sg: "SG",
254
- Sb: "SB",
255
- Af: "AF",
241
+ Pn: "PN",
242
+ Sa: "SA",
243
+ Ch: "CH",
244
+ Va: "VA",
245
+ Bf: "BF",
256
246
  My: "MY",
247
+ Nr: "NR",
248
+ Cv: "CV",
249
+ Al: "AL",
250
+ Cn: "CN",
251
+ Am: "AM",
252
+ Ni: "NI",
253
+ Aw: "AW",
254
+ Li: "LI",
255
+ Ba: "BA",
256
+ Bd: "BD",
257
257
  } as const;
258
258
  export type CountryAlpha2Input = ClosedEnum<typeof CountryAlpha2Input>;
259
259
 
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
8
9
  import { Result as SafeParseResult } from "../../types/fp.js";
9
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
11
  import {
@@ -31,6 +32,14 @@ export type CustomerStateSubscriptionMetadata =
31
32
  | number
32
33
  | boolean;
33
34
 
35
+ export const CustomerStateSubscriptionStatus = {
36
+ Active: "active",
37
+ Trialing: "trialing",
38
+ } as const;
39
+ export type CustomerStateSubscriptionStatus = ClosedEnum<
40
+ typeof CustomerStateSubscriptionStatus
41
+ >;
42
+
34
43
  /**
35
44
  * An active customer subscription.
36
45
  */
@@ -54,7 +63,7 @@ export type CustomerStateSubscription = {
54
63
  | { [k: string]: string | number | boolean | Date | null }
55
64
  | undefined;
56
65
  metadata: { [k: string]: string | number | number | boolean };
57
- status: "active";
66
+ status: CustomerStateSubscriptionStatus;
58
67
  /**
59
68
  * The amount of the subscription.
60
69
  */
@@ -72,6 +81,14 @@ export type CustomerStateSubscription = {
72
81
  * The end timestamp of the current billing period.
73
82
  */
74
83
  currentPeriodEnd: Date | null;
84
+ /**
85
+ * The start timestamp of the trial period, if any.
86
+ */
87
+ trialStart: Date | null;
88
+ /**
89
+ * The end timestamp of the trial period, if any.
90
+ */
91
+ trialEnd: Date | null;
75
92
  /**
76
93
  * Whether the subscription will be canceled at the end of the current period.
77
94
  */
@@ -230,6 +247,27 @@ export function customerStateSubscriptionMetadataFromJSON(
230
247
  );
231
248
  }
232
249
 
250
+ /** @internal */
251
+ export const CustomerStateSubscriptionStatus$inboundSchema: z.ZodNativeEnum<
252
+ typeof CustomerStateSubscriptionStatus
253
+ > = z.nativeEnum(CustomerStateSubscriptionStatus);
254
+
255
+ /** @internal */
256
+ export const CustomerStateSubscriptionStatus$outboundSchema: z.ZodNativeEnum<
257
+ typeof CustomerStateSubscriptionStatus
258
+ > = CustomerStateSubscriptionStatus$inboundSchema;
259
+
260
+ /**
261
+ * @internal
262
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
263
+ */
264
+ export namespace CustomerStateSubscriptionStatus$ {
265
+ /** @deprecated use `CustomerStateSubscriptionStatus$inboundSchema` instead. */
266
+ export const inboundSchema = CustomerStateSubscriptionStatus$inboundSchema;
267
+ /** @deprecated use `CustomerStateSubscriptionStatus$outboundSchema` instead. */
268
+ export const outboundSchema = CustomerStateSubscriptionStatus$outboundSchema;
269
+ }
270
+
233
271
  /** @internal */
234
272
  export const CustomerStateSubscription$inboundSchema: z.ZodType<
235
273
  CustomerStateSubscription,
@@ -254,7 +292,7 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
254
292
  metadata: z.record(
255
293
  z.union([z.string(), z.number().int(), z.number(), z.boolean()]),
256
294
  ),
257
- status: z.literal("active"),
295
+ status: CustomerStateSubscriptionStatus$inboundSchema,
258
296
  amount: z.number().int(),
259
297
  currency: z.string(),
260
298
  recurring_interval: SubscriptionRecurringInterval$inboundSchema,
@@ -264,6 +302,12 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
264
302
  current_period_end: z.nullable(
265
303
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
266
304
  ),
305
+ trial_start: z.nullable(
306
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
307
+ ),
308
+ trial_end: z.nullable(
309
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
310
+ ),
267
311
  cancel_at_period_end: z.boolean(),
268
312
  canceled_at: z.nullable(
269
313
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
@@ -285,6 +329,8 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
285
329
  "recurring_interval": "recurringInterval",
286
330
  "current_period_start": "currentPeriodStart",
287
331
  "current_period_end": "currentPeriodEnd",
332
+ "trial_start": "trialStart",
333
+ "trial_end": "trialEnd",
288
334
  "cancel_at_period_end": "cancelAtPeriodEnd",
289
335
  "canceled_at": "canceledAt",
290
336
  "started_at": "startedAt",
@@ -303,12 +349,14 @@ export type CustomerStateSubscription$Outbound = {
303
349
  | { [k: string]: string | number | boolean | string | null }
304
350
  | undefined;
305
351
  metadata: { [k: string]: string | number | number | boolean };
306
- status: "active";
352
+ status: string;
307
353
  amount: number;
308
354
  currency: string;
309
355
  recurring_interval: string;
310
356
  current_period_start: string;
311
357
  current_period_end: string | null;
358
+ trial_start: string | null;
359
+ trial_end: string | null;
312
360
  cancel_at_period_end: boolean;
313
361
  canceled_at: string | null;
314
362
  started_at: string | null;
@@ -340,12 +388,14 @@ export const CustomerStateSubscription$outboundSchema: z.ZodType<
340
388
  metadata: z.record(
341
389
  z.union([z.string(), z.number().int(), z.number(), z.boolean()]),
342
390
  ),
343
- status: z.literal("active"),
391
+ status: CustomerStateSubscriptionStatus$outboundSchema,
344
392
  amount: z.number().int(),
345
393
  currency: z.string(),
346
394
  recurringInterval: SubscriptionRecurringInterval$outboundSchema,
347
395
  currentPeriodStart: z.date().transform(v => v.toISOString()),
348
396
  currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
397
+ trialStart: z.nullable(z.date().transform(v => v.toISOString())),
398
+ trialEnd: z.nullable(z.date().transform(v => v.toISOString())),
349
399
  cancelAtPeriodEnd: z.boolean(),
350
400
  canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
351
401
  startedAt: z.nullable(z.date().transform(v => v.toISOString())),
@@ -361,6 +411,8 @@ export const CustomerStateSubscription$outboundSchema: z.ZodType<
361
411
  recurringInterval: "recurring_interval",
362
412
  currentPeriodStart: "current_period_start",
363
413
  currentPeriodEnd: "current_period_end",
414
+ trialStart: "trial_start",
415
+ trialEnd: "trial_end",
364
416
  cancelAtPeriodEnd: "cancel_at_period_end",
365
417
  canceledAt: "canceled_at",
366
418
  startedAt: "started_at",