@trigger.dev/platform 1.3.1 → 1.4.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 +829 -993
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2664 -2034
- package/dist/index.d.ts +2664 -2034
- package/dist/index.js +764 -904
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -1,1014 +1,850 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/v3/schemas/planDefinitions.ts
|
|
4
|
+
const ExceedableLimit = zod.z.object({
|
|
5
|
+
number: zod.z.number(),
|
|
6
|
+
canExceed: zod.z.boolean().optional()
|
|
7
|
+
});
|
|
8
|
+
const EnvironmentBasedLimit = zod.z.object({
|
|
9
|
+
production: zod.z.number(),
|
|
10
|
+
staging: zod.z.number(),
|
|
11
|
+
preview: zod.z.number(),
|
|
12
|
+
development: zod.z.number(),
|
|
13
|
+
canExceed: zod.z.boolean().optional(),
|
|
14
|
+
number: zod.z.number()
|
|
15
|
+
});
|
|
16
|
+
const BatchRateLimitConfig = zod.z.object({
|
|
17
|
+
type: zod.z.string(),
|
|
18
|
+
interval: zod.z.string(),
|
|
19
|
+
maxTokens: zod.z.number(),
|
|
20
|
+
refillRate: zod.z.number()
|
|
21
|
+
});
|
|
22
|
+
const BatchQueueConcurrencyConfig = zod.z.object({ processingConcurrency: zod.z.number() });
|
|
23
|
+
/**
|
|
24
|
+
* Hosted webhook limits, synced into Organization.webhookLimitsConfig on plan changes. The webapp
|
|
25
|
+
* falls back to its env defaults for any field that isn't set.
|
|
26
|
+
*/
|
|
27
|
+
const WebhookLimitsConfig = zod.z.object({
|
|
28
|
+
maxWaitersPerEnvironment: zod.z.number(),
|
|
29
|
+
maxWaitersPerEndpoint: zod.z.number(),
|
|
30
|
+
concurrency: zod.z.number(),
|
|
31
|
+
deliveryRetentionDays: zod.z.number(),
|
|
32
|
+
deliveryRetentionStrict: zod.z.boolean().optional(),
|
|
33
|
+
endpointRateLimitTokens: zod.z.number().optional(),
|
|
34
|
+
endpointRateLimitWindowSeconds: zod.z.number().optional(),
|
|
35
|
+
environmentRateLimitTokens: zod.z.number().optional(),
|
|
36
|
+
environmentRateLimitWindowSeconds: zod.z.number().optional()
|
|
37
|
+
});
|
|
38
|
+
const QueueSizeLimits = zod.z.object({
|
|
39
|
+
development: zod.z.number(),
|
|
40
|
+
deployed: zod.z.number()
|
|
41
|
+
});
|
|
42
|
+
const Limits = zod.z.object({
|
|
43
|
+
includedUsage: zod.z.number(),
|
|
44
|
+
concurrentRuns: EnvironmentBasedLimit,
|
|
45
|
+
teamMembers: ExceedableLimit,
|
|
46
|
+
schedules: ExceedableLimit,
|
|
47
|
+
logRetentionDays: ExceedableLimit,
|
|
48
|
+
queryPeriodDays: ExceedableLimit,
|
|
49
|
+
alerts: ExceedableLimit,
|
|
50
|
+
hasStagingEnvironment: zod.z.boolean(),
|
|
51
|
+
realtimeConcurrentConnections: ExceedableLimit,
|
|
52
|
+
branches: ExceedableLimit,
|
|
53
|
+
branchesDev: ExceedableLimit,
|
|
54
|
+
support: zod.z.enum(["community", "slack"]),
|
|
55
|
+
batchRateLimitConfig: BatchRateLimitConfig.optional(),
|
|
56
|
+
batchQueueConcurrencyConfig: BatchQueueConcurrencyConfig.optional(),
|
|
57
|
+
webhookLimitsConfig: WebhookLimitsConfig.optional(),
|
|
58
|
+
metricDashboards: ExceedableLimit,
|
|
59
|
+
metricWidgetsPerDashboard: ExceedableLimit,
|
|
60
|
+
agentMessages: ExceedableLimit.optional(),
|
|
61
|
+
agentWatchMaxHours: ExceedableLimit.optional(),
|
|
62
|
+
agentWatchers: ExceedableLimit.optional(),
|
|
63
|
+
declaredSchedulesPerDeploy: ExceedableLimit.optional(),
|
|
64
|
+
queueSizeLimits: QueueSizeLimits.optional(),
|
|
65
|
+
hasPrivateNetworking: zod.z.boolean().optional(),
|
|
66
|
+
privateLinkConnectionLimit: zod.z.number().optional(),
|
|
67
|
+
hasSso: zod.z.boolean().optional(),
|
|
68
|
+
streamBasinRetention: zod.z.string().optional()
|
|
69
|
+
});
|
|
70
|
+
const commonMetadata = {
|
|
71
|
+
title: zod.z.string(),
|
|
72
|
+
code: zod.z.string()
|
|
9
73
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
74
|
+
const pricingLookup = {
|
|
75
|
+
tierPriceCode: zod.z.string(),
|
|
76
|
+
usagePriceCode: zod.z.string(),
|
|
77
|
+
usageCouponCode: zod.z.string().optional()
|
|
17
78
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
BillingLimitsPendingResolvesResult: () => BillingLimitsPendingResolvesResult,
|
|
40
|
-
CreatePrivateLinkConnectionBody: () => CreatePrivateLinkConnectionBody,
|
|
41
|
-
CurrentPlan: () => CurrentPlan,
|
|
42
|
-
CustomerPortalRequestBodySchema: () => CustomerPortalRequestBodySchema,
|
|
43
|
-
CustomerPortalSchema: () => CustomerPortalSchema,
|
|
44
|
-
DeletePrivateLinkResult: () => DeletePrivateLinkResult,
|
|
45
|
-
EnqueueBuildRequestSchema: () => EnqueueBuildRequestSchema,
|
|
46
|
-
EnqueueBuildResponseSchema: () => EnqueueBuildResponseSchema,
|
|
47
|
-
ErrorSchema: () => ErrorSchema,
|
|
48
|
-
FreeConnectRequiredSchema: () => FreeConnectRequiredSchema,
|
|
49
|
-
FreeConnectedSchema: () => FreeConnectedSchema,
|
|
50
|
-
MAX_INVOCATION_COST_IN_CENTS: () => MAX_INVOCATION_COST_IN_CENTS,
|
|
51
|
-
PlanDefinitionSchema: () => PlanDefinitionSchema,
|
|
52
|
-
Plans: () => Plans,
|
|
53
|
-
PlansResult: () => PlansResult,
|
|
54
|
-
PrivateLinkConnection: () => PrivateLinkConnection,
|
|
55
|
-
PrivateLinkConnectionList: () => PrivateLinkConnectionList,
|
|
56
|
-
PrivateLinkConnectionStatus: () => PrivateLinkConnectionStatus,
|
|
57
|
-
PrivateLinkRegionsResult: () => PrivateLinkRegionsResult,
|
|
58
|
-
PromoCreditsResult: () => PromoCreditsResult,
|
|
59
|
-
RegistryCredentialsResponseSchema: () => RegistryCredentialsResponseSchema,
|
|
60
|
-
ReportComputeUsageEvent: () => ReportComputeUsageEvent,
|
|
61
|
-
ReportInvocationUsageEvent: () => ReportInvocationUsageEvent,
|
|
62
|
-
ReportInvocationUsageResult: () => ReportInvocationUsageResult,
|
|
63
|
-
ReportUsagePlan: () => ReportUsagePlan,
|
|
64
|
-
ReportUsageResult: () => ReportUsageResult,
|
|
65
|
-
ResolveBillingLimitRequest: () => ResolveBillingLimitRequest,
|
|
66
|
-
SetAddOnBody: () => SetAddOnBody,
|
|
67
|
-
SetAddOnResult: () => SetAddOnResult,
|
|
68
|
-
SetPlanBodySchema: () => SetPlanBodySchema,
|
|
69
|
-
SubscribeResultSchema: () => SubscribeResultSchema,
|
|
70
|
-
SubscriptionResult: () => SubscriptionResult,
|
|
71
|
-
TriggerInitialDeploymentRequestSchema: () => TriggerInitialDeploymentRequestSchema,
|
|
72
|
-
TriggerInitialDeploymentResponseSchema: () => TriggerInitialDeploymentResponseSchema,
|
|
73
|
-
UpdateBillingAlertsRequest: () => UpdateBillingAlertsRequest,
|
|
74
|
-
UpdateBillingLimitRequest: () => UpdateBillingLimitRequest,
|
|
75
|
-
UsageParams: () => UsageParams,
|
|
76
|
-
UsageResult: () => UsageResult,
|
|
77
|
-
UsageSeriesParams: () => UsageSeriesParams,
|
|
78
|
-
UsageSeriesResult: () => UsageSeriesResult,
|
|
79
|
-
ValidatePromoCodeBodySchema: () => ValidatePromoCodeBodySchema,
|
|
80
|
-
ValidatePromoCodeResult: () => ValidatePromoCodeResult,
|
|
81
|
-
defaultMachine: () => defaultMachine,
|
|
82
|
-
machineDefinition: () => machineDefinition,
|
|
83
|
-
machines: () => machines,
|
|
84
|
-
objectToSearchParams: () => objectToSearchParams
|
|
85
|
-
});
|
|
86
|
-
module.exports = __toCommonJS(v3_exports);
|
|
87
|
-
|
|
88
|
-
// src/v3/schemas/planDefinitions.ts
|
|
89
|
-
var import_zod = require("zod");
|
|
90
|
-
var ExceedableLimit = import_zod.z.object({
|
|
91
|
-
number: import_zod.z.number(),
|
|
92
|
-
canExceed: import_zod.z.boolean().optional()
|
|
93
|
-
});
|
|
94
|
-
var EnvironmentBasedLimit = import_zod.z.object({
|
|
95
|
-
production: import_zod.z.number(),
|
|
96
|
-
staging: import_zod.z.number(),
|
|
97
|
-
preview: import_zod.z.number(),
|
|
98
|
-
development: import_zod.z.number(),
|
|
99
|
-
canExceed: import_zod.z.boolean().optional(),
|
|
100
|
-
// Legacy, return the `production` value
|
|
101
|
-
number: import_zod.z.number()
|
|
102
|
-
});
|
|
103
|
-
var BatchRateLimitConfig = import_zod.z.object({
|
|
104
|
-
type: import_zod.z.string(),
|
|
105
|
-
interval: import_zod.z.string(),
|
|
106
|
-
maxTokens: import_zod.z.number(),
|
|
107
|
-
refillRate: import_zod.z.number()
|
|
108
|
-
});
|
|
109
|
-
var BatchQueueConcurrencyConfig = import_zod.z.object({
|
|
110
|
-
processingConcurrency: import_zod.z.number()
|
|
111
|
-
});
|
|
112
|
-
var QueueSizeLimits = import_zod.z.object({
|
|
113
|
-
development: import_zod.z.number(),
|
|
114
|
-
deployed: import_zod.z.number()
|
|
115
|
-
});
|
|
116
|
-
var Limits = import_zod.z.object({
|
|
117
|
-
includedUsage: import_zod.z.number(),
|
|
118
|
-
concurrentRuns: EnvironmentBasedLimit,
|
|
119
|
-
teamMembers: ExceedableLimit,
|
|
120
|
-
schedules: ExceedableLimit,
|
|
121
|
-
logRetentionDays: ExceedableLimit,
|
|
122
|
-
queryPeriodDays: ExceedableLimit,
|
|
123
|
-
alerts: ExceedableLimit,
|
|
124
|
-
hasStagingEnvironment: import_zod.z.boolean(),
|
|
125
|
-
realtimeConcurrentConnections: ExceedableLimit,
|
|
126
|
-
branches: ExceedableLimit,
|
|
127
|
-
branchesDev: ExceedableLimit,
|
|
128
|
-
support: import_zod.z.enum(["community", "slack"]),
|
|
129
|
-
batchRateLimitConfig: BatchRateLimitConfig.optional(),
|
|
130
|
-
batchQueueConcurrencyConfig: BatchQueueConcurrencyConfig.optional(),
|
|
131
|
-
metricDashboards: ExceedableLimit,
|
|
132
|
-
metricWidgetsPerDashboard: ExceedableLimit,
|
|
133
|
-
queueSizeLimits: QueueSizeLimits.optional(),
|
|
134
|
-
hasPrivateNetworking: import_zod.z.boolean().optional(),
|
|
135
|
-
privateLinkConnectionLimit: import_zod.z.number().optional(),
|
|
136
|
-
hasSso: import_zod.z.boolean().optional(),
|
|
137
|
-
// Duration string (e.g. "30d", "1y"). When set, the org gets a
|
|
138
|
-
// dedicated S2 stream basin with this retention; when omitted, the
|
|
139
|
-
// org's streams flow to the shared global basin.
|
|
140
|
-
streamBasinRetention: import_zod.z.string().optional()
|
|
141
|
-
});
|
|
142
|
-
var commonMetadata = {
|
|
143
|
-
title: import_zod.z.string(),
|
|
144
|
-
code: import_zod.z.string()
|
|
145
|
-
};
|
|
146
|
-
var pricingLookup = {
|
|
147
|
-
tierPriceCode: import_zod.z.string(),
|
|
148
|
-
usagePriceCode: import_zod.z.string(),
|
|
149
|
-
usageCouponCode: import_zod.z.string().optional()
|
|
150
|
-
};
|
|
151
|
-
var FreePlanDefinition = import_zod.z.object({
|
|
152
|
-
...commonMetadata,
|
|
153
|
-
type: import_zod.z.literal("free"),
|
|
154
|
-
limits: Limits
|
|
155
|
-
});
|
|
156
|
-
var PaidPlanDefinition = import_zod.z.object({
|
|
157
|
-
...commonMetadata,
|
|
158
|
-
type: import_zod.z.literal("paid"),
|
|
159
|
-
tierPrice: import_zod.z.number(),
|
|
160
|
-
stripe: import_zod.z.object(pricingLookup),
|
|
161
|
-
limits: Limits
|
|
162
|
-
});
|
|
163
|
-
var EnterprisePlanDefinition = import_zod.z.object({
|
|
164
|
-
...commonMetadata,
|
|
165
|
-
type: import_zod.z.literal("enterprise"),
|
|
166
|
-
limits: Limits
|
|
167
|
-
});
|
|
168
|
-
var PlanDefinitionSchema = import_zod.z.discriminatedUnion("type", [
|
|
169
|
-
FreePlanDefinition,
|
|
170
|
-
PaidPlanDefinition,
|
|
171
|
-
EnterprisePlanDefinition
|
|
79
|
+
const FreePlanDefinition = zod.z.object({
|
|
80
|
+
...commonMetadata,
|
|
81
|
+
type: zod.z.literal("free"),
|
|
82
|
+
limits: Limits
|
|
83
|
+
});
|
|
84
|
+
const PaidPlanDefinition = zod.z.object({
|
|
85
|
+
...commonMetadata,
|
|
86
|
+
type: zod.z.literal("paid"),
|
|
87
|
+
tierPrice: zod.z.number(),
|
|
88
|
+
stripe: zod.z.object(pricingLookup),
|
|
89
|
+
limits: Limits
|
|
90
|
+
});
|
|
91
|
+
const EnterprisePlanDefinition = zod.z.object({
|
|
92
|
+
...commonMetadata,
|
|
93
|
+
type: zod.z.literal("enterprise"),
|
|
94
|
+
limits: Limits
|
|
95
|
+
});
|
|
96
|
+
const PlanDefinitionSchema = zod.z.discriminatedUnion("type", [
|
|
97
|
+
FreePlanDefinition,
|
|
98
|
+
PaidPlanDefinition,
|
|
99
|
+
EnterprisePlanDefinition
|
|
172
100
|
]);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
var CurrentPlan = import_zod2.z.object({
|
|
234
|
-
//todo remove this after the next deploy
|
|
235
|
-
subscription: import_zod2.z.any(),
|
|
236
|
-
v3Subscription: SubscriptionResult
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// src/v3/schemas/subscribe.ts
|
|
240
|
-
var import_zod3 = require("zod");
|
|
241
|
-
var SetPaidPlanBodySchema = import_zod3.z.object({
|
|
242
|
-
type: import_zod3.z.literal("paid"),
|
|
243
|
-
planCode: import_zod3.z.string(),
|
|
244
|
-
userId: import_zod3.z.string()
|
|
245
|
-
});
|
|
246
|
-
var SetFreePlanBodySchema = import_zod3.z.object({
|
|
247
|
-
type: import_zod3.z.literal("free"),
|
|
248
|
-
userId: import_zod3.z.string()
|
|
249
|
-
});
|
|
250
|
-
var SetPlanBodySchema = import_zod3.z.discriminatedUnion("type", [
|
|
251
|
-
SetPaidPlanBodySchema,
|
|
252
|
-
SetFreePlanBodySchema
|
|
101
|
+
const MachineDefinition = zod.z.object({
|
|
102
|
+
code: zod.z.string(),
|
|
103
|
+
title: zod.z.string(),
|
|
104
|
+
cpu: zod.z.number(),
|
|
105
|
+
memory: zod.z.number(),
|
|
106
|
+
centsPerMs: zod.z.number()
|
|
107
|
+
});
|
|
108
|
+
const Plans = zod.z.object({
|
|
109
|
+
free: FreePlanDefinition,
|
|
110
|
+
hobby: PaidPlanDefinition,
|
|
111
|
+
pro: PaidPlanDefinition,
|
|
112
|
+
enterprise: EnterprisePlanDefinition
|
|
113
|
+
});
|
|
114
|
+
/** The pricing per step of the add-on, e.g. $10 for 50 units */
|
|
115
|
+
const AddOnPricing = zod.z.object({
|
|
116
|
+
/** The step size - must purchase in multiples of this amount */
|
|
117
|
+
stepSize: zod.z.number(),
|
|
118
|
+
/** Price per step in cents */
|
|
119
|
+
centsPerStep: zod.z.number()
|
|
120
|
+
});
|
|
121
|
+
const PlansResult = zod.z.object({
|
|
122
|
+
plans: Plans,
|
|
123
|
+
usagePricing: zod.z.object({
|
|
124
|
+
centsPerRunInvocation: zod.z.number(),
|
|
125
|
+
machines: zod.z.record(zod.z.string(), MachineDefinition),
|
|
126
|
+
defaultMachine: zod.z.string()
|
|
127
|
+
}),
|
|
128
|
+
addOnPricing: zod.z.object({
|
|
129
|
+
concurrency: AddOnPricing,
|
|
130
|
+
branches: AddOnPricing,
|
|
131
|
+
seats: AddOnPricing,
|
|
132
|
+
schedules: AddOnPricing
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
const AddOnDefinition = zod.z.object({
|
|
136
|
+
code: zod.z.enum([
|
|
137
|
+
"concurrency",
|
|
138
|
+
"branches",
|
|
139
|
+
"seats",
|
|
140
|
+
"schedules"
|
|
141
|
+
]),
|
|
142
|
+
priceCode: zod.z.string(),
|
|
143
|
+
pricing: AddOnPricing
|
|
144
|
+
});
|
|
145
|
+
const AddOn = zod.z.object({
|
|
146
|
+
purchased: zod.z.number(),
|
|
147
|
+
quota: zod.z.number().optional()
|
|
148
|
+
});
|
|
149
|
+
const AddOns = zod.z.object({
|
|
150
|
+
concurrentRuns: AddOn.optional(),
|
|
151
|
+
branches: AddOn.optional(),
|
|
152
|
+
seats: AddOn.optional(),
|
|
153
|
+
schedules: AddOn.optional()
|
|
154
|
+
});
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/v3/schemas/subscription.ts
|
|
157
|
+
const FreeTierStatus = zod.z.enum([
|
|
158
|
+
"requires_connect",
|
|
159
|
+
"approved",
|
|
160
|
+
"rejected"
|
|
253
161
|
]);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
162
|
+
const SubscriptionResult = zod.z.object({
|
|
163
|
+
freeTierStatus: FreeTierStatus,
|
|
164
|
+
isPaying: zod.z.boolean(),
|
|
165
|
+
showSelfServe: zod.z.boolean().default(true),
|
|
166
|
+
canceledAt: zod.z.string().optional(),
|
|
167
|
+
plan: PlanDefinitionSchema.optional(),
|
|
168
|
+
addOns: AddOns.optional()
|
|
169
|
+
});
|
|
170
|
+
const CurrentPlan = zod.z.object({
|
|
171
|
+
subscription: zod.z.any(),
|
|
172
|
+
v3Subscription: SubscriptionResult
|
|
173
|
+
});
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/v3/schemas/subscribe.ts
|
|
176
|
+
const SetPaidPlanBodySchema = zod.z.object({
|
|
177
|
+
type: zod.z.literal("paid"),
|
|
178
|
+
planCode: zod.z.string(),
|
|
179
|
+
userId: zod.z.string()
|
|
180
|
+
});
|
|
181
|
+
const SetFreePlanBodySchema = zod.z.object({
|
|
182
|
+
type: zod.z.literal("free"),
|
|
183
|
+
userId: zod.z.string()
|
|
184
|
+
});
|
|
185
|
+
const SetPlanBodySchema = zod.z.discriminatedUnion("type", [SetPaidPlanBodySchema, SetFreePlanBodySchema]);
|
|
186
|
+
const FreeConnectRequiredSchema = zod.z.object({
|
|
187
|
+
action: zod.z.literal("free_connect_required"),
|
|
188
|
+
connectUrl: zod.z.string().url()
|
|
189
|
+
});
|
|
190
|
+
const FreeConnectedSchema = zod.z.object({
|
|
191
|
+
action: zod.z.literal("free_connected"),
|
|
192
|
+
accepted: zod.z.boolean()
|
|
193
|
+
});
|
|
194
|
+
const UpdatedSubscriptionResultSchema = zod.z.object({
|
|
195
|
+
action: zod.z.literal("updated_subscription"),
|
|
196
|
+
subscription: zod.z.object({ planCode: zod.z.string() })
|
|
197
|
+
});
|
|
198
|
+
const CreateSubscriptionFlowStartSchema = zod.z.object({
|
|
199
|
+
action: zod.z.literal("create_subscription_flow_start"),
|
|
200
|
+
subscription: zod.z.object({ planCode: zod.z.string() }),
|
|
201
|
+
checkoutUrl: zod.z.string().url()
|
|
202
|
+
});
|
|
203
|
+
const CanceledSubscriptionResultSchema = zod.z.object({ action: zod.z.literal("canceled_subscription") });
|
|
204
|
+
const SubscribeResultSchema = zod.z.discriminatedUnion("action", [
|
|
205
|
+
FreeConnectRequiredSchema,
|
|
206
|
+
FreeConnectedSchema,
|
|
207
|
+
CreateSubscriptionFlowStartSchema,
|
|
208
|
+
UpdatedSubscriptionResultSchema,
|
|
209
|
+
CanceledSubscriptionResultSchema
|
|
284
210
|
]);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
211
|
+
const SetAddOnBody = zod.z.object({
|
|
212
|
+
type: zod.z.enum([
|
|
213
|
+
"concurrency",
|
|
214
|
+
"branches",
|
|
215
|
+
"seats",
|
|
216
|
+
"schedules"
|
|
217
|
+
]),
|
|
218
|
+
amount: zod.z.number()
|
|
219
|
+
});
|
|
220
|
+
const SetAddOnResult = zod.z.discriminatedUnion("result", [
|
|
221
|
+
zod.z.object({
|
|
222
|
+
result: zod.z.literal("error"),
|
|
223
|
+
error: zod.z.string()
|
|
224
|
+
}),
|
|
225
|
+
zod.z.object({
|
|
226
|
+
result: zod.z.literal("success"),
|
|
227
|
+
type: zod.z.string(),
|
|
228
|
+
amount: zod.z.number(),
|
|
229
|
+
subscription: zod.z.object({ id: zod.z.string() })
|
|
230
|
+
}),
|
|
231
|
+
zod.z.object({
|
|
232
|
+
result: zod.z.literal("max_quota_reached"),
|
|
233
|
+
type: zod.z.string(),
|
|
234
|
+
maxQuota: zod.z.number()
|
|
235
|
+
})
|
|
307
236
|
]);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
237
|
+
const CancelSubscriptionResponse = zod.z.object({
|
|
238
|
+
outcome: zod.z.enum([
|
|
239
|
+
"canceled",
|
|
240
|
+
"already_canceled",
|
|
241
|
+
"no_subscription"
|
|
242
|
+
]),
|
|
243
|
+
cancelAt: zod.z.string().nullable()
|
|
244
|
+
});
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/v3/schemas/portal.ts
|
|
247
|
+
const CustomerPortalRequestBodySchema = zod.z.object({ returnUrl: zod.z.string() });
|
|
248
|
+
const CustomerPortalSchema = zod.z.object({ customerPortalUrl: zod.z.string().optional() });
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/v3/schemas/error.ts
|
|
251
|
+
const ErrorSchema = zod.z.object({
|
|
252
|
+
error: zod.z.string(),
|
|
253
|
+
code: zod.z.string().optional()
|
|
323
254
|
}).passthrough();
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
var UsageSeriesParams = import_zod6.z.object({
|
|
336
|
-
from: import_zod6.z.coerce.date(),
|
|
337
|
-
to: import_zod6.z.coerce.date(),
|
|
338
|
-
/** defaults to DAY */
|
|
339
|
-
window: Window.optional(),
|
|
340
|
-
timezone: import_zod6.z.string().optional()
|
|
341
|
-
//these don't work at the moment because you can't group by items that aren't defined in the meter group by
|
|
342
|
-
// groupByEnvironmentType: BooleanParam.optional(),
|
|
343
|
-
// groupByTaskIdentifier: BooleanParam.optional(),
|
|
344
|
-
});
|
|
345
|
-
var UsageSeriesResult = import_zod6.z.object({
|
|
346
|
-
from: import_zod6.z.string(),
|
|
347
|
-
to: import_zod6.z.string(),
|
|
348
|
-
window: Window.optional(),
|
|
349
|
-
data: import_zod6.z.object({
|
|
350
|
-
value: import_zod6.z.number(),
|
|
351
|
-
windowStart: import_zod6.z.string(),
|
|
352
|
-
windowEnd: import_zod6.z.string()
|
|
353
|
-
//these don't work at the moment
|
|
354
|
-
// groupBy: z
|
|
355
|
-
// .object({
|
|
356
|
-
// environmentType: z.string().optional(),
|
|
357
|
-
// taskIdentifer: z.string().optional(),
|
|
358
|
-
// })
|
|
359
|
-
// .optional(),
|
|
360
|
-
}).array()
|
|
361
|
-
});
|
|
362
|
-
var ReportComputeUsageEvent = import_zod6.z.object({
|
|
363
|
-
durationMs: import_zod6.z.number()
|
|
364
|
-
});
|
|
365
|
-
var ReportUsagePlan = import_zod6.z.object({
|
|
366
|
-
type: import_zod6.z.string(),
|
|
367
|
-
code: import_zod6.z.string(),
|
|
368
|
-
isPaying: import_zod6.z.boolean()
|
|
369
|
-
});
|
|
370
|
-
var ReportUsageResult = import_zod6.z.object({
|
|
371
|
-
hasAccess: import_zod6.z.boolean(),
|
|
372
|
-
balance: import_zod6.z.number().optional(),
|
|
373
|
-
usage: import_zod6.z.number().optional(),
|
|
374
|
-
overage: import_zod6.z.number().optional(),
|
|
375
|
-
plan: ReportUsagePlan.optional(),
|
|
376
|
-
limitState: import_zod6.z.literal("grace").optional(),
|
|
377
|
-
reason: import_zod6.z.enum(["free_tier_exceeded", "billing_limit"]).optional()
|
|
378
|
-
});
|
|
379
|
-
var MAX_INVOCATION_COST_IN_CENTS = 1e4;
|
|
380
|
-
var ReportInvocationUsageEvent = import_zod6.z.object({
|
|
381
|
-
organizationId: import_zod6.z.string().min(1).max(128),
|
|
382
|
-
costInCents: import_zod6.z.number().finite().min(0).max(MAX_INVOCATION_COST_IN_CENTS),
|
|
383
|
-
additionalData: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.any()).optional()
|
|
384
|
-
});
|
|
385
|
-
var ReportInvocationUsageResult = import_zod6.z.discriminatedUnion("success", [
|
|
386
|
-
import_zod6.z.object({
|
|
387
|
-
success: import_zod6.z.literal(true)
|
|
388
|
-
}),
|
|
389
|
-
import_zod6.z.object({
|
|
390
|
-
success: import_zod6.z.literal(false),
|
|
391
|
-
error: import_zod6.z.string()
|
|
392
|
-
})
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/v3/schemas/usage.ts
|
|
257
|
+
const UsageParams = zod.z.object({
|
|
258
|
+
from: zod.z.coerce.date(),
|
|
259
|
+
to: zod.z.coerce.date()
|
|
260
|
+
});
|
|
261
|
+
const UsageResult = zod.z.object({ cents: zod.z.number() });
|
|
262
|
+
const Window = zod.z.enum([
|
|
263
|
+
"MINUTE",
|
|
264
|
+
"HOUR",
|
|
265
|
+
"DAY"
|
|
393
266
|
]);
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
267
|
+
const UsageSeriesParams = zod.z.object({
|
|
268
|
+
from: zod.z.coerce.date(),
|
|
269
|
+
to: zod.z.coerce.date(),
|
|
270
|
+
/** defaults to DAY */
|
|
271
|
+
window: Window.optional(),
|
|
272
|
+
timezone: zod.z.string().optional()
|
|
273
|
+
});
|
|
274
|
+
const UsageSeriesResult = zod.z.object({
|
|
275
|
+
from: zod.z.string(),
|
|
276
|
+
to: zod.z.string(),
|
|
277
|
+
window: Window.optional(),
|
|
278
|
+
data: zod.z.object({
|
|
279
|
+
value: zod.z.number(),
|
|
280
|
+
windowStart: zod.z.string(),
|
|
281
|
+
windowEnd: zod.z.string()
|
|
282
|
+
}).array()
|
|
283
|
+
});
|
|
284
|
+
const ReportComputeUsageEvent = zod.z.object({ durationMs: zod.z.number() });
|
|
285
|
+
const ReportUsagePlan = zod.z.object({
|
|
286
|
+
type: zod.z.string(),
|
|
287
|
+
code: zod.z.string(),
|
|
288
|
+
isPaying: zod.z.boolean()
|
|
289
|
+
});
|
|
290
|
+
const ReportUsageResult = zod.z.object({
|
|
291
|
+
hasAccess: zod.z.boolean(),
|
|
292
|
+
balance: zod.z.number().optional(),
|
|
293
|
+
usage: zod.z.number().optional(),
|
|
294
|
+
overage: zod.z.number().optional(),
|
|
295
|
+
plan: ReportUsagePlan.optional(),
|
|
296
|
+
limitState: zod.z.literal("grace").optional(),
|
|
297
|
+
reason: zod.z.enum(["free_tier_exceeded", "billing_limit"]).optional()
|
|
298
|
+
});
|
|
299
|
+
/** Upper bound for a single invocation base charge ($100). */
|
|
300
|
+
const MAX_INVOCATION_COST_IN_CENTS = 1e4;
|
|
301
|
+
const ReportInvocationUsageEvent = zod.z.object({
|
|
302
|
+
organizationId: zod.z.string().min(1).max(128),
|
|
303
|
+
costInCents: zod.z.number().finite().min(0).max(MAX_INVOCATION_COST_IN_CENTS),
|
|
304
|
+
additionalData: zod.z.record(zod.z.string(), zod.z.any()).optional()
|
|
305
|
+
});
|
|
306
|
+
const ReportInvocationUsageResult = zod.z.discriminatedUnion("success", [zod.z.object({ success: zod.z.literal(true) }), zod.z.object({
|
|
307
|
+
success: zod.z.literal(false),
|
|
308
|
+
error: zod.z.string()
|
|
309
|
+
})]);
|
|
310
|
+
const BillingAlertsResult = zod.z.object({
|
|
311
|
+
amount: zod.z.number(),
|
|
312
|
+
emails: zod.z.array(zod.z.string()),
|
|
313
|
+
alertLevels: zod.z.array(zod.z.number())
|
|
314
|
+
});
|
|
315
|
+
const UpdateBillingAlertsRequest = zod.z.object({
|
|
316
|
+
amount: zod.z.number().positive(),
|
|
317
|
+
emails: zod.z.array(zod.z.string()),
|
|
318
|
+
alertLevels: zod.z.array(zod.z.number())
|
|
319
|
+
});
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/v3/schemas/billingLimit.ts
|
|
322
|
+
const BillingLimitState = zod.z.discriminatedUnion("status", [
|
|
323
|
+
zod.z.object({ status: zod.z.literal("ok") }),
|
|
324
|
+
zod.z.object({
|
|
325
|
+
status: zod.z.literal("grace"),
|
|
326
|
+
hitAt: zod.z.string(),
|
|
327
|
+
graceEndsAt: zod.z.string()
|
|
328
|
+
}),
|
|
329
|
+
zod.z.object({
|
|
330
|
+
status: zod.z.literal("rejected"),
|
|
331
|
+
hitAt: zod.z.string(),
|
|
332
|
+
graceEndsAt: zod.z.string()
|
|
333
|
+
})
|
|
425
334
|
]);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
335
|
+
const billingLimitConfiguredFields = {
|
|
336
|
+
isConfigured: zod.z.literal(true),
|
|
337
|
+
cancelInProgressRuns: zod.z.boolean(),
|
|
338
|
+
limitState: BillingLimitState,
|
|
339
|
+
effectiveAmountCents: zod.z.number().int().nonnegative().nullable(),
|
|
340
|
+
gracePeriodMs: zod.z.number().int().nonnegative()
|
|
432
341
|
};
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
342
|
+
const BillingLimitUnconfigured = zod.z.object({
|
|
343
|
+
isConfigured: zod.z.literal(false),
|
|
344
|
+
gracePeriodMs: zod.z.number().int().nonnegative()
|
|
345
|
+
});
|
|
346
|
+
const BillingLimitConfiguredNone = zod.z.object({
|
|
347
|
+
...billingLimitConfiguredFields,
|
|
348
|
+
mode: zod.z.literal("none")
|
|
349
|
+
});
|
|
350
|
+
const BillingLimitConfiguredPlan = zod.z.object({
|
|
351
|
+
...billingLimitConfiguredFields,
|
|
352
|
+
mode: zod.z.literal("plan")
|
|
353
|
+
});
|
|
354
|
+
const BillingLimitConfiguredCustom = zod.z.object({
|
|
355
|
+
...billingLimitConfiguredFields,
|
|
356
|
+
mode: zod.z.literal("custom"),
|
|
357
|
+
amountCents: zod.z.number().int().positive()
|
|
358
|
+
});
|
|
359
|
+
const BillingLimitResult = zod.z.union([
|
|
360
|
+
BillingLimitUnconfigured,
|
|
361
|
+
BillingLimitConfiguredNone,
|
|
362
|
+
BillingLimitConfiguredPlan,
|
|
363
|
+
BillingLimitConfiguredCustom
|
|
455
364
|
]);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
365
|
+
const UpdateBillingLimitRequest = zod.z.discriminatedUnion("mode", [
|
|
366
|
+
zod.z.object({
|
|
367
|
+
mode: zod.z.literal("none"),
|
|
368
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
369
|
+
}),
|
|
370
|
+
zod.z.object({
|
|
371
|
+
mode: zod.z.literal("plan"),
|
|
372
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
373
|
+
}),
|
|
374
|
+
zod.z.object({
|
|
375
|
+
mode: zod.z.literal("custom"),
|
|
376
|
+
amountCents: zod.z.number().int().positive(),
|
|
377
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
378
|
+
})
|
|
470
379
|
]);
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
380
|
+
const ResolveBillingLimitRequest = zod.z.discriminatedUnion("action", [zod.z.object({
|
|
381
|
+
action: zod.z.literal("increase"),
|
|
382
|
+
newAmountCents: zod.z.number().int().positive(),
|
|
383
|
+
resumeMode: zod.z.enum(["queue", "new_only"])
|
|
384
|
+
}), zod.z.object({
|
|
385
|
+
action: zod.z.literal("remove"),
|
|
386
|
+
resumeMode: zod.z.enum(["queue", "new_only"])
|
|
387
|
+
})]);
|
|
388
|
+
const BillingLimitActiveOrg = zod.z.object({
|
|
389
|
+
orgId: zod.z.string(),
|
|
390
|
+
limitState: zod.z.enum(["grace", "rejected"])
|
|
391
|
+
});
|
|
392
|
+
const BillingLimitsActiveResult = zod.z.object({ orgs: zod.z.array(BillingLimitActiveOrg) });
|
|
393
|
+
const BillingLimitPendingResolveOrg = zod.z.object({
|
|
394
|
+
organizationId: zod.z.string(),
|
|
395
|
+
resumeMode: zod.z.enum(["queue", "new_only"]),
|
|
396
|
+
resolvedAt: zod.z.string()
|
|
397
|
+
});
|
|
398
|
+
const BillingLimitsPendingResolvesResult = zod.z.object({ orgs: zod.z.array(BillingLimitPendingResolveOrg) });
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/v3/schemas/registryCredentials.ts
|
|
401
|
+
const RegistryCredentialsResponseSchema = zod.z.object({
|
|
402
|
+
username: zod.z.string(),
|
|
403
|
+
password: zod.z.string(),
|
|
404
|
+
expiresAt: zod.z.string().datetime(),
|
|
405
|
+
repositoryUri: zod.z.string()
|
|
406
|
+
});
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/v3/schemas/enqueueBuild.ts
|
|
409
|
+
const EnqueueBuildOptionsSchema = zod.z.object({
|
|
410
|
+
skipPromotion: zod.z.boolean().optional(),
|
|
411
|
+
configFilePath: zod.z.string().optional(),
|
|
412
|
+
fromBundle: zod.z.boolean().optional()
|
|
413
|
+
});
|
|
414
|
+
const EnqueueBuildRequestSchema = zod.z.union([zod.z.object({
|
|
415
|
+
deploymentId: zod.z.string(),
|
|
416
|
+
artifactKey: zod.z.string(),
|
|
417
|
+
options: EnqueueBuildOptionsSchema
|
|
418
|
+
}), zod.z.object({
|
|
419
|
+
deploymentId: zod.z.string(),
|
|
420
|
+
github: zod.z.object({
|
|
421
|
+
commitSha: zod.z.string().regex(/^[0-9a-f]{40}$/, "commitSha must be a full lowercase git SHA"),
|
|
422
|
+
ref: zod.z.string().min(1).max(255)
|
|
423
|
+
}),
|
|
424
|
+
options: EnqueueBuildOptionsSchema
|
|
425
|
+
})]);
|
|
426
|
+
const EnqueueBuildResponseSchema = zod.z.object({ buildId: zod.z.string() });
|
|
427
|
+
const EnqueueBuildErrorCodeSchema = zod.z.enum([
|
|
428
|
+
"DEPLOYMENT_NOT_PENDING",
|
|
429
|
+
"NO_CONNECTED_REPOSITORY",
|
|
430
|
+
"ATOMIC_PRODUCTION_REQUIRES_VERCEL",
|
|
431
|
+
"COMMIT_NOT_FOUND",
|
|
432
|
+
"GITHUB_UNAVAILABLE"
|
|
481
433
|
]);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
username: import_zod9.z.string(),
|
|
502
|
-
password: import_zod9.z.string(),
|
|
503
|
-
expiresAt: import_zod9.z.string().datetime(),
|
|
504
|
-
repositoryUri: import_zod9.z.string()
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// src/v3/schemas/enqueueBuild.ts
|
|
508
|
-
var import_zod10 = require("zod");
|
|
509
|
-
var EnqueueBuildRequestSchema = import_zod10.z.object({
|
|
510
|
-
deploymentId: import_zod10.z.string(),
|
|
511
|
-
artifactKey: import_zod10.z.string(),
|
|
512
|
-
options: import_zod10.z.object({
|
|
513
|
-
skipPromotion: import_zod10.z.boolean().optional(),
|
|
514
|
-
configFilePath: import_zod10.z.string().optional()
|
|
515
|
-
})
|
|
516
|
-
});
|
|
517
|
-
var EnqueueBuildResponseSchema = import_zod10.z.object({
|
|
518
|
-
buildId: import_zod10.z.string()
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// src/v3/schemas/initialDeployment.ts
|
|
522
|
-
var import_zod11 = require("zod");
|
|
523
|
-
var TriggerInitialDeploymentRequestSchema = import_zod11.z.object({
|
|
524
|
-
environment: import_zod11.z.enum(["prod", "staging", "preview"])
|
|
525
|
-
});
|
|
526
|
-
var TriggerInitialDeploymentResponseSchema = import_zod11.z.object({
|
|
527
|
-
ok: import_zod11.z.boolean()
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
// src/v3/schemas/privateLink.ts
|
|
531
|
-
var import_zod12 = require("zod");
|
|
532
|
-
var PrivateLinkConnectionStatus = import_zod12.z.enum([
|
|
533
|
-
"PENDING",
|
|
534
|
-
"PROVISIONING",
|
|
535
|
-
"ACTIVE",
|
|
536
|
-
"ERROR",
|
|
537
|
-
"DELETING"
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/v3/schemas/initialDeployment.ts
|
|
436
|
+
const TriggerInitialDeploymentRequestSchema = zod.z.object({
|
|
437
|
+
environment: zod.z.enum([
|
|
438
|
+
"prod",
|
|
439
|
+
"staging",
|
|
440
|
+
"preview"
|
|
441
|
+
]),
|
|
442
|
+
branch: zod.z.string().min(1).max(255).optional()
|
|
443
|
+
});
|
|
444
|
+
const TriggerInitialDeploymentResponseSchema = zod.z.object({ ok: zod.z.boolean() });
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/v3/schemas/privateLink.ts
|
|
447
|
+
const PrivateLinkConnectionStatus = zod.z.enum([
|
|
448
|
+
"PENDING",
|
|
449
|
+
"PROVISIONING",
|
|
450
|
+
"ACTIVE",
|
|
451
|
+
"ERROR",
|
|
452
|
+
"DELETING"
|
|
538
453
|
]);
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
var ApplyPromoCodeBodySchema = import_zod13.z.object({
|
|
591
|
-
code: import_zod13.z.string(),
|
|
592
|
-
userId: import_zod13.z.string()
|
|
593
|
-
});
|
|
594
|
-
var ApplyPromoCodeResult = import_zod13.z.object({
|
|
595
|
-
applied: import_zod13.z.boolean(),
|
|
596
|
-
amountInCents: import_zod13.z.number().optional(),
|
|
597
|
-
expiresAt: import_zod13.z.string().datetime().nullable().optional(),
|
|
598
|
-
// Present when applied is false, e.g. "already_redeemed" or "invalid".
|
|
599
|
-
reason: import_zod13.z.string().optional()
|
|
600
|
-
});
|
|
601
|
-
var PromoCreditsResult = import_zod13.z.object({
|
|
602
|
-
promoCredits: import_zod13.z.object({
|
|
603
|
-
grantedCents: import_zod13.z.number(),
|
|
604
|
-
remainingCents: import_zod13.z.number(),
|
|
605
|
-
expiresAt: import_zod13.z.string().datetime().nullable()
|
|
606
|
-
}).nullable()
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
// src/v3/client/index.ts
|
|
454
|
+
const PrivateLinkConnection = zod.z.object({
|
|
455
|
+
id: zod.z.string(),
|
|
456
|
+
friendlyId: zod.z.string(),
|
|
457
|
+
name: zod.z.string(),
|
|
458
|
+
organizationId: zod.z.string(),
|
|
459
|
+
endpointServiceName: zod.z.string(),
|
|
460
|
+
targetRegion: zod.z.string(),
|
|
461
|
+
status: PrivateLinkConnectionStatus,
|
|
462
|
+
statusMessage: zod.z.string().nullable(),
|
|
463
|
+
endpointDnsName: zod.z.string().nullable(),
|
|
464
|
+
endpointIps: zod.z.array(zod.z.string()).nullable(),
|
|
465
|
+
provisionedAt: zod.z.string().nullable(),
|
|
466
|
+
createdAt: zod.z.string(),
|
|
467
|
+
updatedAt: zod.z.string()
|
|
468
|
+
});
|
|
469
|
+
const PrivateLinkConnectionList = zod.z.object({ connections: zod.z.array(PrivateLinkConnection) });
|
|
470
|
+
const CreatePrivateLinkConnectionBody = zod.z.object({
|
|
471
|
+
name: zod.z.string().min(1).max(100).regex(/^[a-zA-Z][a-zA-Z0-9 _-]*$/, "Must start with a letter and contain only letters, numbers, spaces, hyphens, or underscores"),
|
|
472
|
+
endpointServiceName: zod.z.string().regex(/^com\.amazonaws\.vpce\..+\.vpce-svc-.+$/, "Must be a valid VPC Endpoint Service name (com.amazonaws.vpce.<region>.vpce-svc-*)"),
|
|
473
|
+
targetRegion: zod.z.string().regex(/^[a-z]{2}-[a-z]+-\d+$/, "Must be a valid AWS region")
|
|
474
|
+
});
|
|
475
|
+
const DeletePrivateLinkResult = zod.z.object({ success: zod.z.boolean() });
|
|
476
|
+
const PrivateLinkRegionsResult = zod.z.object({
|
|
477
|
+
availableRegions: zod.z.array(zod.z.string()),
|
|
478
|
+
activeRegions: zod.z.array(zod.z.string())
|
|
479
|
+
});
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/v3/schemas/promoCodes.ts
|
|
482
|
+
const ValidatePromoCodeBodySchema = zod.z.object({ code: zod.z.string() });
|
|
483
|
+
const ValidatePromoCodeResult = zod.z.object({
|
|
484
|
+
valid: zod.z.boolean(),
|
|
485
|
+
amountInCents: zod.z.number().optional(),
|
|
486
|
+
expiresAt: zod.z.string().datetime().nullable().optional()
|
|
487
|
+
});
|
|
488
|
+
const ApplyPromoCodeBodySchema = zod.z.object({
|
|
489
|
+
code: zod.z.string(),
|
|
490
|
+
userId: zod.z.string()
|
|
491
|
+
});
|
|
492
|
+
const ApplyPromoCodeResult = zod.z.object({
|
|
493
|
+
applied: zod.z.boolean(),
|
|
494
|
+
amountInCents: zod.z.number().optional(),
|
|
495
|
+
expiresAt: zod.z.string().datetime().nullable().optional(),
|
|
496
|
+
reason: zod.z.string().optional()
|
|
497
|
+
});
|
|
498
|
+
const PromoCreditsResult = zod.z.object({ promoCredits: zod.z.object({
|
|
499
|
+
grantedCents: zod.z.number(),
|
|
500
|
+
remainingCents: zod.z.number(),
|
|
501
|
+
expiresAt: zod.z.string().datetime().nullable()
|
|
502
|
+
}).nullable() });
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/v3/client/index.ts
|
|
610
505
|
var BillingClient = class {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
);
|
|
797
|
-
}
|
|
798
|
-
async getPrivateLinkRegions(orgId) {
|
|
799
|
-
return await this.fetch(
|
|
800
|
-
`/api/v1/orgs/${orgId}/private-connections/regions`,
|
|
801
|
-
PrivateLinkRegionsResult
|
|
802
|
-
);
|
|
803
|
-
}
|
|
804
|
-
async triggerInitialDeployment(projectId, body) {
|
|
805
|
-
return await this.fetch(
|
|
806
|
-
`/api/v1/projects/${projectId}/initial-deployment`,
|
|
807
|
-
TriggerInitialDeploymentResponseSchema,
|
|
808
|
-
{
|
|
809
|
-
method: "POST",
|
|
810
|
-
headers: {
|
|
811
|
-
"Content-Type": "application/json"
|
|
812
|
-
},
|
|
813
|
-
body: JSON.stringify(body)
|
|
814
|
-
}
|
|
815
|
-
);
|
|
816
|
-
}
|
|
817
|
-
async fetch(path, schema, requestInit) {
|
|
818
|
-
const response = await fetch(`${this.config.url}${path}`, {
|
|
819
|
-
...requestInit,
|
|
820
|
-
headers: {
|
|
821
|
-
...requestInit == null ? void 0 : requestInit.headers,
|
|
822
|
-
Authorization: `Bearer ${this.config.apiKey}`
|
|
823
|
-
}
|
|
824
|
-
});
|
|
825
|
-
if (!response.ok) {
|
|
826
|
-
let parsedError;
|
|
827
|
-
try {
|
|
828
|
-
parsedError = ErrorSchema.parse(await response.json());
|
|
829
|
-
} catch {
|
|
830
|
-
parsedError = { error: `http_${response.status}` };
|
|
831
|
-
}
|
|
832
|
-
return {
|
|
833
|
-
success: false,
|
|
834
|
-
...parsedError
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
const json = await response.json();
|
|
838
|
-
const parsed = schema.parse(json);
|
|
839
|
-
return {
|
|
840
|
-
success: true,
|
|
841
|
-
...parsed
|
|
842
|
-
};
|
|
843
|
-
}
|
|
506
|
+
constructor(config) {
|
|
507
|
+
this.config = config;
|
|
508
|
+
}
|
|
509
|
+
async plans() {
|
|
510
|
+
return await this.fetch(`/api/v1/plans/v3`, PlansResult);
|
|
511
|
+
}
|
|
512
|
+
async currentPlan(orgId) {
|
|
513
|
+
return await this.fetch(`/api/v1/orgs/${orgId}`, CurrentPlan);
|
|
514
|
+
}
|
|
515
|
+
async usage(orgId, params) {
|
|
516
|
+
const search = objectToSearchParams(params);
|
|
517
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage?${search?.toString()}`, UsageResult);
|
|
518
|
+
}
|
|
519
|
+
async usageSeries(orgId, params) {
|
|
520
|
+
const search = objectToSearchParams(params);
|
|
521
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage/series?${search?.toString()}`, UsageSeriesResult);
|
|
522
|
+
}
|
|
523
|
+
async setPlan(orgId, body) {
|
|
524
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription`, SubscribeResultSchema, {
|
|
525
|
+
method: "POST",
|
|
526
|
+
headers: { "Content-Type": "application/json" },
|
|
527
|
+
body: JSON.stringify(body)
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
async cancelSubscription(orgId) {
|
|
531
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription/cancel`, CancelSubscriptionResponse, { method: "POST" });
|
|
532
|
+
}
|
|
533
|
+
async setAddOn(orgId, body) {
|
|
534
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription/addon`, SetAddOnResult, {
|
|
535
|
+
method: "POST",
|
|
536
|
+
headers: { "Content-Type": "application/json" },
|
|
537
|
+
body: JSON.stringify(body)
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
async validatePromoCode(code) {
|
|
541
|
+
return await this.fetch(`/api/v1/promo-codes/validate`, ValidatePromoCodeResult, {
|
|
542
|
+
method: "POST",
|
|
543
|
+
headers: { "Content-Type": "application/json" },
|
|
544
|
+
body: JSON.stringify({ code })
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async applyPromoCode(orgId, body) {
|
|
548
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/promo/apply`, ApplyPromoCodeResult, {
|
|
549
|
+
method: "POST",
|
|
550
|
+
headers: { "Content-Type": "application/json" },
|
|
551
|
+
body: JSON.stringify(body)
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
async promoCredits(orgId) {
|
|
555
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/promo/credits`, PromoCreditsResult);
|
|
556
|
+
}
|
|
557
|
+
async createPortalSession(orgId, body) {
|
|
558
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription/portal`, CustomerPortalSchema, {
|
|
559
|
+
method: "POST",
|
|
560
|
+
headers: { "Content-Type": "application/json" },
|
|
561
|
+
body: JSON.stringify(body)
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
*
|
|
566
|
+
* @param event The data is in the body, not using a JWT
|
|
567
|
+
* @returns details about usage
|
|
568
|
+
*/
|
|
569
|
+
async reportInvocationUsage(event) {
|
|
570
|
+
return await this.fetch(`/api/v1/usage/ingest/invocation`, ReportInvocationUsageResult, {
|
|
571
|
+
method: "POST",
|
|
572
|
+
headers: { "Content-Type": "application/json" },
|
|
573
|
+
body: JSON.stringify(event)
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Generates registry credentials for a project. This is used to push images to a project's container repository.
|
|
578
|
+
*
|
|
579
|
+
* @param projectId The ID of the project
|
|
580
|
+
* @param region The region to generate credentials for
|
|
581
|
+
* @returns The registry credentials
|
|
582
|
+
*/
|
|
583
|
+
async generateRegistryCredentials(projectId, region) {
|
|
584
|
+
return await this.fetch(`/api/v1/projects/${projectId}/generate-registry-credentials`, RegistryCredentialsResponseSchema, {
|
|
585
|
+
method: "POST",
|
|
586
|
+
headers: { "Content-Type": "application/json" },
|
|
587
|
+
body: JSON.stringify({ region })
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Enqueues a build for a project deployment.
|
|
592
|
+
*
|
|
593
|
+
* @param projectId The ID of the project
|
|
594
|
+
* @param body The enqueue build request containing the deployment ID
|
|
595
|
+
* @returns The build ID
|
|
596
|
+
*/
|
|
597
|
+
async enqueueBuild(projectId, body) {
|
|
598
|
+
return await this.fetch(`/api/v1/projects/${projectId}/enqueue-build`, EnqueueBuildResponseSchema, {
|
|
599
|
+
method: "POST",
|
|
600
|
+
headers: { "Content-Type": "application/json" },
|
|
601
|
+
body: JSON.stringify(body)
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
*
|
|
606
|
+
* @param event The data is in the body, not using a JWT
|
|
607
|
+
* @returns details about usage
|
|
608
|
+
*/
|
|
609
|
+
async getEntitlement(orgId) {
|
|
610
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage/entitlement`, ReportUsageResult);
|
|
611
|
+
}
|
|
612
|
+
async getBillingAlerts(orgId) {
|
|
613
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-alerts`, BillingAlertsResult);
|
|
614
|
+
}
|
|
615
|
+
async updateBillingAlerts(orgId, body) {
|
|
616
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-alerts`, BillingAlertsResult, {
|
|
617
|
+
method: "POST",
|
|
618
|
+
headers: { "Content-Type": "application/json" },
|
|
619
|
+
body: JSON.stringify(body)
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
async getBillingLimit(orgId) {
|
|
623
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit`, BillingLimitResult);
|
|
624
|
+
}
|
|
625
|
+
async updateBillingLimit(orgId, body) {
|
|
626
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit`, BillingLimitResult, {
|
|
627
|
+
method: "PUT",
|
|
628
|
+
headers: { "Content-Type": "application/json" },
|
|
629
|
+
body: JSON.stringify(body)
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
async resolveBillingLimit(orgId, body) {
|
|
633
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit/resolve`, BillingLimitResult, {
|
|
634
|
+
method: "POST",
|
|
635
|
+
headers: { "Content-Type": "application/json" },
|
|
636
|
+
body: JSON.stringify(body)
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
async getActiveBillingLimits() {
|
|
640
|
+
return await this.fetch(`/api/v1/billing-limits/active`, BillingLimitsActiveResult);
|
|
641
|
+
}
|
|
642
|
+
async getPrivateLinks(orgId) {
|
|
643
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections`, PrivateLinkConnectionList);
|
|
644
|
+
}
|
|
645
|
+
async createPrivateLink(orgId, body) {
|
|
646
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections`, PrivateLinkConnection, {
|
|
647
|
+
method: "POST",
|
|
648
|
+
headers: { "Content-Type": "application/json" },
|
|
649
|
+
body: JSON.stringify(body)
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
async deletePrivateLink(orgId, connectionId) {
|
|
653
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections/${connectionId}`, DeletePrivateLinkResult, { method: "DELETE" });
|
|
654
|
+
}
|
|
655
|
+
async getPrivateLinkRegions(orgId) {
|
|
656
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections/regions`, PrivateLinkRegionsResult);
|
|
657
|
+
}
|
|
658
|
+
async triggerInitialDeployment(projectId, body) {
|
|
659
|
+
return await this.fetch(`/api/v1/projects/${projectId}/initial-deployment`, TriggerInitialDeploymentResponseSchema, {
|
|
660
|
+
method: "POST",
|
|
661
|
+
headers: { "Content-Type": "application/json" },
|
|
662
|
+
body: JSON.stringify(body)
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
async fetch(path, schema, requestInit) {
|
|
666
|
+
const response = await fetch(`${this.config.url}${path}`, {
|
|
667
|
+
...requestInit,
|
|
668
|
+
headers: {
|
|
669
|
+
...requestInit?.headers,
|
|
670
|
+
Authorization: `Bearer ${this.config.apiKey}`
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
if (!response.ok) {
|
|
674
|
+
let parsedError;
|
|
675
|
+
try {
|
|
676
|
+
parsedError = ErrorSchema.parse(await response.json());
|
|
677
|
+
} catch {
|
|
678
|
+
parsedError = { error: `http_${response.status}` };
|
|
679
|
+
}
|
|
680
|
+
return {
|
|
681
|
+
success: false,
|
|
682
|
+
...parsedError
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
const json = await response.json();
|
|
686
|
+
return {
|
|
687
|
+
success: true,
|
|
688
|
+
...schema.parse(json)
|
|
689
|
+
};
|
|
690
|
+
}
|
|
844
691
|
};
|
|
845
692
|
function objectToSearchParams(obj) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
return searchParams;
|
|
693
|
+
if (!obj) return void 0;
|
|
694
|
+
const searchParams = new URLSearchParams();
|
|
695
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
696
|
+
if (value === void 0) return;
|
|
697
|
+
if (Array.isArray(value)) {
|
|
698
|
+
const values = value.map((d) => {
|
|
699
|
+
if (d instanceof Date) return d.toISOString();
|
|
700
|
+
return d;
|
|
701
|
+
});
|
|
702
|
+
searchParams.append(key, values.join(","));
|
|
703
|
+
} else {
|
|
704
|
+
const v = value instanceof Date ? value.toISOString() : value;
|
|
705
|
+
searchParams.append(key, v.toString());
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
return searchParams;
|
|
865
709
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
function machineDefinition({
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
const centsPerSecond = cpu * centsPerVCpuSecond2 + memory * centsPerGbRamSecond2;
|
|
877
|
-
const centsPerMs = centsPerSecond / 1e3;
|
|
878
|
-
return {
|
|
879
|
-
code,
|
|
880
|
-
title,
|
|
881
|
-
cpu,
|
|
882
|
-
memory,
|
|
883
|
-
centsPerMs
|
|
884
|
-
};
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/v3/machineDefinition.ts
|
|
712
|
+
function machineDefinition({ code, title, cpu, memory, centsPerVCpuSecond, centsPerGbRamSecond }) {
|
|
713
|
+
return {
|
|
714
|
+
code,
|
|
715
|
+
title,
|
|
716
|
+
cpu,
|
|
717
|
+
memory,
|
|
718
|
+
centsPerMs: (cpu * centsPerVCpuSecond + memory * centsPerGbRamSecond) / 1e3
|
|
719
|
+
};
|
|
885
720
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region src/v3/machinePresets.ts
|
|
723
|
+
const centsPerVCpuSecond = Number(process.env.CENTS_PER_VCPU_SECOND ?? 0);
|
|
724
|
+
const centsPerGbRamSecond = Number(process.env.CENTS_PER_GB_RAM_SECOND ?? 0);
|
|
725
|
+
const machines = {
|
|
726
|
+
micro: machineDefinition({
|
|
727
|
+
code: "micro",
|
|
728
|
+
title: "Micro",
|
|
729
|
+
cpu: .25,
|
|
730
|
+
memory: .25,
|
|
731
|
+
centsPerVCpuSecond,
|
|
732
|
+
centsPerGbRamSecond
|
|
733
|
+
}),
|
|
734
|
+
"small-1x": machineDefinition({
|
|
735
|
+
code: "small-1x",
|
|
736
|
+
title: "Small 1x",
|
|
737
|
+
cpu: .5,
|
|
738
|
+
memory: .5,
|
|
739
|
+
centsPerVCpuSecond,
|
|
740
|
+
centsPerGbRamSecond
|
|
741
|
+
}),
|
|
742
|
+
"small-2x": machineDefinition({
|
|
743
|
+
code: "small-2x",
|
|
744
|
+
title: "Small 2x",
|
|
745
|
+
cpu: 1,
|
|
746
|
+
memory: 1,
|
|
747
|
+
centsPerVCpuSecond,
|
|
748
|
+
centsPerGbRamSecond
|
|
749
|
+
}),
|
|
750
|
+
"medium-1x": machineDefinition({
|
|
751
|
+
code: "medium-1x",
|
|
752
|
+
title: "Medium 1x",
|
|
753
|
+
cpu: 1,
|
|
754
|
+
memory: 2,
|
|
755
|
+
centsPerVCpuSecond,
|
|
756
|
+
centsPerGbRamSecond
|
|
757
|
+
}),
|
|
758
|
+
"medium-2x": machineDefinition({
|
|
759
|
+
code: "medium-2x",
|
|
760
|
+
title: "Medium 2x",
|
|
761
|
+
cpu: 2,
|
|
762
|
+
memory: 4,
|
|
763
|
+
centsPerVCpuSecond,
|
|
764
|
+
centsPerGbRamSecond
|
|
765
|
+
}),
|
|
766
|
+
"large-1x": machineDefinition({
|
|
767
|
+
code: "large-1x",
|
|
768
|
+
title: "Large 1x",
|
|
769
|
+
cpu: 4,
|
|
770
|
+
memory: 8,
|
|
771
|
+
centsPerVCpuSecond,
|
|
772
|
+
centsPerGbRamSecond
|
|
773
|
+
}),
|
|
774
|
+
"large-2x": machineDefinition({
|
|
775
|
+
code: "large-2x",
|
|
776
|
+
title: "Large 2x",
|
|
777
|
+
cpu: 8,
|
|
778
|
+
memory: 16,
|
|
779
|
+
centsPerVCpuSecond,
|
|
780
|
+
centsPerGbRamSecond
|
|
781
|
+
})
|
|
947
782
|
};
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
783
|
+
const defaultMachine = "small-1x";
|
|
784
|
+
//#endregion
|
|
785
|
+
exports.AddOn = AddOn;
|
|
786
|
+
exports.AddOnDefinition = AddOnDefinition;
|
|
787
|
+
exports.AddOns = AddOns;
|
|
788
|
+
exports.ApplyPromoCodeBodySchema = ApplyPromoCodeBodySchema;
|
|
789
|
+
exports.ApplyPromoCodeResult = ApplyPromoCodeResult;
|
|
790
|
+
exports.BillingAlertsResult = BillingAlertsResult;
|
|
791
|
+
exports.BillingClient = BillingClient;
|
|
792
|
+
exports.BillingLimitActiveOrg = BillingLimitActiveOrg;
|
|
793
|
+
exports.BillingLimitConfiguredCustom = BillingLimitConfiguredCustom;
|
|
794
|
+
exports.BillingLimitConfiguredNone = BillingLimitConfiguredNone;
|
|
795
|
+
exports.BillingLimitConfiguredPlan = BillingLimitConfiguredPlan;
|
|
796
|
+
exports.BillingLimitPendingResolveOrg = BillingLimitPendingResolveOrg;
|
|
797
|
+
exports.BillingLimitResult = BillingLimitResult;
|
|
798
|
+
exports.BillingLimitState = BillingLimitState;
|
|
799
|
+
exports.BillingLimitUnconfigured = BillingLimitUnconfigured;
|
|
800
|
+
exports.BillingLimitsActiveResult = BillingLimitsActiveResult;
|
|
801
|
+
exports.BillingLimitsPendingResolvesResult = BillingLimitsPendingResolvesResult;
|
|
802
|
+
exports.CancelSubscriptionResponse = CancelSubscriptionResponse;
|
|
803
|
+
exports.CreatePrivateLinkConnectionBody = CreatePrivateLinkConnectionBody;
|
|
804
|
+
exports.CurrentPlan = CurrentPlan;
|
|
805
|
+
exports.CustomerPortalRequestBodySchema = CustomerPortalRequestBodySchema;
|
|
806
|
+
exports.CustomerPortalSchema = CustomerPortalSchema;
|
|
807
|
+
exports.DeletePrivateLinkResult = DeletePrivateLinkResult;
|
|
808
|
+
exports.EnqueueBuildErrorCodeSchema = EnqueueBuildErrorCodeSchema;
|
|
809
|
+
exports.EnqueueBuildRequestSchema = EnqueueBuildRequestSchema;
|
|
810
|
+
exports.EnqueueBuildResponseSchema = EnqueueBuildResponseSchema;
|
|
811
|
+
exports.ErrorSchema = ErrorSchema;
|
|
812
|
+
exports.FreeConnectRequiredSchema = FreeConnectRequiredSchema;
|
|
813
|
+
exports.FreeConnectedSchema = FreeConnectedSchema;
|
|
814
|
+
exports.MAX_INVOCATION_COST_IN_CENTS = MAX_INVOCATION_COST_IN_CENTS;
|
|
815
|
+
exports.PlanDefinitionSchema = PlanDefinitionSchema;
|
|
816
|
+
exports.Plans = Plans;
|
|
817
|
+
exports.PlansResult = PlansResult;
|
|
818
|
+
exports.PrivateLinkConnection = PrivateLinkConnection;
|
|
819
|
+
exports.PrivateLinkConnectionList = PrivateLinkConnectionList;
|
|
820
|
+
exports.PrivateLinkConnectionStatus = PrivateLinkConnectionStatus;
|
|
821
|
+
exports.PrivateLinkRegionsResult = PrivateLinkRegionsResult;
|
|
822
|
+
exports.PromoCreditsResult = PromoCreditsResult;
|
|
823
|
+
exports.RegistryCredentialsResponseSchema = RegistryCredentialsResponseSchema;
|
|
824
|
+
exports.ReportComputeUsageEvent = ReportComputeUsageEvent;
|
|
825
|
+
exports.ReportInvocationUsageEvent = ReportInvocationUsageEvent;
|
|
826
|
+
exports.ReportInvocationUsageResult = ReportInvocationUsageResult;
|
|
827
|
+
exports.ReportUsagePlan = ReportUsagePlan;
|
|
828
|
+
exports.ReportUsageResult = ReportUsageResult;
|
|
829
|
+
exports.ResolveBillingLimitRequest = ResolveBillingLimitRequest;
|
|
830
|
+
exports.SetAddOnBody = SetAddOnBody;
|
|
831
|
+
exports.SetAddOnResult = SetAddOnResult;
|
|
832
|
+
exports.SetPlanBodySchema = SetPlanBodySchema;
|
|
833
|
+
exports.SubscribeResultSchema = SubscribeResultSchema;
|
|
834
|
+
exports.SubscriptionResult = SubscriptionResult;
|
|
835
|
+
exports.TriggerInitialDeploymentRequestSchema = TriggerInitialDeploymentRequestSchema;
|
|
836
|
+
exports.TriggerInitialDeploymentResponseSchema = TriggerInitialDeploymentResponseSchema;
|
|
837
|
+
exports.UpdateBillingAlertsRequest = UpdateBillingAlertsRequest;
|
|
838
|
+
exports.UpdateBillingLimitRequest = UpdateBillingLimitRequest;
|
|
839
|
+
exports.UsageParams = UsageParams;
|
|
840
|
+
exports.UsageResult = UsageResult;
|
|
841
|
+
exports.UsageSeriesParams = UsageSeriesParams;
|
|
842
|
+
exports.UsageSeriesResult = UsageSeriesResult;
|
|
843
|
+
exports.ValidatePromoCodeBodySchema = ValidatePromoCodeBodySchema;
|
|
844
|
+
exports.ValidatePromoCodeResult = ValidatePromoCodeResult;
|
|
845
|
+
exports.defaultMachine = defaultMachine;
|
|
846
|
+
exports.machineDefinition = machineDefinition;
|
|
847
|
+
exports.machines = machines;
|
|
848
|
+
exports.objectToSearchParams = objectToSearchParams;
|
|
849
|
+
|
|
1014
850
|
//# sourceMappingURL=index.cjs.map
|