@s-hirano-ist/s-core 1.1.6 → 1.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.
- 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/errors/error-classes.d.ts +83 -3
- package/dist/errors/error-classes.d.ts.map +1 -1
- package/dist/errors/error-classes.js +83 -6
- 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 +7 -5
|
@@ -1,32 +1,220 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { UserId } from "../../common/entities/common-entity";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for validating ISBN identifiers.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Validates that the ISBN is a string of 1-17 characters containing only
|
|
8
|
+
* digits and hyphens. Supports both ISBN-10 and ISBN-13 formats.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const isbn = ISBN.parse("978-4-06-521234-5");
|
|
13
|
+
* const isbn10 = ISBN.parse("4-06-521234-X");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see {@link makeISBN} for factory function
|
|
17
|
+
*/
|
|
18
|
+
export declare const ISBN: z.core.$ZodBranded<z.ZodString, "ISBN">;
|
|
19
|
+
/**
|
|
20
|
+
* Branded type for validated ISBN identifiers.
|
|
21
|
+
*/
|
|
4
22
|
export type ISBN = z.infer<typeof ISBN>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a validated ISBN from a string.
|
|
25
|
+
*
|
|
26
|
+
* @param v - The raw ISBN string
|
|
27
|
+
* @returns A branded ISBN value
|
|
28
|
+
* @throws {ZodError} When validation fails
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const isbn = makeISBN("978-4-06-521234-5");
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
5
35
|
export declare const makeISBN: (v: string) => ISBN;
|
|
6
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Zod schema for validating book titles.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Validates that the title is a non-empty string between 1 and 256 characters.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const title = BookTitle.parse("The Pragmatic Programmer");
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @see {@link makeBookTitle} for factory function
|
|
48
|
+
*/
|
|
49
|
+
export declare const BookTitle: z.core.$ZodBranded<z.ZodString, "BookTitle">;
|
|
50
|
+
/**
|
|
51
|
+
* Branded type for validated book titles.
|
|
52
|
+
*/
|
|
7
53
|
export type BookTitle = z.infer<typeof BookTitle>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a validated BookTitle from a string.
|
|
56
|
+
*
|
|
57
|
+
* @param v - The raw title string
|
|
58
|
+
* @returns A branded BookTitle value
|
|
59
|
+
* @throws {ZodError} When validation fails (empty or exceeds 256 chars)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const title = makeBookTitle("The Pragmatic Programmer");
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
8
66
|
export declare const makeBookTitle: (v: string) => BookTitle;
|
|
9
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Zod schema for Google Books API title.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Optional string for the title fetched from Google Books API.
|
|
72
|
+
* Null values are allowed when no Google Books data is available.
|
|
73
|
+
*
|
|
74
|
+
* @see {@link makeGoogleTitle} for factory function
|
|
75
|
+
*/
|
|
76
|
+
export declare const GoogleTitle: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleTitle">;
|
|
77
|
+
/**
|
|
78
|
+
* Branded type for Google Books API titles.
|
|
79
|
+
*/
|
|
10
80
|
export type GoogleTitle = z.infer<typeof GoogleTitle>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a validated GoogleTitle from a string or null.
|
|
83
|
+
*
|
|
84
|
+
* @param v - The Google Books title, null, or undefined
|
|
85
|
+
* @returns A branded GoogleTitle value
|
|
86
|
+
*/
|
|
11
87
|
export declare const makeGoogleTitle: (v: string | null | undefined) => GoogleTitle;
|
|
12
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Zod schema for Google Books API subtitle.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Optional string for the subtitle fetched from Google Books API.
|
|
93
|
+
*
|
|
94
|
+
* @see {@link makeGoogleSubTitle} for factory function
|
|
95
|
+
*/
|
|
96
|
+
export declare const GoogleSubtitle: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleSubTitle">;
|
|
97
|
+
/**
|
|
98
|
+
* Branded type for Google Books API subtitles.
|
|
99
|
+
*/
|
|
13
100
|
export type GoogleSubtitle = z.infer<typeof GoogleSubtitle>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a validated GoogleSubtitle from a string or null.
|
|
103
|
+
*
|
|
104
|
+
* @param v - The Google Books subtitle, null, or undefined
|
|
105
|
+
* @returns A branded GoogleSubtitle value
|
|
106
|
+
*/
|
|
14
107
|
export declare const makeGoogleSubTitle: (v: string | null | undefined) => GoogleSubtitle;
|
|
15
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Zod schema for Google Books API authors list.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* Array of author names fetched from Google Books API.
|
|
113
|
+
* Null when no author information is available.
|
|
114
|
+
*
|
|
115
|
+
* @see {@link makeGoogleAuthors} for factory function
|
|
116
|
+
*/
|
|
117
|
+
export declare const GoogleAuthors: z.core.$ZodBranded<z.ZodNullable<z.ZodArray<z.ZodString>>, "GoogleAuthors">;
|
|
118
|
+
/**
|
|
119
|
+
* Branded type for Google Books API authors.
|
|
120
|
+
*/
|
|
16
121
|
export type GoogleAuthors = z.infer<typeof GoogleAuthors>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a validated GoogleAuthors from an array or null.
|
|
124
|
+
*
|
|
125
|
+
* @param v - The authors array, null, or undefined
|
|
126
|
+
* @returns A branded GoogleAuthors value
|
|
127
|
+
*/
|
|
17
128
|
export declare const makeGoogleAuthors: (v: string[] | null | undefined) => GoogleAuthors;
|
|
18
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Zod schema for Google Books API description.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* Book description/synopsis fetched from Google Books API.
|
|
134
|
+
*
|
|
135
|
+
* @see {@link makeGoogleDescription} for factory function
|
|
136
|
+
*/
|
|
137
|
+
export declare const GoogleDescription: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleDescription">;
|
|
138
|
+
/**
|
|
139
|
+
* Branded type for Google Books API descriptions.
|
|
140
|
+
*/
|
|
19
141
|
export type GoogleDescription = z.infer<typeof GoogleDescription>;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a validated GoogleDescription from a string or null.
|
|
144
|
+
*
|
|
145
|
+
* @param v - The description, null, or undefined
|
|
146
|
+
* @returns A branded GoogleDescription value
|
|
147
|
+
*/
|
|
20
148
|
export declare const makeGoogleDescription: (v: string | null | undefined) => GoogleDescription;
|
|
21
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Zod schema for Google Books API cover image URL.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* URL to the book cover image from Google Books API.
|
|
154
|
+
*
|
|
155
|
+
* @see {@link makeGoogleImgSrc} for factory function
|
|
156
|
+
*/
|
|
157
|
+
export declare const GoogleImgSrc: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleImgSrc">;
|
|
158
|
+
/**
|
|
159
|
+
* Branded type for Google Books API image URLs.
|
|
160
|
+
*/
|
|
22
161
|
export type GoogleImgSrc = z.infer<typeof GoogleImgSrc>;
|
|
162
|
+
/**
|
|
163
|
+
* Creates a validated GoogleImgSrc from a string or null.
|
|
164
|
+
*
|
|
165
|
+
* @param v - The image URL, null, or undefined
|
|
166
|
+
* @returns A branded GoogleImgSrc value
|
|
167
|
+
*/
|
|
23
168
|
export declare const makeGoogleImgSrc: (v: string | null | undefined) => GoogleImgSrc;
|
|
24
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Zod schema for Google Books API link URL.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* URL to the book's page on Google Books.
|
|
174
|
+
*
|
|
175
|
+
* @see {@link makeGoogleHref} for factory function
|
|
176
|
+
*/
|
|
177
|
+
export declare const GoogleHref: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleHref">;
|
|
178
|
+
/**
|
|
179
|
+
* Branded type for Google Books API links.
|
|
180
|
+
*/
|
|
25
181
|
export type GoogleHref = z.infer<typeof GoogleHref>;
|
|
182
|
+
/**
|
|
183
|
+
* Creates a validated GoogleHref from a string or null.
|
|
184
|
+
*
|
|
185
|
+
* @param v - The link URL, null, or undefined
|
|
186
|
+
* @returns A branded GoogleHref value
|
|
187
|
+
*/
|
|
26
188
|
export declare const makeGoogleHref: (v: string | null | undefined) => GoogleHref;
|
|
27
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Zod schema for book markdown content.
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* Markdown-formatted notes or review content for the book.
|
|
194
|
+
*
|
|
195
|
+
* @see {@link makeBookMarkdown} for factory function
|
|
196
|
+
*/
|
|
197
|
+
export declare const BookMarkdown: z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "BookMarkdown">;
|
|
198
|
+
/**
|
|
199
|
+
* Branded type for book markdown content.
|
|
200
|
+
*/
|
|
28
201
|
export type BookMarkdown = z.infer<typeof BookMarkdown>;
|
|
202
|
+
/**
|
|
203
|
+
* Creates a validated BookMarkdown from a string or null.
|
|
204
|
+
*
|
|
205
|
+
* @param v - The markdown content or null
|
|
206
|
+
* @returns A branded BookMarkdown value
|
|
207
|
+
*/
|
|
29
208
|
export declare const makeBookMarkdown: (v: string | null) => BookMarkdown;
|
|
209
|
+
/**
|
|
210
|
+
* Zod schema for an unexported book.
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* Represents a book that has not yet been published.
|
|
214
|
+
* This is the initial state of all newly created books.
|
|
215
|
+
*
|
|
216
|
+
* @see {@link ExportedBook} for the published state
|
|
217
|
+
*/
|
|
30
218
|
export declare const UnexportedBook: z.ZodObject<{
|
|
31
219
|
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
32
220
|
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
@@ -42,8 +230,23 @@ export declare const UnexportedBook: z.ZodObject<{
|
|
|
42
230
|
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
43
231
|
status: z.ZodLiteral<"UNEXPORTED">;
|
|
44
232
|
}, z.core.$strip>;
|
|
233
|
+
/**
|
|
234
|
+
* Type for an unexported book entity.
|
|
235
|
+
*
|
|
236
|
+
* @remarks
|
|
237
|
+
* Immutable entity representing a book pending export.
|
|
238
|
+
*/
|
|
45
239
|
export type UnexportedBook = Readonly<z.infer<typeof UnexportedBook>>;
|
|
46
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Zod schema for an exported book.
|
|
242
|
+
*
|
|
243
|
+
* @remarks
|
|
244
|
+
* Represents a book that has been published.
|
|
245
|
+
* Includes the exportedAt timestamp.
|
|
246
|
+
*
|
|
247
|
+
* @see {@link UnexportedBook} for the initial state
|
|
248
|
+
*/
|
|
249
|
+
export declare const ExportedBook: z.ZodObject<{
|
|
47
250
|
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
48
251
|
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
49
252
|
ISBN: z.core.$ZodBranded<z.ZodString, "ISBN">;
|
|
@@ -59,15 +262,147 @@ declare const ExportedBook: z.ZodObject<{
|
|
|
59
262
|
status: z.ZodLiteral<"EXPORTED">;
|
|
60
263
|
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
|
|
61
264
|
}, z.core.$strip>;
|
|
62
|
-
|
|
63
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Type for an exported book entity.
|
|
267
|
+
*
|
|
268
|
+
* @remarks
|
|
269
|
+
* Immutable entity representing a published book.
|
|
270
|
+
*/
|
|
271
|
+
export type ExportedBook = Readonly<z.infer<typeof ExportedBook>>;
|
|
272
|
+
/**
|
|
273
|
+
* Zod schema for a book marked for export in the current batch.
|
|
274
|
+
*
|
|
275
|
+
* @remarks
|
|
276
|
+
* Represents a book that has been marked for export but not yet finalized.
|
|
277
|
+
* This intermediate state allows for batch processing with revert capability.
|
|
278
|
+
*
|
|
279
|
+
* @see {@link UnexportedBook} for the initial state
|
|
280
|
+
* @see {@link ExportedBook} for the final state
|
|
281
|
+
*/
|
|
282
|
+
export declare const LastUpdatedBook: z.ZodObject<{
|
|
283
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
284
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
285
|
+
ISBN: z.core.$ZodBranded<z.ZodString, "ISBN">;
|
|
286
|
+
title: z.core.$ZodBranded<z.ZodString, "BookTitle">;
|
|
287
|
+
googleTitle: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleTitle">>;
|
|
288
|
+
googleSubtitle: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleSubTitle">>;
|
|
289
|
+
googleAuthors: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodArray<z.ZodString>>, "GoogleAuthors">>;
|
|
290
|
+
googleDescription: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleDescription">>;
|
|
291
|
+
googleImgSrc: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleImgSrc">>;
|
|
292
|
+
googleHref: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "GoogleHref">>;
|
|
293
|
+
markdown: z.ZodOptional<z.core.$ZodBranded<z.ZodNullable<z.ZodString>, "BookMarkdown">>;
|
|
294
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
295
|
+
status: z.ZodLiteral<"LAST_UPDATED">;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
/**
|
|
298
|
+
* Type for a book marked for export.
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* Immutable entity representing a book in the current export batch.
|
|
302
|
+
* Can be reverted back to UnexportedBook or finalized to ExportedBook.
|
|
303
|
+
*/
|
|
304
|
+
export type LastUpdatedBook = Readonly<z.infer<typeof LastUpdatedBook>>;
|
|
305
|
+
/**
|
|
306
|
+
* Arguments for creating a new book.
|
|
307
|
+
*
|
|
308
|
+
* @remarks
|
|
309
|
+
* Provides the required fields for book creation.
|
|
310
|
+
* The id, createdAt, and status are auto-generated.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const args: CreateBookArgs = {
|
|
315
|
+
* userId: makeUserId("user-123"),
|
|
316
|
+
* ISBN: makeISBN("978-4-06-521234-5"),
|
|
317
|
+
* title: makeBookTitle("The Pragmatic Programmer"),
|
|
318
|
+
* };
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
export type CreateBookArgs = Readonly<{
|
|
322
|
+
/** The user who owns the book */
|
|
64
323
|
userId: UserId;
|
|
324
|
+
/** The book's ISBN identifier */
|
|
65
325
|
ISBN: ISBN;
|
|
326
|
+
/** The book title */
|
|
66
327
|
title: BookTitle;
|
|
67
328
|
}>;
|
|
329
|
+
/**
|
|
330
|
+
* Factory object for Book domain entity operations.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* Provides immutable entity creation following DDD patterns.
|
|
334
|
+
* All returned entities are frozen using Object.freeze().
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* // Create a new unexported book
|
|
339
|
+
* const book = bookEntity.create({
|
|
340
|
+
* userId: makeUserId("user-123"),
|
|
341
|
+
* ISBN: makeISBN("978-4-06-521234-5"),
|
|
342
|
+
* title: makeBookTitle("The Pragmatic Programmer"),
|
|
343
|
+
* });
|
|
344
|
+
*
|
|
345
|
+
* // Export the book (changes status to EXPORTED)
|
|
346
|
+
* const exported = bookEntity.export(book);
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* @see {@link CreateBookArgs} for creation parameters
|
|
350
|
+
*/
|
|
68
351
|
export declare const bookEntity: {
|
|
352
|
+
/**
|
|
353
|
+
* Creates a new unexported book entity.
|
|
354
|
+
*
|
|
355
|
+
* @param args - The creation arguments containing required fields
|
|
356
|
+
* @returns A frozen UnexportedBook instance with generated id and timestamps
|
|
357
|
+
* @throws {InvalidFormatError} When validation of any field fails
|
|
358
|
+
* @throws {UnexpectedError} For unexpected errors during creation
|
|
359
|
+
*/
|
|
69
360
|
create: (args: CreateBookArgs) => UnexportedBook;
|
|
361
|
+
/**
|
|
362
|
+
* Transitions a book from UNEXPORTED to EXPORTED status.
|
|
363
|
+
*
|
|
364
|
+
* @param book - The unexported book to export
|
|
365
|
+
* @returns A frozen ExportedBook with exportedAt timestamp
|
|
366
|
+
* @throws {InvalidFormatError} When the book state is invalid
|
|
367
|
+
* @throws {UnexpectedError} For unexpected errors during export
|
|
368
|
+
*/
|
|
70
369
|
export: (book: UnexportedBook) => ExportedBook;
|
|
370
|
+
/**
|
|
371
|
+
* Marks a book for export in the current batch.
|
|
372
|
+
*
|
|
373
|
+
* @remarks
|
|
374
|
+
* Transitions from UNEXPORTED to LAST_UPDATED status.
|
|
375
|
+
* This allows for batch processing with revert capability.
|
|
376
|
+
*
|
|
377
|
+
* @param book - The unexported book to mark
|
|
378
|
+
* @returns A frozen LastUpdatedBook
|
|
379
|
+
* @throws {InvalidFormatError} When the book state is invalid
|
|
380
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
381
|
+
*/
|
|
382
|
+
markAsLastUpdated: (book: UnexportedBook) => LastUpdatedBook;
|
|
383
|
+
/**
|
|
384
|
+
* Reverts a book from LAST_UPDATED back to UNEXPORTED.
|
|
385
|
+
*
|
|
386
|
+
* @remarks
|
|
387
|
+
* Use this when batch processing fails and needs to be rolled back.
|
|
388
|
+
*
|
|
389
|
+
* @param book - The last updated book to revert
|
|
390
|
+
* @returns A frozen UnexportedBook
|
|
391
|
+
* @throws {InvalidFormatError} When the book state is invalid
|
|
392
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
393
|
+
*/
|
|
394
|
+
revert: (book: LastUpdatedBook) => UnexportedBook;
|
|
395
|
+
/**
|
|
396
|
+
* Finalizes a book from LAST_UPDATED to EXPORTED.
|
|
397
|
+
*
|
|
398
|
+
* @remarks
|
|
399
|
+
* Use this after batch processing succeeds to confirm the export.
|
|
400
|
+
*
|
|
401
|
+
* @param book - The last updated book to finalize
|
|
402
|
+
* @returns A frozen ExportedBook with exportedAt timestamp
|
|
403
|
+
* @throws {InvalidFormatError} When the book state is invalid
|
|
404
|
+
* @throws {UnexpectedError} For unexpected errors
|
|
405
|
+
*/
|
|
406
|
+
finalize: (book: LastUpdatedBook) => ExportedBook;
|
|
71
407
|
};
|
|
72
|
-
export {};
|
|
73
408
|
//# sourceMappingURL=books-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"books-entity.d.ts","sourceRoot":"","sources":["../../../books/entities/books-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"books-entity.d.ts","sourceRoot":"","sources":["../../../books/entities/books-entity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