@alpic-ai/api 0.0.0-dev.36e5073

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.
@@ -0,0 +1,354 @@
1
+ import * as _orpc_contract0 from "@orpc/contract";
2
+ import { InferContractRouterInputs, InferContractRouterOutputs } from "@orpc/contract";
3
+ import { z } from "zod";
4
+
5
+ //#region src/api.contract.d.ts
6
+ type ApiContext = {
7
+ request: Request & {
8
+ teamId: string;
9
+ };
10
+ };
11
+ declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
12
+ projectId: z.ZodString;
13
+ name: z.ZodString;
14
+ sourceBranch: z.ZodString;
15
+ environmentVariables: z.ZodDefault<z.ZodArray<z.ZodObject<{
16
+ key: z.ZodString;
17
+ value: z.ZodString;
18
+ isSecret: z.ZodDefault<z.ZodBoolean>;
19
+ }, z.core.$strip>>>;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ id: z.ZodString;
22
+ name: z.ZodString;
23
+ sourceBranch: z.ZodNullable<z.ZodString>;
24
+ urls: z.ZodArray<z.ZodString>;
25
+ createdAt: z.ZodCoercedDate<unknown>;
26
+ projectId: z.ZodString;
27
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
28
+ NOT_FOUND: {};
29
+ BAD_REQUEST: {};
30
+ }>, Record<never, never>>;
31
+ declare const contract: {
32
+ deployments: {
33
+ get: {
34
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
35
+ deploymentId: z.ZodString;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ id: z.ZodString;
38
+ status: z.ZodEnum<{
39
+ ongoing: "ongoing";
40
+ deployed: "deployed";
41
+ failed: "failed";
42
+ canceled: "canceled";
43
+ }>;
44
+ sourceRef: z.ZodNullable<z.ZodString>;
45
+ sourceCommitId: z.ZodNullable<z.ZodString>;
46
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
47
+ authorUsername: z.ZodNullable<z.ZodString>;
48
+ authorAvatarUrl: z.ZodNullable<z.ZodString>;
49
+ startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
50
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
51
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
52
+ NOT_FOUND: {};
53
+ }>, Record<never, never>>;
54
+ };
55
+ uploadArtifact: {
56
+ v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodObject<{
57
+ uploadUrl: z.ZodString;
58
+ token: z.ZodString;
59
+ expiresAt: z.ZodCoercedDate<unknown>;
60
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
61
+ };
62
+ };
63
+ environments: {
64
+ create: {
65
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
66
+ projectId: z.ZodString;
67
+ name: z.ZodString;
68
+ sourceBranch: z.ZodString;
69
+ environmentVariables: z.ZodDefault<z.ZodArray<z.ZodObject<{
70
+ key: z.ZodString;
71
+ value: z.ZodString;
72
+ isSecret: z.ZodDefault<z.ZodBoolean>;
73
+ }, z.core.$strip>>>;
74
+ }, z.core.$strip>, z.ZodObject<{
75
+ id: z.ZodString;
76
+ name: z.ZodString;
77
+ sourceBranch: z.ZodNullable<z.ZodString>;
78
+ urls: z.ZodArray<z.ZodString>;
79
+ createdAt: z.ZodCoercedDate<unknown>;
80
+ projectId: z.ZodString;
81
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
82
+ NOT_FOUND: {};
83
+ BAD_REQUEST: {};
84
+ }>, Record<never, never>>;
85
+ };
86
+ get: {
87
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
88
+ environmentId: z.ZodString;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ id: z.ZodString;
91
+ name: z.ZodString;
92
+ sourceBranch: z.ZodNullable<z.ZodString>;
93
+ mcpServerUrl: z.ZodString;
94
+ domains: z.ZodArray<z.ZodURL>;
95
+ createdAt: z.ZodCoercedDate<unknown>;
96
+ projectId: z.ZodString;
97
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
98
+ NOT_FOUND: {};
99
+ }>, Record<never, never>>;
100
+ };
101
+ deploy: {
102
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
103
+ environmentId: z.ZodString;
104
+ token: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ id: z.ZodString;
107
+ status: z.ZodEnum<{
108
+ ongoing: "ongoing";
109
+ deployed: "deployed";
110
+ failed: "failed";
111
+ canceled: "canceled";
112
+ }>;
113
+ sourceRef: z.ZodNullable<z.ZodString>;
114
+ sourceCommitId: z.ZodNullable<z.ZodString>;
115
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
116
+ authorUsername: z.ZodNullable<z.ZodString>;
117
+ authorAvatarUrl: z.ZodNullable<z.ZodString>;
118
+ startedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
119
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
120
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
121
+ NOT_FOUND: {};
122
+ BAD_REQUEST: {};
123
+ }>, Record<never, never>>;
124
+ };
125
+ };
126
+ projects: {
127
+ get: {
128
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
129
+ projectId: z.ZodString;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ id: z.ZodString;
132
+ name: z.ZodString;
133
+ teamId: z.ZodString;
134
+ sourceRepository: z.ZodNullable<z.ZodString>;
135
+ runtime: z.ZodEnum<{
136
+ "python3.13": "python3.13";
137
+ "python3.14": "python3.14";
138
+ node22: "node22";
139
+ node24: "node24";
140
+ }>;
141
+ transport: z.ZodNullable<z.ZodEnum<{
142
+ stdio: "stdio";
143
+ sse: "sse";
144
+ streamablehttp: "streamablehttp";
145
+ }>>;
146
+ rootDirectory: z.ZodNullable<z.ZodString>;
147
+ buildCommand: z.ZodNullable<z.ZodString>;
148
+ buildOutputDir: z.ZodNullable<z.ZodString>;
149
+ installCommand: z.ZodNullable<z.ZodString>;
150
+ startCommand: z.ZodNullable<z.ZodString>;
151
+ createdAt: z.ZodCoercedDate<unknown>;
152
+ productionEnvironment: z.ZodNullable<z.ZodObject<{
153
+ id: z.ZodString;
154
+ name: z.ZodString;
155
+ mcpServerUrl: z.ZodString;
156
+ latestDeployment: z.ZodNullable<z.ZodObject<{
157
+ id: z.ZodString;
158
+ status: z.ZodEnum<{
159
+ ongoing: "ongoing";
160
+ deployed: "deployed";
161
+ failed: "failed";
162
+ canceled: "canceled";
163
+ }>;
164
+ sourceCommitId: z.ZodNullable<z.ZodString>;
165
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
166
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
167
+ }, z.core.$strip>>;
168
+ }, z.core.$strip>>;
169
+ environments: z.ZodArray<z.ZodObject<{
170
+ id: z.ZodString;
171
+ name: z.ZodString;
172
+ sourceBranch: z.ZodNullable<z.ZodString>;
173
+ mcpServerUrl: z.ZodString;
174
+ createdAt: z.ZodCoercedDate<unknown>;
175
+ projectId: z.ZodString;
176
+ latestDeployment: z.ZodNullable<z.ZodObject<{
177
+ id: z.ZodString;
178
+ status: z.ZodEnum<{
179
+ ongoing: "ongoing";
180
+ deployed: "deployed";
181
+ failed: "failed";
182
+ canceled: "canceled";
183
+ }>;
184
+ sourceCommitId: z.ZodNullable<z.ZodString>;
185
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
186
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>>;
189
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
190
+ NOT_FOUND: {};
191
+ }>, Record<never, never>>;
192
+ };
193
+ list: {
194
+ v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
195
+ id: z.ZodString;
196
+ name: z.ZodString;
197
+ teamId: z.ZodString;
198
+ sourceRepository: z.ZodNullable<z.ZodString>;
199
+ runtime: z.ZodEnum<{
200
+ "python3.13": "python3.13";
201
+ "python3.14": "python3.14";
202
+ node22: "node22";
203
+ node24: "node24";
204
+ }>;
205
+ transport: z.ZodNullable<z.ZodEnum<{
206
+ stdio: "stdio";
207
+ sse: "sse";
208
+ streamablehttp: "streamablehttp";
209
+ }>>;
210
+ rootDirectory: z.ZodNullable<z.ZodString>;
211
+ buildCommand: z.ZodNullable<z.ZodString>;
212
+ buildOutputDir: z.ZodNullable<z.ZodString>;
213
+ installCommand: z.ZodNullable<z.ZodString>;
214
+ startCommand: z.ZodNullable<z.ZodString>;
215
+ createdAt: z.ZodCoercedDate<unknown>;
216
+ productionEnvironment: z.ZodNullable<z.ZodObject<{
217
+ id: z.ZodString;
218
+ name: z.ZodString;
219
+ mcpServerUrl: z.ZodString;
220
+ latestDeployment: z.ZodNullable<z.ZodObject<{
221
+ id: z.ZodString;
222
+ status: z.ZodEnum<{
223
+ ongoing: "ongoing";
224
+ deployed: "deployed";
225
+ failed: "failed";
226
+ canceled: "canceled";
227
+ }>;
228
+ sourceCommitId: z.ZodNullable<z.ZodString>;
229
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
230
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
231
+ }, z.core.$strip>>;
232
+ }, z.core.$strip>>;
233
+ environments: z.ZodArray<z.ZodObject<{
234
+ id: z.ZodString;
235
+ name: z.ZodString;
236
+ sourceBranch: z.ZodNullable<z.ZodString>;
237
+ mcpServerUrl: z.ZodString;
238
+ createdAt: z.ZodCoercedDate<unknown>;
239
+ projectId: z.ZodString;
240
+ latestDeployment: z.ZodNullable<z.ZodObject<{
241
+ id: z.ZodString;
242
+ status: z.ZodEnum<{
243
+ ongoing: "ongoing";
244
+ deployed: "deployed";
245
+ failed: "failed";
246
+ canceled: "canceled";
247
+ }>;
248
+ sourceCommitId: z.ZodNullable<z.ZodString>;
249
+ sourceCommitMessage: z.ZodNullable<z.ZodString>;
250
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
251
+ }, z.core.$strip>>;
252
+ }, z.core.$strip>>;
253
+ }, z.core.$strip>>, Record<never, never>, Record<never, never>>;
254
+ };
255
+ create: {
256
+ v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
257
+ name: z.ZodString;
258
+ sourceRepository: z.ZodOptional<z.ZodString>;
259
+ branchName: z.ZodOptional<z.ZodString>;
260
+ runtime: z.ZodEnum<{
261
+ "python3.13": "python3.13";
262
+ "python3.14": "python3.14";
263
+ node22: "node22";
264
+ node24: "node24";
265
+ }>;
266
+ transport: z.ZodOptional<z.ZodEnum<{
267
+ stdio: "stdio";
268
+ sse: "sse";
269
+ streamablehttp: "streamablehttp";
270
+ }>>;
271
+ rootDirectory: z.ZodOptional<z.ZodString>;
272
+ settings: z.ZodDefault<z.ZodObject<{
273
+ installCommand: z.ZodOptional<z.ZodString>;
274
+ buildCommand: z.ZodOptional<z.ZodString>;
275
+ buildOutputDir: z.ZodOptional<z.ZodString>;
276
+ startCommand: z.ZodOptional<z.ZodString>;
277
+ }, z.core.$strip>>;
278
+ environmentVariables: z.ZodDefault<z.ZodArray<z.ZodObject<{
279
+ key: z.ZodString;
280
+ value: z.ZodString;
281
+ isSecret: z.ZodDefault<z.ZodBoolean>;
282
+ }, z.core.$strip>>>;
283
+ }, z.core.$strip>, z.ZodObject<{
284
+ id: z.ZodString;
285
+ name: z.ZodString;
286
+ teamId: z.ZodString;
287
+ environments: z.ZodArray<z.ZodObject<{
288
+ id: z.ZodString;
289
+ name: z.ZodString;
290
+ }, z.core.$strip>>;
291
+ productionEnvironment: z.ZodNullable<z.ZodObject<{
292
+ id: z.ZodString;
293
+ name: z.ZodString;
294
+ }, z.core.$strip>>;
295
+ sourceRepository: z.ZodNullable<z.ZodString>;
296
+ runtime: z.ZodEnum<{
297
+ "python3.13": "python3.13";
298
+ "python3.14": "python3.14";
299
+ node22: "node22";
300
+ node24: "node24";
301
+ }>;
302
+ transport: z.ZodNullable<z.ZodEnum<{
303
+ stdio: "stdio";
304
+ sse: "sse";
305
+ streamablehttp: "streamablehttp";
306
+ }>>;
307
+ rootDirectory: z.ZodNullable<z.ZodString>;
308
+ buildCommand: z.ZodNullable<z.ZodString>;
309
+ buildOutputDir: z.ZodNullable<z.ZodString>;
310
+ installCommand: z.ZodNullable<z.ZodString>;
311
+ startCommand: z.ZodNullable<z.ZodString>;
312
+ createdAt: z.ZodCoercedDate<unknown>;
313
+ }, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
314
+ NOT_FOUND: {};
315
+ BAD_REQUEST: {};
316
+ }>, Record<never, never>>;
317
+ };
318
+ };
319
+ };
320
+ type RouterInput = InferContractRouterInputs<typeof contract>;
321
+ type RouterOutput = InferContractRouterOutputs<typeof contract>;
322
+ //#endregion
323
+ //#region src/schemas.d.ts
324
+ declare const environmentVariableSchema: z.ZodObject<{
325
+ key: z.ZodString;
326
+ value: z.ZodString;
327
+ isSecret: z.ZodDefault<z.ZodBoolean>;
328
+ }, z.core.$strip>;
329
+ declare const environmentVariablesSchema: z.ZodArray<z.ZodObject<{
330
+ key: z.ZodString;
331
+ value: z.ZodString;
332
+ isSecret: z.ZodDefault<z.ZodBoolean>;
333
+ }, z.core.$strip>>;
334
+ declare const buildSettingsSchema: z.ZodObject<{
335
+ installCommand: z.ZodOptional<z.ZodString>;
336
+ buildCommand: z.ZodOptional<z.ZodString>;
337
+ buildOutputDir: z.ZodOptional<z.ZodString>;
338
+ startCommand: z.ZodOptional<z.ZodString>;
339
+ }, z.core.$strip>;
340
+ declare const runtimeSchema: z.ZodEnum<{
341
+ "python3.13": "python3.13";
342
+ "python3.14": "python3.14";
343
+ node22: "node22";
344
+ node24: "node24";
345
+ }>;
346
+ type Runtime = z.infer<typeof runtimeSchema>;
347
+ declare const transportSchema: z.ZodEnum<{
348
+ stdio: "stdio";
349
+ sse: "sse";
350
+ streamablehttp: "streamablehttp";
351
+ }>;
352
+ type Transport = z.infer<typeof transportSchema>;
353
+ //#endregion
354
+ export { ApiContext, RouterInput, RouterOutput, Runtime, Transport, buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
package/dist/index.mjs ADDED
@@ -0,0 +1,264 @@
1
+ import { oc } from "@orpc/contract";
2
+ import { z } from "zod";
3
+
4
+ //#region src/schemas.ts
5
+ const RESERVED_KEYS = [
6
+ "_HANDLER",
7
+ "_X_AMZN_TRACE_ID",
8
+ "AWS_DEFAULT_REGION",
9
+ "AWS_REGION",
10
+ "AWS_EXECUTION_ENV",
11
+ "AWS_LAMBDA_FUNCTION_NAME",
12
+ "AWS_LAMBDA_FUNCTION_MEMORY_SIZE",
13
+ "AWS_LAMBDA_FUNCTION_VERSION",
14
+ "AWS_LAMBDA_INITIALIZATION_TYPE",
15
+ "AWS_LAMBDA_LOG_GROUP_NAME",
16
+ "AWS_ACCESS_KEY",
17
+ "AWS_LAMBDA_RUNTIME_API",
18
+ "LAMBDA_TASK_ROOT",
19
+ "LAMBDA_RUNTIME_DIR",
20
+ "START_COMMAND",
21
+ "ENVIRONMENT_ID",
22
+ "PROJECT_BUILD_IMAGES_REPOSITORY_URI",
23
+ "ENVIRONMENT_LAMBDA_FUNCTION_ARN",
24
+ "SOURCE_REPOSITORY",
25
+ "SOURCE_BRANCH",
26
+ "SOURCE_REPOSITORY_CREDENTIALS",
27
+ "RUNTIME",
28
+ "ROOT_DIRECTORY",
29
+ "BUILD_ARG_INSTALL_COMMAND",
30
+ "BUILD_ARG_BUILD_COMMAND",
31
+ "BUILD_ARG_BUILD_OUTPUT_DIR",
32
+ "BUILD_ARG_START_COMMAND",
33
+ "ALPIC_HOST"
34
+ ];
35
+ const environmentVariableSchema = z.object({
36
+ 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"),
37
+ value: z.string().min(1, "Value is required"),
38
+ isSecret: z.boolean().default(false)
39
+ });
40
+ const environmentVariablesSchema = z.array(environmentVariableSchema);
41
+ const buildSettingsSchema = z.object({
42
+ installCommand: z.string().optional(),
43
+ buildCommand: z.string().optional(),
44
+ buildOutputDir: z.string().optional(),
45
+ startCommand: z.string().optional()
46
+ });
47
+ const runtimeSchema = z.enum([
48
+ "python3.13",
49
+ "python3.14",
50
+ "node22",
51
+ "node24"
52
+ ]);
53
+ const transportSchema = z.enum([
54
+ "stdio",
55
+ "sse",
56
+ "streamablehttp"
57
+ ]);
58
+
59
+ //#endregion
60
+ //#region src/api.contract.ts
61
+ const deploymentStatusSchema = z.enum([
62
+ "ongoing",
63
+ "deployed",
64
+ "failed",
65
+ "canceled"
66
+ ]);
67
+ const latestDeploymentSchema = z.object({
68
+ id: z.string(),
69
+ status: deploymentStatusSchema,
70
+ sourceCommitId: z.string().nullable(),
71
+ sourceCommitMessage: z.string().nullable(),
72
+ completedAt: z.coerce.date().nullable()
73
+ });
74
+ const deploymentSchema = z.object({
75
+ id: z.string(),
76
+ status: deploymentStatusSchema,
77
+ sourceRef: z.string().nullable(),
78
+ sourceCommitId: z.string().nullable(),
79
+ sourceCommitMessage: z.string().nullable(),
80
+ authorUsername: z.string().nullable(),
81
+ authorAvatarUrl: z.string().nullable(),
82
+ startedAt: z.coerce.date().nullable(),
83
+ completedAt: z.coerce.date().nullable()
84
+ });
85
+ const createEnvironmentContractV1 = oc.route({
86
+ path: "/v1/environments",
87
+ method: "POST",
88
+ summary: "Create an environment",
89
+ description: "Create an environment for a project",
90
+ tags: ["environments"],
91
+ successDescription: "The environment has been created successfully"
92
+ }).errors({
93
+ NOT_FOUND: {},
94
+ BAD_REQUEST: {}
95
+ }).input(z.object({
96
+ projectId: z.string().describe("The ID of the project to create the environment for"),
97
+ name: z.string().min(1).describe("The name of the environment"),
98
+ sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
99
+ environmentVariables: environmentVariablesSchema.default([])
100
+ })).output(z.object({
101
+ id: z.string(),
102
+ name: z.string(),
103
+ sourceBranch: z.string().nullable().describe("The branch used to build the environment"),
104
+ urls: z.array(z.string().url()).describe("The URLs of the MCP server"),
105
+ createdAt: z.coerce.date(),
106
+ projectId: z.string().describe("The ID of the project the environment belongs to")
107
+ }));
108
+ const getEnvironmentContractV1 = oc.route({
109
+ path: "/v1/environments/:environmentId",
110
+ method: "GET",
111
+ summary: "Get an environment",
112
+ description: "Get an environment by ID",
113
+ tags: ["environments"],
114
+ successDescription: "The environment details"
115
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.object({
116
+ id: z.string(),
117
+ name: z.string(),
118
+ sourceBranch: z.string().nullable(),
119
+ mcpServerUrl: z.string(),
120
+ domains: z.array(z.url()),
121
+ createdAt: z.coerce.date(),
122
+ projectId: z.string()
123
+ }));
124
+ const productionEnvironmentSchema = z.object({
125
+ id: z.string(),
126
+ name: z.string(),
127
+ mcpServerUrl: z.string(),
128
+ latestDeployment: latestDeploymentSchema.nullable()
129
+ });
130
+ const environmentSchema = z.object({
131
+ id: z.string(),
132
+ name: z.string(),
133
+ sourceBranch: z.string().nullable(),
134
+ mcpServerUrl: z.string(),
135
+ createdAt: z.coerce.date(),
136
+ projectId: z.string(),
137
+ latestDeployment: latestDeploymentSchema.nullable()
138
+ });
139
+ const projectOutputSchema = z.object({
140
+ id: z.string(),
141
+ name: z.string(),
142
+ teamId: z.string(),
143
+ sourceRepository: z.string().nullable(),
144
+ runtime: runtimeSchema,
145
+ transport: transportSchema.nullable(),
146
+ rootDirectory: z.string().nullable(),
147
+ buildCommand: z.string().nullable(),
148
+ buildOutputDir: z.string().nullable(),
149
+ installCommand: z.string().nullable(),
150
+ startCommand: z.string().nullable(),
151
+ createdAt: z.coerce.date(),
152
+ productionEnvironment: productionEnvironmentSchema.nullable(),
153
+ environments: z.array(environmentSchema)
154
+ });
155
+ const getProjectContractV1 = oc.route({
156
+ path: "/v1/projects/:projectId",
157
+ method: "GET",
158
+ summary: "Get a project",
159
+ description: "Get a project by ID",
160
+ tags: ["projects"],
161
+ successDescription: "The project details"
162
+ }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
163
+ const listProjectsContractV1 = oc.route({
164
+ path: "/v1/projects",
165
+ method: "GET",
166
+ summary: "List projects",
167
+ description: "List all projects for a team",
168
+ tags: ["projects"],
169
+ successDescription: "The list of projects"
170
+ }).output(z.array(projectOutputSchema));
171
+ const createProjectContractV1 = oc.route({
172
+ path: "/v1/projects",
173
+ method: "POST",
174
+ summary: "Create a project",
175
+ description: "Create a project for a team",
176
+ tags: ["projects"],
177
+ successDescription: "The project has been created successfully"
178
+ }).errors({
179
+ NOT_FOUND: {},
180
+ BAD_REQUEST: {}
181
+ }).input(z.object({
182
+ name: z.string().min(1).max(100),
183
+ sourceRepository: z.string().optional(),
184
+ branchName: z.string().min(1).optional(),
185
+ runtime: runtimeSchema,
186
+ transport: transportSchema.optional(),
187
+ rootDirectory: z.string().optional(),
188
+ settings: buildSettingsSchema.default({}),
189
+ environmentVariables: environmentVariablesSchema.default([])
190
+ })).output(z.object({
191
+ id: z.string(),
192
+ name: z.string(),
193
+ teamId: z.string(),
194
+ environments: z.array(z.object({
195
+ id: z.string(),
196
+ name: z.string()
197
+ })),
198
+ productionEnvironment: z.object({
199
+ id: z.string(),
200
+ name: z.string()
201
+ }).nullable(),
202
+ sourceRepository: z.string().nullable(),
203
+ runtime: runtimeSchema,
204
+ transport: transportSchema.nullable(),
205
+ rootDirectory: z.string().nullable(),
206
+ buildCommand: z.string().nullable(),
207
+ buildOutputDir: z.string().nullable(),
208
+ installCommand: z.string().nullable(),
209
+ startCommand: z.string().nullable(),
210
+ createdAt: z.coerce.date()
211
+ }));
212
+ const deployEnvironmentContractV1 = oc.route({
213
+ path: "/v1/environments/:environmentId/deploy",
214
+ method: "POST",
215
+ summary: "Deploy an environment",
216
+ description: "Deploy an environment",
217
+ tags: ["environments"],
218
+ successDescription: "The environment has been deployed successfully"
219
+ }).errors({
220
+ NOT_FOUND: {},
221
+ BAD_REQUEST: {}
222
+ }).input(z.object({
223
+ environmentId: z.string().describe("The ID of the environment to deploy"),
224
+ token: z.string().describe("The token to identify the source archive").optional()
225
+ })).output(deploymentSchema);
226
+ const uploadDeploymentArtifactContractV1 = oc.route({
227
+ path: "/v1/deployments/upload",
228
+ method: "POST",
229
+ summary: "Upload deployment artifacts",
230
+ description: "Return a presigned S3 URL to upload a deployment artifact",
231
+ tags: ["deployments"],
232
+ successDescription: "The presigned upload URL has been generated successfully"
233
+ }).output(z.object({
234
+ uploadUrl: z.string().url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
235
+ token: z.string().describe("Token to identify the source archive"),
236
+ expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
237
+ }));
238
+ const getDeploymentContractV1 = oc.route({
239
+ path: "/v1/deployments/:deploymentId",
240
+ method: "GET",
241
+ summary: "Get a deployment",
242
+ description: "Get a deployment by ID",
243
+ tags: ["deployments"],
244
+ successDescription: "The deployment details"
245
+ }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
246
+ const contract = {
247
+ deployments: {
248
+ get: { v1: getDeploymentContractV1 },
249
+ uploadArtifact: { v1: uploadDeploymentArtifactContractV1 }
250
+ },
251
+ environments: {
252
+ create: { v1: createEnvironmentContractV1 },
253
+ get: { v1: getEnvironmentContractV1 },
254
+ deploy: { v1: deployEnvironmentContractV1 }
255
+ },
256
+ projects: {
257
+ get: { v1: getProjectContractV1 },
258
+ list: { v1: listProjectsContractV1 },
259
+ create: { v1: createProjectContractV1 }
260
+ }
261
+ };
262
+
263
+ //#endregion
264
+ export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@alpic-ai/api",
3
+ "version": "0.0.0-dev.36e5073",
4
+ "description": "Contract for the Alpic API",
5
+ "type": "module",
6
+ "main": "./dist/index.mjs",
7
+ "types": "./dist/index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "author": "Alpic",
18
+ "license": "ISC",
19
+ "dependencies": {
20
+ "@orpc/contract": "^1.13.4",
21
+ "zod": "^4.3.6"
22
+ },
23
+ "devDependencies": {
24
+ "@total-typescript/tsconfig": "^1.0.4",
25
+ "biome": "^0.3.3",
26
+ "shx": "^0.4.0",
27
+ "tsdown": "^0.20.1",
28
+ "typescript": "^5.9.3",
29
+ "vitest": "^4.0.18"
30
+ },
31
+ "scripts": {
32
+ "build": "shx rm -rf dist && tsdown",
33
+ "format": "biome check --write --error-on-warnings",
34
+ "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
35
+ "test:unit": "vitest run",
36
+ "test:format": "prettier --check .",
37
+ "test:type": "tsc --noEmit"
38
+ }
39
+ }