@pixerate/schemas 1.0.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.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @pixerate/schemas
2
+
3
+ A public, open-source TypeScript and Zod validation schemas package associated with Pixerate and Slopmachine. It contains unified schemas and validation models to ensure absolute API and schema stability across private and public downstream systems.
4
+
5
+ ## Key Features
6
+
7
+ - **Standard Validation Schemas**: Validation schemas for all core capabilities including image/video payloads, job queues, fidelity states, etc.
8
+ - **Unified Aspect Ratios**: Declares the comprehensive 10-option `AspectRatio` union (`1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`) and the video aspect ratios.
9
+ - **Lightweight & Dependency-Free**: Relies only on `zod`. Perfect for browser environments, SDKs, and server-side runtimes alike.
10
+
11
+ ## Structure
12
+
13
+ ```
14
+ src/
15
+ └── index.ts # Unified exports for all Zod schemas & TypeScript types
16
+ ```
17
+
18
+ ## Exported Types & Schemas
19
+
20
+ ### 1. Fidelity
21
+ - **Schema**: `FidelitySchema`
22
+ - **Type**: `Fidelity` (`"outline" | "blocked" | "shaded" | "polished"`)
23
+
24
+ ### 2. Aspect Ratio
25
+ - **Schema**: `AspectRatioSchema`
26
+ - **Type**: `AspectRatio` (10 core orientations supported by current image/video generation models)
27
+
28
+ ### 3. Video Aspect Ratio
29
+ - **Schema**: `VideoAspectRatioSchema`
30
+ - **Type**: `VideoAspectRatio` (`"9:16" | "16:9"`)
31
+
32
+ ### 4. Generation & Transformation Payloads
33
+ - **Image Generation**: `ImageGenerationPayload` (`ImageGenerationSchema`)
34
+ - **Image Transformation**: `ImageTransformationPayload` (`ImageTransformationSchema`)
35
+ - **Video Analysis**: `VideoAnalysisPayload` (`VideoAnalysisSchema`)
36
+
37
+ ---
38
+
39
+ ## Getting Started
40
+
41
+ ### Installation
42
+
43
+ Install via npm once published to your registry:
44
+ ```bash
45
+ npm install @pixerate/schemas
46
+ ```
47
+
48
+ For local development inside monorepos, use standard symlinks or `file:` package.json paths:
49
+ ```json
50
+ "dependencies": {
51
+ "@pixerate/schemas": "file:../pixerate-schemas"
52
+ }
53
+ ```
54
+
55
+ ### Build Instructions
56
+
57
+ Build output compiles to standard ESM target via `tsup`:
58
+ ```bash
59
+ # Install dependencies
60
+ npm install
61
+
62
+ # Build compiled ESM and declaration files
63
+ npm run build
64
+ ```
65
+
66
+ The compiled bundles and types will reside in the `dist/` directory.
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const FidelitySchema: z.ZodEnum<["outline", "blocked", "shaded", "polished"]>;
4
+ type Fidelity = z.infer<typeof FidelitySchema>;
5
+ declare const AspectRatioSchema: z.ZodEnum<["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]>;
6
+ type AspectRatio = z.infer<typeof AspectRatioSchema>;
7
+ declare const VideoAspectRatioSchema: z.ZodEnum<["9:16", "16:9"]>;
8
+ type VideoAspectRatio = z.infer<typeof VideoAspectRatioSchema>;
9
+ declare const ImageGenerationSchema: z.ZodObject<{
10
+ prompt: z.ZodString;
11
+ aspectRatio: z.ZodOptional<z.ZodEnum<["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]>>;
12
+ seed: z.ZodOptional<z.ZodNumber>;
13
+ fidelity: z.ZodOptional<z.ZodEnum<["outline", "blocked", "shaded", "polished"]>>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ prompt: string;
16
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
17
+ seed?: number | undefined;
18
+ fidelity?: "outline" | "blocked" | "shaded" | "polished" | undefined;
19
+ }, {
20
+ prompt: string;
21
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
22
+ seed?: number | undefined;
23
+ fidelity?: "outline" | "blocked" | "shaded" | "polished" | undefined;
24
+ }>;
25
+ type ImageGenerationPayload = z.infer<typeof ImageGenerationSchema>;
26
+ declare const ImageTransformationSchema: z.ZodObject<{
27
+ prompt: z.ZodString;
28
+ changes: z.ZodString;
29
+ aspectRatio: z.ZodOptional<z.ZodEnum<["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]>>;
30
+ seed: z.ZodOptional<z.ZodNumber>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ prompt: string;
33
+ changes: string;
34
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
35
+ seed?: number | undefined;
36
+ }, {
37
+ prompt: string;
38
+ changes: string;
39
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
40
+ seed?: number | undefined;
41
+ }>;
42
+ type ImageTransformationPayload = z.infer<typeof ImageTransformationSchema>;
43
+ declare const VideoAnalysisCategorySchema: z.ZodEnum<["Scenes", "Environments", "Things", "Creatures", "People", "Clothes", "Shapes", "Effects", "Uploads"]>;
44
+ type VideoAnalysisCategory = z.infer<typeof VideoAnalysisCategorySchema>;
45
+ declare const VideoAnalysisSchema: z.ZodObject<{
46
+ title: z.ZodString;
47
+ prompt: z.ZodString;
48
+ category: z.ZodEnum<["Scenes", "Environments", "Things", "Creatures", "People", "Clothes", "Shapes", "Effects", "Uploads"]>;
49
+ fidelity: z.ZodEnum<["outline", "blocked", "shaded", "polished"]>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ prompt: string;
52
+ fidelity: "outline" | "blocked" | "shaded" | "polished";
53
+ title: string;
54
+ category: "Scenes" | "Environments" | "Things" | "Creatures" | "People" | "Clothes" | "Shapes" | "Effects" | "Uploads";
55
+ }, {
56
+ prompt: string;
57
+ fidelity: "outline" | "blocked" | "shaded" | "polished";
58
+ title: string;
59
+ category: "Scenes" | "Environments" | "Things" | "Creatures" | "People" | "Clothes" | "Shapes" | "Effects" | "Uploads";
60
+ }>;
61
+ type VideoAnalysisPayload = z.infer<typeof VideoAnalysisSchema>;
62
+ declare const QueueJobSchema: z.ZodObject<{
63
+ id: z.ZodString;
64
+ type: z.ZodEnum<["text", "image", "video", "analysis"]>;
65
+ status: z.ZodEnum<["queued", "processing", "completed", "failed"]>;
66
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
67
+ createdAt: z.ZodOptional<z.ZodAny>;
68
+ updatedAt: z.ZodOptional<z.ZodAny>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ type: "text" | "image" | "video" | "analysis";
71
+ status: "queued" | "processing" | "completed" | "failed";
72
+ id: string;
73
+ payload?: Record<string, any> | undefined;
74
+ createdAt?: any;
75
+ updatedAt?: any;
76
+ }, {
77
+ type: "text" | "image" | "video" | "analysis";
78
+ status: "queued" | "processing" | "completed" | "failed";
79
+ id: string;
80
+ payload?: Record<string, any> | undefined;
81
+ createdAt?: any;
82
+ updatedAt?: any;
83
+ }>;
84
+ type QueueJob = z.infer<typeof QueueJobSchema>;
85
+
86
+ export { type AspectRatio, AspectRatioSchema, type Fidelity, FidelitySchema, type ImageGenerationPayload, ImageGenerationSchema, type ImageTransformationPayload, ImageTransformationSchema, type QueueJob, QueueJobSchema, type VideoAnalysisCategory, VideoAnalysisCategorySchema, type VideoAnalysisPayload, VideoAnalysisSchema, type VideoAspectRatio, VideoAspectRatioSchema };
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ // src/index.ts
2
+ import { z } from "zod";
3
+ var FidelitySchema = z.enum(["outline", "blocked", "shaded", "polished"]);
4
+ var AspectRatioSchema = z.enum([
5
+ "1:1",
6
+ "2:3",
7
+ "3:2",
8
+ "3:4",
9
+ "4:3",
10
+ "4:5",
11
+ "5:4",
12
+ "9:16",
13
+ "16:9",
14
+ "21:9"
15
+ ]);
16
+ var VideoAspectRatioSchema = z.enum(["9:16", "16:9"]);
17
+ var ImageGenerationSchema = z.object({
18
+ prompt: z.string(),
19
+ aspectRatio: AspectRatioSchema.optional(),
20
+ seed: z.number().int().optional(),
21
+ fidelity: FidelitySchema.optional()
22
+ });
23
+ var ImageTransformationSchema = z.object({
24
+ prompt: z.string(),
25
+ changes: z.string(),
26
+ aspectRatio: AspectRatioSchema.optional(),
27
+ seed: z.number().int().optional()
28
+ });
29
+ var VideoAnalysisCategorySchema = z.enum([
30
+ "Scenes",
31
+ "Environments",
32
+ "Things",
33
+ "Creatures",
34
+ "People",
35
+ "Clothes",
36
+ "Shapes",
37
+ "Effects",
38
+ "Uploads"
39
+ ]);
40
+ var VideoAnalysisSchema = z.object({
41
+ title: z.string(),
42
+ prompt: z.string(),
43
+ category: VideoAnalysisCategorySchema,
44
+ fidelity: FidelitySchema
45
+ });
46
+ var QueueJobSchema = z.object({
47
+ id: z.string(),
48
+ type: z.enum(["text", "image", "video", "analysis"]),
49
+ status: z.enum(["queued", "processing", "completed", "failed"]),
50
+ payload: z.record(z.any()).optional(),
51
+ createdAt: z.any().optional(),
52
+ updatedAt: z.any().optional()
53
+ });
54
+ export {
55
+ AspectRatioSchema,
56
+ FidelitySchema,
57
+ ImageGenerationSchema,
58
+ ImageTransformationSchema,
59
+ QueueJobSchema,
60
+ VideoAnalysisCategorySchema,
61
+ VideoAnalysisSchema,
62
+ VideoAspectRatioSchema
63
+ };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@pixerate/schemas",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "build": "tsup src/index.ts --format esm --dts --clean"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Pixerate/schemas.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Pixerate/schemas/issues"
22
+ },
23
+ "homepage": "https://github.com/Pixerate/schemas#readme",
24
+ "author": "Pixerate",
25
+ "license": "MIT",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "zod": "^3.23.8"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "^5.4.5",
37
+ "tsup": "^8.0.2"
38
+ }
39
+ }