@alpic-ai/api 0.0.0-staging.4e5172b → 0.0.0-staging.50c4a2f
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 +59 -2
- package/dist/index.mjs +63 -12
- package/package.json +8 -5
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,12 @@ type ApiContext = {
|
|
|
10
10
|
awsCognitoUserSub: string | undefined;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
declare const deploymentStatusSchema: z.ZodEnum<{
|
|
14
|
+
ongoing: "ongoing";
|
|
15
|
+
deployed: "deployed";
|
|
16
|
+
failed: "failed";
|
|
17
|
+
canceled: "canceled";
|
|
18
|
+
}>;
|
|
13
19
|
declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
14
20
|
projectId: z.ZodString;
|
|
15
21
|
name: z.ZodString;
|
|
@@ -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,51 @@ 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
|
+
};
|
|
229
286
|
};
|
|
230
287
|
environmentVariables: {
|
|
231
288
|
list: {
|
|
@@ -624,4 +681,4 @@ declare const transportSchema: z.ZodEnum<{
|
|
|
624
681
|
}>;
|
|
625
682
|
type Transport = z.infer<typeof transportSchema>;
|
|
626
683
|
//#endregion
|
|
627
|
-
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,4 +1,5 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import ms from "ms";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/schemas.ts
|
|
4
5
|
const RESERVED_KEYS = [
|
|
@@ -83,9 +84,16 @@ const deploymentSchema = z.object({
|
|
|
83
84
|
authorUsername: z.string().nullable(),
|
|
84
85
|
authorAvatarUrl: z.string().nullable(),
|
|
85
86
|
startedAt: z.coerce.date().nullable(),
|
|
86
|
-
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()
|
|
87
92
|
});
|
|
88
|
-
const
|
|
93
|
+
const isValidLogTimeInput = (value) => {
|
|
94
|
+
if (ms(value) !== void 0) return true;
|
|
95
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
96
|
+
};
|
|
89
97
|
const createEnvironmentContractV1 = oc.route({
|
|
90
98
|
path: "/v1/environments",
|
|
91
99
|
method: "POST",
|
|
@@ -313,7 +321,7 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
313
321
|
}).input(z.object({
|
|
314
322
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
315
323
|
token: z.string().describe("The token to identify the source archive").optional()
|
|
316
|
-
})).output(
|
|
324
|
+
})).output(deploymentSchema);
|
|
317
325
|
const uploadDeploymentArtifactContractV1 = oc.route({
|
|
318
326
|
path: "/v1/deployments/upload",
|
|
319
327
|
method: "POST",
|
|
@@ -326,17 +334,18 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
326
334
|
token: z.string().describe("Token to identify the source archive"),
|
|
327
335
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
328
336
|
}));
|
|
329
|
-
const
|
|
337
|
+
const listDeploymentsContractV1 = oc.route({
|
|
330
338
|
path: "/v1/projects/{projectId}/deployments",
|
|
331
339
|
method: "GET",
|
|
332
340
|
summary: "List project deployments",
|
|
333
341
|
description: "List all deployments for a project",
|
|
334
342
|
tags: ["deployments"],
|
|
335
343
|
successDescription: "The list of deployments"
|
|
336
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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));
|
|
340
349
|
const getDeploymentContractV1 = oc.route({
|
|
341
350
|
path: "/v1/deployments/{deploymentId}",
|
|
342
351
|
method: "GET",
|
|
@@ -344,7 +353,48 @@ const getDeploymentContractV1 = oc.route({
|
|
|
344
353
|
description: "Get a deployment by ID",
|
|
345
354
|
tags: ["deployments"],
|
|
346
355
|
successDescription: "The deployment details"
|
|
347
|
-
}).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
|
+
}));
|
|
348
398
|
const getDeploymentLogsContractV1 = oc.route({
|
|
349
399
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
350
400
|
method: "GET",
|
|
@@ -426,7 +476,7 @@ const contract = {
|
|
|
426
476
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
427
477
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
428
478
|
deployments: {
|
|
429
|
-
list: { v1:
|
|
479
|
+
list: { v1: listDeploymentsContractV1 },
|
|
430
480
|
get: { v1: getDeploymentContractV1 },
|
|
431
481
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
432
482
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -434,7 +484,8 @@ const contract = {
|
|
|
434
484
|
environments: {
|
|
435
485
|
create: { v1: createEnvironmentContractV1 },
|
|
436
486
|
get: { v1: getEnvironmentContractV1 },
|
|
437
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
487
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
488
|
+
getLogs: { v1: getLogsContractV1 }
|
|
438
489
|
},
|
|
439
490
|
environmentVariables: {
|
|
440
491
|
list: { v1: listEnvironmentVariablesContractV1 },
|
|
@@ -452,4 +503,4 @@ const contract = {
|
|
|
452
503
|
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
453
504
|
};
|
|
454
505
|
//#endregion
|
|
455
|
-
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.50c4a2f",
|
|
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.7",
|
|
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.21.
|
|
28
|
+
"tsdown": "^0.21.3",
|
|
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
|
}
|