@s-hirano-ist/s-core 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/articles/entities/article-entity.d.ts +30 -99
- package/dist/articles/entities/article-entity.d.ts.map +1 -1
- package/dist/articles/entities/article-entity.js +1 -67
- package/dist/articles/entities/article-entity.js.map +1 -1
- package/dist/articles/index.d.ts +1 -0
- package/dist/articles/index.d.ts.map +1 -1
- package/dist/articles/index.js +1 -0
- package/dist/articles/index.js.map +1 -1
- package/dist/articles/repositories/articles-command-repository.interface.d.ts +4 -0
- package/dist/articles/repositories/articles-command-repository.interface.d.ts.map +1 -1
- package/dist/articles/services/articles-batch-domain-service.d.ts +82 -0
- package/dist/articles/services/articles-batch-domain-service.d.ts.map +1 -0
- package/dist/articles/services/articles-batch-domain-service.js +91 -0
- package/dist/articles/services/articles-batch-domain-service.js.map +1 -0
- package/dist/books/entities/books-entity.d.ts +34 -104
- package/dist/books/entities/books-entity.d.ts.map +1 -1
- package/dist/books/entities/books-entity.js +1 -67
- package/dist/books/entities/books-entity.js.map +1 -1
- package/dist/books/index.d.ts +1 -0
- package/dist/books/index.d.ts.map +1 -1
- package/dist/books/index.js +1 -0
- package/dist/books/index.js.map +1 -1
- package/dist/books/repositories/books-command-repository.interface.d.ts +4 -0
- package/dist/books/repositories/books-command-repository.interface.d.ts.map +1 -1
- package/dist/books/services/books-batch-domain-service.d.ts +36 -0
- package/dist/books/services/books-batch-domain-service.d.ts.map +1 -0
- package/dist/books/services/books-batch-domain-service.js +49 -0
- package/dist/books/services/books-batch-domain-service.js.map +1 -0
- package/dist/common/entities/common-entity.d.ts +8 -20
- package/dist/common/entities/common-entity.d.ts.map +1 -1
- package/dist/common/entities/common-entity.js +2 -14
- package/dist/common/entities/common-entity.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +2 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/repositories/batch-command-repository.interface.d.ts +93 -0
- package/dist/common/repositories/batch-command-repository.interface.d.ts.map +1 -0
- package/dist/common/repositories/batch-command-repository.interface.js +2 -0
- package/dist/common/repositories/batch-command-repository.interface.js.map +1 -0
- package/dist/images/entities/image-entity.d.ts +27 -101
- package/dist/images/entities/image-entity.d.ts.map +1 -1
- package/dist/images/entities/image-entity.js +1 -67
- package/dist/images/entities/image-entity.js.map +1 -1
- package/dist/images/index.d.ts +1 -0
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +1 -0
- package/dist/images/index.js.map +1 -1
- package/dist/images/repositories/images-command-repository.interface.d.ts +4 -0
- package/dist/images/repositories/images-command-repository.interface.d.ts.map +1 -1
- package/dist/images/services/images-batch-domain-service.d.ts +36 -0
- package/dist/images/services/images-batch-domain-service.d.ts.map +1 -0
- package/dist/images/services/images-batch-domain-service.js +49 -0
- package/dist/images/services/images-batch-domain-service.js.map +1 -0
- package/dist/notes/entities/note-entity.d.ts +13 -76
- package/dist/notes/entities/note-entity.d.ts.map +1 -1
- package/dist/notes/entities/note-entity.js +1 -67
- package/dist/notes/entities/note-entity.js.map +1 -1
- package/dist/notes/index.d.ts +1 -0
- package/dist/notes/index.d.ts.map +1 -1
- package/dist/notes/index.js +1 -0
- package/dist/notes/index.js.map +1 -1
- package/dist/notes/repositories/notes-command-repository.interface.d.ts +4 -0
- package/dist/notes/repositories/notes-command-repository.interface.d.ts.map +1 -1
- package/dist/notes/services/notes-batch-domain-service.d.ts +36 -0
- package/dist/notes/services/notes-batch-domain-service.d.ts.map +1 -0
- package/dist/notes/services/notes-batch-domain-service.js +49 -0
- package/dist/notes/services/notes-batch-domain-service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -13,7 +13,7 @@ import { UserId } from "../../common/entities/common-entity.js";
|
|
|
13
13
|
*
|
|
14
14
|
* @see {@link makeNoteTitle} for factory function
|
|
15
15
|
*/
|
|
16
|
-
export declare const NoteTitle: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
|
|
16
|
+
export declare const NoteTitle: z.core.$ZodBranded<z.ZodString, "NoteTitle", "out">;
|
|
17
17
|
/**
|
|
18
18
|
* Branded type for validated note titles.
|
|
19
19
|
*/
|
|
@@ -45,7 +45,7 @@ export declare const makeNoteTitle: (v: string) => NoteTitle;
|
|
|
45
45
|
*
|
|
46
46
|
* @see {@link makeMarkdown} for factory function
|
|
47
47
|
*/
|
|
48
|
-
export declare const Markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
|
|
48
|
+
export declare const Markdown: z.core.$ZodBranded<z.ZodString, "Markdown", "out">;
|
|
49
49
|
/**
|
|
50
50
|
* Branded type for validated markdown content.
|
|
51
51
|
*/
|
|
@@ -73,11 +73,11 @@ export declare const makeMarkdown: (v: string) => Markdown;
|
|
|
73
73
|
* @see {@link ExportedNote} for the published state
|
|
74
74
|
*/
|
|
75
75
|
export declare const UnexportedNote: z.ZodObject<{
|
|
76
|
-
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
77
|
-
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
78
|
-
title: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
|
|
79
|
-
markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
|
|
80
|
-
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
76
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
77
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId", "out">;
|
|
78
|
+
title: z.core.$ZodBranded<z.ZodString, "NoteTitle", "out">;
|
|
79
|
+
markdown: z.core.$ZodBranded<z.ZodString, "Markdown", "out">;
|
|
80
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt", "out">;
|
|
81
81
|
status: z.ZodLiteral<"UNEXPORTED">;
|
|
82
82
|
}, z.core.$strip>;
|
|
83
83
|
/**
|
|
@@ -97,13 +97,13 @@ export type UnexportedNote = Readonly<z.infer<typeof UnexportedNote>>;
|
|
|
97
97
|
* @see {@link UnexportedNote} for the initial state
|
|
98
98
|
*/
|
|
99
99
|
export declare const ExportedNote: z.ZodObject<{
|
|
100
|
-
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
101
|
-
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
102
|
-
title: z.core.$ZodBranded<z.ZodString, "NoteTitle">;
|
|
103
|
-
markdown: z.core.$ZodBranded<z.ZodString, "Markdown">;
|
|
104
|
-
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
100
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
101
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId", "out">;
|
|
102
|
+
title: z.core.$ZodBranded<z.ZodString, "NoteTitle", "out">;
|
|
103
|
+
markdown: z.core.$ZodBranded<z.ZodString, "Markdown", "out">;
|
|
104
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt", "out">;
|
|
105
105
|
status: z.ZodLiteral<"EXPORTED">;
|
|
106
|
-
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
|
|
106
|
+
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt", "out">;
|
|
107
107
|
}, z.core.$strip>;
|
|
108
108
|
/**
|
|
109
109
|
* Type for an exported note entity.
|
|
@@ -112,32 +112,6 @@ export declare const ExportedNote: z.ZodObject<{
|
|
|
112
112
|
* Immutable entity representing a published note.
|
|
113
113
|
*/
|
|
114
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
115
|
/**
|
|
142
116
|
* Arguments for creating a new note.
|
|
143
117
|
*
|
|
@@ -203,42 +177,5 @@ export declare const noteEntity: {
|
|
|
203
177
|
* @throws {UnexpectedError} For unexpected errors during export
|
|
204
178
|
*/
|
|
205
179
|
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;
|
|
243
180
|
};
|
|
244
181
|
//# sourceMappingURL=note-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-entity.d.ts","sourceRoot":"","sources":["../../../notes/entities/note-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"note-entity.d.ts","sourceRoot":"","sources":["../../../notes/entities/note-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAQN,MAAM,EACN,MAAM,wCAAwC,CAAC;AAKhD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,qDAIA,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,SAAS,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
import { CreatedAt, ExportedStatus, Id, makeCreatedAt, makeExportedStatus, makeId, UnexportedStatus, UserId, } from "../../common/entities/common-entity.js";
|
|
3
3
|
import { createEntityWithErrorHandling } from "../../common/services/entity-factory.js";
|
|
4
4
|
// Value objects
|
|
5
5
|
/**
|
|
@@ -97,17 +97,6 @@ export const UnexportedNote = Base.extend({ status: UnexportedStatus });
|
|
|
97
97
|
* @see {@link UnexportedNote} for the initial state
|
|
98
98
|
*/
|
|
99
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
100
|
/**
|
|
112
101
|
* Factory object for Note domain entity operations.
|
|
113
102
|
*
|
|
@@ -164,60 +153,5 @@ export const noteEntity = {
|
|
|
164
153
|
});
|
|
165
154
|
});
|
|
166
155
|
},
|
|
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
|
-
},
|
|
222
156
|
};
|
|
223
157
|
//# 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,
|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SAAS;IAChB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAUxE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAmC9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,IAAoB,EAAkB,EAAE;QAChD,OAAO,6BAA6B,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,MAAM,CAAC;YACb,EAAE,EAAE,MAAM,EAAE;YACZ,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,aAAa,EAAE;YAC1B,GAAG,IAAI;SACP,CAAC,CACF,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,IAAoB,EAAgB,EAAE;QAC9C,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"}
|
package/dist/notes/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from "./events/note-created-event.js";
|
|
|
35
35
|
export * from "./events/note-deleted-event.js";
|
|
36
36
|
export * from "./repositories/notes-command-repository.interface.js";
|
|
37
37
|
export * from "./repositories/notes-query-repository.interface.js";
|
|
38
|
+
export * from "./services/notes-batch-domain-service.js";
|
|
38
39
|
export * from "./services/notes-domain-service.js";
|
|
39
40
|
export * from "./types/cache-strategy.js";
|
|
40
41
|
export * from "./types/query-params.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,cAAc,2BAA2B,CAAC;AAG1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAGnE,cAAc,oCAAoC,CAAC;AAGnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,cAAc,2BAA2B,CAAC;AAG1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAGnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
package/dist/notes/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from "./events/note-deleted-event.js";
|
|
|
39
39
|
export * from "./repositories/notes-command-repository.interface.js";
|
|
40
40
|
export * from "./repositories/notes-query-repository.interface.js";
|
|
41
41
|
// Services
|
|
42
|
+
export * from "./services/notes-batch-domain-service.js";
|
|
42
43
|
export * from "./services/notes-domain-service.js";
|
|
43
44
|
// Types
|
|
44
45
|
export * from "./types/cache-strategy.js";
|
package/dist/notes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,WAAW;AACX,cAAc,2BAA2B,CAAC;AAE1C,SAAS;AACT,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAE/C,eAAe;AACf,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAEnE,WAAW;AACX,cAAc,oCAAoC,CAAC;AAEnD,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,WAAW;AACX,cAAc,2BAA2B,CAAC;AAE1C,SAAS;AACT,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAE/C,eAAe;AACf,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAEnE,WAAW;AACX,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AAEnD,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
@@ -7,6 +7,9 @@ import type { UnexportedNote } from "../entities/note-entity.js";
|
|
|
7
7
|
* Follows the CQRS pattern - this interface handles write operations only.
|
|
8
8
|
* Implementations should be provided by the infrastructure layer (e.g., Prisma).
|
|
9
9
|
*
|
|
10
|
+
* For batch operations (bulkUpdateStatus), use {@link IBatchCommandRepository}
|
|
11
|
+
* from the common module directly.
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```typescript
|
|
12
15
|
* // Infrastructure implementation
|
|
@@ -24,6 +27,7 @@ import type { UnexportedNote } from "../entities/note-entity.js";
|
|
|
24
27
|
* ```
|
|
25
28
|
*
|
|
26
29
|
* @see {@link INotesQueryRepository} for read operations
|
|
30
|
+
* @see {@link IBatchCommandRepository} for batch operations
|
|
27
31
|
*/
|
|
28
32
|
export type INotesCommandRepository = {
|
|
29
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes-command-repository.interface.d.ts","sourceRoot":"","sources":["../../../notes/repositories/notes-command-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"notes-command-repository.interface.d.ts","sourceRoot":"","sources":["../../../notes/repositories/notes-command-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACrC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type UserId } from "../../common/entities/common-entity.js";
|
|
2
|
+
import type { BulkUpdateResult, IBatchCommandRepository } from "../../common/repositories/batch-command-repository.interface.js";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the reset operation.
|
|
5
|
+
*/
|
|
6
|
+
export type ResetResult = {
|
|
7
|
+
finalized: BulkUpdateResult;
|
|
8
|
+
marked: BulkUpdateResult;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Domain service for batch operations on Notes.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Encapsulates the business logic for batch status transitions.
|
|
15
|
+
* Manages the state machine for note lifecycle:
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
* UNEXPORTED --> LAST_UPDATED --> EXPORTED
|
|
19
|
+
* |
|
|
20
|
+
* v
|
|
21
|
+
* UNEXPORTED (revert)
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class NotesBatchDomainService {
|
|
25
|
+
private readonly commandRepository;
|
|
26
|
+
constructor(commandRepository: IBatchCommandRepository);
|
|
27
|
+
/**
|
|
28
|
+
* Resets notes for a new batch export.
|
|
29
|
+
*/
|
|
30
|
+
resetNotes(userId: UserId): Promise<ResetResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Reverts notes from LAST_UPDATED back to UNEXPORTED.
|
|
33
|
+
*/
|
|
34
|
+
revertNotes(userId: UserId): Promise<BulkUpdateResult>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=notes-batch-domain-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes-batch-domain-service.d.ts","sourceRoot":"","sources":["../../../notes/services/notes-batch-domain-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,MAAM,EACX,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EACX,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,iEAAiE,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAuB;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,uBAAuB;IAEvE;;OAEG;IACU,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiB7D;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAOnE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { makeExportedAt, } from "../../common/entities/common-entity.js";
|
|
2
|
+
/**
|
|
3
|
+
* Domain service for batch operations on Notes.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Encapsulates the business logic for batch status transitions.
|
|
7
|
+
* Manages the state machine for note lifecycle:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* UNEXPORTED --> LAST_UPDATED --> EXPORTED
|
|
11
|
+
* |
|
|
12
|
+
* v
|
|
13
|
+
* UNEXPORTED (revert)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export class NotesBatchDomainService {
|
|
17
|
+
commandRepository;
|
|
18
|
+
constructor(commandRepository) {
|
|
19
|
+
this.commandRepository = commandRepository;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resets notes for a new batch export.
|
|
23
|
+
*/
|
|
24
|
+
async resetNotes(userId) {
|
|
25
|
+
const finalized = await this.commandRepository.bulkUpdateStatus({
|
|
26
|
+
userId,
|
|
27
|
+
fromStatus: "LAST_UPDATED",
|
|
28
|
+
toStatus: "EXPORTED",
|
|
29
|
+
exportedAt: makeExportedAt(),
|
|
30
|
+
});
|
|
31
|
+
const marked = await this.commandRepository.bulkUpdateStatus({
|
|
32
|
+
userId,
|
|
33
|
+
fromStatus: "UNEXPORTED",
|
|
34
|
+
toStatus: "LAST_UPDATED",
|
|
35
|
+
});
|
|
36
|
+
return { finalized, marked };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reverts notes from LAST_UPDATED back to UNEXPORTED.
|
|
40
|
+
*/
|
|
41
|
+
async revertNotes(userId) {
|
|
42
|
+
return this.commandRepository.bulkUpdateStatus({
|
|
43
|
+
userId,
|
|
44
|
+
fromStatus: "LAST_UPDATED",
|
|
45
|
+
toStatus: "UNEXPORTED",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=notes-batch-domain-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes-batch-domain-service.js","sourceRoot":"","sources":["../../../notes/services/notes-batch-domain-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,GAEd,MAAM,wCAAwC,CAAC;AAchD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,uBAAuB;IACN;IAA7B,YAA6B,iBAA0C;QAA1C,sBAAiB,GAAjB,iBAAiB,CAAyB;IAAG,CAAC;IAE3E;;OAEG;IACI,KAAK,CAAC,UAAU,CAAC,MAAc;QACrC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC/D,MAAM;YACN,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,cAAc,EAAE;SAC5B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC5D,MAAM;YACN,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,cAAc;SACxB,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,MAAc;QACtC,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC9C,MAAM;YACN,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,YAAY;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
|