@alpic-ai/api 0.0.0-staging.65ed220 → 0.0.0-staging.66f53e4
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 +219 -1
- package/dist/index.mjs +190 -19
- package/package.json +7 -5
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,8 @@ 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
|
};
|
|
11
13
|
declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -29,6 +31,16 @@ declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuil
|
|
|
29
31
|
BAD_REQUEST: {};
|
|
30
32
|
}>, Record<never, never>>;
|
|
31
33
|
declare const contract: {
|
|
34
|
+
teams: {
|
|
35
|
+
list: {
|
|
36
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
40
|
+
hasStripeAccount: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
32
44
|
analytics: {
|
|
33
45
|
get: {
|
|
34
46
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -123,6 +135,7 @@ declare const contract: {
|
|
|
123
135
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
124
136
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
125
137
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
138
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
126
139
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
127
140
|
NOT_FOUND: {};
|
|
128
141
|
}>, Record<never, never>>;
|
|
@@ -207,13 +220,180 @@ declare const contract: {
|
|
|
207
220
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
208
221
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
209
222
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
223
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
224
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
225
|
+
NOT_FOUND: {};
|
|
226
|
+
BAD_REQUEST: {};
|
|
227
|
+
}>, Record<never, never>>;
|
|
228
|
+
};
|
|
229
|
+
getLogs: {
|
|
230
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
231
|
+
environmentId: z.ZodString;
|
|
232
|
+
since: z.ZodOptional<z.ZodString>;
|
|
233
|
+
until: z.ZodOptional<z.ZodString>;
|
|
234
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
235
|
+
level: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
236
|
+
INFO: "INFO";
|
|
237
|
+
ERROR: "ERROR";
|
|
238
|
+
WARNING: "WARNING";
|
|
239
|
+
DEBUG: "DEBUG";
|
|
240
|
+
}>>>;
|
|
241
|
+
search: z.ZodOptional<z.ZodString>;
|
|
242
|
+
nextToken: z.ZodOptional<z.ZodString>;
|
|
243
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
244
|
+
logs: z.ZodArray<z.ZodObject<{
|
|
245
|
+
timestamp: z.ZodCoercedDate<unknown>;
|
|
246
|
+
type: z.ZodEnum<{
|
|
247
|
+
INFO: "INFO";
|
|
248
|
+
ERROR: "ERROR";
|
|
249
|
+
WARNING: "WARNING";
|
|
250
|
+
DEBUG: "DEBUG";
|
|
251
|
+
START: "START";
|
|
252
|
+
END: "END";
|
|
253
|
+
}>;
|
|
254
|
+
requestId: z.ZodString;
|
|
255
|
+
content: z.ZodOptional<z.ZodString>;
|
|
256
|
+
method: z.ZodOptional<z.ZodString>;
|
|
257
|
+
durationInMs: z.ZodOptional<z.ZodNumber>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
nextToken: z.ZodNullable<z.ZodString>;
|
|
210
260
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
211
261
|
NOT_FOUND: {};
|
|
212
262
|
BAD_REQUEST: {};
|
|
213
263
|
}>, Record<never, never>>;
|
|
214
264
|
};
|
|
215
265
|
};
|
|
266
|
+
environmentVariables: {
|
|
267
|
+
list: {
|
|
268
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
269
|
+
environmentId: z.ZodString;
|
|
270
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
key: z.ZodString;
|
|
273
|
+
value: z.ZodString;
|
|
274
|
+
isSecret: z.ZodBoolean;
|
|
275
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
276
|
+
}, z.core.$strip>>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
277
|
+
NOT_FOUND: {};
|
|
278
|
+
}>, Record<never, never>>;
|
|
279
|
+
};
|
|
280
|
+
create: {
|
|
281
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
282
|
+
environmentId: z.ZodString;
|
|
283
|
+
environmentVariables: z.ZodArray<z.ZodObject<{
|
|
284
|
+
key: z.ZodString;
|
|
285
|
+
value: z.ZodString;
|
|
286
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
287
|
+
}, z.core.$strip>>;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
success: z.ZodLiteral<true>;
|
|
290
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
291
|
+
NOT_FOUND: {};
|
|
292
|
+
BAD_REQUEST: {};
|
|
293
|
+
}>, Record<never, never>>;
|
|
294
|
+
};
|
|
295
|
+
update: {
|
|
296
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
297
|
+
environmentVariableId: z.ZodString;
|
|
298
|
+
key: z.ZodString;
|
|
299
|
+
value: z.ZodOptional<z.ZodString>;
|
|
300
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
301
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
302
|
+
success: z.ZodLiteral<true>;
|
|
303
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
304
|
+
NOT_FOUND: {};
|
|
305
|
+
BAD_REQUEST: {};
|
|
306
|
+
}>, Record<never, never>>;
|
|
307
|
+
};
|
|
308
|
+
delete: {
|
|
309
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
310
|
+
environmentVariableId: z.ZodString;
|
|
311
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
312
|
+
success: z.ZodLiteral<true>;
|
|
313
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
314
|
+
NOT_FOUND: {};
|
|
315
|
+
}>, Record<never, never>>;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
216
318
|
projects: {
|
|
319
|
+
update: {
|
|
320
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
321
|
+
projectId: z.ZodString;
|
|
322
|
+
name: z.ZodOptional<z.ZodString>;
|
|
323
|
+
sourceRepository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
324
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
name: z.ZodString;
|
|
327
|
+
teamId: z.ZodString;
|
|
328
|
+
sourceRepository: z.ZodNullable<z.ZodString>;
|
|
329
|
+
runtime: z.ZodEnum<{
|
|
330
|
+
"python3.13": "python3.13";
|
|
331
|
+
"python3.14": "python3.14";
|
|
332
|
+
node22: "node22";
|
|
333
|
+
node24: "node24";
|
|
334
|
+
}>;
|
|
335
|
+
transport: z.ZodNullable<z.ZodEnum<{
|
|
336
|
+
stdio: "stdio";
|
|
337
|
+
sse: "sse";
|
|
338
|
+
streamablehttp: "streamablehttp";
|
|
339
|
+
}>>;
|
|
340
|
+
rootDirectory: z.ZodNullable<z.ZodString>;
|
|
341
|
+
buildCommand: z.ZodNullable<z.ZodString>;
|
|
342
|
+
buildOutputDir: z.ZodNullable<z.ZodString>;
|
|
343
|
+
installCommand: z.ZodNullable<z.ZodString>;
|
|
344
|
+
startCommand: z.ZodNullable<z.ZodString>;
|
|
345
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
346
|
+
productionEnvironment: z.ZodNullable<z.ZodObject<{
|
|
347
|
+
id: z.ZodString;
|
|
348
|
+
name: z.ZodString;
|
|
349
|
+
mcpServerUrl: z.ZodString;
|
|
350
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
351
|
+
domain: z.ZodString;
|
|
352
|
+
status: z.ZodEnum<{
|
|
353
|
+
ongoing: "ongoing";
|
|
354
|
+
deployed: "deployed";
|
|
355
|
+
failed: "failed";
|
|
356
|
+
}>;
|
|
357
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
358
|
+
}, z.core.$strip>>;
|
|
359
|
+
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
360
|
+
id: z.ZodString;
|
|
361
|
+
status: z.ZodEnum<{
|
|
362
|
+
ongoing: "ongoing";
|
|
363
|
+
deployed: "deployed";
|
|
364
|
+
failed: "failed";
|
|
365
|
+
canceled: "canceled";
|
|
366
|
+
}>;
|
|
367
|
+
sourceCommitId: z.ZodNullable<z.ZodString>;
|
|
368
|
+
sourceCommitMessage: z.ZodNullable<z.ZodString>;
|
|
369
|
+
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
370
|
+
}, z.core.$strip>>;
|
|
371
|
+
}, z.core.$strip>>;
|
|
372
|
+
environments: z.ZodArray<z.ZodObject<{
|
|
373
|
+
id: z.ZodString;
|
|
374
|
+
name: z.ZodString;
|
|
375
|
+
sourceBranch: z.ZodNullable<z.ZodString>;
|
|
376
|
+
mcpServerUrl: z.ZodString;
|
|
377
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
378
|
+
projectId: z.ZodString;
|
|
379
|
+
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
status: z.ZodEnum<{
|
|
382
|
+
ongoing: "ongoing";
|
|
383
|
+
deployed: "deployed";
|
|
384
|
+
failed: "failed";
|
|
385
|
+
canceled: "canceled";
|
|
386
|
+
}>;
|
|
387
|
+
sourceCommitId: z.ZodNullable<z.ZodString>;
|
|
388
|
+
sourceCommitMessage: z.ZodNullable<z.ZodString>;
|
|
389
|
+
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
390
|
+
}, z.core.$strip>>;
|
|
391
|
+
}, z.core.$strip>>;
|
|
392
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
393
|
+
NOT_FOUND: {};
|
|
394
|
+
BAD_REQUEST: {};
|
|
395
|
+
}>, Record<never, never>>;
|
|
396
|
+
};
|
|
217
397
|
get: {
|
|
218
398
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
219
399
|
projectId: z.ZodString;
|
|
@@ -243,6 +423,15 @@ declare const contract: {
|
|
|
243
423
|
id: z.ZodString;
|
|
244
424
|
name: z.ZodString;
|
|
245
425
|
mcpServerUrl: z.ZodString;
|
|
426
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
427
|
+
domain: z.ZodString;
|
|
428
|
+
status: z.ZodEnum<{
|
|
429
|
+
ongoing: "ongoing";
|
|
430
|
+
deployed: "deployed";
|
|
431
|
+
failed: "failed";
|
|
432
|
+
}>;
|
|
433
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
434
|
+
}, z.core.$strip>>;
|
|
246
435
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
247
436
|
id: z.ZodString;
|
|
248
437
|
status: z.ZodEnum<{
|
|
@@ -281,7 +470,9 @@ declare const contract: {
|
|
|
281
470
|
}>, Record<never, never>>;
|
|
282
471
|
};
|
|
283
472
|
list: {
|
|
284
|
-
v1: _orpc_contract0.
|
|
473
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{
|
|
474
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
475
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
285
476
|
id: z.ZodString;
|
|
286
477
|
name: z.ZodString;
|
|
287
478
|
teamId: z.ZodString;
|
|
@@ -307,6 +498,15 @@ declare const contract: {
|
|
|
307
498
|
id: z.ZodString;
|
|
308
499
|
name: z.ZodString;
|
|
309
500
|
mcpServerUrl: z.ZodString;
|
|
501
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
502
|
+
domain: z.ZodString;
|
|
503
|
+
status: z.ZodEnum<{
|
|
504
|
+
ongoing: "ongoing";
|
|
505
|
+
deployed: "deployed";
|
|
506
|
+
failed: "failed";
|
|
507
|
+
}>;
|
|
508
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
509
|
+
}, z.core.$strip>>;
|
|
310
510
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
311
511
|
id: z.ZodString;
|
|
312
512
|
status: z.ZodEnum<{
|
|
@@ -406,6 +606,24 @@ declare const contract: {
|
|
|
406
606
|
BAD_REQUEST: {};
|
|
407
607
|
}>, Record<never, never>>;
|
|
408
608
|
};
|
|
609
|
+
delete: {
|
|
610
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
611
|
+
projectId: z.ZodString;
|
|
612
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
613
|
+
success: z.ZodLiteral<true>;
|
|
614
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
615
|
+
NOT_FOUND: {};
|
|
616
|
+
}>, Record<never, never>>;
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
tunnels: {
|
|
620
|
+
getTicket: {
|
|
621
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodObject<{
|
|
622
|
+
subdomain: z.ZodString;
|
|
623
|
+
ticket: z.ZodString;
|
|
624
|
+
tunnelHost: z.ZodString;
|
|
625
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
626
|
+
};
|
|
409
627
|
};
|
|
410
628
|
};
|
|
411
629
|
type RouterInput = InferContractRouterInputs<typeof contract>;
|
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([
|
|
@@ -82,6 +86,11 @@ const deploymentSchema = z.object({
|
|
|
82
86
|
startedAt: z.coerce.date().nullable(),
|
|
83
87
|
completedAt: z.coerce.date().nullable()
|
|
84
88
|
});
|
|
89
|
+
const deploymentWithPageUrlSchema = deploymentSchema.extend({ deploymentPageUrl: z.url().nullable() });
|
|
90
|
+
const isValidLogTimeInput = (value) => {
|
|
91
|
+
if (ms(value) !== void 0) return true;
|
|
92
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
93
|
+
};
|
|
85
94
|
const createEnvironmentContractV1 = oc.route({
|
|
86
95
|
path: "/v1/environments",
|
|
87
96
|
method: "POST",
|
|
@@ -106,7 +115,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
106
115
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
107
116
|
}));
|
|
108
117
|
const getEnvironmentContractV1 = oc.route({
|
|
109
|
-
path: "/v1/environments
|
|
118
|
+
path: "/v1/environments/{environmentId}",
|
|
110
119
|
method: "GET",
|
|
111
120
|
summary: "Get an environment",
|
|
112
121
|
description: "Get an environment by ID",
|
|
@@ -121,10 +130,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
130
|
createdAt: z.coerce.date(),
|
|
122
131
|
projectId: z.string()
|
|
123
132
|
}));
|
|
133
|
+
const domainSchema = z.object({
|
|
134
|
+
domain: z.string(),
|
|
135
|
+
status: z.enum([
|
|
136
|
+
"ongoing",
|
|
137
|
+
"deployed",
|
|
138
|
+
"failed"
|
|
139
|
+
]),
|
|
140
|
+
createdAt: z.coerce.date()
|
|
141
|
+
});
|
|
124
142
|
const productionEnvironmentSchema = z.object({
|
|
125
143
|
id: z.string(),
|
|
126
144
|
name: z.string(),
|
|
127
145
|
mcpServerUrl: z.string(),
|
|
146
|
+
domains: z.array(domainSchema),
|
|
128
147
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
148
|
});
|
|
130
149
|
const environmentSchema = z.object({
|
|
@@ -153,7 +172,7 @@ const projectOutputSchema = z.object({
|
|
|
153
172
|
environments: z.array(environmentSchema)
|
|
154
173
|
});
|
|
155
174
|
const getProjectContractV1 = oc.route({
|
|
156
|
-
path: "/v1/projects
|
|
175
|
+
path: "/v1/projects/{projectId}",
|
|
157
176
|
method: "GET",
|
|
158
177
|
summary: "Get a project",
|
|
159
178
|
description: "Get a project by ID",
|
|
@@ -167,7 +186,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
186
|
description: "List all projects for a team",
|
|
168
187
|
tags: ["projects"],
|
|
169
188
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
189
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
190
|
const createProjectContractV1 = oc.route({
|
|
172
191
|
path: "/v1/projects",
|
|
173
192
|
method: "POST",
|
|
@@ -180,7 +199,7 @@ const createProjectContractV1 = oc.route({
|
|
|
180
199
|
BAD_REQUEST: {}
|
|
181
200
|
}).input(z.object({
|
|
182
201
|
teamId: z.string().optional(),
|
|
183
|
-
name: z.string().min(1).max(100),
|
|
202
|
+
name: z.string().trim().min(1).max(100),
|
|
184
203
|
sourceRepository: z.string().optional(),
|
|
185
204
|
branchName: z.string().min(1).optional(),
|
|
186
205
|
runtime: runtimeSchema,
|
|
@@ -210,8 +229,84 @@ const createProjectContractV1 = oc.route({
|
|
|
210
229
|
startCommand: z.string().nullable(),
|
|
211
230
|
createdAt: z.coerce.date()
|
|
212
231
|
}));
|
|
232
|
+
const environmentVariableOutputSchema = z.object({
|
|
233
|
+
id: z.string(),
|
|
234
|
+
key: z.string(),
|
|
235
|
+
value: z.string(),
|
|
236
|
+
isSecret: z.boolean(),
|
|
237
|
+
createdAt: z.coerce.date()
|
|
238
|
+
});
|
|
239
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
240
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
241
|
+
method: "GET",
|
|
242
|
+
summary: "List environment variables",
|
|
243
|
+
description: "List all environment variables for an environment",
|
|
244
|
+
tags: ["environments"],
|
|
245
|
+
successDescription: "The list of environment variables"
|
|
246
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
247
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
248
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
249
|
+
method: "POST",
|
|
250
|
+
summary: "Add environment variables",
|
|
251
|
+
description: "Add one or more environment variables to an environment",
|
|
252
|
+
tags: ["environments"],
|
|
253
|
+
successDescription: "The environment variables have been added successfully"
|
|
254
|
+
}).errors({
|
|
255
|
+
NOT_FOUND: {},
|
|
256
|
+
BAD_REQUEST: {}
|
|
257
|
+
}).input(z.object({
|
|
258
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
259
|
+
environmentVariables: environmentVariablesSchema
|
|
260
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
261
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
262
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
263
|
+
method: "PATCH",
|
|
264
|
+
summary: "Update an environment variable",
|
|
265
|
+
description: "Update an environment variable by ID",
|
|
266
|
+
tags: ["environments"],
|
|
267
|
+
successDescription: "The environment variable has been updated successfully"
|
|
268
|
+
}).errors({
|
|
269
|
+
NOT_FOUND: {},
|
|
270
|
+
BAD_REQUEST: {}
|
|
271
|
+
}).input(z.object({
|
|
272
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
273
|
+
key: environmentVariableSchema.shape.key,
|
|
274
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
275
|
+
isSecret: environmentVariableSchema.shape.isSecret
|
|
276
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
277
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
278
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
279
|
+
method: "DELETE",
|
|
280
|
+
summary: "Delete an environment variable",
|
|
281
|
+
description: "Delete an environment variable by ID",
|
|
282
|
+
tags: ["environments"],
|
|
283
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
284
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
285
|
+
const deleteProjectContractV1 = oc.route({
|
|
286
|
+
path: "/v1/projects/:projectId",
|
|
287
|
+
method: "DELETE",
|
|
288
|
+
summary: "Delete a project",
|
|
289
|
+
description: "Delete a project and all its environments",
|
|
290
|
+
tags: ["projects"],
|
|
291
|
+
successDescription: "The project has been deleted successfully"
|
|
292
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
293
|
+
const updateProjectContractV1 = oc.route({
|
|
294
|
+
path: "/v1/projects/{projectId}",
|
|
295
|
+
method: "PATCH",
|
|
296
|
+
summary: "Update a project",
|
|
297
|
+
description: "Update project settings",
|
|
298
|
+
tags: ["projects"],
|
|
299
|
+
successDescription: "The project has been updated successfully"
|
|
300
|
+
}).errors({
|
|
301
|
+
NOT_FOUND: {},
|
|
302
|
+
BAD_REQUEST: {}
|
|
303
|
+
}).input(z.object({
|
|
304
|
+
projectId: z.string().describe("The ID of the project"),
|
|
305
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
306
|
+
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
307
|
+
})).output(projectOutputSchema);
|
|
213
308
|
const deployEnvironmentContractV1 = oc.route({
|
|
214
|
-
path: "/v1/environments
|
|
309
|
+
path: "/v1/environments/{environmentId}/deploy",
|
|
215
310
|
method: "POST",
|
|
216
311
|
summary: "Deploy an environment",
|
|
217
312
|
description: "Deploy an environment",
|
|
@@ -223,7 +318,7 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
223
318
|
}).input(z.object({
|
|
224
319
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
225
320
|
token: z.string().describe("The token to identify the source archive").optional()
|
|
226
|
-
})).output(
|
|
321
|
+
})).output(deploymentWithPageUrlSchema);
|
|
227
322
|
const uploadDeploymentArtifactContractV1 = oc.route({
|
|
228
323
|
path: "/v1/deployments/upload",
|
|
229
324
|
method: "POST",
|
|
@@ -237,7 +332,7 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
237
332
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
238
333
|
}));
|
|
239
334
|
const listProjectDeploymentsContractV1 = oc.route({
|
|
240
|
-
path: "/v1/projects
|
|
335
|
+
path: "/v1/projects/{projectId}/deployments",
|
|
241
336
|
method: "GET",
|
|
242
337
|
summary: "List project deployments",
|
|
243
338
|
description: "List all deployments for a project",
|
|
@@ -248,15 +343,56 @@ const listProjectDeploymentsContractV1 = oc.route({
|
|
|
248
343
|
environmentId: z.string()
|
|
249
344
|
})));
|
|
250
345
|
const getDeploymentContractV1 = oc.route({
|
|
251
|
-
path: "/v1/deployments
|
|
346
|
+
path: "/v1/deployments/{deploymentId}",
|
|
252
347
|
method: "GET",
|
|
253
348
|
summary: "Get a deployment",
|
|
254
349
|
description: "Get a deployment by ID",
|
|
255
350
|
tags: ["deployments"],
|
|
256
351
|
successDescription: "The deployment details"
|
|
257
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(
|
|
352
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentWithPageUrlSchema);
|
|
353
|
+
const getLogsContractV1 = oc.route({
|
|
354
|
+
path: "/v1/environments/{environmentId}/logs",
|
|
355
|
+
method: "GET",
|
|
356
|
+
summary: "Get logs",
|
|
357
|
+
description: "Get logs for an environment",
|
|
358
|
+
tags: ["environments"],
|
|
359
|
+
successDescription: "The logs"
|
|
360
|
+
}).errors({
|
|
361
|
+
NOT_FOUND: {},
|
|
362
|
+
BAD_REQUEST: {}
|
|
363
|
+
}).input(z.object({
|
|
364
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
365
|
+
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)"),
|
|
366
|
+
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"),
|
|
367
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
368
|
+
level: z.array(z.enum([
|
|
369
|
+
"INFO",
|
|
370
|
+
"ERROR",
|
|
371
|
+
"WARNING",
|
|
372
|
+
"DEBUG"
|
|
373
|
+
])).optional().describe("Filter by log level"),
|
|
374
|
+
search: z.string().optional().describe("Filter pattern to search for in log content"),
|
|
375
|
+
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
376
|
+
})).output(z.object({
|
|
377
|
+
logs: z.array(z.object({
|
|
378
|
+
timestamp: z.coerce.date(),
|
|
379
|
+
type: z.enum([
|
|
380
|
+
"START",
|
|
381
|
+
"END",
|
|
382
|
+
"INFO",
|
|
383
|
+
"ERROR",
|
|
384
|
+
"WARNING",
|
|
385
|
+
"DEBUG"
|
|
386
|
+
]),
|
|
387
|
+
requestId: z.string(),
|
|
388
|
+
content: z.string().optional(),
|
|
389
|
+
method: z.string().optional(),
|
|
390
|
+
durationInMs: z.number().optional()
|
|
391
|
+
})),
|
|
392
|
+
nextToken: z.string().nullable()
|
|
393
|
+
}));
|
|
258
394
|
const getDeploymentLogsContractV1 = oc.route({
|
|
259
|
-
path: "/v1/deployments
|
|
395
|
+
path: "/v1/deployments/{deploymentId}/logs",
|
|
260
396
|
method: "GET",
|
|
261
397
|
summary: "Get deployment logs",
|
|
262
398
|
description: "Get the logs for a deployment",
|
|
@@ -283,7 +419,7 @@ const analyticsTimeSeriesSchema = z.object({
|
|
|
283
419
|
task_count: z.array(analyticsDataPointSchema)
|
|
284
420
|
});
|
|
285
421
|
const getProjectAnalyticsContractV1 = oc.route({
|
|
286
|
-
path: "/v1/analytics
|
|
422
|
+
path: "/v1/analytics/{projectId}",
|
|
287
423
|
method: "GET",
|
|
288
424
|
summary: "Get project analytics",
|
|
289
425
|
description: "Get analytics data for a project over a time range",
|
|
@@ -307,7 +443,33 @@ const getProjectAnalyticsContractV1 = oc.route({
|
|
|
307
443
|
}),
|
|
308
444
|
timeSeries: analyticsTimeSeriesSchema
|
|
309
445
|
}));
|
|
446
|
+
const listTeamsContractV1 = oc.route({
|
|
447
|
+
path: "/v1/teams",
|
|
448
|
+
method: "GET",
|
|
449
|
+
summary: "List teams",
|
|
450
|
+
description: "List all teams for the authenticated user",
|
|
451
|
+
tags: ["teams"],
|
|
452
|
+
successDescription: "The list of teams"
|
|
453
|
+
}).output(z.array(z.object({
|
|
454
|
+
id: z.string(),
|
|
455
|
+
name: z.string(),
|
|
456
|
+
createdAt: z.coerce.date(),
|
|
457
|
+
hasStripeAccount: z.boolean()
|
|
458
|
+
})));
|
|
459
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
460
|
+
path: "/v1/tunnels/ticket",
|
|
461
|
+
method: "GET",
|
|
462
|
+
summary: "Get a tunnel ticket",
|
|
463
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
464
|
+
tags: ["tunnels"],
|
|
465
|
+
successDescription: "The tunnel ticket"
|
|
466
|
+
}).output(z.object({
|
|
467
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
468
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
469
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
470
|
+
}));
|
|
310
471
|
const contract = {
|
|
472
|
+
teams: { list: { v1: listTeamsContractV1 } },
|
|
311
473
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
312
474
|
deployments: {
|
|
313
475
|
list: { v1: listProjectDeploymentsContractV1 },
|
|
@@ -318,14 +480,23 @@ const contract = {
|
|
|
318
480
|
environments: {
|
|
319
481
|
create: { v1: createEnvironmentContractV1 },
|
|
320
482
|
get: { v1: getEnvironmentContractV1 },
|
|
321
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
483
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
484
|
+
getLogs: { v1: getLogsContractV1 }
|
|
485
|
+
},
|
|
486
|
+
environmentVariables: {
|
|
487
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
488
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
489
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
490
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
322
491
|
},
|
|
323
492
|
projects: {
|
|
493
|
+
update: { v1: updateProjectContractV1 },
|
|
324
494
|
get: { v1: getProjectContractV1 },
|
|
325
495
|
list: { v1: listProjectsContractV1 },
|
|
326
|
-
create: { v1: createProjectContractV1 }
|
|
327
|
-
|
|
496
|
+
create: { v1: createProjectContractV1 },
|
|
497
|
+
delete: { v1: deleteProjectContractV1 }
|
|
498
|
+
},
|
|
499
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
328
500
|
};
|
|
329
|
-
|
|
330
501
|
//#endregion
|
|
331
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
502
|
+
export { buildSettingsSchema, contract, createEnvironmentContractV1, 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.66f53e4",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,14 +17,15 @@
|
|
|
17
17
|
"author": "Alpic",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orpc/contract": "^1.13.
|
|
20
|
+
"@orpc/contract": "^1.13.6",
|
|
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.1",
|
|
28
29
|
"typescript": "^5.9.3",
|
|
29
30
|
"vitest": "^4.0.18"
|
|
30
31
|
},
|
|
@@ -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
|
}
|