@alpic-ai/api 0.0.0-staging.bced96f → 0.0.0-staging.bdeff30
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 +62 -1
- package/dist/index.mjs +77 -8
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ type ApiContext = {
|
|
|
7
7
|
request: Request & {
|
|
8
8
|
teamIds: string[];
|
|
9
9
|
defaultTeamId: string | undefined;
|
|
10
|
+
awsCognitoUserSub: string | undefined;
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
declare const createEnvironmentContractV1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -37,7 +38,6 @@ declare const contract: {
|
|
|
37
38
|
name: z.ZodString;
|
|
38
39
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
39
40
|
hasStripeAccount: z.ZodBoolean;
|
|
40
|
-
hasActiveSubscription: z.ZodBoolean;
|
|
41
41
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
42
42
|
};
|
|
43
43
|
};
|
|
@@ -227,6 +227,58 @@ declare const contract: {
|
|
|
227
227
|
}>, Record<never, never>>;
|
|
228
228
|
};
|
|
229
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
|
+
};
|
|
230
282
|
projects: {
|
|
231
283
|
update: {
|
|
232
284
|
v1: _orpc_contract0.ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -528,6 +580,15 @@ declare const contract: {
|
|
|
528
580
|
}>, Record<never, never>>;
|
|
529
581
|
};
|
|
530
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
|
+
};
|
|
531
592
|
};
|
|
532
593
|
type RouterInput = InferContractRouterInputs<typeof contract>;
|
|
533
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",
|
|
@@ -34,7 +33,8 @@ const RESERVED_KEYS = [
|
|
|
34
33
|
"BUILD_ARG_BUILD_COMMAND",
|
|
35
34
|
"BUILD_ARG_BUILD_OUTPUT_DIR",
|
|
36
35
|
"BUILD_ARG_START_COMMAND",
|
|
37
|
-
"ALPIC_HOST"
|
|
36
|
+
"ALPIC_HOST",
|
|
37
|
+
"ALPIC_CUSTOM_DOMAINS"
|
|
38
38
|
];
|
|
39
39
|
const environmentVariableSchema = z.object({
|
|
40
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"),
|
|
@@ -59,7 +59,6 @@ const transportSchema = z.enum([
|
|
|
59
59
|
"sse",
|
|
60
60
|
"streamablehttp"
|
|
61
61
|
]);
|
|
62
|
-
|
|
63
62
|
//#endregion
|
|
64
63
|
//#region src/api.contract.ts
|
|
65
64
|
const deploymentStatusSchema = z.enum([
|
|
@@ -225,6 +224,59 @@ const createProjectContractV1 = oc.route({
|
|
|
225
224
|
startCommand: z.string().nullable(),
|
|
226
225
|
createdAt: z.coerce.date()
|
|
227
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) }));
|
|
228
280
|
const deleteProjectContractV1 = oc.route({
|
|
229
281
|
path: "/v1/projects/:projectId",
|
|
230
282
|
method: "DELETE",
|
|
@@ -356,9 +408,20 @@ const listTeamsContractV1 = oc.route({
|
|
|
356
408
|
id: z.string(),
|
|
357
409
|
name: z.string(),
|
|
358
410
|
createdAt: z.coerce.date(),
|
|
359
|
-
hasStripeAccount: z.boolean()
|
|
360
|
-
hasActiveSubscription: z.boolean()
|
|
411
|
+
hasStripeAccount: z.boolean()
|
|
361
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
|
+
}));
|
|
362
425
|
const contract = {
|
|
363
426
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
364
427
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
@@ -373,14 +436,20 @@ const contract = {
|
|
|
373
436
|
get: { v1: getEnvironmentContractV1 },
|
|
374
437
|
deploy: { v1: deployEnvironmentContractV1 }
|
|
375
438
|
},
|
|
439
|
+
environmentVariables: {
|
|
440
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
441
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
442
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
443
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
444
|
+
},
|
|
376
445
|
projects: {
|
|
377
446
|
update: { v1: updateProjectContractV1 },
|
|
378
447
|
get: { v1: getProjectContractV1 },
|
|
379
448
|
list: { v1: listProjectsContractV1 },
|
|
380
449
|
create: { v1: createProjectContractV1 },
|
|
381
450
|
delete: { v1: deleteProjectContractV1 }
|
|
382
|
-
}
|
|
451
|
+
},
|
|
452
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } }
|
|
383
453
|
};
|
|
384
|
-
|
|
385
454
|
//#endregion
|
|
386
|
-
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.bdeff30",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
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
|
},
|