@alpic-ai/api 0.0.0-staging.4d77f78 → 0.0.0-staging.4e5172b
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 +93 -2
- package/dist/index.mjs +93 -10
- package/package.json +3 -3
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<{
|
|
@@ -36,7 +38,6 @@ declare const contract: {
|
|
|
36
38
|
name: z.ZodString;
|
|
37
39
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
38
40
|
hasStripeAccount: z.ZodBoolean;
|
|
39
|
-
hasActiveSubscription: z.ZodBoolean;
|
|
40
41
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
41
42
|
};
|
|
42
43
|
};
|
|
@@ -226,6 +227,58 @@ declare const contract: {
|
|
|
226
227
|
}>, Record<never, never>>;
|
|
227
228
|
};
|
|
228
229
|
};
|
|
230
|
+
environmentVariables: {
|
|
231
|
+
list: {
|
|
232
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
233
|
+
environmentId: z.ZodString;
|
|
234
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
235
|
+
id: z.ZodString;
|
|
236
|
+
key: z.ZodString;
|
|
237
|
+
value: z.ZodString;
|
|
238
|
+
isSecret: z.ZodBoolean;
|
|
239
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
240
|
+
}, z.core.$strip>>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
241
|
+
NOT_FOUND: {};
|
|
242
|
+
}>, Record<never, never>>;
|
|
243
|
+
};
|
|
244
|
+
create: {
|
|
245
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
246
|
+
environmentId: z.ZodString;
|
|
247
|
+
environmentVariables: z.ZodArray<z.ZodObject<{
|
|
248
|
+
key: z.ZodString;
|
|
249
|
+
value: z.ZodString;
|
|
250
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
+
success: z.ZodLiteral<true>;
|
|
254
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
255
|
+
NOT_FOUND: {};
|
|
256
|
+
BAD_REQUEST: {};
|
|
257
|
+
}>, Record<never, never>>;
|
|
258
|
+
};
|
|
259
|
+
update: {
|
|
260
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
261
|
+
environmentVariableId: z.ZodString;
|
|
262
|
+
key: z.ZodString;
|
|
263
|
+
value: z.ZodOptional<z.ZodString>;
|
|
264
|
+
isSecret: z.ZodDefault<z.ZodBoolean>;
|
|
265
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
266
|
+
success: z.ZodLiteral<true>;
|
|
267
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
268
|
+
NOT_FOUND: {};
|
|
269
|
+
BAD_REQUEST: {};
|
|
270
|
+
}>, Record<never, never>>;
|
|
271
|
+
};
|
|
272
|
+
delete: {
|
|
273
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
274
|
+
environmentVariableId: z.ZodString;
|
|
275
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
276
|
+
success: z.ZodLiteral<true>;
|
|
277
|
+
}, z.core.$strip>, _orpc_contract0.MergedErrorMap<Record<never, never>, {
|
|
278
|
+
NOT_FOUND: {};
|
|
279
|
+
}>, Record<never, never>>;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
229
282
|
projects: {
|
|
230
283
|
update: {
|
|
231
284
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -258,6 +311,15 @@ declare const contract: {
|
|
|
258
311
|
id: z.ZodString;
|
|
259
312
|
name: z.ZodString;
|
|
260
313
|
mcpServerUrl: z.ZodString;
|
|
314
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
315
|
+
domain: z.ZodString;
|
|
316
|
+
status: z.ZodEnum<{
|
|
317
|
+
ongoing: "ongoing";
|
|
318
|
+
deployed: "deployed";
|
|
319
|
+
failed: "failed";
|
|
320
|
+
}>;
|
|
321
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
322
|
+
}, z.core.$strip>>;
|
|
261
323
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
262
324
|
id: z.ZodString;
|
|
263
325
|
status: z.ZodEnum<{
|
|
@@ -325,6 +387,15 @@ declare const contract: {
|
|
|
325
387
|
id: z.ZodString;
|
|
326
388
|
name: z.ZodString;
|
|
327
389
|
mcpServerUrl: z.ZodString;
|
|
390
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
391
|
+
domain: z.ZodString;
|
|
392
|
+
status: z.ZodEnum<{
|
|
393
|
+
ongoing: "ongoing";
|
|
394
|
+
deployed: "deployed";
|
|
395
|
+
failed: "failed";
|
|
396
|
+
}>;
|
|
397
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
398
|
+
}, z.core.$strip>>;
|
|
328
399
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
329
400
|
id: z.ZodString;
|
|
330
401
|
status: z.ZodEnum<{
|
|
@@ -363,7 +434,9 @@ declare const contract: {
|
|
|
363
434
|
}>, Record<never, never>>;
|
|
364
435
|
};
|
|
365
436
|
list: {
|
|
366
|
-
v1: _orpc_contract0.
|
|
437
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{
|
|
438
|
+
teamId: z.ZodOptional<z.ZodString>;
|
|
439
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
367
440
|
id: z.ZodString;
|
|
368
441
|
name: z.ZodString;
|
|
369
442
|
teamId: z.ZodString;
|
|
@@ -389,6 +462,15 @@ declare const contract: {
|
|
|
389
462
|
id: z.ZodString;
|
|
390
463
|
name: z.ZodString;
|
|
391
464
|
mcpServerUrl: z.ZodString;
|
|
465
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
466
|
+
domain: z.ZodString;
|
|
467
|
+
status: z.ZodEnum<{
|
|
468
|
+
ongoing: "ongoing";
|
|
469
|
+
deployed: "deployed";
|
|
470
|
+
failed: "failed";
|
|
471
|
+
}>;
|
|
472
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
473
|
+
}, z.core.$strip>>;
|
|
392
474
|
latestDeployment: z.ZodNullable<z.ZodObject<{
|
|
393
475
|
id: z.ZodString;
|
|
394
476
|
status: z.ZodEnum<{
|
|
@@ -498,6 +580,15 @@ declare const contract: {
|
|
|
498
580
|
}>, Record<never, never>>;
|
|
499
581
|
};
|
|
500
582
|
};
|
|
583
|
+
tunnels: {
|
|
584
|
+
getTicket: {
|
|
585
|
+
v1: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, z.ZodObject<{
|
|
586
|
+
subdomain: z.ZodString;
|
|
587
|
+
ticket: z.ZodString;
|
|
588
|
+
tunnelHost: z.ZodString;
|
|
589
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
590
|
+
};
|
|
591
|
+
};
|
|
501
592
|
};
|
|
502
593
|
type RouterInput = InferContractRouterInputs<typeof contract>;
|
|
503
594
|
type RouterOutput = InferContractRouterOutputs<typeof contract>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/schemas.ts
|
|
5
4
|
const RESERVED_KEYS = [
|
|
6
5
|
"_HANDLER",
|
|
@@ -13,7 +12,11 @@ const RESERVED_KEYS = [
|
|
|
13
12
|
"AWS_LAMBDA_FUNCTION_VERSION",
|
|
14
13
|
"AWS_LAMBDA_INITIALIZATION_TYPE",
|
|
15
14
|
"AWS_LAMBDA_LOG_GROUP_NAME",
|
|
15
|
+
"AWS_LAMBDA_LOG_STREAM_NAME",
|
|
16
16
|
"AWS_ACCESS_KEY",
|
|
17
|
+
"AWS_ACCESS_KEY_ID",
|
|
18
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
19
|
+
"AWS_SESSION_TOKEN",
|
|
17
20
|
"AWS_LAMBDA_RUNTIME_API",
|
|
18
21
|
"LAMBDA_TASK_ROOT",
|
|
19
22
|
"LAMBDA_RUNTIME_DIR",
|
|
@@ -30,7 +33,8 @@ const RESERVED_KEYS = [
|
|
|
30
33
|
"BUILD_ARG_BUILD_COMMAND",
|
|
31
34
|
"BUILD_ARG_BUILD_OUTPUT_DIR",
|
|
32
35
|
"BUILD_ARG_START_COMMAND",
|
|
33
|
-
"ALPIC_HOST"
|
|
36
|
+
"ALPIC_HOST",
|
|
37
|
+
"ALPIC_CUSTOM_DOMAINS"
|
|
34
38
|
];
|
|
35
39
|
const environmentVariableSchema = z.object({
|
|
36
40
|
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 +59,6 @@ const transportSchema = z.enum([
|
|
|
55
59
|
"sse",
|
|
56
60
|
"streamablehttp"
|
|
57
61
|
]);
|
|
58
|
-
|
|
59
62
|
//#endregion
|
|
60
63
|
//#region src/api.contract.ts
|
|
61
64
|
const deploymentStatusSchema = z.enum([
|
|
@@ -122,10 +125,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
122
125
|
createdAt: z.coerce.date(),
|
|
123
126
|
projectId: z.string()
|
|
124
127
|
}));
|
|
128
|
+
const domainSchema = z.object({
|
|
129
|
+
domain: z.string(),
|
|
130
|
+
status: z.enum([
|
|
131
|
+
"ongoing",
|
|
132
|
+
"deployed",
|
|
133
|
+
"failed"
|
|
134
|
+
]),
|
|
135
|
+
createdAt: z.coerce.date()
|
|
136
|
+
});
|
|
125
137
|
const productionEnvironmentSchema = z.object({
|
|
126
138
|
id: z.string(),
|
|
127
139
|
name: z.string(),
|
|
128
140
|
mcpServerUrl: z.string(),
|
|
141
|
+
domains: z.array(domainSchema),
|
|
129
142
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
130
143
|
});
|
|
131
144
|
const environmentSchema = z.object({
|
|
@@ -168,7 +181,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
168
181
|
description: "List all projects for a team",
|
|
169
182
|
tags: ["projects"],
|
|
170
183
|
successDescription: "The list of projects"
|
|
171
|
-
}).output(z.array(projectOutputSchema));
|
|
184
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
172
185
|
const createProjectContractV1 = oc.route({
|
|
173
186
|
path: "/v1/projects",
|
|
174
187
|
method: "POST",
|
|
@@ -181,7 +194,7 @@ const createProjectContractV1 = oc.route({
|
|
|
181
194
|
BAD_REQUEST: {}
|
|
182
195
|
}).input(z.object({
|
|
183
196
|
teamId: z.string().optional(),
|
|
184
|
-
name: z.string().min(1).max(100),
|
|
197
|
+
name: z.string().trim().min(1).max(100),
|
|
185
198
|
sourceRepository: z.string().optional(),
|
|
186
199
|
branchName: z.string().min(1).optional(),
|
|
187
200
|
runtime: runtimeSchema,
|
|
@@ -211,6 +224,59 @@ const createProjectContractV1 = oc.route({
|
|
|
211
224
|
startCommand: z.string().nullable(),
|
|
212
225
|
createdAt: z.coerce.date()
|
|
213
226
|
}));
|
|
227
|
+
const environmentVariableOutputSchema = z.object({
|
|
228
|
+
id: z.string(),
|
|
229
|
+
key: z.string(),
|
|
230
|
+
value: z.string(),
|
|
231
|
+
isSecret: z.boolean(),
|
|
232
|
+
createdAt: z.coerce.date()
|
|
233
|
+
});
|
|
234
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
235
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
236
|
+
method: "GET",
|
|
237
|
+
summary: "List environment variables",
|
|
238
|
+
description: "List all environment variables for an environment",
|
|
239
|
+
tags: ["environments"],
|
|
240
|
+
successDescription: "The list of environment variables"
|
|
241
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
242
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
243
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
244
|
+
method: "POST",
|
|
245
|
+
summary: "Add environment variables",
|
|
246
|
+
description: "Add one or more environment variables to an environment",
|
|
247
|
+
tags: ["environments"],
|
|
248
|
+
successDescription: "The environment variables have been added successfully"
|
|
249
|
+
}).errors({
|
|
250
|
+
NOT_FOUND: {},
|
|
251
|
+
BAD_REQUEST: {}
|
|
252
|
+
}).input(z.object({
|
|
253
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
254
|
+
environmentVariables: environmentVariablesSchema
|
|
255
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
256
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
257
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
258
|
+
method: "PATCH",
|
|
259
|
+
summary: "Update an environment variable",
|
|
260
|
+
description: "Update an environment variable by ID",
|
|
261
|
+
tags: ["environments"],
|
|
262
|
+
successDescription: "The environment variable has been updated successfully"
|
|
263
|
+
}).errors({
|
|
264
|
+
NOT_FOUND: {},
|
|
265
|
+
BAD_REQUEST: {}
|
|
266
|
+
}).input(z.object({
|
|
267
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
268
|
+
key: environmentVariableSchema.shape.key,
|
|
269
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
270
|
+
isSecret: environmentVariableSchema.shape.isSecret
|
|
271
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
272
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
273
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
274
|
+
method: "DELETE",
|
|
275
|
+
summary: "Delete an environment variable",
|
|
276
|
+
description: "Delete an environment variable by ID",
|
|
277
|
+
tags: ["environments"],
|
|
278
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
279
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
214
280
|
const deleteProjectContractV1 = oc.route({
|
|
215
281
|
path: "/v1/projects/:projectId",
|
|
216
282
|
method: "DELETE",
|
|
@@ -342,9 +408,20 @@ const listTeamsContractV1 = oc.route({
|
|
|
342
408
|
id: z.string(),
|
|
343
409
|
name: z.string(),
|
|
344
410
|
createdAt: z.coerce.date(),
|
|
345
|
-
hasStripeAccount: z.boolean()
|
|
346
|
-
hasActiveSubscription: z.boolean()
|
|
411
|
+
hasStripeAccount: z.boolean()
|
|
347
412
|
})));
|
|
413
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
414
|
+
path: "/v1/tunnels/ticket",
|
|
415
|
+
method: "GET",
|
|
416
|
+
summary: "Get a tunnel ticket",
|
|
417
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
418
|
+
tags: ["tunnels"],
|
|
419
|
+
successDescription: "The tunnel ticket"
|
|
420
|
+
}).output(z.object({
|
|
421
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
422
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
423
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
424
|
+
}));
|
|
348
425
|
const contract = {
|
|
349
426
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
350
427
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
@@ -359,14 +436,20 @@ const contract = {
|
|
|
359
436
|
get: { v1: getEnvironmentContractV1 },
|
|
360
437
|
deploy: { v1: deployEnvironmentContractV1 }
|
|
361
438
|
},
|
|
439
|
+
environmentVariables: {
|
|
440
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
441
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
442
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
443
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
444
|
+
},
|
|
362
445
|
projects: {
|
|
363
446
|
update: { v1: updateProjectContractV1 },
|
|
364
447
|
get: { v1: getProjectContractV1 },
|
|
365
448
|
list: { v1: listProjectsContractV1 },
|
|
366
449
|
create: { v1: createProjectContractV1 },
|
|
367
450
|
delete: { v1: deleteProjectContractV1 }
|
|
368
|
-
}
|
|
451
|
+
},
|
|
452
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
369
453
|
};
|
|
370
|
-
|
|
371
454
|
//#endregion
|
|
372
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
455
|
+
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.4e5172b",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"author": "Alpic",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orpc/contract": "^1.13.
|
|
20
|
+
"@orpc/contract": "^1.13.6",
|
|
21
21
|
"zod": "^4.3.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
25
25
|
"shx": "^0.4.0",
|
|
26
|
-
"tsdown": "^0.
|
|
26
|
+
"tsdown": "^0.21.1",
|
|
27
27
|
"typescript": "^5.9.3",
|
|
28
28
|
"vitest": "^4.0.18"
|
|
29
29
|
},
|