@palmetto/nestjs-log-history 0.1.0 → 0.2.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.
@@ -38,6 +38,9 @@ function isNull(obj) {
38
38
  return obj === null;
39
39
  }
40
40
  function entryToEntity(entry) {
41
+ if (typeof entry.model_id === "number") {
42
+ throw new Error(`Invalid model_id in log history entry: ${entry.model_id}`);
43
+ }
41
44
  return {
42
45
  _id: new mongoose_1.Types.ObjectId(),
43
46
  modelId: new mongoose_1.Types.ObjectId(entry.model_id),
@@ -51,7 +51,7 @@ export declare function createLogHistorySchema(options: HistoryPluginConfig): im
51
51
  context?: Record<string, unknown> | undefined;
52
52
  originalDocument?: unknown;
53
53
  updatedDocument?: unknown;
54
- }, {}, {}> & {
54
+ }, {}, import("mongoose").DefaultSchemaOptions> & {
55
55
  modelId: import("mongoose").Types.ObjectId;
56
56
  changeType: "create" | "update" | "delete";
57
57
  logs: {
@@ -71,7 +71,25 @@ export declare function createLogHistorySchema(options: HistoryPluginConfig): im
71
71
  _id: import("mongoose").Types.ObjectId;
72
72
  } & {
73
73
  __v: number;
74
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
74
+ } & {
75
+ id: string;
76
+ }, any, {
77
+ modelId: import("mongoose").Types.ObjectId;
78
+ changeType: "create" | "update" | "delete";
79
+ logs: {
80
+ fieldName: string;
81
+ changeType: "add" | "edit" | "remove";
82
+ fromValue?: string | undefined;
83
+ toValue?: string | undefined;
84
+ context?: Record<string, unknown> | undefined;
85
+ }[];
86
+ isDeleted: boolean;
87
+ createdBy: string;
88
+ createdAt: Date;
89
+ context?: Record<string, unknown> | undefined;
90
+ originalDocument?: unknown;
91
+ updatedDocument?: unknown;
92
+ }>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
75
93
  modelId: import("mongoose").Types.ObjectId;
76
94
  changeType: "create" | "update" | "delete";
77
95
  logs: {
@@ -87,7 +105,7 @@ export declare function createLogHistorySchema(options: HistoryPluginConfig): im
87
105
  context?: Record<string, unknown> | undefined;
88
106
  originalDocument?: unknown;
89
107
  updatedDocument?: unknown;
90
- }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
108
+ }, import("mongoose").Document<unknown, {}, {
91
109
  modelId: import("mongoose").Types.ObjectId;
92
110
  changeType: "create" | "update" | "delete";
93
111
  logs: {
@@ -103,7 +121,9 @@ export declare function createLogHistorySchema(options: HistoryPluginConfig): im
103
121
  context?: Record<string, unknown> | undefined;
104
122
  originalDocument?: unknown;
105
123
  updatedDocument?: unknown;
106
- }>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<{
124
+ }, {
125
+ id: string;
126
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
107
127
  modelId: import("mongoose").Types.ObjectId;
108
128
  changeType: "create" | "update" | "delete";
109
129
  logs: {
@@ -119,8 +139,546 @@ export declare function createLogHistorySchema(options: HistoryPluginConfig): im
119
139
  context?: Record<string, unknown> | undefined;
120
140
  originalDocument?: unknown;
121
141
  updatedDocument?: unknown;
122
- }> & {
142
+ } & {
123
143
  _id: import("mongoose").Types.ObjectId;
124
144
  } & {
125
145
  __v: number;
146
+ }, "id"> & {
147
+ id: string;
148
+ }, {
149
+ modelId?: import("mongoose").SchemaDefinitionProperty<import("mongoose").Types.ObjectId, {
150
+ modelId: import("mongoose").Types.ObjectId;
151
+ changeType: "create" | "update" | "delete";
152
+ logs: {
153
+ fieldName: string;
154
+ changeType: "add" | "edit" | "remove";
155
+ fromValue?: string | undefined;
156
+ toValue?: string | undefined;
157
+ context?: Record<string, unknown> | undefined;
158
+ }[];
159
+ isDeleted: boolean;
160
+ createdBy: string;
161
+ createdAt: Date;
162
+ context?: Record<string, unknown> | undefined;
163
+ originalDocument?: unknown;
164
+ updatedDocument?: unknown;
165
+ }, import("mongoose").Document<unknown, {}, {
166
+ modelId: import("mongoose").Types.ObjectId;
167
+ changeType: "create" | "update" | "delete";
168
+ logs: {
169
+ fieldName: string;
170
+ changeType: "add" | "edit" | "remove";
171
+ fromValue?: string | undefined;
172
+ toValue?: string | undefined;
173
+ context?: Record<string, unknown> | undefined;
174
+ }[];
175
+ isDeleted: boolean;
176
+ createdBy: string;
177
+ createdAt: Date;
178
+ context?: Record<string, unknown> | undefined;
179
+ originalDocument?: unknown;
180
+ updatedDocument?: unknown;
181
+ }, {
182
+ id: string;
183
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
184
+ modelId: import("mongoose").Types.ObjectId;
185
+ changeType: "create" | "update" | "delete";
186
+ logs: {
187
+ fieldName: string;
188
+ changeType: "add" | "edit" | "remove";
189
+ fromValue?: string | undefined;
190
+ toValue?: string | undefined;
191
+ context?: Record<string, unknown> | undefined;
192
+ }[];
193
+ isDeleted: boolean;
194
+ createdBy: string;
195
+ createdAt: Date;
196
+ context?: Record<string, unknown> | undefined;
197
+ originalDocument?: unknown;
198
+ updatedDocument?: unknown;
199
+ } & {
200
+ _id: import("mongoose").Types.ObjectId;
201
+ } & {
202
+ __v: number;
203
+ }, "id"> & {
204
+ id: string;
205
+ }> | undefined;
206
+ changeType?: import("mongoose").SchemaDefinitionProperty<"create" | "update" | "delete", {
207
+ modelId: import("mongoose").Types.ObjectId;
208
+ changeType: "create" | "update" | "delete";
209
+ logs: {
210
+ fieldName: string;
211
+ changeType: "add" | "edit" | "remove";
212
+ fromValue?: string | undefined;
213
+ toValue?: string | undefined;
214
+ context?: Record<string, unknown> | undefined;
215
+ }[];
216
+ isDeleted: boolean;
217
+ createdBy: string;
218
+ createdAt: Date;
219
+ context?: Record<string, unknown> | undefined;
220
+ originalDocument?: unknown;
221
+ updatedDocument?: unknown;
222
+ }, import("mongoose").Document<unknown, {}, {
223
+ modelId: import("mongoose").Types.ObjectId;
224
+ changeType: "create" | "update" | "delete";
225
+ logs: {
226
+ fieldName: string;
227
+ changeType: "add" | "edit" | "remove";
228
+ fromValue?: string | undefined;
229
+ toValue?: string | undefined;
230
+ context?: Record<string, unknown> | undefined;
231
+ }[];
232
+ isDeleted: boolean;
233
+ createdBy: string;
234
+ createdAt: Date;
235
+ context?: Record<string, unknown> | undefined;
236
+ originalDocument?: unknown;
237
+ updatedDocument?: unknown;
238
+ }, {
239
+ id: string;
240
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
241
+ modelId: import("mongoose").Types.ObjectId;
242
+ changeType: "create" | "update" | "delete";
243
+ logs: {
244
+ fieldName: string;
245
+ changeType: "add" | "edit" | "remove";
246
+ fromValue?: string | undefined;
247
+ toValue?: string | undefined;
248
+ context?: Record<string, unknown> | undefined;
249
+ }[];
250
+ isDeleted: boolean;
251
+ createdBy: string;
252
+ createdAt: Date;
253
+ context?: Record<string, unknown> | undefined;
254
+ originalDocument?: unknown;
255
+ updatedDocument?: unknown;
256
+ } & {
257
+ _id: import("mongoose").Types.ObjectId;
258
+ } & {
259
+ __v: number;
260
+ }, "id"> & {
261
+ id: string;
262
+ }> | undefined;
263
+ logs?: import("mongoose").SchemaDefinitionProperty<{
264
+ fieldName: string;
265
+ changeType: "add" | "edit" | "remove";
266
+ fromValue?: string | undefined;
267
+ toValue?: string | undefined;
268
+ context?: Record<string, unknown> | undefined;
269
+ }[], {
270
+ modelId: import("mongoose").Types.ObjectId;
271
+ changeType: "create" | "update" | "delete";
272
+ logs: {
273
+ fieldName: string;
274
+ changeType: "add" | "edit" | "remove";
275
+ fromValue?: string | undefined;
276
+ toValue?: string | undefined;
277
+ context?: Record<string, unknown> | undefined;
278
+ }[];
279
+ isDeleted: boolean;
280
+ createdBy: string;
281
+ createdAt: Date;
282
+ context?: Record<string, unknown> | undefined;
283
+ originalDocument?: unknown;
284
+ updatedDocument?: unknown;
285
+ }, import("mongoose").Document<unknown, {}, {
286
+ modelId: import("mongoose").Types.ObjectId;
287
+ changeType: "create" | "update" | "delete";
288
+ logs: {
289
+ fieldName: string;
290
+ changeType: "add" | "edit" | "remove";
291
+ fromValue?: string | undefined;
292
+ toValue?: string | undefined;
293
+ context?: Record<string, unknown> | undefined;
294
+ }[];
295
+ isDeleted: boolean;
296
+ createdBy: string;
297
+ createdAt: Date;
298
+ context?: Record<string, unknown> | undefined;
299
+ originalDocument?: unknown;
300
+ updatedDocument?: unknown;
301
+ }, {
302
+ id: string;
303
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
304
+ modelId: import("mongoose").Types.ObjectId;
305
+ changeType: "create" | "update" | "delete";
306
+ logs: {
307
+ fieldName: string;
308
+ changeType: "add" | "edit" | "remove";
309
+ fromValue?: string | undefined;
310
+ toValue?: string | undefined;
311
+ context?: Record<string, unknown> | undefined;
312
+ }[];
313
+ isDeleted: boolean;
314
+ createdBy: string;
315
+ createdAt: Date;
316
+ context?: Record<string, unknown> | undefined;
317
+ originalDocument?: unknown;
318
+ updatedDocument?: unknown;
319
+ } & {
320
+ _id: import("mongoose").Types.ObjectId;
321
+ } & {
322
+ __v: number;
323
+ }, "id"> & {
324
+ id: string;
325
+ }> | undefined;
326
+ isDeleted?: import("mongoose").SchemaDefinitionProperty<boolean, {
327
+ modelId: import("mongoose").Types.ObjectId;
328
+ changeType: "create" | "update" | "delete";
329
+ logs: {
330
+ fieldName: string;
331
+ changeType: "add" | "edit" | "remove";
332
+ fromValue?: string | undefined;
333
+ toValue?: string | undefined;
334
+ context?: Record<string, unknown> | undefined;
335
+ }[];
336
+ isDeleted: boolean;
337
+ createdBy: string;
338
+ createdAt: Date;
339
+ context?: Record<string, unknown> | undefined;
340
+ originalDocument?: unknown;
341
+ updatedDocument?: unknown;
342
+ }, import("mongoose").Document<unknown, {}, {
343
+ modelId: import("mongoose").Types.ObjectId;
344
+ changeType: "create" | "update" | "delete";
345
+ logs: {
346
+ fieldName: string;
347
+ changeType: "add" | "edit" | "remove";
348
+ fromValue?: string | undefined;
349
+ toValue?: string | undefined;
350
+ context?: Record<string, unknown> | undefined;
351
+ }[];
352
+ isDeleted: boolean;
353
+ createdBy: string;
354
+ createdAt: Date;
355
+ context?: Record<string, unknown> | undefined;
356
+ originalDocument?: unknown;
357
+ updatedDocument?: unknown;
358
+ }, {
359
+ id: string;
360
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
361
+ modelId: import("mongoose").Types.ObjectId;
362
+ changeType: "create" | "update" | "delete";
363
+ logs: {
364
+ fieldName: string;
365
+ changeType: "add" | "edit" | "remove";
366
+ fromValue?: string | undefined;
367
+ toValue?: string | undefined;
368
+ context?: Record<string, unknown> | undefined;
369
+ }[];
370
+ isDeleted: boolean;
371
+ createdBy: string;
372
+ createdAt: Date;
373
+ context?: Record<string, unknown> | undefined;
374
+ originalDocument?: unknown;
375
+ updatedDocument?: unknown;
376
+ } & {
377
+ _id: import("mongoose").Types.ObjectId;
378
+ } & {
379
+ __v: number;
380
+ }, "id"> & {
381
+ id: string;
382
+ }> | undefined;
383
+ createdBy?: import("mongoose").SchemaDefinitionProperty<string, {
384
+ modelId: import("mongoose").Types.ObjectId;
385
+ changeType: "create" | "update" | "delete";
386
+ logs: {
387
+ fieldName: string;
388
+ changeType: "add" | "edit" | "remove";
389
+ fromValue?: string | undefined;
390
+ toValue?: string | undefined;
391
+ context?: Record<string, unknown> | undefined;
392
+ }[];
393
+ isDeleted: boolean;
394
+ createdBy: string;
395
+ createdAt: Date;
396
+ context?: Record<string, unknown> | undefined;
397
+ originalDocument?: unknown;
398
+ updatedDocument?: unknown;
399
+ }, import("mongoose").Document<unknown, {}, {
400
+ modelId: import("mongoose").Types.ObjectId;
401
+ changeType: "create" | "update" | "delete";
402
+ logs: {
403
+ fieldName: string;
404
+ changeType: "add" | "edit" | "remove";
405
+ fromValue?: string | undefined;
406
+ toValue?: string | undefined;
407
+ context?: Record<string, unknown> | undefined;
408
+ }[];
409
+ isDeleted: boolean;
410
+ createdBy: string;
411
+ createdAt: Date;
412
+ context?: Record<string, unknown> | undefined;
413
+ originalDocument?: unknown;
414
+ updatedDocument?: unknown;
415
+ }, {
416
+ id: string;
417
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
418
+ modelId: import("mongoose").Types.ObjectId;
419
+ changeType: "create" | "update" | "delete";
420
+ logs: {
421
+ fieldName: string;
422
+ changeType: "add" | "edit" | "remove";
423
+ fromValue?: string | undefined;
424
+ toValue?: string | undefined;
425
+ context?: Record<string, unknown> | undefined;
426
+ }[];
427
+ isDeleted: boolean;
428
+ createdBy: string;
429
+ createdAt: Date;
430
+ context?: Record<string, unknown> | undefined;
431
+ originalDocument?: unknown;
432
+ updatedDocument?: unknown;
433
+ } & {
434
+ _id: import("mongoose").Types.ObjectId;
435
+ } & {
436
+ __v: number;
437
+ }, "id"> & {
438
+ id: string;
439
+ }> | undefined;
440
+ createdAt?: import("mongoose").SchemaDefinitionProperty<Date, {
441
+ modelId: import("mongoose").Types.ObjectId;
442
+ changeType: "create" | "update" | "delete";
443
+ logs: {
444
+ fieldName: string;
445
+ changeType: "add" | "edit" | "remove";
446
+ fromValue?: string | undefined;
447
+ toValue?: string | undefined;
448
+ context?: Record<string, unknown> | undefined;
449
+ }[];
450
+ isDeleted: boolean;
451
+ createdBy: string;
452
+ createdAt: Date;
453
+ context?: Record<string, unknown> | undefined;
454
+ originalDocument?: unknown;
455
+ updatedDocument?: unknown;
456
+ }, import("mongoose").Document<unknown, {}, {
457
+ modelId: import("mongoose").Types.ObjectId;
458
+ changeType: "create" | "update" | "delete";
459
+ logs: {
460
+ fieldName: string;
461
+ changeType: "add" | "edit" | "remove";
462
+ fromValue?: string | undefined;
463
+ toValue?: string | undefined;
464
+ context?: Record<string, unknown> | undefined;
465
+ }[];
466
+ isDeleted: boolean;
467
+ createdBy: string;
468
+ createdAt: Date;
469
+ context?: Record<string, unknown> | undefined;
470
+ originalDocument?: unknown;
471
+ updatedDocument?: unknown;
472
+ }, {
473
+ id: string;
474
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
475
+ modelId: import("mongoose").Types.ObjectId;
476
+ changeType: "create" | "update" | "delete";
477
+ logs: {
478
+ fieldName: string;
479
+ changeType: "add" | "edit" | "remove";
480
+ fromValue?: string | undefined;
481
+ toValue?: string | undefined;
482
+ context?: Record<string, unknown> | undefined;
483
+ }[];
484
+ isDeleted: boolean;
485
+ createdBy: string;
486
+ createdAt: Date;
487
+ context?: Record<string, unknown> | undefined;
488
+ originalDocument?: unknown;
489
+ updatedDocument?: unknown;
490
+ } & {
491
+ _id: import("mongoose").Types.ObjectId;
492
+ } & {
493
+ __v: number;
494
+ }, "id"> & {
495
+ id: string;
496
+ }> | undefined;
497
+ context?: import("mongoose").SchemaDefinitionProperty<Record<string, unknown> | undefined, {
498
+ modelId: import("mongoose").Types.ObjectId;
499
+ changeType: "create" | "update" | "delete";
500
+ logs: {
501
+ fieldName: string;
502
+ changeType: "add" | "edit" | "remove";
503
+ fromValue?: string | undefined;
504
+ toValue?: string | undefined;
505
+ context?: Record<string, unknown> | undefined;
506
+ }[];
507
+ isDeleted: boolean;
508
+ createdBy: string;
509
+ createdAt: Date;
510
+ context?: Record<string, unknown> | undefined;
511
+ originalDocument?: unknown;
512
+ updatedDocument?: unknown;
513
+ }, import("mongoose").Document<unknown, {}, {
514
+ modelId: import("mongoose").Types.ObjectId;
515
+ changeType: "create" | "update" | "delete";
516
+ logs: {
517
+ fieldName: string;
518
+ changeType: "add" | "edit" | "remove";
519
+ fromValue?: string | undefined;
520
+ toValue?: string | undefined;
521
+ context?: Record<string, unknown> | undefined;
522
+ }[];
523
+ isDeleted: boolean;
524
+ createdBy: string;
525
+ createdAt: Date;
526
+ context?: Record<string, unknown> | undefined;
527
+ originalDocument?: unknown;
528
+ updatedDocument?: unknown;
529
+ }, {
530
+ id: string;
531
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
532
+ modelId: import("mongoose").Types.ObjectId;
533
+ changeType: "create" | "update" | "delete";
534
+ logs: {
535
+ fieldName: string;
536
+ changeType: "add" | "edit" | "remove";
537
+ fromValue?: string | undefined;
538
+ toValue?: string | undefined;
539
+ context?: Record<string, unknown> | undefined;
540
+ }[];
541
+ isDeleted: boolean;
542
+ createdBy: string;
543
+ createdAt: Date;
544
+ context?: Record<string, unknown> | undefined;
545
+ originalDocument?: unknown;
546
+ updatedDocument?: unknown;
547
+ } & {
548
+ _id: import("mongoose").Types.ObjectId;
549
+ } & {
550
+ __v: number;
551
+ }, "id"> & {
552
+ id: string;
553
+ }> | undefined;
554
+ originalDocument?: import("mongoose").SchemaDefinitionProperty<unknown, {
555
+ modelId: import("mongoose").Types.ObjectId;
556
+ changeType: "create" | "update" | "delete";
557
+ logs: {
558
+ fieldName: string;
559
+ changeType: "add" | "edit" | "remove";
560
+ fromValue?: string | undefined;
561
+ toValue?: string | undefined;
562
+ context?: Record<string, unknown> | undefined;
563
+ }[];
564
+ isDeleted: boolean;
565
+ createdBy: string;
566
+ createdAt: Date;
567
+ context?: Record<string, unknown> | undefined;
568
+ originalDocument?: unknown;
569
+ updatedDocument?: unknown;
570
+ }, import("mongoose").Document<unknown, {}, {
571
+ modelId: import("mongoose").Types.ObjectId;
572
+ changeType: "create" | "update" | "delete";
573
+ logs: {
574
+ fieldName: string;
575
+ changeType: "add" | "edit" | "remove";
576
+ fromValue?: string | undefined;
577
+ toValue?: string | undefined;
578
+ context?: Record<string, unknown> | undefined;
579
+ }[];
580
+ isDeleted: boolean;
581
+ createdBy: string;
582
+ createdAt: Date;
583
+ context?: Record<string, unknown> | undefined;
584
+ originalDocument?: unknown;
585
+ updatedDocument?: unknown;
586
+ }, {
587
+ id: string;
588
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
589
+ modelId: import("mongoose").Types.ObjectId;
590
+ changeType: "create" | "update" | "delete";
591
+ logs: {
592
+ fieldName: string;
593
+ changeType: "add" | "edit" | "remove";
594
+ fromValue?: string | undefined;
595
+ toValue?: string | undefined;
596
+ context?: Record<string, unknown> | undefined;
597
+ }[];
598
+ isDeleted: boolean;
599
+ createdBy: string;
600
+ createdAt: Date;
601
+ context?: Record<string, unknown> | undefined;
602
+ originalDocument?: unknown;
603
+ updatedDocument?: unknown;
604
+ } & {
605
+ _id: import("mongoose").Types.ObjectId;
606
+ } & {
607
+ __v: number;
608
+ }, "id"> & {
609
+ id: string;
610
+ }> | undefined;
611
+ updatedDocument?: import("mongoose").SchemaDefinitionProperty<unknown, {
612
+ modelId: import("mongoose").Types.ObjectId;
613
+ changeType: "create" | "update" | "delete";
614
+ logs: {
615
+ fieldName: string;
616
+ changeType: "add" | "edit" | "remove";
617
+ fromValue?: string | undefined;
618
+ toValue?: string | undefined;
619
+ context?: Record<string, unknown> | undefined;
620
+ }[];
621
+ isDeleted: boolean;
622
+ createdBy: string;
623
+ createdAt: Date;
624
+ context?: Record<string, unknown> | undefined;
625
+ originalDocument?: unknown;
626
+ updatedDocument?: unknown;
627
+ }, import("mongoose").Document<unknown, {}, {
628
+ modelId: import("mongoose").Types.ObjectId;
629
+ changeType: "create" | "update" | "delete";
630
+ logs: {
631
+ fieldName: string;
632
+ changeType: "add" | "edit" | "remove";
633
+ fromValue?: string | undefined;
634
+ toValue?: string | undefined;
635
+ context?: Record<string, unknown> | undefined;
636
+ }[];
637
+ isDeleted: boolean;
638
+ createdBy: string;
639
+ createdAt: Date;
640
+ context?: Record<string, unknown> | undefined;
641
+ originalDocument?: unknown;
642
+ updatedDocument?: unknown;
643
+ }, {
644
+ id: string;
645
+ }, import("mongoose").DefaultSchemaOptions> & Omit<{
646
+ modelId: import("mongoose").Types.ObjectId;
647
+ changeType: "create" | "update" | "delete";
648
+ logs: {
649
+ fieldName: string;
650
+ changeType: "add" | "edit" | "remove";
651
+ fromValue?: string | undefined;
652
+ toValue?: string | undefined;
653
+ context?: Record<string, unknown> | undefined;
654
+ }[];
655
+ isDeleted: boolean;
656
+ createdBy: string;
657
+ createdAt: Date;
658
+ context?: Record<string, unknown> | undefined;
659
+ originalDocument?: unknown;
660
+ updatedDocument?: unknown;
661
+ } & {
662
+ _id: import("mongoose").Types.ObjectId;
663
+ } & {
664
+ __v: number;
665
+ }, "id"> & {
666
+ id: string;
667
+ }> | undefined;
668
+ }, {
669
+ modelId: import("mongoose").Types.ObjectId;
670
+ changeType: "create" | "update" | "delete";
671
+ logs: {
672
+ fieldName: string;
673
+ changeType: "add" | "edit" | "remove";
674
+ fromValue?: string | undefined;
675
+ toValue?: string | undefined;
676
+ context?: Record<string, unknown> | undefined;
677
+ }[];
678
+ isDeleted: boolean;
679
+ createdBy: string;
680
+ createdAt: Date;
681
+ context?: Record<string, unknown> | undefined;
682
+ originalDocument?: unknown;
683
+ updatedDocument?: unknown;
126
684
  }>;
package/dist/service.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { FilterQuery, PaginateModel, Types } from "mongoose";
2
- import { BaseMongooseService } from "@palmetto/nestjs-mongoose/dist/services/base-mongoose.service";
1
+ import { PaginateModel, QueryFilter, Types } from "mongoose";
2
+ import { BaseMongooseService } from "@palmetto/nestjs-mongoose";
3
3
  import { LogHistoryEntry, LogHistoryPlugin } from "@palmetto/mongoose-log-history";
4
4
  import { LogHistoryEntity } from "./entities/log-history.js";
5
5
  export interface HistoryFindAllOptions {
@@ -13,6 +13,6 @@ export declare class HistoryService extends BaseMongooseService<LogHistoryEntity
13
13
  constructor(model: PaginateModel<LogHistoryEntity>, modelName: string);
14
14
  saveHistories(_: LogHistoryPlugin, histories: LogHistoryEntry[]): Promise<void>;
15
15
  findAllById(id: string | Types.ObjectId, { limit, page, start, end }?: HistoryFindAllOptions): Promise<import("@palmetto/nestjs-mongoose").PageResult<LogHistoryEntity>>;
16
- removeAll(filter?: FilterQuery<LogHistoryEntity>): Promise<number>;
16
+ removeAll(filter?: QueryFilter<LogHistoryEntity>): Promise<number>;
17
17
  removeAllById(id: string | Types.ObjectId): Promise<number>;
18
18
  }
package/dist/service.js CHANGED
@@ -22,10 +22,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.HistoryService = void 0;
23
23
  const mongoose_1 = require("mongoose");
24
24
  const common_1 = require("@nestjs/common");
25
- const base_mongoose_service_1 = require("@palmetto/nestjs-mongoose/dist/services/base-mongoose.service");
25
+ const nestjs_mongoose_1 = require("@palmetto/nestjs-mongoose");
26
26
  const log_history_js_1 = require("./entities/log-history.js");
27
27
  const history_saver_js_1 = require("./history-saver.js");
28
- let HistoryService = HistoryService_1 = class HistoryService extends base_mongoose_service_1.BaseMongooseService {
28
+ let HistoryService = HistoryService_1 = class HistoryService extends nestjs_mongoose_1.BaseMongooseService {
29
29
  constructor(model, modelName) {
30
30
  super(model);
31
31
  this.logger = new common_1.Logger(HistoryService_1.name);
@@ -68,7 +68,7 @@ let HistoryService = HistoryService_1 = class HistoryService extends base_mongoo
68
68
  }
69
69
  removeAll() {
70
70
  return __awaiter(this, arguments, void 0, function* (filter = {}) {
71
- const result = yield this.model.collection.deleteMany(filter);
71
+ const result = yield this.model.deleteMany(filter);
72
72
  this.logger.debug(`removed ${result.deletedCount} history entries`);
73
73
  return result.deletedCount;
74
74
  });
package/package.json CHANGED
@@ -1,54 +1,51 @@
1
1
  {
2
2
  "name": "@palmetto/nestjs-log-history",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "main": "./dist/main.js",
5
5
  "scripts": {
6
6
  "lint": "yarn run -T eslint --fix ./src",
7
7
  "format": "yarn run -T prettier --write --loglevel warn .",
8
8
  "tc": "tsc --noEmit",
9
+ "test": "yarn test-runner 'vitest run'",
10
+ "test:watch": "yarn test-runner 'vitest watch'",
9
11
  "build": "yarn clean && yarn ci:build",
10
12
  "clean": "rm -rf ./dist/",
11
13
  "ci:build": "tsc -p tsconfig.build.json",
12
14
  "ci:lint": "yarn run -T eslint . && yarn run -T prettier --check --loglevel warn .",
13
15
  "ci:tc": "yarn tc",
16
+ "ci:test": "yarn run -T ci:test --project @palmetto/nestjs-log-history",
14
17
  "hook:lint": "eslint --cache --fix",
15
18
  "hook:format": "prettier --write --loglevel warn",
16
19
  "hook:tc": "yarn tc",
17
20
  "prepublishOnly": "yarn build",
18
- "test-runner": "../../scripts/test-runner.sh",
19
- "test": "yarn run test-runner vitest run",
20
- "test:watch": "yarn run test-runner vitest watch"
21
+ "test-runner": "../../scripts/test-runner.sh yarn run -T $0 --project @palmetto/nestjs-log-history"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@nestjs/common": "^11.1.6",
24
- "@nestjs/core": "^11.1.6",
25
- "@nestjs/mongoose": "^11",
25
+ "@nestjs/core": "^11.1.18",
26
+ "@nestjs/mongoose": "^11.0.4",
26
27
  "@nestjs/testing": "^11.1.5",
27
- "@palmetto/mongoose-log-history": "^1.2.4",
28
- "@palmetto/nestjs-mongoose": "^2.3.2",
29
- "@palmetto/nestjs-toolbelt": "^2.0.1",
30
- "@palmetto/nestjs-zod-dto": "^2.0.2",
31
- "@palmetto/zod-mongoose-schema": "^0.3.0",
32
- "@swc/core": "^1.13.3",
28
+ "@palmetto/mongoose-log-history": "^1.2.5",
29
+ "@palmetto/nestjs-mongoose": "^3.1.0",
30
+ "@palmetto/nestjs-toolbelt": "^3.0.1",
31
+ "@palmetto/nestjs-zod-dto": "^2.0.5",
32
+ "@palmetto/zod-mongoose-schema": "^1.0.0",
33
33
  "@types/node": "^24.2.1",
34
- "mongodb": "~6.20.0",
35
- "mongoose": "^8.19.3",
34
+ "mongoose": "^9.4.1",
36
35
  "typescript": "5.7.3",
37
- "unplugin-swc": "^1.5.6",
38
- "vitest": "^3.2.4",
36
+ "vitest": "^4.1.5",
39
37
  "zod": "^4.3"
40
38
  },
41
39
  "peerDependencies": {
42
- "@nestjs/common": "^11.1.6",
43
- "@nestjs/core": "^11.1.6",
40
+ "@nestjs/common": "^11",
41
+ "@nestjs/core": "^11",
44
42
  "@nestjs/mongoose": "^11",
45
- "@palmetto/mongoose-log-history": "*",
46
- "@palmetto/nestjs-mongoose": "^2.3.2",
47
- "@palmetto/nestjs-toolbelt": "^2.0.1",
48
- "@palmetto/nestjs-zod-dto": "^2.0.2",
49
- "@palmetto/zod-mongoose-schema": "^0.3.0",
50
- "mongodb": "~6.20.0",
51
- "mongoose": "^8.19.3",
43
+ "@palmetto/mongoose-log-history": "^1",
44
+ "@palmetto/nestjs-mongoose": "^3.1.0",
45
+ "@palmetto/nestjs-toolbelt": "^3.0.1",
46
+ "@palmetto/nestjs-zod-dto": "^2.0.5",
47
+ "@palmetto/zod-mongoose-schema": "^1.0.0",
48
+ "mongoose": "^9",
52
49
  "zod": "^4.3"
53
50
  },
54
51
  "dependencies": {