@trigger.dev/platform 1.1.0 → 1.2.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/index.cjs +272 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13295 -577
- package/dist/index.d.ts +13295 -577
- package/dist/index.js +254 -52
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -288,11 +288,14 @@ var ReportUsageResult = z6.object({
|
|
|
288
288
|
balance: z6.number().optional(),
|
|
289
289
|
usage: z6.number().optional(),
|
|
290
290
|
overage: z6.number().optional(),
|
|
291
|
-
plan: ReportUsagePlan.optional()
|
|
291
|
+
plan: ReportUsagePlan.optional(),
|
|
292
|
+
limitState: z6.literal("grace").optional(),
|
|
293
|
+
reason: z6.enum(["free_tier_exceeded", "billing_limit"]).optional()
|
|
292
294
|
});
|
|
295
|
+
var MAX_INVOCATION_COST_IN_CENTS = 1e4;
|
|
293
296
|
var ReportInvocationUsageEvent = z6.object({
|
|
294
|
-
organizationId: z6.string(),
|
|
295
|
-
costInCents: z6.number(),
|
|
297
|
+
organizationId: z6.string().min(1).max(128),
|
|
298
|
+
costInCents: z6.number().finite().min(0).max(MAX_INVOCATION_COST_IN_CENTS),
|
|
296
299
|
additionalData: z6.record(z6.string(), z6.any()).optional()
|
|
297
300
|
});
|
|
298
301
|
var ReportInvocationUsageResult = z6.discriminatedUnion("success", [
|
|
@@ -314,76 +317,165 @@ var BillingAlertDefinition = z7.object({
|
|
|
314
317
|
});
|
|
315
318
|
var BillingAlertsResult = BillingAlertDefinition;
|
|
316
319
|
var UpdateBillingAlertsRequest = z7.object({
|
|
317
|
-
amount: z7.number(),
|
|
320
|
+
amount: z7.number().positive(),
|
|
318
321
|
emails: z7.array(z7.string()),
|
|
319
322
|
alertLevels: z7.array(z7.number())
|
|
320
323
|
});
|
|
321
324
|
|
|
322
|
-
// src/v3/schemas/
|
|
325
|
+
// src/v3/schemas/billingLimit.ts
|
|
323
326
|
import { z as z8 } from "zod";
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
var BillingLimitState = z8.discriminatedUnion("status", [
|
|
328
|
+
z8.object({
|
|
329
|
+
status: z8.literal("ok")
|
|
330
|
+
}),
|
|
331
|
+
z8.object({
|
|
332
|
+
status: z8.literal("grace"),
|
|
333
|
+
hitAt: z8.string(),
|
|
334
|
+
graceEndsAt: z8.string()
|
|
335
|
+
}),
|
|
336
|
+
z8.object({
|
|
337
|
+
status: z8.literal("rejected"),
|
|
338
|
+
hitAt: z8.string(),
|
|
339
|
+
graceEndsAt: z8.string()
|
|
340
|
+
})
|
|
341
|
+
]);
|
|
342
|
+
var billingLimitConfiguredFields = {
|
|
343
|
+
isConfigured: z8.literal(true),
|
|
344
|
+
cancelInProgressRuns: z8.boolean(),
|
|
345
|
+
limitState: BillingLimitState,
|
|
346
|
+
effectiveAmountCents: z8.number().int().nonnegative().nullable(),
|
|
347
|
+
gracePeriodMs: z8.number().int().nonnegative()
|
|
348
|
+
};
|
|
349
|
+
var BillingLimitUnconfigured = z8.object({
|
|
350
|
+
isConfigured: z8.literal(false),
|
|
351
|
+
gracePeriodMs: z8.number().int().nonnegative()
|
|
352
|
+
});
|
|
353
|
+
var BillingLimitConfiguredNone = z8.object({
|
|
354
|
+
...billingLimitConfiguredFields,
|
|
355
|
+
mode: z8.literal("none")
|
|
356
|
+
});
|
|
357
|
+
var BillingLimitConfiguredPlan = z8.object({
|
|
358
|
+
...billingLimitConfiguredFields,
|
|
359
|
+
mode: z8.literal("plan")
|
|
360
|
+
});
|
|
361
|
+
var BillingLimitConfiguredCustom = z8.object({
|
|
362
|
+
...billingLimitConfiguredFields,
|
|
363
|
+
mode: z8.literal("custom"),
|
|
364
|
+
amountCents: z8.number().int().positive()
|
|
365
|
+
});
|
|
366
|
+
var BillingLimitResult = z8.union([
|
|
367
|
+
BillingLimitUnconfigured,
|
|
368
|
+
BillingLimitConfiguredNone,
|
|
369
|
+
BillingLimitConfiguredPlan,
|
|
370
|
+
BillingLimitConfiguredCustom
|
|
371
|
+
]);
|
|
372
|
+
var UpdateBillingLimitRequest = z8.discriminatedUnion("mode", [
|
|
373
|
+
z8.object({
|
|
374
|
+
mode: z8.literal("none"),
|
|
375
|
+
cancelInProgressRuns: z8.boolean()
|
|
376
|
+
}),
|
|
377
|
+
z8.object({
|
|
378
|
+
mode: z8.literal("plan"),
|
|
379
|
+
cancelInProgressRuns: z8.boolean()
|
|
380
|
+
}),
|
|
381
|
+
z8.object({
|
|
382
|
+
mode: z8.literal("custom"),
|
|
383
|
+
amountCents: z8.number().int().positive(),
|
|
384
|
+
cancelInProgressRuns: z8.boolean()
|
|
385
|
+
})
|
|
386
|
+
]);
|
|
387
|
+
var ResolveBillingLimitRequest = z8.discriminatedUnion("action", [
|
|
388
|
+
z8.object({
|
|
389
|
+
action: z8.literal("increase"),
|
|
390
|
+
newAmountCents: z8.number().int().positive(),
|
|
391
|
+
resumeMode: z8.enum(["queue", "new_only"])
|
|
392
|
+
}),
|
|
393
|
+
z8.object({
|
|
394
|
+
action: z8.literal("remove"),
|
|
395
|
+
resumeMode: z8.enum(["queue", "new_only"])
|
|
396
|
+
})
|
|
397
|
+
]);
|
|
398
|
+
var BillingLimitActiveOrg = z8.object({
|
|
399
|
+
orgId: z8.string(),
|
|
400
|
+
limitState: z8.enum(["grace", "rejected"])
|
|
401
|
+
});
|
|
402
|
+
var BillingLimitsActiveResult = z8.object({
|
|
403
|
+
orgs: z8.array(BillingLimitActiveOrg)
|
|
404
|
+
});
|
|
405
|
+
var BillingLimitPendingResolveOrg = z8.object({
|
|
406
|
+
organizationId: z8.string(),
|
|
407
|
+
resumeMode: z8.enum(["queue", "new_only"]),
|
|
408
|
+
resolvedAt: z8.string()
|
|
409
|
+
});
|
|
410
|
+
var BillingLimitsPendingResolvesResult = z8.object({
|
|
411
|
+
orgs: z8.array(BillingLimitPendingResolveOrg)
|
|
329
412
|
});
|
|
330
413
|
|
|
331
|
-
// src/v3/schemas/
|
|
414
|
+
// src/v3/schemas/registryCredentials.ts
|
|
332
415
|
import { z as z9 } from "zod";
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
416
|
+
var RegistryCredentialsResponseSchema = z9.object({
|
|
417
|
+
username: z9.string(),
|
|
418
|
+
password: z9.string(),
|
|
419
|
+
expiresAt: z9.string().datetime(),
|
|
420
|
+
repositoryUri: z9.string()
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// src/v3/schemas/enqueueBuild.ts
|
|
424
|
+
import { z as z10 } from "zod";
|
|
425
|
+
var EnqueueBuildRequestSchema = z10.object({
|
|
426
|
+
deploymentId: z10.string(),
|
|
427
|
+
artifactKey: z10.string(),
|
|
428
|
+
options: z10.object({
|
|
429
|
+
skipPromotion: z10.boolean().optional(),
|
|
430
|
+
configFilePath: z10.string().optional()
|
|
339
431
|
})
|
|
340
432
|
});
|
|
341
|
-
var EnqueueBuildResponseSchema =
|
|
342
|
-
buildId:
|
|
433
|
+
var EnqueueBuildResponseSchema = z10.object({
|
|
434
|
+
buildId: z10.string()
|
|
343
435
|
});
|
|
344
436
|
|
|
345
437
|
// src/v3/schemas/initialDeployment.ts
|
|
346
|
-
import { z as
|
|
347
|
-
var TriggerInitialDeploymentRequestSchema =
|
|
348
|
-
environment:
|
|
438
|
+
import { z as z11 } from "zod";
|
|
439
|
+
var TriggerInitialDeploymentRequestSchema = z11.object({
|
|
440
|
+
environment: z11.enum(["prod", "staging", "preview"])
|
|
349
441
|
});
|
|
350
|
-
var TriggerInitialDeploymentResponseSchema =
|
|
351
|
-
ok:
|
|
442
|
+
var TriggerInitialDeploymentResponseSchema = z11.object({
|
|
443
|
+
ok: z11.boolean()
|
|
352
444
|
});
|
|
353
445
|
|
|
354
446
|
// src/v3/schemas/privateLink.ts
|
|
355
|
-
import { z as
|
|
356
|
-
var PrivateLinkConnectionStatus =
|
|
447
|
+
import { z as z12 } from "zod";
|
|
448
|
+
var PrivateLinkConnectionStatus = z12.enum([
|
|
357
449
|
"PENDING",
|
|
358
450
|
"PROVISIONING",
|
|
359
451
|
"ACTIVE",
|
|
360
452
|
"ERROR",
|
|
361
453
|
"DELETING"
|
|
362
454
|
]);
|
|
363
|
-
var PrivateLinkConnection =
|
|
364
|
-
id:
|
|
365
|
-
friendlyId:
|
|
366
|
-
name:
|
|
367
|
-
organizationId:
|
|
368
|
-
endpointServiceName:
|
|
369
|
-
targetRegion:
|
|
455
|
+
var PrivateLinkConnection = z12.object({
|
|
456
|
+
id: z12.string(),
|
|
457
|
+
friendlyId: z12.string(),
|
|
458
|
+
name: z12.string(),
|
|
459
|
+
organizationId: z12.string(),
|
|
460
|
+
endpointServiceName: z12.string(),
|
|
461
|
+
targetRegion: z12.string(),
|
|
370
462
|
status: PrivateLinkConnectionStatus,
|
|
371
|
-
statusMessage:
|
|
372
|
-
endpointDnsName:
|
|
373
|
-
endpointIps:
|
|
374
|
-
provisionedAt:
|
|
375
|
-
createdAt:
|
|
376
|
-
updatedAt:
|
|
377
|
-
});
|
|
378
|
-
var PrivateLinkConnectionList =
|
|
379
|
-
connections:
|
|
380
|
-
});
|
|
381
|
-
var CreatePrivateLinkConnectionBody =
|
|
382
|
-
name:
|
|
463
|
+
statusMessage: z12.string().nullable(),
|
|
464
|
+
endpointDnsName: z12.string().nullable(),
|
|
465
|
+
endpointIps: z12.array(z12.string()).nullable(),
|
|
466
|
+
provisionedAt: z12.string().nullable(),
|
|
467
|
+
createdAt: z12.string(),
|
|
468
|
+
updatedAt: z12.string()
|
|
469
|
+
});
|
|
470
|
+
var PrivateLinkConnectionList = z12.object({
|
|
471
|
+
connections: z12.array(PrivateLinkConnection)
|
|
472
|
+
});
|
|
473
|
+
var CreatePrivateLinkConnectionBody = z12.object({
|
|
474
|
+
name: z12.string().min(1).max(100).regex(
|
|
383
475
|
/^[a-zA-Z][a-zA-Z0-9 _-]*$/,
|
|
384
476
|
"Must start with a letter and contain only letters, numbers, spaces, hyphens, or underscores"
|
|
385
477
|
),
|
|
386
|
-
endpointServiceName:
|
|
478
|
+
endpointServiceName: z12.string().regex(
|
|
387
479
|
/^com\.amazonaws\.vpce\..+\.vpce-svc-.+$/,
|
|
388
480
|
"Must be a valid VPC Endpoint Service name (com.amazonaws.vpce.<region>.vpce-svc-*)"
|
|
389
481
|
),
|
|
@@ -391,14 +483,43 @@ var CreatePrivateLinkConnectionBody = z11.object({
|
|
|
391
483
|
// this validates the AWS region *format* only; the authoritative check that
|
|
392
484
|
// the region is actually configured happens server-side against the set of
|
|
393
485
|
// regions discovered from env vars.
|
|
394
|
-
targetRegion:
|
|
486
|
+
targetRegion: z12.string().regex(/^[a-z]{2}-[a-z]+-\d+$/, "Must be a valid AWS region")
|
|
487
|
+
});
|
|
488
|
+
var DeletePrivateLinkResult = z12.object({
|
|
489
|
+
success: z12.boolean()
|
|
395
490
|
});
|
|
396
|
-
var
|
|
397
|
-
|
|
491
|
+
var PrivateLinkRegionsResult = z12.object({
|
|
492
|
+
availableRegions: z12.array(z12.string()),
|
|
493
|
+
activeRegions: z12.array(z12.string())
|
|
398
494
|
});
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
495
|
+
|
|
496
|
+
// src/v3/schemas/promoCodes.ts
|
|
497
|
+
import { z as z13 } from "zod";
|
|
498
|
+
var ValidatePromoCodeBodySchema = z13.object({
|
|
499
|
+
code: z13.string()
|
|
500
|
+
});
|
|
501
|
+
var ValidatePromoCodeResult = z13.object({
|
|
502
|
+
valid: z13.boolean(),
|
|
503
|
+
amountInCents: z13.number().optional(),
|
|
504
|
+
expiresAt: z13.string().datetime().nullable().optional()
|
|
505
|
+
});
|
|
506
|
+
var ApplyPromoCodeBodySchema = z13.object({
|
|
507
|
+
code: z13.string(),
|
|
508
|
+
userId: z13.string()
|
|
509
|
+
});
|
|
510
|
+
var ApplyPromoCodeResult = z13.object({
|
|
511
|
+
applied: z13.boolean(),
|
|
512
|
+
amountInCents: z13.number().optional(),
|
|
513
|
+
expiresAt: z13.string().datetime().nullable().optional(),
|
|
514
|
+
// Present when applied is false, e.g. "already_redeemed" or "invalid".
|
|
515
|
+
reason: z13.string().optional()
|
|
516
|
+
});
|
|
517
|
+
var PromoCreditsResult = z13.object({
|
|
518
|
+
promoCredits: z13.object({
|
|
519
|
+
grantedCents: z13.number(),
|
|
520
|
+
remainingCents: z13.number(),
|
|
521
|
+
expiresAt: z13.string().datetime().nullable()
|
|
522
|
+
}).nullable()
|
|
402
523
|
});
|
|
403
524
|
|
|
404
525
|
// src/v3/client/index.ts
|
|
@@ -452,6 +573,34 @@ var BillingClient = class {
|
|
|
452
573
|
}
|
|
453
574
|
);
|
|
454
575
|
}
|
|
576
|
+
async validatePromoCode(code) {
|
|
577
|
+
return await this.fetch(`/api/v1/promo-codes/validate`, ValidatePromoCodeResult, {
|
|
578
|
+
method: "POST",
|
|
579
|
+
headers: {
|
|
580
|
+
"Content-Type": "application/json"
|
|
581
|
+
},
|
|
582
|
+
body: JSON.stringify({ code })
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
async applyPromoCode(orgId, body) {
|
|
586
|
+
return await this.fetch(
|
|
587
|
+
`/api/v1/orgs/${orgId}/promo/apply`,
|
|
588
|
+
ApplyPromoCodeResult,
|
|
589
|
+
{
|
|
590
|
+
method: "POST",
|
|
591
|
+
headers: {
|
|
592
|
+
"Content-Type": "application/json"
|
|
593
|
+
},
|
|
594
|
+
body: JSON.stringify(body)
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
async promoCredits(orgId) {
|
|
599
|
+
return await this.fetch(
|
|
600
|
+
`/api/v1/orgs/${orgId}/promo/credits`,
|
|
601
|
+
PromoCreditsResult
|
|
602
|
+
);
|
|
603
|
+
}
|
|
455
604
|
async createPortalSession(orgId, body) {
|
|
456
605
|
return await this.fetch(
|
|
457
606
|
`/api/v1/orgs/${orgId}/v3/subscription/portal`,
|
|
@@ -553,6 +702,41 @@ var BillingClient = class {
|
|
|
553
702
|
}
|
|
554
703
|
);
|
|
555
704
|
}
|
|
705
|
+
async getBillingLimit(orgId) {
|
|
706
|
+
return await this.fetch(
|
|
707
|
+
`/api/v1/orgs/${orgId}/billing-limit`,
|
|
708
|
+
BillingLimitResult
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
async updateBillingLimit(orgId, body) {
|
|
712
|
+
return await this.fetch(
|
|
713
|
+
`/api/v1/orgs/${orgId}/billing-limit`,
|
|
714
|
+
BillingLimitResult,
|
|
715
|
+
{
|
|
716
|
+
method: "PUT",
|
|
717
|
+
headers: {
|
|
718
|
+
"Content-Type": "application/json"
|
|
719
|
+
},
|
|
720
|
+
body: JSON.stringify(body)
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
async resolveBillingLimit(orgId, body) {
|
|
725
|
+
return await this.fetch(
|
|
726
|
+
`/api/v1/orgs/${orgId}/billing-limit/resolve`,
|
|
727
|
+
BillingLimitResult,
|
|
728
|
+
{
|
|
729
|
+
method: "POST",
|
|
730
|
+
headers: {
|
|
731
|
+
"Content-Type": "application/json"
|
|
732
|
+
},
|
|
733
|
+
body: JSON.stringify(body)
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
async getActiveBillingLimits() {
|
|
738
|
+
return await this.fetch(`/api/v1/billing-limits/active`, BillingLimitsActiveResult);
|
|
739
|
+
}
|
|
556
740
|
async getPrivateLinks(orgId) {
|
|
557
741
|
return await this.fetch(
|
|
558
742
|
`/api/v1/orgs/${orgId}/private-connections`,
|
|
@@ -736,8 +920,20 @@ export {
|
|
|
736
920
|
AddOn,
|
|
737
921
|
AddOnDefinition,
|
|
738
922
|
AddOns,
|
|
923
|
+
ApplyPromoCodeBodySchema,
|
|
924
|
+
ApplyPromoCodeResult,
|
|
739
925
|
BillingAlertsResult,
|
|
740
926
|
BillingClient,
|
|
927
|
+
BillingLimitActiveOrg,
|
|
928
|
+
BillingLimitConfiguredCustom,
|
|
929
|
+
BillingLimitConfiguredNone,
|
|
930
|
+
BillingLimitConfiguredPlan,
|
|
931
|
+
BillingLimitPendingResolveOrg,
|
|
932
|
+
BillingLimitResult,
|
|
933
|
+
BillingLimitState,
|
|
934
|
+
BillingLimitUnconfigured,
|
|
935
|
+
BillingLimitsActiveResult,
|
|
936
|
+
BillingLimitsPendingResolvesResult,
|
|
741
937
|
CreatePrivateLinkConnectionBody,
|
|
742
938
|
CurrentPlan,
|
|
743
939
|
CustomerPortalRequestBodySchema,
|
|
@@ -748,6 +944,7 @@ export {
|
|
|
748
944
|
ErrorSchema,
|
|
749
945
|
FreeConnectRequiredSchema,
|
|
750
946
|
FreeConnectedSchema,
|
|
947
|
+
MAX_INVOCATION_COST_IN_CENTS,
|
|
751
948
|
PlanDefinitionSchema,
|
|
752
949
|
Plans,
|
|
753
950
|
PlansResult,
|
|
@@ -755,12 +952,14 @@ export {
|
|
|
755
952
|
PrivateLinkConnectionList,
|
|
756
953
|
PrivateLinkConnectionStatus,
|
|
757
954
|
PrivateLinkRegionsResult,
|
|
955
|
+
PromoCreditsResult,
|
|
758
956
|
RegistryCredentialsResponseSchema,
|
|
759
957
|
ReportComputeUsageEvent,
|
|
760
958
|
ReportInvocationUsageEvent,
|
|
761
959
|
ReportInvocationUsageResult,
|
|
762
960
|
ReportUsagePlan,
|
|
763
961
|
ReportUsageResult,
|
|
962
|
+
ResolveBillingLimitRequest,
|
|
764
963
|
SetAddOnBody,
|
|
765
964
|
SetAddOnResult,
|
|
766
965
|
SetPlanBodySchema,
|
|
@@ -769,10 +968,13 @@ export {
|
|
|
769
968
|
TriggerInitialDeploymentRequestSchema,
|
|
770
969
|
TriggerInitialDeploymentResponseSchema,
|
|
771
970
|
UpdateBillingAlertsRequest,
|
|
971
|
+
UpdateBillingLimitRequest,
|
|
772
972
|
UsageParams,
|
|
773
973
|
UsageResult,
|
|
774
974
|
UsageSeriesParams,
|
|
775
975
|
UsageSeriesResult,
|
|
976
|
+
ValidatePromoCodeBodySchema,
|
|
977
|
+
ValidatePromoCodeResult,
|
|
776
978
|
defaultMachine,
|
|
777
979
|
machineDefinition,
|
|
778
980
|
machines,
|