mongofire 6.5.3 → 6.5.5
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/CHANGELOG.md +21 -67
- package/README.md +365 -136
- package/dist/bin/mongofire.cjs +1 -851
- package/dist/src/changetrack.js +1 -1
- package/dist/src/compactor.js +1 -0
- package/dist/src/connection.js +1 -1
- package/dist/src/device.js +1 -1
- package/dist/src/diff.js +1 -0
- package/dist/src/field-merge.js +1 -0
- package/dist/src/index.cjs +1 -1
- package/dist/src/plugin.js +1 -1
- package/dist/src/plugin.mjs +6 -0
- package/dist/src/rate-limiter.js +1 -0
- package/dist/src/reconcile.js +1 -1
- package/dist/src/schema-manager.js +1 -0
- package/dist/src/state.js +1 -1
- package/dist/src/sync.js +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/types/index.d.ts +134 -307
- package/index.cjs +0 -2
- package/index.mjs +0 -1
- package/package.json +20 -19
- package/bin/mongofire.cjs +0 -852
package/dist/src/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x3e354b,_0x2f8583){const _0x4fc325={_0x25cf44:0x15d,_0x5c86d8:0x14d,_0x31fefd:0x347,_0x4ae2b9:0x39b,_0x1a83cc:0x370,_0x387b3e:0x3c5,_0x3849c3:0x3cb,_0x4713b4:0x3aa,_0x14ea1e:0x3e6,_0x59013b:0x38e,_0x3a5223:0xdb,_0x139dd2:0xee,_0x5a1aa5:0xd9,_0x5192e9:0x37d,_0xced1e5:0x3a1,_0x56b571:0x37f,_0x214ea7:0x395,_0x3e32fb:0x38a,_0x2628d7:0x3c3},_0x32ef93={_0x7089c6:0x270},_0x58b6ce=_0x3e354b();function _0x1c1b24(_0x5039e9,_0x17d878,_0x833cd0,_0x292547){return _0x1617(_0x833cd0- -_0x32ef93._0x7089c6,_0x17d878);}function _0x57e2d3(_0x5bb217,_0x1c0baf,_0x54d933,_0x1173e0){return _0x1617(_0x5bb217-0x241,_0x1173e0);}while(!![]){try{const _0x2af1bd=-parseInt(_0x1c1b24(-_0x4fc325._0x25cf44,-0x14e,-_0x4fc325._0x5c86d8,-0x162))/(-0x27b*0x5+0x19*0x11b+-0xf3b*0x1)+-parseInt(_0x57e2d3(0x350,0x313,_0x4fc325._0x31fefd,0x363))/(0x6*0x13+0x27*0x81+-0x1417)+-parseInt(_0x57e2d3(_0x4fc325._0x4ae2b9,_0x4fc325._0x1a83cc,_0x4fc325._0x387b3e,_0x4fc325._0x3849c3))/(0x1477+0x4*0x95d+0x73d*-0x8)+parseInt(_0x57e2d3(_0x4fc325._0x4713b4,_0x4fc325._0x14ea1e,_0x4fc325._0x59013b,0x384))/(0x1*-0x8cc+0x741+0x18f)+-parseInt(_0x1c1b24(-0xbe,-_0x4fc325._0x3a5223,-_0x4fc325._0x139dd2,-_0x4fc325._0x5a1aa5))/(0x120*-0x5+-0x91a+0x19*0x97)+-parseInt(_0x57e2d3(0x391,0x353,0x3b9,0x3b3))/(0x11a3+0x1d6+-0x1373)+parseInt(_0x57e2d3(_0x4fc325._0x5192e9,_0x4fc325._0xced1e5,0x347,_0x4fc325._0x56b571))/(0x2b*-0xe3+0x11ff+0x1429)*(parseInt(_0x57e2d3(_0x4fc325._0x214ea7,0x362,_0x4fc325._0x3e32fb,_0x4fc325._0x2628d7))/(-0x2206+0x97*-0x1f+0x3457));if(_0x2af1bd===_0x2f8583)break;else _0x58b6ce['push'](_0x58b6ce['shift']());}catch(_0x228230){_0x58b6ce['push'](_0x58b6ce['shift']());}}}(_0x4500,-0x5*0x18603+-0xbf8d*-0x1+0xb2d77*0x1));const crypto=require(_0xd3a169(0xb5,0xd4,0xb5,0xf3)),{ObjectId}=require('mongodb');function asDate(_0x5b1770){const _0x38fc15={_0x5c97c7:0x113},_0xb13e5f={_0x5559e6:0xe3,_0x37d41d:0xbe};if(!_0x5b1770)return null;const _0x57048a=new Date(_0x5b1770);function _0x4c794e(_0x148549,_0x49c145,_0x27e37b,_0x9eafe5){return _0xd3a169(_0x27e37b,_0x49c145-_0xb13e5f._0x5559e6,_0x49c145-0x78,_0x9eafe5-_0xb13e5f._0x37d41d);}return Number['isNaN'](_0x57048a[_0x4c794e(0xed,_0x38fc15._0x5c97c7,0x146,0xde)]())?null:_0x57048a;}function asInt(_0x427210,_0x3bae66=-0xbd0+-0x2058+0x3*0xeb8){const _0x377200={_0x2e7f65:0xd2,_0xa4fb0f:0xea,_0xc920bd:0x9b,_0x30ecb9:0xad,_0xbbb9ae:0x109,_0x4300e7:0xc7,_0x3b0daf:0xdf,_0x3797dc:0xdd,_0x2b6fb5:0x1da},_0xbd69a5={_0x30a2e8:0x11c,_0x470de9:0x15},_0x58f9c6={_0x1e63f6:0x112,_0x5c8c13:0x272},_0x12cc49={'QiPel':function(_0xb570a2,_0x999d){return _0xb570a2(_0x999d);},'foFRL':function(_0x59bd17,_0x51fcc3){return _0x59bd17!=_0x51fcc3;}};function _0x4cc2ac(_0x296acc,_0xf1cc60,_0x5c4eb3,_0x222184){return _0xd3a169(_0x296acc,_0xf1cc60-_0x58f9c6._0x1e63f6,_0x5c4eb3- -_0x58f9c6._0x5c8c13,_0x222184-0x6f);}function _0x168387(_0x3eacf1,_0x20f1eb,_0x49951c,_0x4cc663){return _0xd3a169(_0x49951c,_0x20f1eb-_0xbd69a5._0x30a2e8,_0x4cc663-_0xbd69a5._0x470de9,_0x4cc663-0x42);}const _0x5be7a0=_0x12cc49[_0x168387(_0x377200._0x2e7f65,_0x377200._0xa4fb0f,_0x377200._0xc920bd,_0x377200._0x30ecb9)](Number,_0x427210);return Number[_0x168387(_0x377200._0xbbb9ae,0x134,_0x377200._0x4300e7,0xf7)](_0x5be7a0)?_0x5be7a0:_0x12cc49[_0x168387(0xe5,_0x377200._0x3b0daf,_0x377200._0x3797dc,0xed)](_0x3bae66,null)?_0x12cc49[_0x4cc2ac(-0x1a0,-0x20a,-_0x377200._0x2b6fb5,-0x1e1)](Number,_0x3bae66):-0x1e8*0xa+0x13f*0x17+-0x999;}function _0xd3a169(_0x509ba7,_0x368672,_0x40f587,_0x25c49){return _0x1617(_0x40f587- -0x99,_0x509ba7);}function metaId(_0x12304a,_0x15275e){return _0x12304a+':'+_0x15275e;}function toObjectId(_0x5bfc4f){if(!_0x5bfc4f)return _0x5bfc4f;if(_0x5bfc4f instanceof ObjectId)return _0x5bfc4f;try{return new ObjectId(_0x5bfc4f);}catch{return _0x5bfc4f;}}const _COLLECTION_NAME_RE=/^[a-zA-Z0-9][a-zA-Z0-9_.\-]*$/;function validateCollectionName(_0x4aed55){const _0x55d3e5={_0x1ee3cd:0x216,_0x257933:0x1d1,_0x36205e:0x1d0,_0x1ea394:0x24f,_0xb886c6:0x273,_0x1c7287:0x25e,_0xa83802:0x271,_0x299dc1:0x29b,_0x2bb8b7:0x288,_0x54ff67:0x2c3,_0x44d6df:0x25c,_0x4fbca1:0x278,_0x5a1f27:0x255,_0x5af14a:0x2bd,_0x1b7c99:0x2ae,_0x4158dc:0x295,_0x584474:0x2c8,_0x369836:0x2da,_0x558800:0x2de,_0x23bbd7:0x2ba,_0xad2760:0x1d8,_0x69baf7:0x1f8,_0x338f58:0x1fc,_0x4cf02f:0x1da,_0x545f38:0x263,_0x27f33d:0x236,_0x2cd86c:0x226,_0x30c94b:0x1d0,_0x31485c:0x202,_0x396552:0x1c6,_0xdc171d:0x221,_0x2dfd48:0x2bb,_0x1e1e08:0x2f7,_0x41e125:0x246,_0x292531:0x286,_0x56d35e:0x1ae,_0x56acd2:0x1fe,_0x236e8a:0x223,_0x3caf39:0x258,_0x5730fa:0x1ef,_0x1a084c:0x1eb,_0x52b890:0x20c,_0x53d1f1:0x1ee,_0x3e9ab1:0x1bd,_0x15d525:0x1ed,_0x301c20:0x2a5,_0x13e4e5:0x290,_0x2d8026:0x26c,_0x30dba2:0x1f3,_0x52aeba:0x1b1,_0x48b246:0x28f,_0x56eb3e:0x287,_0x553b17:0x257,_0xa3d5b8:0x22f,_0x1a5d14:0x26b,_0x581b4f:0x2ce,_0x35ad24:0x1c6,_0x221990:0x1bc,_0x507961:0x295,_0xa62c00:0x2bf,_0x5a8cbc:0x214,_0x572c32:0x1df,_0xb6e871:0x21c,_0x39f681:0x1e7,_0x5c5971:0x1e2,_0x5e9874:0x213,_0x2469e9:0x1da,_0x253817:0x1de,_0x25d577:0x26a,_0x235710:0x24c,_0x4438fe:0x254,_0x41f77f:0x21d,_0x787285:0x217,_0x48749f:0x218,_0x118b25:0x2a3,_0x117c88:0x280,_0x175112:0x2e9,_0x51601a:0x2c7,_0x45b2af:0x274,_0x556d05:0x256},_0x312512={_0x5cac6c:0x169},_0x16e659={_0x5ec646:0x1e8},_0x24dc53={};_0x24dc53['zADnH']=_0x1b2994(_0x55d3e5._0x1ee3cd,_0x55d3e5._0x257933,0x208,_0x55d3e5._0x36205e),_0x24dc53['YAGLv']=function(_0x5bf2fc,_0x2b9377){return _0x5bf2fc+_0x2b9377;},_0x24dc53[_0x175191(0x279,0x2a8,0x26e,_0x55d3e5._0x1ea394)]=function(_0x2c3a1b,_0x404602){return _0x2c3a1b+_0x404602;};const _0x58775a=_0x24dc53;function _0x175191(_0x139b61,_0x4a3d28,_0x31bccd,_0x3582c5){return _0xd3a169(_0x4a3d28,_0x4a3d28-_0x16e659._0x5ec646,_0x139b61-0x1d7,_0x3582c5-0xe4);}if(!_0x4aed55||typeof _0x4aed55!==_0x175191(_0x55d3e5._0xb886c6,0x269,_0x55d3e5._0x1c7287,_0x55d3e5._0xa83802))throw new Error(_0x175191(0x2a5,0x2b5,0x2b0,_0x55d3e5._0x299dc1)+']\x20Collecti'+'on\x20name\x20mu'+_0x175191(_0x55d3e5._0x2bb8b7,_0x55d3e5._0x54ff67,0x2a4,_0x55d3e5._0x44d6df)+_0x175191(_0x55d3e5._0x4fbca1,_0x55d3e5._0x5a1f27,0x2a5,0x29b)+_0x175191(_0x55d3e5._0x5af14a,_0x55d3e5._0x1b7c99,0x2c1,_0x55d3e5._0x4158dc)+'\x20'+JSON[_0x175191(_0x55d3e5._0x584474,_0x55d3e5._0x369836,_0x55d3e5._0x558800,_0x55d3e5._0x23bbd7)](_0x4aed55));function _0x1b2994(_0x330301,_0x2837fb,_0x5730e2,_0x43797a){return _0xd3a169(_0x43797a,_0x2837fb-_0x312512._0x5cac6c,_0x5730e2-0x145,_0x43797a-0x72);}if(_0x4aed55['startsWith'](_0x1b2994(0x241,_0x55d3e5._0xad2760,0x210,0x21b)))throw new Error('[MongoFire'+_0x1b2994(_0x55d3e5._0x69baf7,_0x55d3e5._0x338f58,_0x55d3e5._0x4cf02f,0x20a)+_0x1b2994(0x209,0x19d,_0x55d3e5._0xad2760,0x1c0)+_0x4aed55+(_0x175191(_0x55d3e5._0x545f38,0x259,_0x55d3e5._0x27f33d,0x255)+_0x1b2994(_0x55d3e5._0x2cd86c,_0x55d3e5._0x30c94b,0x20a,_0x55d3e5._0x31485c)+'s\x20starting'+_0x1b2994(_0x55d3e5._0x396552,_0x55d3e5._0xdc171d,0x201,0x22d)+_0x175191(_0x55d3e5._0x2dfd48,0x2a5,0x29a,_0x55d3e5._0x1e1e08))+(_0x175191(0x25e,0x22a,_0x55d3e5._0x41e125,_0x55d3e5._0x292531)+'nternally\x20'+_0x1b2994(0x1a6,0x1a2,0x1d6,_0x55d3e5._0x56d35e)+'re\x20and\x20can'+_0x175191(0x27e,0x269,0x25d,0x26a)+_0x1b2994(0x25f,_0x55d3e5._0x56acd2,_0x55d3e5._0x236e8a,_0x55d3e5._0x3caf39)));if(_0x4aed55[_0x1b2994(0x1ea,0x22f,0x225,_0x55d3e5._0x5730fa)](':')){if(_0x1b2994(_0x55d3e5._0x1a084c,_0x55d3e5._0x52b890,0x208,0x21f)===_0x58775a[_0x1b2994(_0x55d3e5._0x53d1f1,_0x55d3e5._0x3e9ab1,_0x55d3e5._0x15d525,0x218)])throw new Error(_0x58775a['YAGLv'](_0x175191(_0x55d3e5._0x301c20,0x2d7,_0x55d3e5._0x13e4e5,_0x55d3e5._0x2d8026)+_0x1b2994(_0x55d3e5._0x30dba2,0x1b3,0x1da,_0x55d3e5._0x52aeba)+_0x175191(0x26a,_0x55d3e5._0x48b246,0x28d,_0x55d3e5._0x56eb3e)+_0x4aed55+(_0x175191(_0x55d3e5._0x553b17,_0x55d3e5._0xa3d5b8,_0x55d3e5._0x1a5d14,0x27b)+_0x175191(0x294,_0x55d3e5._0x581b4f,0x2cd,0x2b8)+_0x1b2994(0x200,0x1c6,_0x55d3e5._0x35ad24,_0x55d3e5._0x56d35e)+_0x1b2994(0x1ad,_0x55d3e5._0x4cf02f,_0x55d3e5._0x221990,0x1b1)),'metaId\x20key'+'\x20collision'+_0x175191(_0x55d3e5._0x507961,0x258,_0x55d3e5._0xa62c00,0x292)+'ocmeta.\x20Re'+'name\x20the\x20c'+_0x1b2994(_0x55d3e5._0x5a8cbc,_0x55d3e5._0x572c32,0x205,0x1ea)));else return _0x1b81e1+':'+_0x33ccb8;}if(!_COLLECTION_NAME_RE['test'](_0x4aed55))throw new Error(_0x58775a[_0x1b2994(_0x55d3e5._0xb6e871,0x20b,_0x55d3e5._0x39f681,_0x55d3e5._0x5730fa)](_0x1b2994(0x230,_0x55d3e5._0x5c5971,_0x55d3e5._0x5e9874,0x1e3)+_0x1b2994(_0x55d3e5._0x2469e9,_0x55d3e5._0x253817,_0x55d3e5._0x2469e9,0x1ef)+_0x175191(_0x55d3e5._0x25d577,_0x55d3e5._0x235710,0x29a,0x272)+_0x4aed55+(_0x175191(_0x55d3e5._0x553b17,0x21d,_0x55d3e5._0x4438fe,_0x55d3e5._0x41f77f)+_0x1b2994(0x215,0x23e,_0x55d3e5._0x787285,_0x55d3e5._0x48749f)+_0x175191(0x29e,_0x55d3e5._0x118b25,_0x55d3e5._0x117c88,0x299)+'\x20'),_0x175191(0x290,0x2b4,_0x55d3e5._0x118b25,0x26d)+_0x175191(0x2b6,0x28f,_0x55d3e5._0x175112,_0x55d3e5._0x51601a)+_0x175191(0x255,_0x55d3e5._0x2cd86c,0x231,0x247)+_0x175191(_0x55d3e5._0x45b2af,0x2a4,0x24e,_0x55d3e5._0x556d05)+'yphens,\x20do'+'ts.'));}function resolveOwnerKey(_0x2d08b7){const _0x3948f5={_0xf96984:0x22e,_0x428638:0x228,_0x3cce60:0x24a,_0x31d63d:0x23e,_0x3af7a8:0x205,_0x8664e:0x28c,_0x414ce6:0x2b6,_0x4671fd:0x2c9,_0x5ae3f6:0x2f6},_0xf683f8={_0x334068:0x2c,_0x141445:0x178},_0x2ae1c4={_0x66ce0b:0x195},_0x50e47c={};_0x50e47c['juCsD']=_0x47d60f(_0x3948f5._0xf96984,0x21a,0x207,_0x3948f5._0x428638);const _0x32bafb=_0x50e47c;function _0x4d4b7f(_0x246d93,_0x18d134,_0x55ff57,_0x2eac1f){return _0xd3a169(_0x55ff57,_0x18d134-0x19a,_0x18d134-0x1fc,_0x2eac1f-_0x2ae1c4._0x66ce0b);}if(!_0x2d08b7)return _0x47d60f(_0x3948f5._0xf96984,0x212,_0x3948f5._0x3cce60,_0x3948f5._0x31d63d);function _0x47d60f(_0x472ff9,_0x4128c1,_0x395934,_0x2548cc){return _0xd3a169(_0x2548cc,_0x4128c1-_0xf683f8._0x334068,_0x472ff9-_0xf683f8._0x141445,_0x2548cc-0x5d);}const _0x58ea5d=_0x2d08b7[_0x47d60f(0x225,_0x3948f5._0x3af7a8,0x1f3,0x1f4)]??_0x2d08b7[_0x4d4b7f(_0x3948f5._0x8664e,_0x3948f5._0x414ce6,0x2b8,0x2eb)];return _0x58ea5d==null||_0x58ea5d===''?_0x32bafb[_0x4d4b7f(_0x3948f5._0x4671fd,0x2c6,0x2f0,_0x3948f5._0x5ae3f6)]:String(_0x58ea5d);}function resolveOpType(_0x15301c){const _0x1d2095={_0x9c84aa:0x1f5,_0x365490:0x1f4,_0x44db99:0x1a4,_0x39d421:0x1e0,_0x50e107:0x1a9},_0x571c0e={_0x14076c:0x1aa},_0x55b7aa={_0x16853f:0x15e};function _0x11c24b(_0x5e6435,_0x56c7f2,_0x278e8a,_0x1e2524){return _0xd3a169(_0x5e6435,_0x56c7f2-0x1ac,_0x1e2524-0x105,_0x1e2524-_0x55b7aa._0x16853f);}const _0x1b93ad={};function _0x2343e6(_0x560cd4,_0x448a6c,_0x1bf1c9,_0x8b21a8){return _0xd3a169(_0x560cd4,_0x448a6c-0xf4,_0x448a6c-0x9d,_0x8b21a8-_0x571c0e._0x14076c);}_0x1b93ad['IOLtK']='update';const _0x4fe1f6=_0x1b93ad;return _0x15301c?.[_0x11c24b(0x200,_0x1d2095._0x9c84aa,0x1d3,_0x1d2095._0x365490)]||_0x15301c?.['op']||_0x4fe1f6[_0x11c24b(_0x1d2095._0x44db99,0x1ac,_0x1d2095._0x39d421,_0x1d2095._0x50e107)];}function _deepClone(_0x19b743){const _0x1b8694={_0x1c950f:0x53,_0x8fd000:0x5a,_0x2768c6:0x1d,_0x4b56e8:0x33,_0x1b1a28:0x12,_0x1e7000:0x5b,_0x58b0e4:0xc,_0x114c3b:0xf,_0x1f345f:0x34,_0x4a1680:0xb,_0x407b8f:0x4f,_0x3e5d79:0x53,_0x1b8dd5:0x2c,_0x54a72c:0x3f,_0x30b7d9:0x4b,_0x21c890:0x5f,_0x371ea2:0x48,_0x316974:0x2f},_0x4aff16={_0x446635:0x27,_0x3a117c:0x83},_0x287f80={_0x3c44ad:0xc9,_0x3be318:0xdb},_0x458789={};_0x458789[_0x16a3d4(_0x1b8694._0x1c950f,0x79,0x73,_0x1b8694._0x8fd000)]=function(_0x227cc8,_0x144242){return _0x227cc8===_0x144242;},_0x458789[_0x38ed45(0x10,0xa,_0x1b8694._0x2768c6,_0x1b8694._0x4b56e8)]=function(_0x419860,_0x166afe){return _0x419860 instanceof _0x166afe;};const _0x1de905=_0x458789;function _0x38ed45(_0x1c6a5d,_0x1881b2,_0x46a6a5,_0x4611e1){return _0xd3a169(_0x4611e1,_0x1881b2-_0x287f80._0x3c44ad,_0x1c6a5d- -0xc4,_0x4611e1-_0x287f80._0x3be318);}if(_0x19b743===null||_0x1de905[_0x38ed45(_0x1b8694._0x1b1a28,-0x2,0x1a,0x3f)](_0x19b743,undefined))return _0x19b743;if(_0x1de905[_0x16a3d4(0x51,0x3d,0x3d,_0x1b8694._0x1e7000)](_0x19b743,Date))return new Date(_0x19b743['getTime']());if(_0x19b743 instanceof ObjectId)return new ObjectId(_0x19b743[_0x38ed45(-_0x1b8694._0x58b0e4,0x10,-_0x1b8694._0x114c3b,-0xd)+'g']());if(Buffer[_0x16a3d4(0x4a,0x26,0x6a,0x4c)](_0x19b743))return Buffer[_0x38ed45(0x13,0xa,0x2a,0x1)](_0x19b743);if(Array['isArray'](_0x19b743))return _0x19b743[_0x38ed45(0x2a,_0x1b8694._0x1f345f,-_0x1b8694._0x4a1680,_0x1b8694._0x407b8f)](_deepClone);function _0x16a3d4(_0x3f0d93,_0x3558cf,_0x40a814,_0x3d9064){return _0xd3a169(_0x40a814,_0x3558cf-_0x4aff16._0x446635,_0x3f0d93- -_0x4aff16._0x3a117c,_0x3d9064-0xe5);}if(_0x1de905[_0x16a3d4(_0x1b8694._0x3e5d79,_0x1b8694._0x1b8dd5,0x51,0x8a)](typeof _0x19b743,_0x16a3d4(_0x1b8694._0x54a72c,_0x1b8694._0x30b7d9,0x63,_0x1b8694._0x21c890))){const _0x5cdb44={};for(const _0x137ab3 of Object[_0x16a3d4(0x29,_0x1b8694._0x371ea2,_0x1b8694._0x316974,0x4f)](_0x19b743))_0x5cdb44[_0x137ab3]=_deepClone(_0x19b743[_0x137ab3]);return _0x5cdb44;}return _0x19b743;}function safeDoc(_0x3019e5){const _0x3e800d={_0x85763:0x3b7,_0x324098:0x3a0,_0x4edf86:0x378,_0x26c8f7:0x397,_0x12c505:0x3af,_0x1a2f20:0x3b8,_0x577daf:0x3e6,_0x368710:0x3ad,_0x43725c:0x49f,_0x5bd2a1:0x3a7,_0x2b5c29:0x3d6,_0x438779:0x3c2,_0x30c731:0x468,_0x1e98bf:0x452,_0x2ca57f:0x46a,_0x5e992d:0x47b,_0x1a696d:0x47a,_0x98fb33:0x485},_0xd2835b={_0x1b85be:0x3c4,_0x59c066:0x1bf},_0x27006a={_0x5f4831:0x5f,_0x3f979c:0x315};function _0x1c2824(_0x565352,_0x45dc40,_0xeb292f,_0x3279ec){return _0xd3a169(_0xeb292f,_0x45dc40-_0x27006a._0x5f4831,_0x3279ec-_0x27006a._0x3f979c,_0x3279ec-0xb8);}const _0x5d3ace={'EATEV':_0x1c2824(0x3af,0x402,_0x3e800d._0x85763,0x3cb),'gWuEP':function(_0xe24bea,_0x42cb38){return _0xe24bea===_0x42cb38;},'rJJVV':function(_0x5351a2,_0x335ced){return _0x5351a2(_0x335ced);},'POURr':function(_0x57c9d1,_0x13bda8){return _0x57c9d1||_0x13bda8;},'cWUcm':'JcZOs','rbLcH':function(_0x54522f,_0x539d44){return _0x54522f(_0x539d44);}};function _0x1603f0(_0x34dfa7,_0x21f048,_0x2301bc,_0x5d618c){return _0xd3a169(_0x2301bc,_0x21f048-0x13b,_0x21f048-_0xd2835b._0x1b85be,_0x5d618c-_0xd2835b._0x59c066);}if(!_0x3019e5||typeof _0x3019e5!==_0x1c2824(0x3da,_0x3e800d._0x324098,0x3c2,0x3d7))return _0x5d3ace[_0x1c2824(_0x3e800d._0x4edf86,0x394,0x382,_0x3e800d._0x26c8f7)](_0x3019e5,null);try{if(_0x5d3ace[_0x1c2824(_0x3e800d._0x12c505,0x3b8,_0x3e800d._0x1a2f20,_0x3e800d._0x577daf)]!==_0x1c2824(_0x3e800d._0x368710,0x3c5,0x3ea,0x3c0)){if(!_0x1265f7)return _0x5d3ace[_0x1603f0(0x4af,_0x3e800d._0x43725c,0x4a3,0x4ab)];const _0x50c8e9=_0x2c581a[_0x1c2824(_0x3e800d._0x5bd2a1,0x393,_0x3e800d._0x2b5c29,_0x3e800d._0x438779)]??_0x1cf108[_0x1603f0(_0x3e800d._0x30c731,0x47e,_0x3e800d._0x1e98bf,_0x3e800d._0x2ca57f)];return _0x50c8e9==null||_0x5d3ace[_0x1603f0(0x4d5,0x499,_0x3e800d._0x5e992d,0x4b4)](_0x50c8e9,'')?_0x1603f0(0x477,_0x3e800d._0x1a696d,0x46a,_0x3e800d._0x98fb33):_0x5d3ace['rJJVV'](_0x324d7f,_0x50c8e9);}else return _0x5d3ace['rbLcH'](_deepClone,_0x3019e5);}catch{return null;}}function stableStringify(_0x39aad6){const _0x14f3d3={_0x44e5ef:0x196,_0x3b1448:0x14,_0x25aa43:0x40,_0x3bc1bf:0x1a2,_0x20d404:0x188,_0x6d2e2d:0x20,_0x236649:0xe,_0x4637e3:0x15d,_0x185fa6:0x136,_0x29607e:0x13a,_0x87f574:0x162,_0x172efb:0x31,_0x53fbfc:0x48,_0x37f8ff:0x17,_0x4ec4df:0x4e,_0x14df44:0x6,_0x2f60da:0x16b,_0x1fc586:0x198,_0x48ce2b:0x160,_0x2626ba:0x10,_0x1972f4:0x12,_0x5de441:0x23,_0x44237a:0x17a,_0x40612e:0x1b1,_0x64ddf9:0x150,_0x21fb92:0x155,_0x4572ed:0x149,_0x18666a:0x143,_0x5cefe0:0x145,_0x2c75b3:0x16b,_0x39e8cd:0x180,_0x5d8988:0x190,_0x19fdab:0x19b,_0x597c37:0x1a5,_0x27e88a:0x1a6,_0x231222:0x178,_0xf3ec8e:0x11,_0x5169b4:0x18,_0x4926a6:0x12,_0x24f00c:0x28,_0x67cdff:0x44,_0x77e1a5:0x16c,_0x508a98:0x16e,_0x31f389:0x19b,_0x552f25:0x1a,_0x2f1266:0x6d,_0x504d04:0x119,_0x3e75e2:0x1b,_0xa98719:0x153,_0x44a576:0x1ce,_0xbb5a28:0x179,_0x3ce08e:0x2d,_0x101b8e:0x62,_0x15e873:0x10,_0xc55db7:0x54,_0x48fc1a:0x36,_0x438613:0x48,_0x31fe6d:0x1cb,_0x1eda38:0x1a2,_0x3fbada:0x51,_0x38f69a:0x3e,_0x43a45b:0x1b,_0x4cf75:0x8,_0x3663f7:0x3e,_0x5deb7a:0x15,_0x5330c4:0x79,_0x45a24c:0x9,_0x5f00a3:0x6,_0x50249c:0x22,_0x4f0ebf:0x8d},_0x3f5086={_0x1cba29:0xc8,_0x473de1:0x22a},_0x40dd7b={_0x480050:0x30,_0x3c7243:0x4a},_0xe80c3b={};_0xe80c3b['NMfGT']=_0x582881(-0x187,-_0x14f3d3._0x44e5ef,-0x1c5,-0x191),_0xe80c3b[_0x20dfdc(-0xe,-0x2e,-_0x14f3d3._0x3b1448,-_0x14f3d3._0x25aa43)]=function(_0x1a239f,_0x4d78be){return _0x1a239f instanceof _0x4d78be;},_0xe80c3b[_0x582881(-0x1cd,-_0x14f3d3._0x3bc1bf,-0x1b8,-_0x14f3d3._0x20d404)]=_0x20dfdc(-_0x14f3d3._0x6d2e2d,-0x3b,-0x39,_0x14f3d3._0x236649);const _0x41a536=_0xe80c3b;if(_0x39aad6===null||_0x39aad6===undefined)return String(_0x39aad6);if(Buffer[_0x582881(-0x191,-_0x14f3d3._0x4637e3,-_0x14f3d3._0x185fa6,-0x13d)](_0x39aad6))return _0x582881(-_0x14f3d3._0x29607e,-0x164,-_0x14f3d3._0x87f574,-0x128)+_0x39aad6[_0x20dfdc(-0xb,_0x14f3d3._0x172efb,-0x3f,-_0x14f3d3._0x53fbfc)](_0x41a536['NMfGT'])+'>\x22';if(_0x39aad6?.[_0x20dfdc(-_0x14f3d3._0x37f8ff,-0x4e,-_0x14f3d3._0x4ec4df,-_0x14f3d3._0x14df44)]===_0x582881(-0x161,-0x193,-_0x14f3d3._0x2f60da,-_0x14f3d3._0x1fc586)){const _0x3063c2=_0x39aad6[_0x582881(-0x17b,-0x13e,-_0x14f3d3._0x48ce2b,-0x176)],_0x4fb4a0=Buffer[_0x582881(-0x17d,-0x15d,-0x186,-0x169)](_0x3063c2)?_0x3063c2[_0x20dfdc(-0xb,-_0x14f3d3._0x2626ba,_0x14f3d3._0x1972f4,_0x14f3d3._0x5de441)](_0x582881(-0x18f,-_0x14f3d3._0x44e5ef,-0x1b8,-0x17f)):Buffer['from'](_0x3063c2)[_0x582881(-0x180,-0x198,-_0x14f3d3._0x44237a,-0x19d)]('hex');return _0x582881(-_0x14f3d3._0x40612e,-0x180,-_0x14f3d3._0x64ddf9,-0x156)+_0x4fb4a0+'>\x22';}function _0x20dfdc(_0x27388c,_0x1139fc,_0x72cc12,_0x5eff25){return _0xd3a169(_0x72cc12,_0x1139fc-_0x40dd7b._0x480050,_0x27388c- -0x9d,_0x5eff25-_0x40dd7b._0x3c7243);}function _0x582881(_0x22356c,_0x24e2ab,_0x223dcb,_0x123636){return _0xd3a169(_0x22356c,_0x24e2ab-_0x3f5086._0x1cba29,_0x24e2ab- -_0x3f5086._0x473de1,_0x123636-0x16c);}if(_0x41a536['grsic'](_0x39aad6,Uint8Array)){if(_0x582881(-_0x14f3d3._0x21fb92,-0x145,-_0x14f3d3._0x4572ed,-0x111)!==_0x582881(-_0x14f3d3._0x18666a,-_0x14f3d3._0x5cefe0,-_0x14f3d3._0x2c75b3,-_0x14f3d3._0x39e8cd))throw new _0x2397e7(_0x582881(-_0x14f3d3._0x5d8988,-0x15c,-0x156,-0x13f)+_0x582881(-_0x14f3d3._0x19fdab,-0x195,-_0x14f3d3._0x597c37,-0x193)+_0x582881(-_0x14f3d3._0x27e88a,-0x197,-_0x14f3d3._0x231222,-0x1a1)+_0x2e82c7+(_0x20dfdc(-_0x14f3d3._0xf3ec8e,-_0x14f3d3._0x5169b4,0x14,-_0x14f3d3._0x4926a6)+_0x20dfdc(_0x14f3d3._0x24f00c,0x19,0x5c,0x22)+_0x20dfdc(0x32,_0x14f3d3._0x67cdff,0x39,0x1b)+_0x582881(-_0x14f3d3._0x77e1a5,-_0x14f3d3._0x508a98,-_0x14f3d3._0x31f389,-0x18f)+_0x20dfdc(0x47,_0x14f3d3._0x552f25,0x79,0x7a))+('are\x20used\x20i'+'nternally\x20'+'by\x20MongoFi'+_0x20dfdc(_0x14f3d3._0x4ec4df,_0x14f3d3._0x2f1266,0x6c,0x7d)+'not\x20be\x20syn'+_0x582881(-0x161,-0x14c,-_0x14f3d3._0x504d04,-0x122)));else return _0x20dfdc(_0x14f3d3._0xf3ec8e,_0x14f3d3._0x3e75e2,0x16,-0x16)+Buffer[_0x582881(-0x149,-_0x14f3d3._0xa98719,-0x126,-0x11d)](_0x39aad6)['toString'](_0x582881(-_0x14f3d3._0x44a576,-0x196,-0x1af,-_0x14f3d3._0xbb5a28))+'>\x22';}if(typeof _0x39aad6!==_0x20dfdc(0x25,_0x14f3d3._0x3ce08e,_0x14f3d3._0x101b8e,-_0x14f3d3._0x15e873))return JSON[_0x20dfdc(_0x14f3d3._0xc55db7,0x1a,0x57,0x42)](_0x39aad6);if(Array[_0x20dfdc(_0x14f3d3._0x48fc1a,_0x14f3d3._0x438613,0x41,0x25)](_0x39aad6)){if('wIUCL'===_0x41a536[_0x582881(-_0x14f3d3._0x31fe6d,-_0x14f3d3._0x1eda38,-0x164,-0x18c)])return'['+_0x39aad6[_0x20dfdc(_0x14f3d3._0x3fbada,_0x14f3d3._0x38f69a,_0x14f3d3._0x43a45b,0x4b)](_0xe8c0d6=>stableStringify(_0xe8c0d6))['join'](',')+']';else throw new _0x56da7d(_0x20dfdc(_0x14f3d3._0x172efb,_0x14f3d3._0x3ce08e,-_0x14f3d3._0x4cf75,0x18)+']\x20Collecti'+'on\x20name\x20mu'+_0x20dfdc(0x14,-0x17,_0x14f3d3._0x3663f7,0xe)+_0x20dfdc(0x4,0x2d,-0xc,_0x14f3d3._0x5deb7a)+'ring,\x20got:'+'\x20'+_0x1b9712[_0x20dfdc(0x54,0x75,0x3a,_0x14f3d3._0x5330c4)](_0x225251));}const _0x4f583e=Object['keys'](_0x39aad6)[_0x20dfdc(_0x14f3d3._0x45a24c,0x14,-_0x14f3d3._0x5f00a3,0x6)](),_0x7386bf=_0x4f583e[_0x20dfdc(0x51,0x70,_0x14f3d3._0x50249c,_0x14f3d3._0x4f0ebf)](_0x3dc56d=>JSON[_0x20dfdc(0x54,0x65,0x54,0x27)](_0x3dc56d)+':'+stableStringify(_0x39aad6[_0x3dc56d]))['join'](',');return'{'+_0x7386bf+'}';}function _0x4ef94c(_0x404699,_0x2dd1bf,_0x5b0cd4,_0x478d94){return _0x1617(_0x478d94-0x1c9,_0x404699);}function _0x1617(_0x1ba31b,_0x8c89ab){_0x1ba31b=_0x1ba31b-(-0x10*0x8+-0x6ed+0x6*0x16a);const _0x17929a=_0x4500();let _0xcd0e47=_0x17929a[_0x1ba31b];if(_0x1617['avhPyt']===undefined){var _0x13b808=function(_0x66f2f8){const _0x61eb4a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x188bb2='',_0x14f835='';for(let _0xee2243=0x1*-0x2413+0x538+0x1edb,_0x4aa7f7,_0x110f4e,_0x2383a7=-0x22f7+0xa3*0x17+-0x66*-0x33;_0x110f4e=_0x66f2f8['charAt'](_0x2383a7++);~_0x110f4e&&(_0x4aa7f7=_0xee2243%(0x21ba+-0x239*0x7+-0x1227*0x1)?_0x4aa7f7*(-0x1e6b*0x1+0x2e5+0x2c7*0xa)+_0x110f4e:_0x110f4e,_0xee2243++%(-0x1089+0x2*0x1af+0x177*0x9))?_0x188bb2+=String['fromCharCode'](0xc04+-0x3b*-0x86+-0x29e7&_0x4aa7f7>>(-(-0x91d*0x4+0x1*0x2645+0x1cf*-0x1)*_0xee2243&-0x103a+0x7*-0x47+0x1231)):0x24*-0x115+-0x7*-0x419+0xa45){_0x110f4e=_0x61eb4a['indexOf'](_0x110f4e);}for(let _0x1d627b=-0x1145+0x1b7b+-0xa36,_0x884859=_0x188bb2['length'];_0x1d627b<_0x884859;_0x1d627b++){_0x14f835+='%'+('00'+_0x188bb2['charCodeAt'](_0x1d627b)['toString'](-0x2c4+0x13*0x18d+-0x1aa3))['slice'](-(-0x84*0x26+-0xf31*0x2+0x31fc));}return decodeURIComponent(_0x14f835);};_0x1617['woconJ']=_0x13b808,_0x1617['ofcENU']={},_0x1617['avhPyt']=!![];}const _0x53dd3b=_0x17929a[0x1*-0xf5c+0x224+0x8d*0x18],_0x2cc90b=_0x1ba31b+_0x53dd3b,_0x21e508=_0x1617['ofcENU'][_0x2cc90b];return!_0x21e508?(_0xcd0e47=_0x1617['woconJ'](_0xcd0e47),_0x1617['ofcENU'][_0x2cc90b]=_0xcd0e47):_0xcd0e47=_0x21e508,_0xcd0e47;}function payloadChecksum(_0x5d22aa,_0xb856bc=![]){const _0x2c0cff={_0x36bc3a:0x2a7,_0x153823:0x277,_0x3b9427:0x29e,_0x3f98a6:0x2f8,_0x43327a:0x2a6,_0x4c4673:0x2d6,_0x227fc4:0x28c,_0x1c775f:0x262,_0xf76cec:0x23e,_0x1cc676:0x2b2,_0x43b03e:0x2a4,_0x2446e0:0x253,_0x387a64:0x2cd,_0x4fa10c:0x2dc,_0x5b1917:0x2ed,_0x185ea7:0x2a3,_0x2cab1e:0x268,_0x13a442:0x284,_0x21ca89:0x290,_0x402b76:0x288,_0x2a34db:0x270},_0x29f7bd={_0x4bd271:0x1ee},_0x150e79={_0x2ade6a:0xc2};function _0x4a46f0(_0x319e02,_0x567f0e,_0x3ed522,_0x424a1e){return _0xd3a169(_0x319e02,_0x567f0e-_0x150e79._0x2ade6a,_0x3ed522-0x20d,_0x424a1e-0x164);}const _0x1c5e47={'HOtPw':function(_0x589de1,_0x20ac12){return _0x589de1!==_0x20ac12;},'TltGg':function(_0x47998c,_0x3813c7){return _0x47998c(_0x3813c7);},'sErvE':_0x4a46f0(_0x2c0cff._0x36bc3a,_0x2c0cff._0x153823,0x2ab,0x29d)};function _0x50cb67(_0x37fba1,_0x52b1e0,_0x2eae55,_0x24a6a4){return _0xd3a169(_0x24a6a4,_0x52b1e0-0x4c,_0x2eae55-_0x29f7bd._0x4bd271,_0x24a6a4-0x13b);}if(_0xb856bc&&_0x1c5e47['HOtPw'](process[_0x50cb67(0x2b8,0x2dc,0x2ba,_0x2c0cff._0x3b9427)][_0x4a46f0(_0x2c0cff._0x3f98a6,_0x2c0cff._0x43327a,_0x2c0cff._0x4c4673,0x2be)+_0x50cb67(_0x2c0cff._0x227fc4,_0x2c0cff._0x1c775f,0x279,_0x2c0cff._0xf76cec)+_0x4a46f0(_0x2c0cff._0x1cc676,_0x2c0cff._0x43b03e,_0x2c0cff._0x1cc676,0x2d1)],'1'))return null;const _0x13f01f=_0x5d22aa===null?_0x50cb67(0x270,0x238,0x273,_0x2c0cff._0x2446e0):_0x1c5e47['TltGg'](stableStringify,_0x5d22aa);return crypto['createHash'](_0x1c5e47[_0x4a46f0(_0x2c0cff._0x387a64,_0x2c0cff._0x4fa10c,0x2b6,_0x2c0cff._0x5b1917)])[_0x50cb67(_0x2c0cff._0x185ea7,0x2a1,_0x2c0cff._0x2cab1e,_0x2c0cff._0x13a442)](_0x13f01f)[_0x4a46f0(0x258,0x2ab,_0x2c0cff._0x21ca89,_0x2c0cff._0x402b76)](_0x50cb67(_0x2c0cff._0x2a34db,0x2b9,0x282,_0x2c0cff._0x227fc4));}function buildDocPayload(_0x346125,_0x325b75,_0x147824){const _0x1eb4f2={_0x1ff2e4:0x4c,_0x16bdd4:0x3f,_0x49fda5:0x3e,_0x4d7746:0x31,_0x236625:0x75,_0x49c4ab:0x49,_0x3e48f7:0x5c,_0x5933e0:0x66,_0x3b8e85:0x77,_0x2dd5b0:0x18,_0x405004:0x2,_0x3a3f29:0xd9,_0x41f178:0xd4,_0x16ef00:0xa3,_0x247602:0x71,_0x6cdaac:0xf9,_0x336a52:0x10b,_0x4b07ed:0xb9,_0x4015dd:0x10,_0x529f46:0x30,_0x354600:0x2f},_0x100bd8={_0x3aa5cf:0xc6,_0x5b3a4d:0x148},_0x125fab={'VjHPo':function(_0x347958,_0x346793){return _0x347958(_0x346793);},'pLUIf':function(_0x186858,_0x233dfd){return _0x186858(_0x233dfd);}};function _0x43b0ea(_0x64bb10,_0x31eeac,_0x566005,_0xaa916f){return _0xd3a169(_0x64bb10,_0x31eeac-0x145,_0xaa916f- -0x161,_0xaa916f-0xc6);}const _0x7861af=_0x125fab[_0x5224ba(-_0x1eb4f2._0x1ff2e4,-0x56,-_0x1eb4f2._0x16bdd4,-_0x1eb4f2._0x49fda5)](safeDoc,_0x346125[_0x5224ba(-_0x1eb4f2._0x4d7746,-_0x1eb4f2._0x236625,-_0x1eb4f2._0x49c4ab,-0x48)]||_0x346125['doc']);if(!_0x7861af)return null;_0x7861af[_0x43b0ea(-_0x1eb4f2._0x3e48f7,-_0x1eb4f2._0x5933e0,-0x83,-_0x1eb4f2._0x3b8e85)]=_0x125fab[_0x5224ba(-_0x1eb4f2._0x2dd5b0,-0x2a,_0x1eb4f2._0x405004,-0x26)](toObjectId,_0x346125[_0x43b0ea(-_0x1eb4f2._0x3a3f29,-0x106,-0xcd,-_0x1eb4f2._0x41f178)]),_0x7861af[_0x43b0ea(-_0x1eb4f2._0x16ef00,-0xa4,-0x4e,-_0x1eb4f2._0x247602)+'n']=_0x325b75,_0x7861af[_0x43b0ea(-_0x1eb4f2._0x6cdaac,-_0x1eb4f2._0x336a52,-0x101,-0xd3)+_0x43b0ea(-_0x1eb4f2._0x4b07ed,-0xb3,-0x88,-0xae)+'Id']=_0x147824,_0x7861af[_0x5224ba(-_0x1eb4f2._0x405004,-0x39,-0x1b,_0x1eb4f2._0x4015dd)]=_0x346125[_0x5224ba(-0x1c,-_0x1eb4f2._0x529f46,-_0x1eb4f2._0x354600,0x6)];function _0x5224ba(_0x2f7d1e,_0x6e6693,_0x2e3bd4,_0x3595ce){return _0xd3a169(_0x6e6693,_0x6e6693-_0x100bd8._0x3aa5cf,_0x2e3bd4- -0xdf,_0x3595ce-_0x100bd8._0x5b3a4d);}return _0x7861af['_mf_lastOp'+'Id']=_0x346125['opId'],_0x7861af;}function buildPendingSets(_0x22bd90){const _0x3852e9={_0x29b37a:0x178,_0x568a32:0x14e,_0x2fc959:0x156,_0x297914:0x13f,_0x202845:0x453,_0x4c0dd8:0x426,_0x1d8fdd:0x40b,_0x101fa1:0x42d,_0x25555c:0x413,_0x12bda5:0x426,_0x43fd71:0x45c,_0x31af21:0x3bd,_0x331daf:0x3c3,_0x507503:0x3c2},_0x36af3d={_0x4dc8d2:0x67},_0x376eb5={_0x497dd5:0x19,_0x12b079:0x34a},_0x386f14={'laExS':function(_0x94388c,_0xeb8368){return _0x94388c(_0xeb8368);}},_0x14c3e4=new Set(),_0x46c9ff=new Set();for(const _0x48ba49 of _0x22bd90){const _0x1dbb0a=_0x386f14[_0x36b95d(0x14d,_0x3852e9._0x29b37a,_0x3852e9._0x568a32,_0x3852e9._0x2fc959)](String,_0x48ba49[_0x36b95d(0xf7,0xd1,_0x3852e9._0x297914,0x109)]);_0x46c9ff[_0x4450cb(0x450,_0x3852e9._0x202845,_0x3852e9._0x4c0dd8,0x43c)](_0x1dbb0a);if(resolveOpType(_0x48ba49)===_0x4450cb(0x453,_0x3852e9._0x1d8fdd,_0x3852e9._0x101fa1,_0x3852e9._0x25555c))_0x14c3e4[_0x4450cb(0x40b,0x447,_0x3852e9._0x12bda5,_0x3852e9._0x43fd71)](_0x1dbb0a);}function _0x4450cb(_0x35b130,_0x56f774,_0x4392bf,_0x1cecf3){return _0xd3a169(_0x35b130,_0x56f774-_0x376eb5._0x497dd5,_0x4392bf-_0x376eb5._0x12b079,_0x1cecf3-0xcc);}const _0x520e6a={};_0x520e6a[_0x4450cb(_0x3852e9._0x31af21,0x3eb,_0x3852e9._0x331daf,0x387)+_0x4450cb(0x3c9,0x3c6,_0x3852e9._0x507503,0x3e3)]=_0x14c3e4;function _0x36b95d(_0x1df6fd,_0x241bc6,_0x5dcbf4,_0xb9521a){return _0xd3a169(_0x5dcbf4,_0x241bc6-_0x36af3d._0x4dc8d2,_0xb9521a-0x7c,_0xb9521a-0x10b);}return _0x520e6a[_0x36b95d(0xe1,0x120,0x11d,0x116)+'Ids']=_0x46c9ff,_0x520e6a;}const _0x25d676={};_0x25d676[_0xd3a169(0xa2,0x93,0x7c,0xa1)+'ment']='before';const _FROZEN_RETURN_BEFORE=Object[_0x4ef94c(0x2d1,0x2eb,0x2c0,0x2e1)](_0x25d676),_0x36a93f={};_0x36a93f[_0xd3a169(0xb1,0xf2,0xe8,0xd5)+'inal']=!![];const _FROZEN_RETURN_ORIGINAL=Object[_0xd3a169(0x78,0xa0,0x7f,0xb6)](_0x36a93f);let _useReturnOriginal=![];function getReturnBeforeOpt(){return _useReturnOriginal?_FROZEN_RETURN_ORIGINAL:_FROZEN_RETURN_BEFORE;}function markReturnDocFallback(){_useReturnOriginal=!![];}const _0x4d4134={};_0x4d4134[_0xd3a169(0x12b,0xce,0xed,0x10d)]=asDate,_0x4d4134['asInt']=asInt,_0x4d4134['metaId']=metaId,_0x4d4134['toObjectId']=toObjectId,_0x4d4134['validateCo'+_0x4ef94c(0x2af,0x2a6,0x2a8,0x2dd)+'me']=validateCollectionName,_0x4d4134['resolveOwn'+'erKey']=resolveOwnerKey,_0x4d4134[_0x4ef94c(0x33a,0x30f,0x35f,0x32a)+_0xd3a169(0x8f,0x59,0x89,0x7d)]=resolveOpType,_0x4d4134['safeDoc']=safeDoc,_0x4d4134['stableStri'+_0x4ef94c(0x2ed,0x332,0x300,0x2fb)]=stableStringify,_0x4d4134[_0xd3a169(0x98,0xbd,0xbf,0xe3)+_0x4ef94c(0x311,0x321,0x33b,0x33b)]=payloadChecksum,_0x4d4134[_0x4ef94c(0x326,0x2d5,0x320,0x301)+_0x4ef94c(0x327,0x32c,0x315,0x2f2)]=buildDocPayload,_0x4d4134[_0x4ef94c(0x303,0x32b,0x31e,0x316)+_0xd3a169(0xd3,0xd8,0xdd,0xf0)]=buildPendingSets,_0x4d4134[_0x4ef94c(0x352,0x326,0x33b,0x314)+_0x4ef94c(0x353,0x33a,0x372,0x349)]=getReturnBeforeOpt,_0x4d4134[_0x4ef94c(0x348,0x325,0x31d,0x311)+'DocFallbac'+'k']=markReturnDocFallback,module[_0x4ef94c(0x2c6,0x31e,0x2b7,0x2e6)]=_0x4d4134;function _0x4500(){const _0x37f8b7=['yxjLihvZzwqGAq','B1Phzu0','ExbL','mZG4ntK3DgnOufDw','vKvssuzzx1jftq','iIbPCYbYzxnLCG','zg9Jswq','x21Mx2XHC3rxCG','z3jZAwm','EwXVywq','yNKGtw9Uz29gAq','Dg9tDhjPBMC','B24GBMfTzsaI','Agv4','xsbdB2XSzwn0Aq','Cgf5Bg9Hza','qMLUyxj5','uwLqzwW','BMDPzNK','CgvUzgLUz0fUEq','z2v0vgLTzq','C3rYAw5N','CNnJB3jLCYWGAa','C2HHmJu2','yNvPBgreB2nqyq','vMPiug8','BI1LBxb0EsbZDa','ueLJBKG','mZi0mdC4m2fOBuHyza','su9mDeS','t1rf','C29YDa','BM90igjLihn5BG','EKfeBKG','C0vYDKu','iJXIAw46','sMnAt3m','A2v5CW','B3DUzxjlzxK','iJX1odO','BwfYA1jLDhvYBG','B3bjza','C3qGyMuGysbUBW','z2v0uMv0DxjUqG','AxrLCKrLDMLJzq','yNvPBgrqzw5KAq','y3j5ChrV','z2XVyMfS','odaWmtaWD0LwyKnP','Dg9izxHtDhjPBG','qwXSB3DLzdOGBa','B3DUzxjjza','mtz5AeLvuKG','ihDPDgGGiL9TzG','igeGy29SB24GDW','CYbPBIbFBwzFza','Cgf5Bg9HzenOzq','B2XSzwn0Aw9UlG','nJm1ntmYzfbAEKPL','B2jQzwn0','D2f4rwK','x21Mx29Wswq','DMvKiokaLcbUyw1L','iJXIDwy6','AgfYywn0zxjZlG','CMvZB2X2zu9Wva','tu9or09gsvjfxW','ANvdC0q','x21MxW','zw52','AxncDwzMzxi','w01VBMDVrMLYzq','CYbZDgfYDgLUzW','mtKXotC4nhvbv2zora','y1Dvy20','igLUDMfSAwqGyW','AxnbCNjHEq','AMDMEM4','z1D1rva','wwTTz3K','zNjVBq','zM9guKW','y2TZDw0','BgffEfm','rufurvy','ywrK','BMDtzxrZ','y2vKlG','zxr0zxjZlcbKAq','Aw5JBhvKzxm','CeXvswy','AxnjBNrLz2vY','zgvSzxrL','xYiG','v291C2e','CMLUzYWGz290oG','zwzVCMvpChq','CMv0DxjUt3jPzW','ntiXota1y3DvB2vP','x2LK','CMuGyw5KignHBG','yNvMzMvY','yxneyxrL','BwfW','DhLWzq','x21Mx3zLCNnPBW','C3rYAw5NAwz5','ntCWnZeWDKPnA2zT','ignHDxnLia','zxrLswrZ','CgvUzgLUz0rLBa','DxbKyxrL','BgXLy3rPB25oyq','CMv0DxjUrg9JDq','D0Lvq0W','z2L0CYWGDw5Kzq','zNjLzxPL','iIbJB250ywLUCW','AgLJAcb3B3vSza','ue9vuNi','zgLNzxn0','zxHWB3j0CW','BNvSBa','x2jZB250ExbL'];_0x4500=function(){return _0x37f8b7;};return _0x4500();}
|
|
1
|
+
'use strict';(function(_0x26dab2,_0xc85535){const _0x93066a={_0x343364:0x5a8,_0x1d4923:0x59c,_0x5984ab:0x5a4,_0x50d88e:0x5be,_0x3d847a:0x5ae,_0x277e63:0x5ba,_0x354c23:0x597,_0x1fc865:0x583,_0x2965c:0x5b4,_0x1af377:0x5b3},_0x13d436={_0x1e88a3:0x393},_0x1db407=_0x26dab2();function _0x5e9d1c(_0x313fe7,_0x1a3db1){return _0x30a6(_0x313fe7-_0x13d436._0x1e88a3,_0x1a3db1);}while(!![]){try{const _0x5918b2=parseInt(_0x5e9d1c(_0x93066a._0x343364,0x5bd))/0x1+parseInt(_0x5e9d1c(_0x93066a._0x1d4923,0x586))/0x2*(-parseInt(_0x5e9d1c(_0x93066a._0x5984ab,_0x93066a._0x50d88e))/0x3)+-parseInt(_0x5e9d1c(0x5aa,0x59e))/0x4*(parseInt(_0x5e9d1c(0x5af,_0x93066a._0x3d847a))/0x5)+parseInt(_0x5e9d1c(0x5ac,_0x93066a._0x277e63))/0x6*(parseInt(_0x5e9d1c(0x59f,0x58e))/0x7)+-parseInt(_0x5e9d1c(0x5bb,0x5ac))/0x8*(parseInt(_0x5e9d1c(_0x93066a._0x354c23,_0x93066a._0x1fc865))/0x9)+parseInt(_0x5e9d1c(_0x93066a._0x2965c,_0x93066a._0x1af377))/0xa*(-parseInt(_0x5e9d1c(0x58c,0x58a))/0xb)+-parseInt(_0x5e9d1c(0x5a1,0x5b7))/0xc*(-parseInt(_0x5e9d1c(0x5a3,0x5be))/0xd);if(_0x5918b2===_0xc85535)break;else _0x1db407['push'](_0x1db407['shift']());}catch(_0x39049d){_0x1db407['push'](_0x1db407['shift']());}}}(_0x417b,0x47d9c));const crypto=require('crypto'),{ObjectId:ObjectId}=require(_0x181cff(0x547,0x54f));function asDate(_0x282ed3){const _0x3e5ead={_0x40aa49:0x228},_0xe06126={_0x374632:0x2de};function _0x516336(_0x77ddc3,_0x542660){return _0x181cff(_0x77ddc3,_0x542660- -_0xe06126._0x374632);}if(!_0x282ed3)return null;const _0x6b3cd2=new Date(_0x282ed3);return Number[_0x516336(_0x3e5ead._0x40aa49,0x240)](_0x6b3cd2[_0x516336(0x269,0x25d)]())?null:_0x6b3cd2;}function asInt(_0x548b2b,_0x2bc18e=0x0){const _0x551b10={_0x3ac52b:0x1ee},_0x29845d={_0x3c9801:0x319};function _0x25f82a(_0x2f8449,_0x52fa28){return _0x181cff(_0x2f8449,_0x52fa28- -_0x29845d._0x3c9801);}const _0x3f806a=Number(_0x548b2b);return Number[_0x25f82a(_0x551b10._0x3ac52b,0x1ff)](_0x3f806a)?_0x3f806a:null!=_0x2bc18e?Number(_0x2bc18e):0x0;}function metaId(_0xe48b5,_0xd9e9b0){return _0xe48b5+':'+_0xd9e9b0;}function toObjectId(_0x3ab03e){if(!_0x3ab03e)return _0x3ab03e;if(_0x3ab03e instanceof ObjectId)return _0x3ab03e;try{return new ObjectId(_0x3ab03e);}catch{return _0x3ab03e;}}const _COLLECTION_NAME_RE=/^[a-zA-Z0-9][a-zA-Z0-9_.\-]*$/;function validateCollectionName(_0x10b638){const _0x576833={_0x460c4c:0x279,_0x245ce0:0x268,_0x391d93:0x274,_0x2c86c4:0x264,_0xb1ce41:0x246,_0x1c28ad:0x238,_0x369d47:0x241,_0x5886ed:0x251,_0x507ae6:0x279,_0x1e89ba:0x25f,_0x1acb4a:0x22e,_0x1e1e39:0x241,_0x198cc0:0x259,_0x252730:0x25f,_0x52cb82:0x227},_0x5d71c7={_0x4073cc:0x2e8};function _0x4298a1(_0x213aaa,_0x14661b){return _0x181cff(_0x213aaa,_0x14661b- -_0x5d71c7._0x4073cc);}if(!_0x10b638||'string'!=typeof _0x10b638)throw new Error(_0x4298a1(_0x576833._0x460c4c,_0x576833._0x245ce0)+JSON[_0x4298a1(_0x576833._0x391d93,0x258)](_0x10b638));if(_0x10b638[_0x4298a1(_0x576833._0x2c86c4,_0x576833._0xb1ce41)](_0x4298a1(0x253,_0x576833._0x1c28ad)))throw new Error(_0x4298a1(0x257,_0x576833._0x369d47)+_0x10b638+_0x4298a1(0x254,_0x576833._0x5886ed));if(_0x10b638[_0x4298a1(_0x576833._0x507ae6,_0x576833._0x1e89ba)](':'))throw new Error(_0x4298a1(_0x576833._0x1acb4a,_0x576833._0x1e1e39)+_0x10b638+'\x22\x20contains\x20a\x20colon\x20which\x20would\x20cause\x20metaId\x20key\x20collisions\x20in\x20_mf_docmeta.\x20Rename\x20the\x20collection.');if(!_COLLECTION_NAME_RE[_0x4298a1(_0x576833._0x245ce0,_0x576833._0x198cc0)](_0x10b638))throw new Error(_0x4298a1(_0x576833._0x252730,0x241)+_0x10b638+_0x4298a1(_0x576833._0x52cb82,0x22e));}function resolveOwnerKey(_0x124d78){const _0x4753a4={_0x4662a4:0x3fe};if(!_0x124d78)return _0x1f9352(0x3e5,0x3d3);function _0x1f9352(_0x5beb91,_0x26ae35){return _0x181cff(_0x26ae35,_0x5beb91- -0x13c);}const _0x56e7e3=_0x124d78[_0x1f9352(0x411,0x402)]??_0x124d78[_0x1f9352(0x3fb,0x404)];return null==_0x56e7e3||''===_0x56e7e3?_0x1f9352(0x3e5,_0x4753a4._0x4662a4):String(_0x56e7e3);}function _0x30a6(_0x1c7704,_0x4cabcd){_0x1c7704=_0x1c7704-0x1f2;const _0x417b33=_0x417b();let _0x30a6f3=_0x417b33[_0x1c7704];if(_0x30a6['AgDYBo']===undefined){var _0x11eb0c=function(_0x5ebca5){const _0x3f4b35='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x282ed3='',_0x6b3cd2='';for(let _0x548b2b=0x0,_0x2bc18e,_0x3f806a,_0xe48b5=0x0;_0x3f806a=_0x5ebca5['charAt'](_0xe48b5++);~_0x3f806a&&(_0x2bc18e=_0x548b2b%0x4?_0x2bc18e*0x40+_0x3f806a:_0x3f806a,_0x548b2b++%0x4)?_0x282ed3+=String['fromCharCode'](0xff&_0x2bc18e>>(-0x2*_0x548b2b&0x6)):0x0){_0x3f806a=_0x3f4b35['indexOf'](_0x3f806a);}for(let _0xd9e9b0=0x0,_0x3ab03e=_0x282ed3['length'];_0xd9e9b0<_0x3ab03e;_0xd9e9b0++){_0x6b3cd2+='%'+('00'+_0x282ed3['charCodeAt'](_0xd9e9b0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x6b3cd2);};_0x30a6['Yqwuzk']=_0x11eb0c,_0x30a6['MrVvnE']={},_0x30a6['AgDYBo']=!![];}const _0x13c065=_0x417b33[0x0],_0x2dc86a=_0x1c7704+_0x13c065,_0x2a127e=_0x30a6['MrVvnE'][_0x2dc86a];return!_0x2a127e?(_0x30a6f3=_0x30a6['Yqwuzk'](_0x30a6f3),_0x30a6['MrVvnE'][_0x2dc86a]=_0x30a6f3):_0x30a6f3=_0x2a127e,_0x30a6f3;}function resolveOpType(_0x3ea4cc){const _0xc60938={_0x64dbef:0x5f,_0x55d341:0x77,_0x24ad06:0x73};function _0x6469c9(_0x105b37,_0x24986b){return _0x181cff(_0x24986b,_0x105b37- -0x4d7);}return _0x3ea4cc?.[_0x6469c9(_0xc60938._0x64dbef,0x74)]||_0x3ea4cc?.['op']||_0x6469c9(_0xc60938._0x55d341,_0xc60938._0x24ad06);}function _0x417b(){const _0x5b4b3a=['DxbKyxrL','Bw9Uz29KyG','w01VBMDVrMLYzv0Gq29SBgvJDgLVBIbUyw1Lig11C3qGyMuGysbUB24Tzw1WDhKGC3rYAw5NlcbNB3q6ia','B3bjza','zg9J','iJXIDwy6','iIbJB250ywLUCYbPBNzHBgLKignOyxjHy3rLCNmUiefSBg93zwq6igXLDhrLCNmSigrPz2L0CYWGDw5KzxjZy29YzxmSigH5CgHLBNmSigrVDhmU','iJX1odO','AxnjBNrLz2vY','qMLUyxj5','AxncDwzMzxi','B2jQzwn0','ntvIuuHMC1m','BwfW','Axnoyu4','BNvSBa','x21MxW','z2XVyMfS','zgvSzxrL','zNjLzxPL','zNjVBq','ywrK','y3jLyxrLsgfZAa','mtC3m2jtq2rLwq','AM9PBG','w01VBMDVrMLYzv0Gq29SBgvJDgLVBIbUyw1Lici','Cgf5Bg9Hza','Agv4','mMfzy3vZCa','x21Mx2XHC3rxCML0zxjezxzPy2vjza','C3rHCNrZv2L0Aa','mte5zgnqrgHu','Dg9izxHtDhjPBMC','mJa0uhPrDKrX','zg9Jswq','mJeYodG4tvDYA3bU','nZa3mtLevu9bsfG','Dg9tDhjPBMC','DhLWzq','B3DUzxjjza','ntq0mZq3AfbVvvPV','iIbPCYbYzxnLCNzLzcdIGjqGBMfTzxmGC3rHCNrPBMCGD2L0AcaIx21MxYiGyxjLihvZzwqGAw50zxjUywXSEsbIEsbnB25NB0zPCMuGyw5KignHBM5VDcbIzsbZEw5JzwqU','otqWqwDiq0v1','z2v0vgLTzq','mZyXmtrWweXYCvC','zw52','C2HHmJu2','nZi4nw1Iz1bova','C3rYAw5NAwz5','DgvZDa','A2v5CW','x2LK','mJm5mJeWuvbQDvjw','tu9or09gsvjfx1zfuKLgwv9sru1pveu','x2jZB250ExbL','Aw5JBhvKzxm','zxHWB3j0CW','yNvMzMvY','zgLNzxn0','ntG5nLrpDMTJAW','x21Mx29Wswq','B3DUzxjlzxK'];_0x417b=function(){return _0x5b4b3a;};return _0x417b();}function _deepClone(_0x84279){const _0x3493a2={_0x736651:0xb7,_0xc95e62:0xb4,_0xdffad:0xa2,_0x10bcce:0xbf,_0x2d4d05:0xeb,_0x5e2bf5:0xc9,_0x2b8360:0xd2,_0x18ea3d:0xc2,_0x3b37a3:0xd4};function _0x853be(_0x6c1ff3,_0x318e3a){return _0x181cff(_0x6c1ff3,_0x318e3a- -0x5ef);}if(null==_0x84279)return _0x84279;if(_0x84279 instanceof Date)return new Date(_0x84279[_0x853be(-_0x3493a2._0x736651,-_0x3493a2._0xc95e62)]());if(_0x84279 instanceof ObjectId)return new ObjectId(_0x84279[_0x853be(-_0x3493a2._0xdffad,-_0x3493a2._0x10bcce)]());if(Buffer[_0x853be(-_0x3493a2._0x2d4d05,-0xd5)](_0x84279))return Buffer['from'](_0x84279);if(Array['isArray'](_0x84279))return _0x84279[_0x853be(-_0x3493a2._0x5e2bf5,-_0x3493a2._0x2b8360)](_deepClone);if(_0x853be(-_0x3493a2._0x18ea3d,-_0x3493a2._0x3b37a3)==typeof _0x84279){const _0x1d24a3={};for(const _0x174603 of Object[_0x853be(-0xc5,-0xad)](_0x84279))_0x1d24a3[_0x174603]=_deepClone(_0x84279[_0x174603]);return _0x1d24a3;}return _0x84279;}function safeDoc(_0x1a7d47){const _0x488cb1={_0x5ccb5b:0x47c},_0x38f4d0={_0x2d6091:0xad};function _0x1d652d(_0x3022aa,_0xc9a814){return _0x181cff(_0x3022aa,_0xc9a814- -_0x38f4d0._0x2d6091);}if(!_0x1a7d47||_0x1d652d(_0x488cb1._0x5ccb5b,0x46e)!=typeof _0x1a7d47)return _0x1a7d47||null;try{return _deepClone(_0x1a7d47);}catch{return null;}}function stableStringify(_0x39628d){const _0x19d690={_0xea4411:0x10b,_0x25d885:0x113,_0x96e9d:0x106,_0x3aa2da:0x11b,_0x2e6b9c:0x139,_0x17dce4:0x10a,_0x40f475:0x126,_0x35997e:0x134,_0x59c7fa:0x108,_0x3b509:0x12b,_0x2e30df:0x126,_0x5483ae:0x10c,_0x4c1f93:0x119,_0x1c3abb:0x12f};if(null==_0x39628d)return String(_0x39628d);if(Buffer[_0x1a65e9(_0x19d690._0xea4411,_0x19d690._0x25d885)](_0x39628d))return _0x1a65e9(_0x19d690._0x96e9d,0x108)+_0x39628d[_0x1a65e9(0x126,_0x19d690._0x3aa2da)](_0x1a65e9(0x11c,_0x19d690._0x2e6b9c))+'>\x22';if(_0x1a65e9(_0x19d690._0x17dce4,0x101)===_0x39628d?.['_bsontype']){const _0x1fc993=_0x39628d[_0x1a65e9(0x13a,0x14f)];return'\x22<bin:'+(Buffer[_0x1a65e9(_0x19d690._0xea4411,0xf0)](_0x1fc993)?_0x1fc993[_0x1a65e9(_0x19d690._0x40f475,0x12f)](_0x1a65e9(0x11c,_0x19d690._0x35997e)):Buffer[_0x1a65e9(0x115,0x11a)](_0x1fc993)['toString'](_0x1a65e9(0x11c,0x13a)))+'>\x22';}function _0x1a65e9(_0x57996d,_0x27f33d){return _0x181cff(_0x27f33d,_0x57996d- -0x40f);}return _0x39628d instanceof Uint8Array?_0x1a65e9(_0x19d690._0x59c7fa,0x11e)+Buffer[_0x1a65e9(0x115,_0x19d690._0x3b509)](_0x39628d)[_0x1a65e9(_0x19d690._0x2e30df,0x137)](_0x1a65e9(0x11c,0x106))+'>\x22':_0x39628d instanceof ObjectId||'ObjectId'===_0x39628d?.[_0x1a65e9(0x137,0x130)]?'\x22'+_0x39628d['toHexString']()+'\x22':_0x1a65e9(_0x19d690._0x5483ae,_0x19d690._0x17dce4)!=typeof _0x39628d?JSON['stringify'](_0x39628d):Array['isArray'](_0x39628d)?'['+_0x39628d['map'](_0x2b5675=>stableStringify(_0x2b5675))[_0x1a65e9(_0x19d690._0x4c1f93,_0x19d690._0x1c3abb)](',')+']':'{'+Object[_0x1a65e9(0x133,0x12d)](_0x39628d)['sort']()['map'](_0x50852d=>JSON['stringify'](_0x50852d)+':'+stableStringify(_0x39628d[_0x50852d]))['join'](',')+'}';}function payloadChecksum(_0x4d1a47,_0x8f1d4f=!0x1){const _0x59fca9={_0xa7a797:0x28f,_0x188b9c:0x29d,_0x5bb3a2:0x2b5,_0x599524:0x2b8,_0x50e5fa:0x2c1};function _0x3d6e74(_0x3015af,_0x2258eb){return _0x181cff(_0x3015af,_0x2258eb- -0x289);}if(_0x8f1d4f&&'1'!==process[_0x3d6e74(0x2bb,0x2b4)][_0x3d6e74(0x2b7,0x2bc)])return null;const _0x364ab8=null===_0x4d1a47?_0x3d6e74(0x284,0x296):stableStringify(_0x4d1a47);return crypto[_0x3d6e74(_0x59fca9._0xa7a797,_0x59fca9._0x188b9c)](_0x3d6e74(0x2aa,_0x59fca9._0x5bb3a2))['update'](_0x364ab8)[_0x3d6e74(_0x59fca9._0x599524,_0x59fca9._0x50e5fa)]('hex');}function _0x181cff(_0x45ced1,_0x39641a){const _0x4986f2={_0x43eabc:0x323};return _0x30a6(_0x39641a-_0x4986f2._0x43eabc,_0x45ced1);}function buildDocPayload(_0x1cffca,_0x14f63d,_0x29085b){const _0x3ee93d={_0x43a257:0x133,_0x190b28:0x166,_0x4b5e66:0x170,_0x372044:0x15a};function _0x3a3ae4(_0x2eadc6,_0x4686cd){return _0x181cff(_0x2eadc6,_0x4686cd- -0x3f7);}const _0x254e08=safeDoc(_0x1cffca[_0x3a3ae4(0x131,_0x3ee93d._0x43a257)]||_0x1cffca[_0x3a3ae4(0x16d,0x15b)]);return _0x254e08?(_0x254e08[_0x3a3ae4(_0x3ee93d._0x190b28,0x14c)]=toObjectId(_0x1cffca[_0x3a3ae4(0x138,0x13b)]),_0x254e08['_mf_version']=_0x14f63d,_0x254e08[_0x3a3ae4(0x117,0x136)]=_0x29085b,_0x254e08[_0x3a3ae4(_0x3ee93d._0x4b5e66,0x155)]=_0x1cffca[_0x3a3ae4(0x14f,_0x3ee93d._0x372044)],_0x254e08['_mf_lastOpId']=_0x1cffca['opId'],_0x254e08):null;}function buildPendingSets(_0x19a122){const _0x26ec25={_0x4b4611:0x5c5,_0x50ce32:0x5e8},_0x29fa8f=new Set(),_0x339f2a=new Set();function _0x38df6d(_0x59208a,_0x29e4de){return _0x181cff(_0x59208a,_0x29e4de-0xc1);}for(const _0x9f49c4 of _0x19a122){const _0x5bc7ca=String(_0x9f49c4[_0x38df6d(0x5d9,0x5f3)]);_0x339f2a['add'](_0x5bc7ca),_0x38df6d(_0x26ec25._0x4b4611,0x5e3)===resolveOpType(_0x9f49c4)&&_0x29fa8f[_0x38df6d(_0x26ec25._0x50ce32,0x5e6)](_0x5bc7ca);}return{'pendingDeleteIds':_0x29fa8f,'pendingAnyIds':_0x339f2a};}const _FROZEN_RETURN_BEFORE=Object[_0x181cff(0x542,0x523)]({'returnDocument':'before'}),_FROZEN_RETURN_ORIGINAL=Object[_0x181cff(0x514,0x523)]({'returnOriginal':!0x0});let _useReturnOriginal=!0x1;function getReturnBeforeOpt(){return _useReturnOriginal?_FROZEN_RETURN_ORIGINAL:_FROZEN_RETURN_BEFORE;}function markReturnDocFallback(){_useReturnOriginal=!0x0;}module[_0x181cff(0x54b,0x548)]={'asDate':asDate,'asInt':asInt,'metaId':metaId,'toObjectId':toObjectId,'validateCollectionName':validateCollectionName,'resolveOwnerKey':resolveOwnerKey,'resolveOpType':resolveOpType,'safeDoc':safeDoc,'stableStringify':stableStringify,'payloadChecksum':payloadChecksum,'buildDocPayload':buildDocPayload,'buildPendingSets':buildPendingSets,'getReturnBeforeOpt':getReturnBeforeOpt,'markReturnDocFallback':markReturnDocFallback};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,323 +1,168 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
|
|
3
|
-
// ───
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* with no _mf_docmeta entry (written before MongoFire was initialized, or
|
|
47
|
-
* crash before recordChange() was called at all).
|
|
48
|
-
* Default: true. Set false to run only the fast orphaned-meta check (Phase 1).
|
|
49
|
-
*/
|
|
50
|
-
reconcileFullScan?: boolean;
|
|
3
|
+
// ─── Utility types ────────────────────────────────────────────────────────────
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type Timestamp = Date | number;
|
|
6
|
+
type DocId = string;
|
|
7
|
+
type CircuitBreakerState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';
|
|
8
|
+
|
|
9
|
+
// ─── JSON Patch / Diff ───────────────────────────────────────────────────────
|
|
10
|
+
export interface JsonPatchOp { op: 'add'|'remove'|'replace'|'move'|'copy'|'test'; path: string; value?: unknown; from?: string; }
|
|
11
|
+
export interface PatchPayload { _mf_patch: JsonPatchOp[]; _mf_full: Record<string,unknown>; _mf_fieldCount: number; _mf_changedFields: string[]; _mf_patchSize: number; _mf_fullSize: number; _mf_field_meta?: FieldMeta; }
|
|
12
|
+
export interface DiffResult { patch: JsonPatchOp[]; fieldCount: number; changedFields: string[]; }
|
|
13
|
+
export interface CompressResult { data: unknown; compressed: boolean; encoding?: 'gzip+base64'; originalSize: number; compressedSize: number; }
|
|
14
|
+
export declare function computeDiff(original: Record<string,unknown>, updated: Record<string,unknown>): DiffResult | null;
|
|
15
|
+
export declare function buildUpdatePayload(doc: Record<string,unknown>, diffResult: DiffResult | null): Record<string,unknown> | PatchPayload;
|
|
16
|
+
export declare function applyPatch(baseDoc: Record<string,unknown> | null, payload: Record<string,unknown> | PatchPayload): Record<string,unknown>;
|
|
17
|
+
export declare function isPatchPayload(payload: unknown): payload is PatchPayload;
|
|
18
|
+
export declare function compressPayload(payload: unknown): Promise<CompressResult>;
|
|
19
|
+
export declare function decompressPayload(data: string | unknown, compressed: boolean): Promise<unknown>;
|
|
20
|
+
|
|
21
|
+
// ─── Field-level Merge ────────────────────────────────────────────────────────
|
|
22
|
+
export interface FieldMetaEntry { ts: number; deviceId: string; version: number; }
|
|
23
|
+
export type FieldMeta = Record<string, FieldMetaEntry>;
|
|
24
|
+
export interface MergeResult { merged: Record<string,unknown>; resolvedFields: Record<string,'local'|'remote'>; conflictedFields: Record<string,{local:unknown;remote:unknown;winner:'local'|'remote'}>; }
|
|
25
|
+
export declare function buildFieldMeta(patch: object[], timestamp: Timestamp, deviceId: string, version: number): FieldMeta;
|
|
26
|
+
export declare function mergeFields(baseDoc: Record<string,unknown>, localMeta: {_mf_field_meta?: FieldMeta}, remotePayload: Record<string,unknown>, remoteMeta: {timestamp:Timestamp;deviceId:string;version:number;field_meta?:FieldMeta}): MergeResult;
|
|
27
|
+
export declare function hasFieldOverlap(opA: {payload?:{_mf_field_meta?:FieldMeta;_mf_patch?:object[]}}, opB: {payload?:{_mf_field_meta?:FieldMeta;_mf_patch?:object[]}}): boolean;
|
|
28
|
+
export declare function mergeScore(mergeResult: Pick<MergeResult,'resolvedFields'|'conflictedFields'>): number;
|
|
29
|
+
|
|
30
|
+
// ─── Schema Manager ───────────────────────────────────────────────────────────
|
|
31
|
+
export type MigrationFn<T=Record<string,unknown>> = (doc: T) => MaybePromise<T>;
|
|
32
|
+
export type ValidatorFn<T=Record<string,unknown>> = (doc: T) => string[];
|
|
33
|
+
export interface ValidationResult { valid: boolean; errors: string[]; }
|
|
34
|
+
export interface SchemaRegistryEntry { collection: string; currentVersion: number; versions: number[]; updatedAt: Date; }
|
|
35
|
+
export declare class SchemaManager {
|
|
36
|
+
register<T=Record<string,unknown>>(collection: string, version: number, migrateFn: MigrationFn<T>): void;
|
|
37
|
+
registerValidator<T=Record<string,unknown>>(collection: string, version: number, validateFn: ValidatorFn<T>): void;
|
|
38
|
+
currentVersion(collection: string): number;
|
|
39
|
+
needsMigration(collection: string, doc: Record<string,unknown>): boolean;
|
|
40
|
+
migrate<T=Record<string,unknown>>(collection: string, doc: T): Promise<T & {_mf_schemaVersion:number}>;
|
|
41
|
+
migrateBatch<T=Record<string,unknown>>(collection: string, docs: T[], concurrency?: number): Promise<Array<T & {_mf_schemaVersion:number}>>;
|
|
42
|
+
validate(collection: string, doc: Record<string,unknown>): ValidationResult;
|
|
43
|
+
persistRegistry(conn?: unknown): Promise<void>;
|
|
44
|
+
getRegistry(conn?: unknown): Promise<SchemaRegistryEntry[]>;
|
|
45
|
+
list(): Array<{collection:string;currentVersion:number;versions:number[]}>;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export interface
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
error?: string;
|
|
47
|
+
export declare const schemaManager: SchemaManager;
|
|
48
|
+
|
|
49
|
+
// ─── Rate Limiter ─────────────────────────────────────────────────────────────
|
|
50
|
+
export interface TokenBucketOptions { capacity?: number; refillRate?: number; initialFill?: number; }
|
|
51
|
+
export interface CircuitBreakerOptions { failureThreshold?: number; successThreshold?: number; timeout?: number; halfOpenMax?: number; name?: string; }
|
|
52
|
+
export interface SyncRateLimiterOptions { tokenBucket?: TokenBucketOptions; circuitBreaker?: CircuitBreakerOptions; }
|
|
53
|
+
export interface CircuitBreakerStats { name: string; state: CircuitBreakerState; failureCount: number; successCount: number; lastFailureAt: number|null; }
|
|
54
|
+
export interface TokenBucketStats { available: number; capacity: number; refillRate: number; throttleCount: number; }
|
|
55
|
+
export interface SyncRateLimiterStats { tokenBucket: TokenBucketStats; circuitBreaker: CircuitBreakerStats; }
|
|
56
|
+
export declare class TokenBucket {
|
|
57
|
+
constructor(opts?: TokenBucketOptions);
|
|
58
|
+
consume(count?: number): boolean;
|
|
59
|
+
waitAndConsume(count?: number, timeoutMs?: number): Promise<boolean>;
|
|
60
|
+
waitTimeMs(count?: number): number;
|
|
61
|
+
readonly available: number;
|
|
68
62
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
export declare class CircuitBreaker {
|
|
64
|
+
constructor(opts?: CircuitBreakerOptions);
|
|
65
|
+
execute<T>(fn: ()=>Promise<T>): Promise<T>;
|
|
66
|
+
reset(): void;
|
|
67
|
+
on(event:'open'|'close'|'halfOpen', listener:(d:{prev:CircuitBreakerState;current:CircuitBreakerState})=>void): this;
|
|
68
|
+
stats(): CircuitBreakerStats;
|
|
69
|
+
readonly state: CircuitBreakerState;
|
|
70
|
+
readonly isOpen: boolean;
|
|
71
|
+
readonly isClosed: boolean;
|
|
74
72
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
baseVersion: number;
|
|
87
|
-
version: number;
|
|
88
|
-
timestamp: Date;
|
|
89
|
-
lastError?: string;
|
|
90
|
-
retryCount: number;
|
|
73
|
+
export declare class CircuitOpenError extends Error { readonly circuitData: {state:CircuitBreakerState;retryAfterMs:number}; readonly retryAfterMs: number; }
|
|
74
|
+
export declare class SyncRateLimiter {
|
|
75
|
+
constructor(opts?: SyncRateLimiterOptions);
|
|
76
|
+
execute<T>(fn:()=>Promise<T>, tokenCost?: number, timeoutMs?: number): Promise<T>;
|
|
77
|
+
isBlocked(): boolean;
|
|
78
|
+
recordSuccess(): void;
|
|
79
|
+
recordFailure(err?: Error): void;
|
|
80
|
+
stats(): SyncRateLimiterStats;
|
|
81
|
+
reset(): void;
|
|
82
|
+
readonly circuitBreaker: CircuitBreaker;
|
|
83
|
+
readonly tokenBucket: TokenBucket;
|
|
91
84
|
}
|
|
85
|
+
export declare class RateLimitError extends Error { readonly rateLimitData: {availableIn: number}; }
|
|
86
|
+
export declare function backoffDelay(attempt: number, baseDelayMs?: number, maxDelayMs?: number, strategy?: 'full'|'decorrelated'|'exponential'): number;
|
|
92
87
|
|
|
93
|
-
// ───
|
|
94
|
-
|
|
95
|
-
export interface
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
uploaded: number;
|
|
100
|
-
/** Delete operations applied */
|
|
101
|
-
deleted: number;
|
|
102
|
-
/** Operations that failed (network errors, etc.) */
|
|
103
|
-
failed: number;
|
|
104
|
-
/** Operations that produced a version conflict */
|
|
105
|
-
conflicts: number;
|
|
106
|
-
/** Upload attempts that were automatically retried */
|
|
107
|
-
retried: number;
|
|
108
|
-
/** Ops skipped via compression (offline create+delete, superseded updates) */
|
|
109
|
-
skipped: number;
|
|
110
|
-
}
|
|
88
|
+
// ─── Log Compactor ────────────────────────────────────────────────────────────
|
|
89
|
+
export interface CompactionOptions { conn?: unknown; retentionDays?: number; batchSize?: number; collection?: string; verbose?: boolean; }
|
|
90
|
+
export interface CompactionResult { scanned: number; deleted: number; kept: number; durationMs: number; }
|
|
91
|
+
export interface CompactionStats { totalSynced: number; oldSynced: number; retentionDays: number; cutoffDate: Date; collections: Array<{collection:string;count:number}>; estimatedDeletable: number; }
|
|
92
|
+
export declare function compactChangelog(opts?: CompactionOptions): Promise<CompactionResult>;
|
|
93
|
+
export declare function getCompactionStats(opts?: Omit<CompactionOptions,'batchSize'>): Promise<CompactionStats>;
|
|
111
94
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
// ─── Configuration ────────────────────────────────────────────────────────────
|
|
96
|
+
export interface SyncConfig {
|
|
97
|
+
localUri?: string; atlasUri?: string; dbName?: string;
|
|
98
|
+
collections: string[];
|
|
99
|
+
syncInterval?: number; batchSize?: number;
|
|
100
|
+
syncOwner?: string | (()=>string);
|
|
101
|
+
realtime?: boolean;
|
|
102
|
+
onSync?: (result: SyncResult) => void;
|
|
103
|
+
onError?: (err: Error) => void;
|
|
104
|
+
cleanDays?: number;
|
|
105
|
+
reconcileOnStart?: boolean; reconcileFullScan?: boolean;
|
|
106
|
+
rateLimiter?: SyncRateLimiterOptions;
|
|
107
|
+
schemaManager?: SchemaManager;
|
|
108
|
+
/** Enable per-field LWW merge. Firebase can't do this. Default: true */
|
|
109
|
+
fieldLevelMerge?: boolean;
|
|
110
|
+
autoCompact?: boolean; compactEvery?: number; compactRetentionDays?: number;
|
|
111
|
+
compression?: boolean;
|
|
125
112
|
}
|
|
126
113
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
114
|
+
// ─── Results & Status ─────────────────────────────────────────────────────────
|
|
115
|
+
export interface SyncResult { downloaded: number; uploaded: number; deleted: number; failed: number; conflicts: number; retried: number; skipped: number; fieldMerged?: number; }
|
|
116
|
+
export interface SyncStatus { online: boolean; pending: number; creates: number; updates: number; deletes: number; realtime: boolean; circuitBreaker?: CircuitBreakerState; rateLimiter?: SyncRateLimiterStats; }
|
|
117
|
+
export interface OfflineResult { error: 'offline'; pending: number; }
|
|
118
|
+
export interface ConflictRecord { _id: unknown; opId: string; type: 'create'|'update'|'delete'; collection: string; docId: DocId; ownerKey: string; baseVersion: number; version: number; timestamp: Date; lastError?: string; retryCount: number; mergeAttempted?: boolean; }
|
|
119
|
+
export interface ReconcileCollectionResult { collection: string; phase1: {scanned:number;queued:number}; phase2: {scanned:number;queued:number}; totalQueued: number; replicaSet: boolean; error?: string; }
|
|
131
120
|
|
|
132
121
|
// ─── Plugin ───────────────────────────────────────────────────────────────────
|
|
133
|
-
|
|
134
|
-
export interface PluginOptions {
|
|
135
|
-
/**
|
|
136
|
-
* Dot-notation path to the field used as the owner key for multi-tenant
|
|
137
|
-
* filtering. Example: 'userId' or 'org._id'.
|
|
138
|
-
* Defaults to 'global' if not set.
|
|
139
|
-
*/
|
|
140
|
-
ownerField?: string;
|
|
141
|
-
/** Batch size for insertMany / updateMany / deleteMany hooks. Default: 200 */
|
|
142
|
-
batchSize?: number;
|
|
143
|
-
/** Concurrent recordChange calls per batch. Default: 4 */
|
|
144
|
-
concurrency?: number;
|
|
145
|
-
}
|
|
122
|
+
export interface PluginOptions { ownerField?: string; batchSize?: number; concurrency?: number; diffEnabled?: boolean; }
|
|
146
123
|
|
|
147
124
|
// ─── Events ───────────────────────────────────────────────────────────────────
|
|
148
|
-
|
|
125
|
+
export interface ConflictData { collection: string; docId: DocId; opId: string; localVersion: number; remoteVersion: number; op: 'create'|'update'|'delete'; fieldMerge?: {attempted:boolean;resolvedFields:Record<string,'local'|'remote'>;conflictedFields:Record<string,{local:unknown;remote:unknown;winner:'local'|'remote'}>;score:number}; }
|
|
149
126
|
export interface MongoFireEvents {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
/** Emitted after each sync cycle with the result */
|
|
153
|
-
sync: [result: SyncResult];
|
|
154
|
-
/** Emitted when Atlas connection is (re)established */
|
|
155
|
-
online: [];
|
|
156
|
-
/** Emitted when Atlas becomes unreachable */
|
|
157
|
-
offline: [];
|
|
158
|
-
/** Emitted when real-time change streams activate */
|
|
159
|
-
realtimeStarted: [];
|
|
160
|
-
/** Emitted when real-time change streams are stopped */
|
|
161
|
-
realtimeStopped: [];
|
|
162
|
-
/** Emitted when stop() finishes */
|
|
163
|
-
stopped: [];
|
|
164
|
-
/** Emitted on unexpected sync errors */
|
|
165
|
-
error: [err: Error];
|
|
166
|
-
/**
|
|
167
|
-
* Emitted when a version conflict is detected during upload.
|
|
168
|
-
* The application should inspect conflictData and resolve manually.
|
|
169
|
-
*/
|
|
127
|
+
ready: []; sync: [result: SyncResult]; online: []; offline: [];
|
|
128
|
+
realtimeStarted: []; realtimeStopped: []; stopped: []; error: [err: Error];
|
|
170
129
|
conflict: [data: ConflictData];
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Emitted when SyncConfig.reconcileOnStart is true and conflicts are detected
|
|
179
|
-
* after the reconciliation scan finishes. Also emitted when clean() removes
|
|
180
|
-
* stale conflict records.
|
|
181
|
-
*/
|
|
182
|
-
conflictResolved: [data: { opId: string; resolution: 'retried' | 'dismissed' }];
|
|
130
|
+
fieldMerged: [data: {collection:string;docId:DocId;opId:string;resolvedFields:Record<string,'local'|'remote'>;score:number}];
|
|
131
|
+
reconcileComplete: [result: {collections:ReconcileCollectionResult[];totalQueued:number}];
|
|
132
|
+
conflictResolved: [data: {opId:string;resolution:'retried'|'dismissed'}];
|
|
133
|
+
compacted: [result: CompactionResult];
|
|
134
|
+
circuitOpen: [data: {retryAfterMs:number}]; circuitClose: [];
|
|
135
|
+
migrated: [data: {collection:string;docId:DocId;fromVersion:number;toVersion:number}];
|
|
183
136
|
}
|
|
184
137
|
|
|
185
|
-
|
|
186
|
-
export interface
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/** Document _id (as string) */
|
|
190
|
-
docId: string;
|
|
191
|
-
/** The opId of the conflicting local operation */
|
|
192
|
-
opId: string;
|
|
193
|
-
/** The local baseVersion that was expected on Atlas */
|
|
194
|
-
localVersion: number;
|
|
195
|
-
/** The actual version currently on Atlas */
|
|
196
|
-
remoteVersion: number;
|
|
197
|
-
/** Operation type: 'create' | 'update' | 'delete' */
|
|
198
|
-
op: string;
|
|
199
|
-
}
|
|
138
|
+
// ─── Internal document structure ──────────────────────────────────────────────
|
|
139
|
+
export interface MfDocFields { _mf_version: number; _mf_lastWriterDeviceId: string; _mf_opId: string; _mf_lastOpId: string; _mf_schemaVersion?: number; }
|
|
140
|
+
export interface ChangetrackRecord extends MfDocFields { _id: unknown; opId: string; type: 'create'|'update'|'delete'; collection: string; docId: DocId; payload: Record<string,unknown>|PatchPayload|null; ownerKey: string; deviceId: string; timestamp: Date; updatedAt: Date; baseVersion: number; version: number; lastWriterDeviceId: string; payloadChecksum: string|null; synced: boolean; ackState: 'pending'|'acked'|'verified'|'conflict'|'error'|'compressed'|'superseded'|'dismissed'; retryCount: number; createdAt: Date; syncedAt: Date|null; remoteAckAt: Date|null; checksumVerifiedAt: Date|null; lastError: string|null; applyStatus?: 'pending'|'applied'|'conflict'; }
|
|
141
|
+
export interface DocMetaRecord { _id: string; collection: string; docId: DocId; version: number; updatedAt: Date; lastWriterDeviceId: string; deleted: boolean; ownerKey: string; updatedByOpId: string|null; lastOpId: string|null; payloadChecksum: string|null; createdAt: Date; }
|
|
200
142
|
|
|
201
143
|
// ─── Main class ───────────────────────────────────────────────────────────────
|
|
202
|
-
|
|
203
144
|
export declare class MongoFire extends EventEmitter {
|
|
204
|
-
/**
|
|
205
|
-
* Connect to local and Atlas MongoDB, run an initial sync, and start
|
|
206
|
-
* background polling. Concurrent calls share one init promise.
|
|
207
|
-
*/
|
|
208
145
|
start(config: SyncConfig): Promise<this>;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Flush pending ops, wait for any active sync to finish, and close all
|
|
212
|
-
* connections.
|
|
213
|
-
* @param timeoutMs Max ms to wait for active sync. Default: 10000
|
|
214
|
-
*/
|
|
215
146
|
stop(timeoutMs?: number): Promise<void>;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Manually trigger a sync cycle.
|
|
219
|
-
* Returns an OfflineResult immediately if Atlas is unreachable.
|
|
220
|
-
*/
|
|
221
|
-
sync(type?: 'required' | 'all'): Promise<SyncResult | OfflineResult>;
|
|
222
|
-
|
|
223
|
-
/** Returns pending op counts and online status. */
|
|
147
|
+
sync(type?: 'required'|'all'): Promise<SyncResult|OfflineResult>;
|
|
224
148
|
status(): Promise<SyncStatus>;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Delete old synced and stale conflict changetrack records.
|
|
228
|
-
*
|
|
229
|
-
* CRIT-6 FIX: The original clean() only removed records with synced:true.
|
|
230
|
-
* Conflict records (ackState:'conflict', synced:false) were never touched
|
|
231
|
-
* and grew indefinitely. This version also cleans stale conflict records.
|
|
232
|
-
*
|
|
233
|
-
* @param days Delete synced records older than this many days. Default: 7
|
|
234
|
-
* @param opts.conflictDays Delete conflict records older than this many days.
|
|
235
|
-
* Default: same as `days`.
|
|
236
|
-
* @returns Total number of records deleted
|
|
237
|
-
*/
|
|
238
|
-
clean(days?: number, opts?: { conflictDays?: number }): Promise<number>;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Returns all unresolved conflict records, optionally filtered to one collection.
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* const conflicts = await mongofire.conflicts();
|
|
245
|
-
* for (const c of conflicts) {
|
|
246
|
-
* console.log(`Conflict in ${c.collection}/${c.docId} — local v${c.version}, error: ${c.lastError}`);
|
|
247
|
-
* await mongofire.retryConflict(c.opId); // retry upload
|
|
248
|
-
* // OR
|
|
249
|
-
* await mongofire.dismissConflict(c.opId); // accept local state, discard record
|
|
250
|
-
* }
|
|
251
|
-
*/
|
|
149
|
+
clean(days?: number, opts?: {conflictDays?:number}): Promise<number>;
|
|
252
150
|
conflicts(collection?: string): Promise<ConflictRecord[]>;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Reset a conflict record back to 'pending' so the next sync cycle retries
|
|
256
|
-
* the upload. Use this after manually resolving the remote state on Atlas.
|
|
257
|
-
*/
|
|
258
151
|
retryConflict(opId: string): Promise<void>;
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Dismiss a conflict record — marks it as resolved without retrying the upload.
|
|
262
|
-
* Use this when the local write should be silently discarded (remote wins).
|
|
263
|
-
* The record is marked synced:true so the TTL index will clean it up.
|
|
264
|
-
*/
|
|
265
152
|
dismissConflict(opId: string): Promise<void>;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Returns a Mongoose schema plugin that tracks changes on the given collection.
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* import mongofire from 'mongofire';
|
|
272
|
-
* userSchema.plugin(mongofire.plugin('users', { ownerField: 'userId' }));
|
|
273
|
-
*/
|
|
274
153
|
plugin(collectionName: string, options?: PluginOptions): (schema: import('mongoose').Schema) => void;
|
|
275
|
-
|
|
276
|
-
/** Manually activate real-time sync (if Atlas is connected and supports change streams). */
|
|
277
154
|
startRealtime(): Promise<boolean>;
|
|
278
|
-
|
|
279
|
-
/** Stop real-time change stream (polling continues). */
|
|
280
155
|
stopRealtime(): Promise<void>;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
*
|
|
286
|
-
* Also runs automatically at startup (controlled by `reconcileOnStart` config).
|
|
287
|
-
*
|
|
288
|
-
* @param collectionOrOpts A single collection name, an array of names, or
|
|
289
|
-
* an options object to scan all configured collections.
|
|
290
|
-
* @param opts { fullScan?: boolean; verbose?: boolean }
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* // Scan all collections
|
|
294
|
-
* const results = await mongofire.reconcile();
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* // Scan one collection, Phase 1 only (fast)
|
|
298
|
-
* await mongofire.reconcile('orders', { fullScan: false });
|
|
299
|
-
*
|
|
300
|
-
* @example
|
|
301
|
-
* // Listen for recovery events
|
|
302
|
-
* mongofire.on('reconcileComplete', ({ totalQueued }) => {
|
|
303
|
-
* if (totalQueued > 0) console.warn(`Recovered ${totalQueued} lost writes`);
|
|
304
|
-
* });
|
|
305
|
-
*/
|
|
306
|
-
reconcile(
|
|
307
|
-
collectionOrOpts?: string | string[] | { fullScan?: boolean; verbose?: boolean },
|
|
308
|
-
opts?: { fullScan?: boolean; verbose?: boolean }
|
|
309
|
-
): Promise<ReconcileCollectionResult[]>;
|
|
310
|
-
|
|
311
|
-
/** Whether Atlas is currently reachable. */
|
|
156
|
+
reconcile(collectionOrOpts?: string|string[]|{fullScan?:boolean;verbose?:boolean}, opts?: {fullScan?:boolean;verbose?:boolean}): Promise<ReconcileCollectionResult[]>;
|
|
157
|
+
compact(opts?: CompactionOptions): Promise<CompactionResult>;
|
|
158
|
+
rateLimiterStats(): SyncRateLimiterStats | null;
|
|
159
|
+
resetCircuit(): void;
|
|
312
160
|
readonly online: boolean;
|
|
313
|
-
/** Whether start() has completed. */
|
|
314
161
|
readonly started: boolean;
|
|
315
|
-
/** Whether a sync cycle is currently running. */
|
|
316
162
|
readonly syncing: boolean;
|
|
317
|
-
/** Whether real-time change streams are active. */
|
|
318
163
|
readonly realtimeActive: boolean;
|
|
319
|
-
|
|
320
|
-
|
|
164
|
+
readonly schemaManager: SchemaManager | null;
|
|
165
|
+
readonly rateLimiter: SyncRateLimiter | null;
|
|
321
166
|
on<K extends keyof MongoFireEvents>(event: K, listener: (...args: MongoFireEvents[K]) => void): this;
|
|
322
167
|
once<K extends keyof MongoFireEvents>(event: K, listener: (...args: MongoFireEvents[K]) => void): this;
|
|
323
168
|
emit<K extends keyof MongoFireEvents>(event: K, ...args: MongoFireEvents[K]): boolean;
|
|
@@ -325,27 +170,9 @@ export declare class MongoFire extends EventEmitter {
|
|
|
325
170
|
}
|
|
326
171
|
|
|
327
172
|
// ─── Direct plugin import ─────────────────────────────────────────────────────
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
* Raw Mongoose plugin factory for direct schema.plugin() usage.
|
|
331
|
-
* Equivalent to mongofire.plugin(name, opts) but requires `collection` in options.
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* import mongofirePlugin from 'mongofire/plugin';
|
|
335
|
-
* userSchema.plugin(mongofirePlugin, { collection: 'users', ownerField: 'userId' });
|
|
336
|
-
*
|
|
337
|
-
* @example
|
|
338
|
-
* // Or use the factory helper (matches instance.plugin() return shape):
|
|
339
|
-
* import { factory } from 'mongofire/plugin';
|
|
340
|
-
* userSchema.plugin(factory('users', { ownerField: 'userId' }));
|
|
341
|
-
*/
|
|
342
|
-
export declare function mongofirePlugin(schema: import('mongoose').Schema, options?: PluginOptions & { collection?: string }): void;
|
|
343
|
-
export declare namespace mongofirePlugin {
|
|
344
|
-
function factory(collectionName: string, options?: PluginOptions): (schema: import('mongoose').Schema) => void;
|
|
345
|
-
}
|
|
173
|
+
export declare function mongofirePlugin(schema: import('mongoose').Schema, options?: PluginOptions & {collection?: string}): void;
|
|
174
|
+
export declare namespace mongofirePlugin { function factory(collectionName: string, options?: PluginOptions): (schema: import('mongoose').Schema) => void; }
|
|
346
175
|
|
|
347
176
|
// ─── Default export ───────────────────────────────────────────────────────────
|
|
348
|
-
|
|
349
|
-
/** The default MongoFire singleton instance. */
|
|
350
|
-
declare const mongofire: MongoFire & { MongoFire: typeof MongoFire };
|
|
177
|
+
declare const mongofire: MongoFire & { MongoFire: typeof MongoFire; schemaManager: SchemaManager; };
|
|
351
178
|
export default mongofire;
|
package/index.cjs
CHANGED
package/index.mjs
CHANGED