@getanthill/event-source
Advanced tools
Comparing version 0.13.1 to 0.14.0
@@ -24,11 +24,3 @@ /** | ||
*/ | ||
static getRequiredIndexes(correlationField: any, withGlobalVersion: any): ({ | ||
version: number; | ||
unique?: undefined; | ||
name?: undefined; | ||
} | { | ||
unique: boolean; | ||
name: string; | ||
version?: undefined; | ||
})[][]; | ||
static getRequiredIndexes(correlationField: any, withGlobalVersion: any): [any, any][]; | ||
/** | ||
@@ -35,0 +27,0 @@ * Returns events for a given correlation id |
@@ -28,20 +28,43 @@ import { strict as assert } from 'assert'; | ||
static getRequiredIndexes(correlationField, withGlobalVersion) { | ||
return [ | ||
const indexes = [ | ||
[ | ||
withGlobalVersion === true | ||
? { | ||
version: 1, | ||
} | ||
: { | ||
[correlationField]: 1, | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: withGlobalVersion === true | ||
? 'version_unicity' | ||
: 'correlation_id_version_unicity', | ||
created_at: 1, | ||
}, | ||
{ | ||
name: 'created_at_1', | ||
}, | ||
], | ||
]; | ||
if (withGlobalVersion === true) { | ||
indexes.push([ | ||
{ | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: 'version_unicity', | ||
}, | ||
]); | ||
} | ||
else { | ||
indexes.push([ | ||
{ | ||
version: 1, | ||
}, | ||
{ | ||
name: 'version_1', | ||
}, | ||
], [ | ||
{ | ||
[correlationField]: 1, | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: 'correlation_id_version_unicity', | ||
}, | ||
]); | ||
} | ||
return indexes; | ||
} | ||
@@ -48,0 +71,0 @@ /** |
{ | ||
"name": "@getanthill/event-source", | ||
"version": "0.13.1", | ||
"version": "0.14.0", | ||
"description": "Event-sourced data store handling library", | ||
@@ -36,13 +36,13 @@ "main": "dist/bundle.cjs.js", | ||
"@airbnb/node-memwatch": "2.0.0", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-typescript": "^7.21.0", | ||
"@commitlint/cli": "17.4.4", | ||
"@commitlint/config-conventional": "17.4.4", | ||
"@getanthill/mongodb-connector": "1.3.0", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@semantic-release/changelog": "6.0.2", | ||
"@semantic-release/gitlab": "11.0.1", | ||
"@types/jest": "^29.4.0", | ||
"@babel/preset-env": "^7.21.5", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@commitlint/cli": "17.6.1", | ||
"@commitlint/config-conventional": "17.6.1", | ||
"@getanthill/mongodb-connector": "1.3.2", | ||
"@rollup/plugin-commonjs": "^24.1.0", | ||
"@rollup/plugin-node-resolve": "^15.0.2", | ||
"@rollup/plugin-typescript": "^11.1.0", | ||
"@semantic-release/changelog": "6.0.3", | ||
"@semantic-release/gitlab": "12.0.1", | ||
"@types/jest": "^29.5.1", | ||
"babel-jest": "^29.5.0", | ||
@@ -53,10 +53,10 @@ "babel-loader": "^9.1.2", | ||
"jest": "^29.5.0", | ||
"mongodb": "^5.1.0", | ||
"npm": "^9.6.0", | ||
"prettier": "^2.8.4", | ||
"rollup": "^3.18.0", | ||
"rollup-plugin-external-globals": "^0.7.1", | ||
"semantic-release": "20.1.1", | ||
"mongodb": "^5.3.0", | ||
"npm": "^9.6.5", | ||
"prettier": "^2.8.8", | ||
"rollup": "^3.21.3", | ||
"rollup-plugin-external-globals": "^0.7.3", | ||
"semantic-release": "21.0.2", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.5", | ||
"typescript": "^5.0.4", | ||
"validate-branch-name": "1.3.0" | ||
@@ -63,0 +63,0 @@ }, |
@@ -34,21 +34,47 @@ import { strict as assert } from 'assert'; | ||
static getRequiredIndexes(correlationField, withGlobalVersion) { | ||
return [ | ||
const indexes: [any, any][] = [ | ||
[ | ||
withGlobalVersion === true | ||
? { | ||
version: 1, | ||
} | ||
: { | ||
[correlationField]: 1, | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: | ||
withGlobalVersion === true | ||
? 'version_unicity' | ||
: 'correlation_id_version_unicity', | ||
created_at: 1, | ||
}, | ||
{ | ||
name: 'created_at_1', | ||
}, | ||
], | ||
]; | ||
if (withGlobalVersion === true) { | ||
indexes.push([ | ||
{ | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: 'version_unicity', | ||
}, | ||
]); | ||
} else { | ||
indexes.push( | ||
[ | ||
{ | ||
version: 1, | ||
}, | ||
{ | ||
name: 'version_1', | ||
}, | ||
], | ||
[ | ||
{ | ||
[correlationField]: 1, | ||
version: 1, | ||
}, | ||
{ | ||
unique: true, | ||
name: 'correlation_id_version_unicity', | ||
}, | ||
], | ||
); | ||
} | ||
return indexes; | ||
} | ||
@@ -55,0 +81,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1292554
35990