@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,11 +1,77 @@
1
1
  import { z } from "zod";
2
2
  import { UserId } from "../../common/entities/common-entity";
3
- declare const NoteTitle: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
3
+ /**
4
+ * Zod schema for validating note titles.
5
+ *
6
+ * @remarks
7
+ * Validates that the title is a non-empty string between 1 and 64 characters.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const title = NoteTitle.parse("Meeting Notes");
12
+ * ```
13
+ *
14
+ * @see {@link makeNoteTitle} for factory function
15
+ */
16
+ export declare const NoteTitle: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
17
+ /**
18
+ * Branded type for validated note titles.
19
+ */
4
20
  export type NoteTitle = z.infer<typeof NoteTitle>;
21
+ /**
22
+ * Creates a validated NoteTitle from a string.
23
+ *
24
+ * @param v - The raw title string
25
+ * @returns A branded NoteTitle value
26
+ * @throws {ZodError} When validation fails (empty or exceeds 64 chars)
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const title = makeNoteTitle("Meeting Notes");
31
+ * ```
32
+ */
5
33
  export declare const makeNoteTitle: (v: string) => NoteTitle;
6
- declare const Markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
34
+ /**
35
+ * Zod schema for validating markdown content.
36
+ *
37
+ * @remarks
38
+ * Validates that the markdown is a non-empty string.
39
+ * No maximum length is enforced to allow for long-form content.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const content = Markdown.parse("# Heading\n\nParagraph text");
44
+ * ```
45
+ *
46
+ * @see {@link makeMarkdown} for factory function
47
+ */
48
+ export declare const Markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
49
+ /**
50
+ * Branded type for validated markdown content.
51
+ */
7
52
  export type Markdown = z.infer<typeof Markdown>;
53
+ /**
54
+ * Creates a validated Markdown from a string.
55
+ *
56
+ * @param v - The raw markdown string
57
+ * @returns A branded Markdown value
58
+ * @throws {ZodError} When the string is empty
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const content = makeMarkdown("# Heading\n\nParagraph text");
63
+ * ```
64
+ */
8
65
  export declare const makeMarkdown: (v: string) => Markdown;
66
+ /**
67
+ * Zod schema for an unexported note.
68
+ *
69
+ * @remarks
70
+ * Represents a note that has not yet been published.
71
+ * This is the initial state of all newly created notes.
72
+ *
73
+ * @see {@link ExportedNote} for the published state
74
+ */
9
75
  export declare const UnexportedNote: z.ZodObject<{
10
76
  id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
11
77
  userId: z.core.$ZodBranded<z.ZodString, "UserId">;
@@ -14,8 +80,23 @@ export declare const UnexportedNote: z.ZodObject<{
14
80
  createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
15
81
  status: z.ZodLiteral<"UNEXPORTED">;
16
82
  }, z.core.$strip>;
83
+ /**
84
+ * Type for an unexported note entity.
85
+ *
86
+ * @remarks
87
+ * Immutable entity representing a note pending export.
88
+ */
17
89
  export type UnexportedNote = Readonly<z.infer<typeof UnexportedNote>>;
18
- declare const ExportedNote: z.ZodObject<{
90
+ /**
91
+ * Zod schema for an exported note.
92
+ *
93
+ * @remarks
94
+ * Represents a note that has been published.
95
+ * Includes the exportedAt timestamp.
96
+ *
97
+ * @see {@link UnexportedNote} for the initial state
98
+ */
99
+ export declare const ExportedNote: z.ZodObject<{
19
100
  id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
20
101
  userId: z.core.$ZodBranded<z.ZodString, "UserId">;
21
102
  title: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
@@ -24,15 +105,140 @@ declare const ExportedNote: z.ZodObject<{
24
105
  status: z.ZodLiteral<"EXPORTED">;
25
106
  exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
26
107
  }, z.core.$strip>;
27
- type ExportedNote = Readonly<z.infer<typeof ExportedNote>>;
28
- type CreateNoteArgs = Readonly<{
108
+ /**
109
+ * Type for an exported note entity.
110
+ *
111
+ * @remarks
112
+ * Immutable entity representing a published note.
113
+ */
114
+ export type ExportedNote = Readonly<z.infer<typeof ExportedNote>>;
115
+ /**
116
+ * Zod schema for a note marked for export in the current batch.
117
+ *
118
+ * @remarks
119
+ * Represents a note that has been marked for export but not yet finalized.
120
+ * This intermediate state allows for batch processing with revert capability.
121
+ *
122
+ * @see {@link UnexportedNote} for the initial state
123
+ * @see {@link ExportedNote} for the final state
124
+ */
125
+ export declare const LastUpdatedNote: z.ZodObject<{
126
+ id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
127
+ userId: z.core.$ZodBranded<z.ZodString, "UserId">;
128
+ title: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
129
+ markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
130
+ createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
131
+ status: z.ZodLiteral<"LAST_UPDATED">;
132
+ }, z.core.$strip>;
133
+ /**
134
+ * Type for a note marked for export.
135
+ *
136
+ * @remarks
137
+ * Immutable entity representing a note in the current export batch.
138
+ * Can be reverted back to UnexportedNote or finalized to ExportedNote.
139
+ */
140
+ export type LastUpdatedNote = Readonly<z.infer<typeof LastUpdatedNote>>;
141
+ /**
142
+ * Arguments for creating a new note.
143
+ *
144
+ * @remarks
145
+ * Provides the required fields for note creation.
146
+ * The id, createdAt, and status are auto-generated.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const args: CreateNoteArgs = {
151
+ * userId: makeUserId("user-123"),
152
+ * title: makeNoteTitle("Meeting Notes"),
153
+ * markdown: makeMarkdown("# Meeting Notes\n\n- Item 1\n- Item 2"),
154
+ * };
155
+ * ```
156
+ */
157
+ export type CreateNoteArgs = Readonly<{
158
+ /** The user who owns the note */
29
159
  userId: UserId;
160
+ /** The note title */
30
161
  title: NoteTitle;
162
+ /** The markdown content */
31
163
  markdown: Markdown;
32
164
  }>;
165
+ /**
166
+ * Factory object for Note domain entity operations.
167
+ *
168
+ * @remarks
169
+ * Provides immutable entity creation following DDD patterns.
170
+ * All returned entities are frozen using Object.freeze().
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * // Create a new unexported note
175
+ * const note = noteEntity.create({
176
+ * userId: makeUserId("user-123"),
177
+ * title: makeNoteTitle("Meeting Notes"),
178
+ * markdown: makeMarkdown("# Content"),
179
+ * });
180
+ *
181
+ * // Export the note (changes status to EXPORTED)
182
+ * const exported = noteEntity.export(note);
183
+ * ```
184
+ *
185
+ * @see {@link CreateNoteArgs} for creation parameters
186
+ */
33
187
  export declare const noteEntity: {
188
+ /**
189
+ * Creates a new unexported note entity.
190
+ *
191
+ * @param args - The creation arguments containing required fields
192
+ * @returns A frozen UnexportedNote instance with generated id and timestamps
193
+ * @throws {InvalidFormatError} When validation of any field fails
194
+ * @throws {UnexpectedError} For unexpected errors during creation
195
+ */
34
196
  create: (args: CreateNoteArgs) => UnexportedNote;
197
+ /**
198
+ * Transitions a note from UNEXPORTED to EXPORTED status.
199
+ *
200
+ * @param note - The unexported note to export
201
+ * @returns A frozen ExportedNote with exportedAt timestamp
202
+ * @throws {InvalidFormatError} When the note state is invalid
203
+ * @throws {UnexpectedError} For unexpected errors during export
204
+ */
35
205
  export: (note: UnexportedNote) => ExportedNote;
206
+ /**
207
+ * Marks a note for export in the current batch.
208
+ *
209
+ * @remarks
210
+ * Transitions from UNEXPORTED to LAST_UPDATED status.
211
+ * This allows for batch processing with revert capability.
212
+ *
213
+ * @param note - The unexported note to mark
214
+ * @returns A frozen LastUpdatedNote
215
+ * @throws {InvalidFormatError} When the note state is invalid
216
+ * @throws {UnexpectedError} For unexpected errors
217
+ */
218
+ markAsLastUpdated: (note: UnexportedNote) => LastUpdatedNote;
219
+ /**
220
+ * Reverts a note from LAST_UPDATED back to UNEXPORTED.
221
+ *
222
+ * @remarks
223
+ * Use this when batch processing fails and needs to be rolled back.
224
+ *
225
+ * @param note - The last updated note to revert
226
+ * @returns A frozen UnexportedNote
227
+ * @throws {InvalidFormatError} When the note state is invalid
228
+ * @throws {UnexpectedError} For unexpected errors
229
+ */
230
+ revert: (note: LastUpdatedNote) => UnexportedNote;
231
+ /**
232
+ * Finalizes a note from LAST_UPDATED to EXPORTED.
233
+ *
234
+ * @remarks
235
+ * Use this after batch processing succeeds to confirm the export.
236
+ *
237
+ * @param note - The last updated note to finalize
238
+ * @returns A frozen ExportedNote with exportedAt timestamp
239
+ * @throws {InvalidFormatError} When the note state is invalid
240
+ * @throws {UnexpectedError} For unexpected errors
241
+ */
242
+ finalize: (note: LastUpdatedNote) => ExportedNote;
36
243
  };
37
- export {};
38
244
  //# sourceMappingURL=note-entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"note-entity.d.ts","sourceRoot":"","sources":["../../../notes/entities/note-entity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ACH,eAAO,MAAM,UAAU;IACtB;;;;;;;OAOG;mBACY,cAAc,KAAG,cAAc;IAW9C;;;;;;;OAOG;mBACY,cAAc,KAAG,YAAY;IAU5C;;;;;;;;;;;OAWG;8BACuB,cAAc,KAAG,eAAe;IAS1D;;;;;;;;;;OAUG;mBACY,eAAe,KAAG,cAAc;IAS/C;;;;;;;;;;OAUG;qBACc,eAAe,KAAG,YAAY;CAS/C,CAAC"}
@@ -1,19 +1,75 @@
1
1
  import { z } from "zod";
2
- import { CreatedAt, ExportedStatus, Id, makeCreatedAt, makeExportedStatus, makeId, UnexportedStatus, UserId, } from "../../common/entities/common-entity";
2
+ import { CreatedAt, ExportedStatus, Id, LastUpdatedStatus, makeCreatedAt, makeExportedStatus, makeId, UnexportedStatus, UserId, } from "../../common/entities/common-entity";
3
3
  import { createEntityWithErrorHandling } from "../../common/services/entity-factory";
4
4
  // Value objects
5
- const NoteTitle = z
5
+ /**
6
+ * Zod schema for validating note titles.
7
+ *
8
+ * @remarks
9
+ * Validates that the title is a non-empty string between 1 and 64 characters.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const title = NoteTitle.parse("Meeting Notes");
14
+ * ```
15
+ *
16
+ * @see {@link makeNoteTitle} for factory function
17
+ */
18
+ export const NoteTitle = z
6
19
  .string({ message: "required" })
7
20
  .min(1, { message: "required" })
8
21
  .max(64, { message: "tooLong" })
9
22
  .brand();
23
+ /**
24
+ * Creates a validated NoteTitle from a string.
25
+ *
26
+ * @param v - The raw title string
27
+ * @returns A branded NoteTitle value
28
+ * @throws {ZodError} When validation fails (empty or exceeds 64 chars)
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const title = makeNoteTitle("Meeting Notes");
33
+ * ```
34
+ */
10
35
  export const makeNoteTitle = (v) => NoteTitle.parse(v);
11
- const Markdown = z
36
+ /**
37
+ * Zod schema for validating markdown content.
38
+ *
39
+ * @remarks
40
+ * Validates that the markdown is a non-empty string.
41
+ * No maximum length is enforced to allow for long-form content.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const content = Markdown.parse("# Heading\n\nParagraph text");
46
+ * ```
47
+ *
48
+ * @see {@link makeMarkdown} for factory function
49
+ */
50
+ export const Markdown = z
12
51
  .string({ message: "required" })
13
52
  .min(1, { message: "required" })
14
53
  .brand();
54
+ /**
55
+ * Creates a validated Markdown from a string.
56
+ *
57
+ * @param v - The raw markdown string
58
+ * @returns A branded Markdown value
59
+ * @throws {ZodError} When the string is empty
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const content = makeMarkdown("# Heading\n\nParagraph text");
64
+ * ```
65
+ */
15
66
  export const makeMarkdown = (v) => Markdown.parse(v);
16
67
  // Entities
68
+ /**
69
+ * Base schema containing common note fields.
70
+ *
71
+ * @internal
72
+ */
17
73
  const Base = z.object({
18
74
  id: Id,
19
75
  userId: UserId,
@@ -21,9 +77,68 @@ const Base = z.object({
21
77
  markdown: Markdown,
22
78
  createdAt: CreatedAt,
23
79
  });
80
+ /**
81
+ * Zod schema for an unexported note.
82
+ *
83
+ * @remarks
84
+ * Represents a note that has not yet been published.
85
+ * This is the initial state of all newly created notes.
86
+ *
87
+ * @see {@link ExportedNote} for the published state
88
+ */
24
89
  export const UnexportedNote = Base.extend({ status: UnexportedStatus });
25
- const ExportedNote = Base.extend(ExportedStatus.shape);
90
+ /**
91
+ * Zod schema for an exported note.
92
+ *
93
+ * @remarks
94
+ * Represents a note that has been published.
95
+ * Includes the exportedAt timestamp.
96
+ *
97
+ * @see {@link UnexportedNote} for the initial state
98
+ */
99
+ export const ExportedNote = Base.extend(ExportedStatus.shape);
100
+ /**
101
+ * Zod schema for a note marked for export in the current batch.
102
+ *
103
+ * @remarks
104
+ * Represents a note that has been marked for export but not yet finalized.
105
+ * This intermediate state allows for batch processing with revert capability.
106
+ *
107
+ * @see {@link UnexportedNote} for the initial state
108
+ * @see {@link ExportedNote} for the final state
109
+ */
110
+ export const LastUpdatedNote = Base.extend({ status: LastUpdatedStatus });
111
+ /**
112
+ * Factory object for Note domain entity operations.
113
+ *
114
+ * @remarks
115
+ * Provides immutable entity creation following DDD patterns.
116
+ * All returned entities are frozen using Object.freeze().
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * // Create a new unexported note
121
+ * const note = noteEntity.create({
122
+ * userId: makeUserId("user-123"),
123
+ * title: makeNoteTitle("Meeting Notes"),
124
+ * markdown: makeMarkdown("# Content"),
125
+ * });
126
+ *
127
+ * // Export the note (changes status to EXPORTED)
128
+ * const exported = noteEntity.export(note);
129
+ * ```
130
+ *
131
+ * @see {@link CreateNoteArgs} for creation parameters
132
+ */
26
133
  export const noteEntity = {
134
+ /**
135
+ * Creates a new unexported note entity.
136
+ *
137
+ * @param args - The creation arguments containing required fields
138
+ * @returns A frozen UnexportedNote instance with generated id and timestamps
139
+ * @throws {InvalidFormatError} When validation of any field fails
140
+ * @throws {UnexpectedError} For unexpected errors during creation
141
+ */
27
142
  create: (args) => {
28
143
  return createEntityWithErrorHandling(() => Object.freeze({
29
144
  id: makeId(),
@@ -32,6 +147,14 @@ export const noteEntity = {
32
147
  ...args,
33
148
  }));
34
149
  },
150
+ /**
151
+ * Transitions a note from UNEXPORTED to EXPORTED status.
152
+ *
153
+ * @param note - The unexported note to export
154
+ * @returns A frozen ExportedNote with exportedAt timestamp
155
+ * @throws {InvalidFormatError} When the note state is invalid
156
+ * @throws {UnexpectedError} For unexpected errors during export
157
+ */
35
158
  export: (note) => {
36
159
  return createEntityWithErrorHandling(() => {
37
160
  const exportedStatus = makeExportedStatus();
@@ -41,5 +164,60 @@ export const noteEntity = {
41
164
  });
42
165
  });
43
166
  },
167
+ /**
168
+ * Marks a note for export in the current batch.
169
+ *
170
+ * @remarks
171
+ * Transitions from UNEXPORTED to LAST_UPDATED status.
172
+ * This allows for batch processing with revert capability.
173
+ *
174
+ * @param note - The unexported note to mark
175
+ * @returns A frozen LastUpdatedNote
176
+ * @throws {InvalidFormatError} When the note state is invalid
177
+ * @throws {UnexpectedError} For unexpected errors
178
+ */
179
+ markAsLastUpdated: (note) => {
180
+ return createEntityWithErrorHandling(() => Object.freeze({
181
+ ...note,
182
+ status: "LAST_UPDATED",
183
+ }));
184
+ },
185
+ /**
186
+ * Reverts a note from LAST_UPDATED back to UNEXPORTED.
187
+ *
188
+ * @remarks
189
+ * Use this when batch processing fails and needs to be rolled back.
190
+ *
191
+ * @param note - The last updated note to revert
192
+ * @returns A frozen UnexportedNote
193
+ * @throws {InvalidFormatError} When the note state is invalid
194
+ * @throws {UnexpectedError} For unexpected errors
195
+ */
196
+ revert: (note) => {
197
+ return createEntityWithErrorHandling(() => Object.freeze({
198
+ ...note,
199
+ status: "UNEXPORTED",
200
+ }));
201
+ },
202
+ /**
203
+ * Finalizes a note from LAST_UPDATED to EXPORTED.
204
+ *
205
+ * @remarks
206
+ * Use this after batch processing succeeds to confirm the export.
207
+ *
208
+ * @param note - The last updated note to finalize
209
+ * @returns A frozen ExportedNote with exportedAt timestamp
210
+ * @throws {InvalidFormatError} When the note state is invalid
211
+ * @throws {UnexpectedError} For unexpected errors
212
+ */
213
+ finalize: (note) => {
214
+ return createEntityWithErrorHandling(() => {
215
+ const exportedStatus = makeExportedStatus();
216
+ return Object.freeze({
217
+ ...note,
218
+ ...exportedStatus,
219
+ });
220
+ });
221
+ },
44
222
  };
45
223
  //# sourceMappingURL=note-entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"note-entity.js","sourceRoot":"","sources":["../../../notes/entities/note-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,SAAS,EACT,cAAc,EACd,EAAE,EACF,aAAa,EACb,kBAAkB,EAClB,MAAM,EACN,gBAAgB,EAChB,MAAM,GACN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAErF,gBAAgB;AAEhB,MAAM,SAAS,GAAG,CAAC;KACjB,MAAM,CAAC,EAAE,OAAO,EAAE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,CAAC,MAAM,CAAC;gBACpB,GAAG,IAAI;gBACP,GAAG,cAAc;aACjB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,iBAAiB,EAAE,CAAC,IAAoB,EAAmB,EAAE;QAC5D,OAAO,6BAA6B,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,MAAM,CAAC;YACb,GAAG,IAAI;YACP,MAAM,EAAE,cAAuB;SAC/B,CAAC,CACF,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,EAAE,CAAC,IAAqB,EAAkB,EAAE;QACjD,OAAO,6BAA6B,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,MAAM,CAAC;YACb,GAAG,IAAI;YACP,MAAM,EAAE,YAAqB;SAC7B,CAAC,CACF,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,CAAC,IAAqB,EAAgB,EAAE;QACjD,OAAO,6BAA6B,CAAC,GAAG,EAAE;YACzC,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,MAAM,CAAC;gBACpB,GAAG,IAAI;gBACP,GAAG,cAAc;aACjB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
@@ -1,5 +1,37 @@
1
1
  import { BaseDomainEvent } from "../../common/events/base-domain-event";
2
+ /**
3
+ * Domain event emitted when a note is created.
4
+ *
5
+ * @remarks
6
+ * Part of the event-driven architecture for cross-cutting concerns
7
+ * like notifications, logging, and analytics.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const event = new NoteCreatedEvent({
12
+ * title: "Meeting Notes",
13
+ * markdown: "# Meeting Notes\n\n- Item 1",
14
+ * userId: "user-123",
15
+ * caller: "addNote",
16
+ * });
17
+ *
18
+ * // event.eventType === "note.created"
19
+ * await eventHandler.handle(event);
20
+ * ```
21
+ *
22
+ * @see {@link BaseDomainEvent} for base class
23
+ * @see {@link NoteDeletedEvent} for deletion event
24
+ */
2
25
  export declare class NoteCreatedEvent extends BaseDomainEvent {
26
+ /**
27
+ * Creates a new NoteCreatedEvent.
28
+ *
29
+ * @param data - Event data containing note details and metadata
30
+ * @param data.title - The note title
31
+ * @param data.markdown - The markdown content
32
+ * @param data.userId - The user who created the note
33
+ * @param data.caller - The function/method that triggered the event
34
+ */
3
35
  constructor(data: {
4
36
  title: string;
5
37
  markdown: string;
@@ -1 +1 @@
1
- {"version":3,"file":"note-created-event.d.ts","sourceRoot":"","sources":["../../../notes/events/note-created-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,qBAAa,gBAAiB,SAAQ,eAAe;gBACxC,IAAI,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KACf;CAaD"}
1
+ {"version":3,"file":"note-created-event.d.ts","sourceRoot":"","sources":["../../../notes/events/note-created-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACpD;;;;;;;;OAQG;gBACS,IAAI,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KACf;CAaD"}
@@ -1,5 +1,37 @@
1
1
  import { BaseDomainEvent } from "../../common/events/base-domain-event";
2
+ /**
3
+ * Domain event emitted when a note is created.
4
+ *
5
+ * @remarks
6
+ * Part of the event-driven architecture for cross-cutting concerns
7
+ * like notifications, logging, and analytics.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const event = new NoteCreatedEvent({
12
+ * title: "Meeting Notes",
13
+ * markdown: "# Meeting Notes\n\n- Item 1",
14
+ * userId: "user-123",
15
+ * caller: "addNote",
16
+ * });
17
+ *
18
+ * // event.eventType === "note.created"
19
+ * await eventHandler.handle(event);
20
+ * ```
21
+ *
22
+ * @see {@link BaseDomainEvent} for base class
23
+ * @see {@link NoteDeletedEvent} for deletion event
24
+ */
2
25
  export class NoteCreatedEvent extends BaseDomainEvent {
26
+ /**
27
+ * Creates a new NoteCreatedEvent.
28
+ *
29
+ * @param data - Event data containing note details and metadata
30
+ * @param data.title - The note title
31
+ * @param data.markdown - The markdown content
32
+ * @param data.userId - The user who created the note
33
+ * @param data.caller - The function/method that triggered the event
34
+ */
3
35
  constructor(data) {
4
36
  super("note.created", {
5
37
  title: data.title,
@@ -1 +1 @@
1
- {"version":3,"file":"note-created-event.js","sourceRoot":"","sources":["../../../notes/events/note-created-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IACpD,YAAY,IAKX;QACA,KAAK,CACJ,cAAc,EACd;YACC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,EACD;YACC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CACD,CAAC;IACH,CAAC;CACD"}
1
+ {"version":3,"file":"note-created-event.js","sourceRoot":"","sources":["../../../notes/events/note-created-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IACpD;;;;;;;;OAQG;IACH,YAAY,IAKX;QACA,KAAK,CACJ,cAAc,EACd;YACC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,EACD;YACC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CACD,CAAC;IACH,CAAC;CACD"}
@@ -1,5 +1,35 @@
1
1
  import { BaseDomainEvent } from "../../common/events/base-domain-event";
2
+ /**
3
+ * Domain event emitted when a note is deleted.
4
+ *
5
+ * @remarks
6
+ * Part of the event-driven architecture for cross-cutting concerns
7
+ * like notifications, logging, and analytics.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const event = new NoteDeletedEvent({
12
+ * title: "Deleted Note",
13
+ * userId: "user-123",
14
+ * caller: "deleteNote",
15
+ * });
16
+ *
17
+ * // event.eventType === "note.deleted"
18
+ * await eventHandler.handle(event);
19
+ * ```
20
+ *
21
+ * @see {@link BaseDomainEvent} for base class
22
+ * @see {@link NoteCreatedEvent} for creation event
23
+ */
2
24
  export declare class NoteDeletedEvent extends BaseDomainEvent {
25
+ /**
26
+ * Creates a new NoteDeletedEvent.
27
+ *
28
+ * @param data - Event data containing deletion details
29
+ * @param data.title - The title of the deleted note
30
+ * @param data.userId - The user who deleted the note
31
+ * @param data.caller - The function/method that triggered the event
32
+ */
3
33
  constructor(data: {
4
34
  title: string;
5
35
  userId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"note-deleted-event.d.ts","sourceRoot":"","sources":["../../../notes/events/note-deleted-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,qBAAa,gBAAiB,SAAQ,eAAe;gBACxC,IAAI,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KACf;CAYD"}
1
+ {"version":3,"file":"note-deleted-event.d.ts","sourceRoot":"","sources":["../../../notes/events/note-deleted-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACpD;;;;;;;OAOG;gBACS,IAAI,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KACf;CAYD"}
@@ -1,5 +1,35 @@
1
1
  import { BaseDomainEvent } from "../../common/events/base-domain-event";
2
+ /**
3
+ * Domain event emitted when a note is deleted.
4
+ *
5
+ * @remarks
6
+ * Part of the event-driven architecture for cross-cutting concerns
7
+ * like notifications, logging, and analytics.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const event = new NoteDeletedEvent({
12
+ * title: "Deleted Note",
13
+ * userId: "user-123",
14
+ * caller: "deleteNote",
15
+ * });
16
+ *
17
+ * // event.eventType === "note.deleted"
18
+ * await eventHandler.handle(event);
19
+ * ```
20
+ *
21
+ * @see {@link BaseDomainEvent} for base class
22
+ * @see {@link NoteCreatedEvent} for creation event
23
+ */
2
24
  export class NoteDeletedEvent extends BaseDomainEvent {
25
+ /**
26
+ * Creates a new NoteDeletedEvent.
27
+ *
28
+ * @param data - Event data containing deletion details
29
+ * @param data.title - The title of the deleted note
30
+ * @param data.userId - The user who deleted the note
31
+ * @param data.caller - The function/method that triggered the event
32
+ */
3
33
  constructor(data) {
4
34
  super("note.deleted", {
5
35
  title: data.title,
@@ -1 +1 @@
1
- {"version":3,"file":"note-deleted-event.js","sourceRoot":"","sources":["../../../notes/events/note-deleted-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IACpD,YAAY,IAIX;QACA,KAAK,CACJ,cAAc,EACd;YACC,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,EACD;YACC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CACD,CAAC;IACH,CAAC;CACD"}
1
+ {"version":3,"file":"note-deleted-event.js","sourceRoot":"","sources":["../../../notes/events/note-deleted-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IACpD;;;;;;;OAOG;IACH,YAAY,IAIX;QACA,KAAK,CACJ,cAAc,EACd;YACC,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,EACD;YACC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CACD,CAAC;IACH,CAAC;CACD"}