@trigger.dev/platform 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +785 -994
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2509 -14837
- package/dist/index.d.ts +2509 -14837
- package/dist/index.js +722 -905
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,1014 +1,805 @@
|
|
|
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
|
+
const QueueSizeLimits = zod.z.object({
|
|
24
|
+
development: zod.z.number(),
|
|
25
|
+
deployed: zod.z.number()
|
|
26
|
+
});
|
|
27
|
+
const Limits = zod.z.object({
|
|
28
|
+
includedUsage: zod.z.number(),
|
|
29
|
+
concurrentRuns: EnvironmentBasedLimit,
|
|
30
|
+
teamMembers: ExceedableLimit,
|
|
31
|
+
schedules: ExceedableLimit,
|
|
32
|
+
logRetentionDays: ExceedableLimit,
|
|
33
|
+
queryPeriodDays: ExceedableLimit,
|
|
34
|
+
alerts: ExceedableLimit,
|
|
35
|
+
hasStagingEnvironment: zod.z.boolean(),
|
|
36
|
+
realtimeConcurrentConnections: ExceedableLimit,
|
|
37
|
+
branches: ExceedableLimit,
|
|
38
|
+
branchesDev: ExceedableLimit,
|
|
39
|
+
support: zod.z.enum(["community", "slack"]),
|
|
40
|
+
batchRateLimitConfig: BatchRateLimitConfig.optional(),
|
|
41
|
+
batchQueueConcurrencyConfig: BatchQueueConcurrencyConfig.optional(),
|
|
42
|
+
metricDashboards: ExceedableLimit,
|
|
43
|
+
metricWidgetsPerDashboard: ExceedableLimit,
|
|
44
|
+
agentMessages: ExceedableLimit.optional(),
|
|
45
|
+
agentWatchMaxHours: ExceedableLimit.optional(),
|
|
46
|
+
agentWatchers: ExceedableLimit.optional(),
|
|
47
|
+
queueSizeLimits: QueueSizeLimits.optional(),
|
|
48
|
+
hasPrivateNetworking: zod.z.boolean().optional(),
|
|
49
|
+
privateLinkConnectionLimit: zod.z.number().optional(),
|
|
50
|
+
hasSso: zod.z.boolean().optional(),
|
|
51
|
+
streamBasinRetention: zod.z.string().optional()
|
|
52
|
+
});
|
|
53
|
+
const commonMetadata = {
|
|
54
|
+
title: zod.z.string(),
|
|
55
|
+
code: zod.z.string()
|
|
9
56
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
57
|
+
const pricingLookup = {
|
|
58
|
+
tierPriceCode: zod.z.string(),
|
|
59
|
+
usagePriceCode: zod.z.string(),
|
|
60
|
+
usageCouponCode: zod.z.string().optional()
|
|
17
61
|
};
|
|
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
|
|
62
|
+
const FreePlanDefinition = zod.z.object({
|
|
63
|
+
...commonMetadata,
|
|
64
|
+
type: zod.z.literal("free"),
|
|
65
|
+
limits: Limits
|
|
66
|
+
});
|
|
67
|
+
const PaidPlanDefinition = zod.z.object({
|
|
68
|
+
...commonMetadata,
|
|
69
|
+
type: zod.z.literal("paid"),
|
|
70
|
+
tierPrice: zod.z.number(),
|
|
71
|
+
stripe: zod.z.object(pricingLookup),
|
|
72
|
+
limits: Limits
|
|
73
|
+
});
|
|
74
|
+
const EnterprisePlanDefinition = zod.z.object({
|
|
75
|
+
...commonMetadata,
|
|
76
|
+
type: zod.z.literal("enterprise"),
|
|
77
|
+
limits: Limits
|
|
78
|
+
});
|
|
79
|
+
const PlanDefinitionSchema = zod.z.discriminatedUnion("type", [
|
|
80
|
+
FreePlanDefinition,
|
|
81
|
+
PaidPlanDefinition,
|
|
82
|
+
EnterprisePlanDefinition
|
|
172
83
|
]);
|
|
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
|
|
84
|
+
const MachineDefinition = zod.z.object({
|
|
85
|
+
code: zod.z.string(),
|
|
86
|
+
title: zod.z.string(),
|
|
87
|
+
cpu: zod.z.number(),
|
|
88
|
+
memory: zod.z.number(),
|
|
89
|
+
centsPerMs: zod.z.number()
|
|
90
|
+
});
|
|
91
|
+
const Plans = zod.z.object({
|
|
92
|
+
free: FreePlanDefinition,
|
|
93
|
+
hobby: PaidPlanDefinition,
|
|
94
|
+
pro: PaidPlanDefinition,
|
|
95
|
+
enterprise: EnterprisePlanDefinition
|
|
96
|
+
});
|
|
97
|
+
/** The pricing per step of the add-on, e.g. $10 for 50 units */
|
|
98
|
+
const AddOnPricing = zod.z.object({
|
|
99
|
+
/** The step size - must purchase in multiples of this amount */
|
|
100
|
+
stepSize: zod.z.number(),
|
|
101
|
+
/** Price per step in cents */
|
|
102
|
+
centsPerStep: zod.z.number()
|
|
103
|
+
});
|
|
104
|
+
const PlansResult = zod.z.object({
|
|
105
|
+
plans: Plans,
|
|
106
|
+
usagePricing: zod.z.object({
|
|
107
|
+
centsPerRunInvocation: zod.z.number(),
|
|
108
|
+
machines: zod.z.record(zod.z.string(), MachineDefinition),
|
|
109
|
+
defaultMachine: zod.z.string()
|
|
110
|
+
}),
|
|
111
|
+
addOnPricing: zod.z.object({
|
|
112
|
+
concurrency: AddOnPricing,
|
|
113
|
+
branches: AddOnPricing,
|
|
114
|
+
seats: AddOnPricing,
|
|
115
|
+
schedules: AddOnPricing
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
const AddOnDefinition = zod.z.object({
|
|
119
|
+
code: zod.z.enum([
|
|
120
|
+
"concurrency",
|
|
121
|
+
"branches",
|
|
122
|
+
"seats",
|
|
123
|
+
"schedules"
|
|
124
|
+
]),
|
|
125
|
+
priceCode: zod.z.string(),
|
|
126
|
+
pricing: AddOnPricing
|
|
127
|
+
});
|
|
128
|
+
const AddOn = zod.z.object({
|
|
129
|
+
purchased: zod.z.number(),
|
|
130
|
+
quota: zod.z.number().optional()
|
|
131
|
+
});
|
|
132
|
+
const AddOns = zod.z.object({
|
|
133
|
+
concurrentRuns: AddOn.optional(),
|
|
134
|
+
branches: AddOn.optional(),
|
|
135
|
+
seats: AddOn.optional(),
|
|
136
|
+
schedules: AddOn.optional()
|
|
137
|
+
});
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/v3/schemas/subscription.ts
|
|
140
|
+
const FreeTierStatus = zod.z.enum([
|
|
141
|
+
"requires_connect",
|
|
142
|
+
"approved",
|
|
143
|
+
"rejected"
|
|
253
144
|
]);
|
|
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
|
-
|
|
145
|
+
const SubscriptionResult = zod.z.object({
|
|
146
|
+
freeTierStatus: FreeTierStatus,
|
|
147
|
+
isPaying: zod.z.boolean(),
|
|
148
|
+
showSelfServe: zod.z.boolean().default(true),
|
|
149
|
+
canceledAt: zod.z.string().optional(),
|
|
150
|
+
plan: PlanDefinitionSchema.optional(),
|
|
151
|
+
addOns: AddOns.optional()
|
|
152
|
+
});
|
|
153
|
+
const CurrentPlan = zod.z.object({
|
|
154
|
+
subscription: zod.z.any(),
|
|
155
|
+
v3Subscription: SubscriptionResult
|
|
156
|
+
});
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/v3/schemas/subscribe.ts
|
|
159
|
+
const SetPaidPlanBodySchema = zod.z.object({
|
|
160
|
+
type: zod.z.literal("paid"),
|
|
161
|
+
planCode: zod.z.string(),
|
|
162
|
+
userId: zod.z.string()
|
|
163
|
+
});
|
|
164
|
+
const SetFreePlanBodySchema = zod.z.object({
|
|
165
|
+
type: zod.z.literal("free"),
|
|
166
|
+
userId: zod.z.string()
|
|
167
|
+
});
|
|
168
|
+
const SetPlanBodySchema = zod.z.discriminatedUnion("type", [SetPaidPlanBodySchema, SetFreePlanBodySchema]);
|
|
169
|
+
const FreeConnectRequiredSchema = zod.z.object({
|
|
170
|
+
action: zod.z.literal("free_connect_required"),
|
|
171
|
+
connectUrl: zod.z.string().url()
|
|
172
|
+
});
|
|
173
|
+
const FreeConnectedSchema = zod.z.object({
|
|
174
|
+
action: zod.z.literal("free_connected"),
|
|
175
|
+
accepted: zod.z.boolean()
|
|
176
|
+
});
|
|
177
|
+
const UpdatedSubscriptionResultSchema = zod.z.object({
|
|
178
|
+
action: zod.z.literal("updated_subscription"),
|
|
179
|
+
subscription: zod.z.object({ planCode: zod.z.string() })
|
|
180
|
+
});
|
|
181
|
+
const CreateSubscriptionFlowStartSchema = zod.z.object({
|
|
182
|
+
action: zod.z.literal("create_subscription_flow_start"),
|
|
183
|
+
subscription: zod.z.object({ planCode: zod.z.string() }),
|
|
184
|
+
checkoutUrl: zod.z.string().url()
|
|
185
|
+
});
|
|
186
|
+
const CanceledSubscriptionResultSchema = zod.z.object({ action: zod.z.literal("canceled_subscription") });
|
|
187
|
+
const SubscribeResultSchema = zod.z.discriminatedUnion("action", [
|
|
188
|
+
FreeConnectRequiredSchema,
|
|
189
|
+
FreeConnectedSchema,
|
|
190
|
+
CreateSubscriptionFlowStartSchema,
|
|
191
|
+
UpdatedSubscriptionResultSchema,
|
|
192
|
+
CanceledSubscriptionResultSchema
|
|
284
193
|
]);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
194
|
+
const SetAddOnBody = zod.z.object({
|
|
195
|
+
type: zod.z.enum([
|
|
196
|
+
"concurrency",
|
|
197
|
+
"branches",
|
|
198
|
+
"seats",
|
|
199
|
+
"schedules"
|
|
200
|
+
]),
|
|
201
|
+
amount: zod.z.number()
|
|
202
|
+
});
|
|
203
|
+
const SetAddOnResult = zod.z.discriminatedUnion("result", [
|
|
204
|
+
zod.z.object({
|
|
205
|
+
result: zod.z.literal("error"),
|
|
206
|
+
error: zod.z.string()
|
|
207
|
+
}),
|
|
208
|
+
zod.z.object({
|
|
209
|
+
result: zod.z.literal("success"),
|
|
210
|
+
type: zod.z.string(),
|
|
211
|
+
amount: zod.z.number(),
|
|
212
|
+
subscription: zod.z.object({ id: zod.z.string() })
|
|
213
|
+
}),
|
|
214
|
+
zod.z.object({
|
|
215
|
+
result: zod.z.literal("max_quota_reached"),
|
|
216
|
+
type: zod.z.string(),
|
|
217
|
+
maxQuota: zod.z.number()
|
|
218
|
+
})
|
|
307
219
|
]);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
// src/v3/schemas/error.ts
|
|
319
|
-
var import_zod5 = require("zod");
|
|
320
|
-
var ErrorSchema = import_zod5.z.object({
|
|
321
|
-
error: import_zod5.z.string(),
|
|
322
|
-
code: import_zod5.z.string().optional()
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/v3/schemas/portal.ts
|
|
222
|
+
const CustomerPortalRequestBodySchema = zod.z.object({ returnUrl: zod.z.string() });
|
|
223
|
+
const CustomerPortalSchema = zod.z.object({ customerPortalUrl: zod.z.string().optional() });
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/v3/schemas/error.ts
|
|
226
|
+
const ErrorSchema = zod.z.object({
|
|
227
|
+
error: zod.z.string(),
|
|
228
|
+
code: zod.z.string().optional()
|
|
323
229
|
}).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
|
-
})
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/v3/schemas/usage.ts
|
|
232
|
+
const UsageParams = zod.z.object({
|
|
233
|
+
from: zod.z.coerce.date(),
|
|
234
|
+
to: zod.z.coerce.date()
|
|
235
|
+
});
|
|
236
|
+
const UsageResult = zod.z.object({ cents: zod.z.number() });
|
|
237
|
+
const Window = zod.z.enum([
|
|
238
|
+
"MINUTE",
|
|
239
|
+
"HOUR",
|
|
240
|
+
"DAY"
|
|
393
241
|
]);
|
|
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
|
-
|
|
242
|
+
const UsageSeriesParams = zod.z.object({
|
|
243
|
+
from: zod.z.coerce.date(),
|
|
244
|
+
to: zod.z.coerce.date(),
|
|
245
|
+
/** defaults to DAY */
|
|
246
|
+
window: Window.optional(),
|
|
247
|
+
timezone: zod.z.string().optional()
|
|
248
|
+
});
|
|
249
|
+
const UsageSeriesResult = zod.z.object({
|
|
250
|
+
from: zod.z.string(),
|
|
251
|
+
to: zod.z.string(),
|
|
252
|
+
window: Window.optional(),
|
|
253
|
+
data: zod.z.object({
|
|
254
|
+
value: zod.z.number(),
|
|
255
|
+
windowStart: zod.z.string(),
|
|
256
|
+
windowEnd: zod.z.string()
|
|
257
|
+
}).array()
|
|
258
|
+
});
|
|
259
|
+
const ReportComputeUsageEvent = zod.z.object({ durationMs: zod.z.number() });
|
|
260
|
+
const ReportUsagePlan = zod.z.object({
|
|
261
|
+
type: zod.z.string(),
|
|
262
|
+
code: zod.z.string(),
|
|
263
|
+
isPaying: zod.z.boolean()
|
|
264
|
+
});
|
|
265
|
+
const ReportUsageResult = zod.z.object({
|
|
266
|
+
hasAccess: zod.z.boolean(),
|
|
267
|
+
balance: zod.z.number().optional(),
|
|
268
|
+
usage: zod.z.number().optional(),
|
|
269
|
+
overage: zod.z.number().optional(),
|
|
270
|
+
plan: ReportUsagePlan.optional(),
|
|
271
|
+
limitState: zod.z.literal("grace").optional(),
|
|
272
|
+
reason: zod.z.enum(["free_tier_exceeded", "billing_limit"]).optional()
|
|
273
|
+
});
|
|
274
|
+
/** Upper bound for a single invocation base charge ($100). */
|
|
275
|
+
const MAX_INVOCATION_COST_IN_CENTS = 1e4;
|
|
276
|
+
const ReportInvocationUsageEvent = zod.z.object({
|
|
277
|
+
organizationId: zod.z.string().min(1).max(128),
|
|
278
|
+
costInCents: zod.z.number().finite().min(0).max(MAX_INVOCATION_COST_IN_CENTS),
|
|
279
|
+
additionalData: zod.z.record(zod.z.string(), zod.z.any()).optional()
|
|
280
|
+
});
|
|
281
|
+
const ReportInvocationUsageResult = zod.z.discriminatedUnion("success", [zod.z.object({ success: zod.z.literal(true) }), zod.z.object({
|
|
282
|
+
success: zod.z.literal(false),
|
|
283
|
+
error: zod.z.string()
|
|
284
|
+
})]);
|
|
285
|
+
const BillingAlertsResult = zod.z.object({
|
|
286
|
+
amount: zod.z.number(),
|
|
287
|
+
emails: zod.z.array(zod.z.string()),
|
|
288
|
+
alertLevels: zod.z.array(zod.z.number())
|
|
289
|
+
});
|
|
290
|
+
const UpdateBillingAlertsRequest = zod.z.object({
|
|
291
|
+
amount: zod.z.number().positive(),
|
|
292
|
+
emails: zod.z.array(zod.z.string()),
|
|
293
|
+
alertLevels: zod.z.array(zod.z.number())
|
|
294
|
+
});
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/v3/schemas/billingLimit.ts
|
|
297
|
+
const BillingLimitState = zod.z.discriminatedUnion("status", [
|
|
298
|
+
zod.z.object({ status: zod.z.literal("ok") }),
|
|
299
|
+
zod.z.object({
|
|
300
|
+
status: zod.z.literal("grace"),
|
|
301
|
+
hitAt: zod.z.string(),
|
|
302
|
+
graceEndsAt: zod.z.string()
|
|
303
|
+
}),
|
|
304
|
+
zod.z.object({
|
|
305
|
+
status: zod.z.literal("rejected"),
|
|
306
|
+
hitAt: zod.z.string(),
|
|
307
|
+
graceEndsAt: zod.z.string()
|
|
308
|
+
})
|
|
425
309
|
]);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
310
|
+
const billingLimitConfiguredFields = {
|
|
311
|
+
isConfigured: zod.z.literal(true),
|
|
312
|
+
cancelInProgressRuns: zod.z.boolean(),
|
|
313
|
+
limitState: BillingLimitState,
|
|
314
|
+
effectiveAmountCents: zod.z.number().int().nonnegative().nullable(),
|
|
315
|
+
gracePeriodMs: zod.z.number().int().nonnegative()
|
|
432
316
|
};
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
317
|
+
const BillingLimitUnconfigured = zod.z.object({
|
|
318
|
+
isConfigured: zod.z.literal(false),
|
|
319
|
+
gracePeriodMs: zod.z.number().int().nonnegative()
|
|
320
|
+
});
|
|
321
|
+
const BillingLimitConfiguredNone = zod.z.object({
|
|
322
|
+
...billingLimitConfiguredFields,
|
|
323
|
+
mode: zod.z.literal("none")
|
|
324
|
+
});
|
|
325
|
+
const BillingLimitConfiguredPlan = zod.z.object({
|
|
326
|
+
...billingLimitConfiguredFields,
|
|
327
|
+
mode: zod.z.literal("plan")
|
|
328
|
+
});
|
|
329
|
+
const BillingLimitConfiguredCustom = zod.z.object({
|
|
330
|
+
...billingLimitConfiguredFields,
|
|
331
|
+
mode: zod.z.literal("custom"),
|
|
332
|
+
amountCents: zod.z.number().int().positive()
|
|
333
|
+
});
|
|
334
|
+
const BillingLimitResult = zod.z.union([
|
|
335
|
+
BillingLimitUnconfigured,
|
|
336
|
+
BillingLimitConfiguredNone,
|
|
337
|
+
BillingLimitConfiguredPlan,
|
|
338
|
+
BillingLimitConfiguredCustom
|
|
455
339
|
]);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
340
|
+
const UpdateBillingLimitRequest = zod.z.discriminatedUnion("mode", [
|
|
341
|
+
zod.z.object({
|
|
342
|
+
mode: zod.z.literal("none"),
|
|
343
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
344
|
+
}),
|
|
345
|
+
zod.z.object({
|
|
346
|
+
mode: zod.z.literal("plan"),
|
|
347
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
348
|
+
}),
|
|
349
|
+
zod.z.object({
|
|
350
|
+
mode: zod.z.literal("custom"),
|
|
351
|
+
amountCents: zod.z.number().int().positive(),
|
|
352
|
+
cancelInProgressRuns: zod.z.boolean()
|
|
353
|
+
})
|
|
470
354
|
]);
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
355
|
+
const ResolveBillingLimitRequest = zod.z.discriminatedUnion("action", [zod.z.object({
|
|
356
|
+
action: zod.z.literal("increase"),
|
|
357
|
+
newAmountCents: zod.z.number().int().positive(),
|
|
358
|
+
resumeMode: zod.z.enum(["queue", "new_only"])
|
|
359
|
+
}), zod.z.object({
|
|
360
|
+
action: zod.z.literal("remove"),
|
|
361
|
+
resumeMode: zod.z.enum(["queue", "new_only"])
|
|
362
|
+
})]);
|
|
363
|
+
const BillingLimitActiveOrg = zod.z.object({
|
|
364
|
+
orgId: zod.z.string(),
|
|
365
|
+
limitState: zod.z.enum(["grace", "rejected"])
|
|
366
|
+
});
|
|
367
|
+
const BillingLimitsActiveResult = zod.z.object({ orgs: zod.z.array(BillingLimitActiveOrg) });
|
|
368
|
+
const BillingLimitPendingResolveOrg = zod.z.object({
|
|
369
|
+
organizationId: zod.z.string(),
|
|
370
|
+
resumeMode: zod.z.enum(["queue", "new_only"]),
|
|
371
|
+
resolvedAt: zod.z.string()
|
|
372
|
+
});
|
|
373
|
+
const BillingLimitsPendingResolvesResult = zod.z.object({ orgs: zod.z.array(BillingLimitPendingResolveOrg) });
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/v3/schemas/registryCredentials.ts
|
|
376
|
+
const RegistryCredentialsResponseSchema = zod.z.object({
|
|
377
|
+
username: zod.z.string(),
|
|
378
|
+
password: zod.z.string(),
|
|
379
|
+
expiresAt: zod.z.string().datetime(),
|
|
380
|
+
repositoryUri: zod.z.string()
|
|
381
|
+
});
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/v3/schemas/enqueueBuild.ts
|
|
384
|
+
const EnqueueBuildRequestSchema = zod.z.object({
|
|
385
|
+
deploymentId: zod.z.string(),
|
|
386
|
+
artifactKey: zod.z.string(),
|
|
387
|
+
options: zod.z.object({
|
|
388
|
+
skipPromotion: zod.z.boolean().optional(),
|
|
389
|
+
configFilePath: zod.z.string().optional(),
|
|
390
|
+
fromBundle: zod.z.boolean().optional()
|
|
391
|
+
})
|
|
392
|
+
});
|
|
393
|
+
const EnqueueBuildResponseSchema = zod.z.object({ buildId: zod.z.string() });
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/v3/schemas/initialDeployment.ts
|
|
396
|
+
const TriggerInitialDeploymentRequestSchema = zod.z.object({
|
|
397
|
+
environment: zod.z.enum([
|
|
398
|
+
"prod",
|
|
399
|
+
"staging",
|
|
400
|
+
"preview"
|
|
401
|
+
]),
|
|
402
|
+
branch: zod.z.string().min(1).max(255).optional()
|
|
403
|
+
});
|
|
404
|
+
const TriggerInitialDeploymentResponseSchema = zod.z.object({ ok: zod.z.boolean() });
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/v3/schemas/privateLink.ts
|
|
407
|
+
const PrivateLinkConnectionStatus = zod.z.enum([
|
|
408
|
+
"PENDING",
|
|
409
|
+
"PROVISIONING",
|
|
410
|
+
"ACTIVE",
|
|
411
|
+
"ERROR",
|
|
412
|
+
"DELETING"
|
|
481
413
|
]);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
"PENDING",
|
|
534
|
-
"PROVISIONING",
|
|
535
|
-
"ACTIVE",
|
|
536
|
-
"ERROR",
|
|
537
|
-
"DELETING"
|
|
538
|
-
]);
|
|
539
|
-
var PrivateLinkConnection = import_zod12.z.object({
|
|
540
|
-
id: import_zod12.z.string(),
|
|
541
|
-
friendlyId: import_zod12.z.string(),
|
|
542
|
-
name: import_zod12.z.string(),
|
|
543
|
-
organizationId: import_zod12.z.string(),
|
|
544
|
-
endpointServiceName: import_zod12.z.string(),
|
|
545
|
-
targetRegion: import_zod12.z.string(),
|
|
546
|
-
status: PrivateLinkConnectionStatus,
|
|
547
|
-
statusMessage: import_zod12.z.string().nullable(),
|
|
548
|
-
endpointDnsName: import_zod12.z.string().nullable(),
|
|
549
|
-
endpointIps: import_zod12.z.array(import_zod12.z.string()).nullable(),
|
|
550
|
-
provisionedAt: import_zod12.z.string().nullable(),
|
|
551
|
-
createdAt: import_zod12.z.string(),
|
|
552
|
-
updatedAt: import_zod12.z.string()
|
|
553
|
-
});
|
|
554
|
-
var PrivateLinkConnectionList = import_zod12.z.object({
|
|
555
|
-
connections: import_zod12.z.array(PrivateLinkConnection)
|
|
556
|
-
});
|
|
557
|
-
var CreatePrivateLinkConnectionBody = import_zod12.z.object({
|
|
558
|
-
name: import_zod12.z.string().min(1).max(100).regex(
|
|
559
|
-
/^[a-zA-Z][a-zA-Z0-9 _-]*$/,
|
|
560
|
-
"Must start with a letter and contain only letters, numbers, spaces, hyphens, or underscores"
|
|
561
|
-
),
|
|
562
|
-
endpointServiceName: import_zod12.z.string().regex(
|
|
563
|
-
/^com\.amazonaws\.vpce\..+\.vpce-svc-.+$/,
|
|
564
|
-
"Must be a valid VPC Endpoint Service name (com.amazonaws.vpce.<region>.vpce-svc-*)"
|
|
565
|
-
),
|
|
566
|
-
// Region support is dynamic (driven by the billing service's env vars), so
|
|
567
|
-
// this validates the AWS region *format* only; the authoritative check that
|
|
568
|
-
// the region is actually configured happens server-side against the set of
|
|
569
|
-
// regions discovered from env vars.
|
|
570
|
-
targetRegion: import_zod12.z.string().regex(/^[a-z]{2}-[a-z]+-\d+$/, "Must be a valid AWS region")
|
|
571
|
-
});
|
|
572
|
-
var DeletePrivateLinkResult = import_zod12.z.object({
|
|
573
|
-
success: import_zod12.z.boolean()
|
|
574
|
-
});
|
|
575
|
-
var PrivateLinkRegionsResult = import_zod12.z.object({
|
|
576
|
-
availableRegions: import_zod12.z.array(import_zod12.z.string()),
|
|
577
|
-
activeRegions: import_zod12.z.array(import_zod12.z.string())
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
// src/v3/schemas/promoCodes.ts
|
|
581
|
-
var import_zod13 = require("zod");
|
|
582
|
-
var ValidatePromoCodeBodySchema = import_zod13.z.object({
|
|
583
|
-
code: import_zod13.z.string()
|
|
584
|
-
});
|
|
585
|
-
var ValidatePromoCodeResult = import_zod13.z.object({
|
|
586
|
-
valid: import_zod13.z.boolean(),
|
|
587
|
-
amountInCents: import_zod13.z.number().optional(),
|
|
588
|
-
expiresAt: import_zod13.z.string().datetime().nullable().optional()
|
|
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
|
|
414
|
+
const PrivateLinkConnection = zod.z.object({
|
|
415
|
+
id: zod.z.string(),
|
|
416
|
+
friendlyId: zod.z.string(),
|
|
417
|
+
name: zod.z.string(),
|
|
418
|
+
organizationId: zod.z.string(),
|
|
419
|
+
endpointServiceName: zod.z.string(),
|
|
420
|
+
targetRegion: zod.z.string(),
|
|
421
|
+
status: PrivateLinkConnectionStatus,
|
|
422
|
+
statusMessage: zod.z.string().nullable(),
|
|
423
|
+
endpointDnsName: zod.z.string().nullable(),
|
|
424
|
+
endpointIps: zod.z.array(zod.z.string()).nullable(),
|
|
425
|
+
provisionedAt: zod.z.string().nullable(),
|
|
426
|
+
createdAt: zod.z.string(),
|
|
427
|
+
updatedAt: zod.z.string()
|
|
428
|
+
});
|
|
429
|
+
const PrivateLinkConnectionList = zod.z.object({ connections: zod.z.array(PrivateLinkConnection) });
|
|
430
|
+
const CreatePrivateLinkConnectionBody = zod.z.object({
|
|
431
|
+
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"),
|
|
432
|
+
endpointServiceName: zod.z.string().regex(/^com\.amazonaws\.vpce\..+\.vpce-svc-.+$/, "Must be a valid VPC Endpoint Service name (com.amazonaws.vpce.<region>.vpce-svc-*)"),
|
|
433
|
+
targetRegion: zod.z.string().regex(/^[a-z]{2}-[a-z]+-\d+$/, "Must be a valid AWS region")
|
|
434
|
+
});
|
|
435
|
+
const DeletePrivateLinkResult = zod.z.object({ success: zod.z.boolean() });
|
|
436
|
+
const PrivateLinkRegionsResult = zod.z.object({
|
|
437
|
+
availableRegions: zod.z.array(zod.z.string()),
|
|
438
|
+
activeRegions: zod.z.array(zod.z.string())
|
|
439
|
+
});
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/v3/schemas/promoCodes.ts
|
|
442
|
+
const ValidatePromoCodeBodySchema = zod.z.object({ code: zod.z.string() });
|
|
443
|
+
const ValidatePromoCodeResult = zod.z.object({
|
|
444
|
+
valid: zod.z.boolean(),
|
|
445
|
+
amountInCents: zod.z.number().optional(),
|
|
446
|
+
expiresAt: zod.z.string().datetime().nullable().optional()
|
|
447
|
+
});
|
|
448
|
+
const ApplyPromoCodeBodySchema = zod.z.object({
|
|
449
|
+
code: zod.z.string(),
|
|
450
|
+
userId: zod.z.string()
|
|
451
|
+
});
|
|
452
|
+
const ApplyPromoCodeResult = zod.z.object({
|
|
453
|
+
applied: zod.z.boolean(),
|
|
454
|
+
amountInCents: zod.z.number().optional(),
|
|
455
|
+
expiresAt: zod.z.string().datetime().nullable().optional(),
|
|
456
|
+
reason: zod.z.string().optional()
|
|
457
|
+
});
|
|
458
|
+
const PromoCreditsResult = zod.z.object({ promoCredits: zod.z.object({
|
|
459
|
+
grantedCents: zod.z.number(),
|
|
460
|
+
remainingCents: zod.z.number(),
|
|
461
|
+
expiresAt: zod.z.string().datetime().nullable()
|
|
462
|
+
}).nullable() });
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/v3/client/index.ts
|
|
610
465
|
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
|
-
method: "DELETE"
|
|
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
|
-
}
|
|
466
|
+
constructor(config) {
|
|
467
|
+
this.config = config;
|
|
468
|
+
}
|
|
469
|
+
async plans() {
|
|
470
|
+
return await this.fetch(`/api/v1/plans/v3`, PlansResult);
|
|
471
|
+
}
|
|
472
|
+
async currentPlan(orgId) {
|
|
473
|
+
return await this.fetch(`/api/v1/orgs/${orgId}`, CurrentPlan);
|
|
474
|
+
}
|
|
475
|
+
async usage(orgId, params) {
|
|
476
|
+
const search = objectToSearchParams(params);
|
|
477
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage?${search?.toString()}`, UsageResult);
|
|
478
|
+
}
|
|
479
|
+
async usageSeries(orgId, params) {
|
|
480
|
+
const search = objectToSearchParams(params);
|
|
481
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage/series?${search?.toString()}`, UsageSeriesResult);
|
|
482
|
+
}
|
|
483
|
+
async setPlan(orgId, body) {
|
|
484
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription`, SubscribeResultSchema, {
|
|
485
|
+
method: "POST",
|
|
486
|
+
headers: { "Content-Type": "application/json" },
|
|
487
|
+
body: JSON.stringify(body)
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
async setAddOn(orgId, body) {
|
|
491
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription/addon`, SetAddOnResult, {
|
|
492
|
+
method: "POST",
|
|
493
|
+
headers: { "Content-Type": "application/json" },
|
|
494
|
+
body: JSON.stringify(body)
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
async validatePromoCode(code) {
|
|
498
|
+
return await this.fetch(`/api/v1/promo-codes/validate`, ValidatePromoCodeResult, {
|
|
499
|
+
method: "POST",
|
|
500
|
+
headers: { "Content-Type": "application/json" },
|
|
501
|
+
body: JSON.stringify({ code })
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
async applyPromoCode(orgId, body) {
|
|
505
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/promo/apply`, ApplyPromoCodeResult, {
|
|
506
|
+
method: "POST",
|
|
507
|
+
headers: { "Content-Type": "application/json" },
|
|
508
|
+
body: JSON.stringify(body)
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
async promoCredits(orgId) {
|
|
512
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/promo/credits`, PromoCreditsResult);
|
|
513
|
+
}
|
|
514
|
+
async createPortalSession(orgId, body) {
|
|
515
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/v3/subscription/portal`, CustomerPortalSchema, {
|
|
516
|
+
method: "POST",
|
|
517
|
+
headers: { "Content-Type": "application/json" },
|
|
518
|
+
body: JSON.stringify(body)
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
*
|
|
523
|
+
* @param event The data is in the body, not using a JWT
|
|
524
|
+
* @returns details about usage
|
|
525
|
+
*/
|
|
526
|
+
async reportInvocationUsage(event) {
|
|
527
|
+
return await this.fetch(`/api/v1/usage/ingest/invocation`, ReportInvocationUsageResult, {
|
|
528
|
+
method: "POST",
|
|
529
|
+
headers: { "Content-Type": "application/json" },
|
|
530
|
+
body: JSON.stringify(event)
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Generates registry credentials for a project. This is used to push images to a project's container repository.
|
|
535
|
+
*
|
|
536
|
+
* @param projectId The ID of the project
|
|
537
|
+
* @param region The region to generate credentials for
|
|
538
|
+
* @returns The registry credentials
|
|
539
|
+
*/
|
|
540
|
+
async generateRegistryCredentials(projectId, region) {
|
|
541
|
+
return await this.fetch(`/api/v1/projects/${projectId}/generate-registry-credentials`, RegistryCredentialsResponseSchema, {
|
|
542
|
+
method: "POST",
|
|
543
|
+
headers: { "Content-Type": "application/json" },
|
|
544
|
+
body: JSON.stringify({ region })
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Enqueues a build for a project deployment.
|
|
549
|
+
*
|
|
550
|
+
* @param projectId The ID of the project
|
|
551
|
+
* @param body The enqueue build request containing the deployment ID
|
|
552
|
+
* @returns The build ID
|
|
553
|
+
*/
|
|
554
|
+
async enqueueBuild(projectId, body) {
|
|
555
|
+
return await this.fetch(`/api/v1/projects/${projectId}/enqueue-build`, EnqueueBuildResponseSchema, {
|
|
556
|
+
method: "POST",
|
|
557
|
+
headers: { "Content-Type": "application/json" },
|
|
558
|
+
body: JSON.stringify(body)
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
*
|
|
563
|
+
* @param event The data is in the body, not using a JWT
|
|
564
|
+
* @returns details about usage
|
|
565
|
+
*/
|
|
566
|
+
async getEntitlement(orgId) {
|
|
567
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/usage/entitlement`, ReportUsageResult);
|
|
568
|
+
}
|
|
569
|
+
async getBillingAlerts(orgId) {
|
|
570
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-alerts`, BillingAlertsResult);
|
|
571
|
+
}
|
|
572
|
+
async updateBillingAlerts(orgId, body) {
|
|
573
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-alerts`, BillingAlertsResult, {
|
|
574
|
+
method: "POST",
|
|
575
|
+
headers: { "Content-Type": "application/json" },
|
|
576
|
+
body: JSON.stringify(body)
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
async getBillingLimit(orgId) {
|
|
580
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit`, BillingLimitResult);
|
|
581
|
+
}
|
|
582
|
+
async updateBillingLimit(orgId, body) {
|
|
583
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit`, BillingLimitResult, {
|
|
584
|
+
method: "PUT",
|
|
585
|
+
headers: { "Content-Type": "application/json" },
|
|
586
|
+
body: JSON.stringify(body)
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
async resolveBillingLimit(orgId, body) {
|
|
590
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/billing-limit/resolve`, BillingLimitResult, {
|
|
591
|
+
method: "POST",
|
|
592
|
+
headers: { "Content-Type": "application/json" },
|
|
593
|
+
body: JSON.stringify(body)
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
async getActiveBillingLimits() {
|
|
597
|
+
return await this.fetch(`/api/v1/billing-limits/active`, BillingLimitsActiveResult);
|
|
598
|
+
}
|
|
599
|
+
async getPrivateLinks(orgId) {
|
|
600
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections`, PrivateLinkConnectionList);
|
|
601
|
+
}
|
|
602
|
+
async createPrivateLink(orgId, body) {
|
|
603
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections`, PrivateLinkConnection, {
|
|
604
|
+
method: "POST",
|
|
605
|
+
headers: { "Content-Type": "application/json" },
|
|
606
|
+
body: JSON.stringify(body)
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async deletePrivateLink(orgId, connectionId) {
|
|
610
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections/${connectionId}`, DeletePrivateLinkResult, { method: "DELETE" });
|
|
611
|
+
}
|
|
612
|
+
async getPrivateLinkRegions(orgId) {
|
|
613
|
+
return await this.fetch(`/api/v1/orgs/${orgId}/private-connections/regions`, PrivateLinkRegionsResult);
|
|
614
|
+
}
|
|
615
|
+
async triggerInitialDeployment(projectId, body) {
|
|
616
|
+
return await this.fetch(`/api/v1/projects/${projectId}/initial-deployment`, TriggerInitialDeploymentResponseSchema, {
|
|
617
|
+
method: "POST",
|
|
618
|
+
headers: { "Content-Type": "application/json" },
|
|
619
|
+
body: JSON.stringify(body)
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
async fetch(path, schema, requestInit) {
|
|
623
|
+
const response = await fetch(`${this.config.url}${path}`, {
|
|
624
|
+
...requestInit,
|
|
625
|
+
headers: {
|
|
626
|
+
...requestInit?.headers,
|
|
627
|
+
Authorization: `Bearer ${this.config.apiKey}`
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
if (!response.ok) {
|
|
631
|
+
let parsedError;
|
|
632
|
+
try {
|
|
633
|
+
parsedError = ErrorSchema.parse(await response.json());
|
|
634
|
+
} catch {
|
|
635
|
+
parsedError = { error: `http_${response.status}` };
|
|
636
|
+
}
|
|
637
|
+
return {
|
|
638
|
+
success: false,
|
|
639
|
+
...parsedError
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
const json = await response.json();
|
|
643
|
+
return {
|
|
644
|
+
success: true,
|
|
645
|
+
...schema.parse(json)
|
|
646
|
+
};
|
|
647
|
+
}
|
|
844
648
|
};
|
|
845
649
|
function objectToSearchParams(obj) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
return searchParams;
|
|
650
|
+
if (!obj) return void 0;
|
|
651
|
+
const searchParams = new URLSearchParams();
|
|
652
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
653
|
+
if (value === void 0) return;
|
|
654
|
+
if (Array.isArray(value)) {
|
|
655
|
+
const values = value.map((d) => {
|
|
656
|
+
if (d instanceof Date) return d.toISOString();
|
|
657
|
+
return d;
|
|
658
|
+
});
|
|
659
|
+
searchParams.append(key, values.join(","));
|
|
660
|
+
} else {
|
|
661
|
+
const v = value instanceof Date ? value.toISOString() : value;
|
|
662
|
+
searchParams.append(key, v.toString());
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
return searchParams;
|
|
865
666
|
}
|
|
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
|
-
};
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/v3/machineDefinition.ts
|
|
669
|
+
function machineDefinition({ code, title, cpu, memory, centsPerVCpuSecond, centsPerGbRamSecond }) {
|
|
670
|
+
return {
|
|
671
|
+
code,
|
|
672
|
+
title,
|
|
673
|
+
cpu,
|
|
674
|
+
memory,
|
|
675
|
+
centsPerMs: (cpu * centsPerVCpuSecond + memory * centsPerGbRamSecond) / 1e3
|
|
676
|
+
};
|
|
885
677
|
}
|
|
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
|
-
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/v3/machinePresets.ts
|
|
680
|
+
const centsPerVCpuSecond = Number(process.env.CENTS_PER_VCPU_SECOND ?? 0);
|
|
681
|
+
const centsPerGbRamSecond = Number(process.env.CENTS_PER_GB_RAM_SECOND ?? 0);
|
|
682
|
+
const machines = {
|
|
683
|
+
micro: machineDefinition({
|
|
684
|
+
code: "micro",
|
|
685
|
+
title: "Micro",
|
|
686
|
+
cpu: .25,
|
|
687
|
+
memory: .25,
|
|
688
|
+
centsPerVCpuSecond,
|
|
689
|
+
centsPerGbRamSecond
|
|
690
|
+
}),
|
|
691
|
+
"small-1x": machineDefinition({
|
|
692
|
+
code: "small-1x",
|
|
693
|
+
title: "Small 1x",
|
|
694
|
+
cpu: .5,
|
|
695
|
+
memory: .5,
|
|
696
|
+
centsPerVCpuSecond,
|
|
697
|
+
centsPerGbRamSecond
|
|
698
|
+
}),
|
|
699
|
+
"small-2x": machineDefinition({
|
|
700
|
+
code: "small-2x",
|
|
701
|
+
title: "Small 2x",
|
|
702
|
+
cpu: 1,
|
|
703
|
+
memory: 1,
|
|
704
|
+
centsPerVCpuSecond,
|
|
705
|
+
centsPerGbRamSecond
|
|
706
|
+
}),
|
|
707
|
+
"medium-1x": machineDefinition({
|
|
708
|
+
code: "medium-1x",
|
|
709
|
+
title: "Medium 1x",
|
|
710
|
+
cpu: 1,
|
|
711
|
+
memory: 2,
|
|
712
|
+
centsPerVCpuSecond,
|
|
713
|
+
centsPerGbRamSecond
|
|
714
|
+
}),
|
|
715
|
+
"medium-2x": machineDefinition({
|
|
716
|
+
code: "medium-2x",
|
|
717
|
+
title: "Medium 2x",
|
|
718
|
+
cpu: 2,
|
|
719
|
+
memory: 4,
|
|
720
|
+
centsPerVCpuSecond,
|
|
721
|
+
centsPerGbRamSecond
|
|
722
|
+
}),
|
|
723
|
+
"large-1x": machineDefinition({
|
|
724
|
+
code: "large-1x",
|
|
725
|
+
title: "Large 1x",
|
|
726
|
+
cpu: 4,
|
|
727
|
+
memory: 8,
|
|
728
|
+
centsPerVCpuSecond,
|
|
729
|
+
centsPerGbRamSecond
|
|
730
|
+
}),
|
|
731
|
+
"large-2x": machineDefinition({
|
|
732
|
+
code: "large-2x",
|
|
733
|
+
title: "Large 2x",
|
|
734
|
+
cpu: 8,
|
|
735
|
+
memory: 16,
|
|
736
|
+
centsPerVCpuSecond,
|
|
737
|
+
centsPerGbRamSecond
|
|
738
|
+
})
|
|
947
739
|
};
|
|
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
|
-
});
|
|
740
|
+
const defaultMachine = "small-1x";
|
|
741
|
+
//#endregion
|
|
742
|
+
exports.AddOn = AddOn;
|
|
743
|
+
exports.AddOnDefinition = AddOnDefinition;
|
|
744
|
+
exports.AddOns = AddOns;
|
|
745
|
+
exports.ApplyPromoCodeBodySchema = ApplyPromoCodeBodySchema;
|
|
746
|
+
exports.ApplyPromoCodeResult = ApplyPromoCodeResult;
|
|
747
|
+
exports.BillingAlertsResult = BillingAlertsResult;
|
|
748
|
+
exports.BillingClient = BillingClient;
|
|
749
|
+
exports.BillingLimitActiveOrg = BillingLimitActiveOrg;
|
|
750
|
+
exports.BillingLimitConfiguredCustom = BillingLimitConfiguredCustom;
|
|
751
|
+
exports.BillingLimitConfiguredNone = BillingLimitConfiguredNone;
|
|
752
|
+
exports.BillingLimitConfiguredPlan = BillingLimitConfiguredPlan;
|
|
753
|
+
exports.BillingLimitPendingResolveOrg = BillingLimitPendingResolveOrg;
|
|
754
|
+
exports.BillingLimitResult = BillingLimitResult;
|
|
755
|
+
exports.BillingLimitState = BillingLimitState;
|
|
756
|
+
exports.BillingLimitUnconfigured = BillingLimitUnconfigured;
|
|
757
|
+
exports.BillingLimitsActiveResult = BillingLimitsActiveResult;
|
|
758
|
+
exports.BillingLimitsPendingResolvesResult = BillingLimitsPendingResolvesResult;
|
|
759
|
+
exports.CreatePrivateLinkConnectionBody = CreatePrivateLinkConnectionBody;
|
|
760
|
+
exports.CurrentPlan = CurrentPlan;
|
|
761
|
+
exports.CustomerPortalRequestBodySchema = CustomerPortalRequestBodySchema;
|
|
762
|
+
exports.CustomerPortalSchema = CustomerPortalSchema;
|
|
763
|
+
exports.DeletePrivateLinkResult = DeletePrivateLinkResult;
|
|
764
|
+
exports.EnqueueBuildRequestSchema = EnqueueBuildRequestSchema;
|
|
765
|
+
exports.EnqueueBuildResponseSchema = EnqueueBuildResponseSchema;
|
|
766
|
+
exports.ErrorSchema = ErrorSchema;
|
|
767
|
+
exports.FreeConnectRequiredSchema = FreeConnectRequiredSchema;
|
|
768
|
+
exports.FreeConnectedSchema = FreeConnectedSchema;
|
|
769
|
+
exports.MAX_INVOCATION_COST_IN_CENTS = MAX_INVOCATION_COST_IN_CENTS;
|
|
770
|
+
exports.PlanDefinitionSchema = PlanDefinitionSchema;
|
|
771
|
+
exports.Plans = Plans;
|
|
772
|
+
exports.PlansResult = PlansResult;
|
|
773
|
+
exports.PrivateLinkConnection = PrivateLinkConnection;
|
|
774
|
+
exports.PrivateLinkConnectionList = PrivateLinkConnectionList;
|
|
775
|
+
exports.PrivateLinkConnectionStatus = PrivateLinkConnectionStatus;
|
|
776
|
+
exports.PrivateLinkRegionsResult = PrivateLinkRegionsResult;
|
|
777
|
+
exports.PromoCreditsResult = PromoCreditsResult;
|
|
778
|
+
exports.RegistryCredentialsResponseSchema = RegistryCredentialsResponseSchema;
|
|
779
|
+
exports.ReportComputeUsageEvent = ReportComputeUsageEvent;
|
|
780
|
+
exports.ReportInvocationUsageEvent = ReportInvocationUsageEvent;
|
|
781
|
+
exports.ReportInvocationUsageResult = ReportInvocationUsageResult;
|
|
782
|
+
exports.ReportUsagePlan = ReportUsagePlan;
|
|
783
|
+
exports.ReportUsageResult = ReportUsageResult;
|
|
784
|
+
exports.ResolveBillingLimitRequest = ResolveBillingLimitRequest;
|
|
785
|
+
exports.SetAddOnBody = SetAddOnBody;
|
|
786
|
+
exports.SetAddOnResult = SetAddOnResult;
|
|
787
|
+
exports.SetPlanBodySchema = SetPlanBodySchema;
|
|
788
|
+
exports.SubscribeResultSchema = SubscribeResultSchema;
|
|
789
|
+
exports.SubscriptionResult = SubscriptionResult;
|
|
790
|
+
exports.TriggerInitialDeploymentRequestSchema = TriggerInitialDeploymentRequestSchema;
|
|
791
|
+
exports.TriggerInitialDeploymentResponseSchema = TriggerInitialDeploymentResponseSchema;
|
|
792
|
+
exports.UpdateBillingAlertsRequest = UpdateBillingAlertsRequest;
|
|
793
|
+
exports.UpdateBillingLimitRequest = UpdateBillingLimitRequest;
|
|
794
|
+
exports.UsageParams = UsageParams;
|
|
795
|
+
exports.UsageResult = UsageResult;
|
|
796
|
+
exports.UsageSeriesParams = UsageSeriesParams;
|
|
797
|
+
exports.UsageSeriesResult = UsageSeriesResult;
|
|
798
|
+
exports.ValidatePromoCodeBodySchema = ValidatePromoCodeBodySchema;
|
|
799
|
+
exports.ValidatePromoCodeResult = ValidatePromoCodeResult;
|
|
800
|
+
exports.defaultMachine = defaultMachine;
|
|
801
|
+
exports.machineDefinition = machineDefinition;
|
|
802
|
+
exports.machines = machines;
|
|
803
|
+
exports.objectToSearchParams = objectToSearchParams;
|
|
804
|
+
|
|
1014
805
|
//# sourceMappingURL=index.cjs.map
|