@trigger.dev/platform 1.0.15 → 1.0.17

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.
@@ -5134,8 +5134,9 @@ declare const SubscriptionResult: z.ZodObject<{
5134
5134
  title: string;
5135
5135
  }>]>>;
5136
5136
  }, "strip", z.ZodTypeAny, {
5137
- isPaying: boolean;
5138
5137
  freeTierStatus: "requires_connect" | "approved" | "rejected";
5138
+ isPaying: boolean;
5139
+ canceledAt?: string | undefined;
5139
5140
  plan?: {
5140
5141
  code: string;
5141
5142
  type: "free";
@@ -5254,10 +5255,10 @@ declare const SubscriptionResult: z.ZodObject<{
5254
5255
  };
5255
5256
  title: string;
5256
5257
  } | undefined;
5257
- canceledAt?: string | undefined;
5258
5258
  }, {
5259
- isPaying: boolean;
5260
5259
  freeTierStatus: "requires_connect" | "approved" | "rejected";
5260
+ isPaying: boolean;
5261
+ canceledAt?: string | undefined;
5261
5262
  plan?: {
5262
5263
  code: string;
5263
5264
  type: "free";
@@ -5376,162 +5377,10 @@ declare const SubscriptionResult: z.ZodObject<{
5376
5377
  };
5377
5378
  title: string;
5378
5379
  } | undefined;
5379
- canceledAt?: string | undefined;
5380
5380
  }>;
5381
5381
  type SubscriptionResult = z.infer<typeof SubscriptionResult>;
5382
5382
  declare const CurrentPlan: z.ZodObject<{
5383
- subscription: z.ZodObject<{
5384
- isPaying: z.ZodBoolean;
5385
- plan: z.ZodObject<{
5386
- title: z.ZodString;
5387
- code: z.ZodString;
5388
- concurrentRuns: z.ZodObject<{
5389
- pricing: z.ZodOptional<z.ZodObject<{
5390
- code: z.ZodString;
5391
- upto: z.ZodOptional<z.ZodNumber>;
5392
- tierCost: z.ZodOptional<z.ZodNumber>;
5393
- }, "strip", z.ZodTypeAny, {
5394
- code: string;
5395
- upto?: number | undefined;
5396
- tierCost?: number | undefined;
5397
- }, {
5398
- code: string;
5399
- upto?: number | undefined;
5400
- tierCost?: number | undefined;
5401
- }>>;
5402
- freeAllowance: z.ZodOptional<z.ZodNumber>;
5403
- }, "strip", z.ZodTypeAny, {
5404
- pricing?: {
5405
- code: string;
5406
- upto?: number | undefined;
5407
- tierCost?: number | undefined;
5408
- } | undefined;
5409
- freeAllowance?: number | undefined;
5410
- }, {
5411
- pricing?: {
5412
- code: string;
5413
- upto?: number | undefined;
5414
- tierCost?: number | undefined;
5415
- } | undefined;
5416
- freeAllowance?: number | undefined;
5417
- }>;
5418
- runs: z.ZodOptional<z.ZodObject<{
5419
- pricing: z.ZodOptional<z.ZodObject<{
5420
- code: z.ZodString;
5421
- }, "strip", z.ZodTypeAny, {
5422
- code: string;
5423
- }, {
5424
- code: string;
5425
- }>>;
5426
- freeAllowance: z.ZodOptional<z.ZodNumber>;
5427
- }, "strip", z.ZodTypeAny, {
5428
- pricing?: {
5429
- code: string;
5430
- } | undefined;
5431
- freeAllowance?: number | undefined;
5432
- }, {
5433
- pricing?: {
5434
- code: string;
5435
- } | undefined;
5436
- freeAllowance?: number | undefined;
5437
- }>>;
5438
- }, "strip", z.ZodTypeAny, {
5439
- code: string;
5440
- concurrentRuns: {
5441
- pricing?: {
5442
- code: string;
5443
- upto?: number | undefined;
5444
- tierCost?: number | undefined;
5445
- } | undefined;
5446
- freeAllowance?: number | undefined;
5447
- };
5448
- title: string;
5449
- runs?: {
5450
- pricing?: {
5451
- code: string;
5452
- } | undefined;
5453
- freeAllowance?: number | undefined;
5454
- } | undefined;
5455
- }, {
5456
- code: string;
5457
- concurrentRuns: {
5458
- pricing?: {
5459
- code: string;
5460
- upto?: number | undefined;
5461
- tierCost?: number | undefined;
5462
- } | undefined;
5463
- freeAllowance?: number | undefined;
5464
- };
5465
- title: string;
5466
- runs?: {
5467
- pricing?: {
5468
- code: string;
5469
- } | undefined;
5470
- freeAllowance?: number | undefined;
5471
- } | undefined;
5472
- }>;
5473
- limits: z.ZodObject<{
5474
- runs: z.ZodOptional<z.ZodNumber>;
5475
- concurrentRuns: z.ZodOptional<z.ZodNumber>;
5476
- }, "strip", z.ZodTypeAny, {
5477
- concurrentRuns?: number | undefined;
5478
- runs?: number | undefined;
5479
- }, {
5480
- concurrentRuns?: number | undefined;
5481
- runs?: number | undefined;
5482
- }>;
5483
- canceledAt: z.ZodOptional<z.ZodString>;
5484
- }, "strip", z.ZodTypeAny, {
5485
- limits: {
5486
- concurrentRuns?: number | undefined;
5487
- runs?: number | undefined;
5488
- };
5489
- isPaying: boolean;
5490
- plan: {
5491
- code: string;
5492
- concurrentRuns: {
5493
- pricing?: {
5494
- code: string;
5495
- upto?: number | undefined;
5496
- tierCost?: number | undefined;
5497
- } | undefined;
5498
- freeAllowance?: number | undefined;
5499
- };
5500
- title: string;
5501
- runs?: {
5502
- pricing?: {
5503
- code: string;
5504
- } | undefined;
5505
- freeAllowance?: number | undefined;
5506
- } | undefined;
5507
- };
5508
- canceledAt?: string | undefined;
5509
- }, {
5510
- limits: {
5511
- concurrentRuns?: number | undefined;
5512
- runs?: number | undefined;
5513
- };
5514
- isPaying: boolean;
5515
- plan: {
5516
- code: string;
5517
- concurrentRuns: {
5518
- pricing?: {
5519
- code: string;
5520
- upto?: number | undefined;
5521
- tierCost?: number | undefined;
5522
- } | undefined;
5523
- freeAllowance?: number | undefined;
5524
- };
5525
- title: string;
5526
- runs?: {
5527
- pricing?: {
5528
- code: string;
5529
- } | undefined;
5530
- freeAllowance?: number | undefined;
5531
- } | undefined;
5532
- };
5533
- canceledAt?: string | undefined;
5534
- }>;
5383
+ subscription: z.ZodAny;
5535
5384
  v3Subscription: z.ZodObject<{
5536
5385
  freeTierStatus: z.ZodEnum<["requires_connect", "approved", "rejected"]>;
5537
5386
  isPaying: z.ZodBoolean;
@@ -6215,8 +6064,9 @@ declare const CurrentPlan: z.ZodObject<{
6215
6064
  title: string;
6216
6065
  }>]>>;
6217
6066
  }, "strip", z.ZodTypeAny, {
6218
- isPaying: boolean;
6219
6067
  freeTierStatus: "requires_connect" | "approved" | "rejected";
6068
+ isPaying: boolean;
6069
+ canceledAt?: string | undefined;
6220
6070
  plan?: {
6221
6071
  code: string;
6222
6072
  type: "free";
@@ -6335,10 +6185,10 @@ declare const CurrentPlan: z.ZodObject<{
6335
6185
  };
6336
6186
  title: string;
6337
6187
  } | undefined;
6338
- canceledAt?: string | undefined;
6339
6188
  }, {
6340
- isPaying: boolean;
6341
6189
  freeTierStatus: "requires_connect" | "approved" | "rejected";
6190
+ isPaying: boolean;
6191
+ canceledAt?: string | undefined;
6342
6192
  plan?: {
6343
6193
  code: string;
6344
6194
  type: "free";
@@ -6457,38 +6307,12 @@ declare const CurrentPlan: z.ZodObject<{
6457
6307
  };
6458
6308
  title: string;
6459
6309
  } | undefined;
6460
- canceledAt?: string | undefined;
6461
6310
  }>;
6462
6311
  }, "strip", z.ZodTypeAny, {
6463
- subscription: {
6464
- limits: {
6465
- concurrentRuns?: number | undefined;
6466
- runs?: number | undefined;
6467
- };
6468
- isPaying: boolean;
6469
- plan: {
6470
- code: string;
6471
- concurrentRuns: {
6472
- pricing?: {
6473
- code: string;
6474
- upto?: number | undefined;
6475
- tierCost?: number | undefined;
6476
- } | undefined;
6477
- freeAllowance?: number | undefined;
6478
- };
6479
- title: string;
6480
- runs?: {
6481
- pricing?: {
6482
- code: string;
6483
- } | undefined;
6484
- freeAllowance?: number | undefined;
6485
- } | undefined;
6486
- };
6487
- canceledAt?: string | undefined;
6488
- };
6489
6312
  v3Subscription: {
6490
- isPaying: boolean;
6491
6313
  freeTierStatus: "requires_connect" | "approved" | "rejected";
6314
+ isPaying: boolean;
6315
+ canceledAt?: string | undefined;
6492
6316
  plan?: {
6493
6317
  code: string;
6494
6318
  type: "free";
@@ -6607,38 +6431,13 @@ declare const CurrentPlan: z.ZodObject<{
6607
6431
  };
6608
6432
  title: string;
6609
6433
  } | undefined;
6610
- canceledAt?: string | undefined;
6611
6434
  };
6435
+ subscription?: any;
6612
6436
  }, {
6613
- subscription: {
6614
- limits: {
6615
- concurrentRuns?: number | undefined;
6616
- runs?: number | undefined;
6617
- };
6618
- isPaying: boolean;
6619
- plan: {
6620
- code: string;
6621
- concurrentRuns: {
6622
- pricing?: {
6623
- code: string;
6624
- upto?: number | undefined;
6625
- tierCost?: number | undefined;
6626
- } | undefined;
6627
- freeAllowance?: number | undefined;
6628
- };
6629
- title: string;
6630
- runs?: {
6631
- pricing?: {
6632
- code: string;
6633
- } | undefined;
6634
- freeAllowance?: number | undefined;
6635
- } | undefined;
6636
- };
6637
- canceledAt?: string | undefined;
6638
- };
6639
6437
  v3Subscription: {
6640
- isPaying: boolean;
6641
6438
  freeTierStatus: "requires_connect" | "approved" | "rejected";
6439
+ isPaying: boolean;
6440
+ canceledAt?: string | undefined;
6642
6441
  plan?: {
6643
6442
  code: string;
6644
6443
  type: "free";
@@ -6757,8 +6556,8 @@ declare const CurrentPlan: z.ZodObject<{
6757
6556
  };
6758
6557
  title: string;
6759
6558
  } | undefined;
6760
- canceledAt?: string | undefined;
6761
6559
  };
6560
+ subscription?: any;
6762
6561
  }>;
6763
6562
  type CurrentPlan = z.infer<typeof CurrentPlan>;
6764
6563
 
@@ -7084,6 +6883,35 @@ declare const ReportInvocationUsageResult: z.ZodDiscriminatedUnion<"success", [z
7084
6883
  success: false;
7085
6884
  }>]>;
7086
6885
 
6886
+ declare const BillingAlertsResult: z.ZodObject<{
6887
+ amount: z.ZodNumber;
6888
+ emails: z.ZodArray<z.ZodString, "many">;
6889
+ alertLevels: z.ZodArray<z.ZodNumber, "many">;
6890
+ }, "strip", z.ZodTypeAny, {
6891
+ amount: number;
6892
+ emails: string[];
6893
+ alertLevels: number[];
6894
+ }, {
6895
+ amount: number;
6896
+ emails: string[];
6897
+ alertLevels: number[];
6898
+ }>;
6899
+ type BillingAlertsResult = z.infer<typeof BillingAlertsResult>;
6900
+ declare const UpdateBillingAlertsRequest: z.ZodObject<{
6901
+ amount: z.ZodNumber;
6902
+ emails: z.ZodArray<z.ZodString, "many">;
6903
+ alertLevels: z.ZodArray<z.ZodNumber, "many">;
6904
+ }, "strip", z.ZodTypeAny, {
6905
+ amount: number;
6906
+ emails: string[];
6907
+ alertLevels: number[];
6908
+ }, {
6909
+ amount: number;
6910
+ emails: string[];
6911
+ alertLevels: number[];
6912
+ }>;
6913
+ type UpdateBillingAlertsRequest = z.infer<typeof UpdateBillingAlertsRequest>;
6914
+
7087
6915
  type BillingClientConfig = {
7088
6916
  url: string;
7089
6917
  apiKey: string;
@@ -7104,6 +6932,7 @@ type UsageResponse = Result<typeof UsageResult>;
7104
6932
  type UsageSeriesResponse = Result<typeof UsageSeriesResult>;
7105
6933
  type UsageInvocationReportResponse = Result<typeof ReportInvocationUsageResult>;
7106
6934
  type UsageEntitlementResponse = Result<typeof ReportUsageResult>;
6935
+ type BillingAlertsResponse = Result<typeof BillingAlertsResult>;
7107
6936
  declare class BillingClient {
7108
6937
  private readonly config;
7109
6938
  constructor(config: BillingClientConfig);
@@ -7125,6 +6954,8 @@ declare class BillingClient {
7125
6954
  * @returns details about usage
7126
6955
  */
7127
6956
  getEntitlement(orgId: string): Promise<UsageEntitlementResponse>;
6957
+ getBillingAlerts(orgId: string): Promise<BillingAlertsResponse>;
6958
+ updateBillingAlerts(orgId: string, body: UpdateBillingAlertsRequest): Promise<BillingAlertsResponse>;
7128
6959
  fetch<TSchema extends ZodType = z.ZodTypeAny>(path: string, schema: TSchema, requestInit?: RequestInit): Promise<Result<TSchema>>;
7129
6960
  }
7130
6961
  declare function objectToSearchParams(obj: undefined | Record<string, string | string[] | number | number[] | boolean | boolean[] | Date | Date[] | undefined>): URLSearchParams | undefined;
@@ -7193,4 +7024,4 @@ declare const machines: {
7193
7024
  type MachineCode = keyof typeof machines;
7194
7025
  declare const defaultMachine: MachineCode;
7195
7026
 
7196
- export { BillingClient, type CanceledSubscriptionResult, type CreateSubscriptionFlowStart, CurrentPlan, type CurrentPlanResponse, type CustomerPortal, type CustomerPortalRequestBody, CustomerPortalRequestBodySchema, type CustomerPortalResponse, CustomerPortalSchema, EnterprisePlanDefinition, type Error, ErrorSchema, ExceedableLimit, type FreeConnectRequired, FreeConnectRequiredSchema, type FreeConnected, FreeConnectedSchema, FreePlanDefinition, FreeTierStatus, Limits, type MachineCode, MachineDefinition, type MachineDefinitionInput, PaidPlanDefinition, type PlanDefinition, PlanDefinitionSchema, Plans, type PlansResponse, PlansResult, ReportComputeUsageEvent, ReportInvocationUsageEvent, ReportInvocationUsageResult, ReportUsageResult, type SetPlanBody, SetPlanBodySchema, type SetPlanResponse, type SubscribeResult, SubscribeResultSchema, SubscriptionResult, type UpdatedSubscriptionResult, type UsageEntitlementResponse, type UsageInvocationReportResponse, UsageParams, type UsageResponse, UsageResult, UsageSeriesParams, type UsageSeriesResponse, UsageSeriesResult, defaultMachine, machineDefinition, machines, objectToSearchParams };
7027
+ export { type BillingAlertsResponse, BillingAlertsResult, BillingClient, type CanceledSubscriptionResult, type CreateSubscriptionFlowStart, CurrentPlan, type CurrentPlanResponse, type CustomerPortal, type CustomerPortalRequestBody, CustomerPortalRequestBodySchema, type CustomerPortalResponse, CustomerPortalSchema, EnterprisePlanDefinition, type Error, ErrorSchema, ExceedableLimit, type FreeConnectRequired, FreeConnectRequiredSchema, type FreeConnected, FreeConnectedSchema, FreePlanDefinition, FreeTierStatus, Limits, type MachineCode, MachineDefinition, type MachineDefinitionInput, PaidPlanDefinition, type PlanDefinition, PlanDefinitionSchema, Plans, type PlansResponse, PlansResult, ReportComputeUsageEvent, ReportInvocationUsageEvent, ReportInvocationUsageResult, ReportUsageResult, type SetPlanBody, SetPlanBodySchema, type SetPlanResponse, type SubscribeResult, SubscribeResultSchema, SubscriptionResult, UpdateBillingAlertsRequest, type UpdatedSubscriptionResult, type UsageEntitlementResponse, type UsageInvocationReportResponse, UsageParams, type UsageResponse, UsageResult, UsageSeriesParams, type UsageSeriesResponse, UsageSeriesResult, defaultMachine, machineDefinition, machines, objectToSearchParams };
@@ -70,106 +70,60 @@ var PlansResult = z.object({
70
70
  });
71
71
 
72
72
  // src/v3/schemas/subscription.ts
73
- import { z as z3 } from "zod";
74
-
75
- // src/v2/schemas/usage.ts
76
73
  import { z as z2 } from "zod";
77
- var RunPricingSchema = z2.object({
78
- pricing: z2.object({
79
- code: z2.string()
80
- }).optional(),
81
- freeAllowance: z2.number().optional()
82
- });
83
- var ActiveSubscriptionSchema = z2.object({
84
- isPaying: z2.boolean(),
85
- plan: z2.object({
86
- title: z2.string(),
87
- code: z2.string(),
88
- concurrentRuns: z2.object({
89
- pricing: z2.object({
90
- code: z2.string(),
91
- upto: z2.number().optional(),
92
- tierCost: z2.number().optional()
93
- }).optional(),
94
- freeAllowance: z2.number().optional()
95
- }),
96
- runs: RunPricingSchema.optional()
97
- }),
98
- limits: z2.object({
99
- runs: z2.number().optional(),
100
- concurrentRuns: z2.number().optional()
101
- }),
102
- canceledAt: z2.string().optional()
103
- });
104
- var CurrentPlanSchema = z2.object({
105
- subscription: ActiveSubscriptionSchema.optional()
106
- });
107
- var SetPaidPlanBodySchema = z2.object({
108
- type: z2.literal("paid"),
109
- planCode: z2.string(),
110
- concurrentRunBracket: z2.string()
111
- });
112
- var SetFreePlanBodySchema = z2.object({
113
- type: z2.literal("free")
114
- });
115
- var SetPlanBodySchema = z2.discriminatedUnion("type", [
116
- SetPaidPlanBodySchema,
117
- SetFreePlanBodySchema
118
- ]);
119
-
120
- // src/v3/schemas/subscription.ts
121
- var FreeTierStatus = z3.enum(["requires_connect", "approved", "rejected"]);
122
- var SubscriptionResult = z3.object({
74
+ var FreeTierStatus = z2.enum(["requires_connect", "approved", "rejected"]);
75
+ var SubscriptionResult = z2.object({
123
76
  freeTierStatus: FreeTierStatus,
124
- isPaying: z3.boolean(),
125
- canceledAt: z3.string().optional(),
77
+ isPaying: z2.boolean(),
78
+ canceledAt: z2.string().optional(),
126
79
  plan: PlanDefinitionSchema.optional()
127
80
  });
128
- var CurrentPlan = z3.object({
129
- subscription: ActiveSubscriptionSchema,
81
+ var CurrentPlan = z2.object({
82
+ //todo remove this after the next deploy
83
+ subscription: z2.any(),
130
84
  v3Subscription: SubscriptionResult
131
85
  });
132
86
 
133
87
  // src/v3/schemas/subscribe.ts
134
- import { z as z4 } from "zod";
135
- var SetPaidPlanBodySchema2 = z4.object({
136
- type: z4.literal("paid"),
137
- planCode: z4.string(),
138
- userId: z4.string()
88
+ import { z as z3 } from "zod";
89
+ var SetPaidPlanBodySchema = z3.object({
90
+ type: z3.literal("paid"),
91
+ planCode: z3.string(),
92
+ userId: z3.string()
139
93
  });
140
- var SetFreePlanBodySchema2 = z4.object({
141
- type: z4.literal("free"),
142
- userId: z4.string()
94
+ var SetFreePlanBodySchema = z3.object({
95
+ type: z3.literal("free"),
96
+ userId: z3.string()
143
97
  });
144
- var SetPlanBodySchema2 = z4.discriminatedUnion("type", [
145
- SetPaidPlanBodySchema2,
146
- SetFreePlanBodySchema2
98
+ var SetPlanBodySchema = z3.discriminatedUnion("type", [
99
+ SetPaidPlanBodySchema,
100
+ SetFreePlanBodySchema
147
101
  ]);
148
- var FreeConnectRequiredSchema = z4.object({
149
- action: z4.literal("free_connect_required"),
150
- connectUrl: z4.string().url()
151
- });
152
- var FreeConnectedSchema = z4.object({
153
- action: z4.literal("free_connected"),
154
- accepted: z4.boolean()
155
- });
156
- var UpdatedSubscriptionResultSchema = z4.object({
157
- action: z4.literal("updated_subscription"),
158
- subscription: z4.object({
159
- planCode: z4.string()
102
+ var FreeConnectRequiredSchema = z3.object({
103
+ action: z3.literal("free_connect_required"),
104
+ connectUrl: z3.string().url()
105
+ });
106
+ var FreeConnectedSchema = z3.object({
107
+ action: z3.literal("free_connected"),
108
+ accepted: z3.boolean()
109
+ });
110
+ var UpdatedSubscriptionResultSchema = z3.object({
111
+ action: z3.literal("updated_subscription"),
112
+ subscription: z3.object({
113
+ planCode: z3.string()
160
114
  })
161
115
  });
162
- var CreateSubscriptionFlowStartSchema = z4.object({
163
- action: z4.literal("create_subscription_flow_start"),
164
- subscription: z4.object({
165
- planCode: z4.string()
116
+ var CreateSubscriptionFlowStartSchema = z3.object({
117
+ action: z3.literal("create_subscription_flow_start"),
118
+ subscription: z3.object({
119
+ planCode: z3.string()
166
120
  }),
167
- checkoutUrl: z4.string().url()
121
+ checkoutUrl: z3.string().url()
168
122
  });
169
- var CanceledSubscriptionResultSchema = z4.object({
170
- action: z4.literal("canceled_subscription")
123
+ var CanceledSubscriptionResultSchema = z3.object({
124
+ action: z3.literal("canceled_subscription")
171
125
  });
172
- var SubscribeResultSchema = z4.discriminatedUnion("action", [
126
+ var SubscribeResultSchema = z3.discriminatedUnion("action", [
173
127
  FreeConnectRequiredSchema,
174
128
  FreeConnectedSchema,
175
129
  CreateSubscriptionFlowStartSchema,
@@ -178,52 +132,52 @@ var SubscribeResultSchema = z4.discriminatedUnion("action", [
178
132
  ]);
179
133
 
180
134
  // src/v3/schemas/portal.ts
181
- import { z as z5 } from "zod";
182
- var CustomerPortalRequestBodySchema = z5.object({
183
- returnUrl: z5.string()
135
+ import { z as z4 } from "zod";
136
+ var CustomerPortalRequestBodySchema = z4.object({
137
+ returnUrl: z4.string()
184
138
  });
185
- var CustomerPortalSchema = z5.object({
186
- customerPortalUrl: z5.string().optional()
139
+ var CustomerPortalSchema = z4.object({
140
+ customerPortalUrl: z4.string().optional()
187
141
  });
188
142
 
189
143
  // src/v3/schemas/error.ts
190
- import { z as z6 } from "zod";
191
- var ErrorSchema = z6.object({
192
- error: z6.string()
144
+ import { z as z5 } from "zod";
145
+ var ErrorSchema = z5.object({
146
+ error: z5.string()
193
147
  });
194
148
 
195
149
  // src/v3/schemas/usage.ts
196
- import { z as z7 } from "zod";
197
- var UsageParams = z7.object({
198
- from: z7.coerce.date(),
199
- to: z7.coerce.date()
150
+ import { z as z6 } from "zod";
151
+ var UsageParams = z6.object({
152
+ from: z6.coerce.date(),
153
+ to: z6.coerce.date()
200
154
  });
201
- var UsageResult = z7.object({
202
- cents: z7.number()
155
+ var UsageResult = z6.object({
156
+ cents: z6.number()
203
157
  });
204
- var Window = z7.enum(["MINUTE", "HOUR", "DAY"]);
205
- var BooleanParam = z7.preprocess(
158
+ var Window = z6.enum(["MINUTE", "HOUR", "DAY"]);
159
+ var BooleanParam = z6.preprocess(
206
160
  (val) => val === "true" ? true : false,
207
- z7.boolean()
161
+ z6.boolean()
208
162
  );
209
- var UsageSeriesParams = z7.object({
210
- from: z7.coerce.date(),
211
- to: z7.coerce.date(),
163
+ var UsageSeriesParams = z6.object({
164
+ from: z6.coerce.date(),
165
+ to: z6.coerce.date(),
212
166
  /** defaults to DAY */
213
167
  window: Window.optional(),
214
- timezone: z7.string().optional()
168
+ timezone: z6.string().optional()
215
169
  //these don't work at the moment because you can't group by items that aren't defined in the meter group by
216
170
  // groupByEnvironmentType: BooleanParam.optional(),
217
171
  // groupByTaskIdentifier: BooleanParam.optional(),
218
172
  });
219
- var UsageSeriesResult = z7.object({
220
- from: z7.string(),
221
- to: z7.string(),
173
+ var UsageSeriesResult = z6.object({
174
+ from: z6.string(),
175
+ to: z6.string(),
222
176
  window: Window.optional(),
223
- data: z7.object({
224
- value: z7.number(),
225
- windowStart: z7.string(),
226
- windowEnd: z7.string()
177
+ data: z6.object({
178
+ value: z6.number(),
179
+ windowStart: z6.string(),
180
+ windowEnd: z6.string()
227
181
  //these don't work at the moment
228
182
  // groupBy: z
229
183
  // .object({
@@ -233,30 +187,44 @@ var UsageSeriesResult = z7.object({
233
187
  // .optional(),
234
188
  }).array()
235
189
  });
236
- var ReportComputeUsageEvent = z7.object({
237
- durationMs: z7.number()
190
+ var ReportComputeUsageEvent = z6.object({
191
+ durationMs: z6.number()
238
192
  });
239
- var ReportUsageResult = z7.object({
240
- hasAccess: z7.boolean(),
241
- balance: z7.number().optional(),
242
- usage: z7.number().optional(),
243
- overage: z7.number().optional()
193
+ var ReportUsageResult = z6.object({
194
+ hasAccess: z6.boolean(),
195
+ balance: z6.number().optional(),
196
+ usage: z6.number().optional(),
197
+ overage: z6.number().optional()
244
198
  });
245
- var ReportInvocationUsageEvent = z7.object({
246
- organizationId: z7.string(),
247
- costInCents: z7.number(),
248
- additionalData: z7.record(z7.any()).optional()
199
+ var ReportInvocationUsageEvent = z6.object({
200
+ organizationId: z6.string(),
201
+ costInCents: z6.number(),
202
+ additionalData: z6.record(z6.any()).optional()
249
203
  });
250
- var ReportInvocationUsageResult = z7.discriminatedUnion("success", [
251
- z7.object({
252
- success: z7.literal(true)
204
+ var ReportInvocationUsageResult = z6.discriminatedUnion("success", [
205
+ z6.object({
206
+ success: z6.literal(true)
253
207
  }),
254
- z7.object({
255
- success: z7.literal(false),
256
- error: z7.string()
208
+ z6.object({
209
+ success: z6.literal(false),
210
+ error: z6.string()
257
211
  })
258
212
  ]);
259
213
 
214
+ // src/v3/schemas/billingAlerts.ts
215
+ import { z as z7 } from "zod";
216
+ var BillingAlertDefinition = z7.object({
217
+ amount: z7.number(),
218
+ emails: z7.array(z7.string()),
219
+ alertLevels: z7.array(z7.number())
220
+ });
221
+ var BillingAlertsResult = BillingAlertDefinition;
222
+ var UpdateBillingAlertsRequest = z7.object({
223
+ amount: z7.number(),
224
+ emails: z7.array(z7.string()),
225
+ alertLevels: z7.array(z7.number())
226
+ });
227
+
260
228
  // src/v3/client/index.ts
261
229
  var BillingClient = class {
262
230
  constructor(config) {
@@ -337,6 +305,25 @@ var BillingClient = class {
337
305
  ReportUsageResult
338
306
  );
339
307
  }
308
+ async getBillingAlerts(orgId) {
309
+ return await this.fetch(
310
+ `/api/v1/orgs/${orgId}/billing-alerts`,
311
+ BillingAlertsResult
312
+ );
313
+ }
314
+ async updateBillingAlerts(orgId, body) {
315
+ return await this.fetch(
316
+ `/api/v1/orgs/${orgId}/billing-alerts`,
317
+ BillingAlertsResult,
318
+ {
319
+ method: "POST",
320
+ headers: {
321
+ "Content-Type": "application/json"
322
+ },
323
+ body: JSON.stringify(body)
324
+ }
325
+ );
326
+ }
340
327
  async fetch(path, schema, requestInit) {
341
328
  const response = await fetch(`${this.config.url}${path}`, {
342
329
  ...requestInit,
@@ -466,6 +453,7 @@ var machines = {
466
453
  };
467
454
  var defaultMachine = "small-1x";
468
455
  export {
456
+ BillingAlertsResult,
469
457
  BillingClient,
470
458
  CurrentPlan,
471
459
  CustomerPortalRequestBodySchema,
@@ -480,9 +468,10 @@ export {
480
468
  ReportInvocationUsageEvent,
481
469
  ReportInvocationUsageResult,
482
470
  ReportUsageResult,
483
- SetPlanBodySchema2 as SetPlanBodySchema,
471
+ SetPlanBodySchema,
484
472
  SubscribeResultSchema,
485
473
  SubscriptionResult,
474
+ UpdateBillingAlertsRequest,
486
475
  UsageParams,
487
476
  UsageResult,
488
477
  UsageSeriesParams,