@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.
- 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 -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,11 +1,77 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { UserId } from "../../common/entities/common-entity";
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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.ts"],"names":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AAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACrC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,QAAQ,CAAC;CACnB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
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,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,MAAM,EACN,gBAAgB,EAChB,MAAM,GACN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAErF,gBAAgB;AAEhB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC;KACxB,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KAC/B,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KAC/B,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KAC/B,KAAK,EAAe,CAAC;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
|
+
/**
|
|
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;
|
|
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;
|
|
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"}
|