ts-patch-mongoose 2.6.5 → 2.6.7

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.
Files changed (96) hide show
  1. package/.swcrc +1 -1
  2. package/LICENSE +1 -1
  3. package/README.md +0 -2
  4. package/biome.json +30 -0
  5. package/dist/cjs/em.js +2 -2
  6. package/dist/cjs/em.js.map +1 -1
  7. package/dist/cjs/helpers.js +1 -1
  8. package/dist/cjs/helpers.js.map +1 -1
  9. package/dist/cjs/hooks/delete-hooks.js +5 -13
  10. package/dist/cjs/hooks/delete-hooks.js.map +1 -1
  11. package/dist/cjs/hooks/save-hooks.js +1 -1
  12. package/dist/cjs/hooks/save-hooks.js.map +1 -1
  13. package/dist/cjs/hooks/update-hooks.js +6 -14
  14. package/dist/cjs/hooks/update-hooks.js.map +1 -1
  15. package/dist/cjs/models/History.js.map +1 -1
  16. package/dist/cjs/patch.js +7 -11
  17. package/dist/cjs/patch.js.map +1 -1
  18. package/dist/cjs/plugin.js +2 -2
  19. package/dist/cjs/plugin.js.map +1 -1
  20. package/dist/cjs/types/em.d.ts +1 -1
  21. package/dist/cjs/types/em.d.ts.map +1 -1
  22. package/dist/cjs/types/hooks/delete-hooks.d.ts.map +1 -1
  23. package/dist/cjs/types/hooks/save-hooks.d.ts.map +1 -1
  24. package/dist/cjs/types/hooks/update-hooks.d.ts.map +1 -1
  25. package/dist/cjs/types/interfaces/IHistory.d.ts +1 -1
  26. package/dist/cjs/types/interfaces/IHistory.d.ts.map +1 -1
  27. package/dist/cjs/types/models/History.d.ts +6 -0
  28. package/dist/cjs/types/models/History.d.ts.map +1 -1
  29. package/dist/cjs/types/patch.d.ts +2 -2
  30. package/dist/cjs/types/patch.d.ts.map +1 -1
  31. package/dist/cjs/types/plugin.d.ts.map +1 -1
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/cjs/version.js.map +1 -1
  34. package/dist/esm/em.js +1 -1
  35. package/dist/esm/em.js.map +1 -1
  36. package/dist/esm/helpers.js +1 -1
  37. package/dist/esm/helpers.js.map +1 -1
  38. package/dist/esm/hooks/delete-hooks.js +5 -13
  39. package/dist/esm/hooks/delete-hooks.js.map +1 -1
  40. package/dist/esm/hooks/save-hooks.js +1 -1
  41. package/dist/esm/hooks/save-hooks.js.map +1 -1
  42. package/dist/esm/hooks/update-hooks.js +6 -14
  43. package/dist/esm/hooks/update-hooks.js.map +1 -1
  44. package/dist/esm/models/History.js.map +1 -1
  45. package/dist/esm/patch.js +7 -11
  46. package/dist/esm/patch.js.map +1 -1
  47. package/dist/esm/plugin.js +2 -2
  48. package/dist/esm/plugin.js.map +1 -1
  49. package/dist/esm/types/em.d.ts +1 -1
  50. package/dist/esm/types/em.d.ts.map +1 -1
  51. package/dist/esm/types/hooks/delete-hooks.d.ts.map +1 -1
  52. package/dist/esm/types/hooks/save-hooks.d.ts.map +1 -1
  53. package/dist/esm/types/hooks/update-hooks.d.ts.map +1 -1
  54. package/dist/esm/types/interfaces/IHistory.d.ts +1 -1
  55. package/dist/esm/types/interfaces/IHistory.d.ts.map +1 -1
  56. package/dist/esm/types/models/History.d.ts +6 -0
  57. package/dist/esm/types/models/History.d.ts.map +1 -1
  58. package/dist/esm/types/patch.d.ts +2 -2
  59. package/dist/esm/types/patch.d.ts.map +1 -1
  60. package/dist/esm/types/plugin.d.ts.map +1 -1
  61. package/dist/esm/version.js +1 -1
  62. package/dist/esm/version.js.map +1 -1
  63. package/package.json +16 -25
  64. package/src/em.ts +1 -1
  65. package/src/helpers.ts +1 -1
  66. package/src/hooks/delete-hooks.ts +8 -16
  67. package/src/hooks/save-hooks.ts +3 -4
  68. package/src/hooks/update-hooks.ts +7 -18
  69. package/src/interfaces/IHistory.ts +1 -1
  70. package/src/interfaces/IHookContext.ts +1 -1
  71. package/src/models/History.ts +41 -38
  72. package/src/patch.ts +10 -15
  73. package/src/plugin.ts +3 -4
  74. package/src/version.ts +1 -1
  75. package/tests/em.test.ts +4 -2
  76. package/tests/mongo/.gitignore +3 -0
  77. package/tests/mongo/server.ts +32 -0
  78. package/tests/patch.test.ts +16 -11
  79. package/tests/plugin-event-created.test.ts +37 -57
  80. package/tests/plugin-event-deleted.test.ts +23 -13
  81. package/tests/plugin-event-updated.test.ts +48 -31
  82. package/tests/plugin-global.test.ts +51 -41
  83. package/tests/plugin-omit-all.test.ts +15 -8
  84. package/tests/plugin-patch-history-disabled.test.ts +15 -8
  85. package/tests/plugin-pre-delete.test.ts +15 -9
  86. package/tests/plugin-pre-save.test.ts +13 -8
  87. package/tests/plugin.test.ts +17 -9
  88. package/tests/schemas/DescriptionSchema.ts +8 -5
  89. package/tests/schemas/ProductSchema.ts +22 -19
  90. package/tests/schemas/UserSchema.ts +12 -9
  91. package/tsconfig.json +4 -14
  92. package/vite.config.mts +12 -0
  93. package/.eslintignore +0 -4
  94. package/.eslintrc +0 -96
  95. package/jest-mongodb-config.ts +0 -10
  96. package/jest.config.ts +0 -32
package/.eslintrc DELETED
@@ -1,96 +0,0 @@
1
- {
2
- "root": true,
3
- "env": {
4
- "commonjs": true,
5
- "es2021": true,
6
- "node": true,
7
- "jest": true
8
- },
9
- "parser": "@typescript-eslint/parser",
10
- "plugins": [
11
- "@typescript-eslint",
12
- "sonarjs"
13
- ],
14
- "extends": [
15
- "eslint:recommended",
16
- "plugin:sonarjs/recommended",
17
- "plugin:@typescript-eslint/eslint-recommended",
18
- "plugin:@stylistic/recommended-extends"
19
- ],
20
- "globals": {
21
- "Atomics": "readonly",
22
- "SharedArrayBuffer": "readonly"
23
- },
24
- "parserOptions": {
25
- "ecmaVersion": 2021,
26
- "sourceType": "module"
27
- },
28
- "rules": {
29
- "@stylistic/arrow-parens": ["error", "always"],
30
- "@stylistic/brace-style": ["error", "1tbs"],
31
- "@typescript-eslint/array-type": "error",
32
- "@typescript-eslint/consistent-type-imports": "error",
33
- "@typescript-eslint/method-signature-style": "error",
34
- "@typescript-eslint/consistent-indexed-object-style": "error"
35
- },
36
- "overrides": [
37
- {
38
- "files": [
39
- "tests/**/*.test.ts"
40
- ],
41
- "plugins": [
42
- "jest",
43
- "jest-formatting"
44
- ],
45
- "extends": [
46
- "plugin:@typescript-eslint/recommended",
47
- "plugin:@typescript-eslint/strict",
48
- "plugin:@typescript-eslint/stylistic",
49
- "plugin:jest/style",
50
- "plugin:jest/recommended",
51
- "plugin:jest-formatting/recommended"
52
- ],
53
- "rules": {
54
- "sonarjs/no-duplicate-string": "off"
55
- }
56
- },
57
- {
58
- "parserOptions": {
59
- "project": [
60
- "tsconfig.json"
61
- ]
62
- },
63
- "files": [
64
- "src/**/*.ts"
65
- ],
66
- "extends": [
67
- "plugin:@typescript-eslint/recommended-type-checked",
68
- "plugin:@typescript-eslint/strict-type-checked",
69
- "plugin:@typescript-eslint/stylistic-type-checked"
70
- ],
71
- "rules": {
72
- "@typescript-eslint/member-delimiter-style": [
73
- "error",
74
- {
75
- "multiline": {
76
- "delimiter": "none",
77
- "requireLast": true
78
- },
79
- "singleline": {
80
- "delimiter": "comma",
81
- "requireLast": false
82
- }
83
- }
84
- ],
85
- "@typescript-eslint/consistent-type-exports": "error",
86
- "@typescript-eslint/explicit-function-return-type": "error",
87
- "@typescript-eslint/explicit-module-boundary-types": "error",
88
- "@typescript-eslint/member-ordering": "error",
89
- "@typescript-eslint/typedef": "error",
90
- "@typescript-eslint/prefer-enum-initializers": "error",
91
- "@typescript-eslint/require-array-sort-compare": "error",
92
- "@typescript-eslint/no-redundant-type-constituents": "error"
93
- }
94
- }
95
- ]
96
- }
@@ -1,10 +0,0 @@
1
- export default {
2
- mongodbMemoryServerOptions: {
3
- binary: {
4
- skipMD5: true,
5
- },
6
- autoStart: false,
7
- instance: {},
8
- },
9
- useSharedDBForAllJestWorkers: false,
10
- }
package/jest.config.ts DELETED
@@ -1,32 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- const { recursive } = require('merge')
3
- const mongo = require('@shelf/jest-mongodb/jest-preset')
4
-
5
- const config = recursive(mongo, {
6
- roots: [
7
- '<rootDir>/src/',
8
- '<rootDir>/tests/',
9
- ],
10
- clearMocks: true,
11
- collectCoverage: true,
12
- collectCoverageFrom: [
13
- 'src/**/*.ts',
14
- '!src/**/*.d.ts',
15
- '!src/interfaces/**/*.ts',
16
- ],
17
- coverageDirectory: 'coverage',
18
- testMatch: [
19
- '<rootDir>/tests/**/*.test.ts',
20
- ],
21
- transform: {
22
- '^.+\\.(t|j)sx?$': '@swc-node/jest',
23
- },
24
- testPathIgnorePatterns: [
25
- 'node_modules',
26
- ],
27
- watchPathIgnorePatterns: [
28
- 'globalConfig',
29
- ],
30
- })
31
-
32
- module.exports = config