@electr0zed/test-results-dashboard-api-types 0.3.0

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,9 @@
1
+ export declare const ErrorCode: {
2
+ readonly ValidationError: "VALIDATION_ERROR";
3
+ readonly Unauthorized: "UNAUTHORIZED";
4
+ readonly Forbidden: "FORBIDDEN";
5
+ readonly NotFound: "NOT_FOUND";
6
+ readonly AlreadyExists: "ALREADY_EXISTS";
7
+ readonly InternalServerError: "INTERNAL_SERVER_ERROR";
8
+ };
9
+ export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
package/dist/errors.js ADDED
@@ -0,0 +1,8 @@
1
+ export const ErrorCode = {
2
+ ValidationError: 'VALIDATION_ERROR',
3
+ Unauthorized: 'UNAUTHORIZED',
4
+ Forbidden: 'FORBIDDEN',
5
+ NotFound: 'NOT_FOUND',
6
+ AlreadyExists: 'ALREADY_EXISTS',
7
+ InternalServerError: 'INTERNAL_SERVER_ERROR',
8
+ };
@@ -0,0 +1,3 @@
1
+ export * from './response.js';
2
+ export * from './errors.js';
3
+ export * from './projects.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './response.js';
2
+ export * from './errors.js';
3
+ export * from './projects.js';
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export declare const ProjectSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ publicId: z.ZodUUID;
5
+ name: z.ZodString;
6
+ active: z.ZodBoolean;
7
+ createdAt: z.ZodCoercedDate<unknown>;
8
+ updatedAt: z.ZodCoercedDate<unknown>;
9
+ }, z.core.$strip>;
10
+ export type Project = z.infer<typeof ProjectSchema>;
11
+ export declare const GetProjectSchema: z.ZodObject<{
12
+ publicId: z.ZodUUID;
13
+ }, z.core.$strip>;
14
+ export type GetProject = z.infer<typeof GetProjectSchema>;
15
+ export declare const CreateProjectSchema: z.ZodObject<{
16
+ name: z.ZodString;
17
+ }, z.core.$strip>;
18
+ export type CreateProject = z.infer<typeof CreateProjectSchema>;
19
+ export declare const EditProjectSchema: z.ZodObject<{
20
+ name: z.ZodOptional<z.ZodString>;
21
+ active: z.ZodOptional<z.ZodBoolean>;
22
+ }, z.core.$strip>;
23
+ export type EditProject = z.infer<typeof EditProjectSchema>;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export const ProjectSchema = z.object({
3
+ id: z.number(),
4
+ publicId: z.uuid(),
5
+ name: z.string(),
6
+ active: z.boolean(),
7
+ createdAt: z.coerce.date(),
8
+ updatedAt: z.coerce.date(),
9
+ });
10
+ export const GetProjectSchema = z.object({
11
+ publicId: z.uuid(),
12
+ });
13
+ export const CreateProjectSchema = z.object({
14
+ name: z.string().min(1, { message: 'Project name is required' }),
15
+ });
16
+ export const EditProjectSchema = z.object({
17
+ name: z.string().min(1, { message: 'Project name is required' }).optional(),
18
+ active: z.boolean().optional(),
19
+ });
@@ -0,0 +1,25 @@
1
+ import type { ErrorCode } from "./errors.js";
2
+ export type ApiSuccess<T> = {
3
+ success: true;
4
+ data: T;
5
+ meta?: ApiMeta;
6
+ };
7
+ export type ApiFailure = {
8
+ success: false;
9
+ error: ApiError;
10
+ };
11
+ export type ApiResponse<T> = ApiSuccess<T> | ApiFailure;
12
+ export type ApiMeta = {
13
+ pagination?: PaginationMeta;
14
+ };
15
+ export type PaginationMeta = {
16
+ page: number;
17
+ pageSize: number;
18
+ total: number;
19
+ totalPages: number;
20
+ };
21
+ export type ApiError = {
22
+ code: ErrorCode;
23
+ message: string;
24
+ details?: unknown;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@electr0zed/test-results-dashboard-api-types",
3
+ "version": "0.3.0",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "test": "echo \"Error: no test specified\" && exit 1",
21
+ "build": "tsc -p tsconfig.json",
22
+ "clean": "rimraf dist"
23
+ },
24
+ "devDependencies": {
25
+ "rimraf": "^6.1.3",
26
+ "typescript": "^5.9.3"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/ELECTR0ZED/test-results-dashboard.git"
31
+ },
32
+ "dependencies": {
33
+ "zod": "^4.4.1"
34
+ }
35
+ }