diff --git a/src/mongo.db.ts b/src/mongo.db.ts index 80ea856..466e9a3 100644 --- a/src/mongo.db.ts +++ b/src/mongo.db.ts @@ -35,9 +35,10 @@ export interface MongoDBCfg { logger?: CommonLogger } -export interface MongoDBSaveOptions +export interface MongoDBSaveOptions = AnyObjectWithId> extends CommonDBSaveOptions, CommandOperationOptions {} + export interface MongoDBOptions extends CommonDBOptions, CommandOperationOptions {} export class MongoDB extends BaseCommonDB implements CommonDB { @@ -104,7 +105,7 @@ export class MongoDB extends BaseCommonDB implements CommonDB { return colObjects.map(c => c.name) } - override async saveBatch( + override async saveBatch>( table: string, rows: ROW[], opt: MongoDBSaveOptions = {}, @@ -121,7 +122,7 @@ export class MongoDB extends BaseCommonDB implements CommonDB { filter: { _id: r.id, }, - replacement: this.mapToMongo(r), + replacement: this.mapToMongo(r as ObjectWithId), upsert: true, }, })), diff --git a/yarn.lock b/yarn.lock index e275b42..2dfab42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -449,10 +449,10 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" -"@es-joy/jsdoccomment@~0.22.1": - version "0.22.2" - resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.22.2.tgz#1c972f56a265ada7facbd0770a6caea6a391f5c8" - integrity sha512-pM6WQKcuAtdYoqCsXSvVSu3Ij8K0HY50L8tIheOKHDl0wH1uA4zbP88etY8SIeP16NVCMCTFU+Q2DahSKheGGQ== +"@es-joy/jsdoccomment@~0.23.1": + version "0.23.4" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.23.4.tgz#c18a4ac973f262bfede9182548a440523859740f" + integrity sha512-cC9SEf5SfQCzR3Noje3Lx06B8ReUbUk3m6z7fT3Pdgl/j2dbKuctvse3uzPq51JJTcrNaSqExn4vfc1rhwRPNQ== dependencies: comment-parser "1.3.1" esquery "^1.4.0" @@ -717,9 +717,9 @@ typescript "^4.0.2" "@naturalcycles/db-lib@^8.0.1": - version "8.36.1" - resolved "https://registry.yarnpkg.com/@naturalcycles/db-lib/-/db-lib-8.36.1.tgz#a58a1d4cedbb333927d5b80699c76cdd138b2611" - integrity sha512-MDkMalg7SPcHEaLscF3FknO1kgloxZDIrKvsXIqAMymZhZyKkEpKMfH8KzMt5zEIztsvgCrx5SZ/0tx0Ervuuw== + version "8.38.0" + resolved "https://registry.yarnpkg.com/@naturalcycles/db-lib/-/db-lib-8.38.0.tgz#9ab095a09182cfff825f940d9232f194b88b51c1" + integrity sha512-Zmk4KQl/vV6KmCN1Bk2eZ5cRgMk0uV5rN7KIEPrdjw959DvQWW+vZYXB2Nv3VT8J/GChQ133NO+Sl2c84o9h8Q== dependencies: "@naturalcycles/js-lib" "^14.0.0" "@naturalcycles/nodejs-lib" "^12.0.0" @@ -766,9 +766,9 @@ yargs "^17.0.0" "@naturalcycles/js-lib@^14.0.0": - version "14.98.1" - resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.98.1.tgz#3df41076d86c1e0bb4058747b02e00defce97de3" - integrity sha512-vp3FzxmCMsCSsQNrXJLucj0FAEo0m4sPKoLcSms+RqE2JYbS/daQIjDy1l6H1e448KHWuD1BDPLIZfpUkAtE7Q== + version "14.98.2" + resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.98.2.tgz#76dd4ec23b805837a3e84b088a13a15dea22e29b" + integrity sha512-D2QjRNFEtGPf9osVNOYUGylTpymW3wsGMHRPsdv0aj0tOb3gPLy/xJA1Rvjbwp2zK69IR2eDCPkIrwllfqnhPw== dependencies: tslib "^2.0.0" @@ -1171,9 +1171,9 @@ JSONStream@^1.0.4: through ">=2.2.7 <3" abab@^2.0.3, abab@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" - integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== acorn-globals@^6.0.0: version "6.0.0" @@ -2330,16 +2330,16 @@ eslint-plugin-jest@^26.0.0: "@typescript-eslint/utils" "^5.10.0" eslint-plugin-jsdoc@^39.1.0: - version "39.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.2.1.tgz#39c85a7b36fd49b2799d0e8652108f1e8e85fc64" - integrity sha512-bNNAJPhFUKVBHJMKU7zAQ1LvlVWoDbxAA/Ty9hwSI2hy+AVpc9wq16W6YHXd0PuMhXlv4FgYtjizHMu8Mnc4GA== + version "39.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.2.2.tgz#a16a4f04aab2fdf2120274722d6b097354495ab8" + integrity sha512-ybkvja0p9JRzHEd2ST9h+Z47DLOuPyXpeb6r18/zKHdMmggPU1J0/zl+F0phea8ze9rMxi42MJVmGXi2NZ7PpA== dependencies: - "@es-joy/jsdoccomment" "~0.22.1" + "@es-joy/jsdoccomment" "~0.23.1" comment-parser "1.3.1" debug "^4.3.4" escape-string-regexp "^4.0.0" esquery "^1.4.0" - semver "^7.3.6" + semver "^7.3.7" spdx-expression-parse "^3.0.1" eslint-plugin-unicorn@^42.0.0: @@ -2655,9 +2655,9 @@ form-data@^3.0.0: mime-types "^2.1.12" fs-extra@^10.0.0: - version "10.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.1.tgz#27de43b4320e833f6867cc044bfce29fdf0ef3b8" - integrity sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag== + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1" @@ -4804,7 +4804,7 @@ semver@7.3.5: dependencies: lru-cache "^6.0.0" -semver@7.x, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.6: +semver@7.x, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7: version "7.3.7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==