@alpic-ai/api 0.0.0-staging.1ecf87c → 0.0.0-staging.1fa97ff
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 +683 -11
- package/dist/index.mjs +415 -17
- package/package.json +10 -8
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,92 @@ const transportSchema = z.enum([
|
|
|
55
60
|
"sse",
|
|
56
61
|
"streamablehttp"
|
|
57
62
|
]);
|
|
58
|
-
|
|
63
|
+
const analysisStatusSchema = z.enum([
|
|
64
|
+
"pending",
|
|
65
|
+
"partial",
|
|
66
|
+
"completed",
|
|
67
|
+
"failed"
|
|
68
|
+
]);
|
|
69
|
+
const platformSchema = z.enum(["chatgpt", "claudeai"]);
|
|
70
|
+
const checkSeveritySchema = z.enum([
|
|
71
|
+
"error",
|
|
72
|
+
"warning",
|
|
73
|
+
"info"
|
|
74
|
+
]);
|
|
75
|
+
const checkCategorySchema = z.enum([
|
|
76
|
+
"connectivity",
|
|
77
|
+
"tool-metadata",
|
|
78
|
+
"resource-metadata",
|
|
79
|
+
"performance",
|
|
80
|
+
"e2e"
|
|
81
|
+
]);
|
|
82
|
+
const checkScopeSchema = z.enum(["server", "view"]);
|
|
83
|
+
const checkDetailSchema = z.object({
|
|
84
|
+
label: z.string(),
|
|
85
|
+
value: z.string().optional()
|
|
86
|
+
});
|
|
87
|
+
const checkResultSchema = z.object({
|
|
88
|
+
checkId: z.string(),
|
|
89
|
+
status: z.enum([
|
|
90
|
+
"pass",
|
|
91
|
+
"fail",
|
|
92
|
+
"skip",
|
|
93
|
+
"pending"
|
|
94
|
+
]),
|
|
95
|
+
message: z.string(),
|
|
96
|
+
skipReason: z.string().optional(),
|
|
97
|
+
severity: checkSeveritySchema,
|
|
98
|
+
category: checkCategorySchema,
|
|
99
|
+
scope: checkScopeSchema,
|
|
100
|
+
platforms: z.array(platformSchema).readonly().optional(),
|
|
101
|
+
durationMs: z.number(),
|
|
102
|
+
details: z.array(checkDetailSchema).optional(),
|
|
103
|
+
hint: z.object({ text: z.string() }).optional()
|
|
104
|
+
});
|
|
105
|
+
const auditReportSchema = z.object({
|
|
106
|
+
schemaVersion: z.string(),
|
|
107
|
+
auditId: z.string(),
|
|
108
|
+
targetUrl: z.string(),
|
|
109
|
+
startedAt: z.string(),
|
|
110
|
+
completedAt: z.string(),
|
|
111
|
+
durationMs: z.number(),
|
|
112
|
+
results: z.array(checkResultSchema),
|
|
113
|
+
requiresAuth: z.boolean(),
|
|
114
|
+
hasViewSupport: z.boolean(),
|
|
115
|
+
viewPlatforms: z.array(platformSchema).readonly().optional(),
|
|
116
|
+
isReadyForPlatform: z.record(platformSchema, z.boolean()),
|
|
117
|
+
widgetScreenshotKeys: z.object({
|
|
118
|
+
chatgpt: z.string().optional(),
|
|
119
|
+
claudeai: z.string().optional()
|
|
120
|
+
}).optional(),
|
|
121
|
+
widgetScreenshots: z.object({
|
|
122
|
+
chatgpt: z.object({ url: z.string() }).optional(),
|
|
123
|
+
claudeai: z.object({ url: z.string() }).optional()
|
|
124
|
+
}).optional()
|
|
125
|
+
});
|
|
126
|
+
const serverFieldsSchema = z.object({
|
|
127
|
+
$schema: z.string(),
|
|
128
|
+
name: z.string(),
|
|
129
|
+
description: z.string(),
|
|
130
|
+
version: z.string().optional(),
|
|
131
|
+
title: z.string().optional(),
|
|
132
|
+
websiteUrl: z.url().optional(),
|
|
133
|
+
icons: z.array(z.object({
|
|
134
|
+
src: z.url(),
|
|
135
|
+
mimeType: z.string().optional(),
|
|
136
|
+
sizes: z.array(z.string()).optional()
|
|
137
|
+
})).optional(),
|
|
138
|
+
remotes: z.array(z.object({
|
|
139
|
+
type: z.string(),
|
|
140
|
+
url: z.url().optional(),
|
|
141
|
+
headers: z.array(z.object({
|
|
142
|
+
name: z.string(),
|
|
143
|
+
description: z.string(),
|
|
144
|
+
isRequired: z.boolean().optional(),
|
|
145
|
+
isSecret: z.boolean().optional()
|
|
146
|
+
})).optional()
|
|
147
|
+
})).optional()
|
|
148
|
+
});
|
|
59
149
|
//#endregion
|
|
60
150
|
//#region src/api.contract.ts
|
|
61
151
|
const deploymentStatusSchema = z.enum([
|
|
@@ -80,8 +170,16 @@ const deploymentSchema = z.object({
|
|
|
80
170
|
authorUsername: z.string().nullable(),
|
|
81
171
|
authorAvatarUrl: z.string().nullable(),
|
|
82
172
|
startedAt: z.coerce.date().nullable(),
|
|
83
|
-
completedAt: z.coerce.date().nullable()
|
|
173
|
+
completedAt: z.coerce.date().nullable(),
|
|
174
|
+
environmentId: z.string(),
|
|
175
|
+
environmentName: z.string(),
|
|
176
|
+
isCurrent: z.boolean(),
|
|
177
|
+
deploymentPageUrl: z.url().nullable()
|
|
84
178
|
});
|
|
179
|
+
const isValidLogTimeInput = (value) => {
|
|
180
|
+
if (ms(value) !== void 0) return true;
|
|
181
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
182
|
+
};
|
|
85
183
|
const createEnvironmentContractV1 = oc.route({
|
|
86
184
|
path: "/v1/environments",
|
|
87
185
|
method: "POST",
|
|
@@ -106,7 +204,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
106
204
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
107
205
|
}));
|
|
108
206
|
const getEnvironmentContractV1 = oc.route({
|
|
109
|
-
path: "/v1/environments
|
|
207
|
+
path: "/v1/environments/{environmentId}",
|
|
110
208
|
method: "GET",
|
|
111
209
|
summary: "Get an environment",
|
|
112
210
|
description: "Get an environment by ID",
|
|
@@ -121,10 +219,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
219
|
createdAt: z.coerce.date(),
|
|
122
220
|
projectId: z.string()
|
|
123
221
|
}));
|
|
222
|
+
const domainSchema = z.object({
|
|
223
|
+
domain: z.string(),
|
|
224
|
+
status: z.enum([
|
|
225
|
+
"ongoing",
|
|
226
|
+
"deployed",
|
|
227
|
+
"failed"
|
|
228
|
+
]),
|
|
229
|
+
createdAt: z.coerce.date()
|
|
230
|
+
});
|
|
124
231
|
const productionEnvironmentSchema = z.object({
|
|
125
232
|
id: z.string(),
|
|
126
233
|
name: z.string(),
|
|
127
234
|
mcpServerUrl: z.string(),
|
|
235
|
+
domains: z.array(domainSchema),
|
|
128
236
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
237
|
});
|
|
130
238
|
const environmentSchema = z.object({
|
|
@@ -153,7 +261,7 @@ const projectOutputSchema = z.object({
|
|
|
153
261
|
environments: z.array(environmentSchema)
|
|
154
262
|
});
|
|
155
263
|
const getProjectContractV1 = oc.route({
|
|
156
|
-
path: "/v1/projects
|
|
264
|
+
path: "/v1/projects/{projectId}",
|
|
157
265
|
method: "GET",
|
|
158
266
|
summary: "Get a project",
|
|
159
267
|
description: "Get a project by ID",
|
|
@@ -167,7 +275,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
275
|
description: "List all projects for a team",
|
|
168
276
|
tags: ["projects"],
|
|
169
277
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
278
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
279
|
const createProjectContractV1 = oc.route({
|
|
172
280
|
path: "/v1/projects",
|
|
173
281
|
method: "POST",
|
|
@@ -179,7 +287,8 @@ const createProjectContractV1 = oc.route({
|
|
|
179
287
|
NOT_FOUND: {},
|
|
180
288
|
BAD_REQUEST: {}
|
|
181
289
|
}).input(z.object({
|
|
182
|
-
|
|
290
|
+
teamId: z.string().optional(),
|
|
291
|
+
name: z.string().trim().min(1).max(100),
|
|
183
292
|
sourceRepository: z.string().optional(),
|
|
184
293
|
branchName: z.string().min(1).optional(),
|
|
185
294
|
runtime: runtimeSchema,
|
|
@@ -209,8 +318,84 @@ const createProjectContractV1 = oc.route({
|
|
|
209
318
|
startCommand: z.string().nullable(),
|
|
210
319
|
createdAt: z.coerce.date()
|
|
211
320
|
}));
|
|
321
|
+
const environmentVariableOutputSchema = z.object({
|
|
322
|
+
id: z.string(),
|
|
323
|
+
key: z.string(),
|
|
324
|
+
value: z.string(),
|
|
325
|
+
isSecret: z.boolean(),
|
|
326
|
+
createdAt: z.coerce.date()
|
|
327
|
+
});
|
|
328
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
329
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
330
|
+
method: "GET",
|
|
331
|
+
summary: "List environment variables",
|
|
332
|
+
description: "List all environment variables for an environment",
|
|
333
|
+
tags: ["environments"],
|
|
334
|
+
successDescription: "The list of environment variables"
|
|
335
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
336
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
337
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
338
|
+
method: "POST",
|
|
339
|
+
summary: "Add environment variables",
|
|
340
|
+
description: "Add one or more environment variables to an environment",
|
|
341
|
+
tags: ["environments"],
|
|
342
|
+
successDescription: "The environment variables have been added successfully"
|
|
343
|
+
}).errors({
|
|
344
|
+
NOT_FOUND: {},
|
|
345
|
+
BAD_REQUEST: {}
|
|
346
|
+
}).input(z.object({
|
|
347
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
348
|
+
environmentVariables: environmentVariablesSchema
|
|
349
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
350
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
351
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
352
|
+
method: "PATCH",
|
|
353
|
+
summary: "Update an environment variable",
|
|
354
|
+
description: "Update an environment variable by ID",
|
|
355
|
+
tags: ["environments"],
|
|
356
|
+
successDescription: "The environment variable has been updated successfully"
|
|
357
|
+
}).errors({
|
|
358
|
+
NOT_FOUND: {},
|
|
359
|
+
BAD_REQUEST: {}
|
|
360
|
+
}).input(z.object({
|
|
361
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
362
|
+
key: environmentVariableSchema.shape.key,
|
|
363
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
364
|
+
isSecret: environmentVariableSchema.shape.isSecret
|
|
365
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
366
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
367
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
368
|
+
method: "DELETE",
|
|
369
|
+
summary: "Delete an environment variable",
|
|
370
|
+
description: "Delete an environment variable by ID",
|
|
371
|
+
tags: ["environments"],
|
|
372
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
373
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
374
|
+
const deleteProjectContractV1 = oc.route({
|
|
375
|
+
path: "/v1/projects/:projectId",
|
|
376
|
+
method: "DELETE",
|
|
377
|
+
summary: "Delete a project",
|
|
378
|
+
description: "Delete a project and all its environments",
|
|
379
|
+
tags: ["projects"],
|
|
380
|
+
successDescription: "The project has been deleted successfully"
|
|
381
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
382
|
+
const updateProjectContractV1 = oc.route({
|
|
383
|
+
path: "/v1/projects/{projectId}",
|
|
384
|
+
method: "PATCH",
|
|
385
|
+
summary: "Update a project",
|
|
386
|
+
description: "Update project settings",
|
|
387
|
+
tags: ["projects"],
|
|
388
|
+
successDescription: "The project has been updated successfully"
|
|
389
|
+
}).errors({
|
|
390
|
+
NOT_FOUND: {},
|
|
391
|
+
BAD_REQUEST: {}
|
|
392
|
+
}).input(z.object({
|
|
393
|
+
projectId: z.string().describe("The ID of the project"),
|
|
394
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
395
|
+
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
396
|
+
})).output(projectOutputSchema);
|
|
212
397
|
const deployEnvironmentContractV1 = oc.route({
|
|
213
|
-
path: "/v1/environments
|
|
398
|
+
path: "/v1/environments/{environmentId}/deploy",
|
|
214
399
|
method: "POST",
|
|
215
400
|
summary: "Deploy an environment",
|
|
216
401
|
description: "Deploy an environment",
|
|
@@ -230,35 +415,248 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
230
415
|
description: "Return a presigned S3 URL to upload a deployment artifact",
|
|
231
416
|
tags: ["deployments"],
|
|
232
417
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
233
|
-
}).output(z.object({
|
|
234
|
-
uploadUrl: z.
|
|
418
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
419
|
+
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
235
420
|
token: z.string().describe("Token to identify the source archive"),
|
|
236
421
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
237
422
|
}));
|
|
423
|
+
const listDeploymentsContractV1 = oc.route({
|
|
424
|
+
path: "/v1/projects/{projectId}/deployments",
|
|
425
|
+
method: "GET",
|
|
426
|
+
summary: "List project deployments",
|
|
427
|
+
description: "List all deployments for a project",
|
|
428
|
+
tags: ["deployments"],
|
|
429
|
+
successDescription: "The list of deployments"
|
|
430
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
431
|
+
projectId: z.string().describe("The ID of the project"),
|
|
432
|
+
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
433
|
+
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
434
|
+
})).output(z.array(deploymentSchema));
|
|
238
435
|
const getDeploymentContractV1 = oc.route({
|
|
239
|
-
path: "/v1/deployments
|
|
436
|
+
path: "/v1/deployments/{deploymentId}",
|
|
240
437
|
method: "GET",
|
|
241
438
|
summary: "Get a deployment",
|
|
242
439
|
description: "Get a deployment by ID",
|
|
243
440
|
tags: ["deployments"],
|
|
244
441
|
successDescription: "The deployment details"
|
|
245
442
|
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
|
|
443
|
+
const getLogsContractV1 = oc.route({
|
|
444
|
+
path: "/v1/environments/{environmentId}/logs",
|
|
445
|
+
method: "GET",
|
|
446
|
+
summary: "Get logs",
|
|
447
|
+
description: "Get logs for an environment",
|
|
448
|
+
tags: ["environments"],
|
|
449
|
+
successDescription: "The logs"
|
|
450
|
+
}).errors({
|
|
451
|
+
NOT_FOUND: {},
|
|
452
|
+
BAD_REQUEST: {}
|
|
453
|
+
}).input(z.object({
|
|
454
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
455
|
+
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)"),
|
|
456
|
+
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"),
|
|
457
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
458
|
+
level: z.array(z.enum([
|
|
459
|
+
"INFO",
|
|
460
|
+
"ERROR",
|
|
461
|
+
"WARNING",
|
|
462
|
+
"DEBUG"
|
|
463
|
+
])).optional().describe("Filter by log level"),
|
|
464
|
+
search: z.string().optional().describe("Filter pattern to search for in log content"),
|
|
465
|
+
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
466
|
+
})).output(z.object({
|
|
467
|
+
logs: z.array(z.object({
|
|
468
|
+
timestamp: z.coerce.date(),
|
|
469
|
+
type: z.enum([
|
|
470
|
+
"START",
|
|
471
|
+
"END",
|
|
472
|
+
"INFO",
|
|
473
|
+
"ERROR",
|
|
474
|
+
"WARNING",
|
|
475
|
+
"DEBUG"
|
|
476
|
+
]),
|
|
477
|
+
requestId: z.string(),
|
|
478
|
+
content: z.string().optional(),
|
|
479
|
+
method: z.string().optional(),
|
|
480
|
+
durationInMs: z.number().optional()
|
|
481
|
+
})),
|
|
482
|
+
nextToken: z.string().nullable()
|
|
483
|
+
}));
|
|
484
|
+
const getDeploymentLogsContractV1 = oc.route({
|
|
485
|
+
path: "/v1/deployments/{deploymentId}/logs",
|
|
486
|
+
method: "GET",
|
|
487
|
+
summary: "Get deployment logs",
|
|
488
|
+
description: "Get the logs for a deployment",
|
|
489
|
+
tags: ["deployments"],
|
|
490
|
+
successDescription: "The deployment logs"
|
|
491
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(z.object({
|
|
492
|
+
logs: z.array(z.object({
|
|
493
|
+
timestamp: z.coerce.date().optional(),
|
|
494
|
+
content: z.string().optional()
|
|
495
|
+
})),
|
|
496
|
+
hasMoreLogs: z.boolean()
|
|
497
|
+
}));
|
|
498
|
+
const analyticsDataPointSchema = z.object({
|
|
499
|
+
timestamp: z.number(),
|
|
500
|
+
categories: z.record(z.string(), z.unknown())
|
|
501
|
+
});
|
|
502
|
+
const analyticsTimeSeriesSchema = z.object({
|
|
503
|
+
sessions_count: z.array(analyticsDataPointSchema),
|
|
504
|
+
requests_count: z.array(analyticsDataPointSchema),
|
|
505
|
+
requests_latency_mean: z.array(analyticsDataPointSchema),
|
|
506
|
+
tool_errors: z.array(analyticsDataPointSchema),
|
|
507
|
+
mcp_errors: z.array(analyticsDataPointSchema),
|
|
508
|
+
output_token_mean: z.array(analyticsDataPointSchema),
|
|
509
|
+
task_count: z.array(analyticsDataPointSchema)
|
|
510
|
+
});
|
|
511
|
+
const getProjectAnalyticsContractV1 = oc.route({
|
|
512
|
+
path: "/v1/analytics/{projectId}",
|
|
513
|
+
method: "GET",
|
|
514
|
+
summary: "Get project analytics",
|
|
515
|
+
description: "Get analytics data for a project over a time range",
|
|
516
|
+
tags: ["analytics"],
|
|
517
|
+
successDescription: "The project analytics data"
|
|
518
|
+
}).errors({
|
|
519
|
+
NOT_FOUND: {},
|
|
520
|
+
BAD_REQUEST: {}
|
|
521
|
+
}).input(z.object({
|
|
522
|
+
projectId: z.string().describe("The ID of the project"),
|
|
523
|
+
startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
|
|
524
|
+
endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
|
|
525
|
+
timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
|
|
526
|
+
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 744 * 60 * 60 * 1e3, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
|
|
527
|
+
metadata: z.object({
|
|
528
|
+
startTimestamp: z.number(),
|
|
529
|
+
endTimestamp: z.number(),
|
|
530
|
+
timeZone: z.string(),
|
|
531
|
+
startDate: z.coerce.date(),
|
|
532
|
+
interval: z.string()
|
|
533
|
+
}),
|
|
534
|
+
timeSeries: analyticsTimeSeriesSchema
|
|
535
|
+
}));
|
|
536
|
+
const listTeamsContractV1 = oc.route({
|
|
537
|
+
path: "/v1/teams",
|
|
538
|
+
method: "GET",
|
|
539
|
+
summary: "List teams",
|
|
540
|
+
description: "List all teams for the authenticated user",
|
|
541
|
+
tags: ["teams"],
|
|
542
|
+
successDescription: "The list of teams"
|
|
543
|
+
}).output(z.array(z.object({
|
|
544
|
+
id: z.string(),
|
|
545
|
+
name: z.string(),
|
|
546
|
+
createdAt: z.coerce.date(),
|
|
547
|
+
hasStripeAccount: z.boolean()
|
|
548
|
+
})));
|
|
549
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
550
|
+
path: "/v1/tunnels/ticket",
|
|
551
|
+
method: "GET",
|
|
552
|
+
summary: "Get a tunnel ticket",
|
|
553
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
554
|
+
tags: ["tunnels"],
|
|
555
|
+
successDescription: "The tunnel ticket"
|
|
556
|
+
}).output(z.object({
|
|
557
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
558
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
559
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
560
|
+
}));
|
|
561
|
+
const publishServerContractV1 = oc.route({
|
|
562
|
+
path: "/v1/distribution/publish",
|
|
563
|
+
method: "POST",
|
|
564
|
+
summary: "Publish a server to the MCP registry",
|
|
565
|
+
tags: ["distribution"],
|
|
566
|
+
successDescription: "The server has been published successfully"
|
|
567
|
+
}).errors({
|
|
568
|
+
NOT_FOUND: {},
|
|
569
|
+
BAD_REQUEST: {}
|
|
570
|
+
}).input(z.object({
|
|
571
|
+
projectId: z.string(),
|
|
572
|
+
domain: z.string(),
|
|
573
|
+
title: z.string().min(1).max(100),
|
|
574
|
+
description: z.string().min(1).max(100),
|
|
575
|
+
websiteUrl: z.url().max(255).optional(),
|
|
576
|
+
iconSrc: z.url().max(255).optional(),
|
|
577
|
+
dryRun: z.boolean().optional()
|
|
578
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
579
|
+
const getServerInfoContractV1 = oc.route({
|
|
580
|
+
path: "/v1/distribution/get",
|
|
581
|
+
method: "GET",
|
|
582
|
+
summary: "Get server info",
|
|
583
|
+
description: "Get info about a server",
|
|
584
|
+
tags: ["distribution"],
|
|
585
|
+
successDescription: "The server info"
|
|
586
|
+
}).errors({
|
|
587
|
+
NOT_FOUND: {},
|
|
588
|
+
BAD_REQUEST: {}
|
|
589
|
+
}).input(z.object({
|
|
590
|
+
projectId: z.string(),
|
|
591
|
+
domain: z.string()
|
|
592
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
593
|
+
const createBeaconContractV1 = oc.route({
|
|
594
|
+
path: "/v1/beacon/analyses",
|
|
595
|
+
method: "POST",
|
|
596
|
+
summary: "Create a beacon analysis",
|
|
597
|
+
description: "Analyze an MCP server for spec compliance and AI client compatibility",
|
|
598
|
+
tags: ["beacon"],
|
|
599
|
+
successDescription: "The analysis has been created"
|
|
600
|
+
}).errors({
|
|
601
|
+
NOT_FOUND: {},
|
|
602
|
+
BAD_REQUEST: {}
|
|
603
|
+
}).input(z.object({
|
|
604
|
+
targetUrl: z.string().url().describe("The HTTPS URL of the MCP server to analyze"),
|
|
605
|
+
teamId: z.string().optional().describe("The team ID to associate the analysis with"),
|
|
606
|
+
projectId: z.string().optional().describe("The project ID to associate the analysis with")
|
|
607
|
+
})).output(z.object({ id: z.string() }));
|
|
608
|
+
const getBeaconContractV1 = oc.route({
|
|
609
|
+
path: "/v1/beacon/analyses/{analysisId}",
|
|
610
|
+
method: "GET",
|
|
611
|
+
summary: "Get a beacon analysis",
|
|
612
|
+
description: "Get a beacon analysis by ID, including the report if completed",
|
|
613
|
+
tags: ["beacon"],
|
|
614
|
+
successDescription: "The analysis details"
|
|
615
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ analysisId: z.string().describe("The ID of the analysis") })).output(z.object({
|
|
616
|
+
id: z.string(),
|
|
617
|
+
targetUrl: z.string(),
|
|
618
|
+
status: analysisStatusSchema,
|
|
619
|
+
durationMs: z.number().nullable(),
|
|
620
|
+
createdAt: z.coerce.date(),
|
|
621
|
+
report: auditReportSchema.nullable()
|
|
622
|
+
}));
|
|
246
623
|
const contract = {
|
|
624
|
+
teams: { list: { v1: listTeamsContractV1 } },
|
|
625
|
+
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
247
626
|
deployments: {
|
|
627
|
+
list: { v1: listDeploymentsContractV1 },
|
|
248
628
|
get: { v1: getDeploymentContractV1 },
|
|
249
|
-
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 }
|
|
629
|
+
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
630
|
+
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
250
631
|
},
|
|
251
632
|
environments: {
|
|
252
633
|
create: { v1: createEnvironmentContractV1 },
|
|
253
634
|
get: { v1: getEnvironmentContractV1 },
|
|
254
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
635
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
636
|
+
getLogs: { v1: getLogsContractV1 }
|
|
637
|
+
},
|
|
638
|
+
environmentVariables: {
|
|
639
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
640
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
641
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
642
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
255
643
|
},
|
|
256
644
|
projects: {
|
|
645
|
+
update: { v1: updateProjectContractV1 },
|
|
257
646
|
get: { v1: getProjectContractV1 },
|
|
258
647
|
list: { v1: listProjectsContractV1 },
|
|
259
|
-
create: { v1: createProjectContractV1 }
|
|
648
|
+
create: { v1: createProjectContractV1 },
|
|
649
|
+
delete: { v1: deleteProjectContractV1 }
|
|
650
|
+
},
|
|
651
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } },
|
|
652
|
+
distribution: {
|
|
653
|
+
publish: { v1: publishServerContractV1 },
|
|
654
|
+
get: { v1: getServerInfoContractV1 }
|
|
655
|
+
},
|
|
656
|
+
beacon: {
|
|
657
|
+
create: { v1: createBeaconContractV1 },
|
|
658
|
+
get: { v1: getBeaconContractV1 }
|
|
260
659
|
}
|
|
261
660
|
};
|
|
262
|
-
|
|
263
661
|
//#endregion
|
|
264
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
662
|
+
export { analysisStatusSchema, auditReportSchema, buildSettingsSchema, checkDetailSchema, checkResultSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, platformSchema, runtimeSchema, serverFieldsSchema, 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.1fa97ff",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,23 +17,25 @@
|
|
|
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",
|
|
25
|
-
"
|
|
26
|
+
"@types/ms": "^2.1.0",
|
|
26
27
|
"shx": "^0.4.0",
|
|
27
|
-
"tsdown": "^0.
|
|
28
|
+
"tsdown": "^0.21.4",
|
|
28
29
|
"typescript": "^5.9.3",
|
|
29
|
-
"vitest": "^4.0
|
|
30
|
+
"vitest": "^4.1.0"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build": "shx rm -rf dist && tsdown",
|
|
33
|
-
"format": "biome check --write --error-on-warnings",
|
|
34
|
+
"format": "biome check --write --error-on-warnings .",
|
|
34
35
|
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
35
36
|
"test:unit": "vitest run",
|
|
36
|
-
"test:format": "
|
|
37
|
-
"test:type": "tsc --noEmit"
|
|
37
|
+
"test:format": "biome check --error-on-warnings .",
|
|
38
|
+
"test:type": "tsc --noEmit",
|
|
39
|
+
"publish:npm": "pnpm publish --tag \"${NPM_TAG}\" --access public --no-git-checks"
|
|
38
40
|
}
|
|
39
41
|
}
|