@s-hirano-ist/s-core 1.2.0 → 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.
Files changed (166) hide show
  1. package/dist/articles/entities/article-entity.d.ts +342 -11
  2. package/dist/articles/entities/article-entity.d.ts.map +1 -1
  3. package/dist/articles/entities/article-entity.js +295 -9
  4. package/dist/articles/entities/article-entity.js.map +1 -1
  5. package/dist/articles/events/article-created-event.d.ts +36 -0
  6. package/dist/articles/events/article-created-event.d.ts.map +1 -1
  7. package/dist/articles/events/article-created-event.js +36 -0
  8. package/dist/articles/events/article-created-event.js.map +1 -1
  9. package/dist/articles/events/article-deleted-event.d.ts +30 -0
  10. package/dist/articles/events/article-deleted-event.d.ts.map +1 -1
  11. package/dist/articles/events/article-deleted-event.js +30 -0
  12. package/dist/articles/events/article-deleted-event.js.map +1 -1
  13. package/dist/articles/index.d.ts +33 -0
  14. package/dist/articles/index.d.ts.map +1 -1
  15. package/dist/articles/index.js +33 -0
  16. package/dist/articles/index.js.map +1 -1
  17. package/dist/articles/repositories/articles-command-repository.interface.d.ts +37 -0
  18. package/dist/articles/repositories/articles-command-repository.interface.d.ts.map +1 -1
  19. package/dist/articles/repositories/articles-query-repository.interface.d.ts +53 -0
  20. package/dist/articles/repositories/articles-query-repository.interface.d.ts.map +1 -1
  21. package/dist/articles/repositories/category-query-repository.interface.d.ts +29 -0
  22. package/dist/articles/repositories/category-query-repository.interface.d.ts.map +1 -1
  23. package/dist/articles/services/articles-domain-service.d.ts +40 -0
  24. package/dist/articles/services/articles-domain-service.d.ts.map +1 -1
  25. package/dist/articles/services/articles-domain-service.js +50 -0
  26. package/dist/articles/services/articles-domain-service.js.map +1 -1
  27. package/dist/articles/types/cache-strategy.d.ts +19 -0
  28. package/dist/articles/types/cache-strategy.d.ts.map +1 -1
  29. package/dist/articles/types/query-params.d.ts +83 -5
  30. package/dist/articles/types/query-params.d.ts.map +1 -1
  31. package/dist/articles/types/sort-order.d.ts +12 -0
  32. package/dist/articles/types/sort-order.d.ts.map +1 -1
  33. package/dist/books/entities/books-entity.d.ts +348 -13
  34. package/dist/books/entities/books-entity.d.ts.map +1 -1
  35. package/dist/books/entities/books-entity.js +296 -11
  36. package/dist/books/entities/books-entity.js.map +1 -1
  37. package/dist/books/events/book-created-event.d.ts +32 -0
  38. package/dist/books/events/book-created-event.d.ts.map +1 -1
  39. package/dist/books/events/book-created-event.js +32 -0
  40. package/dist/books/events/book-created-event.js.map +1 -1
  41. package/dist/books/events/book-deleted-event.d.ts +30 -0
  42. package/dist/books/events/book-deleted-event.d.ts.map +1 -1
  43. package/dist/books/events/book-deleted-event.js +30 -0
  44. package/dist/books/events/book-deleted-event.js.map +1 -1
  45. package/dist/books/index.d.ts +33 -0
  46. package/dist/books/index.d.ts.map +1 -1
  47. package/dist/books/index.js +33 -0
  48. package/dist/books/index.js.map +1 -1
  49. package/dist/books/repositories/books-command-repository.interface.d.ts +45 -0
  50. package/dist/books/repositories/books-command-repository.interface.d.ts.map +1 -1
  51. package/dist/books/repositories/books-query-repository.interface.d.ts +53 -0
  52. package/dist/books/repositories/books-query-repository.interface.d.ts.map +1 -1
  53. package/dist/books/services/books-domain-service.d.ts +40 -0
  54. package/dist/books/services/books-domain-service.d.ts.map +1 -1
  55. package/dist/books/services/books-domain-service.js +50 -0
  56. package/dist/books/services/books-domain-service.js.map +1 -1
  57. package/dist/books/types/cache-strategy.d.ts +19 -0
  58. package/dist/books/types/cache-strategy.d.ts.map +1 -1
  59. package/dist/books/types/query-params.d.ts +44 -3
  60. package/dist/books/types/query-params.d.ts.map +1 -1
  61. package/dist/books/types/sort-order.d.ts +12 -0
  62. package/dist/books/types/sort-order.d.ts.map +1 -1
  63. package/dist/common/entities/common-entity.d.ts +282 -2
  64. package/dist/common/entities/common-entity.d.ts.map +1 -1
  65. package/dist/common/entities/common-entity.js +235 -2
  66. package/dist/common/entities/common-entity.js.map +1 -1
  67. package/dist/common/events/base-domain-event.d.ts +32 -0
  68. package/dist/common/events/base-domain-event.d.ts.map +1 -1
  69. package/dist/common/events/base-domain-event.js +32 -0
  70. package/dist/common/events/base-domain-event.js.map +1 -1
  71. package/dist/common/events/domain-event.interface.d.ts +54 -0
  72. package/dist/common/events/domain-event.interface.d.ts.map +1 -1
  73. package/dist/common/events/system-error-event.d.ts +36 -0
  74. package/dist/common/events/system-error-event.d.ts.map +1 -1
  75. package/dist/common/events/system-error-event.js +36 -0
  76. package/dist/common/events/system-error-event.js.map +1 -1
  77. package/dist/common/events/system-warning-event.d.ts +35 -0
  78. package/dist/common/events/system-warning-event.d.ts.map +1 -1
  79. package/dist/common/events/system-warning-event.js +35 -0
  80. package/dist/common/events/system-warning-event.js.map +1 -1
  81. package/dist/common/index.d.ts +23 -0
  82. package/dist/common/index.d.ts.map +1 -1
  83. package/dist/common/index.js +23 -0
  84. package/dist/common/index.js.map +1 -1
  85. package/dist/common/services/entity-factory.d.ts +27 -0
  86. package/dist/common/services/entity-factory.d.ts.map +1 -1
  87. package/dist/common/services/entity-factory.js +27 -0
  88. package/dist/common/services/entity-factory.js.map +1 -1
  89. package/dist/common/services/id-generator.d.ts +32 -0
  90. package/dist/common/services/id-generator.d.ts.map +1 -1
  91. package/dist/common/services/id-generator.js +32 -0
  92. package/dist/common/services/id-generator.js.map +1 -1
  93. package/dist/errors/error-classes.d.ts +83 -0
  94. package/dist/errors/error-classes.d.ts.map +1 -1
  95. package/dist/errors/error-classes.js +83 -0
  96. package/dist/errors/error-classes.js.map +1 -1
  97. package/dist/errors/index.d.ts +29 -0
  98. package/dist/errors/index.d.ts.map +1 -1
  99. package/dist/errors/index.js +29 -0
  100. package/dist/errors/index.js.map +1 -1
  101. package/dist/images/entities/image-entity.d.ts +373 -4
  102. package/dist/images/entities/image-entity.d.ts.map +1 -1
  103. package/dist/images/entities/image-entity.js +320 -3
  104. package/dist/images/entities/image-entity.js.map +1 -1
  105. package/dist/images/events/image-created-event.d.ts +30 -0
  106. package/dist/images/events/image-created-event.d.ts.map +1 -1
  107. package/dist/images/events/image-created-event.js +30 -0
  108. package/dist/images/events/image-created-event.js.map +1 -1
  109. package/dist/images/events/image-deleted-event.d.ts +30 -0
  110. package/dist/images/events/image-deleted-event.d.ts.map +1 -1
  111. package/dist/images/events/image-deleted-event.js +30 -0
  112. package/dist/images/events/image-deleted-event.js.map +1 -1
  113. package/dist/images/index.d.ts +35 -0
  114. package/dist/images/index.d.ts.map +1 -1
  115. package/dist/images/index.js +35 -0
  116. package/dist/images/index.js.map +1 -1
  117. package/dist/images/repositories/images-command-repository.interface.d.ts +43 -0
  118. package/dist/images/repositories/images-command-repository.interface.d.ts.map +1 -1
  119. package/dist/images/repositories/images-query-repository.interface.d.ts +59 -0
  120. package/dist/images/repositories/images-query-repository.interface.d.ts.map +1 -1
  121. package/dist/images/services/images-domain-service.d.ts +40 -0
  122. package/dist/images/services/images-domain-service.d.ts.map +1 -1
  123. package/dist/images/services/images-domain-service.js +50 -0
  124. package/dist/images/services/images-domain-service.js.map +1 -1
  125. package/dist/images/types/cache-strategy.d.ts +19 -0
  126. package/dist/images/types/cache-strategy.d.ts.map +1 -1
  127. package/dist/images/types/query-params.d.ts +44 -3
  128. package/dist/images/types/query-params.d.ts.map +1 -1
  129. package/dist/images/types/sort-order.d.ts +12 -0
  130. package/dist/images/types/sort-order.d.ts.map +1 -1
  131. package/dist/index.d.ts +30 -0
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +30 -0
  134. package/dist/index.js.map +1 -1
  135. package/dist/notes/entities/note-entity.d.ts +212 -6
  136. package/dist/notes/entities/note-entity.d.ts.map +1 -1
  137. package/dist/notes/entities/note-entity.js +182 -4
  138. package/dist/notes/entities/note-entity.js.map +1 -1
  139. package/dist/notes/events/note-created-event.d.ts +32 -0
  140. package/dist/notes/events/note-created-event.d.ts.map +1 -1
  141. package/dist/notes/events/note-created-event.js +32 -0
  142. package/dist/notes/events/note-created-event.js.map +1 -1
  143. package/dist/notes/events/note-deleted-event.d.ts +30 -0
  144. package/dist/notes/events/note-deleted-event.d.ts.map +1 -1
  145. package/dist/notes/events/note-deleted-event.js +30 -0
  146. package/dist/notes/events/note-deleted-event.js.map +1 -1
  147. package/dist/notes/index.d.ts +32 -0
  148. package/dist/notes/index.d.ts.map +1 -1
  149. package/dist/notes/index.js +32 -0
  150. package/dist/notes/index.js.map +1 -1
  151. package/dist/notes/repositories/notes-command-repository.interface.d.ts +37 -0
  152. package/dist/notes/repositories/notes-command-repository.interface.d.ts.map +1 -1
  153. package/dist/notes/repositories/notes-query-repository.interface.d.ts +53 -0
  154. package/dist/notes/repositories/notes-query-repository.interface.d.ts.map +1 -1
  155. package/dist/notes/services/notes-domain-service.d.ts +40 -0
  156. package/dist/notes/services/notes-domain-service.d.ts.map +1 -1
  157. package/dist/notes/services/notes-domain-service.js +50 -0
  158. package/dist/notes/services/notes-domain-service.js.map +1 -1
  159. package/dist/notes/types/cache-strategy.d.ts +19 -0
  160. package/dist/notes/types/cache-strategy.d.ts.map +1 -1
  161. package/dist/notes/types/query-params.d.ts +44 -3
  162. package/dist/notes/types/query-params.d.ts.map +1 -1
  163. package/dist/notes/types/sort-order.d.ts +12 -0
  164. package/dist/notes/types/sort-order.d.ts.map +1 -1
  165. package/dist/tsconfig.tsbuildinfo +1 -1
  166. package/package.json +1 -1
@@ -1,26 +1,206 @@
1
1
  import { z } from "zod";
2
2
  import { UserId } from "../../common/entities/common-entity";
3
- declare const CategoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
3
+ /**
4
+ * Zod schema for validating category names.
5
+ *
6
+ * @remarks
7
+ * Validates that the category name is a trimmed string between 1 and 16 characters.
8
+ * Used for organizing articles into logical groups.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const name = CategoryName.parse("Technology");
13
+ * ```
14
+ *
15
+ * @see {@link makeCategoryName} for factory function
16
+ */
17
+ export declare const CategoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
18
+ /**
19
+ * Branded type for validated category names.
20
+ */
4
21
  export type CategoryName = z.infer<typeof CategoryName>;
22
+ /**
23
+ * Creates a validated CategoryName from a string.
24
+ *
25
+ * @param v - The raw string value to validate
26
+ * @returns A branded CategoryName value
27
+ * @throws {ZodError} When validation fails (empty or exceeds 16 chars)
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const name = makeCategoryName("Technology");
32
+ * ```
33
+ */
5
34
  export declare const makeCategoryName: (v: string) => CategoryName;
6
- declare const ArticleTitle: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
35
+ /**
36
+ * Zod schema for validating article titles.
37
+ *
38
+ * @remarks
39
+ * Validates that the title is a non-empty string between 1 and 128 characters.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const title = ArticleTitle.parse("Introduction to TypeScript");
44
+ * ```
45
+ *
46
+ * @see {@link makeArticleTitle} for factory function
47
+ */
48
+ export declare const ArticleTitle: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
49
+ /**
50
+ * Branded type for validated article titles.
51
+ */
7
52
  export type ArticleTitle = z.infer<typeof ArticleTitle>;
53
+ /**
54
+ * Creates a validated ArticleTitle from a string.
55
+ *
56
+ * @param v - The raw string value to validate
57
+ * @returns A branded ArticleTitle value
58
+ * @throws {ZodError} When validation fails (empty or exceeds 128 chars)
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const title = makeArticleTitle("Introduction to TypeScript");
63
+ * ```
64
+ */
8
65
  export declare const makeArticleTitle: (v: string) => ArticleTitle;
9
- declare const Quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
66
+ /**
67
+ * Zod schema for validating article quotes.
68
+ *
69
+ * @remarks
70
+ * Validates an optional quote with maximum 512 characters.
71
+ * Null and undefined values are allowed.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const quote = Quote.parse("This is a notable excerpt from the article.");
76
+ * const empty = Quote.parse(null);
77
+ * ```
78
+ *
79
+ * @see {@link makeQuote} for factory function
80
+ */
81
+ export declare const Quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
82
+ /**
83
+ * Branded type for validated quotes.
84
+ */
10
85
  export type Quote = z.infer<typeof Quote>;
86
+ /**
87
+ * Creates a validated Quote from a string or null/undefined.
88
+ *
89
+ * @param v - The raw string value, null, or undefined
90
+ * @returns A branded Quote value
91
+ * @throws {ZodError} When string exceeds 512 characters
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const quote = makeQuote("Notable excerpt");
96
+ * const noQuote = makeQuote(null);
97
+ * ```
98
+ */
11
99
  export declare const makeQuote: (v: string | null | undefined) => Quote;
12
- declare const Url: z.core.$ZodBranded<z.ZodURL, "Url">;
100
+ /**
101
+ * Zod schema for validating article URLs.
102
+ *
103
+ * @remarks
104
+ * Validates that the URL is a valid HTTP or HTTPS URL.
105
+ * Other protocols are not allowed.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const url = Url.parse("https://example.com/article");
110
+ * ```
111
+ *
112
+ * @see {@link makeUrl} for factory function
113
+ */
114
+ export declare const Url: z.core.$ZodBranded<z.ZodURL, "Url">;
115
+ /**
116
+ * Branded type for validated URLs.
117
+ */
13
118
  export type Url = z.infer<typeof Url>;
119
+ /**
120
+ * Creates a validated Url from a string.
121
+ *
122
+ * @param v - The raw URL string
123
+ * @returns A branded Url value
124
+ * @throws {ZodError} When URL is invalid or not HTTP/HTTPS
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const url = makeUrl("https://example.com/article");
129
+ * ```
130
+ */
14
131
  export declare const makeUrl: (v: string) => Url;
15
- declare const OgTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
132
+ /**
133
+ * Zod schema for validating Open Graph titles.
134
+ *
135
+ * @remarks
136
+ * Optional string for the OG title fetched from the article URL.
137
+ * Null and undefined values are allowed.
138
+ *
139
+ * @see {@link makeOgTitle} for factory function
140
+ */
141
+ export declare const OgTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
142
+ /**
143
+ * Branded type for validated OG titles.
144
+ */
16
145
  export type OgTitle = z.infer<typeof OgTitle>;
146
+ /**
147
+ * Creates a validated OgTitle from a string or null/undefined.
148
+ *
149
+ * @param v - The raw OG title string, null, or undefined
150
+ * @returns A branded OgTitle value
151
+ */
17
152
  export declare const makeOgTitle: (v: string | null | undefined) => OgTitle;
18
- declare const OgDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
153
+ /**
154
+ * Zod schema for validating Open Graph descriptions.
155
+ *
156
+ * @remarks
157
+ * Optional string for the OG description fetched from the article URL.
158
+ * Null and undefined values are allowed.
159
+ *
160
+ * @see {@link makeOgDescription} for factory function
161
+ */
162
+ export declare const OgDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
163
+ /**
164
+ * Branded type for validated OG descriptions.
165
+ */
19
166
  export type OgDescription = z.infer<typeof OgDescription>;
167
+ /**
168
+ * Creates a validated OgDescription from a string or null/undefined.
169
+ *
170
+ * @param v - The raw OG description string, null, or undefined
171
+ * @returns A branded OgDescription value
172
+ */
20
173
  export declare const makeOgDescription: (v: string | null | undefined) => OgDescription;
21
- declare const OgImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
174
+ /**
175
+ * Zod schema for validating Open Graph image URLs.
176
+ *
177
+ * @remarks
178
+ * Optional string for the OG image URL fetched from the article URL.
179
+ * Null and undefined values are allowed.
180
+ *
181
+ * @see {@link makeOgImageUrl} for factory function
182
+ */
183
+ export declare const OgImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
184
+ /**
185
+ * Branded type for validated OG image URLs.
186
+ */
22
187
  export type OgImageUrl = z.infer<typeof OgImageUrl>;
188
+ /**
189
+ * Creates a validated OgImageUrl from a string or null/undefined.
190
+ *
191
+ * @param v - The raw OG image URL string, null, or undefined
192
+ * @returns A branded OgImageUrl value
193
+ */
23
194
  export declare const makeOgImageUrl: (v: string | null | undefined) => OgImageUrl;
195
+ /**
196
+ * Zod schema for an unexported article.
197
+ *
198
+ * @remarks
199
+ * Represents an article that has not yet been published.
200
+ * This is the initial state of all newly created articles.
201
+ *
202
+ * @see {@link ExportedArticle} for the published state
203
+ */
24
204
  export declare const UnexportedArticle: z.ZodObject<{
25
205
  id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
26
206
  userId: z.core.$ZodBranded<z.ZodString, "UserId">;
@@ -35,8 +215,23 @@ export declare const UnexportedArticle: z.ZodObject<{
35
215
  ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
36
216
  status: z.ZodLiteral<"UNEXPORTED">;
37
217
  }, z.core.$strip>;
218
+ /**
219
+ * Type for an unexported article entity.
220
+ *
221
+ * @remarks
222
+ * Immutable entity representing an article pending export.
223
+ */
38
224
  export type UnexportedArticle = Readonly<z.infer<typeof UnexportedArticle>>;
39
- declare const ExportedArticle: z.ZodObject<{
225
+ /**
226
+ * Zod schema for an exported article.
227
+ *
228
+ * @remarks
229
+ * Represents an article that has been published.
230
+ * Includes the exportedAt timestamp.
231
+ *
232
+ * @see {@link UnexportedArticle} for the initial state
233
+ */
234
+ export declare const ExportedArticle: z.ZodObject<{
40
235
  id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
41
236
  userId: z.core.$ZodBranded<z.ZodString, "UserId">;
42
237
  categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
@@ -51,17 +246,153 @@ declare const ExportedArticle: z.ZodObject<{
51
246
  status: z.ZodLiteral<"EXPORTED">;
52
247
  exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
53
248
  }, z.core.$strip>;
54
- type ExportedArticle = Readonly<z.infer<typeof ExportedArticle>>;
55
- type CreateArticleArgs = Readonly<{
249
+ /**
250
+ * Type for an exported article entity.
251
+ *
252
+ * @remarks
253
+ * Immutable entity representing a published article.
254
+ */
255
+ export type ExportedArticle = Readonly<z.infer<typeof ExportedArticle>>;
256
+ /**
257
+ * Zod schema for an article marked for export in the current batch.
258
+ *
259
+ * @remarks
260
+ * Represents an article that has been marked for export but not yet finalized.
261
+ * This intermediate state allows for batch processing with revert capability.
262
+ *
263
+ * @see {@link UnexportedArticle} for the initial state
264
+ * @see {@link ExportedArticle} for the final state
265
+ */
266
+ export declare const LastUpdatedArticle: z.ZodObject<{
267
+ id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
268
+ userId: z.core.$ZodBranded<z.ZodString, "UserId">;
269
+ categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
270
+ categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
271
+ title: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
272
+ quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
273
+ url: z.core.$ZodBranded<z.ZodURL, "Url">;
274
+ createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
275
+ ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
276
+ ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
277
+ ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
278
+ status: z.ZodLiteral<"LAST_UPDATED">;
279
+ }, z.core.$strip>;
280
+ /**
281
+ * Type for an article marked for export.
282
+ *
283
+ * @remarks
284
+ * Immutable entity representing an article in the current export batch.
285
+ * Can be reverted back to UnexportedArticle or finalized to ExportedArticle.
286
+ */
287
+ export type LastUpdatedArticle = Readonly<z.infer<typeof LastUpdatedArticle>>;
288
+ /**
289
+ * Arguments for creating a new article.
290
+ *
291
+ * @remarks
292
+ * Provides the required fields for article creation.
293
+ * The id, categoryId, createdAt, and status are auto-generated.
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * const args: CreateArticleArgs = {
298
+ * userId: makeUserId("user-123"),
299
+ * categoryName: makeCategoryName("Tech"),
300
+ * title: makeArticleTitle("Article Title"),
301
+ * url: makeUrl("https://example.com"),
302
+ * quote: makeQuote("Notable excerpt"),
303
+ * };
304
+ * ```
305
+ */
306
+ export type CreateArticleArgs = Readonly<{
307
+ /** The user who owns the article */
56
308
  userId: UserId;
309
+ /** The category for organizing the article */
57
310
  categoryName: CategoryName;
311
+ /** The article title */
58
312
  title: ArticleTitle;
313
+ /** Optional quote/excerpt from the article */
59
314
  quote?: Quote;
315
+ /** The article URL */
60
316
  url: Url;
61
317
  }>;
318
+ /**
319
+ * Factory object for Article domain entity operations.
320
+ *
321
+ * @remarks
322
+ * Provides immutable entity creation following DDD patterns.
323
+ * All returned entities are frozen using Object.freeze().
324
+ *
325
+ * @example
326
+ * ```typescript
327
+ * // Create a new unexported article
328
+ * const article = articleEntity.create({
329
+ * userId: makeUserId("user-123"),
330
+ * categoryName: makeCategoryName("Tech"),
331
+ * title: makeArticleTitle("Article Title"),
332
+ * url: makeUrl("https://example.com"),
333
+ * });
334
+ *
335
+ * // Export the article (changes status to EXPORTED)
336
+ * const exported = articleEntity.export(article);
337
+ * ```
338
+ *
339
+ * @see {@link CreateArticleArgs} for creation parameters
340
+ */
62
341
  export declare const articleEntity: {
342
+ /**
343
+ * Creates a new unexported article entity.
344
+ *
345
+ * @param args - The creation arguments containing required fields
346
+ * @returns A frozen UnexportedArticle instance with generated id and timestamps
347
+ * @throws {InvalidFormatError} When validation of any field fails
348
+ * @throws {UnexpectedError} For unexpected errors during creation
349
+ */
63
350
  create: (args: CreateArticleArgs) => UnexportedArticle;
351
+ /**
352
+ * Transitions an article from UNEXPORTED to EXPORTED status.
353
+ *
354
+ * @param article - The unexported article to export
355
+ * @returns A frozen ExportedArticle with exportedAt timestamp
356
+ * @throws {InvalidFormatError} When the article state is invalid
357
+ * @throws {UnexpectedError} For unexpected errors during export
358
+ */
64
359
  export: (article: UnexportedArticle) => ExportedArticle;
360
+ /**
361
+ * Marks an article for export in the current batch.
362
+ *
363
+ * @remarks
364
+ * Transitions from UNEXPORTED to LAST_UPDATED status.
365
+ * This allows for batch processing with revert capability.
366
+ *
367
+ * @param article - The unexported article to mark
368
+ * @returns A frozen LastUpdatedArticle
369
+ * @throws {InvalidFormatError} When the article state is invalid
370
+ * @throws {UnexpectedError} For unexpected errors
371
+ */
372
+ markAsLastUpdated: (article: UnexportedArticle) => LastUpdatedArticle;
373
+ /**
374
+ * Reverts an article from LAST_UPDATED back to UNEXPORTED.
375
+ *
376
+ * @remarks
377
+ * Use this when batch processing fails and needs to be rolled back.
378
+ *
379
+ * @param article - The last updated article to revert
380
+ * @returns A frozen UnexportedArticle
381
+ * @throws {InvalidFormatError} When the article state is invalid
382
+ * @throws {UnexpectedError} For unexpected errors
383
+ */
384
+ revert: (article: LastUpdatedArticle) => UnexportedArticle;
385
+ /**
386
+ * Finalizes an article from LAST_UPDATED to EXPORTED.
387
+ *
388
+ * @remarks
389
+ * Use this after batch processing succeeds to confirm the export.
390
+ *
391
+ * @param article - The last updated article to finalize
392
+ * @returns A frozen ExportedArticle with exportedAt timestamp
393
+ * @throws {InvalidFormatError} When the article state is invalid
394
+ * @throws {UnexpectedError} For unexpected errors
395
+ */
396
+ finalize: (article: LastUpdatedArticle) => ExportedArticle;
65
397
  };
66
- export {};
67
398
  //# sourceMappingURL=article-entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"article-entity.d.ts","sourceRoot":"","sources":["../../../articles/entities/article-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAQN,MAAM,EACN,MAAM,qCAAqC,CAAC;AAK7C,QAAA,MAAM,YAAY,iDAKO,CAAC;AAC1B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OA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