ts-patch-mongoose 2.9.5 → 2.9.6

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/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.3.1/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.4.4/schema.json",
3
3
  "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4
4
  "files": {
5
5
  "ignoreUnknown": false,
package/dist/index.cjs CHANGED
@@ -167,10 +167,10 @@ async function bulkPatch(opts, context, eventKey, docsKey) {
167
167
  collectionName: context.collectionName,
168
168
  collectionId: doc._id,
169
169
  doc: getObjectOmit(opts, doc),
170
- user,
171
- reason,
172
- metadata,
173
- version: 0
170
+ version: 0,
171
+ ...user !== void 0 && { user },
172
+ ...reason !== void 0 && { reason },
173
+ ...metadata !== void 0 && { metadata }
174
174
  }
175
175
  }
176
176
  });
@@ -207,10 +207,10 @@ async function updatePatch(opts, context, current, original) {
207
207
  collectionName: context.collectionName,
208
208
  collectionId: original._id,
209
209
  patch,
210
- user,
211
- reason,
212
- metadata,
213
- version
210
+ version,
211
+ ...user !== void 0 && { user },
212
+ ...reason !== void 0 && { reason },
213
+ ...metadata !== void 0 && { metadata }
214
214
  });
215
215
  }
216
216
  }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { HydratedDocument, Types, Query, Schema } from 'mongoose';
1
+ import { Types, Query, HydratedDocument, Schema } from 'mongoose';
2
2
  import { Operation } from 'fast-json-patch';
3
3
  import EventEmitter from 'node:events';
4
4
  import ms from 'ms';
@@ -60,3 +60,4 @@ declare const patchHistoryPlugin: <T>(schema: Schema<T>, opts: PluginOptions<T>)
60
60
 
61
61
  export { em as patchEventEmitter, patchHistoryPlugin, setPatchHistoryTTL };
62
62
  export type { History, HookContext, Metadata, PatchContext, PatchEvent, PluginOptions, User };
63
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sources":["../src/types.ts","../src/em.ts","../src/helpers.ts","../src/index.ts"],"mappings":";;;;;AAGM,UAAW,OAAO;;;;kBAIR,KAAK,CAAC,QAAQ;;;;;;YAMpB,SAAS;;AAGb,UAAW,UAAU;aAChB,gBAAgB;UACnB,gBAAgB;YACd,SAAS;;AAGb,UAAW,YAAY;;;;;kBAKb,gBAAgB;kBAChB,gBAAgB;;;;AAK1B,KAAM,WAAW,MAAM,KAAK;;cAAiC,YAAY;;AAEzE,KAAM,IAAI,GAAG,MAAM;AAEnB,KAAM,QAAQ,GAAG,MAAM;AAEvB,UAAW,aAAa;;;;;;oBAMZ,gBAAgB,QAAQ,OAAO,CAAC,IAAI,IAAI,IAAI;sBAC1C,gBAAgB,QAAQ,OAAO;wBAC7B,gBAAgB,QAAQ,OAAO,CAAC,QAAQ,IAAI,QAAQ;;;uBAGrD,gBAAgB,UAAU,OAAO;;;AChDtD,cAAM,iBAAkB,SAAQ,YAAY;;AAC5C,cAAM,EAAE,mBAA0B;;ACWlC,cAAa,kBAAkB,iBAAwB,EAAE,CAAC,WAAW,KAAG,OAAO;;ACiB/E,cAAa,kBAAkB,cAA8B,MAAM,WAAW,aAAa","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { HydratedDocument, Types, Query, Schema } from 'mongoose';
1
+ import { Types, Query, HydratedDocument, Schema } from 'mongoose';
2
2
  import { Operation } from 'fast-json-patch';
3
3
  import EventEmitter from 'node:events';
4
4
  import ms from 'ms';
@@ -60,3 +60,4 @@ declare const patchHistoryPlugin: <T>(schema: Schema<T>, opts: PluginOptions<T>)
60
60
 
61
61
  export { em as patchEventEmitter, patchHistoryPlugin, setPatchHistoryTTL };
62
62
  export type { History, HookContext, Metadata, PatchContext, PatchEvent, PluginOptions, User };
63
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sources":["../src/types.ts","../src/em.ts","../src/helpers.ts","../src/index.ts"],"mappings":";;;;;AAGM,UAAW,OAAO;;;;kBAIR,KAAK,CAAC,QAAQ;;;;;;YAMpB,SAAS;;AAGb,UAAW,UAAU;aAChB,gBAAgB;UACnB,gBAAgB;YACd,SAAS;;AAGb,UAAW,YAAY;;;;;kBAKb,gBAAgB;kBAChB,gBAAgB;;;;AAK1B,KAAM,WAAW,MAAM,KAAK;;cAAiC,YAAY;;AAEzE,KAAM,IAAI,GAAG,MAAM;AAEnB,KAAM,QAAQ,GAAG,MAAM;AAEvB,UAAW,aAAa;;;;;;oBAMZ,gBAAgB,QAAQ,OAAO,CAAC,IAAI,IAAI,IAAI;sBAC1C,gBAAgB,QAAQ,OAAO;wBAC7B,gBAAgB,QAAQ,OAAO,CAAC,QAAQ,IAAI,QAAQ;;;uBAGrD,gBAAgB,UAAU,OAAO;;;AChDtD,cAAM,iBAAkB,SAAQ,YAAY;;AAC5C,cAAM,EAAE,mBAA0B;;ACWlC,cAAa,kBAAkB,iBAAwB,EAAE,CAAC,WAAW,KAAG,OAAO;;ACiB/E,cAAa,kBAAkB,cAA8B,MAAM,WAAW,aAAa","names":[]}
package/dist/index.mjs CHANGED
@@ -165,10 +165,10 @@ async function bulkPatch(opts, context, eventKey, docsKey) {
165
165
  collectionName: context.collectionName,
166
166
  collectionId: doc._id,
167
167
  doc: getObjectOmit(opts, doc),
168
- user,
169
- reason,
170
- metadata,
171
- version: 0
168
+ version: 0,
169
+ ...user !== void 0 && { user },
170
+ ...reason !== void 0 && { reason },
171
+ ...metadata !== void 0 && { metadata }
172
172
  }
173
173
  }
174
174
  });
@@ -205,10 +205,10 @@ async function updatePatch(opts, context, current, original) {
205
205
  collectionName: context.collectionName,
206
206
  collectionId: original._id,
207
207
  patch,
208
- user,
209
- reason,
210
- metadata,
211
- version
208
+ version,
209
+ ...user !== void 0 && { user },
210
+ ...reason !== void 0 && { reason },
211
+ ...metadata !== void 0 && { metadata }
212
212
  });
213
213
  }
214
214
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ts-patch-mongoose",
3
- "version": "2.9.5",
3
+ "version": "2.9.6",
4
4
  "description": "Patch history & events for mongoose models",
5
5
  "author": "ilovepixelart",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git://github.com/ilovepixelart/ts-patch-mongoose.git"
9
+ "url": "git+https://github.com/ilovepixelart/ts-patch-mongoose.git"
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/ilovepixelart/ts-patch-mongoose/issues"
@@ -68,38 +68,42 @@
68
68
  "test:open": "vitest run --coverage && open-cli coverage/lcov-report/index.html",
69
69
  "type:check": "tsc --noEmit",
70
70
  "build": "pkgroll --clean-dist",
71
- "release": "npm install && npm run biome && npm run type:check && npm run build && np"
71
+ "release": "npm install && npm run biome && npm run type:check && npm run build && np --no-publish"
72
72
  },
73
73
  "dependencies": {
74
- "@types/lodash": "4.17.20",
74
+ "@types/lodash": "4.17.24",
75
75
  "@types/ms": "2.1.0",
76
76
  "@types/semver": "7.7.1",
77
77
  "fast-json-patch": "3.1.1",
78
- "lodash": "4.17.21",
78
+ "lodash": "4.17.23",
79
79
  "ms": "2.1.3",
80
80
  "omit-deep": "0.3.0",
81
81
  "power-assign": "0.2.10",
82
- "semver": "7.7.3"
82
+ "semver": "7.7.4"
83
83
  },
84
84
  "devDependencies": {
85
- "@biomejs/biome": "2.3.1",
86
- "@types/node": "24.9.1",
87
- "@vitest/coverage-v8": "4.0.4",
88
- "mongodb-memory-server": "10.2.3",
89
- "mongoose": "8.19.2",
85
+ "@biomejs/biome": "2.4.4",
86
+ "@types/node": "25.3.0",
87
+ "@vitest/coverage-v8": "4.0.18",
88
+ "mongodb-memory-server": "11.0.1",
89
+ "mongoose": "9.2.2",
90
90
  "open-cli": "8.0.0",
91
- "pkgroll": "2.20.1",
91
+ "pkgroll": "2.26.3",
92
92
  "simple-git-hooks": "2.13.1",
93
93
  "typescript": "5.9.3",
94
- "vitest": "4.0.4"
94
+ "vitest": "4.0.18",
95
+ "np": "11.0.2"
95
96
  },
96
97
  "peerDependencies": {
97
- "mongoose": ">=6.6.0 < 9"
98
+ "mongoose": ">=6.6.0 < 10"
98
99
  },
99
100
  "simple-git-hooks": {
100
101
  "pre-commit": "npm run type:check",
101
102
  "pre-push": "npm run biome:fix"
102
103
  },
104
+ "np": {
105
+ "publish": false
106
+ },
103
107
  "overrides": {
104
108
  "esbuild": "0.25.0"
105
109
  }
package/src/patch.ts CHANGED
@@ -94,10 +94,10 @@ export async function bulkPatch<T>(opts: PluginOptions<T>, context: PatchContext
94
94
  collectionName: context.collectionName,
95
95
  collectionId: doc._id as Types.ObjectId,
96
96
  doc: getObjectOmit(opts, doc),
97
- user,
98
- reason,
99
- metadata,
100
97
  version: 0,
98
+ ...(user !== undefined && { user }),
99
+ ...(reason !== undefined && { reason }),
100
+ ...(metadata !== undefined && { metadata }),
101
101
  },
102
102
  },
103
103
  })
@@ -146,10 +146,10 @@ export async function updatePatch<T>(opts: PluginOptions<T>, context: PatchConte
146
146
  collectionName: context.collectionName,
147
147
  collectionId: original._id as Types.ObjectId,
148
148
  patch,
149
- user,
150
- reason,
151
- metadata,
152
149
  version,
150
+ ...(user !== undefined && { user }),
151
+ ...(reason !== undefined && { reason }),
152
+ ...(metadata !== undefined && { metadata }),
153
153
  })
154
154
  }
155
155
  }