@s-hirano-ist/s-core 1.2.0 → 1.3.1
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/articles/entities/article-entity.d.ts +342 -11
- package/dist/articles/entities/article-entity.d.ts.map +1 -1
- package/dist/articles/entities/article-entity.js +295 -9
- package/dist/articles/entities/article-entity.js.map +1 -1
- package/dist/articles/events/article-created-event.d.ts +36 -0
- package/dist/articles/events/article-created-event.d.ts.map +1 -1
- package/dist/articles/events/article-created-event.js +36 -0
- package/dist/articles/events/article-created-event.js.map +1 -1
- package/dist/articles/events/article-deleted-event.d.ts +30 -0
- package/dist/articles/events/article-deleted-event.d.ts.map +1 -1
- package/dist/articles/events/article-deleted-event.js +30 -0
- package/dist/articles/events/article-deleted-event.js.map +1 -1
- package/dist/articles/index.d.ts +33 -0
- package/dist/articles/index.d.ts.map +1 -1
- package/dist/articles/index.js +33 -0
- package/dist/articles/index.js.map +1 -1
- package/dist/articles/repositories/articles-command-repository.interface.d.ts +37 -0
- package/dist/articles/repositories/articles-command-repository.interface.d.ts.map +1 -1
- package/dist/articles/repositories/articles-query-repository.interface.d.ts +53 -0
- package/dist/articles/repositories/articles-query-repository.interface.d.ts.map +1 -1
- package/dist/articles/repositories/category-query-repository.interface.d.ts +29 -0
- package/dist/articles/repositories/category-query-repository.interface.d.ts.map +1 -1
- package/dist/articles/services/articles-domain-service.d.ts +40 -0
- package/dist/articles/services/articles-domain-service.d.ts.map +1 -1
- package/dist/articles/services/articles-domain-service.js +50 -0
- package/dist/articles/services/articles-domain-service.js.map +1 -1
- package/dist/articles/types/cache-strategy.d.ts +19 -0
- package/dist/articles/types/cache-strategy.d.ts.map +1 -1
- package/dist/articles/types/query-params.d.ts +83 -5
- package/dist/articles/types/query-params.d.ts.map +1 -1
- package/dist/articles/types/sort-order.d.ts +12 -0
- package/dist/articles/types/sort-order.d.ts.map +1 -1
- package/dist/books/entities/books-entity.d.ts +348 -13
- package/dist/books/entities/books-entity.d.ts.map +1 -1
- package/dist/books/entities/books-entity.js +296 -11
- package/dist/books/entities/books-entity.js.map +1 -1
- package/dist/books/events/book-created-event.d.ts +32 -0
- package/dist/books/events/book-created-event.d.ts.map +1 -1
- package/dist/books/events/book-created-event.js +32 -0
- package/dist/books/events/book-created-event.js.map +1 -1
- package/dist/books/events/book-deleted-event.d.ts +30 -0
- package/dist/books/events/book-deleted-event.d.ts.map +1 -1
- package/dist/books/events/book-deleted-event.js +30 -0
- package/dist/books/events/book-deleted-event.js.map +1 -1
- package/dist/books/index.d.ts +33 -0
- package/dist/books/index.d.ts.map +1 -1
- package/dist/books/index.js +33 -0
- package/dist/books/index.js.map +1 -1
- package/dist/books/repositories/books-command-repository.interface.d.ts +45 -0
- package/dist/books/repositories/books-command-repository.interface.d.ts.map +1 -1
- package/dist/books/repositories/books-query-repository.interface.d.ts +53 -0
- package/dist/books/repositories/books-query-repository.interface.d.ts.map +1 -1
- package/dist/books/services/books-domain-service.d.ts +40 -0
- package/dist/books/services/books-domain-service.d.ts.map +1 -1
- package/dist/books/services/books-domain-service.js +50 -0
- package/dist/books/services/books-domain-service.js.map +1 -1
- package/dist/books/types/cache-strategy.d.ts +19 -0
- package/dist/books/types/cache-strategy.d.ts.map +1 -1
- package/dist/books/types/query-params.d.ts +44 -3
- package/dist/books/types/query-params.d.ts.map +1 -1
- package/dist/books/types/sort-order.d.ts +12 -0
- package/dist/books/types/sort-order.d.ts.map +1 -1
- package/dist/common/entities/common-entity.d.ts +282 -2
- package/dist/common/entities/common-entity.d.ts.map +1 -1
- package/dist/common/entities/common-entity.js +235 -2
- package/dist/common/entities/common-entity.js.map +1 -1
- package/dist/common/events/base-domain-event.d.ts +32 -0
- package/dist/common/events/base-domain-event.d.ts.map +1 -1
- package/dist/common/events/base-domain-event.js +32 -0
- package/dist/common/events/base-domain-event.js.map +1 -1
- package/dist/common/events/domain-event.interface.d.ts +54 -0
- package/dist/common/events/domain-event.interface.d.ts.map +1 -1
- package/dist/common/events/system-error-event.d.ts +36 -0
- package/dist/common/events/system-error-event.d.ts.map +1 -1
- package/dist/common/events/system-error-event.js +36 -0
- package/dist/common/events/system-error-event.js.map +1 -1
- package/dist/common/events/system-warning-event.d.ts +35 -0
- package/dist/common/events/system-warning-event.d.ts.map +1 -1
- package/dist/common/events/system-warning-event.js +35 -0
- package/dist/common/events/system-warning-event.js.map +1 -1
- package/dist/common/index.d.ts +23 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +23 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/services/entity-factory.d.ts +27 -0
- package/dist/common/services/entity-factory.d.ts.map +1 -1
- package/dist/common/services/entity-factory.js +27 -0
- package/dist/common/services/entity-factory.js.map +1 -1
- package/dist/common/services/id-generator.d.ts +32 -0
- package/dist/common/services/id-generator.d.ts.map +1 -1
- package/dist/common/services/id-generator.js +32 -0
- package/dist/common/services/id-generator.js.map +1 -1
- package/dist/common/types/search-types.d.ts +96 -0
- package/dist/common/types/search-types.d.ts.map +1 -1
- package/dist/errors/error-classes.d.ts +83 -0
- package/dist/errors/error-classes.d.ts.map +1 -1
- package/dist/errors/error-classes.js +83 -0
- package/dist/errors/error-classes.js.map +1 -1
- package/dist/errors/index.d.ts +29 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +29 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/images/entities/image-entity.d.ts +373 -4
- package/dist/images/entities/image-entity.d.ts.map +1 -1
- package/dist/images/entities/image-entity.js +320 -3
- package/dist/images/entities/image-entity.js.map +1 -1
- package/dist/images/events/image-created-event.d.ts +30 -0
- package/dist/images/events/image-created-event.d.ts.map +1 -1
- package/dist/images/events/image-created-event.js +30 -0
- package/dist/images/events/image-created-event.js.map +1 -1
- package/dist/images/events/image-deleted-event.d.ts +30 -0
- package/dist/images/events/image-deleted-event.d.ts.map +1 -1
- package/dist/images/events/image-deleted-event.js +30 -0
- package/dist/images/events/image-deleted-event.js.map +1 -1
- package/dist/images/index.d.ts +35 -0
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +35 -0
- package/dist/images/index.js.map +1 -1
- package/dist/images/repositories/images-command-repository.interface.d.ts +43 -0
- package/dist/images/repositories/images-command-repository.interface.d.ts.map +1 -1
- package/dist/images/repositories/images-query-repository.interface.d.ts +59 -0
- package/dist/images/repositories/images-query-repository.interface.d.ts.map +1 -1
- package/dist/images/services/images-domain-service.d.ts +40 -0
- package/dist/images/services/images-domain-service.d.ts.map +1 -1
- package/dist/images/services/images-domain-service.js +50 -0
- package/dist/images/services/images-domain-service.js.map +1 -1
- package/dist/images/types/cache-strategy.d.ts +19 -0
- package/dist/images/types/cache-strategy.d.ts.map +1 -1
- package/dist/images/types/query-params.d.ts +44 -3
- package/dist/images/types/query-params.d.ts.map +1 -1
- package/dist/images/types/sort-order.d.ts +12 -0
- package/dist/images/types/sort-order.d.ts.map +1 -1
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/notes/entities/note-entity.d.ts +212 -6
- package/dist/notes/entities/note-entity.d.ts.map +1 -1
- package/dist/notes/entities/note-entity.js +182 -4
- package/dist/notes/entities/note-entity.js.map +1 -1
- package/dist/notes/events/note-created-event.d.ts +32 -0
- package/dist/notes/events/note-created-event.d.ts.map +1 -1
- package/dist/notes/events/note-created-event.js +32 -0
- package/dist/notes/events/note-created-event.js.map +1 -1
- package/dist/notes/events/note-deleted-event.d.ts +30 -0
- package/dist/notes/events/note-deleted-event.d.ts.map +1 -1
- package/dist/notes/events/note-deleted-event.js +30 -0
- package/dist/notes/events/note-deleted-event.js.map +1 -1
- package/dist/notes/index.d.ts +32 -0
- package/dist/notes/index.d.ts.map +1 -1
- package/dist/notes/index.js +32 -0
- package/dist/notes/index.js.map +1 -1
- package/dist/notes/repositories/notes-command-repository.interface.d.ts +37 -0
- package/dist/notes/repositories/notes-command-repository.interface.d.ts.map +1 -1
- package/dist/notes/repositories/notes-query-repository.interface.d.ts +53 -0
- package/dist/notes/repositories/notes-query-repository.interface.d.ts.map +1 -1
- package/dist/notes/services/notes-domain-service.d.ts +40 -0
- package/dist/notes/services/notes-domain-service.d.ts.map +1 -1
- package/dist/notes/services/notes-domain-service.js +50 -0
- package/dist/notes/services/notes-domain-service.js.map +1 -1
- package/dist/notes/types/cache-strategy.d.ts +19 -0
- package/dist/notes/types/cache-strategy.d.ts.map +1 -1
- package/dist/notes/types/query-params.d.ts +44 -3
- package/dist/notes/types/query-params.d.ts.map +1 -1
- package/dist/notes/types/sort-order.d.ts +12 -0
- package/dist/notes/types/sort-order.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,57 @@
|
|
|
1
1
|
import sharp from "sharp";
|
|
2
2
|
import z from "zod";
|
|
3
3
|
import { UserId } from "../../common/entities/common-entity";
|
|
4
|
+
/**
|
|
5
|
+
* Zod schema for validating image paths.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Validates that the path is a non-empty string.
|
|
9
|
+
* Paths are stored in MinIO object storage.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const path = Path.parse("01912c9a-image.jpg");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see {@link makePath} for factory function
|
|
17
|
+
*/
|
|
4
18
|
export declare const Path: z.core.$ZodBranded<z.ZodString, "Path">;
|
|
19
|
+
/**
|
|
20
|
+
* Branded type for validated image paths.
|
|
21
|
+
*/
|
|
5
22
|
export type Path = z.infer<typeof Path>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a validated Path from a string.
|
|
25
|
+
*
|
|
26
|
+
* @param v - The raw path or filename string
|
|
27
|
+
* @param sanitizeAndUnique - If true, sanitizes the filename and prepends a UUIDv7
|
|
28
|
+
* @returns A branded Path value
|
|
29
|
+
* @throws {ZodError} When the path is empty
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Create unique path from user-uploaded filename
|
|
34
|
+
* const path = makePath("my image.jpg", true);
|
|
35
|
+
* // Result: "01912c9a-5e8a-7b5c-8a1b-2c3d4e5f6a7b-myimage.jpg"
|
|
36
|
+
*
|
|
37
|
+
* // Use existing path as-is
|
|
38
|
+
* const existingPath = makePath("existing-path.jpg", false);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
6
41
|
export declare const makePath: (v: string, sanitizeAndUnique: boolean) => Path;
|
|
42
|
+
/**
|
|
43
|
+
* Zod schema for validating image content types.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Only allows JPEG, PNG, and GIF formats.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const type = ContentType.parse("image/jpeg");
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @see {@link makeContentType} for factory function
|
|
54
|
+
*/
|
|
7
55
|
export declare const ContentType: z.core.$ZodBranded<z.ZodEnum<{
|
|
8
56
|
"image/jpeg": "image/jpeg";
|
|
9
57
|
"image/png": "image/png";
|
|
@@ -11,24 +59,185 @@ export declare const ContentType: z.core.$ZodBranded<z.ZodEnum<{
|
|
|
11
59
|
jpeg: "jpeg";
|
|
12
60
|
png: "png";
|
|
13
61
|
}>, "ContentType">;
|
|
62
|
+
/**
|
|
63
|
+
* Branded type for validated content types.
|
|
64
|
+
*/
|
|
14
65
|
export type ContentType = z.infer<typeof ContentType>;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a validated ContentType from a string.
|
|
68
|
+
*
|
|
69
|
+
* @param v - The MIME type or format string
|
|
70
|
+
* @returns A branded ContentType value
|
|
71
|
+
* @throws {ZodError} When the content type is not supported
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const type = makeContentType("image/jpeg");
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
15
78
|
export declare const makeContentType: (v: string) => ContentType;
|
|
79
|
+
/**
|
|
80
|
+
* Zod schema for validating file sizes.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* Validates that the size is a non-negative integer up to 100MB.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const size = FileSize.parse(1024 * 1024); // 1MB
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @see {@link makeFileSize} for factory function
|
|
91
|
+
*/
|
|
16
92
|
export declare const FileSize: z.core.$ZodBranded<z.ZodNumber, "FileSize">;
|
|
93
|
+
/**
|
|
94
|
+
* Branded type for validated file sizes.
|
|
95
|
+
*/
|
|
17
96
|
export type FileSize = z.infer<typeof FileSize>;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a validated FileSize from a number.
|
|
99
|
+
*
|
|
100
|
+
* @param v - The file size in bytes
|
|
101
|
+
* @returns A branded FileSize value
|
|
102
|
+
* @throws {ZodError} When the size exceeds 100MB or is negative
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const size = makeFileSize(1024 * 1024); // 1MB
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
18
109
|
export declare const makeFileSize: (v: number) => FileSize;
|
|
110
|
+
/**
|
|
111
|
+
* Zod schema for validating pixel dimensions.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* Validates that the value is a positive integer.
|
|
115
|
+
* Optional to handle cases where dimensions cannot be determined.
|
|
116
|
+
*
|
|
117
|
+
* @see {@link makePixel} for factory function
|
|
118
|
+
*/
|
|
19
119
|
export declare const Pixel: z.core.$ZodBranded<z.ZodOptional<z.ZodNumber>, "Pixel">;
|
|
120
|
+
/**
|
|
121
|
+
* Branded type for validated pixel dimensions.
|
|
122
|
+
*/
|
|
20
123
|
export type Pixel = z.infer<typeof Pixel>;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a validated Pixel from a number.
|
|
126
|
+
*
|
|
127
|
+
* @param v - The pixel dimension value
|
|
128
|
+
* @returns A branded Pixel value
|
|
129
|
+
* @throws {ZodError} When the value is not a positive integer
|
|
130
|
+
*/
|
|
21
131
|
export declare const makePixel: (v: number) => Pixel;
|
|
132
|
+
/**
|
|
133
|
+
* Zod schema for validating image tags.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* Tags are non-empty strings used for organizing images.
|
|
137
|
+
*
|
|
138
|
+
* @see {@link makeTag} for factory function
|
|
139
|
+
*/
|
|
22
140
|
export declare const Tag: z.core.$ZodBranded<z.ZodString, "Tag">;
|
|
141
|
+
/**
|
|
142
|
+
* Branded type for validated tags.
|
|
143
|
+
*/
|
|
23
144
|
export type Tag = z.infer<typeof Tag>;
|
|
145
|
+
/**
|
|
146
|
+
* Creates a validated Tag from a string.
|
|
147
|
+
*
|
|
148
|
+
* @param v - The tag string
|
|
149
|
+
* @returns A branded Tag value
|
|
150
|
+
* @throws {ZodError} When the tag is empty
|
|
151
|
+
*/
|
|
24
152
|
export declare const makeTag: (v: string) => Tag;
|
|
153
|
+
/**
|
|
154
|
+
* Zod schema for validating image descriptions.
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* Optional non-empty string for describing the image content.
|
|
158
|
+
*
|
|
159
|
+
* @see {@link makeDescription} for factory function
|
|
160
|
+
*/
|
|
25
161
|
export declare const Description: z.core.$ZodBranded<z.ZodOptional<z.ZodString>, "Description">;
|
|
162
|
+
/**
|
|
163
|
+
* Branded type for validated descriptions.
|
|
164
|
+
*/
|
|
26
165
|
export type Description = z.infer<typeof Description>;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a validated Description from a string.
|
|
168
|
+
*
|
|
169
|
+
* @param v - The description string
|
|
170
|
+
* @returns A branded Description value
|
|
171
|
+
* @throws {ZodError} When the description is empty
|
|
172
|
+
*/
|
|
27
173
|
export declare const makeDescription: (v: string) => Description;
|
|
174
|
+
/**
|
|
175
|
+
* Converts a File object to a Buffer.
|
|
176
|
+
*
|
|
177
|
+
* @param file - The File object to convert
|
|
178
|
+
* @returns A Buffer containing the file data
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* const buffer = await makeOriginalBuffer(uploadedFile);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
28
185
|
export declare const makeOriginalBuffer: (file: File) => Promise<Buffer<ArrayBuffer>>;
|
|
186
|
+
/**
|
|
187
|
+
* Creates a thumbnail buffer from a File object.
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
* Resizes the image to 192x192 pixels using sharp.
|
|
191
|
+
*
|
|
192
|
+
* @param file - The File object to create a thumbnail from
|
|
193
|
+
* @returns A Buffer containing the thumbnail image data
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const thumbnail = await makeThumbnailBufferFromFile(uploadedFile);
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
29
200
|
export declare const makeThumbnailBufferFromFile: (file: File) => Promise<Buffer<ArrayBufferLike>>;
|
|
201
|
+
/**
|
|
202
|
+
* Creates a thumbnail buffer from an existing Buffer.
|
|
203
|
+
*
|
|
204
|
+
* @remarks
|
|
205
|
+
* Resizes the image to 192x192 pixels using sharp.
|
|
206
|
+
*
|
|
207
|
+
* @param buffer - The Buffer to create a thumbnail from
|
|
208
|
+
* @returns A Buffer containing the thumbnail image data
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const thumbnail = await makeThumbnailBufferFromBuffer(imageBuffer);
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
30
215
|
export declare const makeThumbnailBufferFromBuffer: (buffer: Buffer) => Promise<Buffer<ArrayBufferLike>>;
|
|
216
|
+
/**
|
|
217
|
+
* Extracts metadata from an image buffer.
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* Uses sharp to extract image metadata including dimensions, format, etc.
|
|
221
|
+
*
|
|
222
|
+
* @param buffer - The image buffer to analyze
|
|
223
|
+
* @returns The image metadata from sharp
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const metadata = await makeMetadata(imageBuffer);
|
|
228
|
+
* console.log(metadata.width, metadata.height);
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
31
231
|
export declare const makeMetadata: (buffer: Buffer) => Promise<sharp.Metadata>;
|
|
232
|
+
/**
|
|
233
|
+
* Zod schema for an unexported image.
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
* Represents an image that has not yet been published.
|
|
237
|
+
* This is the initial state of all newly created images.
|
|
238
|
+
*
|
|
239
|
+
* @see {@link ExportedImage} for the published state
|
|
240
|
+
*/
|
|
32
241
|
export declare const UnexportedImage: z.ZodObject<{
|
|
33
242
|
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
34
243
|
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
@@ -48,8 +257,23 @@ export declare const UnexportedImage: z.ZodObject<{
|
|
|
48
257
|
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
49
258
|
status: z.ZodLiteral<"UNEXPORTED">;
|
|
50
259
|
}, z.core.$strip>;
|
|
260
|
+
/**
|
|
261
|
+
* Type for an unexported image entity.
|
|
262
|
+
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* Immutable entity representing an image pending export.
|
|
265
|
+
*/
|
|
51
266
|
export type UnexportedImage = Readonly<z.infer<typeof UnexportedImage>>;
|
|
52
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Zod schema for an exported image.
|
|
269
|
+
*
|
|
270
|
+
* @remarks
|
|
271
|
+
* Represents an image that has been published.
|
|
272
|
+
* Includes the exportedAt timestamp.
|
|
273
|
+
*
|
|
274
|
+
* @see {@link UnexportedImage} for the initial state
|
|
275
|
+
*/
|
|
276
|
+
export declare const ExportedImage: z.ZodObject<{
|
|
53
277
|
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
54
278
|
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
55
279
|
path: z.core.$ZodBranded<z.ZodString, "Path">;
|
|
@@ -69,20 +293,165 @@ declare const ExportedImage: z.ZodObject<{
|
|
|
69
293
|
status: z.ZodLiteral<"EXPORTED">;
|
|
70
294
|
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
|
|
71
295
|
}, z.core.$strip>;
|
|
72
|
-
|
|
73
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Type for an exported image entity.
|
|
298
|
+
*
|
|
299
|
+
* @remarks
|
|
300
|
+
* Immutable entity representing a published image.
|
|
301
|
+
*/
|
|
302
|
+
export type ExportedImage = Readonly<z.infer<typeof ExportedImage>>;
|
|
303
|
+
/**
|
|
304
|
+
* Zod schema for an image marked for export in the current batch.
|
|
305
|
+
*
|
|
306
|
+
* @remarks
|
|
307
|
+
* Represents an image that has been marked for export but not yet finalized.
|
|
308
|
+
* This intermediate state allows for batch processing with revert capability.
|
|
309
|
+
*
|
|
310
|
+
* @see {@link UnexportedImage} for the initial state
|
|
311
|
+
* @see {@link ExportedImage} for the final state
|
|
312
|
+
*/
|
|
313
|
+
export declare const LastUpdatedImage: z.ZodObject<{
|
|
314
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
315
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
316
|
+
path: z.core.$ZodBranded<z.ZodString, "Path">;
|
|
317
|
+
contentType: z.core.$ZodBranded<z.ZodEnum<{
|
|
318
|
+
"image/jpeg": "image/jpeg";
|
|
319
|
+
"image/png": "image/png";
|
|
320
|
+
"image/gif": "image/gif";
|
|
321
|
+
jpeg: "jpeg";
|
|
322
|
+
png: "png";
|
|
323
|
+
}>, "ContentType">;
|
|
324
|
+
fileSize: z.core.$ZodBranded<z.ZodNumber, "FileSize">;
|
|
325
|
+
width: z.core.$ZodBranded<z.ZodOptional<z.ZodNumber>, "Pixel">;
|
|
326
|
+
height: z.core.$ZodBranded<z.ZodOptional<z.ZodNumber>, "Pixel">;
|
|
327
|
+
tags: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "Tag">>>;
|
|
328
|
+
description: z.core.$ZodBranded<z.ZodOptional<z.ZodString>, "Description">;
|
|
329
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
330
|
+
status: z.ZodLiteral<"LAST_UPDATED">;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
/**
|
|
333
|
+
* Type for an image marked for export.
|
|
334
|
+
*
|
|
335
|
+
* @remarks
|
|
336
|
+
* Immutable entity representing an image in the current export batch.
|
|
337
|
+
* Can be reverted back to UnexportedImage or finalized to ExportedImage.
|
|
338
|
+
*/
|
|
339
|
+
export type LastUpdatedImage = Readonly<z.infer<typeof LastUpdatedImage>>;
|
|
340
|
+
/**
|
|
341
|
+
* Arguments for creating a new image.
|
|
342
|
+
*
|
|
343
|
+
* @remarks
|
|
344
|
+
* Provides the required fields for image creation.
|
|
345
|
+
* The id, createdAt, and status are auto-generated.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* const args: CreateImageArgs = {
|
|
350
|
+
* userId: makeUserId("user-123"),
|
|
351
|
+
* path: makePath("image.jpg", true),
|
|
352
|
+
* contentType: makeContentType("image/jpeg"),
|
|
353
|
+
* fileSize: makeFileSize(1024 * 1024),
|
|
354
|
+
* width: makePixel(1920),
|
|
355
|
+
* height: makePixel(1080),
|
|
356
|
+
* };
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
export type CreateImageArgs = Readonly<{
|
|
360
|
+
/** The user who owns the image */
|
|
74
361
|
userId: UserId;
|
|
362
|
+
/** The storage path for the image */
|
|
75
363
|
path: Path;
|
|
364
|
+
/** The MIME type of the image */
|
|
76
365
|
contentType: ContentType;
|
|
366
|
+
/** The file size in bytes */
|
|
77
367
|
fileSize: FileSize;
|
|
368
|
+
/** Optional width in pixels */
|
|
78
369
|
width?: Pixel;
|
|
370
|
+
/** Optional height in pixels */
|
|
79
371
|
height?: Pixel;
|
|
372
|
+
/** Optional tags for organization */
|
|
80
373
|
tags?: Array<Tag>;
|
|
374
|
+
/** Optional description */
|
|
81
375
|
description?: Description;
|
|
82
376
|
}>;
|
|
377
|
+
/**
|
|
378
|
+
* Factory object for Image domain entity operations.
|
|
379
|
+
*
|
|
380
|
+
* @remarks
|
|
381
|
+
* Provides immutable entity creation following DDD patterns.
|
|
382
|
+
* All returned entities are frozen using Object.freeze().
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* // Create a new unexported image
|
|
387
|
+
* const image = imageEntity.create({
|
|
388
|
+
* userId: makeUserId("user-123"),
|
|
389
|
+
* path: makePath("image.jpg", true),
|
|
390
|
+
* contentType: makeContentType("image/jpeg"),
|
|
391
|
+
* fileSize: makeFileSize(1024),
|
|
392
|
+
* });
|
|
393
|
+
*
|
|
394
|
+
* // Export the image (changes status to EXPORTED)
|
|
395
|
+
* const exported = imageEntity.export(image);
|
|
396
|
+
* ```
|
|
397
|
+
*
|
|
398
|
+
* @see {@link CreateImageArgs} for creation parameters
|
|
399
|
+
*/
|
|
83
400
|
export declare const imageEntity: {
|
|
401
|
+
/**
|
|
402
|
+
* Creates a new unexported image entity.
|
|
403
|
+
*
|
|
404
|
+
* @param args - The creation arguments containing required fields
|
|
405
|
+
* @returns A frozen UnexportedImage instance with generated id and timestamps
|
|
406
|
+
* @throws {InvalidFormatError} When validation of any field fails
|
|
407
|
+
* @throws {UnexpectedError} For unexpected errors during creation
|
|
408
|
+
*/
|
|
84
409
|
create: (args: CreateImageArgs) => UnexportedImage;
|
|
410
|
+
/**
|
|
411
|
+
* Transitions an image from UNEXPORTED to EXPORTED status.
|
|
412
|
+
*
|
|
413
|
+
* @param image - The unexported image to export
|
|
414
|
+
* @returns A frozen ExportedImage with exportedAt timestamp
|
|
415
|
+
* @throws {InvalidFormatError} When the image state is invalid
|
|
416
|
+
* @throws {UnexpectedError} For unexpected errors during export
|
|
417
|
+
*/
|
|
85
418
|
export: (image: UnexportedImage) => ExportedImage;
|
|
419
|
+
/**
|
|
420
|
+
* Marks an image for export in the current batch.
|
|
421
|
+
*
|
|
422
|
+
* @remarks
|
|
423
|
+
* Transitions from UNEXPORTED to LAST_UPDATED status.
|
|
424
|
+
* This allows for batch processing with revert capability.
|
|
425
|
+
*
|
|
426
|
+
* @param image - The unexported image to mark
|
|
427
|
+
* @returns A frozen LastUpdatedImage
|
|
428
|
+
* @throws {InvalidFormatError} When the image state is invalid
|
|
429
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
430
|
+
*/
|
|
431
|
+
markAsLastUpdated: (image: UnexportedImage) => LastUpdatedImage;
|
|
432
|
+
/**
|
|
433
|
+
* Reverts an image from LAST_UPDATED back to UNEXPORTED.
|
|
434
|
+
*
|
|
435
|
+
* @remarks
|
|
436
|
+
* Use this when batch processing fails and needs to be rolled back.
|
|
437
|
+
*
|
|
438
|
+
* @param image - The last updated image to revert
|
|
439
|
+
* @returns A frozen UnexportedImage
|
|
440
|
+
* @throws {InvalidFormatError} When the image state is invalid
|
|
441
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
442
|
+
*/
|
|
443
|
+
revert: (image: LastUpdatedImage) => UnexportedImage;
|
|
444
|
+
/**
|
|
445
|
+
* Finalizes an image from LAST_UPDATED to EXPORTED.
|
|
446
|
+
*
|
|
447
|
+
* @remarks
|
|
448
|
+
* Use this after batch processing succeeds to confirm the export.
|
|
449
|
+
*
|
|
450
|
+
* @param image - The last updated image to finalize
|
|
451
|
+
* @returns A frozen ExportedImage with exportedAt timestamp
|
|
452
|
+
* @throws {InvalidFormatError} When the image state is invalid
|
|
453
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
454
|
+
*/
|
|
455
|
+
finalize: (image: LastUpdatedImage) => ExportedImage;
|
|
86
456
|
};
|
|
87
|
-
export {};
|
|
88
457
|
//# sourceMappingURL=image-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-entity.d.ts","sourceRoot":"","sources":["../../../images/entities/image-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"image-entity.d.ts","sourceRoot":"","sources":["../../../images/entities/image-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EASN,MAAM,EACN,MAAM,qCAAqC,CAAC;AAkB7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,yCAAoC,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,mBAAmB,OAAO,KAAG,IAOhE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW;;;;;;kBAEA,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,KAAG,WAAmC,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,6CAKA,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,e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