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 +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +8 -8
- package/package.json +18 -14
- package/src/patch.ts +6 -6
package/biome.json
CHANGED
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
82
|
+
"semver": "7.7.4"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@biomejs/biome": "2.
|
|
86
|
-
"@types/node": "
|
|
87
|
-
"@vitest/coverage-v8": "4.0.
|
|
88
|
-
"mongodb-memory-server": "
|
|
89
|
-
"mongoose": "
|
|
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.
|
|
91
|
+
"pkgroll": "2.26.3",
|
|
92
92
|
"simple-git-hooks": "2.13.1",
|
|
93
93
|
"typescript": "5.9.3",
|
|
94
|
-
"vitest": "4.0.
|
|
94
|
+
"vitest": "4.0.18",
|
|
95
|
+
"np": "11.0.2"
|
|
95
96
|
},
|
|
96
97
|
"peerDependencies": {
|
|
97
|
-
"mongoose": ">=6.6.0 <
|
|
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
|
}
|