@alpic-ai/api 0.0.0-staging.04f380a → 0.0.0-staging.0566be6
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 +148 -3
- package/dist/index.mjs +153 -19
- package/package.json +8 -5
package/dist/index.d.mts
CHANGED
|
@@ -7,8 +7,15 @@ type ApiContext = {
|
|
|
7
7
|
request: Request & {
|
|
8
8
|
teamIds: string[];
|
|
9
9
|
defaultTeamId: string | undefined;
|
|
10
|
+
awsCognitoUserSub: string | undefined;
|
|
10
11
|
};
|
|
11
12
|
};
|
|
13
|
+
declare const deploymentStatusSchema: z.ZodEnum<{
|
|
14
|
+
ongoing: "ongoing";
|
|
15
|
+
deployed: "deployed";
|
|
16
|
+
failed: "failed";
|
|
17
|
+
canceled: "canceled";
|
|
18
|
+
}>;
|
|
12
19
|
declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
13
20
|
projectId: z.ZodString;
|
|
14
21
|
name: z.ZodString;
|
|
@@ -37,7 +44,6 @@ declare const contract: {
|
|
|
37
44
|
name: z.ZodString;
|
|
38
45
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
39
46
|
hasStripeAccount: z.ZodBoolean;
|
|
40
|
-
hasActiveSubscription: z.ZodBoolean;
|
|
41
47
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
42
48
|
};
|
|
43
49
|
};
|
|
@@ -96,6 +102,13 @@ declare const contract: {
|
|
|
96
102
|
list: {
|
|
97
103
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
98
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>;
|
|
99
112
|
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
100
113
|
id: z.ZodString;
|
|
101
114
|
status: z.ZodEnum<{
|
|
@@ -111,8 +124,10 @@ declare const contract: {
|
|
|
111
124
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
112
125
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
113
126
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
114
|
-
isCurrent: z.ZodBoolean;
|
|
115
127
|
environmentId: z.ZodString;
|
|
128
|
+
environmentName: z.ZodString;
|
|
129
|
+
isCurrent: z.ZodBoolean;
|
|
130
|
+
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
116
131
|
}, z.core.$strip>>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
117
132
|
NOT_FOUND: {};
|
|
118
133
|
}>, Record<never, never>>;
|
|
@@ -135,6 +150,9 @@ declare const contract: {
|
|
|
135
150
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
136
151
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
137
152
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
153
|
+
environmentId: z.ZodString;
|
|
154
|
+
environmentName: z.ZodString;
|
|
155
|
+
isCurrent: z.ZodBoolean;
|
|
138
156
|
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
139
157
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
140
158
|
NOT_FOUND: {};
|
|
@@ -220,12 +238,103 @@ declare const contract: {
|
|
|
220
238
|
authorAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
221
239
|
startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
222
240
|
completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
241
|
+
environmentId: z.ZodString;
|
|
242
|
+
environmentName: z.ZodString;
|
|
243
|
+
isCurrent: z.ZodBoolean;
|
|
223
244
|
deploymentPageUrl: z.ZodNullable<z.ZodURL>;
|
|
224
245
|
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
225
246
|
NOT_FOUND: {};
|
|
226
247
|
BAD_REQUEST: {};
|
|
227
248
|
}>, Record<never, never>>;
|
|
228
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>;
|
|
281
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
282
|
+
NOT_FOUND: {};
|
|
283
|
+
BAD_REQUEST: {};
|
|
284
|
+
}>, Record<never, never>>;
|
|
285
|
+
};
|
|
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
|
+
};
|
|
229
338
|
};
|
|
230
339
|
projects: {
|
|
231
340
|
update: {
|
|
@@ -259,6 +368,15 @@ declare const contract: {
|
|
|
259
368
|
id: z.ZodString;
|
|
260
369
|
name: z.ZodString;
|
|
261
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>>;
|
|
262
380
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
263
381
|
id: z.ZodString;
|
|
264
382
|
status: z.ZodEnum<{
|
|
@@ -326,6 +444,15 @@ declare const contract: {
|
|
|
326
444
|
id: z.ZodString;
|
|
327
445
|
name: z.ZodString;
|
|
328
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>>;
|
|
329
456
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
330
457
|
id: z.ZodString;
|
|
331
458
|
status: z.ZodEnum<{
|
|
@@ -392,6 +519,15 @@ declare const contract: {
|
|
|
392
519
|
id: z.ZodString;
|
|
393
520
|
name: z.ZodString;
|
|
394
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>>;
|
|
395
531
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
396
532
|
id: z.ZodString;
|
|
397
533
|
status: z.ZodEnum<{
|
|
@@ -501,6 +637,15 @@ declare const contract: {
|
|
|
501
637
|
}>, Record<never, never>>;
|
|
502
638
|
};
|
|
503
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
|
+
};
|
|
504
649
|
};
|
|
505
650
|
type RouterInput = InferContractRouterInputs<typeof contract>;
|
|
506
651
|
type RouterOutput = InferContractRouterOutputs<typeof contract>;
|
|
@@ -536,4 +681,4 @@ declare const transportSchema: z.ZodEnum<{
|
|
|
536
681
|
}>;
|
|
537
682
|
type Transport = z.infer<typeof transportSchema>;
|
|
538
683
|
//#endregion
|
|
539
|
-
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,9 +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
|
});
|
|
85
|
-
const
|
|
93
|
+
const isValidLogTimeInput = (value) => {
|
|
94
|
+
if (ms(value) !== void 0) return true;
|
|
95
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
96
|
+
};
|
|
86
97
|
const createEnvironmentContractV1 = oc.route({
|
|
87
98
|
path: "/v1/environments",
|
|
88
99
|
method: "POST",
|
|
@@ -122,10 +133,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
122
133
|
createdAt: z.coerce.date(),
|
|
123
134
|
projectId: z.string()
|
|
124
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
|
+
});
|
|
125
145
|
const productionEnvironmentSchema = z.object({
|
|
126
146
|
id: z.string(),
|
|
127
147
|
name: z.string(),
|
|
128
148
|
mcpServerUrl: z.string(),
|
|
149
|
+
domains: z.array(domainSchema),
|
|
129
150
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
130
151
|
});
|
|
131
152
|
const environmentSchema = z.object({
|
|
@@ -211,6 +232,59 @@ const createProjectContractV1 = oc.route({
|
|
|
211
232
|
startCommand: z.string().nullable(),
|
|
212
233
|
createdAt: z.coerce.date()
|
|
213
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) }));
|
|
214
288
|
const deleteProjectContractV1 = oc.route({
|
|
215
289
|
path: "/v1/projects/:projectId",
|
|
216
290
|
method: "DELETE",
|
|
@@ -247,7 +321,7 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
247
321
|
}).input(z.object({
|
|
248
322
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
249
323
|
token: z.string().describe("The token to identify the source archive").optional()
|
|
250
|
-
})).output(
|
|
324
|
+
})).output(deploymentSchema);
|
|
251
325
|
const uploadDeploymentArtifactContractV1 = oc.route({
|
|
252
326
|
path: "/v1/deployments/upload",
|
|
253
327
|
method: "POST",
|
|
@@ -260,17 +334,18 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
260
334
|
token: z.string().describe("Token to identify the source archive"),
|
|
261
335
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
262
336
|
}));
|
|
263
|
-
const
|
|
337
|
+
const listDeploymentsContractV1 = oc.route({
|
|
264
338
|
path: "/v1/projects/{projectId}/deployments",
|
|
265
339
|
method: "GET",
|
|
266
340
|
summary: "List project deployments",
|
|
267
341
|
description: "List all deployments for a project",
|
|
268
342
|
tags: ["deployments"],
|
|
269
343
|
successDescription: "The list of deployments"
|
|
270
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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));
|
|
274
349
|
const getDeploymentContractV1 = oc.route({
|
|
275
350
|
path: "/v1/deployments/{deploymentId}",
|
|
276
351
|
method: "GET",
|
|
@@ -278,7 +353,48 @@ const getDeploymentContractV1 = oc.route({
|
|
|
278
353
|
description: "Get a deployment by ID",
|
|
279
354
|
tags: ["deployments"],
|
|
280
355
|
successDescription: "The deployment details"
|
|
281
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(
|
|
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
|
+
}));
|
|
282
398
|
const getDeploymentLogsContractV1 = oc.route({
|
|
283
399
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
284
400
|
method: "GET",
|
|
@@ -342,14 +458,25 @@ const listTeamsContractV1 = oc.route({
|
|
|
342
458
|
id: z.string(),
|
|
343
459
|
name: z.string(),
|
|
344
460
|
createdAt: z.coerce.date(),
|
|
345
|
-
hasStripeAccount: z.boolean()
|
|
346
|
-
hasActiveSubscription: z.boolean()
|
|
461
|
+
hasStripeAccount: z.boolean()
|
|
347
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
|
+
}));
|
|
348
475
|
const contract = {
|
|
349
476
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
350
477
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
351
478
|
deployments: {
|
|
352
|
-
list: { v1:
|
|
479
|
+
list: { v1: listDeploymentsContractV1 },
|
|
353
480
|
get: { v1: getDeploymentContractV1 },
|
|
354
481
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
355
482
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -357,7 +484,14 @@ const contract = {
|
|
|
357
484
|
environments: {
|
|
358
485
|
create: { v1: createEnvironmentContractV1 },
|
|
359
486
|
get: { v1: getEnvironmentContractV1 },
|
|
360
|
-
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 }
|
|
361
495
|
},
|
|
362
496
|
projects: {
|
|
363
497
|
update: { v1: updateProjectContractV1 },
|
|
@@ -365,8 +499,8 @@ const contract = {
|
|
|
365
499
|
list: { v1: listProjectsContractV1 },
|
|
366
500
|
create: { v1: createProjectContractV1 },
|
|
367
501
|
delete: { v1: deleteProjectContractV1 }
|
|
368
|
-
}
|
|
502
|
+
},
|
|
503
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
369
504
|
};
|
|
370
|
-
|
|
371
505
|
//#endregion
|
|
372
|
-
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.0566be6",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,15 +17,17 @@
|
|
|
17
17
|
"author": "Alpic",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orpc/contract": "^1.13.
|
|
20
|
+
"@orpc/contract": "^1.13.8",
|
|
21
|
+
"ms": "^2.1.3",
|
|
21
22
|
"zod": "^4.3.6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
26
|
+
"@types/ms": "^2.1.0",
|
|
25
27
|
"shx": "^0.4.0",
|
|
26
|
-
"tsdown": "^0.
|
|
28
|
+
"tsdown": "^0.21.4",
|
|
27
29
|
"typescript": "^5.9.3",
|
|
28
|
-
"vitest": "^4.0
|
|
30
|
+
"vitest": "^4.1.0"
|
|
29
31
|
},
|
|
30
32
|
"scripts": {
|
|
31
33
|
"build": "shx rm -rf dist && tsdown",
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
34
36
|
"test:unit": "vitest run",
|
|
35
37
|
"test:format": "prettier --check .",
|
|
36
|
-
"test:type": "tsc --noEmit"
|
|
38
|
+
"test:type": "tsc --noEmit",
|
|
39
|
+
"publish:npm": "pnpm publish --tag \"${NPM_TAG}\" --access public --no-git-checks"
|
|
37
40
|
}
|
|
38
41
|
}
|