@alpic-ai/api 0.0.0-staging.f2a9041 → 0.0.0-staging.f357770
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.d.mts +155 -4
- package/dist/index.mjs +154 -18
- package/package.json +8 -6
package/dist/index.d.mts
CHANGED
|
@@ -6,8 +6,16 @@ import { z } from "zod";
|
|
|
6
6
|
type ApiContext = {
|
|
7
7
|
request: Request & {
|
|
8
8
|
teamIds: string[];
|
|
9
|
+
defaultTeamId: string | undefined;
|
|
10
|
+
awsCognitoUserSub: string | undefined;
|
|
9
11
|
};
|
|
10
12
|
};
|
|
13
|
+
declare const deploymentStatusSchema: z.ZodEnum<{
|
|
14
|
+
ongoing: "ongoing";
|
|
15
|
+
deployed: "deployed";
|
|
16
|
+
failed: "failed";
|
|
17
|
+
canceled: "canceled";
|
|
18
|
+
}>;
|
|
11
19
|
declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
12
20
|
projectId: z.ZodString;
|
|
13
21
|
name: z.ZodString;
|
|
@@ -36,7 +44,6 @@ declare const contract: {
|
|
|
36
44
|
name: z.ZodString;
|
|
37
45
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
38
46
|
hasStripeAccount: z.ZodBoolean;
|
|
39
|
-
hasActiveSubscription: z.ZodBoolean;
|
|
40
47
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
41
48
|
};
|
|
42
49
|
};
|
|
@@ -95,6 +102,13 @@ declare const contract: {
|
|
|
95
102
|
list: {
|
|
96
103
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
97
104
|
projectId: z.ZodString;
|
|
105
|
+
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
106
|
+
ongoing: "ongoing";
|
|
107
|
+
deployed: "deployed";
|
|
108
|
+
failed: "failed";
|
|
109
|
+
canceled: "canceled";
|
|
110
|
+
}>>>;
|
|
111
|
+
environmentId: z.ZodOptional<z.ZodString>;
|
|
98
112
|
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
99
113
|
id: z.ZodString;
|
|
100
114
|
status: z.ZodEnum<{
|
|
@@ -110,8 +124,10 @@ declare const contract: {
|
|
|
110
124
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
111
125
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
112
126
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
113
|
-
isCurrent: z.ZodBoolean;
|
|
114
127
|
environmentId: z.ZodString;
|
|
128
|
+
environmentName: z.ZodString;
|
|
129
|
+
isCurrent: z.ZodBoolean;
|
|
130
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
115
131
|
}, z.core.$strip>>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
116
132
|
NOT_FOUND: {};
|
|
117
133
|
}>, Record<never, never>>;
|
|
@@ -134,6 +150,10 @@ declare const contract: {
|
|
|
134
150
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
135
151
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
136
152
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
153
|
+
environmentId: z.ZodString;
|
|
154
|
+
environmentName: z.ZodString;
|
|
155
|
+
isCurrent: z.ZodBoolean;
|
|
156
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
137
157
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
138
158
|
NOT_FOUND: {};
|
|
139
159
|
}>, Record<never, never>>;
|
|
@@ -218,16 +238,109 @@ declare const contract: {
|
|
|
218
238
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
219
239
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
220
240
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
241
|
+
environmentId: z.ZodString;
|
|
242
|
+
environmentName: z.ZodString;
|
|
243
|
+
isCurrent: z.ZodBoolean;
|
|
244
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
245
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
246
|
+
NOT_FOUND: {};
|
|
247
|
+
BAD_REQUEST: {};
|
|
248
|
+
}>, Record<never, never>>;
|
|
249
|
+
};
|
|
250
|
+
getLogs: {
|
|
251
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
252
|
+
environmentId: z.ZodString;
|
|
253
|
+
since: z.ZodOptional<z.ZodString>;
|
|
254
|
+
until: z.ZodOptional<z.ZodString>;
|
|
255
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
256
|
+
level: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
257
|
+
INFO: "INFO";
|
|
258
|
+
ERROR: "ERROR";
|
|
259
|
+
WARNING: "WARNING";
|
|
260
|
+
DEBUG: "DEBUG";
|
|
261
|
+
}>>>;
|
|
262
|
+
search: z.ZodOptional<z.ZodString>;
|
|
263
|
+
nextToken: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
logs: z.ZodArray<z.ZodObject<{
|
|
266
|
+
timestamp: z.ZodCoercedDate<unknown>;
|
|
267
|
+
type: z.ZodEnum<{
|
|
268
|
+
INFO: "INFO";
|
|
269
|
+
ERROR: "ERROR";
|
|
270
|
+
WARNING: "WARNING";
|
|
271
|
+
DEBUG: "DEBUG";
|
|
272
|
+
START: "START";
|
|
273
|
+
END: "END";
|
|
274
|
+
}>;
|
|
275
|
+
requestId: z.ZodString;
|
|
276
|
+
content: z.ZodOptional<z.ZodString>;
|
|
277
|
+
method: z.ZodOptional<z.ZodString>;
|
|
278
|
+
durationInMs: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
}, z.core.$strip>>;
|
|
280
|
+
nextToken: z.ZodNullable<z.ZodString>;
|
|
221
281
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
222
282
|
NOT_FOUND: {};
|
|
223
283
|
BAD_REQUEST: {};
|
|
224
284
|
}>, Record<never, never>>;
|
|
225
285
|
};
|
|
226
286
|
};
|
|
287
|
+
environmentVariables: {
|
|
288
|
+
list: {
|
|
289
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
290
|
+
environmentId: z.ZodString;
|
|
291
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
292
|
+
id: z.ZodString;
|
|
293
|
+
key: z.ZodString;
|
|
294
|
+
value: z.ZodString;
|
|
295
|
+
isSecret: z.ZodBoolean;
|
|
296
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
297
|
+
}, z.core.$strip>>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
298
|
+
NOT_FOUND: {};
|
|
299
|
+
}>, Record<never, never>>;
|
|
300
|
+
};
|
|
301
|
+
create: {
|
|
302
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
303
|
+
environmentId: z.ZodString;
|
|
304
|
+
environmentVariables: z.ZodArray<z.ZodObject<{
|
|
305
|
+
key: z.ZodString;
|
|
306
|
+
value: z.ZodString;
|
|
307
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
308
|
+
}, z.core.$strip>>;
|
|
309
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
310
|
+
success: z.ZodLiteral<true>;
|
|
311
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
312
|
+
NOT_FOUND: {};
|
|
313
|
+
BAD_REQUEST: {};
|
|
314
|
+
}>, Record<never, never>>;
|
|
315
|
+
};
|
|
316
|
+
update: {
|
|
317
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
318
|
+
environmentVariableId: z.ZodString;
|
|
319
|
+
key: z.ZodString;
|
|
320
|
+
value: z.ZodOptional<z.ZodString>;
|
|
321
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
322
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
323
|
+
success: z.ZodLiteral<true>;
|
|
324
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
325
|
+
NOT_FOUND: {};
|
|
326
|
+
BAD_REQUEST: {};
|
|
327
|
+
}>, Record<never, never>>;
|
|
328
|
+
};
|
|
329
|
+
delete: {
|
|
330
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
331
|
+
environmentVariableId: z.ZodString;
|
|
332
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
333
|
+
success: z.ZodLiteral<true>;
|
|
334
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
335
|
+
NOT_FOUND: {};
|
|
336
|
+
}>, Record<never, never>>;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
227
339
|
projects: {
|
|
228
340
|
update: {
|
|
229
341
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
230
342
|
projectId: z.ZodString;
|
|
343
|
+
name: z.ZodOptional<z.ZodString>;
|
|
231
344
|
sourceRepository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
232
345
|
}, z.core.$strip>, z.ZodObject<{
|
|
233
346
|
id: z.ZodString;
|
|
@@ -255,6 +368,15 @@ declare const contract: {
|
|
|
255
368
|
id: z.ZodString;
|
|
256
369
|
name: z.ZodString;
|
|
257
370
|
mcpServerUrl: z.ZodString;
|
|
371
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
372
|
+
domain: z.ZodString;
|
|
373
|
+
status: z.ZodEnum<{
|
|
374
|
+
ongoing: "ongoing";
|
|
375
|
+
deployed: "deployed";
|
|
376
|
+
failed: "failed";
|
|
377
|
+
}>;
|
|
378
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
379
|
+
}, z.core.$strip>>;
|
|
258
380
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
259
381
|
id: z.ZodString;
|
|
260
382
|
status: z.ZodEnum<{
|
|
@@ -322,6 +444,15 @@ declare const contract: {
|
|
|
322
444
|
id: z.ZodString;
|
|
323
445
|
name: z.ZodString;
|
|
324
446
|
mcpServerUrl: z.ZodString;
|
|
447
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
448
|
+
domain: z.ZodString;
|
|
449
|
+
status: z.ZodEnum<{
|
|
450
|
+
ongoing: "ongoing";
|
|
451
|
+
deployed: "deployed";
|
|
452
|
+
failed: "failed";
|
|
453
|
+
}>;
|
|
454
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
455
|
+
}, z.core.$strip>>;
|
|
325
456
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
326
457
|
id: z.ZodString;
|
|
327
458
|
status: z.ZodEnum<{
|
|
@@ -360,7 +491,9 @@ declare const contract: {
|
|
|
360
491
|
}>, Record<never, never>>;
|
|
361
492
|
};
|
|
362
493
|
list: {
|
|
363
|
-
v1: _orpc_contract0.
|
|
494
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{
|
|
495
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
364
497
|
id: z.ZodString;
|
|
365
498
|
name: z.ZodString;
|
|
366
499
|
teamId: z.ZodString;
|
|
@@ -386,6 +519,15 @@ declare const contract: {
|
|
|
386
519
|
id: z.ZodString;
|
|
387
520
|
name: z.ZodString;
|
|
388
521
|
mcpServerUrl: z.ZodString;
|
|
522
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
523
|
+
domain: z.ZodString;
|
|
524
|
+
status: z.ZodEnum<{
|
|
525
|
+
ongoing: "ongoing";
|
|
526
|
+
deployed: "deployed";
|
|
527
|
+
failed: "failed";
|
|
528
|
+
}>;
|
|
529
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
530
|
+
}, z.core.$strip>>;
|
|
389
531
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
390
532
|
id: z.ZodString;
|
|
391
533
|
status: z.ZodEnum<{
|
|
@@ -495,6 +637,15 @@ declare const contract: {
|
|
|
495
637
|
}>, Record<never, never>>;
|
|
496
638
|
};
|
|
497
639
|
};
|
|
640
|
+
tunnels: {
|
|
641
|
+
getTicket: {
|
|
642
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodObject<{
|
|
643
|
+
subdomain: z.ZodString;
|
|
644
|
+
ticket: z.ZodString;
|
|
645
|
+
tunnelHost: z.ZodString;
|
|
646
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
647
|
+
};
|
|
648
|
+
};
|
|
498
649
|
};
|
|
499
650
|
type RouterInput = InferContractRouterInputs<typeof contract>;
|
|
500
651
|
type RouterOutput = InferContractRouterOutputs<typeof contract>;
|
|
@@ -530,4 +681,4 @@ declare const transportSchema: z.ZodEnum<{
|
|
|
530
681
|
}>;
|
|
531
682
|
type Transport = z.infer<typeof transportSchema>;
|
|
532
683
|
//#endregion
|
|
533
|
-
export { ApiContext, RouterInput, RouterOutput, Runtime, Transport, buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
684
|
+
export { ApiContext, RouterInput, RouterOutput, Runtime, Transport, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import ms from "ms";
|
|
2
3
|
import { z } from "zod";
|
|
3
|
-
|
|
4
4
|
//#region src/schemas.ts
|
|
5
5
|
const RESERVED_KEYS = [
|
|
6
6
|
"_HANDLER",
|
|
@@ -13,7 +13,11 @@ const RESERVED_KEYS = [
|
|
|
13
13
|
"AWS_LAMBDA_FUNCTION_VERSION",
|
|
14
14
|
"AWS_LAMBDA_INITIALIZATION_TYPE",
|
|
15
15
|
"AWS_LAMBDA_LOG_GROUP_NAME",
|
|
16
|
+
"AWS_LAMBDA_LOG_STREAM_NAME",
|
|
16
17
|
"AWS_ACCESS_KEY",
|
|
18
|
+
"AWS_ACCESS_KEY_ID",
|
|
19
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
20
|
+
"AWS_SESSION_TOKEN",
|
|
17
21
|
"AWS_LAMBDA_RUNTIME_API",
|
|
18
22
|
"LAMBDA_TASK_ROOT",
|
|
19
23
|
"LAMBDA_RUNTIME_DIR",
|
|
@@ -30,7 +34,8 @@ const RESERVED_KEYS = [
|
|
|
30
34
|
"BUILD_ARG_BUILD_COMMAND",
|
|
31
35
|
"BUILD_ARG_BUILD_OUTPUT_DIR",
|
|
32
36
|
"BUILD_ARG_START_COMMAND",
|
|
33
|
-
"ALPIC_HOST"
|
|
37
|
+
"ALPIC_HOST",
|
|
38
|
+
"ALPIC_CUSTOM_DOMAINS"
|
|
34
39
|
];
|
|
35
40
|
const environmentVariableSchema = z.object({
|
|
36
41
|
key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
|
|
@@ -55,7 +60,6 @@ const transportSchema = z.enum([
|
|
|
55
60
|
"sse",
|
|
56
61
|
"streamablehttp"
|
|
57
62
|
]);
|
|
58
|
-
|
|
59
63
|
//#endregion
|
|
60
64
|
//#region src/api.contract.ts
|
|
61
65
|
const deploymentStatusSchema = z.enum([
|
|
@@ -80,8 +84,16 @@ const deploymentSchema = z.object({
|
|
|
80
84
|
authorUsername: z.string().nullable(),
|
|
81
85
|
authorAvatarUrl: z.string().nullable(),
|
|
82
86
|
startedAt: z.coerce.date().nullable(),
|
|
83
|
-
completedAt: z.coerce.date().nullable()
|
|
87
|
+
completedAt: z.coerce.date().nullable(),
|
|
88
|
+
environmentId: z.string(),
|
|
89
|
+
environmentName: z.string(),
|
|
90
|
+
isCurrent: z.boolean(),
|
|
91
|
+
deploymentPageUrl: z.url().nullable()
|
|
84
92
|
});
|
|
93
|
+
const isValidLogTimeInput = (value) => {
|
|
94
|
+
if (ms(value) !== void 0) return true;
|
|
95
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
96
|
+
};
|
|
85
97
|
const createEnvironmentContractV1 = oc.route({
|
|
86
98
|
path: "/v1/environments",
|
|
87
99
|
method: "POST",
|
|
@@ -121,10 +133,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
133
|
createdAt: z.coerce.date(),
|
|
122
134
|
projectId: z.string()
|
|
123
135
|
}));
|
|
136
|
+
const domainSchema = z.object({
|
|
137
|
+
domain: z.string(),
|
|
138
|
+
status: z.enum([
|
|
139
|
+
"ongoing",
|
|
140
|
+
"deployed",
|
|
141
|
+
"failed"
|
|
142
|
+
]),
|
|
143
|
+
createdAt: z.coerce.date()
|
|
144
|
+
});
|
|
124
145
|
const productionEnvironmentSchema = z.object({
|
|
125
146
|
id: z.string(),
|
|
126
147
|
name: z.string(),
|
|
127
148
|
mcpServerUrl: z.string(),
|
|
149
|
+
domains: z.array(domainSchema),
|
|
128
150
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
151
|
});
|
|
130
152
|
const environmentSchema = z.object({
|
|
@@ -167,7 +189,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
189
|
description: "List all projects for a team",
|
|
168
190
|
tags: ["projects"],
|
|
169
191
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
192
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
193
|
const createProjectContractV1 = oc.route({
|
|
172
194
|
path: "/v1/projects",
|
|
173
195
|
method: "POST",
|
|
@@ -180,7 +202,7 @@ const createProjectContractV1 = oc.route({
|
|
|
180
202
|
BAD_REQUEST: {}
|
|
181
203
|
}).input(z.object({
|
|
182
204
|
teamId: z.string().optional(),
|
|
183
|
-
name: z.string().min(1).max(100),
|
|
205
|
+
name: z.string().trim().min(1).max(100),
|
|
184
206
|
sourceRepository: z.string().optional(),
|
|
185
207
|
branchName: z.string().min(1).optional(),
|
|
186
208
|
runtime: runtimeSchema,
|
|
@@ -210,6 +232,59 @@ const createProjectContractV1 = oc.route({
|
|
|
210
232
|
startCommand: z.string().nullable(),
|
|
211
233
|
createdAt: z.coerce.date()
|
|
212
234
|
}));
|
|
235
|
+
const environmentVariableOutputSchema = z.object({
|
|
236
|
+
id: z.string(),
|
|
237
|
+
key: z.string(),
|
|
238
|
+
value: z.string(),
|
|
239
|
+
isSecret: z.boolean(),
|
|
240
|
+
createdAt: z.coerce.date()
|
|
241
|
+
});
|
|
242
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
243
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
244
|
+
method: "GET",
|
|
245
|
+
summary: "List environment variables",
|
|
246
|
+
description: "List all environment variables for an environment",
|
|
247
|
+
tags: ["environments"],
|
|
248
|
+
successDescription: "The list of environment variables"
|
|
249
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
250
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
251
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
252
|
+
method: "POST",
|
|
253
|
+
summary: "Add environment variables",
|
|
254
|
+
description: "Add one or more environment variables to an environment",
|
|
255
|
+
tags: ["environments"],
|
|
256
|
+
successDescription: "The environment variables have been added successfully"
|
|
257
|
+
}).errors({
|
|
258
|
+
NOT_FOUND: {},
|
|
259
|
+
BAD_REQUEST: {}
|
|
260
|
+
}).input(z.object({
|
|
261
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
262
|
+
environmentVariables: environmentVariablesSchema
|
|
263
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
264
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
265
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
266
|
+
method: "PATCH",
|
|
267
|
+
summary: "Update an environment variable",
|
|
268
|
+
description: "Update an environment variable by ID",
|
|
269
|
+
tags: ["environments"],
|
|
270
|
+
successDescription: "The environment variable has been updated successfully"
|
|
271
|
+
}).errors({
|
|
272
|
+
NOT_FOUND: {},
|
|
273
|
+
BAD_REQUEST: {}
|
|
274
|
+
}).input(z.object({
|
|
275
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
276
|
+
key: environmentVariableSchema.shape.key,
|
|
277
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
278
|
+
isSecret: environmentVariableSchema.shape.isSecret
|
|
279
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
280
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
281
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
282
|
+
method: "DELETE",
|
|
283
|
+
summary: "Delete an environment variable",
|
|
284
|
+
description: "Delete an environment variable by ID",
|
|
285
|
+
tags: ["environments"],
|
|
286
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
287
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
213
288
|
const deleteProjectContractV1 = oc.route({
|
|
214
289
|
path: "/v1/projects/:projectId",
|
|
215
290
|
method: "DELETE",
|
|
@@ -230,6 +305,7 @@ const updateProjectContractV1 = oc.route({
|
|
|
230
305
|
BAD_REQUEST: {}
|
|
231
306
|
}).input(z.object({
|
|
232
307
|
projectId: z.string().describe("The ID of the project"),
|
|
308
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
233
309
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
234
310
|
})).output(projectOutputSchema);
|
|
235
311
|
const deployEnvironmentContractV1 = oc.route({
|
|
@@ -258,17 +334,18 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
258
334
|
token: z.string().describe("Token to identify the source archive"),
|
|
259
335
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
260
336
|
}));
|
|
261
|
-
const
|
|
337
|
+
const listDeploymentsContractV1 = oc.route({
|
|
262
338
|
path: "/v1/projects/{projectId}/deployments",
|
|
263
339
|
method: "GET",
|
|
264
340
|
summary: "List project deployments",
|
|
265
341
|
description: "List all deployments for a project",
|
|
266
342
|
tags: ["deployments"],
|
|
267
343
|
successDescription: "The list of deployments"
|
|
268
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
344
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
345
|
+
projectId: z.string().describe("The ID of the project"),
|
|
346
|
+
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
347
|
+
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
348
|
+
})).output(z.array(deploymentSchema));
|
|
272
349
|
const getDeploymentContractV1 = oc.route({
|
|
273
350
|
path: "/v1/deployments/{deploymentId}",
|
|
274
351
|
method: "GET",
|
|
@@ -277,6 +354,47 @@ const getDeploymentContractV1 = oc.route({
|
|
|
277
354
|
tags: ["deployments"],
|
|
278
355
|
successDescription: "The deployment details"
|
|
279
356
|
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
|
|
357
|
+
const getLogsContractV1 = oc.route({
|
|
358
|
+
path: "/v1/environments/{environmentId}/logs",
|
|
359
|
+
method: "GET",
|
|
360
|
+
summary: "Get logs",
|
|
361
|
+
description: "Get logs for an environment",
|
|
362
|
+
tags: ["environments"],
|
|
363
|
+
successDescription: "The logs"
|
|
364
|
+
}).errors({
|
|
365
|
+
NOT_FOUND: {},
|
|
366
|
+
BAD_REQUEST: {}
|
|
367
|
+
}).input(z.object({
|
|
368
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
369
|
+
since: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
370
|
+
until: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("End time — ISO 8601 or relative"),
|
|
371
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
372
|
+
level: z.array(z.enum([
|
|
373
|
+
"INFO",
|
|
374
|
+
"ERROR",
|
|
375
|
+
"WARNING",
|
|
376
|
+
"DEBUG"
|
|
377
|
+
])).optional().describe("Filter by log level"),
|
|
378
|
+
search: z.string().optional().describe("Filter pattern to search for in log content"),
|
|
379
|
+
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
380
|
+
})).output(z.object({
|
|
381
|
+
logs: z.array(z.object({
|
|
382
|
+
timestamp: z.coerce.date(),
|
|
383
|
+
type: z.enum([
|
|
384
|
+
"START",
|
|
385
|
+
"END",
|
|
386
|
+
"INFO",
|
|
387
|
+
"ERROR",
|
|
388
|
+
"WARNING",
|
|
389
|
+
"DEBUG"
|
|
390
|
+
]),
|
|
391
|
+
requestId: z.string(),
|
|
392
|
+
content: z.string().optional(),
|
|
393
|
+
method: z.string().optional(),
|
|
394
|
+
durationInMs: z.number().optional()
|
|
395
|
+
})),
|
|
396
|
+
nextToken: z.string().nullable()
|
|
397
|
+
}));
|
|
280
398
|
const getDeploymentLogsContractV1 = oc.route({
|
|
281
399
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
282
400
|
method: "GET",
|
|
@@ -340,14 +458,25 @@ const listTeamsContractV1 = oc.route({
|
|
|
340
458
|
id: z.string(),
|
|
341
459
|
name: z.string(),
|
|
342
460
|
createdAt: z.coerce.date(),
|
|
343
|
-
hasStripeAccount: z.boolean()
|
|
344
|
-
hasActiveSubscription: z.boolean()
|
|
461
|
+
hasStripeAccount: z.boolean()
|
|
345
462
|
})));
|
|
463
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
464
|
+
path: "/v1/tunnels/ticket",
|
|
465
|
+
method: "GET",
|
|
466
|
+
summary: "Get a tunnel ticket",
|
|
467
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
468
|
+
tags: ["tunnels"],
|
|
469
|
+
successDescription: "The tunnel ticket"
|
|
470
|
+
}).output(z.object({
|
|
471
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
472
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
473
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
474
|
+
}));
|
|
346
475
|
const contract = {
|
|
347
476
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
348
477
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
349
478
|
deployments: {
|
|
350
|
-
list: { v1:
|
|
479
|
+
list: { v1: listDeploymentsContractV1 },
|
|
351
480
|
get: { v1: getDeploymentContractV1 },
|
|
352
481
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
353
482
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -355,7 +484,14 @@ const contract = {
|
|
|
355
484
|
environments: {
|
|
356
485
|
create: { v1: createEnvironmentContractV1 },
|
|
357
486
|
get: { v1: getEnvironmentContractV1 },
|
|
358
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
487
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
488
|
+
getLogs: { v1: getLogsContractV1 }
|
|
489
|
+
},
|
|
490
|
+
environmentVariables: {
|
|
491
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
492
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
493
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
494
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
359
495
|
},
|
|
360
496
|
projects: {
|
|
361
497
|
update: { v1: updateProjectContractV1 },
|
|
@@ -363,8 +499,8 @@ const contract = {
|
|
|
363
499
|
list: { v1: listProjectsContractV1 },
|
|
364
500
|
create: { v1: createProjectContractV1 },
|
|
365
501
|
delete: { v1: deleteProjectContractV1 }
|
|
366
|
-
}
|
|
502
|
+
},
|
|
503
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
367
504
|
};
|
|
368
|
-
|
|
369
505
|
//#endregion
|
|
370
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
506
|
+
export { buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpic-ai/api",
|
|
3
|
-
"version": "0.0.0-staging.
|
|
3
|
+
"version": "0.0.0-staging.f357770",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
"author": "Alpic",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orpc/contract": "^1.13.
|
|
20
|
+
"@orpc/contract": "^1.13.7",
|
|
21
|
+
"ms": "^2.1.3",
|
|
21
22
|
"zod": "^4.3.6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
25
|
-
"
|
|
26
|
+
"@types/ms": "^2.1.0",
|
|
26
27
|
"shx": "^0.4.0",
|
|
27
|
-
"tsdown": "^0.
|
|
28
|
+
"tsdown": "^0.21.3",
|
|
28
29
|
"typescript": "^5.9.3",
|
|
29
|
-
"vitest": "^4.0
|
|
30
|
+
"vitest": "^4.1.0"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build": "shx rm -rf dist && tsdown",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
35
36
|
"test:unit": "vitest run",
|
|
36
37
|
"test:format": "prettier --check .",
|
|
37
|
-
"test:type": "tsc --noEmit"
|
|
38
|
+
"test:type": "tsc --noEmit",
|
|
39
|
+
"publish:npm": "pnpm publish --tag \"${NPM_TAG}\" --access public --no-git-checks"
|
|
38
40
|
}
|
|
39
41
|
}
|