diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e382d55738..8692bd75e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ -### 16.0.0-beta.5 (3 December 2024) +### 16.0.0-beta.6 (4 December 2024) 🚀 **RxDB v16 is released** diff --git a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js index 4deaa0885a0..be5f5b70269 100644 --- a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js +++ b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js @@ -22,7 +22,7 @@ async function addDevModeTrackingIframe(db) { } // do not show if premium flag is set. - if (_index.RXDB_UTILS_GLOBAL.premium && typeof _index.RXDB_UTILS_GLOBAL.premium === 'string' && (await (0, _index.defaultHashSha256)(_index.RXDB_UTILS_GLOBAL.premium)) === _index.PREMIUM_FLAG_HASH) { + if (await (0, _index.hasPremiumFlag)()) { return; } iframeShown = true; diff --git a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map index 9f1e2df4136..14fb3a2ffba 100644 --- a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map +++ b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map @@ -1 +1 @@ -{"version":3,"file":"dev-mode-tracking.js","names":["_index","require","iframeShown","addDevModeTrackingIframe","db","window","location","RXDB_UTILS_GLOBAL","premium","defaultHashSha256","PREMIUM_FLAG_HASH","iframe","document","createElement","style","visibility","width","height","position","top","left","opacity","src","RXDB_VERSION","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n /**\n * Do not use display:none\n * @link https://medium.com/@zachcaceres/dont-use-display-none-to-hide-iframes-in-safari-b51715eb22c4\n */\n iframe.style.visibility = 'hidden';\n iframe.width = '1px';\n iframe.height = '1px';\n iframe.style.position = 'absolute';\n iframe.style.top = '0';\n iframe.style.left = '0';\n iframe.style.opacity = '0.1';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IACIC,wBAAiB,CAACC,OAAO,IACzB,OAAOD,wBAAiB,CAACC,OAAO,KAAK,QAAQ,IAC5C,OAAM,IAAAC,wBAAiB,EAACF,wBAAiB,CAACC,OAAO,CAAC,MAAKE,wBAAkB,EAC5E;IACE;EACJ;EAEAR,WAAW,GAAG,IAAI;EAElB,IAAMS,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/C;AACJ;AACA;AACA;EACIF,MAAM,CAACG,KAAK,CAACC,UAAU,GAAG,QAAQ;EAClCJ,MAAM,CAACK,KAAK,GAAG,KAAK;EACpBL,MAAM,CAACM,MAAM,GAAG,KAAK;EACrBN,MAAM,CAACG,KAAK,CAACI,QAAQ,GAAG,UAAU;EAClCP,MAAM,CAACG,KAAK,CAACK,GAAG,GAAG,GAAG;EACtBR,MAAM,CAACG,KAAK,CAACM,IAAI,GAAG,GAAG;EACvBT,MAAM,CAACG,KAAK,CAACO,OAAO,GAAG,KAAK;EAC5BV,MAAM,CAACW,GAAG,GAAG,sDAAsD,GAAGC,mBAAY;EAClFX,QAAQ,CAACY,IAAI,CAACC,WAAW,CAACd,MAAM,CAAC;AACrC;AAGA,SAASe,WAAWA,CAAA,EAAG;EACnB,OACIpB,QAAQ,CAACqB,QAAQ,KAAK,WAAW,IACjCrB,QAAQ,CAACqB,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvCtB,QAAQ,CAACqB,QAAQ,KAAK,WAAW,IACjCrB,QAAQ,CAACqB,QAAQ,KAAK,SAAS,IAC/BrB,QAAQ,CAACqB,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"dev-mode-tracking.js","names":["_index","require","iframeShown","addDevModeTrackingIframe","db","window","location","hasPremiumFlag","iframe","document","createElement","style","visibility","width","height","position","top","left","opacity","src","RXDB_VERSION","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n RXDB_VERSION,\n hasPremiumFlag\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (await hasPremiumFlag()) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n /**\n * Do not use display:none\n * @link https://medium.com/@zachcaceres/dont-use-display-none-to-hide-iframes-in-safari-b51715eb22c4\n */\n iframe.style.visibility = 'hidden';\n iframe.width = '1px';\n iframe.height = '1px';\n iframe.style.position = 'absolute';\n iframe.style.top = '0';\n iframe.style.left = '0';\n iframe.style.opacity = '0.1';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IAAI,MAAM,IAAAC,qBAAc,EAAC,CAAC,EAAE;IACxB;EACJ;EAEAL,WAAW,GAAG,IAAI;EAElB,IAAMM,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/C;AACJ;AACA;AACA;EACIF,MAAM,CAACG,KAAK,CAACC,UAAU,GAAG,QAAQ;EAClCJ,MAAM,CAACK,KAAK,GAAG,KAAK;EACpBL,MAAM,CAACM,MAAM,GAAG,KAAK;EACrBN,MAAM,CAACG,KAAK,CAACI,QAAQ,GAAG,UAAU;EAClCP,MAAM,CAACG,KAAK,CAACK,GAAG,GAAG,GAAG;EACtBR,MAAM,CAACG,KAAK,CAACM,IAAI,GAAG,GAAG;EACvBT,MAAM,CAACG,KAAK,CAACO,OAAO,GAAG,KAAK;EAC5BV,MAAM,CAACW,GAAG,GAAG,sDAAsD,GAAGC,mBAAY;EAClFX,QAAQ,CAACY,IAAI,CAACC,WAAW,CAACd,MAAM,CAAC;AACrC;AAGA,SAASe,WAAWA,CAAA,EAAG;EACnB,OACIjB,QAAQ,CAACkB,QAAQ,KAAK,WAAW,IACjClB,QAAQ,CAACkB,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvCnB,QAAQ,CAACkB,QAAQ,KAAK,WAAW,IACjClB,QAAQ,CAACkB,QAAQ,KAAK,SAAS,IAC/BlB,QAAQ,CAACkB,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/dev-mode/error-messages.js b/dist/cjs/plugins/dev-mode/error-messages.js index cd43112c3f4..0b1b55a92ac 100644 --- a/dist/cjs/plugins/dev-mode/error-messages.js +++ b/dist/cjs/plugins/dev-mode/error-messages.js @@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ERROR_MESSAGES = void 0; +var _utilsPremium = require("../utils/utils-premium.js"); /** * this plugin adds the error-messages * without it, only error-codes will be shown @@ -96,6 +97,7 @@ var ERROR_MESSAGES = exports.ERROR_MESSAGES = { COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab', CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision', COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key', + COL23: 'In the open-source version of RxDB, the amount of collections that can exist in parallel is limited to ' + _utilsPremium.NON_PREMIUM_COLLECTION_LIMIT + '. If you already purchased the premium access, you can remove this limit: https://rxdb.info/rx-collection.html#faq', // rx-document.js DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed', DOC2: 'cannot observe primary path', diff --git a/dist/cjs/plugins/dev-mode/error-messages.js.map b/dist/cjs/plugins/dev-mode/error-messages.js.map index 0b6286e8f51..ab6d97dfe0d 100644 --- a/dist/cjs/plugins/dev-mode/error-messages.js.map +++ b/dist/cjs/plugins/dev-mode/error-messages.js.map @@ -1 +1 @@ -{"version":3,"file":"error-messages.js","names":["ERROR_MESSAGES","exports","UT1","UT2","UT3","UT4","UT5","UT6","UT7","PL1","PL3","P2","QU1","QU4","QU5","QU6","QU9","QU10","QU11","QU12","QU13","QU14","QU15","QU16","QU17","QU18","MQ1","MQ2","MQ3","MQ4","MQ5","MQ6","MQ7","MQ8","DB1","DB2","DB3","DB4","DB5","DB6","DB8","DB9","DB11","DB12","DB13","DB14","COL1","COL2","COL3","COL4","COL5","COL6","COL7","COL8","COL9","COL10","COL11","COL12","COL13","COL14","COL15","COL16","COL17","COL18","COL20","COL21","CONFLICT","COL22","DOC1","DOC2","DOC3","DOC4","DOC5","DOC6","DOC7","DOC8","DOC9","DOC10","DOC11","DOC13","DOC14","DOC15","DOC16","DOC17","DOC18","DOC19","DOC20","DOC21","DOC22","DOC23","DOC24","DM1","DM2","DM3","DM4","DM5","AT1","EN1","EN2","EN3","EN4","JD1","JD2","JD3","LD1","LD2","LD3","LD4","LD5","LD6","LD7","LD8","RC1","RC2","RC4","RC5","RC6","RC7","RC_PULL","RC_STREAM","RC_PUSH","RC_PUSH_NO_AR","RC_WEBRTC_PEER","RC_COUCHDB_1","RC_COUCHDB_2","RC_OUTDATED","RC_UNAUTHORIZED","RC_FORBIDDEN","SC1","SC2","SC3","SC4","SC6","SC7","SC8","SC10","SC11","SC13","SC14","SC15","SC16","SC17","SC18","SC19","SC20","SC21","SC22","SC23","SC24","SC25","SC26","SC28","SC29","SC30","SC32","SC33","SC34","SC35","SC36","SC37","SC38","SC39","SC40","SC41","DVM1","VD1","VD2","S1","GQL1","GQL3","CRDT1","CRDT2","CRDT3","DXE1","SNH"],"sources":["../../../../src/plugins/dev-mode/error-messages.ts"],"sourcesContent":["/**\n * this plugin adds the error-messages\n * without it, only error-codes will be shown\n * This is mainly because error-string are hard to compress and we need a smaller build\n */\n\n\nexport const ERROR_MESSAGES = {\n // util.js / config\n UT1: 'given name is no string or empty',\n UT2: `collection- and database-names must match the regex to be compatible with couchdb databases.\n See https://neighbourhood.ie/blog/2020/10/13/everything-you-need-to-know-about-couchdb-database-names/\n info: if your database-name specifies a folder, the name must contain the slash-char '/' or '\\\\'`,\n UT3: 'replication-direction must either be push or pull or both. But not none',\n UT4: 'given leveldown is no valid adapter',\n UT5: 'keyCompression is set to true in the schema but no key-compression handler is used in the storage',\n UT6: 'schema contains encrypted fields but no encryption handler is used in the storage',\n UT7: 'attachments.compression is enabled but no attachment-compression plugin is used',\n\n // plugins\n PL1: 'Given plugin is not RxDB plugin.',\n // removed in 14.0.0 - PouchDB RxStorage was removed - PL2: 'You tried importing a RxDB plugin to pouchdb. Use addRxPlugin() instead.',\n PL3: 'A plugin with the same name was already added but it was not the exact same JavaScript object',\n\n // pouch-db.js\n // removed in 12.0.0 - P1: 'PouchDB.getBatch: limit must be > 2',\n P2: 'bulkWrite() cannot be called with an empty array',\n // removed in 12.0.0 - P3: 'bulkAddRevisions cannot be called with an empty array',\n\n // rx-query\n QU1: 'RxQuery._execOverDatabase(): op not known',\n // removed in 9.0.0 - QU2: 'limit() must get a number',\n // removed in 9.0.0 - QU3: 'skip() must get a number',\n QU4: 'RxQuery.regex(): You cannot use .regex() on the primary field',\n QU5: 'RxQuery.sort(): does not work because key is not defined in the schema',\n QU6: 'RxQuery.limit(): cannot be called on .findOne()',\n // removed in 12.0.0 (should by ensured by the typings) - QU7: 'query must be an object',\n // removed in 12.0.0 (should by ensured by the typings) - QU8: 'query cannot be an array',\n QU9: 'throwIfMissing can only be used in findOne queries',\n QU10: 'result empty and throwIfMissing: true',\n QU11: 'RxQuery: no valid query params given',\n QU12: 'Given index is not in schema',\n QU13: 'A top level field of the query is not included in the schema',\n QU14: 'Running a count() query in slow mode is now allowed. Either run a count() query with a selector that fully matches an index ' +\n 'or set allowSlowCount=true when calling the createRxDatabase',\n QU15: 'For count queries it is not allowed to use skip or limit',\n QU16: '$regex queries must be defined by a string, not an RegExp instance. ' +\n 'This is because RegExp objects cannot be JSON stringified and also they are mutable which would be dangerous',\n QU17: 'Chained queries cannot be used on findByIds() RxQuery instances',\n QU18: 'Malformated query result data. This likely happens because you create a OPFS-storage RxDatabase inside of a worker but did not set the usesRxDatabaseInWorker setting. https://rxdb.info/rx-storage-opfs.html#setting-usesrxdatabaseinworker-when-a-rxdatabase-is-also-used-inside-of-the-worker ',\n\n // mquery.js\n MQ1: 'path must be a string or object',\n MQ2: 'Invalid argument',\n MQ3: 'Invalid sort() argument. Must be a string, object, or array',\n MQ4: 'Invalid argument. Expected instanceof mquery or plain object',\n MQ5: 'method must be used after where() when called with these arguments',\n MQ6: 'Can\\'t mix sort syntaxes. Use either array or object | .sort([[\\'field\\', 1], [\\'test\\', -1]]) | .sort({ field: 1, test: -1 })',\n MQ7: 'Invalid sort value',\n MQ8: 'Can\\'t mix sort syntaxes. Use either array or object',\n\n // rx-database\n DB1: 'RxDocument.prepare(): another instance on this adapter has a different password',\n DB2: 'RxDatabase.addCollections(): collection-names cannot start with underscore _',\n DB3: 'RxDatabase.addCollections(): collection already exists. use myDatabase[collectionName] to get it',\n DB4: 'RxDatabase.addCollections(): schema is missing',\n DB5: 'RxDatabase.addCollections(): collection-name not allowed',\n DB6: 'RxDatabase.addCollections(): another instance created this collection with a different schema. Read this https://rxdb.info/questions-answers.html?console=qa#cant-change-the-schema ',\n // removed in 13.0.0 (now part of the encryption plugin) DB7: 'RxDatabase.addCollections(): schema encrypted but no password given',\n DB8: 'createRxDatabase(): A RxDatabase with the same name and adapter already exists.\\n' +\n 'Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional-\\n' +\n 'This often happens in react projects with hot reload that reloads the code without reloading the process.',\n DB9: 'ignoreDuplicate is only allowed in dev-mode and must never be used in production',\n // removed in 14.0.0 - PouchDB RxStorage is removed - DB9: 'createRxDatabase(): Adapter not added. Use addPouchPlugin(require(\\'pouchdb-adapter-[adaptername]\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed DB10: 'createRxDatabase(): To use leveldown-adapters, you have to add the leveldb-plugin. Use addPouchPlugin(require(\\'pouchdb-adapter-leveldb\\'));',\n DB11: 'createRxDatabase(): Invalid db-name, folder-paths must not have an ending slash',\n DB12: 'RxDatabase.addCollections(): could not write to internal store',\n DB13: 'createRxDatabase(): Invalid db-name or collection name, name contains the dollar sign',\n DB14: 'no custom reactivity factory added on database creation',\n\n // rx-collection\n COL1: 'RxDocument.insert() You cannot insert an existing document',\n COL2: 'RxCollection.insert() fieldName ._id can only be used as primaryKey',\n COL3: 'RxCollection.upsert() does not work without primary',\n COL4: 'RxCollection.incrementalUpsert() does not work without primary',\n COL5: 'RxCollection.find() if you want to search by _id, use .findOne(_id)',\n COL6: 'RxCollection.findOne() needs a queryObject or string. Notice that in RxDB, primary keys must be strings and cannot be numbers.',\n COL7: 'hook must be a function',\n COL8: 'hooks-when not known',\n COL9: 'RxCollection.addHook() hook-name not known',\n COL10: 'RxCollection .postCreate-hooks cannot be async',\n COL11: 'migrationStrategies must be an object',\n COL12: 'A migrationStrategy is missing or too much',\n COL13: 'migrationStrategy must be a function',\n COL14: 'given static method-name is not a string',\n COL15: 'static method-names cannot start with underscore _',\n COL16: 'given static method is not a function',\n COL17: 'RxCollection.ORM: statics-name not allowed',\n COL18: 'collection-method not allowed because fieldname is in the schema',\n // removed in 14.0.0, use CONFLICT instead - COL19: 'Document update conflict. When changing a document you must work on the previous revision',\n COL20: 'Storage write error',\n COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab',\n CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision',\n COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key',\n\n // rx-document.js\n DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n DOC2: 'cannot observe primary path',\n DOC3: 'final fields cannot be observed',\n DOC4: 'RxDocument.get$ cannot observe a non-existed field',\n DOC5: 'RxDocument.populate() cannot populate a non-existed field',\n DOC6: 'RxDocument.populate() cannot populate because path has no ref',\n DOC7: 'RxDocument.populate() ref-collection not in database',\n DOC8: 'RxDocument.set(): primary-key cannot be modified',\n DOC9: 'final fields cannot be modified',\n DOC10: 'RxDocument.set(): cannot set childpath when rootPath not selected',\n DOC11: 'RxDocument.save(): can\\'t save deleted document',\n // removed in 10.0.0 DOC12: 'RxDocument.save(): error',\n DOC13: 'RxDocument.remove(): Document is already deleted',\n DOC14: 'RxDocument.close() does not exist',\n DOC15: 'query cannot be an array',\n DOC16: 'Since version 8.0.0 RxDocument.set() can only be called on temporary RxDocuments',\n DOC17: 'Since version 8.0.0 RxDocument.save() can only be called on non-temporary documents',\n DOC18: 'Document property for composed primary key is missing',\n DOC19: 'Value of primary key(s) cannot be changed',\n DOC20: 'PrimaryKey missing',\n DOC21: 'PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace',\n DOC22: 'PrimaryKey must not contain a linebreak',\n DOC23: 'PrimaryKey must not contain a double-quote [\"]',\n DOC24: 'Given document data could not be structured cloned. This happens if you pass non-plain-json data into it, like a Date() object or a Function. ' +\n 'In vue.js this happens if you use ref() on the document data which transforms it into a Proxy object.',\n\n // data-migrator.js\n DM1: 'migrate() Migration has already run',\n DM2: 'migration of document failed final document does not match final schema',\n DM3: 'migration already running',\n DM4: 'Migration errored',\n DM5: 'Cannot open database state with newer RxDB version. You have to migrate your database state first. See https://rxdb.info/migration-storage.html?console=storage ',\n\n // plugins/attachments.js\n AT1: 'to use attachments, please define this in your schema',\n\n // plugins/encryption-crypto-js.js\n EN1: 'password is not valid',\n EN2: 'validatePassword: min-length of password not complied',\n EN3: 'Schema contains encrypted properties but no password is given',\n EN4: 'Password not valid',\n\n // plugins/json-dump.js\n JD1: 'You must create the collections before you can import their data',\n JD2: 'RxCollection.importJSON(): the imported json relies on a different schema',\n JD3: 'RxCollection.importJSON(): json.passwordHash does not match the own',\n\n // plugins/leader-election.js\n\n // plugins/local-documents.js\n LD1: 'RxDocument.allAttachments$ can\\'t use attachments on local documents',\n LD2: 'RxDocument.get(): objPath must be a string',\n LD3: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n LD4: 'cannot observe primary path',\n LD5: 'RxDocument.set() id cannot be modified',\n LD6: 'LocalDocument: Function is not usable on local documents',\n LD7: 'Local document already exists',\n LD8: 'localDocuments not activated. Set localDocuments=true on creation, when you want to store local documents on the RxDatabase or RxCollection.',\n\n // plugins/replication.js\n RC1: 'Replication: already added',\n RC2: 'replicateCouchDB() query must be from the same RxCollection',\n // removed in 14.0.0 - PouchDB RxStorage is removed RC3: 'RxCollection.syncCouchDB() Do not use a collection\\'s pouchdb as remote, use the collection instead',\n RC4: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication when live: true',\n RC5: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication if multiInstance because the replication might run on another instance',\n RC6: 'syncFirestore() serverTimestampField MUST NOT be part of the collections schema and MUST NOT be nested.',\n RC7: 'SimplePeer requires to have process.nextTick() polyfilled, see https://rxdb.info/replication-webrtc.html?console=webrtc ',\n RC_PULL: 'RxReplication pull handler threw an error - see .errors for more details',\n RC_STREAM: 'RxReplication pull stream$ threw an error - see .errors for more details',\n RC_PUSH: 'RxReplication push handler threw an error - see .errors for more details',\n RC_PUSH_NO_AR: 'RxReplication push handler did not return an array with the conflicts',\n RC_WEBRTC_PEER: 'RxReplication WebRTC Peer has error',\n RC_COUCHDB_1: 'replicateCouchDB() url must end with a slash like \\'https://example.com/mydatabase/\\'',\n RC_COUCHDB_2: 'replicateCouchDB() did not get valid result with rows.',\n RC_OUTDATED: 'Outdated client, update required. Replication was canceled',\n RC_UNAUTHORIZED: 'Unauthorized client, update the replicationState.headers to set correct auth data',\n RC_FORBIDDEN: 'Client behaves wrong so the replication was canceled. Mostly happens if the client tries to write data that it is not allowed to',\n\n // plugins/dev-mode/check-schema.js\n SC1: 'fieldnames do not match the regex',\n SC2: 'SchemaCheck: name \\'item\\' reserved for array-fields',\n SC3: 'SchemaCheck: fieldname has a ref-array but items-type is not string',\n SC4: 'SchemaCheck: fieldname has a ref but is not type string, [string,null] or array',\n SC6: 'SchemaCheck: primary can only be defined at top-level',\n SC7: 'SchemaCheck: default-values can only be defined at top-level',\n SC8: 'SchemaCheck: first level-fields cannot start with underscore _',\n SC10: 'SchemaCheck: schema defines ._rev, this will be done automatically',\n SC11: 'SchemaCheck: schema needs a number >=0 as version',\n // removed in 10.0.0 - SC12: 'SchemaCheck: primary can only be defined once',\n SC13: 'SchemaCheck: primary is always index, do not declare it as index',\n SC14: 'SchemaCheck: primary is always unique, do not declare it as index',\n SC15: 'SchemaCheck: primary cannot be encrypted',\n SC16: 'SchemaCheck: primary must have type: string',\n SC17: 'SchemaCheck: top-level fieldname is not allowed',\n SC18: 'SchemaCheck: indexes must be an array',\n SC19: 'SchemaCheck: indexes must contain strings or arrays of strings',\n SC20: 'SchemaCheck: indexes.array must contain strings',\n SC21: 'SchemaCheck: given index is not defined in schema',\n SC22: 'SchemaCheck: given indexKey is not type:string',\n SC23: 'SchemaCheck: fieldname is not allowed',\n SC24: 'SchemaCheck: required fields must be set via array. See https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required',\n SC25: 'SchemaCheck: compoundIndexes needs to be specified in the indexes field',\n SC26: 'SchemaCheck: indexes needs to be specified at collection schema level',\n // removed in 16.0.0 - SC27: 'SchemaCheck: encrypted fields need to be specified at collection schema level',\n SC28: 'SchemaCheck: encrypted fields is not defined in the schema',\n SC29: 'SchemaCheck: missing object key \\'properties\\'',\n SC30: 'SchemaCheck: primaryKey is required',\n SC32: 'SchemaCheck: primary field must have the type string/number/integer',\n SC33: 'SchemaCheck: used primary key is not a property in the schema',\n SC34: 'Fields of type string that are used in an index, must have set the maxLength attribute in the schema',\n SC35: 'Fields of type number/integer that are used in an index, must have set the multipleOf attribute in the schema',\n SC36: 'A field of this type cannot be used as index',\n SC37: 'Fields of type number that are used in an index, must have set the minimum and maximum attribute in the schema',\n SC38: 'Fields of type boolean that are used in an index, must be required in the schema',\n SC39: 'The primary key must have the maxLength attribute set',\n SC40: '$ref fields in the schema are not allowed. RxDB cannot resolve related schemas because it would have a negative performance impact.' +\n 'It would have to run http requests on runtime. $ref fields should be resolved during build time.',\n SC41: 'minimum, maximum and maxLength values for indexes must be real numbers, not Infinity or -Infinity',\n\n // plugins/dev-mode\n // removed in 13.9.0, use PL3 instead - DEV1: 'dev-mode added multiple times',\n DVM1: 'When dev-mode is enabled, your storage must use one of the schema validators at the top level. This is because most problems people have with RxDB is because they store data that is not valid to the schema which causes strange bugs and problems.',\n\n // plugins/validate.js\n VD1: 'Sub-schema not found, does the schemaPath exists in your schema?',\n VD2: 'object does not match schema',\n\n // plugins/in-memory.js\n // removed in 14.0.0 - PouchDB RxStorage is removed IM1: 'InMemory: Memory-Adapter must be added. Use addPouchPlugin(require(\\'pouchdb-adapter-memory\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed IM2: 'inMemoryCollection.sync(): Do not replicate with the in-memory instance. Replicate with the parent instead',\n\n // plugins/server.js\n S1: 'You cannot create collections after calling RxDatabase.server()',\n\n // plugins/replication-graphql.js\n GQL1: 'GraphQL replication: cannot find sub schema by key',\n // removed in 13.0.0, use RC_PULL instead - GQL2: 'GraphQL replication: unknown errors occurred in replication pull - see innerErrors for more details',\n GQL3: 'GraphQL replication: pull returns more documents then batchSize',\n // removed in 13.0.0, use RC_PUSH instead - GQL4: 'GraphQL replication: unknown errors occurred in replication push - see innerErrors for more details',\n\n // plugins/crdt/\n CRDT1: 'CRDT operations cannot be used because the crdt options are not set in the schema.',\n CRDT2: 'RxDocument.incrementalModify() cannot be used when CRDTs are activated.',\n CRDT3: 'To use CRDTs you MUST NOT set a conflictHandler because the default CRDT conflict handler must be used',\n\n // plugins/storage-dexie/\n DXE1: 'non-required index fields are not possible with the dexie.js RxStorage: https://github.com/pubkey/rxdb/pull/6643#issuecomment-2505310082',\n // removed in 15.0.0, added boolean index support to dexie storage - DXE1: 'The dexie.js RxStorage does not support boolean indexes, see https://rxdb.info/rx-storage-dexie.html#boolean-index',\n\n /**\n * Should never be thrown, use this for\n * null checks etc. so you do not have to increase the\n * build size with error message strings.\n */\n SNH: 'This should never happen'\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAGO,IAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1B;EACAE,GAAG,EAAE,kCAAkC;EACvCC,GAAG,kTAE8F;EACjGC,GAAG,EAAE,yEAAyE;EAC9EC,GAAG,EAAE,qCAAqC;EAC1CC,GAAG,EAAE,mGAAmG;EACxGC,GAAG,EAAE,mFAAmF;EACxFC,GAAG,EAAE,iFAAiF;EAEtF;EACAC,GAAG,EAAE,kCAAkC;EACvC;EACAC,GAAG,EAAE,+FAA+F;EAEpG;EACA;EACAC,EAAE,EAAE,kDAAkD;EACtD;;EAEA;EACAC,GAAG,EAAE,2CAA2C;EAChD;EACA;EACAC,GAAG,EAAE,+DAA+D;EACpEC,GAAG,EAAE,wEAAwE;EAC7EC,GAAG,EAAE,iDAAiD;EACtD;EACA;EACAC,GAAG,EAAE,oDAAoD;EACzDC,IAAI,EAAE,uCAAuC;EAC7CC,IAAI,EAAE,sCAAsC;EAC5CC,IAAI,EAAE,8BAA8B;EACpCC,IAAI,EAAE,8DAA8D;EACpEC,IAAI,EAAE,8HAA8H,GAChI,8DAA8D;EAClEC,IAAI,EAAE,0DAA0D;EAChEC,IAAI,EAAE,sEAAsE,GACxE,8GAA8G;EAClHC,IAAI,EAAE,iEAAiE;EACvEC,IAAI,EAAE,mSAAmS;EAEzS;EACAC,GAAG,EAAE,iCAAiC;EACtCC,GAAG,EAAE,kBA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qC;EAC3CC,IAAI,EAAE,qEAAqE;EAC3EC,IAAI,EAAE,+DAA+D;EACrEC,IAAI,EAAE,sGAAsG;EAC5GC,IAAI,EAAE,+GAA+G;EACrHC,IAAI,EAAE,8CAA8C;EACpDC,IAAI,EAAE,gHAAgH;EACtHC,IAAI,EAAE,kFAAkF;EACxFC,IAAI,EAAE,uDAAuD;EAC7DC,IAAI,EAAE,qIAAqI,GACvI,kGAAkG;EACtGC,IAAI,EAAE,mGAAmG;EAEzG;EACA;EACAC,IAAI,EAAE,uPAAuP;EAE7P;EACAC,GAAG,EAAE,kEAAkE;EACvEC,GAAG,EAAE,8BAA8B;EAEnC;EACA;EACA;;EAEA;EACAC,EAAE,EAAE,iEAAiE;EAErE;EACAC,IAAI,EAAE,oDAAoD;EAC1D;EACAC,IAAI,EAAE,iEAAiE;EACvE;;EAEA;EACAC,KAAK,EAAE,oFAAoF;EAC3FC,KAAK,EAAE,yEAAyE;EAChFC,KAAK,EAAE,wGAAwG;EAE/G;EACAC,IAAI,EAAE,0IAA0I;EAChJ;;EAEA;AACJ;AACA;AACA;AACA;EACIC,GAAG,EAAE;AACT,CAAC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"error-messages.js","names":["_utilsPremium","require","ERROR_MESSAGES","exports","UT1","UT2","UT3","UT4","UT5","UT6","UT7","PL1","PL3","P2","QU1","QU4","QU5","QU6","QU9","QU10","QU11","QU12","QU13","QU14","QU15","QU16","QU17","QU18","MQ1","MQ2","MQ3","MQ4","MQ5","MQ6","MQ7","MQ8","DB1","DB2","DB3","DB4","DB5","DB6","DB8","DB9","DB11","DB12","DB13","DB14","COL1","COL2","COL3","COL4","COL5","COL6","COL7","COL8","COL9","COL10","COL11","COL12","COL13","COL14","COL15","COL16","COL17","COL18","COL20","COL21","CONFLICT","COL22","COL23","NON_PREMIUM_COLLECTION_LIMIT","DOC1","DOC2","DOC3","DOC4","DOC5","DOC6","DOC7","DOC8","DOC9","DOC10","DOC11","DOC13","DOC14","DOC15","DOC16","DOC17","DOC18","DOC19","DOC20","DOC21","DOC22","DOC23","DOC24","DM1","DM2","DM3","DM4","DM5","AT1","EN1","EN2","EN3","EN4","JD1","JD2","JD3","LD1","LD2","LD3","LD4","LD5","LD6","LD7","LD8","RC1","RC2","RC4","RC5","RC6","RC7","RC_PULL","RC_STREAM","RC_PUSH","RC_PUSH_NO_AR","RC_WEBRTC_PEER","RC_COUCHDB_1","RC_COUCHDB_2","RC_OUTDATED","RC_UNAUTHORIZED","RC_FORBIDDEN","SC1","SC2","SC3","SC4","SC6","SC7","SC8","SC10","SC11","SC13","SC14","SC15","SC16","SC17","SC18","SC19","SC20","SC21","SC22","SC23","SC24","SC25","SC26","SC28","SC29","SC30","SC32","SC33","SC34","SC35","SC36","SC37","SC38","SC39","SC40","SC41","DVM1","VD1","VD2","S1","GQL1","GQL3","CRDT1","CRDT2","CRDT3","DXE1","SNH"],"sources":["../../../../src/plugins/dev-mode/error-messages.ts"],"sourcesContent":["/**\n * this plugin adds the error-messages\n * without it, only error-codes will be shown\n * This is mainly because error-string are hard to compress and we need a smaller build\n */\n\nimport { NON_PREMIUM_COLLECTION_LIMIT } from '../utils/utils-premium.ts';\n\n\nexport const ERROR_MESSAGES = {\n // util.js / config\n UT1: 'given name is no string or empty',\n UT2: `collection- and database-names must match the regex to be compatible with couchdb databases.\n See https://neighbourhood.ie/blog/2020/10/13/everything-you-need-to-know-about-couchdb-database-names/\n info: if your database-name specifies a folder, the name must contain the slash-char '/' or '\\\\'`,\n UT3: 'replication-direction must either be push or pull or both. But not none',\n UT4: 'given leveldown is no valid adapter',\n UT5: 'keyCompression is set to true in the schema but no key-compression handler is used in the storage',\n UT6: 'schema contains encrypted fields but no encryption handler is used in the storage',\n UT7: 'attachments.compression is enabled but no attachment-compression plugin is used',\n\n // plugins\n PL1: 'Given plugin is not RxDB plugin.',\n // removed in 14.0.0 - PouchDB RxStorage was removed - PL2: 'You tried importing a RxDB plugin to pouchdb. Use addRxPlugin() instead.',\n PL3: 'A plugin with the same name was already added but it was not the exact same JavaScript object',\n\n // pouch-db.js\n // removed in 12.0.0 - P1: 'PouchDB.getBatch: limit must be > 2',\n P2: 'bulkWrite() cannot be called with an empty array',\n // removed in 12.0.0 - P3: 'bulkAddRevisions cannot be called with an empty array',\n\n // rx-query\n QU1: 'RxQuery._execOverDatabase(): op not known',\n // removed in 9.0.0 - QU2: 'limit() must get a number',\n // removed in 9.0.0 - QU3: 'skip() must get a number',\n QU4: 'RxQuery.regex(): You cannot use .regex() on the primary field',\n QU5: 'RxQuery.sort(): does not work because key is not defined in the schema',\n QU6: 'RxQuery.limit(): cannot be called on .findOne()',\n // removed in 12.0.0 (should by ensured by the typings) - QU7: 'query must be an object',\n // removed in 12.0.0 (should by ensured by the typings) - QU8: 'query cannot be an array',\n QU9: 'throwIfMissing can only be used in findOne queries',\n QU10: 'result empty and throwIfMissing: true',\n QU11: 'RxQuery: no valid query params given',\n QU12: 'Given index is not in schema',\n QU13: 'A top level field of the query is not included in the schema',\n QU14: 'Running a count() query in slow mode is now allowed. Either run a count() query with a selector that fully matches an index ' +\n 'or set allowSlowCount=true when calling the createRxDatabase',\n QU15: 'For count queries it is not allowed to use skip or limit',\n QU16: '$regex queries must be defined by a string, not an RegExp instance. ' +\n 'This is because RegExp objects cannot be JSON stringified and also they are mutable which would be dangerous',\n QU17: 'Chained queries cannot be used on findByIds() RxQuery instances',\n QU18: 'Malformated query result data. This likely happens because you create a OPFS-storage RxDatabase inside of a worker but did not set the usesRxDatabaseInWorker setting. https://rxdb.info/rx-storage-opfs.html#setting-usesrxdatabaseinworker-when-a-rxdatabase-is-also-used-inside-of-the-worker ',\n\n // mquery.js\n MQ1: 'path must be a string or object',\n MQ2: 'Invalid argument',\n MQ3: 'Invalid sort() argument. Must be a string, object, or array',\n MQ4: 'Invalid argument. Expected instanceof mquery or plain object',\n MQ5: 'method must be used after where() when called with these arguments',\n MQ6: 'Can\\'t mix sort syntaxes. Use either array or object | .sort([[\\'field\\', 1], [\\'test\\', -1]]) | .sort({ field: 1, test: -1 })',\n MQ7: 'Invalid sort value',\n MQ8: 'Can\\'t mix sort syntaxes. Use either array or object',\n\n // rx-database\n DB1: 'RxDocument.prepare(): another instance on this adapter has a different password',\n DB2: 'RxDatabase.addCollections(): collection-names cannot start with underscore _',\n DB3: 'RxDatabase.addCollections(): collection already exists. use myDatabase[collectionName] to get it',\n DB4: 'RxDatabase.addCollections(): schema is missing',\n DB5: 'RxDatabase.addCollections(): collection-name not allowed',\n DB6: 'RxDatabase.addCollections(): another instance created this collection with a different schema. Read this https://rxdb.info/questions-answers.html?console=qa#cant-change-the-schema ',\n // removed in 13.0.0 (now part of the encryption plugin) DB7: 'RxDatabase.addCollections(): schema encrypted but no password given',\n DB8: 'createRxDatabase(): A RxDatabase with the same name and adapter already exists.\\n' +\n 'Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional-\\n' +\n 'This often happens in react projects with hot reload that reloads the code without reloading the process.',\n DB9: 'ignoreDuplicate is only allowed in dev-mode and must never be used in production',\n // removed in 14.0.0 - PouchDB RxStorage is removed - DB9: 'createRxDatabase(): Adapter not added. Use addPouchPlugin(require(\\'pouchdb-adapter-[adaptername]\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed DB10: 'createRxDatabase(): To use leveldown-adapters, you have to add the leveldb-plugin. Use addPouchPlugin(require(\\'pouchdb-adapter-leveldb\\'));',\n DB11: 'createRxDatabase(): Invalid db-name, folder-paths must not have an ending slash',\n DB12: 'RxDatabase.addCollections(): could not write to internal store',\n DB13: 'createRxDatabase(): Invalid db-name or collection name, name contains the dollar sign',\n DB14: 'no custom reactivity factory added on database creation',\n\n // rx-collection\n COL1: 'RxDocument.insert() You cannot insert an existing document',\n COL2: 'RxCollection.insert() fieldName ._id can only be used as primaryKey',\n COL3: 'RxCollection.upsert() does not work without primary',\n COL4: 'RxCollection.incrementalUpsert() does not work without primary',\n COL5: 'RxCollection.find() if you want to search by _id, use .findOne(_id)',\n COL6: 'RxCollection.findOne() needs a queryObject or string. Notice that in RxDB, primary keys must be strings and cannot be numbers.',\n COL7: 'hook must be a function',\n COL8: 'hooks-when not known',\n COL9: 'RxCollection.addHook() hook-name not known',\n COL10: 'RxCollection .postCreate-hooks cannot be async',\n COL11: 'migrationStrategies must be an object',\n COL12: 'A migrationStrategy is missing or too much',\n COL13: 'migrationStrategy must be a function',\n COL14: 'given static method-name is not a string',\n COL15: 'static method-names cannot start with underscore _',\n COL16: 'given static method is not a function',\n COL17: 'RxCollection.ORM: statics-name not allowed',\n COL18: 'collection-method not allowed because fieldname is in the schema',\n // removed in 14.0.0, use CONFLICT instead - COL19: 'Document update conflict. When changing a document you must work on the previous revision',\n COL20: 'Storage write error',\n COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab',\n CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision',\n COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key',\n COL23: 'In the open-source version of RxDB, the amount of collections that can exist in parallel is limited to '+NON_PREMIUM_COLLECTION_LIMIT+'. If you already purchased the premium access, you can remove this limit: https://rxdb.info/rx-collection.html#faq',\n\n // rx-document.js\n DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n DOC2: 'cannot observe primary path',\n DOC3: 'final fields cannot be observed',\n DOC4: 'RxDocument.get$ cannot observe a non-existed field',\n DOC5: 'RxDocument.populate() cannot populate a non-existed field',\n DOC6: 'RxDocument.populate() cannot populate because path has no ref',\n DOC7: 'RxDocument.populate() ref-collection not in database',\n DOC8: 'RxDocument.set(): primary-key cannot be modified',\n DOC9: 'final fields cannot be modified',\n DOC10: 'RxDocument.set(): cannot set childpath when rootPath not selected',\n DOC11: 'RxDocument.save(): can\\'t save deleted document',\n // removed in 10.0.0 DOC12: 'RxDocument.save(): error',\n DOC13: 'RxDocument.remove(): Document is already deleted',\n DOC14: 'RxDocument.close() does not exist',\n DOC15: 'query cannot be an array',\n DOC16: 'Since version 8.0.0 RxDocument.set() can only be called on temporary RxDocuments',\n DOC17: 'Since version 8.0.0 RxDocument.save() can only be called on non-temporary documents',\n DOC18: 'Document property for composed primary key is missing',\n DOC19: 'Value of primary key(s) cannot be changed',\n DOC20: 'PrimaryKey missing',\n DOC21: 'PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace',\n DOC22: 'PrimaryKey must not contain a linebreak',\n DOC23: 'PrimaryKey must not contain a double-quote [\"]',\n DOC24: 'Given document data could not be structured cloned. This happens if you pass non-plain-json data into it, like a Date() object or a Function. ' +\n 'In vue.js this happens if you use ref() on the document data which transforms it into a Proxy object.',\n\n // data-migrator.js\n DM1: 'migrate() Migration has already run',\n DM2: 'migration of document failed final document does not match final schema',\n DM3: 'migration already running',\n DM4: 'Migration errored',\n DM5: 'Cannot open database state with newer RxDB version. You have to migrate your database state first. See https://rxdb.info/migration-storage.html?console=storage ',\n\n // plugins/attachments.js\n AT1: 'to use attachments, please define this in your schema',\n\n // plugins/encryption-crypto-js.js\n EN1: 'password is not valid',\n EN2: 'validatePassword: min-length of password not complied',\n EN3: 'Schema contains encrypted properties but no password is given',\n EN4: 'Password not valid',\n\n // plugins/json-dump.js\n JD1: 'You must create the collections before you can import their data',\n JD2: 'RxCollection.importJSON(): the imported json relies on a different schema',\n JD3: 'RxCollection.importJSON(): json.passwordHash does not match the own',\n\n // plugins/leader-election.js\n\n // plugins/local-documents.js\n LD1: 'RxDocument.allAttachments$ can\\'t use attachments on local documents',\n LD2: 'RxDocument.get(): objPath must be a string',\n LD3: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n LD4: 'cannot observe primary path',\n LD5: 'RxDocument.set() id cannot be modified',\n LD6: 'LocalDocument: Function is not usable on local documents',\n LD7: 'Local document already exists',\n LD8: 'localDocuments not activated. Set localDocuments=true on creation, when you want to store local documents on the RxDatabase or RxCollection.',\n\n // plugins/replication.js\n RC1: 'Replication: already added',\n RC2: 'replicateCouchDB() query must be from the same RxCollection',\n // removed in 14.0.0 - PouchDB RxStorage is removed RC3: 'RxCollection.syncCouchDB() Do not use a collection\\'s pouchdb as remote, use the collection instead',\n RC4: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication when live: true',\n RC5: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication if multiInstance because the replication might run on another instance',\n RC6: 'syncFirestore() serverTimestampField MUST NOT be part of the collections schema and MUST NOT be nested.',\n RC7: 'SimplePeer requires to have process.nextTick() polyfilled, see https://rxdb.info/replication-webrtc.html?console=webrtc ',\n RC_PULL: 'RxReplication pull handler threw an error - see .errors for more details',\n RC_STREAM: 'RxReplication pull stream$ threw an error - see .errors for more details',\n RC_PUSH: 'RxReplication push handler threw an error - see .errors for more details',\n RC_PUSH_NO_AR: 'RxReplication push handler did not return an array with the conflicts',\n RC_WEBRTC_PEER: 'RxReplication WebRTC Peer has error',\n RC_COUCHDB_1: 'replicateCouchDB() url must end with a slash like \\'https://example.com/mydatabase/\\'',\n RC_COUCHDB_2: 'replicateCouchDB() did not get valid result with rows.',\n RC_OUTDATED: 'Outdated client, update required. Replication was canceled',\n RC_UNAUTHORIZED: 'Unauthorized client, update the replicationState.headers to set correct auth data',\n RC_FORBIDDEN: 'Client behaves wrong so the replication was canceled. Mostly happens if the client tries to write data that it is not allowed to',\n\n // plugins/dev-mode/check-schema.js\n SC1: 'fieldnames do not match the regex',\n SC2: 'SchemaCheck: name \\'item\\' reserved for array-fields',\n SC3: 'SchemaCheck: fieldname has a ref-array but items-type is not string',\n SC4: 'SchemaCheck: fieldname has a ref but is not type string, [string,null] or array',\n SC6: 'SchemaCheck: primary can only be defined at top-level',\n SC7: 'SchemaCheck: default-values can only be defined at top-level',\n SC8: 'SchemaCheck: first level-fields cannot start with underscore _',\n SC10: 'SchemaCheck: schema defines ._rev, this will be done automatically',\n SC11: 'SchemaCheck: schema needs a number >=0 as version',\n // removed in 10.0.0 - SC12: 'SchemaCheck: primary can only be defined once',\n SC13: 'SchemaCheck: primary is always index, do not declare it as index',\n SC14: 'SchemaCheck: primary is always unique, do not declare it as index',\n SC15: 'SchemaCheck: primary cannot be encrypted',\n SC16: 'SchemaCheck: primary must have type: string',\n SC17: 'SchemaCheck: top-level fieldname is not allowed',\n SC18: 'SchemaCheck: indexes must be an array',\n SC19: 'SchemaCheck: indexes must contain strings or arrays of strings',\n SC20: 'SchemaCheck: indexes.array must contain strings',\n SC21: 'SchemaCheck: given index is not defined in schema',\n SC22: 'SchemaCheck: given indexKey is not type:string',\n SC23: 'SchemaCheck: fieldname is not allowed',\n SC24: 'SchemaCheck: required fields must be set via array. See https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required',\n SC25: 'SchemaCheck: compoundIndexes needs to be specified in the indexes field',\n SC26: 'SchemaCheck: indexes needs to be specified at collection schema level',\n // removed in 16.0.0 - SC27: 'SchemaCheck: encrypted fields need to be specified at collection schema level',\n SC28: 'SchemaCheck: encrypted fields is not defined in the schema',\n SC29: 'SchemaCheck: missing object key \\'properties\\'',\n SC30: 'SchemaCheck: primaryKey is required',\n SC32: 'SchemaCheck: primary field must have the type string/number/integer',\n SC33: 'SchemaCheck: used primary key is not a property in the schema',\n SC34: 'Fields of type string that are used in an index, must have set the maxLength attribute in the schema',\n SC35: 'Fields of type number/integer that are used in an index, must have set the multipleOf attribute in the schema',\n SC36: 'A field of this type cannot be used as index',\n SC37: 'Fields of type number that are used in an index, must have set the minimum and maximum attribute in the schema',\n SC38: 'Fields of type boolean that are used in an index, must be required in the schema',\n SC39: 'The primary key must have the maxLength attribute set',\n SC40: '$ref fields in the schema are not allowed. RxDB cannot resolve related schemas because it would have a negative performance impact.' +\n 'It would have to run http requests on runtime. $ref fields should be resolved during build time.',\n SC41: 'minimum, maximum and maxLength values for indexes must be real numbers, not Infinity or -Infinity',\n\n // plugins/dev-mode\n // removed in 13.9.0, use PL3 instead - DEV1: 'dev-mode added multiple times',\n DVM1: 'When dev-mode is enabled, your storage must use one of the schema validators at the top level. This is because most problems people have with RxDB is because they store data that is not valid to the schema which causes strange bugs and problems.',\n\n // plugins/validate.js\n VD1: 'Sub-schema not found, does the schemaPath exists in your schema?',\n VD2: 'object does not match schema',\n\n // plugins/in-memory.js\n // removed in 14.0.0 - PouchDB RxStorage is removed IM1: 'InMemory: Memory-Adapter must be added. Use addPouchPlugin(require(\\'pouchdb-adapter-memory\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed IM2: 'inMemoryCollection.sync(): Do not replicate with the in-memory instance. Replicate with the parent instead',\n\n // plugins/server.js\n S1: 'You cannot create collections after calling RxDatabase.server()',\n\n // plugins/replication-graphql.js\n GQL1: 'GraphQL replication: cannot find sub schema by key',\n // removed in 13.0.0, use RC_PULL instead - GQL2: 'GraphQL replication: unknown errors occurred in replication pull - see innerErrors for more details',\n GQL3: 'GraphQL replication: pull returns more documents then batchSize',\n // removed in 13.0.0, use RC_PUSH instead - GQL4: 'GraphQL replication: unknown errors occurred in replication push - see innerErrors for more details',\n\n // plugins/crdt/\n CRDT1: 'CRDT operations cannot be used because the crdt options are not set in the schema.',\n CRDT2: 'RxDocument.incrementalModify() cannot be used when CRDTs are activated.',\n CRDT3: 'To use CRDTs you MUST NOT set a conflictHandler because the default CRDT conflict handler must be used',\n\n // plugins/storage-dexie/\n DXE1: 'non-required index fields are not possible with the dexie.js RxStorage: https://github.com/pubkey/rxdb/pull/6643#issuecomment-2505310082',\n // removed in 15.0.0, added boolean index support to dexie storage - DXE1: 'The dexie.js RxStorage does not support boolean indexes, see https://rxdb.info/rx-storage-dexie.html#boolean-index',\n\n /**\n * Should never be thrown, use this for\n * null checks etc. so you do not have to increase the\n * build size with error message strings.\n */\n SNH: 'This should never happen'\n};\n"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAKO,IAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1B;EACAE,GAAG,EAAE,kCAAkC;EACvCC,GAAG,kTAE8F;EACjGC,GAAG,EAAE,yEAAyE;E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EAErE;EACAC,IAAI,EAAE,oDAAoD;EAC1D;EACAC,IAAI,EAAE,iEAAiE;EACvE;;EAEA;EACAC,KAAK,EAAE,oFAAoF;EAC3FC,KAAK,EAAE,yEAAyE;EAChFC,KAAK,EAAE,wGAAwG;EAE/G;EACAC,IAAI,EAAE,0IAA0I;EAChJ;;EAEA;AACJ;AACA;AACA;AACA;EACIC,GAAG,EAAE;AACT,CAAC","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js b/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js index 3d6be222d3b..3c40c893219 100644 --- a/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js +++ b/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js @@ -32,7 +32,7 @@ var RxStorageInstanceDexie = exports.RxStorageInstanceDexie = /*#__PURE__*/funct var _proto = RxStorageInstanceDexie.prototype; _proto.bulkWrite = async function bulkWrite(documentWrites, context) { ensureNotClosed(this); - if (!shownNonPremiumLog && (!_index.RXDB_UTILS_GLOBAL.premium || typeof _index.RXDB_UTILS_GLOBAL.premium !== 'string' || (await (0, _index.defaultHashSha256)(_index.RXDB_UTILS_GLOBAL.premium)) !== _index.PREMIUM_FLAG_HASH)) { + if (!shownNonPremiumLog && !(await (0, _index.hasPremiumFlag)())) { console.warn(['-------------- RxDB Open Core RxStorage -------------------------------', 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ', 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.', 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.', ' https://rxdb.info/premium?console=dexie ', 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.', '---------------------------------------------------------------------'].join('\n')); shownNonPremiumLog = true; } else { diff --git a/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map b/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map index 705544c7d99..4e283f1c877 100644 --- a/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map +++ b/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-storage-instance-dexie.js","names":["_rxjs","require","_index","_dexieHelper","_dexieQuery","_rxSchemaHelper","_rxStorageHelper","_rxStorageMultiinstance","_rxError","instanceId","now","shownNonPremiumLog","RxStorageInstanceDexie","exports","storage","databaseName","collectionName","schema","internals","options","settings","devMode","changes$","Subject","primaryPath","getPrimaryFieldOfPrimaryKey","primaryKey","_proto","prototype","bulkWrite","documentWrites","context","ensureNotClosed","RXDB_UTILS_GLOBAL","premium","defaultHashSha256","PREMIUM_FLAG_HASH","console","warn","join","forEach","row","document","_rev","previous","newRxError","args","state","ret","error","map","doc","flatCloneDocWithMeta","documentKeys","writeRow","categorized","dexieDb","transaction","dexieTable","dexieAttachmentsTable","docsInDbMap","Map","docsInDbWithInternals","getDocsInDb","docWithDexieInternals","set","categorizeBulkWriteRows","errors","bulkPutDocs","bulkInsertDocs","push","bulkUpdateDocs","d","fromStorageToDexie","booleanIndexes","length","bulkPut","putAttachments","attachmentsAdd","attachment","id","attachmentObjectId","documentId","attachmentId","data","attachmentData","attachmentsUpdate","bulkDelete","attachmentsRemove","ensureNotFalsy","eventBulk","events","lastState","newestRow","checkpoint","lwt","_meta","next","findDocumentsById","ids","deleted","docsInDb","documentInDb","_deleted","query","preparedQuery","dexieQuery","count","queryPlan","selectorSatisfiedByIndex","result","dexieCount","mode","documents","changeStream","asObservable","cleanup","minimumDeletedTime","maxDeletionTime","toRemove","where","below","toArray","removeIds","getAttachmentData","_digest","get","Error","remove","clear","close","closed","complete","closeDexieDb","createDexieStorageInstance","params","getDexieDbWithTables","instance","addRxStorageMultiInstanceSupport","RX_STORAGE_NAME_DEXIE","Promise","resolve"],"sources":["../../../../src/plugins/storage-dexie/rx-storage-instance-dexie.ts"],"sourcesContent":["import {\n Subject,\n Observable\n} from 'rxjs';\nimport {\n now,\n ensureNotFalsy,\n defaultHashSha256,\n RXDB_UTILS_GLOBAL,\n PREMIUM_FLAG_HASH\n} from '../utils/index.ts';\nimport type {\n RxStorageInstance,\n RxStorageChangeEvent,\n RxDocumentData,\n BulkWriteRow,\n RxStorageBulkWriteResponse,\n RxStorageQueryResult,\n RxJsonSchema,\n RxStorageInstanceCreationParams,\n EventBulk,\n StringKeys,\n RxStorageDefaultCheckpoint,\n CategorizeBulkWriteRowsOutput,\n RxStorageCountResult,\n PreparedQuery\n} from '../../types/index.d.ts';\nimport type {\n DexieSettings,\n DexieStorageInternals\n} from '../../types/plugins/dexie.d.ts';\nimport { RxStorageDexie } from './rx-storage-dexie.ts';\nimport {\n attachmentObjectId,\n closeDexieDb,\n fromStorageToDexie,\n getDexieDbWithTables,\n getDocsInDb,\n RX_STORAGE_NAME_DEXIE\n} from './dexie-helper.ts';\nimport { dexieCount, dexieQuery } from './dexie-query.ts';\nimport { getPrimaryFieldOfPrimaryKey } from '../../rx-schema-helper.ts';\nimport { categorizeBulkWriteRows, flatCloneDocWithMeta } from '../../rx-storage-helper.ts';\nimport { addRxStorageMultiInstanceSupport } from '../../rx-storage-multiinstance.ts';\nimport { newRxError } from '../../rx-error.ts';\n\nlet instanceId = now();\n\nlet shownNonPremiumLog = false;\n\n\nexport class RxStorageInstanceDexie implements RxStorageInstance<\n RxDocType,\n DexieStorageInternals,\n DexieSettings,\n RxStorageDefaultCheckpoint\n> {\n public readonly primaryPath: StringKeys>;\n private changes$: Subject>, RxStorageDefaultCheckpoint>> = new Subject();\n public readonly instanceId = instanceId++;\n public closed?: Promise;\n\n constructor(\n public readonly storage: RxStorageDexie,\n public readonly databaseName: string,\n public readonly collectionName: string,\n public readonly schema: Readonly>>,\n public readonly internals: DexieStorageInternals,\n public readonly options: Readonly,\n public readonly settings: DexieSettings,\n public readonly devMode: boolean\n ) {\n this.primaryPath = getPrimaryFieldOfPrimaryKey(this.schema.primaryKey);\n }\n\n async bulkWrite(\n documentWrites: BulkWriteRow[],\n context: string\n ): Promise> {\n ensureNotClosed(this);\n\n\n if (\n !shownNonPremiumLog &&\n (\n !RXDB_UTILS_GLOBAL.premium ||\n typeof RXDB_UTILS_GLOBAL.premium !== 'string' ||\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) !== PREMIUM_FLAG_HASH)\n )\n ) {\n console.warn(\n [\n '-------------- RxDB Open Core RxStorage -------------------------------',\n 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ',\n 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.',\n 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.',\n ' https://rxdb.info/premium?console=dexie ',\n 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.',\n '---------------------------------------------------------------------'\n ].join('\\n')\n );\n shownNonPremiumLog = true;\n } else {\n shownNonPremiumLog = true;\n }\n\n\n /**\n * Check some assumptions to ensure RxDB\n * does not call the storage with an invalid write.\n */\n documentWrites.forEach(row => {\n // ensure revision is set\n if (\n !row.document._rev ||\n (\n row.previous &&\n !row.previous._rev\n )\n ) {\n throw newRxError('SNH', { args: { row } });\n }\n });\n\n const state = await this.internals;\n const ret: RxStorageBulkWriteResponse = {\n error: []\n };\n\n /**\n * Some storages might add any _meta fields\n * internally. To ensure RxDB can work with that in the\n * test suite, we add a random field here.\n * To ensure \n */\n if (this.devMode) {\n documentWrites = documentWrites.map(row => {\n const doc = flatCloneDocWithMeta(row.document);\n return {\n previous: row.previous,\n document: doc\n }\n })\n }\n\n\n const documentKeys: string[] = documentWrites.map(writeRow => writeRow.document[this.primaryPath] as any);\n let categorized: CategorizeBulkWriteRowsOutput | undefined;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n state.dexieAttachmentsTable,\n async () => {\n const docsInDbMap = new Map>();\n const docsInDbWithInternals = await getDocsInDb(this.internals, documentKeys);\n docsInDbWithInternals.forEach(docWithDexieInternals => {\n const doc = docWithDexieInternals;\n if (doc) {\n docsInDbMap.set((doc as any)[this.primaryPath], doc as any);\n }\n return doc;\n });\n\n categorized = categorizeBulkWriteRows(\n this,\n this.primaryPath as any,\n docsInDbMap,\n documentWrites,\n context\n );\n ret.error = categorized.errors;\n\n /**\n * Batch up the database operations\n * so we can later run them in bulk.\n */\n let bulkPutDocs: any[] = [];\n categorized.bulkInsertDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n categorized.bulkUpdateDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n bulkPutDocs = bulkPutDocs.map(d => fromStorageToDexie(state.booleanIndexes, d));\n\n if (bulkPutDocs.length > 0) {\n await state.dexieTable.bulkPut(bulkPutDocs);\n }\n\n // handle attachments\n const putAttachments: { id: string, data: string }[] = [];\n categorized.attachmentsAdd.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n categorized.attachmentsUpdate.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n await state.dexieAttachmentsTable.bulkPut(putAttachments);\n await state.dexieAttachmentsTable.bulkDelete(\n categorized.attachmentsRemove.map(attachment => attachmentObjectId(attachment.documentId, attachment.attachmentId))\n );\n\n });\n\n categorized = ensureNotFalsy(categorized);\n if (categorized.eventBulk.events.length > 0) {\n const lastState = ensureNotFalsy(categorized.newestRow).document;\n categorized.eventBulk.checkpoint = {\n id: lastState[this.primaryPath],\n lwt: lastState._meta.lwt\n };\n this.changes$.next(categorized.eventBulk);\n }\n\n return ret;\n }\n\n async findDocumentsById(\n ids: string[],\n deleted: boolean\n ): Promise[]> {\n ensureNotClosed(this);\n const state = await this.internals;\n const ret: RxDocumentData[] = [];\n\n await state.dexieDb.transaction(\n 'r',\n state.dexieTable,\n async () => {\n const docsInDb = await getDocsInDb(this.internals, ids);\n docsInDb.forEach(documentInDb => {\n if (\n documentInDb &&\n (!documentInDb._deleted || deleted)\n ) {\n ret.push(documentInDb);\n }\n });\n });\n return ret;\n }\n\n query(preparedQuery: PreparedQuery): Promise> {\n ensureNotClosed(this);\n return dexieQuery(\n this,\n preparedQuery\n );\n }\n async count(\n preparedQuery: PreparedQuery\n ): Promise {\n if (preparedQuery.queryPlan.selectorSatisfiedByIndex) {\n const result = await dexieCount(this, preparedQuery);\n return {\n count: result,\n mode: 'fast'\n };\n } else {\n const result = await dexieQuery(this, preparedQuery);\n return {\n count: result.documents.length,\n mode: 'slow'\n };\n }\n }\n\n changeStream(): Observable>, RxStorageDefaultCheckpoint>> {\n ensureNotClosed(this);\n return this.changes$.asObservable();\n }\n\n async cleanup(minimumDeletedTime: number): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n async () => {\n const maxDeletionTime = now() - minimumDeletedTime;\n const toRemove = await state.dexieTable\n .where('_meta.lwt')\n .below(maxDeletionTime)\n .toArray();\n const removeIds: string[] = [];\n toRemove.forEach(doc => {\n if (doc._deleted === '1') {\n removeIds.push(doc[this.primaryPath]);\n }\n });\n await state.dexieTable.bulkDelete(removeIds);\n }\n );\n\n return true;\n }\n\n async getAttachmentData(documentId: string, attachmentId: string, _digest: string): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n const id = attachmentObjectId(documentId, attachmentId);\n return await state.dexieDb.transaction(\n 'r',\n state.dexieAttachmentsTable,\n async () => {\n\n const attachment = await state.dexieAttachmentsTable.get(id);\n if (attachment) {\n return attachment.data;\n } else {\n throw new Error('attachment missing documentId: ' + documentId + ' attachmentId: ' + attachmentId);\n }\n });\n }\n\n async remove(): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieTable.clear()\n return this.close();\n }\n\n\n close(): Promise {\n if (this.closed) {\n return this.closed;\n }\n this.closed = (async () => {\n this.changes$.complete();\n await closeDexieDb(this.internals);\n })();\n return this.closed;\n }\n}\n\n\nexport async function createDexieStorageInstance(\n storage: RxStorageDexie,\n params: RxStorageInstanceCreationParams,\n settings: DexieSettings\n): Promise> {\n const internals = getDexieDbWithTables(\n params.databaseName,\n params.collectionName,\n settings,\n params.schema\n );\n\n const instance = new RxStorageInstanceDexie(\n storage,\n params.databaseName,\n params.collectionName,\n params.schema,\n internals,\n params.options,\n settings,\n params.devMode\n );\n\n await addRxStorageMultiInstanceSupport(\n RX_STORAGE_NAME_DEXIE,\n params,\n instance\n );\n\n return Promise.resolve(instance);\n}\n\n\n\nfunction ensureNotClosed(\n instance: RxStorageInstanceDexie\n) {\n if (instance.closed) {\n throw new Error('RxStorageInstanceDexie is closed ' + instance.databaseName + '-' + instance.collectionName);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AA4BA,IAAAE,YAAA,GAAAF,OAAA;AAQA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAEA,IAAIQ,UAAU,GAAG,IAAAC,UAAG,EAAC,CAAC;AAEtB,IAAIC,kBAAkB,GAAG,KAAK;AAAC,IAGlBC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA;EAW/B,SAAAA,uBACoBE,OAAuB,EACvBC,YAAoB,EACpBC,cAAsB,EACtBC,MAAyD,EACzDC,SAAgC,EAChCC,OAAgC,EAChCC,QAAuB,EACvBC,OAAgB,EAClC;IAAA,KAbMC,QAAQ,GAAoG,IAAIC,aAAO,CAAC,CAAC;IAAA,KACjHd,UAAU,GAAGA,UAAU,EAAE;IAAA,KAIrBK,OAAuB,GAAvBA,OAAuB;IAAA,KACvBC,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,cAAsB,GAAtBA,cAAsB;IAAA,KACtBC,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G,GAAG0H,QAAQ,CAACzH,cAAc,CAAC;EAChH;AACJ","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"rx-storage-instance-dexie.js","names":["_rxjs","require","_index","_dexieHelper","_dexieQuery","_rxSchemaHelper","_rxStorageHelper","_rxStorageMultiinstance","_rxError","instanceId","now","shownNonPremiumLog","RxStorageInstanceDexie","exports","storage","databaseName","collectionName","schema","internals","options","settings","devMode","changes$","Subject","primaryPath","getPrimaryFieldOfPrimaryKey","primaryKey","_proto","prototype","bulkWrite","documentWrites","context","ensureNotClosed","hasPremiumFlag","console","warn","join","forEach","row","document","_rev","previous","newRxError","args","state","ret","error","map","doc","flatCloneDocWithMeta","documentKeys","writeRow","categorized","dexieDb","transaction","dexieTable","dexieAttachmentsTable","docsInDbMap","Map","docsInDbWithInternals","getDocsInDb","docWithDexieInternals","set","categorizeBulkWriteRows","errors","bulkPutDocs","bulkInsertDocs","push","bulkUpdateDocs","d","fromStorageToDexie","booleanIndexes","length","bulkPut","putAttachments","attachmentsAdd","attachment","id","attachmentObjectId","documentId","attachmentId","data","attachmentData","attachmentsUpdate","bulkDelete","attachmentsRemove","ensureNotFalsy","eventBulk","events","lastState","newestRow","checkpoint","lwt","_meta","next","findDocumentsById","ids","deleted","docsInDb","documentInDb","_deleted","query","preparedQuery","dexieQuery","count","queryPlan","selectorSatisfiedByIndex","result","dexieCount","mode","documents","changeStream","asObservable","cleanup","minimumDeletedTime","maxDeletionTime","toRemove","where","below","toArray","removeIds","getAttachmentData","_digest","get","Error","remove","clear","close","closed","complete","closeDexieDb","createDexieStorageInstance","params","getDexieDbWithTables","instance","addRxStorageMultiInstanceSupport","RX_STORAGE_NAME_DEXIE","Promise","resolve"],"sources":["../../../../src/plugins/storage-dexie/rx-storage-instance-dexie.ts"],"sourcesContent":["import {\n Subject,\n Observable\n} from 'rxjs';\nimport {\n now,\n ensureNotFalsy,\n defaultHashSha256,\n RXDB_UTILS_GLOBAL,\n PREMIUM_FLAG_HASH,\n hasPremiumFlag\n} from '../utils/index.ts';\nimport type {\n RxStorageInstance,\n RxStorageChangeEvent,\n RxDocumentData,\n BulkWriteRow,\n RxStorageBulkWriteResponse,\n RxStorageQueryResult,\n RxJsonSchema,\n RxStorageInstanceCreationParams,\n EventBulk,\n StringKeys,\n RxStorageDefaultCheckpoint,\n CategorizeBulkWriteRowsOutput,\n RxStorageCountResult,\n PreparedQuery\n} from '../../types/index.d.ts';\nimport type {\n DexieSettings,\n DexieStorageInternals\n} from '../../types/plugins/dexie.d.ts';\nimport { RxStorageDexie } from './rx-storage-dexie.ts';\nimport {\n attachmentObjectId,\n closeDexieDb,\n fromStorageToDexie,\n getDexieDbWithTables,\n getDocsInDb,\n RX_STORAGE_NAME_DEXIE\n} from './dexie-helper.ts';\nimport { dexieCount, dexieQuery } from './dexie-query.ts';\nimport { getPrimaryFieldOfPrimaryKey } from '../../rx-schema-helper.ts';\nimport { categorizeBulkWriteRows, flatCloneDocWithMeta } from '../../rx-storage-helper.ts';\nimport { addRxStorageMultiInstanceSupport } from '../../rx-storage-multiinstance.ts';\nimport { newRxError } from '../../rx-error.ts';\n\nlet instanceId = now();\n\nlet shownNonPremiumLog = false;\n\n\nexport class RxStorageInstanceDexie implements RxStorageInstance<\n RxDocType,\n DexieStorageInternals,\n DexieSettings,\n RxStorageDefaultCheckpoint\n> {\n public readonly primaryPath: StringKeys>;\n private changes$: Subject>, RxStorageDefaultCheckpoint>> = new Subject();\n public readonly instanceId = instanceId++;\n public closed?: Promise;\n\n constructor(\n public readonly storage: RxStorageDexie,\n public readonly databaseName: string,\n public readonly collectionName: string,\n public readonly schema: Readonly>>,\n public readonly internals: DexieStorageInternals,\n public readonly options: Readonly,\n public readonly settings: DexieSettings,\n public readonly devMode: boolean\n ) {\n this.primaryPath = getPrimaryFieldOfPrimaryKey(this.schema.primaryKey);\n }\n\n async bulkWrite(\n documentWrites: BulkWriteRow[],\n context: string\n ): Promise> {\n ensureNotClosed(this);\n\n\n if (\n !shownNonPremiumLog &&\n !(await hasPremiumFlag())\n ) {\n console.warn(\n [\n '-------------- RxDB Open Core RxStorage -------------------------------',\n 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ',\n 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.',\n 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.',\n ' https://rxdb.info/premium?console=dexie ',\n 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.',\n '---------------------------------------------------------------------'\n ].join('\\n')\n );\n shownNonPremiumLog = true;\n } else {\n shownNonPremiumLog = true;\n }\n\n\n /**\n * Check some assumptions to ensure RxDB\n * does not call the storage with an invalid write.\n */\n documentWrites.forEach(row => {\n // ensure revision is set\n if (\n !row.document._rev ||\n (\n row.previous &&\n !row.previous._rev\n )\n ) {\n throw newRxError('SNH', { args: { row } });\n }\n });\n\n const state = await this.internals;\n const ret: RxStorageBulkWriteResponse = {\n error: []\n };\n\n /**\n * Some storages might add any _meta fields\n * internally. To ensure RxDB can work with that in the\n * test suite, we add a random field here.\n * To ensure \n */\n if (this.devMode) {\n documentWrites = documentWrites.map(row => {\n const doc = flatCloneDocWithMeta(row.document);\n return {\n previous: row.previous,\n document: doc\n }\n })\n }\n\n\n const documentKeys: string[] = documentWrites.map(writeRow => writeRow.document[this.primaryPath] as any);\n let categorized: CategorizeBulkWriteRowsOutput | undefined;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n state.dexieAttachmentsTable,\n async () => {\n const docsInDbMap = new Map>();\n const docsInDbWithInternals = await getDocsInDb(this.internals, documentKeys);\n docsInDbWithInternals.forEach(docWithDexieInternals => {\n const doc = docWithDexieInternals;\n if (doc) {\n docsInDbMap.set((doc as any)[this.primaryPath], doc as any);\n }\n return doc;\n });\n\n categorized = categorizeBulkWriteRows(\n this,\n this.primaryPath as any,\n docsInDbMap,\n documentWrites,\n context\n );\n ret.error = categorized.errors;\n\n /**\n * Batch up the database operations\n * so we can later run them in bulk.\n */\n let bulkPutDocs: any[] = [];\n categorized.bulkInsertDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n categorized.bulkUpdateDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n bulkPutDocs = bulkPutDocs.map(d => fromStorageToDexie(state.booleanIndexes, d));\n\n if (bulkPutDocs.length > 0) {\n await state.dexieTable.bulkPut(bulkPutDocs);\n }\n\n // handle attachments\n const putAttachments: { id: string, data: string }[] = [];\n categorized.attachmentsAdd.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n categorized.attachmentsUpdate.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n await state.dexieAttachmentsTable.bulkPut(putAttachments);\n await state.dexieAttachmentsTable.bulkDelete(\n categorized.attachmentsRemove.map(attachment => attachmentObjectId(attachment.documentId, attachment.attachmentId))\n );\n\n });\n\n categorized = ensureNotFalsy(categorized);\n if (categorized.eventBulk.events.length > 0) {\n const lastState = ensureNotFalsy(categorized.newestRow).document;\n categorized.eventBulk.checkpoint = {\n id: lastState[this.primaryPath],\n lwt: lastState._meta.lwt\n };\n this.changes$.next(categorized.eventBulk);\n }\n\n return ret;\n }\n\n async findDocumentsById(\n ids: string[],\n deleted: boolean\n ): Promise[]> {\n ensureNotClosed(this);\n const state = await this.internals;\n const ret: RxDocumentData[] = [];\n\n await state.dexieDb.transaction(\n 'r',\n state.dexieTable,\n async () => {\n const docsInDb = await getDocsInDb(this.internals, ids);\n docsInDb.forEach(documentInDb => {\n if (\n documentInDb &&\n (!documentInDb._deleted || deleted)\n ) {\n ret.push(documentInDb);\n }\n });\n });\n return ret;\n }\n\n query(preparedQuery: PreparedQuery): Promise> {\n ensureNotClosed(this);\n return dexieQuery(\n this,\n preparedQuery\n );\n }\n async count(\n preparedQuery: PreparedQuery\n ): Promise {\n if (preparedQuery.queryPlan.selectorSatisfiedByIndex) {\n const result = await dexieCount(this, preparedQuery);\n return {\n count: result,\n mode: 'fast'\n };\n } else {\n const result = await dexieQuery(this, preparedQuery);\n return {\n count: result.documents.length,\n mode: 'slow'\n };\n }\n }\n\n changeStream(): Observable>, RxStorageDefaultCheckpoint>> {\n ensureNotClosed(this);\n return this.changes$.asObservable();\n }\n\n async cleanup(minimumDeletedTime: number): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n async () => {\n const maxDeletionTime = now() - minimumDeletedTime;\n const toRemove = await state.dexieTable\n .where('_meta.lwt')\n .below(maxDeletionTime)\n .toArray();\n const removeIds: string[] = [];\n toRemove.forEach(doc => {\n if (doc._deleted === '1') {\n removeIds.push(doc[this.primaryPath]);\n }\n });\n await state.dexieTable.bulkDelete(removeIds);\n }\n );\n\n return true;\n }\n\n async getAttachmentData(documentId: string, attachmentId: string, _digest: string): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n const id = attachmentObjectId(documentId, attachmentId);\n return await state.dexieDb.transaction(\n 'r',\n state.dexieAttachmentsTable,\n async () => {\n\n const attachment = await state.dexieAttachmentsTable.get(id);\n if (attachment) {\n return attachment.data;\n } else {\n throw new Error('attachment missing documentId: ' + documentId + ' attachmentId: ' + attachmentId);\n }\n });\n }\n\n async remove(): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieTable.clear()\n return this.close();\n }\n\n\n close(): Promise {\n if (this.closed) {\n return this.closed;\n }\n this.closed = (async () => {\n this.changes$.complete();\n await closeDexieDb(this.internals);\n })();\n return this.closed;\n }\n}\n\n\nexport async function createDexieStorageInstance(\n storage: RxStorageDexie,\n params: RxStorageInstanceCreationParams,\n settings: DexieSettings\n): Promise> {\n const internals = getDexieDbWithTables(\n params.databaseName,\n params.collectionName,\n settings,\n params.schema\n );\n\n const instance = new RxStorageInstanceDexie(\n storage,\n params.databaseName,\n params.collectionName,\n params.schema,\n internals,\n params.options,\n settings,\n params.devMode\n );\n\n await addRxStorageMultiInstanceSupport(\n RX_STORAGE_NAME_DEXIE,\n params,\n instance\n );\n\n return Promise.resolve(instance);\n}\n\n\n\nfunction ensureNotClosed(\n instance: RxStorageInstanceDexie\n) {\n if (instance.closed) {\n throw new Error('RxStorageInstanceDexie is closed ' + instance.databaseName + '-' + instance.collectionName);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AA6BA,IAAAE,YAAA,GAAAF,OAAA;AAQA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAEA,IAAIQ,UAAU,GAAG,IAAAC,UAAG,EAAC,CAAC;AAEtB,IAAIC,kBAAkB,GAAG,KAAK;AAAC,IAGlBC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA;EAW/B,SAAAA,uBACoBE,OAAuB,EACvBC,YAAoB,EACpBC,cAAsB,EACtBC,MAAyD,EACzDC,SAAgC,EAChCC,OAAgC,EAChCC,QAAuB,EACvBC,OAAgB,EAClC;IAAA,KAbMC,QAAQ,GAAoG,IAAIC,aAAO,CAAC,CAAC;IAAA,KACjHd,UAAU,GAAGA,UAAU,EAAE;IAAA,KAIrBK,OAAuB,GAAvBA,OAAuB;IAAA,KACvBC,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,cAAsB,GAAtBA,cAAsB;IAAA,KACtBC,MAAyD,GAAzDA,MAAyD;IAAA,KACzDC,SAAgC,GAAhCA,SAAgC;IAAA,KAChCC,OAAgC,GAAhCA,OAAgC;IAAA,KAChCC,QAAuB,GAAvBA,QAAuB;IAAA,KACvBC,OAAgB,GAAhBA,OAAgB;IAEhC,IAAI,CAACG,WAAW,GAAG,IAAAC,2CAA2B,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,CAAC,CAAC;MACxB,MAAM,IAAAC,yBAAY,EAAC,IAAI,CAAChH,SAAS,CAAC;IACtC,CAAC,EAAE,CAAC;IACJ,OAAO,IAAI,CAAC8G,MAAM;EACtB,CAAC;EAAA,OAAApH,sBAAA;AAAA;AAIE,eAAeuH,0BAA0BA,CAC5CrH,OAAuB,EACvBsH,MAAiE,EACjEhH,QAAuB,EACmB;EAC1C,IAAMF,SAAS,GAAG,IAAAmH,iCAAoB,EAClCD,MAAM,CAACrH,YAAY,EACnBqH,MAAM,CAACpH,cAAc,EACrBI,QAAQ,EACRgH,MAAM,CAACnH,MACX,CAAC;EAED,IAAMqH,QAAQ,GAAG,IAAI1H,sBAAsB,CACvCE,OAAO,EACPsH,MAAM,CAACrH,YAAY,EACnBqH,MAAM,CAACpH,cAAc,EACrBoH,MAAM,CAACnH,MAAM,EACbC,SAAS,EACTkH,MAAM,CAACjH,OAAO,EACdC,QAAQ,EACRgH,MAAM,CAAC/G,OACX,CAAC;EAED,MAAM,IAAAkH,wDAAgC,EAClCC,kCAAqB,EACrBJ,MAAM,EACNE,QACJ,CAAC;EAED,OAAOG,OAAO,CAACC,OAAO,CAACJ,QAAQ,CAAC;AACpC;AAIA,SAAStG,eAAeA,CACpBsG,QAAqC,EACvC;EACE,IAAIA,QAAQ,CAACN,MAAM,EAAE;IACjB,MAAM,IAAIJ,KAAK,CAAC,mCAAmC,GAAGU,QAAQ,CAACvH,YAAY,GAAG,GAAG,GAAGuH,QAAQ,CAACtH,cAAc,CAAC;EAChH;AACJ","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/test-utils/schema-objects.js b/dist/cjs/plugins/test-utils/schema-objects.js index fa656397102..790512b9e35 100644 --- a/dist/cjs/plugins/test-utils/schema-objects.js +++ b/dist/cjs/plugins/test-utils/schema-objects.js @@ -263,7 +263,7 @@ function humanWithTimestampData(givenData = {}) { var averageSchemaForFieldLength = schemas.averageSchema(); function averageSchemaData(partial = {}) { return Object.assign({}, { - id: randomStringWithSpecialChars((0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.id.maxLength - 3), (0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.id.maxLength)), + id: randomStringWithSpecialChars((0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.id.maxLength - 1), (0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.id.maxLength)), var1: randomStringWithSpecialChars((0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.var1.maxLength) - 3, (0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.var1.maxLength)), var2: (0, _asyncTestUtil.randomNumber)(100, (0, _index.ensureNotFalsy)(averageSchemaForFieldLength.properties.var2.maximum)), deep: { diff --git a/dist/cjs/plugins/test-utils/schema-objects.js.map b/dist/cjs/plugins/test-utils/schema-objects.js.map index 65c9ec5bef5..ed63d731396 100644 --- a/dist/cjs/plugins/test-utils/schema-objects.js.map +++ b/dist/cjs/plugins/test-utils/schema-objects.js.map @@ -1 +1 @@ -{"version":3,"file":"schema-objects.js","names":["_asyncTestUtil","require","schemas","_interopRequireWildcard","_index","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TEST_DATA_CHARSET","exports","TEST_DATA_CHARSET_LAST_SORTED","ensureNotFalsy","lastOfArray","split","sort","someEmojisArr","baseChars","allChars","slice","appendToArray","randomStringWithSpecialChars","minLength","maxLength","text","Error","length","randomNumber","Math","floor","random","humanData","passportId","age","firstName","lastName","simpleHumanData","simpleHumanV3Data","partial","defaultObj","assign","simpleHumanAge","humanWithSubOther","other","NoIndexHuman","nestedHumanData","mainSkill","name","level","deepNestedHumanData","attack","good","count","bigHumanDocumentType","dnaHash","heroArrayData","skills","Array","fill","map","damage","simpleHeroArray","encryptedHumanData","secret","encryptedObjectHumanData","subname","encryptedDeepHumanDocumentType","firstLevelPassword","secretData","pw","deepSecret","darkhole","nestedSecret","compoundIndexData","passportCountry","compoundIndexNoStringData","nostringIndex","refHumanData","bestFriend","refHumanNestedData","foo","humanWithTimestampData","givenData","ret","id","updatedAt","Date","now","averageSchemaForFieldLength","averageSchema","averageSchemaData","properties","var1","var2","maximum","deep","deep1","deep2","deeper","deepNr","list","pointData","x","y","humanWithIdAndAgeIndexDocumentType","humanWithCompositePrimary","info"],"sources":["../../../../src/plugins/test-utils/schema-objects.ts"],"sourcesContent":["/**\n * this file contains objects which match the schemas in schemas.js\n */\n\nimport {\n randomNumber\n} from 'async-test-util';\nimport { HumanDocumentType } from './schemas.ts';\nimport * as schemas from './schemas.ts';\nimport { appendToArray, ensureNotFalsy, lastOfArray } from '../utils/index.ts';\n\n\n/**\n * Some storages had problems with umlauts and other special chars.\n * So we add these to all test strings.\n */\nexport const TEST_DATA_CHARSET = '0987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüÖÄßÜ[]{}\\'';\nexport const TEST_DATA_CHARSET_LAST_SORTED = ensureNotFalsy(lastOfArray(TEST_DATA_CHARSET.split('').sort()));\nconst someEmojisArr = ['😊', '💩', '👵', '🍌', '🏳️‍🌈', '😃'];\n\nconst baseChars = TEST_DATA_CHARSET.split('');\nconst allChars = baseChars.slice(0);\nappendToArray(allChars, someEmojisArr);\n\nexport function randomStringWithSpecialChars(\n minLength: number,\n /**\n * It has shown that alternating string lengths\n * can reproduce various problems. So by having variable\n * lengths we ensure that this fully works.\n */\n maxLength: number\n) {\n let text = '';\n\n if (!minLength || !maxLength || minLength > maxLength) {\n throw new Error('invalid length given ' + minLength + ' ' + maxLength);\n }\n\n const length = randomNumber(minLength, maxLength);\n\n while (text.length < length) {\n if (text.length === 0) {\n /**\n * TODO foundationdb does not work correctly when an index string starts\n * with an emoji. This can likely be fixed by upgrading foundationdb to the\n * latest version.\n */\n text += baseChars[Math.floor(Math.random() * baseChars.length)];\n } else {\n text += allChars[Math.floor(Math.random() * allChars.length)];\n }\n }\n\n /**\n * Because emojis can have a string.length of 2,\n * we can sometimes end up with strings that are longer\n * than the provided length. In that cases we have to rerun.\n */\n if (text.length > length) {\n return randomStringWithSpecialChars(minLength, maxLength);\n }\n\n return text;\n}\n\nexport interface SimpleHumanDocumentType {\n passportId: string;\n firstName: string;\n lastName: string;\n}\n\nexport function humanData(\n passportId: string = randomStringWithSpecialChars(8, 12),\n age: number = randomNumber(10, 50),\n firstName: string = randomStringWithSpecialChars(8, 12)\n): HumanDocumentType {\n return {\n passportId: passportId,\n firstName,\n lastName: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport function simpleHumanData(): SimpleHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface SimpleHumanV3DocumentType {\n passportId: string;\n age: number;\n oneOptional?: string;\n}\nexport function simpleHumanV3Data(partial: Partial = {}): SimpleHumanV3DocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface SimpleHumanAgeDocumentType {\n passportId: string;\n age: string;\n}\nexport function simpleHumanAge(partial: Partial = {}): SimpleHumanAgeDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50) + ''\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface HumanWithSubOtherDocumentType {\n passportId: string;\n other: {\n age: number;\n };\n}\nexport function humanWithSubOther(): HumanWithSubOtherDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n other: {\n age: randomNumber(10, 50)\n }\n };\n}\n\nexport interface NoIndexHumanDocumentType {\n firstName: string;\n lastName: string;\n}\nexport function NoIndexHuman(): NoIndexHumanDocumentType {\n return {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface NestedHumanDocumentType {\n passportId: string;\n firstName: string;\n mainSkill: {\n name: string;\n level: number;\n };\n}\nexport function nestedHumanData(partial: Partial = {}): NestedHumanDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n level: 5\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface DeepNestedHumanDocumentType {\n passportId: string;\n mainSkill: {\n name: string;\n attack: {\n good: boolean;\n count: number;\n };\n };\n}\nexport function deepNestedHumanData(): DeepNestedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n attack: {\n good: false,\n count: 5\n }\n }\n };\n}\n\nexport interface BigHumanDocumentType {\n passportId: string;\n dnaHash: string;\n firstName: string;\n lastName: string;\n age: number;\n}\nexport function bigHumanDocumentType(): BigHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n dnaHash: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface HeroArrayDocumentType {\n name: string;\n skills: {\n name: string;\n damage: number;\n }[];\n}\nexport function heroArrayData(): HeroArrayDocumentType {\n return {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => {\n return {\n name: randomStringWithSpecialChars(4, 6),\n damage: randomNumber(10, 50)\n };\n })\n };\n}\n\nexport interface SimpleHeroArrayDocumentType {\n name: string;\n skills: string[];\n}\nexport function simpleHeroArray(partial: Partial = {}): SimpleHeroArrayDocumentType {\n const defaultObj = {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => randomStringWithSpecialChars(3, 6))\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface EncryptedHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: string;\n}\nexport function encryptedHumanData(secret = randomStringWithSpecialChars(8, 12)): EncryptedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret\n };\n}\n\nexport interface EncryptedObjectHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: {\n name: string;\n subname: string;\n };\n}\nexport function encryptedObjectHumanData(): EncryptedObjectHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret: {\n name: randomStringWithSpecialChars(8, 12),\n subname: randomStringWithSpecialChars(8, 12)\n }\n };\n}\n\nexport interface EncryptedDeepHumanDocumentType {\n passportId: string;\n firstName: string;\n firstLevelPassword: string;\n secretData: {\n pw: string;\n };\n deepSecret: {\n darkhole: {\n pw: string;\n };\n };\n nestedSecret: {\n darkhole: {\n pw: string;\n };\n };\n}\nexport function encryptedDeepHumanDocumentType(): EncryptedDeepHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n firstLevelPassword: randomStringWithSpecialChars(8, 12),\n secretData: {\n pw: randomStringWithSpecialChars(8, 12)\n },\n deepSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n },\n nestedSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n }\n };\n}\n\nexport interface CompoundIndexDocumentType {\n passportId: string;\n passportCountry: string;\n age: number;\n}\nexport function compoundIndexData(): CompoundIndexDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface CompoundIndexNoStringDocumentType {\n passportId: string;\n passportCountry: { [prop: string]: string; };\n age: number;\n}\nexport function compoundIndexNoStringData(): CompoundIndexNoStringDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: { [randomStringWithSpecialChars(8, 12)]: randomStringWithSpecialChars(8, 12) },\n age: randomNumber(10, 50)\n };\n}\n\nexport interface NostringIndexDocumentType {\n passportId: {};\n firstName: string;\n}\nexport function nostringIndex(): NostringIndexDocumentType {\n return {\n passportId: {},\n firstName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface RefHumanDocumentType {\n name: string;\n bestFriend: string;\n}\nexport function refHumanData(bestFriend?: string): RefHumanDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n bestFriend\n } as any;\n}\n\nexport interface RefHumanNestedDocumentType {\n name: string;\n foo: {\n bestFriend: string;\n };\n}\nexport function refHumanNestedData(bestFriend?: string): RefHumanNestedDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n foo: {\n bestFriend\n } as any\n };\n}\nexport interface HumanWithTimestampNestedDocumentType extends HumanWithTimestampDocumentType {\n address?: {\n street: string;\n suite: string;\n city: string;\n zipcode: string;\n geo: {\n lat: string;\n lng: string;\n };\n }\n}\n\nexport interface HumanWithTimestampDocumentType {\n id: string;\n name: string;\n age: number;\n updatedAt: number;\n deletedAt?: number;\n}\nexport function humanWithTimestampData(givenData: Partial = {}): HumanWithTimestampDocumentType {\n let ret = {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age: randomNumber(1, 100),\n // use some time in the past week\n updatedAt: Date.now()\n };\n ret = Object.assign({}, ret, givenData);\n return ret;\n}\n\nexport interface AverageSchemaDocumentType {\n id: string;\n var1: string;\n var2: number;\n deep: {\n deep1: string;\n deep2: string;\n deeper: {\n deepNr: number;\n };\n };\n list: {\n deep1: string;\n deep2: string;\n }[];\n}\n\n\nconst averageSchemaForFieldLength = schemas.averageSchema() as any;\nexport function averageSchemaData(\n partial: Partial = {}\n): AverageSchemaDocumentType {\n return Object.assign(\n {},\n {\n id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 3), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)),\n var1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength)),\n var2: randomNumber(100, ensureNotFalsy(averageSchemaForFieldLength.properties.var2.maximum)),\n deep: {\n deep1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength)),\n deep2: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength)),\n deeper: {\n deepNr: randomNumber(0, 10)\n }\n },\n list: new Array(5).fill(0).map(() => ({\n deep1: randomStringWithSpecialChars(2, 5),\n deep2: randomStringWithSpecialChars(5, 8)\n }))\n },\n partial\n );\n}\n\nexport interface PointDocumentType {\n id: string;\n x: number;\n y: number;\n}\nexport function pointData(): PointDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n x: randomNumber(1, 100),\n y: randomNumber(1, 100)\n };\n}\n\nexport interface HumanWithIdAndAgeIndexDocumentType {\n id: string;\n name: string;\n age: number;\n}\nexport function humanWithIdAndAgeIndexDocumentType(\n age: number = randomNumber(1, 100)\n): HumanWithIdAndAgeIndexDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport type HumanWithCompositePrimary = {\n // optional because it might be created by RxDB and not known before\n id?: string;\n firstName: string;\n lastName: string;\n info: {\n age: number;\n };\n};\nexport function humanWithCompositePrimary(partial: Partial = {}): HumanWithCompositePrimary {\n const defaultObj = {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n info: {\n age: randomNumber(10, 50)\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAA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,UAAU,EACVD,OACJ,CAAC;AACL","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"schema-objects.js","names":["_asyncTestUtil","require","schemas","_interopRequireWildcard","_index","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TEST_DATA_CHARSET","exports","TEST_DATA_CHARSET_LAST_SORTED","ensureNotFalsy","lastOfArray","split","sort","someEmojisArr","baseChars","allChars","slice","appendToArray","randomStringWithSpecialChars","minLength","maxLength","text","Error","length","randomNumber","Math","floor","random","humanData","passportId","age","firstName","lastName","simpleHumanData","simpleHumanV3Data","partial","defaultObj","assign","simpleHumanAge","humanWithSubOther","other","NoIndexHuman","nestedHumanData","mainSkill","name","level","deepNestedHumanData","attack","good","count","bigHumanDocumentType","dnaHash","heroArrayData","skills","Array","fill","map","damage","simpleHeroArray","encryptedHumanData","secret","encryptedObjectHumanData","subname","encryptedDeepHumanDocumentType","firstLevelPassword","secretData","pw","deepSecret","darkhole","nestedSecret","compoundIndexData","passportCountry","compoundIndexNoStringData","nostringIndex","refHumanData","bestFriend","refHumanNestedData","foo","humanWithTimestampData","givenData","ret","id","updatedAt","Date","now","averageSchemaForFieldLength","averageSchema","averageSchemaData","properties","var1","var2","maximum","deep","deep1","deep2","deeper","deepNr","list","pointData","x","y","humanWithIdAndAgeIndexDocumentType","humanWithCompositePrimary","info"],"sources":["../../../../src/plugins/test-utils/schema-objects.ts"],"sourcesContent":["/**\n * this file contains objects which match the schemas in schemas.js\n */\n\nimport {\n randomNumber\n} from 'async-test-util';\nimport { HumanDocumentType } from './schemas.ts';\nimport * as schemas from './schemas.ts';\nimport { appendToArray, ensureNotFalsy, lastOfArray } from '../utils/index.ts';\n\n\n/**\n * Some storages had problems with umlauts and other special chars.\n * So we add these to all test strings.\n */\nexport const TEST_DATA_CHARSET = '0987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüÖÄßÜ[]{}\\'';\nexport const TEST_DATA_CHARSET_LAST_SORTED = ensureNotFalsy(lastOfArray(TEST_DATA_CHARSET.split('').sort()));\nconst someEmojisArr = ['😊', '💩', '👵', '🍌', '🏳️‍🌈', '😃'];\n\nconst baseChars = TEST_DATA_CHARSET.split('');\nconst allChars = baseChars.slice(0);\nappendToArray(allChars, someEmojisArr);\n\nexport function randomStringWithSpecialChars(\n minLength: number,\n /**\n * It has shown that alternating string lengths\n * can reproduce various problems. So by having variable\n * lengths we ensure that this fully works.\n */\n maxLength: number\n) {\n let text = '';\n\n if (!minLength || !maxLength || minLength > maxLength) {\n throw new Error('invalid length given ' + minLength + ' ' + maxLength);\n }\n\n const length = randomNumber(minLength, maxLength);\n\n while (text.length < length) {\n if (text.length === 0) {\n /**\n * TODO foundationdb does not work correctly when an index string starts\n * with an emoji. This can likely be fixed by upgrading foundationdb to the\n * latest version.\n */\n text += baseChars[Math.floor(Math.random() * baseChars.length)];\n } else {\n text += allChars[Math.floor(Math.random() * allChars.length)];\n }\n }\n\n /**\n * Because emojis can have a string.length of 2,\n * we can sometimes end up with strings that are longer\n * than the provided length. In that cases we have to rerun.\n */\n if (text.length > length) {\n return randomStringWithSpecialChars(minLength, maxLength);\n }\n\n return text;\n}\n\nexport interface SimpleHumanDocumentType {\n passportId: string;\n firstName: string;\n lastName: string;\n}\n\nexport function humanData(\n passportId: string = randomStringWithSpecialChars(8, 12),\n age: number = randomNumber(10, 50),\n firstName: string = randomStringWithSpecialChars(8, 12)\n): HumanDocumentType {\n return {\n passportId: passportId,\n firstName,\n lastName: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport function simpleHumanData(): SimpleHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface SimpleHumanV3DocumentType {\n passportId: string;\n age: number;\n oneOptional?: string;\n}\nexport function simpleHumanV3Data(partial: Partial = {}): SimpleHumanV3DocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface SimpleHumanAgeDocumentType {\n passportId: string;\n age: string;\n}\nexport function simpleHumanAge(partial: Partial = {}): SimpleHumanAgeDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50) + ''\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface HumanWithSubOtherDocumentType {\n passportId: string;\n other: {\n age: number;\n };\n}\nexport function humanWithSubOther(): HumanWithSubOtherDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n other: {\n age: randomNumber(10, 50)\n }\n };\n}\n\nexport interface NoIndexHumanDocumentType {\n firstName: string;\n lastName: string;\n}\nexport function NoIndexHuman(): NoIndexHumanDocumentType {\n return {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface NestedHumanDocumentType {\n passportId: string;\n firstName: string;\n mainSkill: {\n name: string;\n level: number;\n };\n}\nexport function nestedHumanData(partial: Partial = {}): NestedHumanDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n level: 5\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface DeepNestedHumanDocumentType {\n passportId: string;\n mainSkill: {\n name: string;\n attack: {\n good: boolean;\n count: number;\n };\n };\n}\nexport function deepNestedHumanData(): DeepNestedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n attack: {\n good: false,\n count: 5\n }\n }\n };\n}\n\nexport interface BigHumanDocumentType {\n passportId: string;\n dnaHash: string;\n firstName: string;\n lastName: string;\n age: number;\n}\nexport function bigHumanDocumentType(): BigHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n dnaHash: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface HeroArrayDocumentType {\n name: string;\n skills: {\n name: string;\n damage: number;\n }[];\n}\nexport function heroArrayData(): HeroArrayDocumentType {\n return {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => {\n return {\n name: randomStringWithSpecialChars(4, 6),\n damage: randomNumber(10, 50)\n };\n })\n };\n}\n\nexport interface SimpleHeroArrayDocumentType {\n name: string;\n skills: string[];\n}\nexport function simpleHeroArray(partial: Partial = {}): SimpleHeroArrayDocumentType {\n const defaultObj = {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => randomStringWithSpecialChars(3, 6))\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface EncryptedHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: string;\n}\nexport function encryptedHumanData(secret = randomStringWithSpecialChars(8, 12)): EncryptedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret\n };\n}\n\nexport interface EncryptedObjectHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: {\n name: string;\n subname: string;\n };\n}\nexport function encryptedObjectHumanData(): EncryptedObjectHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret: {\n name: randomStringWithSpecialChars(8, 12),\n subname: randomStringWithSpecialChars(8, 12)\n }\n };\n}\n\nexport interface EncryptedDeepHumanDocumentType {\n passportId: string;\n firstName: string;\n firstLevelPassword: string;\n secretData: {\n pw: string;\n };\n deepSecret: {\n darkhole: {\n pw: string;\n };\n };\n nestedSecret: {\n darkhole: {\n pw: string;\n };\n };\n}\nexport function encryptedDeepHumanDocumentType(): EncryptedDeepHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n firstLevelPassword: randomStringWithSpecialChars(8, 12),\n secretData: {\n pw: randomStringWithSpecialChars(8, 12)\n },\n deepSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n },\n nestedSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n }\n };\n}\n\nexport interface CompoundIndexDocumentType {\n passportId: string;\n passportCountry: string;\n age: number;\n}\nexport function compoundIndexData(): CompoundIndexDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface CompoundIndexNoStringDocumentType {\n passportId: string;\n passportCountry: { [prop: string]: string; };\n age: number;\n}\nexport function compoundIndexNoStringData(): CompoundIndexNoStringDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: { [randomStringWithSpecialChars(8, 12)]: randomStringWithSpecialChars(8, 12) },\n age: randomNumber(10, 50)\n };\n}\n\nexport interface NostringIndexDocumentType {\n passportId: {};\n firstName: string;\n}\nexport function nostringIndex(): NostringIndexDocumentType {\n return {\n passportId: {},\n firstName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface RefHumanDocumentType {\n name: string;\n bestFriend: string;\n}\nexport function refHumanData(bestFriend?: string): RefHumanDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n bestFriend\n } as any;\n}\n\nexport interface RefHumanNestedDocumentType {\n name: string;\n foo: {\n bestFriend: string;\n };\n}\nexport function refHumanNestedData(bestFriend?: string): RefHumanNestedDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n foo: {\n bestFriend\n } as any\n };\n}\nexport interface HumanWithTimestampNestedDocumentType extends HumanWithTimestampDocumentType {\n address?: {\n street: string;\n suite: string;\n city: string;\n zipcode: string;\n geo: {\n lat: string;\n lng: string;\n };\n }\n}\n\nexport interface HumanWithTimestampDocumentType {\n id: string;\n name: string;\n age: number;\n updatedAt: number;\n deletedAt?: number;\n}\nexport function humanWithTimestampData(givenData: Partial = {}): HumanWithTimestampDocumentType {\n let ret = {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age: randomNumber(1, 100),\n // use some time in the past week\n updatedAt: Date.now()\n };\n ret = Object.assign({}, ret, givenData);\n return ret;\n}\n\nexport interface AverageSchemaDocumentType {\n id: string;\n var1: string;\n var2: number;\n deep: {\n deep1: string;\n deep2: string;\n deeper: {\n deepNr: number;\n };\n };\n list: {\n deep1: string;\n deep2: string;\n }[];\n}\n\n\nconst averageSchemaForFieldLength = schemas.averageSchema() as any;\nexport function averageSchemaData(\n partial: Partial = {}\n): AverageSchemaDocumentType {\n return Object.assign(\n {},\n {\n id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 1), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)),\n var1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength)),\n var2: randomNumber(100, ensureNotFalsy(averageSchemaForFieldLength.properties.var2.maximum)),\n deep: {\n deep1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength)),\n deep2: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength)),\n deeper: {\n deepNr: randomNumber(0, 10)\n }\n },\n list: new Array(5).fill(0).map(() => ({\n deep1: randomStringWithSpecialChars(2, 5),\n deep2: randomStringWithSpecialChars(5, 8)\n }))\n },\n partial\n );\n}\n\nexport interface PointDocumentType {\n id: string;\n x: number;\n y: number;\n}\nexport function pointData(): PointDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n x: randomNumber(1, 100),\n y: randomNumber(1, 100)\n };\n}\n\nexport interface HumanWithIdAndAgeIndexDocumentType {\n id: string;\n name: string;\n age: number;\n}\nexport function humanWithIdAndAgeIndexDocumentType(\n age: number = randomNumber(1, 100)\n): HumanWithIdAndAgeIndexDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport type HumanWithCompositePrimary = {\n // optional because it might be created by RxDB and not known before\n id?: string;\n firstName: string;\n lastName: string;\n info: {\n age: number;\n };\n};\nexport function humanWithCompositePrimary(partial: Partial = {}): HumanWithCompositePrimary {\n const defaultObj = {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n info: {\n age: randomNumber(10, 50)\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,cAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA+E,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAA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,EAAE,IAAA5E,2BAAY,EAAC,CAAC,EAAE,GAAG;EAC1B,CAAC;AACL;AAOO,SAAS6E,kCAAkCA,CAC9CvE,GAAW,GAAG,IAAAN,2BAAY,EAAC,CAAC,EAAE,GAAG,CAAC,EACA;EAClC,OAAO;IACHyD,EAAE,EAAE/D,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IACvC0B,IAAI,EAAE1B,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IACzCY;EACJ,CAAC;AACL;AAWO,SAASwE,yBAAyBA,CAACnE,OAA2C,GAAG,CAAC,CAAC,EAA6B;EACnH,IAAMC,UAAU,GAAG;IACfL,SAAS,EAAEb,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC9Cc,QAAQ,EAAEd,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7CqF,IAAI,EAAE;MACFzE,GAAG,EAAE,IAAAN,2BAAY,EAAC,EAAE,EAAE,EAAE;IAC5B;EACJ,CAAC;EACD,OAAO1B,MAAM,CAACuC,MAAM,CAChBD,UAAU,EACVD,OACJ,CAAC;AACL","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/utils/index.js b/dist/cjs/plugins/utils/index.js index 8a560f74707..c24d46436fa 100644 --- a/dist/cjs/plugins/utils/index.js +++ b/dist/cjs/plugins/utils/index.js @@ -201,4 +201,15 @@ Object.keys(_utilsGlobal).forEach(function (key) { } }); }); +var _utilsPremium = require("./utils-premium.js"); +Object.keys(_utilsPremium).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _utilsPremium[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _utilsPremium[key]; + } + }); +}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/utils/index.js.map b/dist/cjs/plugins/utils/index.js.map index b4358153d5f..650aeb3ee40 100644 --- a/dist/cjs/plugins/utils/index.js.map +++ b/dist/cjs/plugins/utils/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["_utilsArray","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_utilsBlob","_utilsBase","_utilsRevision","_utilsDocument","_utilsHash","_utilsPromise","_utilsRegex","_utilsString","_utilsObjectDeepEqual","_utilsObjectDotProp","_utilsObject","_utilsMap","_utilsError","_utilsTime","_utilsOther","_utilsRxdbVersion","_utilsGlobal"],"sources":["../../../../src/plugins/utils/index.ts"],"sourcesContent":["export * from './utils-array.ts';\nexport * from './utils-blob.ts';\nexport * from './utils-base64.ts';\nexport * from './utils-revision.ts';\nexport * from './utils-document.ts';\nexport * from './utils-hash.ts';\nexport * from './utils-promise.ts';\nexport * from './utils-regex.ts';\nexport * from './utils-string.ts';\nexport * from './utils-object-deep-equal.ts';\nexport * from './utils-object-dot-prop.ts';\nexport * from './utils-object.ts';\nexport * from './utils-map.ts';\nexport * from './utils-error.ts';\nexport * from './utils-time.ts';\nexport * from './utils-other.ts';\nexport * from './utils-rxdb-version.ts';\nexport * from './utils-global.ts';\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,G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,IAAA,CAAAqB,WAAA,EAAApB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAmB,WAAA,CAAAnB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAe,WAAA,CAAAnB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAoB,iBAAA,GAAAxB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAsB,iBAAA,EAAArB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAoB,iBAAA,CAAApB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAgB,iBAAA,CAAApB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAqB,YAAA,GAAAzB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAuB,YAAA,EAAAtB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAqB,YAAA,CAAArB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAiB,YAAA,CAAArB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["_utilsArray","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_utilsBlob","_utilsBase","_utilsRevision","_utilsDocument","_utilsHash","_utilsPromise","_utilsRegex","_utilsString","_utilsObjectDeepEqual","_utilsObjectDotProp","_utilsObject","_utilsMap","_utilsError","_utilsTime","_utilsOther","_utilsRxdbVersion","_utilsGlobal","_utilsPremium"],"sources":["../../../../src/plugins/utils/index.ts"],"sourcesContent":["export * from './utils-array.ts';\nexport * from './utils-blob.ts';\nexport * from './utils-base64.ts';\nexport * from './utils-revision.ts';\nexport * from './utils-document.ts';\nexport * from './utils-hash.ts';\nexport * from './utils-promise.ts';\nexport * from './utils-regex.ts';\nexport * from './utils-string.ts';\nexport * from './utils-object-deep-equal.ts';\nexport * from './utils-object-dot-prop.ts';\nexport * from './utils-object.ts';\nexport * from './utils-map.ts';\nexport * from './utils-error.ts';\nexport * from './utils-time.ts';\nexport * from './utils-other.ts';\nexport * from './utils-rxdb-version.ts';\nexport * from './utils-global.ts';\nexport * from './utils-premium.ts';\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA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kB,aAAA,CAAAtB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-global.js b/dist/cjs/plugins/utils/utils-global.js index c80c4463756..ba420547128 100644 --- a/dist/cjs/plugins/utils/utils-global.js +++ b/dist/cjs/plugins/utils/utils-global.js @@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.RXDB_UTILS_GLOBAL = exports.PREMIUM_FLAG_HASH = void 0; +exports.RXDB_UTILS_GLOBAL = void 0; /** * Can be used by some plugins to have a "global" object that * can be imported and mutated at will. */ var RXDB_UTILS_GLOBAL = exports.RXDB_UTILS_GLOBAL = {}; -var PREMIUM_FLAG_HASH = exports.PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93'; //# sourceMappingURL=utils-global.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-global.js.map b/dist/cjs/plugins/utils/utils-global.js.map index 3fa18aca035..7600054d404 100644 --- a/dist/cjs/plugins/utils/utils-global.js.map +++ b/dist/cjs/plugins/utils/utils-global.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-global.js","names":["RXDB_UTILS_GLOBAL","exports","PREMIUM_FLAG_HASH"],"sources":["../../../../src/plugins/utils/utils-global.ts"],"sourcesContent":["/**\n * Can be used by some plugins to have a \"global\" object that\n * can be imported and mutated at will.\n */\nexport const RXDB_UTILS_GLOBAL: any = {};\n\n\nexport const PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,IAAMA,iBAAsB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC,CAAC;AAGjC,IAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,kEAAkE","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"utils-global.js","names":["RXDB_UTILS_GLOBAL","exports"],"sources":["../../../../src/plugins/utils/utils-global.ts"],"sourcesContent":["/**\n * Can be used by some plugins to have a \"global\" object that\n * can be imported and mutated at will.\n */\nexport const RXDB_UTILS_GLOBAL: any = {};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,IAAMA,iBAAsB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC,CAAC","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-premium.js b/dist/cjs/plugins/utils/utils-premium.js new file mode 100644 index 00000000000..46ebd619740 --- /dev/null +++ b/dist/cjs/plugins/utils/utils-premium.js @@ -0,0 +1,37 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PREMIUM_FLAG_HASH = exports.NON_PREMIUM_COLLECTION_LIMIT = void 0; +exports.hasPremiumFlag = hasPremiumFlag; +var _utilsGlobal = require("./utils-global.js"); +var _utilsHash = require("./utils-hash.js"); +var _utilsPromise = require("./utils-promise.js"); +var PREMIUM_FLAG_HASH = exports.PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93'; +var NON_PREMIUM_COLLECTION_LIMIT = exports.NON_PREMIUM_COLLECTION_LIMIT = 16; +var hasPremiumPromise = _utilsPromise.PROMISE_RESOLVE_FALSE; +var premiumChecked = false; + +/** + * Here we check if the premium flag has been set. + * This code exists in the open source version of RxDB. + * Yes you are allowed to fork the repo and just overwrite this function. + * However you might better spend this time developing your real project + * and supporting the RxDB efforts by buying premium. + */ +async function hasPremiumFlag() { + if (premiumChecked) { + return hasPremiumPromise; + } + premiumChecked = true; + hasPremiumPromise = (async () => { + if (_utilsGlobal.RXDB_UTILS_GLOBAL.premium && typeof _utilsGlobal.RXDB_UTILS_GLOBAL.premium === 'string' && (await (0, _utilsHash.defaultHashSha256)(_utilsGlobal.RXDB_UTILS_GLOBAL.premium)) === PREMIUM_FLAG_HASH) { + return true; + } else { + return false; + } + })(); + return hasPremiumPromise; +} +//# sourceMappingURL=utils-premium.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-premium.js.map b/dist/cjs/plugins/utils/utils-premium.js.map new file mode 100644 index 00000000000..61f75e271a2 --- /dev/null +++ b/dist/cjs/plugins/utils/utils-premium.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils-premium.js","names":["_utilsGlobal","require","_utilsHash","_utilsPromise","PREMIUM_FLAG_HASH","exports","NON_PREMIUM_COLLECTION_LIMIT","hasPremiumPromise","PROMISE_RESOLVE_FALSE","premiumChecked","hasPremiumFlag","RXDB_UTILS_GLOBAL","premium","defaultHashSha256"],"sources":["../../../../src/plugins/utils/utils-premium.ts"],"sourcesContent":["import { RXDB_UTILS_GLOBAL } from './utils-global.ts';\nimport { defaultHashSha256 } from './utils-hash.ts';\nimport { PROMISE_RESOLVE_FALSE } from './utils-promise.ts';\n\nexport const PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93';\nexport const NON_PREMIUM_COLLECTION_LIMIT = 16;\n\nlet hasPremiumPromise: Promise = PROMISE_RESOLVE_FALSE;\nlet premiumChecked = false;\n\n/**\n * Here we check if the premium flag has been set.\n * This code exists in the open source version of RxDB.\n * Yes you are allowed to fork the repo and just overwrite this function.\n * However you might better spend this time developing your real project\n * and supporting the RxDB efforts by buying premium.\n */\nexport async function hasPremiumFlag() {\n if (premiumChecked) {\n return hasPremiumPromise;\n }\n premiumChecked = true;\n\n hasPremiumPromise = (async () => {\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return true;\n } else {\n return false;\n }\n })();\n\n return hasPremiumPromise;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEO,IAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,kEAAkE;AAC5F,IAAME,4BAA4B,GAAAD,OAAA,CAAAC,4BAAA,GAAG,EAAE;AAE9C,IAAIC,iBAAmC,GAAGC,mCAAqB;AAC/D,IAAIC,cAAc,GAAG,KAAK;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,cAAcA,CAAA,EAAG;EACnC,IAAID,cAAc,EAAE;IAChB,OAAOF,iBAAiB;EAC5B;EACAE,cAAc,GAAG,IAAI;EAErBF,iBAAiB,GAAG,CAAC,YAAY;IAC7B,IACII,8BAAiB,CAACC,OAAO,IACzB,OAAOD,8BAAiB,CAACC,OAAO,KAAK,QAAQ,IAC5C,OAAM,IAAAC,4BAAiB,EAACF,8BAAiB,CAACC,OAAO,CAAC,MAAKR,iBAAkB,EAC5E;MACE,OAAO,IAAI;IACf,CAAC,MAAM;MACH,OAAO,KAAK;IAChB;EACJ,CAAC,EAAE,CAAC;EAEJ,OAAOG,iBAAiB;AAC5B","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-rxdb-version.js b/dist/cjs/plugins/utils/utils-rxdb-version.js index 9e5912d55f5..aea66dca9a9 100644 --- a/dist/cjs/plugins/utils/utils-rxdb-version.js +++ b/dist/cjs/plugins/utils/utils-rxdb-version.js @@ -7,5 +7,5 @@ exports.RXDB_VERSION = void 0; /** * This file is replaced in the 'npm run build:version' script. */ -var RXDB_VERSION = exports.RXDB_VERSION = '16.0.0-beta.5'; +var RXDB_VERSION = exports.RXDB_VERSION = '16.0.0-beta.6'; //# sourceMappingURL=utils-rxdb-version.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-rxdb-version.js.map b/dist/cjs/plugins/utils/utils-rxdb-version.js.map index f8c1a0dfe10..3260089e6ee 100644 --- a/dist/cjs/plugins/utils/utils-rxdb-version.js.map +++ b/dist/cjs/plugins/utils/utils-rxdb-version.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION","exports"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '16.0.0-beta.5';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,eAAe","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION","exports"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '16.0.0-beta.6';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,eAAe","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/rx-collection.js b/dist/cjs/rx-collection.js index 88a056f2538..a06677c05c8 100644 --- a/dist/cjs/rx-collection.js +++ b/dist/cjs/rx-collection.js @@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau Object.defineProperty(exports, "__esModule", { value: true }); -exports.RxCollectionBase = void 0; +exports.RxCollectionBase = exports.OPEN_COLLECTIONS = void 0; exports.createRxCollection = createRxCollection; exports.isRxCollection = isRxCollection; var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); @@ -27,6 +27,7 @@ var _rxChangeEvent = require("./rx-change-event.js"); var HOOKS_WHEN = ['pre', 'post']; var HOOKS_KEYS = ['insert', 'save', 'remove', 'create']; var hooksApplied = false; +var OPEN_COLLECTIONS = exports.OPEN_COLLECTIONS = new Set(); var RxCollectionBase = exports.RxCollectionBase = /*#__PURE__*/function () { /** * Stores all 'normal' documents @@ -72,9 +73,44 @@ var RxCollectionBase = exports.RxCollectionBase = /*#__PURE__*/function () { // might be falsy on pseudoInstance this.eventBulks$ = database.eventBulks$.pipe((0, _rxjs.filter)(changeEventBulk => changeEventBulk.collectionName === this.name)); } else {} + + /** + * Must be last because the hooks might throw on dev-mode + * checks and we do not want to have broken collections here. + * RxCollection instances created for testings do not have a database + * so we do not add these to the list. + */ + if (this.database) { + OPEN_COLLECTIONS.add(this); + } } var _proto = RxCollectionBase.prototype; _proto.prepare = async function prepare() { + if (!(await (0, _index.hasPremiumFlag)())) { + /** + * When used in a test suite, we often open and close many databases with collections + * while not awaiting the database.close() call to improve the test times. + * So when reopening collections and the OPEN_COLLECTIONS size is full, + * we retry after some times to account for this. + */ + var count = 0; + while (count < 10 && OPEN_COLLECTIONS.size > _index.NON_PREMIUM_COLLECTION_LIMIT) { + count++; + await this.promiseWait(30); + } + if (OPEN_COLLECTIONS.size > _index.NON_PREMIUM_COLLECTION_LIMIT) { + throw (0, _rxError.newRxError)('COL23', { + database: this.database.name, + collection: this.name, + args: { + existing: Array.from(OPEN_COLLECTIONS.values()).map(c => ({ + db: c.database ? c.database.name : '', + c: c.name + })) + } + }); + } + } this.storageInstance = (0, _rxStorageHelper.getWrappedStorageInstance)(this.database, this.internalStorageInstance, this.schema.jsonSchema); this.incrementalWriteQueue = new _incrementalWrite.IncrementalWriteQueue(this.storageInstance, this.schema.primaryPath, (newData, oldData) => (0, _rxDocument.beforeDocumentUpdateWrite)(this, newData, oldData), result => this._runHooks('post', 'save', result)); this.$ = this.eventBulks$.pipe((0, _rxjs.mergeMap)(changeEventBulk => (0, _rxChangeEvent.rxChangeEventBulkToRxChangeEvents)(changeEventBulk))); @@ -572,6 +608,7 @@ var RxCollectionBase = exports.RxCollectionBase = /*#__PURE__*/function () { if (this.closed) { return _index.PROMISE_RESOLVE_FALSE; } + OPEN_COLLECTIONS.delete(this); await Promise.all(this.onClose.map(fn => fn())); /** @@ -775,6 +812,7 @@ function createRxCollection({ * If the collection creation fails, * we yet have to close the storage instances. */.catch(err => { + OPEN_COLLECTIONS.delete(collection); return storageInstance.close().then(() => Promise.reject(err)); }); }); diff --git a/dist/cjs/rx-collection.js.map b/dist/cjs/rx-collection.js.map index 7e0d2bd1d42..44f35025141 100644 --- a/dist/cjs/rx-collection.js.map +++ b/dist/cjs/rx-collection.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-collection.js","names":["_rxjs","require","_index","_rxCollectionHelper","_rxQuery","_rxError","_docCache","_queryCache","_changeEventBuffer","_hooks","_rxDocumentPrototypeMerge","_rxStorageHelper","_incrementalWrite","_rxDocument","_overwritable","_defaultConflictHandler","_rxChangeEvent","HOOKS_WHEN","HOOKS_KEYS","hooksApplied","RxCollectionBase","exports","database","name","schema","internalStorageInstance","instanceCreationOptions","migrationStrategies","methods","attachments","options","cacheReplacementPolicy","defaultCacheReplacementPolicy","statics","conflictHandler","defaultConflictHandler","storageInstance","timeouts","Set","incrementalWriteQueue","awaitBeforeReads","_incrementalUpsertQueues","Map","synced","hooks","_subs","createQueryCache","$","checkpoint$","eventBulks$","onClose","closed","onRemove","_applyHookFunctions","asRxCollection","pipe","filter","changeEventBulk","collectionName","_proto","prototype","prepare","getWrappedStorageInstance","jsonSchema","IncrementalWriteQueue","primaryPath","newData","oldData","beforeDocumentUpdateWrite","result","_runHooks","mergeMap","rxChangeEventBulkToRxChangeEvents","map","checkpoint","createChangeEventBuffer","documentConstructor","DocumentCache","bulk","isLocal","events","docData","getRxDocumentConstructor","createNewRxDocument","listenToRemoveSub","internalStore","changeStream","key","version","found","find","event","documentData","context","operation","subscribe","close","Promise","all","fn","push","databaseStorageToken","storageToken","subDocs","eventBulk","id","internal","databaseToken","token","$emit","PROMISE_RESOLVE_VOID","cleanup","_minimumDeletedTime","ensureRxCollectionIsNotClosed","pluginMissing","migrationNeeded","getMigrationState","startMigration","batchSize","migratePromise","insert","json","writeResult","bulkInsert","isError","error","throwIfIsStorageWriteError","insertResult","ensureNotFalsy","success","docsData","length","ids","insertRows","hasHooks","useDocData","fillObjectDataBeforeInsert","then","add","document","Array","index","size","newRxError","collection","args","documents","results","bulkWrite","rxDocuments","ret","getWrittenDocumentsFromBulkWriteResponse","mapDocumentsDataToCacheDocs","docsMap","forEach","row","doc","set","get","primary","bulkRemove","idsOrDocs","rxDocumentMap","findByIds","exec","d","from","values","rxDocument","data","toMutableJSON","removeDocs","writeDoc","flatClone","_deleted","previous","deletedRxDocuments","successIds","getCachedRxDocument","bulkUpsert","insertData","useJsonByDocId","useJson","slice","err","status","documentId","writeData","getFromMapOrThrow","docDataInDb","documentInDb","getCachedRxDocuments","newDoc","incrementalModify","upsert","bulkResult","incrementalUpsert","queue","_incrementalUpsertEnsureRxDocumentExists","wasInserted","inserted","_incrementalUpsertUpdate","queryObj","runPluginHooks","op","_getDefaultQuery","query","createRxQuery","findOne","selector","limit","count","mangoQuery","$in","exportJSON","importJSON","_exportedJSON","insertCRDT","_updateObj","addPipeline","_options","addHook","when","fun","parallel","newRxTypeError","includes","boundFun","bind","runName","series","getHooks","instance","tasks","hook","promiseSeries","_runHooksSync","promiseWait","time","res","timeout","setTimeout","delete","PROMISE_RESOLVE_FALSE","clearTimeout","requestIdlePromise","sub","unsubscribe","collections","runAsyncPluginHooks","remove","removeCollectionStorages","storage","multiInstance","password","hashFunction","_createClass2","default","cE","colProto","Object","getPrototypeOf","fnName","ucfirst","_innerDoc","rxCollection","docDataFromCache","getLatestDocumentDataIfExists","resolve","createRxCollection","autoMigrate","localDocuments","storageInstanceCreationParams","databaseInstanceToken","databaseName","devMode","overwritable","isDevMode","createRxCollectionStorageInstance","entries","funName","defineProperty","creator","catch","reject","isRxCollection","obj"],"sources":["../../src/rx-collection.ts"],"sourcesContent":["import {\n filter,\n map,\n mergeMap\n} from 'rxjs';\n\nimport {\n ucfirst,\n flatClone,\n promiseSeries,\n pluginMissing,\n ensureNotFalsy,\n getFromMapOrThrow,\n PROMISE_RESOLVE_FALSE,\n PROMISE_RESOLVE_VOID\n} from './plugins/utils/index.ts';\nimport {\n fillObjectDataBeforeInsert,\n createRxCollectionStorageInstance,\n removeCollectionStorages,\n ensureRxCollectionIsNotClosed\n} from './rx-collection-helper.ts';\nimport {\n createRxQuery,\n _getDefaultQuery\n} from './rx-query.ts';\nimport {\n newRxError,\n newRxTypeError\n} from './rx-error.ts';\nimport type {\n RxMigrationState\n} from './plugins/migration-schema/index.ts';\nimport {\n DocumentCache,\n mapDocumentsDataToCacheDocs\n} from './doc-cache.ts';\nimport {\n QueryCache,\n createQueryCache,\n defaultCacheReplacementPolicy\n} from './query-cache.ts';\nimport {\n ChangeEventBuffer,\n createChangeEventBuffer\n} from './change-event-buffer.ts';\nimport {\n runAsyncPluginHooks,\n runPluginHooks\n} from './hooks.ts';\n\nimport {\n Subscription,\n Observable\n} from 'rxjs';\n\nimport type {\n KeyFunctionMap,\n RxCollection,\n RxDatabase,\n RxQuery,\n RxDocument,\n RxDumpCollection,\n RxDumpCollectionAny,\n MangoQuery,\n MangoQueryNoLimit,\n RxCacheReplacementPolicy,\n RxStorageWriteError,\n RxDocumentData,\n RxStorageInstanceCreationParams,\n BulkWriteRow,\n RxChangeEvent,\n RxChangeEventInsert,\n RxChangeEventUpdate,\n RxChangeEventDelete,\n RxStorageInstance,\n CollectionsOfDatabase,\n RxChangeEventBulk,\n RxLocalDocumentData,\n RxDocumentBase,\n RxConflictHandler,\n MaybePromise,\n CRDTEntry,\n MangoQuerySelectorAndIndex,\n MigrationStrategies\n} from './types/index.d.ts';\n\nimport {\n RxSchema\n} from './rx-schema.ts';\n\nimport {\n createNewRxDocument,\n getRxDocumentConstructor\n} from './rx-document-prototype-merge.ts';\nimport {\n getWrappedStorageInstance,\n getWrittenDocumentsFromBulkWriteResponse,\n throwIfIsStorageWriteError,\n WrappedRxStorageInstance\n} from './rx-storage-helper.ts';\nimport { IncrementalWriteQueue } from './incremental-write.ts';\nimport { beforeDocumentUpdateWrite } from './rx-document.ts';\nimport { overwritable } from './overwritable.ts';\nimport type { RxPipeline, RxPipelineOptions } from './plugins/pipeline/index.ts';\nimport { defaultConflictHandler } from './replication-protocol/default-conflict-handler.ts';\nimport { rxChangeEventBulkToRxChangeEvents } from './rx-change-event.ts';\n\nconst HOOKS_WHEN = ['pre', 'post'] as const;\ntype HookWhenType = typeof HOOKS_WHEN[number];\nconst HOOKS_KEYS = ['insert', 'save', 'remove', 'create'] as const;\ntype HookKeyType = typeof HOOKS_KEYS[number];\nlet hooksApplied = false;\n\nexport class RxCollectionBase<\n InstanceCreationOptions,\n RxDocumentType = { [prop: string]: any; },\n OrmMethods = {},\n StaticMethods = { [key: string]: any; },\n Reactivity = any\n> {\n\n\n /**\n * Stores all 'normal' documents\n */\n public storageInstance: WrappedRxStorageInstance = {} as any;\n public readonly timeouts: Set> = new Set();\n public incrementalWriteQueue: IncrementalWriteQueue = {} as any;\n\n\n /**\n * Before reads, all these methods are awaited. Used to \"block\" reads\n * depending on other processes, like when the RxPipeline is running.\n */\n public readonly awaitBeforeReads = new Set<() => MaybePromise>();\n\n constructor(\n public readonly database: RxDatabase,\n public name: string,\n public schema: RxSchema,\n public internalStorageInstance: RxStorageInstance,\n public instanceCreationOptions: InstanceCreationOptions = {} as any,\n public migrationStrategies: MigrationStrategies = {},\n public methods: KeyFunctionMap = {},\n public attachments: KeyFunctionMap = {},\n public options: any = {},\n public cacheReplacementPolicy: RxCacheReplacementPolicy = defaultCacheReplacementPolicy,\n public statics: KeyFunctionMap = {},\n public conflictHandler: RxConflictHandler = defaultConflictHandler\n ) {\n _applyHookFunctions(this.asRxCollection);\n\n\n if (database) { // might be falsy on pseudoInstance\n this.eventBulks$ = database.eventBulks$.pipe(\n filter(changeEventBulk => changeEventBulk.collectionName === this.name)\n );\n } else { }\n }\n\n get insert$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'INSERT')\n ) as any;\n }\n get update$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'UPDATE')\n ) as any;\n }\n get remove$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'DELETE')\n ) as any;\n }\n\n public _incrementalUpsertQueues: Map> = new Map();\n // defaults\n public synced: boolean = false;\n public hooks: {\n [key in HookKeyType]: {\n [when in HookWhenType]: {\n series: Function[];\n parallel: Function[];\n };\n }\n } = {} as any;\n public _subs: Subscription[] = [];\n\n public _docCache: DocumentCache = {} as any;\n\n public _queryCache: QueryCache = createQueryCache();\n public $: Observable> = {} as any;\n public checkpoint$: Observable = {} as any;\n public _changeEventBuffer: ChangeEventBuffer = {} as ChangeEventBuffer;\n\n /**\n * Internally only use eventBulks$\n * Do not use .$ or .observable$ because that has to transform\n * the events which decreases performance.\n */\n public readonly eventBulks$: Observable> = {} as any;\n\n\n /**\n * When the collection is closed,\n * these functions will be called an awaited.\n * Used to automatically clean up stuff that\n * belongs to this collection.\n */\n public onClose: (() => MaybePromise)[] = [];\n public closed = false;\n\n public onRemove: (() => MaybePromise)[] = [];\n\n public async prepare(): Promise {\n this.storageInstance = getWrappedStorageInstance(\n this.database,\n this.internalStorageInstance,\n this.schema.jsonSchema\n );\n this.incrementalWriteQueue = new IncrementalWriteQueue(\n this.storageInstance,\n this.schema.primaryPath,\n (newData, oldData) => beforeDocumentUpdateWrite(this as any, newData, oldData),\n result => this._runHooks('post', 'save', result)\n );\n\n this.$ = this.eventBulks$.pipe(\n mergeMap(changeEventBulk => rxChangeEventBulkToRxChangeEvents(changeEventBulk)),\n );\n this.checkpoint$ = this.eventBulks$.pipe(\n map(changeEventBulk => changeEventBulk.checkpoint),\n );\n\n this._changeEventBuffer = createChangeEventBuffer(this.asRxCollection);\n let documentConstructor: any;\n this._docCache = new DocumentCache(\n this.schema.primaryPath,\n this.eventBulks$.pipe(\n filter(bulk => !bulk.isLocal),\n map(bulk => bulk.events)\n ),\n docData => {\n if (!documentConstructor) {\n documentConstructor = getRxDocumentConstructor(this.asRxCollection);\n }\n return createNewRxDocument(this.asRxCollection, documentConstructor, docData);\n }\n );\n\n\n const listenToRemoveSub = this.database.internalStore.changeStream().pipe(\n filter(bulk => {\n const key = this.name + '-' + this.schema.version;\n const found = bulk.events.find(event => {\n return (\n event.documentData.context === 'collection' &&\n event.documentData.key === key &&\n event.operation === 'DELETE'\n );\n });\n return !!found;\n })\n ).subscribe(async () => {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n });\n this._subs.push(listenToRemoveSub);\n\n\n const databaseStorageToken = await this.database.storageToken;\n const subDocs = this.storageInstance.changeStream().subscribe(eventBulk => {\n const changeEventBulk: RxChangeEventBulk = {\n id: eventBulk.id,\n isLocal: false,\n internal: false,\n collectionName: this.name,\n storageToken: databaseStorageToken,\n events: eventBulk.events,\n databaseToken: this.database.token,\n checkpoint: eventBulk.checkpoint,\n context: eventBulk.context\n };\n this.database.$emit(changeEventBulk);\n });\n this._subs.push(subDocs);\n\n return PROMISE_RESOLVE_VOID;\n }\n\n\n /**\n * Manually call the cleanup function of the storage.\n * @link https://rxdb.info/cleanup.html\n */\n cleanup(_minimumDeletedTime?: number): Promise {\n ensureRxCollectionIsNotClosed(this);\n throw pluginMissing('cleanup');\n }\n\n // overwritten by migration-plugin\n migrationNeeded(): Promise {\n throw pluginMissing('migration-schema');\n }\n getMigrationState(): RxMigrationState {\n throw pluginMissing('migration-schema');\n }\n startMigration(batchSize: number = 10): Promise {\n ensureRxCollectionIsNotClosed(this);\n return this.getMigrationState().startMigration(batchSize);\n }\n migratePromise(batchSize: number = 10): Promise {\n return this.getMigrationState().migratePromise(batchSize);\n }\n\n async insert(\n json: RxDocumentType | RxDocument\n ): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const writeResult = await this.bulkInsert([json as any]);\n\n const isError = writeResult.error[0];\n throwIfIsStorageWriteError(this as any, (json as any)[this.schema.primaryPath] as any, json, isError as any);\n const insertResult = ensureNotFalsy(writeResult.success[0]);\n return insertResult;\n }\n\n async bulkInsert(\n docsData: RxDocumentType[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (docsData.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n const primaryPath = this.schema.primaryPath;\n\n const ids = new Set();\n\n /**\n * This code is a bit redundant for better performance.\n * Instead of iterating multiple times,\n * we directly transform the input to a write-row array.\n */\n let insertRows: BulkWriteRow[];\n if (this.hasHooks('pre', 'insert')) {\n insertRows = await Promise.all(\n docsData.map(docData => {\n const useDocData = fillObjectDataBeforeInsert(this.schema, docData);\n return this._runHooks('pre', 'insert', useDocData)\n .then(() => {\n ids.add((useDocData as any)[primaryPath]);\n return { document: useDocData };\n });\n })\n );\n } else {\n insertRows = new Array(docsData.length);\n const schema = this.schema;\n for (let index = 0; index < docsData.length; index++) {\n const docData = docsData[index];\n const useDocData = fillObjectDataBeforeInsert(schema, docData);\n ids.add((useDocData as any)[primaryPath]);\n insertRows[index] = { document: useDocData };\n }\n }\n\n\n if (ids.size !== docsData.length) {\n throw newRxError('COL22', {\n collection: this.name,\n args: {\n documents: docsData\n }\n });\n }\n\n const results = await this.storageInstance.bulkWrite(\n insertRows,\n 'rx-collection-bulk-insert'\n );\n\n\n /**\n * Often the user does not need to access the RxDocuments of the bulkInsert() call.\n * So we transform the data to RxDocuments only if needed to use less CPU performance.\n */\n let rxDocuments: RxDocument[];\n const collection = this;\n const ret = {\n get success() {\n if (!rxDocuments) {\n const success = getWrittenDocumentsFromBulkWriteResponse(\n collection.schema.primaryPath,\n insertRows,\n results\n );\n rxDocuments = mapDocumentsDataToCacheDocs(collection._docCache, success);\n }\n return rxDocuments;\n },\n error: results.error\n };\n\n if (this.hasHooks('post', 'insert')) {\n const docsMap: Map = new Map();\n insertRows.forEach(row => {\n const doc = row.document;\n docsMap.set((doc as any)[primaryPath] as any, doc);\n });\n await Promise.all(\n ret.success.map(doc => {\n return this._runHooks(\n 'post',\n 'insert',\n docsMap.get(doc.primary),\n doc\n );\n })\n );\n }\n\n return ret;\n }\n\n async bulkRemove(\n /**\n * You can either remove the documents by their ids\n * or by directly providing the RxDocument instances\n * if you have them already. This improves performance a bit.\n */\n idsOrDocs: string[] | RxDocument[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const primaryPath = this.schema.primaryPath;\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (idsOrDocs.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n let rxDocumentMap: Map>;\n if (typeof idsOrDocs[0] === 'string') {\n rxDocumentMap = await this.findByIds(idsOrDocs as string[]).exec();\n } else {\n rxDocumentMap = new Map();\n (idsOrDocs as RxDocument[]).forEach(d => rxDocumentMap.set(d.primary, d));\n }\n\n const docsData: RxDocumentData[] = [];\n const docsMap: Map> = new Map();\n Array.from(rxDocumentMap.values()).forEach(rxDocument => {\n const data: RxDocumentData = rxDocument.toMutableJSON(true) as any;\n docsData.push(data);\n docsMap.set(rxDocument.primary, data);\n });\n\n await Promise.all(\n docsData.map(doc => {\n const primary = (doc as any)[this.schema.primaryPath];\n return this._runHooks('pre', 'remove', doc, rxDocumentMap.get(primary));\n })\n );\n const removeDocs: BulkWriteRow[] = docsData.map(doc => {\n const writeDoc = flatClone(doc);\n writeDoc._deleted = true;\n return {\n previous: doc,\n document: writeDoc\n };\n });\n const results = await this.storageInstance.bulkWrite(\n removeDocs,\n 'rx-collection-bulk-remove'\n );\n\n\n const success = getWrittenDocumentsFromBulkWriteResponse(\n this.schema.primaryPath,\n removeDocs,\n results\n );\n\n const deletedRxDocuments: RxDocument[] = [];\n const successIds: string[] = success.map(d => {\n const id = d[primaryPath] as string;\n const doc = this._docCache.getCachedRxDocument(d);\n deletedRxDocuments.push(doc);\n return id;\n });\n\n // run hooks\n await Promise.all(\n successIds.map(id => {\n return this._runHooks(\n 'post',\n 'remove',\n docsMap.get(id),\n rxDocumentMap.get(id)\n );\n })\n );\n\n\n return {\n success: deletedRxDocuments,\n error: results.error\n };\n }\n\n /**\n * same as bulkInsert but overwrites existing document with same primary\n */\n async bulkUpsert(docsData: Partial[]): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const insertData: RxDocumentType[] = [];\n const useJsonByDocId: Map = new Map();\n docsData.forEach(docData => {\n const useJson = fillObjectDataBeforeInsert(this.schema, docData);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL3', {\n primaryPath: this.schema.primaryPath as string,\n data: useJson,\n schema: this.schema.jsonSchema\n });\n }\n useJsonByDocId.set(primary, useJson);\n insertData.push(useJson);\n });\n\n const insertResult = await this.bulkInsert(insertData);\n const success = insertResult.success.slice(0);\n const error: RxStorageWriteError[] = [];\n\n // update the ones that existed already\n await Promise.all(\n insertResult.error.map(async (err) => {\n if (err.status !== 409) {\n error.push(err);\n } else {\n const id = err.documentId;\n const writeData = getFromMapOrThrow(useJsonByDocId, id);\n const docDataInDb = ensureNotFalsy(err.documentInDb);\n const doc = this._docCache.getCachedRxDocuments([docDataInDb])[0];\n const newDoc = await doc.incrementalModify(() => writeData);\n success.push(newDoc);\n }\n })\n );\n return {\n error,\n success\n };\n }\n\n /**\n * same as insert but overwrites existing document with same primary\n */\n async upsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const bulkResult = await this.bulkUpsert([json]);\n throwIfIsStorageWriteError(\n this.asRxCollection,\n (json as any)[this.schema.primaryPath],\n json as any,\n bulkResult.error[0]\n );\n return bulkResult.success[0];\n }\n\n /**\n * upserts to a RxDocument, uses incrementalModify if document already exists\n */\n incrementalUpsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const useJson = fillObjectDataBeforeInsert(this.schema, json);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL4', {\n data: json\n });\n }\n\n // ensure that it won't try 2 parallel runs\n let queue = this._incrementalUpsertQueues.get(primary);\n if (!queue) {\n queue = PROMISE_RESOLVE_VOID;\n }\n queue = queue\n .then(() => _incrementalUpsertEnsureRxDocumentExists(this as any, primary as any, useJson))\n .then((wasInserted) => {\n if (!wasInserted.inserted) {\n return _incrementalUpsertUpdate(wasInserted.doc, useJson);\n } else {\n return wasInserted.doc;\n }\n });\n this._incrementalUpsertQueues.set(primary, queue);\n return queue;\n }\n\n find(queryObj?: MangoQuery): RxQuery<\n RxDocumentType,\n RxDocument[],\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'find',\n queryObj,\n collection: this\n });\n\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n const query = createRxQuery('find', queryObj, this as any);\n return query as any;\n }\n\n findOne(\n queryObj?: MangoQueryNoLimit | string\n ): RxQuery<\n RxDocumentType,\n RxDocument | null,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'findOne',\n queryObj,\n collection: this\n });\n\n let query;\n\n if (typeof queryObj === 'string') {\n query = createRxQuery('findOne', {\n selector: {\n [this.schema.primaryPath]: queryObj\n },\n limit: 1\n }, this as any);\n } else {\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n // cannot have limit on findOne queries because it will be overwritten\n if ((queryObj as MangoQuery).limit) {\n throw newRxError('QU6');\n }\n\n queryObj = flatClone(queryObj);\n (queryObj as any).limit = 1;\n query = createRxQuery('findOne', queryObj, this as any);\n }\n\n\n return query as any;\n }\n\n count(queryObj?: MangoQuerySelectorAndIndex): RxQuery<\n RxDocumentType,\n number,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n const query = createRxQuery('count', queryObj, this as any);\n return query as any;\n }\n\n /**\n * find a list documents by their primary key\n * has way better performance then running multiple findOne() or a find() with a complex $or-selected\n */\n findByIds(\n ids: string[]\n ): RxQuery<\n RxDocumentType,\n Map>,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n const mangoQuery: MangoQuery = {\n selector: {\n [this.schema.primaryPath]: {\n $in: ids.slice(0)\n }\n } as any\n };\n const query = createRxQuery('findByIds', mangoQuery, this as any);\n return query as any;\n }\n\n /**\n * Export collection to a JSON friendly format.\n */\n exportJSON(): Promise>;\n exportJSON(): Promise>;\n exportJSON(): Promise {\n throw pluginMissing('json-dump');\n }\n\n /**\n * Import the parsed JSON export into the collection.\n * @param _exportedJSON The previously exported data from the `.exportJSON()` method.\n */\n importJSON(_exportedJSON: RxDumpCollectionAny): Promise {\n throw pluginMissing('json-dump');\n }\n\n insertCRDT(_updateObj: CRDTEntry | CRDTEntry[]): RxDocument {\n throw pluginMissing('crdt');\n }\n\n\n addPipeline(_options: RxPipelineOptions): Promise> {\n throw pluginMissing('pipeline');\n }\n\n /**\n * HOOKS\n */\n addHook(when: HookWhenType, key: HookKeyType, fun: any, parallel = false) {\n if (typeof fun !== 'function') {\n throw newRxTypeError('COL7', {\n key,\n when\n });\n }\n\n if (!HOOKS_WHEN.includes(when)) {\n throw newRxTypeError('COL8', {\n key,\n when\n });\n }\n\n if (!HOOKS_KEYS.includes(key)) {\n throw newRxError('COL9', {\n key\n });\n }\n\n if (when === 'post' && key === 'create' && parallel === true) {\n throw newRxError('COL10', {\n when,\n key,\n parallel\n });\n }\n\n // bind this-scope to hook-function\n const boundFun = fun.bind(this);\n\n const runName = parallel ? 'parallel' : 'series';\n\n this.hooks[key] = this.hooks[key] || {};\n this.hooks[key][when] = this.hooks[key][when] || {\n series: [],\n parallel: []\n };\n this.hooks[key][when][runName].push(boundFun);\n }\n\n getHooks(when: HookWhenType, key: HookKeyType) {\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return {\n series: [],\n parallel: []\n };\n }\n return this.hooks[key][when];\n }\n\n hasHooks(when: HookWhenType, key: HookKeyType) {\n /**\n * Performance shortcut\n * so that we not have to build the empty object.\n */\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return false;\n }\n\n const hooks = this.getHooks(when, key);\n if (!hooks) {\n return false;\n }\n return hooks.series.length > 0 || hooks.parallel.length > 0;\n }\n\n _runHooks(when: HookWhenType, key: HookKeyType, data: any, instance?: any): Promise {\n const hooks = this.getHooks(when, key);\n\n if (!hooks) {\n return PROMISE_RESOLVE_VOID;\n }\n\n // run parallel: false\n const tasks = hooks.series.map((hook: any) => () => hook(data, instance));\n return promiseSeries(tasks)\n // run parallel: true\n .then(() => Promise.all(\n hooks.parallel\n .map((hook: any) => hook(data, instance))\n ));\n }\n\n /**\n * does the same as ._runHooks() but with non-async-functions\n */\n _runHooksSync(when: HookWhenType, key: HookKeyType, data: any, instance: any) {\n if (!this.hasHooks(when, key)) {\n return;\n }\n const hooks = this.getHooks(when, key);\n if (!hooks) return;\n hooks.series.forEach((hook: any) => hook(data, instance));\n }\n\n /**\n * Returns a promise that resolves after the given time.\n * Ensures that is properly cleans up when the collection is closed\n * so that no running timeouts prevent the exit of the JavaScript process.\n */\n promiseWait(time: number): Promise {\n const ret = new Promise(res => {\n const timeout = setTimeout(() => {\n this.timeouts.delete(timeout);\n res();\n }, time);\n this.timeouts.add(timeout);\n });\n return ret;\n }\n\n async close(): Promise {\n if (this.closed) {\n return PROMISE_RESOLVE_FALSE;\n }\n\n\n await Promise.all(this.onClose.map(fn => fn()));\n\n /**\n * Settings closed = true\n * must be the first thing to do,\n * so for example the replication can directly stop\n * instead of sending requests to a closed storage.\n */\n this.closed = true;\n\n\n Array.from(this.timeouts).forEach(timeout => clearTimeout(timeout));\n if (this._changeEventBuffer) {\n this._changeEventBuffer.close();\n }\n /**\n * First wait until the whole database is idle.\n * This ensures that the storage does not get closed\n * while some operation is running.\n * It is important that we do not intercept a running call\n * because it might lead to undefined behavior like when a doc is written\n * but the change is not added to the changes collection.\n */\n return this.database.requestIdlePromise()\n .then(() => this.storageInstance.close())\n .then(() => {\n /**\n * Unsubscribing must be done AFTER the storageInstance.close()\n * Because the conflict handling is part of the subscriptions and\n * otherwise there might be open conflicts to be resolved which\n * will then stuck and never resolve.\n */\n this._subs.forEach(sub => sub.unsubscribe());\n\n delete this.database.collections[this.name];\n return runAsyncPluginHooks('postCloseRxCollection', this).then(() => true);\n });\n }\n\n /**\n * remove all data of the collection\n */\n async remove(): Promise {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n /**\n * TODO here we should pass the already existing\n * storage instances instead of creating new ones.\n */\n await removeCollectionStorages(\n this.database.storage,\n this.database.internalStore,\n this.database.token,\n this.database.name,\n this.name,\n this.database.multiInstance,\n this.database.password,\n this.database.hashFunction\n );\n }\n\n get asRxCollection(): RxCollection {\n return this as any;\n }\n}\n\n/**\n * adds the hook-functions to the collections prototype\n * this runs only once\n */\nfunction _applyHookFunctions(\n collection: RxCollection\n) {\n if (hooksApplied) return; // already run\n hooksApplied = true;\n const colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(key => {\n HOOKS_WHEN.map(when => {\n const fnName = when + ucfirst(key);\n colProto[fnName] = function (fun: string, parallel: boolean) {\n return this.addHook(when, key, fun, parallel);\n };\n });\n });\n}\n\nfunction _incrementalUpsertUpdate(\n doc: RxDocumentBase,\n json: RxDocumentData\n): Promise> {\n return doc.incrementalModify((_innerDoc) => {\n return json;\n });\n}\n\n/**\n * ensures that the given document exists\n * @return promise that resolves with new doc and flag if inserted\n */\nfunction _incrementalUpsertEnsureRxDocumentExists(\n rxCollection: RxCollection,\n primary: string,\n json: any\n): Promise<\n {\n doc: RxDocument;\n inserted: boolean;\n }\n> {\n /**\n * Optimisation shortcut,\n * first try to find the document in the doc-cache\n */\n const docDataFromCache = rxCollection._docCache.getLatestDocumentDataIfExists(primary);\n if (docDataFromCache) {\n return Promise.resolve({\n doc: rxCollection._docCache.getCachedRxDocuments([docDataFromCache])[0],\n inserted: false\n });\n }\n return rxCollection.findOne(primary).exec()\n .then(doc => {\n if (!doc) {\n return rxCollection.insert(json).then(newDoc => ({\n doc: newDoc,\n inserted: true\n }));\n } else {\n return {\n doc,\n inserted: false\n };\n }\n });\n}\n\n/**\n * creates and prepares a new collection\n */\nexport function createRxCollection(\n {\n database,\n name,\n schema,\n instanceCreationOptions = {},\n migrationStrategies = {},\n autoMigrate = true,\n statics = {},\n methods = {},\n attachments = {},\n options = {},\n localDocuments = false,\n cacheReplacementPolicy = defaultCacheReplacementPolicy,\n conflictHandler = defaultConflictHandler\n }: any\n): Promise {\n const storageInstanceCreationParams: RxStorageInstanceCreationParams = {\n databaseInstanceToken: database.token,\n databaseName: database.name,\n collectionName: name,\n schema: schema.jsonSchema,\n options: instanceCreationOptions,\n multiInstance: database.multiInstance,\n password: database.password,\n devMode: overwritable.isDevMode()\n };\n\n runPluginHooks(\n 'preCreateRxStorageInstance',\n storageInstanceCreationParams\n );\n\n return createRxCollectionStorageInstance(\n database,\n storageInstanceCreationParams\n ).then(storageInstance => {\n const collection = new RxCollectionBase(\n database,\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n statics,\n conflictHandler\n );\n\n return collection\n .prepare()\n .then(() => {\n // ORM add statics\n Object\n .entries(statics)\n .forEach(([funName, fun]) => {\n Object.defineProperty(collection, funName, {\n get: () => (fun as any).bind(collection)\n });\n });\n\n let ret = PROMISE_RESOLVE_VOID;\n if (autoMigrate && collection.schema.version !== 0) {\n ret = collection.migratePromise();\n }\n return ret;\n })\n .then(() => {\n runPluginHooks('createRxCollection', {\n collection,\n creator: {\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n localDocuments,\n statics\n }\n });\n return collection as any;\n })\n /**\n * If the collection creation fails,\n * we yet have to close the storage instances.\n */\n .catch(err => {\n return storageInstance.close()\n .then(() => Promise.reject(err as Error));\n });\n });\n}\n\nexport function isRxCollection(obj: any): boolean {\n return obj instanceof RxCollectionBase;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAUA,IAAAE,mBAAA,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IAAI,CAACpF,UAAU;QAC3C,CAAC,CAAC;MACN,CAAC,CAAC;MAEN,IAAIM,GAAG,GAAGxC,2BAAoB;MAC9B,IAAIgK,WAAW,IAAI9H,UAAU,CAACxH,MAAM,CAACgE,OAAO,KAAK,CAAC,EAAE;QAChD8D,GAAG,GAAGN,UAAU,CAACzB,cAAc,CAAC,CAAC;MACrC;MACA,OAAO+B,GAAG;IACd,CAAC,CAAC,CACDb,IAAI,CAAC,MAAM;MACR,IAAAkE,qBAAc,EAAC,oBAAoB,EAAE;QACjC3D,UAAU;QACV0I,OAAO,EAAE;UACLnQ,IAAI;UACJC,MAAM;UACNY,eAAe;UACfV,uBAAuB;UACvBC,mBAAmB;UACnBC,OAAO;UACPC,WAAW;UACXC,OAAO;UACPC,sBAAsB;UACtBgP,cAAc;UACd9O;QACJ;MACJ,CAAC,CAAC;MACF,OAAO+G,UAAU;IACrB,CAAC;IACD;AACZ;AACA;AACA,OAHY,CAIC2I,KAAK,CAACnG,GAAG,IAAI;MACV,OAAOpJ,eAAe,CAAC4D,KAAK,CAAC,CAAC,CACzByC,IAAI,CAAC,MAAMxC,OAAO,CAAC2L,MAAM,CAACpG,GAAY,CAAC,CAAC;IACjD,CAAC,CAAC;EACV,CAAC,CAAC;AACN;AAEO,SAASqG,cAAcA,CAACC,GAAQ,EAAW;EAC9C,OAAOA,GAAG,YAAY1Q,gBAAgB;AAC1C","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"rx-collection.js","names":["_rxjs","require","_index","_rxCollectionHelper","_rxQuery","_rxError","_docCache","_queryCache","_changeEventBuffer","_hooks","_rxDocumentPrototypeMerge","_rxStorageHelper","_incrementalWrite","_rxDocument","_overwritable","_defaultConflictHandler","_rxChangeEvent","HOOKS_WHEN","HOOKS_KEYS","hooksApplied","OPEN_COLLECTIONS","exports","Set","RxCollectionBase","database","name","schema","internalStorageInstance","instanceCreationOptions","migrationStrategies","methods","attachments","options","cacheReplacementPolicy","defaultCacheReplacementPolicy","statics","conflictHandler","defaultConflictHandler","storageInstance","timeouts","incrementalWriteQueue","awaitBeforeReads","_incrementalUpsertQueues","Map","synced","hooks","_subs","createQueryCache","$","checkpoint$","eventBulks$","onClose","closed","onRemove","_applyHookFunctions","asRxCollection","pipe","filter","changeEventBulk","collectionName","add","_proto","prototype","prepare","hasPremiumFlag","count","size","NON_PREMIUM_COLLECTION_LIMIT","promiseWait","newRxError","collection","args","existing","Array","from","values","map","c","db","getWrappedStorageInstance","jsonSchema","IncrementalWriteQueue","primaryPath","newData","oldData","beforeDocumentUpdateWrite","result","_runHooks","mergeMap","rxChangeEventBulkToRxChangeEvents","checkpoint","createChangeEventBuffer","documentConstructor","DocumentCache","bulk","isLocal","events","docData","getRxDocumentConstructor","createNewRxDocument","listenToRemoveSub","internalStore","changeStream","key","version","found","find","event","documentData","context","operation","subscribe","close","Promise","all","fn","push","databaseStorageToken","storageToken","subDocs","eventBulk","id","internal","databaseToken","token","$emit","PROMISE_RESOLVE_VOID","cleanup","_minimumDeletedTime","ensureRxCollectionIsNotClosed","pluginMissing","migrationNeeded","getMigrationState","startMigration","batchSize","migratePromise","insert","json","writeResult","bulkInsert","isError","error","throwIfIsStorageWriteError","insertResult","ensureNotFalsy","success","docsData","length","ids","insertRows","hasHooks","useDocData","fillObjectDataBeforeInsert","then","document","index","documents","results","bulkWrite","rxDocuments","ret","getWrittenDocumentsFromBulkWriteResponse","mapDocumentsDataToCacheDocs","docsMap","forEach","row","doc","set","get","primary","bulkRemove","idsOrDocs","rxDocumentMap","findByIds","exec","d","rxDocument","data","toMutableJSON","removeDocs","writeDoc","flatClone","_deleted","previous","deletedRxDocuments","successIds","getCachedRxDocument","bulkUpsert","insertData","useJsonByDocId","useJson","slice","err","status","documentId","writeData","getFromMapOrThrow","docDataInDb","documentInDb","getCachedRxDocuments","newDoc","incrementalModify","upsert","bulkResult","incrementalUpsert","queue","_incrementalUpsertEnsureRxDocumentExists","wasInserted","inserted","_incrementalUpsertUpdate","queryObj","runPluginHooks","op","_getDefaultQuery","query","createRxQuery","findOne","selector","limit","mangoQuery","$in","exportJSON","importJSON","_exportedJSON","insertCRDT","_updateObj","addPipeline","_options","addHook","when","fun","parallel","newRxTypeError","includes","boundFun","bind","runName","series","getHooks","instance","tasks","hook","promiseSeries","_runHooksSync","time","res","timeout","setTimeout","delete","PROMISE_RESOLVE_FALSE","clearTimeout","requestIdlePromise","sub","unsubscribe","collections","runAsyncPluginHooks","remove","removeCollectionStorages","storage","multiInstance","password","hashFunction","_createClass2","default","cE","colProto","Object","getPrototypeOf","fnName","ucfirst","_innerDoc","rxCollection","docDataFromCache","getLatestDocumentDataIfExists","resolve","createRxCollection","autoMigrate","localDocuments","storageInstanceCreationParams","databaseInstanceToken","databaseName","devMode","overwritable","isDevMode","createRxCollectionStorageInstance","entries","funName","defineProperty","creator","catch","reject","isRxCollection","obj"],"sources":["../../src/rx-collection.ts"],"sourcesContent":["import {\n filter,\n map,\n mergeMap\n} from 'rxjs';\n\nimport {\n ucfirst,\n flatClone,\n promiseSeries,\n pluginMissing,\n ensureNotFalsy,\n getFromMapOrThrow,\n PROMISE_RESOLVE_FALSE,\n PROMISE_RESOLVE_VOID,\n NON_PREMIUM_COLLECTION_LIMIT,\n hasPremiumFlag\n} from './plugins/utils/index.ts';\nimport {\n fillObjectDataBeforeInsert,\n createRxCollectionStorageInstance,\n removeCollectionStorages,\n ensureRxCollectionIsNotClosed\n} from './rx-collection-helper.ts';\nimport {\n createRxQuery,\n _getDefaultQuery\n} from './rx-query.ts';\nimport {\n newRxError,\n newRxTypeError\n} from './rx-error.ts';\nimport type {\n RxMigrationState\n} from './plugins/migration-schema/index.ts';\nimport {\n DocumentCache,\n mapDocumentsDataToCacheDocs\n} from './doc-cache.ts';\nimport {\n QueryCache,\n createQueryCache,\n defaultCacheReplacementPolicy\n} from './query-cache.ts';\nimport {\n ChangeEventBuffer,\n createChangeEventBuffer\n} from './change-event-buffer.ts';\nimport {\n runAsyncPluginHooks,\n runPluginHooks\n} from './hooks.ts';\n\nimport {\n Subscription,\n Observable\n} from 'rxjs';\n\nimport type {\n KeyFunctionMap,\n RxCollection,\n RxDatabase,\n RxQuery,\n RxDocument,\n RxDumpCollection,\n RxDumpCollectionAny,\n MangoQuery,\n MangoQueryNoLimit,\n RxCacheReplacementPolicy,\n RxStorageWriteError,\n RxDocumentData,\n RxStorageInstanceCreationParams,\n BulkWriteRow,\n RxChangeEvent,\n RxChangeEventInsert,\n RxChangeEventUpdate,\n RxChangeEventDelete,\n RxStorageInstance,\n CollectionsOfDatabase,\n RxChangeEventBulk,\n RxLocalDocumentData,\n RxDocumentBase,\n RxConflictHandler,\n MaybePromise,\n CRDTEntry,\n MangoQuerySelectorAndIndex,\n MigrationStrategies\n} from './types/index.d.ts';\n\nimport {\n RxSchema\n} from './rx-schema.ts';\n\nimport {\n createNewRxDocument,\n getRxDocumentConstructor\n} from './rx-document-prototype-merge.ts';\nimport {\n getWrappedStorageInstance,\n getWrittenDocumentsFromBulkWriteResponse,\n throwIfIsStorageWriteError,\n WrappedRxStorageInstance\n} from './rx-storage-helper.ts';\nimport { IncrementalWriteQueue } from './incremental-write.ts';\nimport { beforeDocumentUpdateWrite } from './rx-document.ts';\nimport { overwritable } from './overwritable.ts';\nimport type { RxPipeline, RxPipelineOptions } from './plugins/pipeline/index.ts';\nimport { defaultConflictHandler } from './replication-protocol/default-conflict-handler.ts';\nimport { rxChangeEventBulkToRxChangeEvents } from './rx-change-event.ts';\n\nconst HOOKS_WHEN = ['pre', 'post'] as const;\ntype HookWhenType = typeof HOOKS_WHEN[number];\nconst HOOKS_KEYS = ['insert', 'save', 'remove', 'create'] as const;\ntype HookKeyType = typeof HOOKS_KEYS[number];\nlet hooksApplied = false;\n\nexport const OPEN_COLLECTIONS = new Set>();\n\nexport class RxCollectionBase<\n InstanceCreationOptions,\n RxDocumentType = { [prop: string]: any; },\n OrmMethods = {},\n StaticMethods = { [key: string]: any; },\n Reactivity = any\n> {\n\n\n /**\n * Stores all 'normal' documents\n */\n public storageInstance: WrappedRxStorageInstance = {} as any;\n public readonly timeouts: Set> = new Set();\n public incrementalWriteQueue: IncrementalWriteQueue = {} as any;\n\n\n /**\n * Before reads, all these methods are awaited. Used to \"block\" reads\n * depending on other processes, like when the RxPipeline is running.\n */\n public readonly awaitBeforeReads = new Set<() => MaybePromise>();\n\n constructor(\n public readonly database: RxDatabase,\n public name: string,\n public schema: RxSchema,\n public internalStorageInstance: RxStorageInstance,\n public instanceCreationOptions: InstanceCreationOptions = {} as any,\n public migrationStrategies: MigrationStrategies = {},\n public methods: KeyFunctionMap = {},\n public attachments: KeyFunctionMap = {},\n public options: any = {},\n public cacheReplacementPolicy: RxCacheReplacementPolicy = defaultCacheReplacementPolicy,\n public statics: KeyFunctionMap = {},\n public conflictHandler: RxConflictHandler = defaultConflictHandler\n ) {\n _applyHookFunctions(this.asRxCollection);\n\n\n if (database) { // might be falsy on pseudoInstance\n this.eventBulks$ = database.eventBulks$.pipe(\n filter(changeEventBulk => changeEventBulk.collectionName === this.name)\n );\n } else { }\n\n\n /**\n * Must be last because the hooks might throw on dev-mode\n * checks and we do not want to have broken collections here.\n * RxCollection instances created for testings do not have a database\n * so we do not add these to the list.\n */\n if (this.database) {\n OPEN_COLLECTIONS.add(this);\n }\n }\n\n get insert$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'INSERT')\n ) as any;\n }\n get update$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'UPDATE')\n ) as any;\n }\n get remove$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'DELETE')\n ) as any;\n }\n\n public _incrementalUpsertQueues: Map> = new Map();\n // defaults\n public synced: boolean = false;\n public hooks: {\n [key in HookKeyType]: {\n [when in HookWhenType]: {\n series: Function[];\n parallel: Function[];\n };\n }\n } = {} as any;\n public _subs: Subscription[] = [];\n\n public _docCache: DocumentCache = {} as any;\n\n public _queryCache: QueryCache = createQueryCache();\n public $: Observable> = {} as any;\n public checkpoint$: Observable = {} as any;\n public _changeEventBuffer: ChangeEventBuffer = {} as ChangeEventBuffer;\n\n /**\n * Internally only use eventBulks$\n * Do not use .$ or .observable$ because that has to transform\n * the events which decreases performance.\n */\n public readonly eventBulks$: Observable> = {} as any;\n\n\n /**\n * When the collection is closed,\n * these functions will be called an awaited.\n * Used to automatically clean up stuff that\n * belongs to this collection.\n */\n public onClose: (() => MaybePromise)[] = [];\n public closed = false;\n\n public onRemove: (() => MaybePromise)[] = [];\n\n public async prepare(): Promise {\n\n if (!(await hasPremiumFlag())) {\n\n /**\n * When used in a test suite, we often open and close many databases with collections\n * while not awaiting the database.close() call to improve the test times.\n * So when reopening collections and the OPEN_COLLECTIONS size is full,\n * we retry after some times to account for this.\n */\n let count = 0;\n while (count < 10 && OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) {\n count++;\n await this.promiseWait(30);\n }\n if (OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) {\n throw newRxError('COL23', {\n database: this.database.name,\n collection: this.name,\n args: {\n existing: Array.from(OPEN_COLLECTIONS.values()).map(c => ({\n db: c.database ? c.database.name : '',\n c: c.name\n }))\n }\n });\n }\n }\n\n\n this.storageInstance = getWrappedStorageInstance(\n this.database,\n this.internalStorageInstance,\n this.schema.jsonSchema\n );\n this.incrementalWriteQueue = new IncrementalWriteQueue(\n this.storageInstance,\n this.schema.primaryPath,\n (newData, oldData) => beforeDocumentUpdateWrite(this as any, newData, oldData),\n result => this._runHooks('post', 'save', result)\n );\n\n this.$ = this.eventBulks$.pipe(\n mergeMap(changeEventBulk => rxChangeEventBulkToRxChangeEvents(changeEventBulk)),\n );\n this.checkpoint$ = this.eventBulks$.pipe(\n map(changeEventBulk => changeEventBulk.checkpoint),\n );\n\n this._changeEventBuffer = createChangeEventBuffer(this.asRxCollection);\n let documentConstructor: any;\n this._docCache = new DocumentCache(\n this.schema.primaryPath,\n this.eventBulks$.pipe(\n filter(bulk => !bulk.isLocal),\n map(bulk => bulk.events)\n ),\n docData => {\n if (!documentConstructor) {\n documentConstructor = getRxDocumentConstructor(this.asRxCollection);\n }\n return createNewRxDocument(this.asRxCollection, documentConstructor, docData);\n }\n );\n\n\n const listenToRemoveSub = this.database.internalStore.changeStream().pipe(\n filter(bulk => {\n const key = this.name + '-' + this.schema.version;\n const found = bulk.events.find(event => {\n return (\n event.documentData.context === 'collection' &&\n event.documentData.key === key &&\n event.operation === 'DELETE'\n );\n });\n return !!found;\n })\n ).subscribe(async () => {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n });\n this._subs.push(listenToRemoveSub);\n\n\n const databaseStorageToken = await this.database.storageToken;\n const subDocs = this.storageInstance.changeStream().subscribe(eventBulk => {\n const changeEventBulk: RxChangeEventBulk = {\n id: eventBulk.id,\n isLocal: false,\n internal: false,\n collectionName: this.name,\n storageToken: databaseStorageToken,\n events: eventBulk.events,\n databaseToken: this.database.token,\n checkpoint: eventBulk.checkpoint,\n context: eventBulk.context\n };\n this.database.$emit(changeEventBulk);\n });\n this._subs.push(subDocs);\n\n return PROMISE_RESOLVE_VOID;\n }\n\n\n /**\n * Manually call the cleanup function of the storage.\n * @link https://rxdb.info/cleanup.html\n */\n cleanup(_minimumDeletedTime?: number): Promise {\n ensureRxCollectionIsNotClosed(this);\n throw pluginMissing('cleanup');\n }\n\n // overwritten by migration-plugin\n migrationNeeded(): Promise {\n throw pluginMissing('migration-schema');\n }\n getMigrationState(): RxMigrationState {\n throw pluginMissing('migration-schema');\n }\n startMigration(batchSize: number = 10): Promise {\n ensureRxCollectionIsNotClosed(this);\n return this.getMigrationState().startMigration(batchSize);\n }\n migratePromise(batchSize: number = 10): Promise {\n return this.getMigrationState().migratePromise(batchSize);\n }\n\n async insert(\n json: RxDocumentType | RxDocument\n ): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const writeResult = await this.bulkInsert([json as any]);\n\n const isError = writeResult.error[0];\n throwIfIsStorageWriteError(this as any, (json as any)[this.schema.primaryPath] as any, json, isError as any);\n const insertResult = ensureNotFalsy(writeResult.success[0]);\n return insertResult;\n }\n\n async bulkInsert(\n docsData: RxDocumentType[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (docsData.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n const primaryPath = this.schema.primaryPath;\n\n const ids = new Set();\n\n /**\n * This code is a bit redundant for better performance.\n * Instead of iterating multiple times,\n * we directly transform the input to a write-row array.\n */\n let insertRows: BulkWriteRow[];\n if (this.hasHooks('pre', 'insert')) {\n insertRows = await Promise.all(\n docsData.map(docData => {\n const useDocData = fillObjectDataBeforeInsert(this.schema, docData);\n return this._runHooks('pre', 'insert', useDocData)\n .then(() => {\n ids.add((useDocData as any)[primaryPath]);\n return { document: useDocData };\n });\n })\n );\n } else {\n insertRows = new Array(docsData.length);\n const schema = this.schema;\n for (let index = 0; index < docsData.length; index++) {\n const docData = docsData[index];\n const useDocData = fillObjectDataBeforeInsert(schema, docData);\n ids.add((useDocData as any)[primaryPath]);\n insertRows[index] = { document: useDocData };\n }\n }\n\n\n if (ids.size !== docsData.length) {\n throw newRxError('COL22', {\n collection: this.name,\n args: {\n documents: docsData\n }\n });\n }\n\n const results = await this.storageInstance.bulkWrite(\n insertRows,\n 'rx-collection-bulk-insert'\n );\n\n\n /**\n * Often the user does not need to access the RxDocuments of the bulkInsert() call.\n * So we transform the data to RxDocuments only if needed to use less CPU performance.\n */\n let rxDocuments: RxDocument[];\n const collection = this;\n const ret = {\n get success() {\n if (!rxDocuments) {\n const success = getWrittenDocumentsFromBulkWriteResponse(\n collection.schema.primaryPath,\n insertRows,\n results\n );\n rxDocuments = mapDocumentsDataToCacheDocs(collection._docCache, success);\n }\n return rxDocuments;\n },\n error: results.error\n };\n\n if (this.hasHooks('post', 'insert')) {\n const docsMap: Map = new Map();\n insertRows.forEach(row => {\n const doc = row.document;\n docsMap.set((doc as any)[primaryPath] as any, doc);\n });\n await Promise.all(\n ret.success.map(doc => {\n return this._runHooks(\n 'post',\n 'insert',\n docsMap.get(doc.primary),\n doc\n );\n })\n );\n }\n\n return ret;\n }\n\n async bulkRemove(\n /**\n * You can either remove the documents by their ids\n * or by directly providing the RxDocument instances\n * if you have them already. This improves performance a bit.\n */\n idsOrDocs: string[] | RxDocument[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const primaryPath = this.schema.primaryPath;\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (idsOrDocs.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n let rxDocumentMap: Map>;\n if (typeof idsOrDocs[0] === 'string') {\n rxDocumentMap = await this.findByIds(idsOrDocs as string[]).exec();\n } else {\n rxDocumentMap = new Map();\n (idsOrDocs as RxDocument[]).forEach(d => rxDocumentMap.set(d.primary, d));\n }\n\n const docsData: RxDocumentData[] = [];\n const docsMap: Map> = new Map();\n Array.from(rxDocumentMap.values()).forEach(rxDocument => {\n const data: RxDocumentData = rxDocument.toMutableJSON(true) as any;\n docsData.push(data);\n docsMap.set(rxDocument.primary, data);\n });\n\n await Promise.all(\n docsData.map(doc => {\n const primary = (doc as any)[this.schema.primaryPath];\n return this._runHooks('pre', 'remove', doc, rxDocumentMap.get(primary));\n })\n );\n const removeDocs: BulkWriteRow[] = docsData.map(doc => {\n const writeDoc = flatClone(doc);\n writeDoc._deleted = true;\n return {\n previous: doc,\n document: writeDoc\n };\n });\n const results = await this.storageInstance.bulkWrite(\n removeDocs,\n 'rx-collection-bulk-remove'\n );\n\n\n const success = getWrittenDocumentsFromBulkWriteResponse(\n this.schema.primaryPath,\n removeDocs,\n results\n );\n\n const deletedRxDocuments: RxDocument[] = [];\n const successIds: string[] = success.map(d => {\n const id = d[primaryPath] as string;\n const doc = this._docCache.getCachedRxDocument(d);\n deletedRxDocuments.push(doc);\n return id;\n });\n\n // run hooks\n await Promise.all(\n successIds.map(id => {\n return this._runHooks(\n 'post',\n 'remove',\n docsMap.get(id),\n rxDocumentMap.get(id)\n );\n })\n );\n\n\n return {\n success: deletedRxDocuments,\n error: results.error\n };\n }\n\n /**\n * same as bulkInsert but overwrites existing document with same primary\n */\n async bulkUpsert(docsData: Partial[]): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const insertData: RxDocumentType[] = [];\n const useJsonByDocId: Map = new Map();\n docsData.forEach(docData => {\n const useJson = fillObjectDataBeforeInsert(this.schema, docData);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL3', {\n primaryPath: this.schema.primaryPath as string,\n data: useJson,\n schema: this.schema.jsonSchema\n });\n }\n useJsonByDocId.set(primary, useJson);\n insertData.push(useJson);\n });\n\n const insertResult = await this.bulkInsert(insertData);\n const success = insertResult.success.slice(0);\n const error: RxStorageWriteError[] = [];\n\n // update the ones that existed already\n await Promise.all(\n insertResult.error.map(async (err) => {\n if (err.status !== 409) {\n error.push(err);\n } else {\n const id = err.documentId;\n const writeData = getFromMapOrThrow(useJsonByDocId, id);\n const docDataInDb = ensureNotFalsy(err.documentInDb);\n const doc = this._docCache.getCachedRxDocuments([docDataInDb])[0];\n const newDoc = await doc.incrementalModify(() => writeData);\n success.push(newDoc);\n }\n })\n );\n return {\n error,\n success\n };\n }\n\n /**\n * same as insert but overwrites existing document with same primary\n */\n async upsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const bulkResult = await this.bulkUpsert([json]);\n throwIfIsStorageWriteError(\n this.asRxCollection,\n (json as any)[this.schema.primaryPath],\n json as any,\n bulkResult.error[0]\n );\n return bulkResult.success[0];\n }\n\n /**\n * upserts to a RxDocument, uses incrementalModify if document already exists\n */\n incrementalUpsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const useJson = fillObjectDataBeforeInsert(this.schema, json);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL4', {\n data: json\n });\n }\n\n // ensure that it won't try 2 parallel runs\n let queue = this._incrementalUpsertQueues.get(primary);\n if (!queue) {\n queue = PROMISE_RESOLVE_VOID;\n }\n queue = queue\n .then(() => _incrementalUpsertEnsureRxDocumentExists(this as any, primary as any, useJson))\n .then((wasInserted) => {\n if (!wasInserted.inserted) {\n return _incrementalUpsertUpdate(wasInserted.doc, useJson);\n } else {\n return wasInserted.doc;\n }\n });\n this._incrementalUpsertQueues.set(primary, queue);\n return queue;\n }\n\n find(queryObj?: MangoQuery): RxQuery<\n RxDocumentType,\n RxDocument[],\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'find',\n queryObj,\n collection: this\n });\n\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n const query = createRxQuery('find', queryObj, this as any);\n return query as any;\n }\n\n findOne(\n queryObj?: MangoQueryNoLimit | string\n ): RxQuery<\n RxDocumentType,\n RxDocument | null,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'findOne',\n queryObj,\n collection: this\n });\n\n let query;\n\n if (typeof queryObj === 'string') {\n query = createRxQuery('findOne', {\n selector: {\n [this.schema.primaryPath]: queryObj\n },\n limit: 1\n }, this as any);\n } else {\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n // cannot have limit on findOne queries because it will be overwritten\n if ((queryObj as MangoQuery).limit) {\n throw newRxError('QU6');\n }\n\n queryObj = flatClone(queryObj);\n (queryObj as any).limit = 1;\n query = createRxQuery('findOne', queryObj, this as any);\n }\n\n\n return query as any;\n }\n\n count(queryObj?: MangoQuerySelectorAndIndex): RxQuery<\n RxDocumentType,\n number,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n const query = createRxQuery('count', queryObj, this as any);\n return query as any;\n }\n\n /**\n * find a list documents by their primary key\n * has way better performance then running multiple findOne() or a find() with a complex $or-selected\n */\n findByIds(\n ids: string[]\n ): RxQuery<\n RxDocumentType,\n Map>,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n const mangoQuery: MangoQuery = {\n selector: {\n [this.schema.primaryPath]: {\n $in: ids.slice(0)\n }\n } as any\n };\n const query = createRxQuery('findByIds', mangoQuery, this as any);\n return query as any;\n }\n\n /**\n * Export collection to a JSON friendly format.\n */\n exportJSON(): Promise>;\n exportJSON(): Promise>;\n exportJSON(): Promise {\n throw pluginMissing('json-dump');\n }\n\n /**\n * Import the parsed JSON export into the collection.\n * @param _exportedJSON The previously exported data from the `.exportJSON()` method.\n */\n importJSON(_exportedJSON: RxDumpCollectionAny): Promise {\n throw pluginMissing('json-dump');\n }\n\n insertCRDT(_updateObj: CRDTEntry | CRDTEntry[]): RxDocument {\n throw pluginMissing('crdt');\n }\n\n\n addPipeline(_options: RxPipelineOptions): Promise> {\n throw pluginMissing('pipeline');\n }\n\n /**\n * HOOKS\n */\n addHook(when: HookWhenType, key: HookKeyType, fun: any, parallel = false) {\n if (typeof fun !== 'function') {\n throw newRxTypeError('COL7', {\n key,\n when\n });\n }\n\n if (!HOOKS_WHEN.includes(when)) {\n throw newRxTypeError('COL8', {\n key,\n when\n });\n }\n\n if (!HOOKS_KEYS.includes(key)) {\n throw newRxError('COL9', {\n key\n });\n }\n\n if (when === 'post' && key === 'create' && parallel === true) {\n throw newRxError('COL10', {\n when,\n key,\n parallel\n });\n }\n\n // bind this-scope to hook-function\n const boundFun = fun.bind(this);\n\n const runName = parallel ? 'parallel' : 'series';\n\n this.hooks[key] = this.hooks[key] || {};\n this.hooks[key][when] = this.hooks[key][when] || {\n series: [],\n parallel: []\n };\n this.hooks[key][when][runName].push(boundFun);\n }\n\n getHooks(when: HookWhenType, key: HookKeyType) {\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return {\n series: [],\n parallel: []\n };\n }\n return this.hooks[key][when];\n }\n\n hasHooks(when: HookWhenType, key: HookKeyType) {\n /**\n * Performance shortcut\n * so that we not have to build the empty object.\n */\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return false;\n }\n\n const hooks = this.getHooks(when, key);\n if (!hooks) {\n return false;\n }\n return hooks.series.length > 0 || hooks.parallel.length > 0;\n }\n\n _runHooks(when: HookWhenType, key: HookKeyType, data: any, instance?: any): Promise {\n const hooks = this.getHooks(when, key);\n\n if (!hooks) {\n return PROMISE_RESOLVE_VOID;\n }\n\n // run parallel: false\n const tasks = hooks.series.map((hook: any) => () => hook(data, instance));\n return promiseSeries(tasks)\n // run parallel: true\n .then(() => Promise.all(\n hooks.parallel\n .map((hook: any) => hook(data, instance))\n ));\n }\n\n /**\n * does the same as ._runHooks() but with non-async-functions\n */\n _runHooksSync(when: HookWhenType, key: HookKeyType, data: any, instance: any) {\n if (!this.hasHooks(when, key)) {\n return;\n }\n const hooks = this.getHooks(when, key);\n if (!hooks) return;\n hooks.series.forEach((hook: any) => hook(data, instance));\n }\n\n /**\n * Returns a promise that resolves after the given time.\n * Ensures that is properly cleans up when the collection is closed\n * so that no running timeouts prevent the exit of the JavaScript process.\n */\n promiseWait(time: number): Promise {\n const ret = new Promise(res => {\n const timeout = setTimeout(() => {\n this.timeouts.delete(timeout);\n res();\n }, time);\n this.timeouts.add(timeout);\n });\n return ret;\n }\n\n async close(): Promise {\n if (this.closed) {\n return PROMISE_RESOLVE_FALSE;\n }\n\n OPEN_COLLECTIONS.delete(this);\n\n\n await Promise.all(this.onClose.map(fn => fn()));\n\n /**\n * Settings closed = true\n * must be the first thing to do,\n * so for example the replication can directly stop\n * instead of sending requests to a closed storage.\n */\n this.closed = true;\n\n\n Array.from(this.timeouts).forEach(timeout => clearTimeout(timeout));\n if (this._changeEventBuffer) {\n this._changeEventBuffer.close();\n }\n /**\n * First wait until the whole database is idle.\n * This ensures that the storage does not get closed\n * while some operation is running.\n * It is important that we do not intercept a running call\n * because it might lead to undefined behavior like when a doc is written\n * but the change is not added to the changes collection.\n */\n return this.database.requestIdlePromise()\n .then(() => this.storageInstance.close())\n .then(() => {\n /**\n * Unsubscribing must be done AFTER the storageInstance.close()\n * Because the conflict handling is part of the subscriptions and\n * otherwise there might be open conflicts to be resolved which\n * will then stuck and never resolve.\n */\n this._subs.forEach(sub => sub.unsubscribe());\n\n delete this.database.collections[this.name];\n return runAsyncPluginHooks('postCloseRxCollection', this).then(() => true);\n });\n }\n\n /**\n * remove all data of the collection\n */\n async remove(): Promise {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n /**\n * TODO here we should pass the already existing\n * storage instances instead of creating new ones.\n */\n await removeCollectionStorages(\n this.database.storage,\n this.database.internalStore,\n this.database.token,\n this.database.name,\n this.name,\n this.database.multiInstance,\n this.database.password,\n this.database.hashFunction\n );\n }\n\n get asRxCollection(): RxCollection {\n return this as any;\n }\n}\n\n/**\n * adds the hook-functions to the collections prototype\n * this runs only once\n */\nfunction _applyHookFunctions(\n collection: RxCollection\n) {\n if (hooksApplied) return; // already run\n hooksApplied = true;\n const colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(key => {\n HOOKS_WHEN.map(when => {\n const fnName = when + ucfirst(key);\n colProto[fnName] = function (fun: string, parallel: boolean) {\n return this.addHook(when, key, fun, parallel);\n };\n });\n });\n}\n\nfunction _incrementalUpsertUpdate(\n doc: RxDocumentBase,\n json: RxDocumentData\n): Promise> {\n return doc.incrementalModify((_innerDoc) => {\n return json;\n });\n}\n\n/**\n * ensures that the given document exists\n * @return promise that resolves with new doc and flag if inserted\n */\nfunction _incrementalUpsertEnsureRxDocumentExists(\n rxCollection: RxCollection,\n primary: string,\n json: any\n): Promise<\n {\n doc: RxDocument;\n inserted: boolean;\n }\n> {\n /**\n * Optimisation shortcut,\n * first try to find the document in the doc-cache\n */\n const docDataFromCache = rxCollection._docCache.getLatestDocumentDataIfExists(primary);\n if (docDataFromCache) {\n return Promise.resolve({\n doc: rxCollection._docCache.getCachedRxDocuments([docDataFromCache])[0],\n inserted: false\n });\n }\n return rxCollection.findOne(primary).exec()\n .then(doc => {\n if (!doc) {\n return rxCollection.insert(json).then(newDoc => ({\n doc: newDoc,\n inserted: true\n }));\n } else {\n return {\n doc,\n inserted: false\n };\n }\n });\n}\n\n/**\n * creates and prepares a new collection\n */\nexport function createRxCollection(\n {\n database,\n name,\n schema,\n instanceCreationOptions = {},\n migrationStrategies = {},\n autoMigrate = true,\n statics = {},\n methods = {},\n attachments = {},\n options = {},\n localDocuments = false,\n cacheReplacementPolicy = defaultCacheReplacementPolicy,\n conflictHandler = defaultConflictHandler\n }: any\n): Promise {\n const storageInstanceCreationParams: RxStorageInstanceCreationParams = {\n databaseInstanceToken: database.token,\n databaseName: database.name,\n collectionName: name,\n schema: schema.jsonSchema,\n options: instanceCreationOptions,\n multiInstance: database.multiInstance,\n password: database.password,\n devMode: overwritable.isDevMode()\n };\n\n runPluginHooks(\n 'preCreateRxStorageInstance',\n storageInstanceCreationParams\n );\n\n return createRxCollectionStorageInstance(\n database,\n storageInstanceCreationParams\n ).then(storageInstance => {\n const collection = new RxCollectionBase(\n database,\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n statics,\n conflictHandler\n );\n\n return collection\n .prepare()\n .then(() => {\n // ORM add statics\n Object\n .entries(statics)\n .forEach(([funName, fun]) => {\n Object.defineProperty(collection, funName, {\n get: () => (fun as any).bind(collection)\n });\n });\n\n let ret = PROMISE_RESOLVE_VOID;\n if (autoMigrate && collection.schema.version !== 0) {\n ret = collection.migratePromise();\n }\n return ret;\n })\n .then(() => {\n runPluginHooks('createRxCollection', {\n collection,\n creator: {\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n localDocuments,\n statics\n }\n });\n return collection as any;\n })\n /**\n * If the collection creation fails,\n * we yet have to close the storage instances.\n */\n .catch(err => {\n OPEN_COLLECTIONS.delete(collection);\n return storageInstance.close()\n .then(() => Promise.reject(err as Error));\n });\n });\n}\n\nexport function isRxCollection(obj: any): boolean {\n return obj instanceof RxCollectionBase;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAYA,IAAAE,mBAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,SAAA,GAAAL,OAAA;AAIA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,kBAAA,GAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAR,OAAA;AA6CA,IAAAS,yBAAA,GAAAT,OAAA;AAIA,IAAAU,gBAAA,GAAAV,OAAA;AAMA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,aAAA,GAAAb,OAAA;AAEA,IAAAc,uBAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAf,OAAA;AAEA,IAAMgB,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU;AAE3C,IAAMC,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU;AAElE,IAAIC,YAAY,GAAG,KAAK;AAEjB,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAIE,GAAG,CAAkC,CAAC;AAAC,IAE9DC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA;EASzB;AACJ;AACA;;EAMI;AACJ;AACA;AACA;;EAGI,SAAAA,iBACoBC,QAAqF,EAC9FC,IAAY,EACZC,MAAgC,EAChCC,uBAAwF,EACxFC,uBAAgD,GAAG,CAAC,CAAQ,EAC5DC,mBAAwC,GAAG,CAAC,CAAC,EAC7CC,OAA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AG,CAAC,KAAK;QACzBoC,MAAM,CAACqB,cAAc,CAACzN,UAAU,EAAEwN,OAAO,EAAE;UACvCtH,GAAG,EAAEA,CAAA,KAAO8D,GAAG,CAASK,IAAI,CAACrK,UAAU;QAC3C,CAAC,CAAC;MACN,CAAC,CAAC;MAEN,IAAI0F,GAAG,GAAGlC,2BAAoB;MAC9B,IAAIsJ,WAAW,IAAI9M,UAAU,CAAC5C,MAAM,CAAC8E,OAAO,KAAK,CAAC,EAAE;QAChDwD,GAAG,GAAG1F,UAAU,CAACiE,cAAc,CAAC,CAAC;MACrC;MACA,OAAOyB,GAAG;IACd,CAAC,CAAC,CACDP,IAAI,CAAC,MAAM;MACR,IAAA0D,qBAAc,EAAC,oBAAoB,EAAE;QACjC7I,UAAU;QACV0N,OAAO,EAAE;UACLvQ,IAAI;UACJC,MAAM;UACNY,eAAe;UACfV,uBAAuB;UACvBC,mBAAmB;UACnBC,OAAO;UACPC,WAAW;UACXC,OAAO;UACPC,sBAAsB;UACtBoP,cAAc;UACdlP;QACJ;MACJ,CAAC,CAAC;MACF,OAAOmC,UAAU;IACrB,CAAC;IACD;AACZ;AACA;AACA,OAHY,CAIC2N,KAAK,CAACjG,GAAG,IAAI;MACV5K,gBAAgB,CAACoO,MAAM,CAAClL,UAAU,CAAC;MACnC,OAAOhC,eAAe,CAAC0E,KAAK,CAAC,CAAC,CACzByC,IAAI,CAAC,MAAMxC,OAAO,CAACiL,MAAM,CAAClG,GAAY,CAAC,CAAC;IACjD,CAAC,CAAC;EACV,CAAC,CAAC;AACN;AAEO,SAASmG,cAAcA,CAACC,GAAQ,EAAW;EAC9C,OAAOA,GAAG,YAAY7Q,gBAAgB;AAC1C","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/dev-mode/dev-mode-tracking.js b/dist/esm/plugins/dev-mode/dev-mode-tracking.js index 31572f18bed..26a776fc061 100644 --- a/dist/esm/plugins/dev-mode/dev-mode-tracking.js +++ b/dist/esm/plugins/dev-mode/dev-mode-tracking.js @@ -1,4 +1,4 @@ -import { PREMIUM_FLAG_HASH, RXDB_UTILS_GLOBAL, RXDB_VERSION, defaultHashSha256 } from "../utils/index.js"; +import { RXDB_VERSION, hasPremiumFlag } from "../utils/index.js"; var iframeShown = false; /** @@ -16,7 +16,7 @@ export async function addDevModeTrackingIframe(db) { } // do not show if premium flag is set. - if (RXDB_UTILS_GLOBAL.premium && typeof RXDB_UTILS_GLOBAL.premium === 'string' && (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium)) === PREMIUM_FLAG_HASH) { + if (await hasPremiumFlag()) { return; } iframeShown = true; diff --git a/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map b/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map index e84df7250eb..f743b75a4a9 100644 --- a/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map +++ b/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map @@ -1 +1 @@ -{"version":3,"file":"dev-mode-tracking.js","names":["PREMIUM_FLAG_HASH","RXDB_UTILS_GLOBAL","RXDB_VERSION","defaultHashSha256","iframeShown","addDevModeTrackingIframe","db","window","location","premium","iframe","document","createElement","style","visibility","width","height","position","top","left","opacity","src","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n /**\n * Do not use display:none\n * @link https://medium.com/@zachcaceres/dont-use-display-none-to-hide-iframes-in-safari-b51715eb22c4\n */\n iframe.style.visibility = 'hidden';\n iframe.width = '1px';\n iframe.height = '1px';\n iframe.style.position = 'absolute';\n iframe.style.top = '0';\n iframe.style.left = '0';\n iframe.style.opacity = '0.1';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":"AACA,SACIA,iBAAiB,EACjBC,iBAAiB,EACjBC,YAAY,EACZC,iBAAiB,QACd,mBAAmB;AAG1B,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IACIP,iBAAiB,CAACQ,OAAO,IACzB,OAAOR,iBAAiB,CAACQ,OAAO,KAAK,QAAQ,IAC5C,OAAMN,iBAAiB,CAACF,iBAAiB,CAACQ,OAAO,CAAC,MAAKT,iBAAkB,EAC5E;IACE;EACJ;EAEAI,WAAW,GAAG,IAAI;EAElB,IAAMM,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/C;AACJ;AACA;AACA;EACIF,MAAM,CAACG,KAAK,CAACC,UAAU,GAAG,QAAQ;EAClCJ,MAAM,CAACK,KAAK,GAAG,KAAK;EACpBL,MAAM,CAACM,MAAM,GAAG,KAAK;EACrBN,MAAM,CAACG,KAAK,CAACI,QAAQ,GAAG,UAAU;EAClCP,MAAM,CAACG,KAAK,CAACK,GAAG,GAAG,GAAG;EACtBR,MAAM,CAACG,KAAK,CAACM,IAAI,GAAG,GAAG;EACvBT,MAAM,CAACG,KAAK,CAACO,OAAO,GAAG,KAAK;EAC5BV,MAAM,CAACW,GAAG,GAAG,sDAAsD,GAAGnB,YAAY;EAClFS,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,MAAM,CAAC;AACrC;AAGA,SAASc,WAAWA,CAAA,EAAG;EACnB,OACIhB,QAAQ,CAACiB,QAAQ,KAAK,WAAW,IACjCjB,QAAQ,CAACiB,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvClB,QAAQ,CAACiB,QAAQ,KAAK,WAAW,IACjCjB,QAAQ,CAACiB,QAAQ,KAAK,SAAS,IAC/BjB,QAAQ,CAACiB,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"dev-mode-tracking.js","names":["RXDB_VERSION","hasPremiumFlag","iframeShown","addDevModeTrackingIframe","db","window","location","iframe","document","createElement","style","visibility","width","height","position","top","left","opacity","src","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n RXDB_VERSION,\n hasPremiumFlag\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (await hasPremiumFlag()) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n /**\n * Do not use display:none\n * @link https://medium.com/@zachcaceres/dont-use-display-none-to-hide-iframes-in-safari-b51715eb22c4\n */\n iframe.style.visibility = 'hidden';\n iframe.width = '1px';\n iframe.height = '1px';\n iframe.style.position = 'absolute';\n iframe.style.top = '0';\n iframe.style.left = '0';\n iframe.style.opacity = '0.1';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":"AACA,SACIA,YAAY,EACZC,cAAc,QACX,mBAAmB;AAG1B,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IAAI,MAAML,cAAc,CAAC,CAAC,EAAE;IACxB;EACJ;EAEAC,WAAW,GAAG,IAAI;EAElB,IAAMK,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/C;AACJ;AACA;AACA;EACIF,MAAM,CAACG,KAAK,CAACC,UAAU,GAAG,QAAQ;EAClCJ,MAAM,CAACK,KAAK,GAAG,KAAK;EACpBL,MAAM,CAACM,MAAM,GAAG,KAAK;EACrBN,MAAM,CAACG,KAAK,CAACI,QAAQ,GAAG,UAAU;EAClCP,MAAM,CAACG,KAAK,CAACK,GAAG,GAAG,GAAG;EACtBR,MAAM,CAACG,KAAK,CAACM,IAAI,GAAG,GAAG;EACvBT,MAAM,CAACG,KAAK,CAACO,OAAO,GAAG,KAAK;EAC5BV,MAAM,CAACW,GAAG,GAAG,sDAAsD,GAAGlB,YAAY;EAClFQ,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,MAAM,CAAC;AACrC;AAGA,SAASc,WAAWA,CAAA,EAAG;EACnB,OACIf,QAAQ,CAACgB,QAAQ,KAAK,WAAW,IACjChB,QAAQ,CAACgB,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvCjB,QAAQ,CAACgB,QAAQ,KAAK,WAAW,IACjChB,QAAQ,CAACgB,QAAQ,KAAK,SAAS,IAC/BhB,QAAQ,CAACgB,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/dev-mode/error-messages.js b/dist/esm/plugins/dev-mode/error-messages.js index c83c62e54f2..07a0b1c94e7 100644 --- a/dist/esm/plugins/dev-mode/error-messages.js +++ b/dist/esm/plugins/dev-mode/error-messages.js @@ -4,6 +4,7 @@ * This is mainly because error-string are hard to compress and we need a smaller build */ +import { NON_PREMIUM_COLLECTION_LIMIT } from "../utils/utils-premium.js"; export var ERROR_MESSAGES = { // util.js / config UT1: 'given name is no string or empty', @@ -90,6 +91,7 @@ export var ERROR_MESSAGES = { COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab', CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision', COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key', + COL23: 'In the open-source version of RxDB, the amount of collections that can exist in parallel is limited to ' + NON_PREMIUM_COLLECTION_LIMIT + '. If you already purchased the premium access, you can remove this limit: https://rxdb.info/rx-collection.html#faq', // rx-document.js DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed', DOC2: 'cannot observe primary path', diff --git a/dist/esm/plugins/dev-mode/error-messages.js.map b/dist/esm/plugins/dev-mode/error-messages.js.map index 6d5026e7edc..f788477460c 100644 --- a/dist/esm/plugins/dev-mode/error-messages.js.map +++ b/dist/esm/plugins/dev-mode/error-messages.js.map @@ -1 +1 @@ -{"version":3,"file":"error-messages.js","names":["ERROR_MESSAGES","UT1","UT2","UT3","UT4","UT5","UT6","UT7","PL1","PL3","P2","QU1","QU4","QU5","QU6","QU9","QU10","QU11","QU12","QU13","QU14","QU15","QU16","QU17","QU18","MQ1","MQ2","MQ3","MQ4","MQ5","MQ6","MQ7","MQ8","DB1","DB2","DB3","DB4","DB5","DB6","DB8","DB9","DB11","DB12","DB13","DB14","COL1","COL2","COL3","COL4","COL5","COL6","COL7","COL8","COL9","COL10","COL11","COL12","COL13","COL14","COL15","COL16","COL17","COL18","COL20","COL21","CONFLICT","COL22","DOC1","DOC2","DOC3","DOC4","DOC5","DOC6","DOC7","DOC8","DOC9","DOC10","DOC11","DOC13","DOC14","DOC15","DOC16","DOC17","DOC18","DOC19","DOC20","DOC21","DOC22","DOC23","DOC24","DM1","DM2","DM3","DM4","DM5","AT1","EN1","EN2","EN3","EN4","JD1","JD2","JD3","LD1","LD2","LD3","LD4","LD5","LD6","LD7","LD8","RC1","RC2","RC4","RC5","RC6","RC7","RC_PULL","RC_STREAM","RC_PUSH","RC_PUSH_NO_AR","RC_WEBRTC_PEER","RC_COUCHDB_1","RC_COUCHDB_2","RC_OUTDATED","RC_UNAUTHORIZED","RC_FORBIDDEN","SC1","SC2","SC3","SC4","SC6","SC7","SC8","SC10","SC11","SC13","SC14","SC15","SC16","SC17","SC18","SC19","SC20","SC21","SC22","SC23","SC24","SC25","SC26","SC28","SC29","SC30","SC32","SC33","SC34","SC35","SC36","SC37","SC38","SC39","SC40","SC41","DVM1","VD1","VD2","S1","GQL1","GQL3","CRDT1","CRDT2","CRDT3","DXE1","SNH"],"sources":["../../../../src/plugins/dev-mode/error-messages.ts"],"sourcesContent":["/**\n * this plugin adds the error-messages\n * without it, only error-codes will be shown\n * This is mainly because error-string are hard to compress and we need a smaller build\n */\n\n\nexport const ERROR_MESSAGES = {\n // util.js / config\n UT1: 'given name is no string or empty',\n UT2: `collection- and database-names must match the regex to be compatible with couchdb databases.\n See https://neighbourhood.ie/blog/2020/10/13/everything-you-need-to-know-about-couchdb-database-names/\n info: if your database-name specifies a folder, the name must contain the slash-char '/' or '\\\\'`,\n UT3: 'replication-direction must either be push or pull or both. But not none',\n UT4: 'given leveldown is no valid adapter',\n UT5: 'keyCompression is set to true in the schema but no key-compression handler is used in the storage',\n UT6: 'schema contains encrypted fields but no encryption handler is used in the storage',\n UT7: 'attachments.compression is enabled but no attachment-compression plugin is used',\n\n // plugins\n PL1: 'Given plugin is not RxDB plugin.',\n // removed in 14.0.0 - PouchDB RxStorage was removed - PL2: 'You tried importing a RxDB plugin to pouchdb. Use addRxPlugin() instead.',\n PL3: 'A plugin with the same name was already added but it was not the exact same JavaScript object',\n\n // pouch-db.js\n // removed in 12.0.0 - P1: 'PouchDB.getBatch: limit must be > 2',\n P2: 'bulkWrite() cannot be called with an empty array',\n // removed in 12.0.0 - P3: 'bulkAddRevisions cannot be called with an empty array',\n\n // rx-query\n QU1: 'RxQuery._execOverDatabase(): op not known',\n // removed in 9.0.0 - QU2: 'limit() must get a number',\n // removed in 9.0.0 - QU3: 'skip() must get a number',\n QU4: 'RxQuery.regex(): You cannot use .regex() on the primary field',\n QU5: 'RxQuery.sort(): does not work because key is not defined in the schema',\n QU6: 'RxQuery.limit(): cannot be called on .findOne()',\n // removed in 12.0.0 (should by ensured by the typings) - QU7: 'query must be an object',\n // removed in 12.0.0 (should by ensured by the typings) - QU8: 'query cannot be an array',\n QU9: 'throwIfMissing can only be used in findOne queries',\n QU10: 'result empty and throwIfMissing: true',\n QU11: 'RxQuery: no valid query params given',\n QU12: 'Given index is not in schema',\n QU13: 'A top level field of the query is not included in the schema',\n QU14: 'Running a count() query in slow mode is now allowed. Either run a count() query with a selector that fully matches an index ' +\n 'or set allowSlowCount=true when calling the createRxDatabase',\n QU15: 'For count queries it is not allowed to use skip or limit',\n QU16: '$regex queries must be defined by a string, not an RegExp instance. ' +\n 'This is because RegExp objects cannot be JSON stringified and also they are mutable which would be dangerous',\n QU17: 'Chained queries cannot be used on findByIds() RxQuery instances',\n QU18: 'Malformated query result data. This likely happens because you create a OPFS-storage RxDatabase inside of a worker but did not set the usesRxDatabaseInWorker setting. https://rxdb.info/rx-storage-opfs.html#setting-usesrxdatabaseinworker-when-a-rxdatabase-is-also-used-inside-of-the-worker ',\n\n // mquery.js\n MQ1: 'path must be a string or object',\n MQ2: 'Invalid argument',\n MQ3: 'Invalid sort() argument. Must be a string, object, or array',\n MQ4: 'Invalid argument. Expected instanceof mquery or plain object',\n MQ5: 'method must be used after where() when called with these arguments',\n MQ6: 'Can\\'t mix sort syntaxes. Use either array or object | .sort([[\\'field\\', 1], [\\'test\\', -1]]) | .sort({ field: 1, test: -1 })',\n MQ7: 'Invalid sort value',\n MQ8: 'Can\\'t mix sort syntaxes. Use either array or object',\n\n // rx-database\n DB1: 'RxDocument.prepare(): another instance on this adapter has a different password',\n DB2: 'RxDatabase.addCollections(): collection-names cannot start with underscore _',\n DB3: 'RxDatabase.addCollections(): collection already exists. use myDatabase[collectionName] to get it',\n DB4: 'RxDatabase.addCollections(): schema is missing',\n DB5: 'RxDatabase.addCollections(): collection-name not allowed',\n DB6: 'RxDatabase.addCollections(): another instance created this collection with a different schema. Read this https://rxdb.info/questions-answers.html?console=qa#cant-change-the-schema ',\n // removed in 13.0.0 (now part of the encryption plugin) DB7: 'RxDatabase.addCollections(): schema encrypted but no password given',\n DB8: 'createRxDatabase(): A RxDatabase with the same name and adapter already exists.\\n' +\n 'Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional-\\n' +\n 'This often happens in react projects with hot reload that reloads the code without reloading the process.',\n DB9: 'ignoreDuplicate is only allowed in dev-mode and must never be used in production',\n // removed in 14.0.0 - PouchDB RxStorage is removed - DB9: 'createRxDatabase(): Adapter not added. Use addPouchPlugin(require(\\'pouchdb-adapter-[adaptername]\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed DB10: 'createRxDatabase(): To use leveldown-adapters, you have to add the leveldb-plugin. Use addPouchPlugin(require(\\'pouchdb-adapter-leveldb\\'));',\n DB11: 'createRxDatabase(): Invalid db-name, folder-paths must not have an ending slash',\n DB12: 'RxDatabase.addCollections(): could not write to internal store',\n DB13: 'createRxDatabase(): Invalid db-name or collection name, name contains the dollar sign',\n DB14: 'no custom reactivity factory added on database creation',\n\n // rx-collection\n COL1: 'RxDocument.insert() You cannot insert an existing document',\n COL2: 'RxCollection.insert() fieldName ._id can only be used as primaryKey',\n COL3: 'RxCollection.upsert() does not work without primary',\n COL4: 'RxCollection.incrementalUpsert() does not work without primary',\n COL5: 'RxCollection.find() if you want to search by _id, use .findOne(_id)',\n COL6: 'RxCollection.findOne() needs a queryObject or string. Notice that in RxDB, primary keys must be strings and cannot be numbers.',\n COL7: 'hook must be a function',\n COL8: 'hooks-when not known',\n COL9: 'RxCollection.addHook() hook-name not known',\n COL10: 'RxCollection .postCreate-hooks cannot be async',\n COL11: 'migrationStrategies must be an object',\n COL12: 'A migrationStrategy is missing or too much',\n COL13: 'migrationStrategy must be a function',\n COL14: 'given static method-name is not a string',\n COL15: 'static method-names cannot start with underscore _',\n COL16: 'given static method is not a function',\n COL17: 'RxCollection.ORM: statics-name not allowed',\n COL18: 'collection-method not allowed because fieldname is in the schema',\n // removed in 14.0.0, use CONFLICT instead - COL19: 'Document update conflict. When changing a document you must work on the previous revision',\n COL20: 'Storage write error',\n COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab',\n CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision',\n COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key',\n\n // rx-document.js\n DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n DOC2: 'cannot observe primary path',\n DOC3: 'final fields cannot be observed',\n DOC4: 'RxDocument.get$ cannot observe a non-existed field',\n DOC5: 'RxDocument.populate() cannot populate a non-existed field',\n DOC6: 'RxDocument.populate() cannot populate because path has no ref',\n DOC7: 'RxDocument.populate() ref-collection not in database',\n DOC8: 'RxDocument.set(): primary-key cannot be modified',\n DOC9: 'final fields cannot be modified',\n DOC10: 'RxDocument.set(): cannot set childpath when rootPath not selected',\n DOC11: 'RxDocument.save(): can\\'t save deleted document',\n // removed in 10.0.0 DOC12: 'RxDocument.save(): error',\n DOC13: 'RxDocument.remove(): Document is already deleted',\n DOC14: 'RxDocument.close() does not exist',\n DOC15: 'query cannot be an array',\n DOC16: 'Since version 8.0.0 RxDocument.set() can only be called on temporary RxDocuments',\n DOC17: 'Since version 8.0.0 RxDocument.save() can only be called on non-temporary documents',\n DOC18: 'Document property for composed primary key is missing',\n DOC19: 'Value of primary key(s) cannot be changed',\n DOC20: 'PrimaryKey missing',\n DOC21: 'PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace',\n DOC22: 'PrimaryKey must not contain a linebreak',\n DOC23: 'PrimaryKey must not contain a double-quote [\"]',\n DOC24: 'Given document data could not be structured cloned. This happens if you pass non-plain-json data into it, like a Date() object or a Function. ' +\n 'In vue.js this happens if you use ref() on the document data which transforms it into a Proxy object.',\n\n // data-migrator.js\n DM1: 'migrate() Migration has already run',\n DM2: 'migration of document failed final document does not match final schema',\n DM3: 'migration already running',\n DM4: 'Migration errored',\n DM5: 'Cannot open database state with newer RxDB version. You have to migrate your database state first. See https://rxdb.info/migration-storage.html?console=storage ',\n\n // plugins/attachments.js\n AT1: 'to use attachments, please define this in your schema',\n\n // plugins/encryption-crypto-js.js\n EN1: 'password is not valid',\n EN2: 'validatePassword: min-length of password not complied',\n EN3: 'Schema contains encrypted properties but no password is given',\n EN4: 'Password not valid',\n\n // plugins/json-dump.js\n JD1: 'You must create the collections before you can import their data',\n JD2: 'RxCollection.importJSON(): the imported json relies on a different schema',\n JD3: 'RxCollection.importJSON(): json.passwordHash does not match the own',\n\n // plugins/leader-election.js\n\n // plugins/local-documents.js\n LD1: 'RxDocument.allAttachments$ can\\'t use attachments on local documents',\n LD2: 'RxDocument.get(): objPath must be a string',\n LD3: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n LD4: 'cannot observe primary path',\n LD5: 'RxDocument.set() id cannot be modified',\n LD6: 'LocalDocument: Function is not usable on local documents',\n LD7: 'Local document already exists',\n LD8: 'localDocuments not activated. Set localDocuments=true on creation, when you want to store local documents on the RxDatabase or RxCollection.',\n\n // plugins/replication.js\n RC1: 'Replication: already added',\n RC2: 'replicateCouchDB() query must be from the same RxCollection',\n // removed in 14.0.0 - PouchDB RxStorage is removed RC3: 'RxCollection.syncCouchDB() Do not use a collection\\'s pouchdb as remote, use the collection instead',\n RC4: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication when live: true',\n RC5: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication if multiInstance because the replication might run on another instance',\n RC6: 'syncFirestore() serverTimestampField MUST NOT be part of the collections schema and MUST NOT be nested.',\n RC7: 'SimplePeer requires to have process.nextTick() polyfilled, see https://rxdb.info/replication-webrtc.html?console=webrtc ',\n RC_PULL: 'RxReplication pull handler threw an error - see .errors for more details',\n RC_STREAM: 'RxReplication pull stream$ threw an error - see .errors for more details',\n RC_PUSH: 'RxReplication push handler threw an error - see .errors for more details',\n RC_PUSH_NO_AR: 'RxReplication push handler did not return an array with the conflicts',\n RC_WEBRTC_PEER: 'RxReplication WebRTC Peer has error',\n RC_COUCHDB_1: 'replicateCouchDB() url must end with a slash like \\'https://example.com/mydatabase/\\'',\n RC_COUCHDB_2: 'replicateCouchDB() did not get valid result with rows.',\n RC_OUTDATED: 'Outdated client, update required. Replication was canceled',\n RC_UNAUTHORIZED: 'Unauthorized client, update the replicationState.headers to set correct auth data',\n RC_FORBIDDEN: 'Client behaves wrong so the replication was canceled. Mostly happens if the client tries to write data that it is not allowed to',\n\n // plugins/dev-mode/check-schema.js\n SC1: 'fieldnames do not match the regex',\n SC2: 'SchemaCheck: name \\'item\\' reserved for array-fields',\n SC3: 'SchemaCheck: fieldname has a ref-array but items-type is not string',\n SC4: 'SchemaCheck: fieldname has a ref but is not type string, [string,null] or array',\n SC6: 'SchemaCheck: primary can only be defined at top-level',\n SC7: 'SchemaCheck: default-values can only be defined at top-level',\n SC8: 'SchemaCheck: first level-fields cannot start with underscore _',\n SC10: 'SchemaCheck: schema defines ._rev, this will be done automatically',\n SC11: 'SchemaCheck: schema needs a number >=0 as version',\n // removed in 10.0.0 - SC12: 'SchemaCheck: primary can only be defined once',\n SC13: 'SchemaCheck: primary is always index, do not declare it as index',\n SC14: 'SchemaCheck: primary is always unique, do not declare it as index',\n SC15: 'SchemaCheck: primary cannot be encrypted',\n SC16: 'SchemaCheck: primary must have type: string',\n SC17: 'SchemaCheck: top-level fieldname is not allowed',\n SC18: 'SchemaCheck: indexes must be an array',\n SC19: 'SchemaCheck: indexes must contain strings or arrays of strings',\n SC20: 'SchemaCheck: indexes.array must contain strings',\n SC21: 'SchemaCheck: given index is not defined in schema',\n SC22: 'SchemaCheck: given indexKey is not type:string',\n SC23: 'SchemaCheck: fieldname is not allowed',\n SC24: 'SchemaCheck: required fields must be set via array. See https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required',\n SC25: 'SchemaCheck: compoundIndexes needs to be specified in the indexes field',\n SC26: 'SchemaCheck: indexes needs to be specified at collection schema level',\n // removed in 16.0.0 - SC27: 'SchemaCheck: encrypted fields need to be specified at collection schema level',\n SC28: 'SchemaCheck: encrypted fields is not defined in the schema',\n SC29: 'SchemaCheck: missing object key \\'properties\\'',\n SC30: 'SchemaCheck: primaryKey is required',\n SC32: 'SchemaCheck: primary field must have the type string/number/integer',\n SC33: 'SchemaCheck: used primary key is not a property in the schema',\n SC34: 'Fields of type string that are used in an index, must have set the maxLength attribute in the schema',\n SC35: 'Fields of type number/integer that are used in an index, must have set the multipleOf attribute in the schema',\n SC36: 'A field of this type cannot be used as index',\n SC37: 'Fields of type number that are used in an index, must have set the minimum and maximum attribute in the schema',\n SC38: 'Fields of type boolean that are used in an index, must be required in the schema',\n SC39: 'The primary key must have the maxLength attribute set',\n SC40: '$ref fields in the schema are not allowed. RxDB cannot resolve related schemas because it would have a negative performance impact.' +\n 'It would have to run http requests on runtime. $ref fields should be resolved during build time.',\n SC41: 'minimum, maximum and maxLength values for indexes must be real numbers, not Infinity or -Infinity',\n\n // plugins/dev-mode\n // removed in 13.9.0, use PL3 instead - DEV1: 'dev-mode added multiple times',\n DVM1: 'When dev-mode is enabled, your storage must use one of the schema validators at the top level. This is because most problems people have with RxDB is because they store data that is not valid to the schema which causes strange bugs and problems.',\n\n // plugins/validate.js\n VD1: 'Sub-schema not found, does the schemaPath exists in your schema?',\n VD2: 'object does not match schema',\n\n // plugins/in-memory.js\n // removed in 14.0.0 - PouchDB RxStorage is removed IM1: 'InMemory: Memory-Adapter must be added. Use addPouchPlugin(require(\\'pouchdb-adapter-memory\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed IM2: 'inMemoryCollection.sync(): Do not replicate with the in-memory instance. Replicate with the parent instead',\n\n // plugins/server.js\n S1: 'You cannot create collections after calling RxDatabase.server()',\n\n // plugins/replication-graphql.js\n GQL1: 'GraphQL replication: cannot find sub schema by key',\n // removed in 13.0.0, use RC_PULL instead - GQL2: 'GraphQL replication: unknown errors occurred in replication pull - see innerErrors for more details',\n GQL3: 'GraphQL replication: pull returns more documents then batchSize',\n // removed in 13.0.0, use RC_PUSH instead - GQL4: 'GraphQL replication: unknown errors occurred in replication push - see innerErrors for more details',\n\n // plugins/crdt/\n CRDT1: 'CRDT operations cannot be used because the crdt options are not set in the schema.',\n CRDT2: 'RxDocument.incrementalModify() cannot be used when CRDTs are activated.',\n CRDT3: 'To use CRDTs you MUST NOT set a conflictHandler because the default CRDT conflict handler must be used',\n\n // plugins/storage-dexie/\n DXE1: 'non-required index fields are not possible with the dexie.js RxStorage: https://github.com/pubkey/rxdb/pull/6643#issuecomment-2505310082',\n // removed in 15.0.0, added boolean index support to dexie storage - DXE1: 'The dexie.js RxStorage does not support boolean indexes, see https://rxdb.info/rx-storage-dexie.html#boolean-index',\n\n /**\n * Should never be thrown, use this for\n * null checks etc. so you do not have to increase the\n * build size with error message strings.\n */\n SNH: 'This should never happen'\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,OAAO,IAAMA,cAAc,GAAG;EAC1B;EACAC,GAAG,EAAE,kCAAkC;EACvCC,GAAG,kTAE8F;EACjGC,GAAG,EAAE,yEAAyE;EAC9EC,GAAG,EAAE,qCAAqC;EAC1CC,GAAG,EAAE,mGAAmG;EACxGC,GAAG,EAAE,mFAAmF;EACxFC,GAAG,EAAE,iFAAiF;EAEtF;EACAC,GAAG,EAAE,kCAAkC;EACvC;EACAC,GAAG,EAAE,+FAA+F;EAEpG;EACA;EACAC,EAAE,EAAE,kDAAkD;EACtD;;EAEA;EACAC,GAAG,EAAE,2CAA2C;EAChD;EACA;EACAC,GAAG,EAAE,+DAA+D;EACpEC,GAAG,EAAE,wEAAwE;EAC7EC,GAAG,EAAE,iDAAiD;EACtD;EACA;EACAC,GAAG,EAAE,oDAAoD;EACzDC,IAAI,EAAE,uCAAuC;EAC7CC,IAAI,EAAE,sCAAsC;EAC5CC,IAAI,EAAE,8BAA8B;EACpCC,IAAI,EAAE,8DAA8D;EACpEC,IAAI,EAAE,8HAA8H,GAChI,8DAA8D;EAClEC,IAAI,EAAE,0DAA0D;EAChEC,IAAI,EAAE,sEAAsE,GACxE,8GAA8G;EAClHC,IAAI,EAAE,iEAAiE;EACvEC,IAAI,EAAE,mSAAmS;EAEzS;EACAC,GAAG,EAAE,iCAAiC;EACtCC,GAAG,EAAE,kBAAkB;EACvBC,GAAG,EAAE,6DAA6D;EAClEC,GAAG,EAAE,8DAA8D;EACnEC,GAAG,EAAE,oEAAoE;EACzEC,GAAG,EAAE,gIAAgI;EACrIC,GAAG,EAAE,oBAAoB;EACzBC,GAAG,EAAE,sDAAsD;EAE3D;EACAC,GAAG,EAAE,iFAAiF;EACtFC,GAAG,EAAE,8EAA8E;EACnFC,GAAG,EAAE,kGAAkG;EACvGC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AAkG;EACtGC,IAAI,EAAE,mGAAmG;EAEzG;EACA;EACAC,IAAI,EAAE,uPAAuP;EAE7P;EACAC,GAAG,EAAE,kEAAkE;EACvEC,GAAG,EAAE,8BAA8B;EAEnC;EACA;EACA;;EAEA;EACAC,EAAE,EAAE,iEAAiE;EAErE;EACAC,IAAI,EAAE,oDAAoD;EAC1D;EACAC,IAAI,EAAE,iEAAiE;EACvE;;EAEA;EACAC,KAAK,EAAE,oFAAoF;EAC3FC,KAAK,EAAE,yEAAyE;EAChFC,KAAK,EAAE,wGAAwG;EAE/G;EACAC,IAAI,EAAE,0IAA0I;EAChJ;;EAEA;AACJ;AACA;AACA;AACA;EACIC,GAAG,EAAE;AACT,CAAC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"error-messages.js","names":["NON_PREMIUM_COLLECTION_LIMIT","ERROR_MESSAGES","UT1","UT2","UT3","UT4","UT5","UT6","UT7","PL1","PL3","P2","QU1","QU4","QU5","QU6","QU9","QU10","QU11","QU12","QU13","QU14","QU15","QU16","QU17","QU18","MQ1","MQ2","MQ3","MQ4","MQ5","MQ6","MQ7","MQ8","DB1","DB2","DB3","DB4","DB5","DB6","DB8","DB9","DB11","DB12","DB13","DB14","COL1","COL2","COL3","COL4","COL5","COL6","COL7","COL8","COL9","COL10","COL11","COL12","COL13","COL14","COL15","COL16","COL17","COL18","COL20","COL21","CONFLICT","COL22","COL23","DOC1","DOC2","DOC3","DOC4","DOC5","DOC6","DOC7","DOC8","DOC9","DOC10","DOC11","DOC13","DOC14","DOC15","DOC16","DOC17","DOC18","DOC19","DOC20","DOC21","DOC22","DOC23","DOC24","DM1","DM2","DM3","DM4","DM5","AT1","EN1","EN2","EN3","EN4","JD1","JD2","JD3","LD1","LD2","LD3","LD4","LD5","LD6","LD7","LD8","RC1","RC2","RC4","RC5","RC6","RC7","RC_PULL","RC_STREAM","RC_PUSH","RC_PUSH_NO_AR","RC_WEBRTC_PEER","RC_COUCHDB_1","RC_COUCHDB_2","RC_OUTDATED","RC_UNAUTHORIZED","RC_FORBIDDEN","SC1","SC2","SC3","SC4","SC6","SC7","SC8","SC10","SC11","SC13","SC14","SC15","SC16","SC17","SC18","SC19","SC20","SC21","SC22","SC23","SC24","SC25","SC26","SC28","SC29","SC30","SC32","SC33","SC34","SC35","SC36","SC37","SC38","SC39","SC40","SC41","DVM1","VD1","VD2","S1","GQL1","GQL3","CRDT1","CRDT2","CRDT3","DXE1","SNH"],"sources":["../../../../src/plugins/dev-mode/error-messages.ts"],"sourcesContent":["/**\n * this plugin adds the error-messages\n * without it, only error-codes will be shown\n * This is mainly because error-string are hard to compress and we need a smaller build\n */\n\nimport { NON_PREMIUM_COLLECTION_LIMIT } from '../utils/utils-premium.ts';\n\n\nexport const ERROR_MESSAGES = {\n // util.js / config\n UT1: 'given name is no string or empty',\n UT2: `collection- and database-names must match the regex to be compatible with couchdb databases.\n See https://neighbourhood.ie/blog/2020/10/13/everything-you-need-to-know-about-couchdb-database-names/\n info: if your database-name specifies a folder, the name must contain the slash-char '/' or '\\\\'`,\n UT3: 'replication-direction must either be push or pull or both. But not none',\n UT4: 'given leveldown is no valid adapter',\n UT5: 'keyCompression is set to true in the schema but no key-compression handler is used in the storage',\n UT6: 'schema contains encrypted fields but no encryption handler is used in the storage',\n UT7: 'attachments.compression is enabled but no attachment-compression plugin is used',\n\n // plugins\n PL1: 'Given plugin is not RxDB plugin.',\n // removed in 14.0.0 - PouchDB RxStorage was removed - PL2: 'You tried importing a RxDB plugin to pouchdb. Use addRxPlugin() instead.',\n PL3: 'A plugin with the same name was already added but it was not the exact same JavaScript object',\n\n // pouch-db.js\n // removed in 12.0.0 - P1: 'PouchDB.getBatch: limit must be > 2',\n P2: 'bulkWrite() cannot be called with an empty array',\n // removed in 12.0.0 - P3: 'bulkAddRevisions cannot be called with an empty array',\n\n // rx-query\n QU1: 'RxQuery._execOverDatabase(): op not known',\n // removed in 9.0.0 - QU2: 'limit() must get a number',\n // removed in 9.0.0 - QU3: 'skip() must get a number',\n QU4: 'RxQuery.regex(): You cannot use .regex() on the primary field',\n QU5: 'RxQuery.sort(): does not work because key is not defined in the schema',\n QU6: 'RxQuery.limit(): cannot be called on .findOne()',\n // removed in 12.0.0 (should by ensured by the typings) - QU7: 'query must be an object',\n // removed in 12.0.0 (should by ensured by the typings) - QU8: 'query cannot be an array',\n QU9: 'throwIfMissing can only be used in findOne queries',\n QU10: 'result empty and throwIfMissing: true',\n QU11: 'RxQuery: no valid query params given',\n QU12: 'Given index is not in schema',\n QU13: 'A top level field of the query is not included in the schema',\n QU14: 'Running a count() query in slow mode is now allowed. Either run a count() query with a selector that fully matches an index ' +\n 'or set allowSlowCount=true when calling the createRxDatabase',\n QU15: 'For count queries it is not allowed to use skip or limit',\n QU16: '$regex queries must be defined by a string, not an RegExp instance. ' +\n 'This is because RegExp objects cannot be JSON stringified and also they are mutable which would be dangerous',\n QU17: 'Chained queries cannot be used on findByIds() RxQuery instances',\n QU18: 'Malformated query result data. This likely happens because you create a OPFS-storage RxDatabase inside of a worker but did not set the usesRxDatabaseInWorker setting. https://rxdb.info/rx-storage-opfs.html#setting-usesrxdatabaseinworker-when-a-rxdatabase-is-also-used-inside-of-the-worker ',\n\n // mquery.js\n MQ1: 'path must be a string or object',\n MQ2: 'Invalid argument',\n MQ3: 'Invalid sort() argument. Must be a string, object, or array',\n MQ4: 'Invalid argument. Expected instanceof mquery or plain object',\n MQ5: 'method must be used after where() when called with these arguments',\n MQ6: 'Can\\'t mix sort syntaxes. Use either array or object | .sort([[\\'field\\', 1], [\\'test\\', -1]]) | .sort({ field: 1, test: -1 })',\n MQ7: 'Invalid sort value',\n MQ8: 'Can\\'t mix sort syntaxes. Use either array or object',\n\n // rx-database\n DB1: 'RxDocument.prepare(): another instance on this adapter has a different password',\n DB2: 'RxDatabase.addCollections(): collection-names cannot start with underscore _',\n DB3: 'RxDatabase.addCollections(): collection already exists. use myDatabase[collectionName] to get it',\n DB4: 'RxDatabase.addCollections(): schema is missing',\n DB5: 'RxDatabase.addCollections(): collection-name not allowed',\n DB6: 'RxDatabase.addCollections(): another instance created this collection with a different schema. Read this https://rxdb.info/questions-answers.html?console=qa#cant-change-the-schema ',\n // removed in 13.0.0 (now part of the encryption plugin) DB7: 'RxDatabase.addCollections(): schema encrypted but no password given',\n DB8: 'createRxDatabase(): A RxDatabase with the same name and adapter already exists.\\n' +\n 'Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional-\\n' +\n 'This often happens in react projects with hot reload that reloads the code without reloading the process.',\n DB9: 'ignoreDuplicate is only allowed in dev-mode and must never be used in production',\n // removed in 14.0.0 - PouchDB RxStorage is removed - DB9: 'createRxDatabase(): Adapter not added. Use addPouchPlugin(require(\\'pouchdb-adapter-[adaptername]\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed DB10: 'createRxDatabase(): To use leveldown-adapters, you have to add the leveldb-plugin. Use addPouchPlugin(require(\\'pouchdb-adapter-leveldb\\'));',\n DB11: 'createRxDatabase(): Invalid db-name, folder-paths must not have an ending slash',\n DB12: 'RxDatabase.addCollections(): could not write to internal store',\n DB13: 'createRxDatabase(): Invalid db-name or collection name, name contains the dollar sign',\n DB14: 'no custom reactivity factory added on database creation',\n\n // rx-collection\n COL1: 'RxDocument.insert() You cannot insert an existing document',\n COL2: 'RxCollection.insert() fieldName ._id can only be used as primaryKey',\n COL3: 'RxCollection.upsert() does not work without primary',\n COL4: 'RxCollection.incrementalUpsert() does not work without primary',\n COL5: 'RxCollection.find() if you want to search by _id, use .findOne(_id)',\n COL6: 'RxCollection.findOne() needs a queryObject or string. Notice that in RxDB, primary keys must be strings and cannot be numbers.',\n COL7: 'hook must be a function',\n COL8: 'hooks-when not known',\n COL9: 'RxCollection.addHook() hook-name not known',\n COL10: 'RxCollection .postCreate-hooks cannot be async',\n COL11: 'migrationStrategies must be an object',\n COL12: 'A migrationStrategy is missing or too much',\n COL13: 'migrationStrategy must be a function',\n COL14: 'given static method-name is not a string',\n COL15: 'static method-names cannot start with underscore _',\n COL16: 'given static method is not a function',\n COL17: 'RxCollection.ORM: statics-name not allowed',\n COL18: 'collection-method not allowed because fieldname is in the schema',\n // removed in 14.0.0, use CONFLICT instead - COL19: 'Document update conflict. When changing a document you must work on the previous revision',\n COL20: 'Storage write error',\n COL21: 'The RxCollection is closed or removed already, either from this JavaScript realm or from another, like a browser tab',\n CONFLICT: 'Document update conflict. When changing a document you must work on the previous revision',\n COL22: '.bulkInsert() and .bulkUpsert() cannot be run with multiple documents that have the same primary key',\n COL23: 'In the open-source version of RxDB, the amount of collections that can exist in parallel is limited to '+NON_PREMIUM_COLLECTION_LIMIT+'. If you already purchased the premium access, you can remove this limit: https://rxdb.info/rx-collection.html#faq',\n\n // rx-document.js\n DOC1: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n DOC2: 'cannot observe primary path',\n DOC3: 'final fields cannot be observed',\n DOC4: 'RxDocument.get$ cannot observe a non-existed field',\n DOC5: 'RxDocument.populate() cannot populate a non-existed field',\n DOC6: 'RxDocument.populate() cannot populate because path has no ref',\n DOC7: 'RxDocument.populate() ref-collection not in database',\n DOC8: 'RxDocument.set(): primary-key cannot be modified',\n DOC9: 'final fields cannot be modified',\n DOC10: 'RxDocument.set(): cannot set childpath when rootPath not selected',\n DOC11: 'RxDocument.save(): can\\'t save deleted document',\n // removed in 10.0.0 DOC12: 'RxDocument.save(): error',\n DOC13: 'RxDocument.remove(): Document is already deleted',\n DOC14: 'RxDocument.close() does not exist',\n DOC15: 'query cannot be an array',\n DOC16: 'Since version 8.0.0 RxDocument.set() can only be called on temporary RxDocuments',\n DOC17: 'Since version 8.0.0 RxDocument.save() can only be called on non-temporary documents',\n DOC18: 'Document property for composed primary key is missing',\n DOC19: 'Value of primary key(s) cannot be changed',\n DOC20: 'PrimaryKey missing',\n DOC21: 'PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace',\n DOC22: 'PrimaryKey must not contain a linebreak',\n DOC23: 'PrimaryKey must not contain a double-quote [\"]',\n DOC24: 'Given document data could not be structured cloned. This happens if you pass non-plain-json data into it, like a Date() object or a Function. ' +\n 'In vue.js this happens if you use ref() on the document data which transforms it into a Proxy object.',\n\n // data-migrator.js\n DM1: 'migrate() Migration has already run',\n DM2: 'migration of document failed final document does not match final schema',\n DM3: 'migration already running',\n DM4: 'Migration errored',\n DM5: 'Cannot open database state with newer RxDB version. You have to migrate your database state first. See https://rxdb.info/migration-storage.html?console=storage ',\n\n // plugins/attachments.js\n AT1: 'to use attachments, please define this in your schema',\n\n // plugins/encryption-crypto-js.js\n EN1: 'password is not valid',\n EN2: 'validatePassword: min-length of password not complied',\n EN3: 'Schema contains encrypted properties but no password is given',\n EN4: 'Password not valid',\n\n // plugins/json-dump.js\n JD1: 'You must create the collections before you can import their data',\n JD2: 'RxCollection.importJSON(): the imported json relies on a different schema',\n JD3: 'RxCollection.importJSON(): json.passwordHash does not match the own',\n\n // plugins/leader-election.js\n\n // plugins/local-documents.js\n LD1: 'RxDocument.allAttachments$ can\\'t use attachments on local documents',\n LD2: 'RxDocument.get(): objPath must be a string',\n LD3: 'RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed',\n LD4: 'cannot observe primary path',\n LD5: 'RxDocument.set() id cannot be modified',\n LD6: 'LocalDocument: Function is not usable on local documents',\n LD7: 'Local document already exists',\n LD8: 'localDocuments not activated. Set localDocuments=true on creation, when you want to store local documents on the RxDatabase or RxCollection.',\n\n // plugins/replication.js\n RC1: 'Replication: already added',\n RC2: 'replicateCouchDB() query must be from the same RxCollection',\n // removed in 14.0.0 - PouchDB RxStorage is removed RC3: 'RxCollection.syncCouchDB() Do not use a collection\\'s pouchdb as remote, use the collection instead',\n RC4: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication when live: true',\n RC5: 'RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication if multiInstance because the replication might run on another instance',\n RC6: 'syncFirestore() serverTimestampField MUST NOT be part of the collections schema and MUST NOT be nested.',\n RC7: 'SimplePeer requires to have process.nextTick() polyfilled, see https://rxdb.info/replication-webrtc.html?console=webrtc ',\n RC_PULL: 'RxReplication pull handler threw an error - see .errors for more details',\n RC_STREAM: 'RxReplication pull stream$ threw an error - see .errors for more details',\n RC_PUSH: 'RxReplication push handler threw an error - see .errors for more details',\n RC_PUSH_NO_AR: 'RxReplication push handler did not return an array with the conflicts',\n RC_WEBRTC_PEER: 'RxReplication WebRTC Peer has error',\n RC_COUCHDB_1: 'replicateCouchDB() url must end with a slash like \\'https://example.com/mydatabase/\\'',\n RC_COUCHDB_2: 'replicateCouchDB() did not get valid result with rows.',\n RC_OUTDATED: 'Outdated client, update required. Replication was canceled',\n RC_UNAUTHORIZED: 'Unauthorized client, update the replicationState.headers to set correct auth data',\n RC_FORBIDDEN: 'Client behaves wrong so the replication was canceled. Mostly happens if the client tries to write data that it is not allowed to',\n\n // plugins/dev-mode/check-schema.js\n SC1: 'fieldnames do not match the regex',\n SC2: 'SchemaCheck: name \\'item\\' reserved for array-fields',\n SC3: 'SchemaCheck: fieldname has a ref-array but items-type is not string',\n SC4: 'SchemaCheck: fieldname has a ref but is not type string, [string,null] or array',\n SC6: 'SchemaCheck: primary can only be defined at top-level',\n SC7: 'SchemaCheck: default-values can only be defined at top-level',\n SC8: 'SchemaCheck: first level-fields cannot start with underscore _',\n SC10: 'SchemaCheck: schema defines ._rev, this will be done automatically',\n SC11: 'SchemaCheck: schema needs a number >=0 as version',\n // removed in 10.0.0 - SC12: 'SchemaCheck: primary can only be defined once',\n SC13: 'SchemaCheck: primary is always index, do not declare it as index',\n SC14: 'SchemaCheck: primary is always unique, do not declare it as index',\n SC15: 'SchemaCheck: primary cannot be encrypted',\n SC16: 'SchemaCheck: primary must have type: string',\n SC17: 'SchemaCheck: top-level fieldname is not allowed',\n SC18: 'SchemaCheck: indexes must be an array',\n SC19: 'SchemaCheck: indexes must contain strings or arrays of strings',\n SC20: 'SchemaCheck: indexes.array must contain strings',\n SC21: 'SchemaCheck: given index is not defined in schema',\n SC22: 'SchemaCheck: given indexKey is not type:string',\n SC23: 'SchemaCheck: fieldname is not allowed',\n SC24: 'SchemaCheck: required fields must be set via array. See https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required',\n SC25: 'SchemaCheck: compoundIndexes needs to be specified in the indexes field',\n SC26: 'SchemaCheck: indexes needs to be specified at collection schema level',\n // removed in 16.0.0 - SC27: 'SchemaCheck: encrypted fields need to be specified at collection schema level',\n SC28: 'SchemaCheck: encrypted fields is not defined in the schema',\n SC29: 'SchemaCheck: missing object key \\'properties\\'',\n SC30: 'SchemaCheck: primaryKey is required',\n SC32: 'SchemaCheck: primary field must have the type string/number/integer',\n SC33: 'SchemaCheck: used primary key is not a property in the schema',\n SC34: 'Fields of type string that are used in an index, must have set the maxLength attribute in the schema',\n SC35: 'Fields of type number/integer that are used in an index, must have set the multipleOf attribute in the schema',\n SC36: 'A field of this type cannot be used as index',\n SC37: 'Fields of type number that are used in an index, must have set the minimum and maximum attribute in the schema',\n SC38: 'Fields of type boolean that are used in an index, must be required in the schema',\n SC39: 'The primary key must have the maxLength attribute set',\n SC40: '$ref fields in the schema are not allowed. RxDB cannot resolve related schemas because it would have a negative performance impact.' +\n 'It would have to run http requests on runtime. $ref fields should be resolved during build time.',\n SC41: 'minimum, maximum and maxLength values for indexes must be real numbers, not Infinity or -Infinity',\n\n // plugins/dev-mode\n // removed in 13.9.0, use PL3 instead - DEV1: 'dev-mode added multiple times',\n DVM1: 'When dev-mode is enabled, your storage must use one of the schema validators at the top level. This is because most problems people have with RxDB is because they store data that is not valid to the schema which causes strange bugs and problems.',\n\n // plugins/validate.js\n VD1: 'Sub-schema not found, does the schemaPath exists in your schema?',\n VD2: 'object does not match schema',\n\n // plugins/in-memory.js\n // removed in 14.0.0 - PouchDB RxStorage is removed IM1: 'InMemory: Memory-Adapter must be added. Use addPouchPlugin(require(\\'pouchdb-adapter-memory\\'));',\n // removed in 14.0.0 - PouchDB RxStorage is removed IM2: 'inMemoryCollection.sync(): Do not replicate with the in-memory instance. Replicate with the parent instead',\n\n // plugins/server.js\n S1: 'You cannot create collections after calling RxDatabase.server()',\n\n // plugins/replication-graphql.js\n GQL1: 'GraphQL replication: cannot find sub schema by key',\n // removed in 13.0.0, use RC_PULL instead - GQL2: 'GraphQL replication: unknown errors occurred in replication pull - see innerErrors for more details',\n GQL3: 'GraphQL replication: pull returns more documents then batchSize',\n // removed in 13.0.0, use RC_PUSH instead - GQL4: 'GraphQL replication: unknown errors occurred in replication push - see innerErrors for more details',\n\n // plugins/crdt/\n CRDT1: 'CRDT operations cannot be used because the crdt options are not set in the schema.',\n CRDT2: 'RxDocument.incrementalModify() cannot be used when CRDTs are activated.',\n CRDT3: 'To use CRDTs you MUST NOT set a conflictHandler because the default CRDT conflict handler must be used',\n\n // plugins/storage-dexie/\n DXE1: 'non-required index fields are not possible with the dexie.js RxStorage: https://github.com/pubkey/rxdb/pull/6643#issuecomment-2505310082',\n // removed in 15.0.0, added boolean index support to dexie storage - DXE1: 'The dexie.js RxStorage does not support boolean indexes, see https://rxdb.info/rx-storage-dexie.html#boolean-index',\n\n /**\n * Should never be thrown, use this for\n * null checks etc. so you do not have to increase the\n * build size with error message strings.\n */\n SNH: 'This should never happen'\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,4BAA4B,QAAQ,2BAA2B;AAGxE,OAAO,IAAMC,cAAc,GAAG;EAC1B;EACAC,GAAG,EAAE,kCAAkC;EACvCC,GAAG,kTAE8F;EACjGC,GAAG,EAAE,yEAAyE;EAC9EC,GAAG,EAAE,qCAAqC;EAC1CC,GAAG,EAAE,mGAAmG;EACxGC,GAAG,EAAE,mFAAmF;EACxFC,GAAG,EAAE,iFAAiF;EAEtF;EACAC,GAAG,EAAE,kCAAkC;EACvC;EACAC,GAAG,EAAE,+FAA+F;EAEpG;EACA;EACAC,EAAE,EAAE,kDAAkD;EACtD;;EAEA;EACAC,GAAG,EAAE,2CAA2C;EAChD;EACA;EACAC,GAAG,EAAE,+DAA+D;EACpEC,G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/storage-dexie/rx-storage-instance-dexie.js b/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js index 99d26364083..2b96a9c393e 100644 --- a/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js +++ b/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js @@ -1,5 +1,5 @@ import { Subject } from 'rxjs'; -import { now, ensureNotFalsy, defaultHashSha256, RXDB_UTILS_GLOBAL, PREMIUM_FLAG_HASH } from "../utils/index.js"; +import { now, ensureNotFalsy, hasPremiumFlag } from "../utils/index.js"; import { attachmentObjectId, closeDexieDb, fromStorageToDexie, getDexieDbWithTables, getDocsInDb, RX_STORAGE_NAME_DEXIE } from "./dexie-helper.js"; import { dexieCount, dexieQuery } from "./dexie-query.js"; import { getPrimaryFieldOfPrimaryKey } from "../../rx-schema-helper.js"; @@ -25,7 +25,7 @@ export var RxStorageInstanceDexie = /*#__PURE__*/function () { var _proto = RxStorageInstanceDexie.prototype; _proto.bulkWrite = async function bulkWrite(documentWrites, context) { ensureNotClosed(this); - if (!shownNonPremiumLog && (!RXDB_UTILS_GLOBAL.premium || typeof RXDB_UTILS_GLOBAL.premium !== 'string' || (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium)) !== PREMIUM_FLAG_HASH)) { + if (!shownNonPremiumLog && !(await hasPremiumFlag())) { console.warn(['-------------- RxDB Open Core RxStorage -------------------------------', 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ', 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.', 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.', ' https://rxdb.info/premium?console=dexie ', 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.', '---------------------------------------------------------------------'].join('\n')); shownNonPremiumLog = true; } else { diff --git a/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map b/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map index ea25ab8dd21..2b37fb8fa5c 100644 --- a/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map +++ b/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-storage-instance-dexie.js","names":["Subject","now","ensureNotFalsy","defaultHashSha256","RXDB_UTILS_GLOBAL","PREMIUM_FLAG_HASH","attachmentObjectId","closeDexieDb","fromStorageToDexie","getDexieDbWithTables","getDocsInDb","RX_STORAGE_NAME_DEXIE","dexieCount","dexieQuery","getPrimaryFieldOfPrimaryKey","categorizeBulkWriteRows","flatCloneDocWithMeta","addRxStorageMultiInstanceSupport","newRxError","instanceId","shownNonPremiumLog","RxStorageInstanceDexie","storage","databaseName","collectionName","schema","internals","options","settings","devMode","changes$","primaryPath","primaryKey","_proto","prototype","bulkWrite","documentWrites","context","ensureNotClosed","premium","console","warn","join","forEach","row","document","_rev","previous","args","state","ret","error","map","doc","documentKeys","writeRow","categorized","dexieDb","transaction","dexieTable","dexieAttachmentsTable","docsInDbMap","Map","docsInDbWithInternals","docWithDexieInternals","set","errors","bulkPutDocs","bulkInsertDocs","push","bulkUpdateDocs","d","booleanIndexes","length","bulkPut","putAttachments","attachmentsAdd","attachment","id","documentId","attachmentId","data","attachmentData","attachmentsUpdate","bulkDelete","attachmentsRemove","eventBulk","events","lastState","newestRow","checkpoint","lwt","_meta","next","findDocumentsById","ids","deleted","docsInDb","documentInDb","_deleted","query","preparedQuery","count","queryPlan","selectorSatisfiedByIndex","result","mode","documents","changeStream","asObservable","cleanup","minimumDeletedTime","maxDeletionTime","toRemove","where","below","toArray","removeIds","getAttachmentData","_digest","get","Error","remove","clear","close","closed","complete","createDexieStorageInstance","params","instance","Promise","resolve"],"sources":["../../../../src/plugins/storage-dexie/rx-storage-instance-dexie.ts"],"sourcesContent":["import {\n Subject,\n Observable\n} from 'rxjs';\nimport {\n now,\n ensureNotFalsy,\n defaultHashSha256,\n RXDB_UTILS_GLOBAL,\n PREMIUM_FLAG_HASH\n} from '../utils/index.ts';\nimport type {\n RxStorageInstance,\n RxStorageChangeEvent,\n RxDocumentData,\n BulkWriteRow,\n RxStorageBulkWriteResponse,\n RxStorageQueryResult,\n RxJsonSchema,\n RxStorageInstanceCreationParams,\n EventBulk,\n StringKeys,\n RxStorageDefaultCheckpoint,\n CategorizeBulkWriteRowsOutput,\n RxStorageCountResult,\n PreparedQuery\n} from '../../types/index.d.ts';\nimport type {\n DexieSettings,\n DexieStorageInternals\n} from '../../types/plugins/dexie.d.ts';\nimport { RxStorageDexie } from './rx-storage-dexie.ts';\nimport {\n attachmentObjectId,\n closeDexieDb,\n fromStorageToDexie,\n getDexieDbWithTables,\n getDocsInDb,\n RX_STORAGE_NAME_DEXIE\n} from './dexie-helper.ts';\nimport { dexieCount, dexieQuery } from './dexie-query.ts';\nimport { getPrimaryFieldOfPrimaryKey } from '../../rx-schema-helper.ts';\nimport { categorizeBulkWriteRows, flatCloneDocWithMeta } from '../../rx-storage-helper.ts';\nimport { addRxStorageMultiInstanceSupport } from '../../rx-storage-multiinstance.ts';\nimport { newRxError } from '../../rx-error.ts';\n\nlet instanceId = now();\n\nlet shownNonPremiumLog = false;\n\n\nexport class RxStorageInstanceDexie implements RxStorageInstance<\n RxDocType,\n DexieStorageInternals,\n DexieSettings,\n RxStorageDefaultCheckpoint\n> {\n public readonly primaryPath: StringKeys>;\n private changes$: Subject>, RxStorageDefaultCheckpoint>> = new Subject();\n public readonly instanceId = instanceId++;\n public closed?: Promise;\n\n constructor(\n public readonly storage: RxStorageDexie,\n public readonly databaseName: string,\n public readonly collectionName: string,\n public readonly schema: Readonly>>,\n public readonly internals: DexieStorageInternals,\n public readonly options: Readonly,\n public readonly settings: DexieSettings,\n public readonly devMode: boolean\n ) {\n this.primaryPath = getPrimaryFieldOfPrimaryKey(this.schema.primaryKey);\n }\n\n async bulkWrite(\n documentWrites: BulkWriteRow[],\n context: string\n ): Promise> {\n ensureNotClosed(this);\n\n\n if (\n !shownNonPremiumLog &&\n (\n !RXDB_UTILS_GLOBAL.premium ||\n typeof RXDB_UTILS_GLOBAL.premium !== 'string' ||\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) !== PREMIUM_FLAG_HASH)\n )\n ) {\n console.warn(\n [\n '-------------- RxDB Open Core RxStorage -------------------------------',\n 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ',\n 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.',\n 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.',\n ' https://rxdb.info/premium?console=dexie ',\n 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.',\n '---------------------------------------------------------------------'\n ].join('\\n')\n );\n shownNonPremiumLog = true;\n } else {\n shownNonPremiumLog = true;\n }\n\n\n /**\n * Check some assumptions to ensure RxDB\n * does not call the storage with an invalid write.\n */\n documentWrites.forEach(row => {\n // ensure revision is set\n if (\n !row.document._rev ||\n (\n row.previous &&\n !row.previous._rev\n )\n ) {\n throw newRxError('SNH', { args: { row } });\n }\n });\n\n const state = await this.internals;\n const ret: RxStorageBulkWriteResponse = {\n error: []\n };\n\n /**\n * Some storages might add any _meta fields\n * internally. To ensure RxDB can work with that in the\n * test suite, we add a random field here.\n * To ensure \n */\n if (this.devMode) {\n documentWrites = documentWrites.map(row => {\n const doc = flatCloneDocWithMeta(row.document);\n return {\n previous: row.previous,\n document: doc\n }\n })\n }\n\n\n const documentKeys: string[] = documentWrites.map(writeRow => writeRow.document[this.primaryPath] as any);\n let categorized: CategorizeBulkWriteRowsOutput | undefined;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n state.dexieAttachmentsTable,\n async () => {\n const docsInDbMap = new Map>();\n const docsInDbWithInternals = await getDocsInDb(this.internals, documentKeys);\n docsInDbWithInternals.forEach(docWithDexieInternals => {\n const doc = docWithDexieInternals;\n if (doc) {\n docsInDbMap.set((doc as any)[this.primaryPath], doc as any);\n }\n return doc;\n });\n\n categorized = categorizeBulkWriteRows(\n this,\n this.primaryPath as any,\n docsInDbMap,\n documentWrites,\n context\n );\n ret.error = categorized.errors;\n\n /**\n * Batch up the database operations\n * so we can later run them in bulk.\n */\n let bulkPutDocs: any[] = [];\n categorized.bulkInsertDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n categorized.bulkUpdateDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n bulkPutDocs = bulkPutDocs.map(d => fromStorageToDexie(state.booleanIndexes, d));\n\n if (bulkPutDocs.length > 0) {\n await state.dexieTable.bulkPut(bulkPutDocs);\n }\n\n // handle attachments\n const putAttachments: { id: string, data: string }[] = [];\n categorized.attachmentsAdd.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n categorized.attachmentsUpdate.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n await state.dexieAttachmentsTable.bulkPut(putAttachments);\n await state.dexieAttachmentsTable.bulkDelete(\n categorized.attachmentsRemove.map(attachment => attachmentObjectId(attachment.documentId, attachment.attachmentId))\n );\n\n });\n\n categorized = ensureNotFalsy(categorized);\n if (categorized.eventBulk.events.length > 0) {\n const lastState = ensureNotFalsy(categorized.newestRow).document;\n categorized.eventBulk.checkpoint = {\n id: lastState[this.primaryPath],\n lwt: lastState._meta.lwt\n };\n this.changes$.next(categorized.eventBulk);\n }\n\n return ret;\n }\n\n async findDocumentsById(\n ids: string[],\n deleted: boolean\n ): Promise[]> {\n ensureNotClosed(this);\n const state = await this.internals;\n const ret: RxDocumentData[] = [];\n\n await state.dexieDb.transaction(\n 'r',\n state.dexieTable,\n async () => {\n const docsInDb = await getDocsInDb(this.internals, ids);\n docsInDb.forEach(documentInDb => {\n if (\n documentInDb &&\n (!documentInDb._deleted || deleted)\n ) {\n ret.push(documentInDb);\n }\n });\n });\n return ret;\n }\n\n query(preparedQuery: PreparedQuery): Promise> {\n ensureNotClosed(this);\n return dexieQuery(\n this,\n preparedQuery\n );\n }\n async count(\n preparedQuery: PreparedQuery\n ): Promise {\n if (preparedQuery.queryPlan.selectorSatisfiedByIndex) {\n const result = await dexieCount(this, preparedQuery);\n return {\n count: result,\n mode: 'fast'\n };\n } else {\n const result = await dexieQuery(this, preparedQuery);\n return {\n count: result.documents.length,\n mode: 'slow'\n };\n }\n }\n\n changeStream(): Observable>, RxStorageDefaultCheckpoint>> {\n ensureNotClosed(this);\n return this.changes$.asObservable();\n }\n\n async cleanup(minimumDeletedTime: number): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n async () => {\n const maxDeletionTime = now() - minimumDeletedTime;\n const toRemove = await state.dexieTable\n .where('_meta.lwt')\n .below(maxDeletionTime)\n .toArray();\n const removeIds: string[] = [];\n toRemove.forEach(doc => {\n if (doc._deleted === '1') {\n removeIds.push(doc[this.primaryPath]);\n }\n });\n await state.dexieTable.bulkDelete(removeIds);\n }\n );\n\n return true;\n }\n\n async getAttachmentData(documentId: string, attachmentId: string, _digest: string): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n const id = attachmentObjectId(documentId, attachmentId);\n return await state.dexieDb.transaction(\n 'r',\n state.dexieAttachmentsTable,\n async () => {\n\n const attachment = await state.dexieAttachmentsTable.get(id);\n if (attachment) {\n return attachment.data;\n } else {\n throw new Error('attachment missing documentId: ' + documentId + ' attachmentId: ' + attachmentId);\n }\n });\n }\n\n async remove(): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieTable.clear()\n return this.close();\n }\n\n\n close(): Promise {\n if (this.closed) {\n return this.closed;\n }\n this.closed = (async () => {\n this.changes$.complete();\n await closeDexieDb(this.internals);\n })();\n return this.closed;\n }\n}\n\n\nexport async function createDexieStorageInstance(\n storage: RxStorageDexie,\n params: RxStorageInstanceCreationParams,\n settings: DexieSettings\n): Promise> {\n const internals = getDexieDbWithTables(\n params.databaseName,\n params.collectionName,\n settings,\n params.schema\n );\n\n const instance = new RxStorageInstanceDexie(\n storage,\n params.databaseName,\n params.collectionName,\n params.schema,\n internals,\n params.options,\n settings,\n params.devMode\n );\n\n await addRxStorageMultiInstanceSupport(\n RX_STORAGE_NAME_DEXIE,\n params,\n instance\n );\n\n return Promise.resolve(instance);\n}\n\n\n\nfunction ensureNotClosed(\n instance: RxStorageInstanceDexie\n) {\n if (instance.closed) {\n throw new Error('RxStorageInstanceDexie is closed ' + instance.databaseName + '-' + instance.collectionName);\n }\n}\n"],"mappings":"AAAA,SACIA,OAAO,QAEJ,MAAM;AACb,SACIC,GAAG,EACHC,cAAc,EACdC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,QACd,mBAAmB;AAsB1B,SACIC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,oBAAoB,EACpBC,WAAW,EACXC,qBAAqB,QAClB,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,UAAU,QAAQ,kBAAkB;AACzD,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,4BAA4B;AAC1F,SAASC,gCAAgC,QAAQ,mCAAmC;AACpF,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,IAAIC,UAAU,GAAGlB,GAAG,CAAC,CAAC;AAEtB,IAAImB,kBAAkB,GAAG,KAAK;AAG9B,WAAaC,sBAAsB;EAW/B,SAAAA,uBACoBC,OAAuB,EACvBC,YAAoB,EACpBC,cAAsB,EACtBC,MAAyD,EACzDC,SAAgC,EAChCC,OAAgC,EAChCC,QAAuB,EACvBC,OAAgB,EAClC;IAAA,KAbMC,QAAQ,GAAoG,IAAI9B,OAAO,CAAC,CAAC;IAAA,KACjHmB,UAAU,GAAGA,UAAU,EAAE;IAAA,KAIrBG,OAAuB,GAAvBA,OAAuB;IAAA,KACvBC,YAAoB,GAApBA,YAAoB;IAAA,KACpBC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{"version":3,"file":"rx-storage-instance-dexie.js","names":["Subject","now","ensureNotFalsy","hasPremiumFlag","attachmentObjectId","closeDexieDb","fromStorageToDexie","getDexieDbWithTables","getDocsInDb","RX_STORAGE_NAME_DEXIE","dexieCount","dexieQuery","getPrimaryFieldOfPrimaryKey","categorizeBulkWriteRows","flatCloneDocWithMeta","addRxStorageMultiInstanceSupport","newRxError","instanceId","shownNonPremiumLog","RxStorageInstanceDexie","storage","databaseName","collectionName","schema","internals","options","settings","devMode","changes$","primaryPath","primaryKey","_proto","prototype","bulkWrite","documentWrites","context","ensureNotClosed","console","warn","join","forEach","row","document","_rev","previous","args","state","ret","error","map","doc","documentKeys","writeRow","categorized","dexieDb","transaction","dexieTable","dexieAttachmentsTable","docsInDbMap","Map","docsInDbWithInternals","docWithDexieInternals","set","errors","bulkPutDocs","bulkInsertDocs","push","bulkUpdateDocs","d","booleanIndexes","length","bulkPut","putAttachments","attachmentsAdd","attachment","id","documentId","attachmentId","data","attachmentData","attachmentsUpdate","bulkDelete","attachmentsRemove","eventBulk","events","lastState","newestRow","checkpoint","lwt","_meta","next","findDocumentsById","ids","deleted","docsInDb","documentInDb","_deleted","query","preparedQuery","count","queryPlan","selectorSatisfiedByIndex","result","mode","documents","changeStream","asObservable","cleanup","minimumDeletedTime","maxDeletionTime","toRemove","where","below","toArray","removeIds","getAttachmentData","_digest","get","Error","remove","clear","close","closed","complete","createDexieStorageInstance","params","instance","Promise","resolve"],"sources":["../../../../src/plugins/storage-dexie/rx-storage-instance-dexie.ts"],"sourcesContent":["import {\n Subject,\n Observable\n} from 'rxjs';\nimport {\n now,\n ensureNotFalsy,\n defaultHashSha256,\n RXDB_UTILS_GLOBAL,\n PREMIUM_FLAG_HASH,\n hasPremiumFlag\n} from '../utils/index.ts';\nimport type {\n RxStorageInstance,\n RxStorageChangeEvent,\n RxDocumentData,\n BulkWriteRow,\n RxStorageBulkWriteResponse,\n RxStorageQueryResult,\n RxJsonSchema,\n RxStorageInstanceCreationParams,\n EventBulk,\n StringKeys,\n RxStorageDefaultCheckpoint,\n CategorizeBulkWriteRowsOutput,\n RxStorageCountResult,\n PreparedQuery\n} from '../../types/index.d.ts';\nimport type {\n DexieSettings,\n DexieStorageInternals\n} from '../../types/plugins/dexie.d.ts';\nimport { RxStorageDexie } from './rx-storage-dexie.ts';\nimport {\n attachmentObjectId,\n closeDexieDb,\n fromStorageToDexie,\n getDexieDbWithTables,\n getDocsInDb,\n RX_STORAGE_NAME_DEXIE\n} from './dexie-helper.ts';\nimport { dexieCount, dexieQuery } from './dexie-query.ts';\nimport { getPrimaryFieldOfPrimaryKey } from '../../rx-schema-helper.ts';\nimport { categorizeBulkWriteRows, flatCloneDocWithMeta } from '../../rx-storage-helper.ts';\nimport { addRxStorageMultiInstanceSupport } from '../../rx-storage-multiinstance.ts';\nimport { newRxError } from '../../rx-error.ts';\n\nlet instanceId = now();\n\nlet shownNonPremiumLog = false;\n\n\nexport class RxStorageInstanceDexie implements RxStorageInstance<\n RxDocType,\n DexieStorageInternals,\n DexieSettings,\n RxStorageDefaultCheckpoint\n> {\n public readonly primaryPath: StringKeys>;\n private changes$: Subject>, RxStorageDefaultCheckpoint>> = new Subject();\n public readonly instanceId = instanceId++;\n public closed?: Promise;\n\n constructor(\n public readonly storage: RxStorageDexie,\n public readonly databaseName: string,\n public readonly collectionName: string,\n public readonly schema: Readonly>>,\n public readonly internals: DexieStorageInternals,\n public readonly options: Readonly,\n public readonly settings: DexieSettings,\n public readonly devMode: boolean\n ) {\n this.primaryPath = getPrimaryFieldOfPrimaryKey(this.schema.primaryKey);\n }\n\n async bulkWrite(\n documentWrites: BulkWriteRow[],\n context: string\n ): Promise> {\n ensureNotClosed(this);\n\n\n if (\n !shownNonPremiumLog &&\n !(await hasPremiumFlag())\n ) {\n console.warn(\n [\n '-------------- RxDB Open Core RxStorage -------------------------------',\n 'You are using the free Dexie.js based RxStorage implementation from RxDB https://rxdb.info/rx-storage-dexie.html?console=dexie ',\n 'While this is a great option, we want to let you know that there are faster storage solutions available in our premium plugins.',\n 'For professional users and production environments, we highly recommend considering these premium options to enhance performance and reliability.',\n ' https://rxdb.info/premium?console=dexie ',\n 'If you already purchased premium access you can disable this log by calling the setPremiumFlag() function from rxdb-premium/plugins/shared.',\n '---------------------------------------------------------------------'\n ].join('\\n')\n );\n shownNonPremiumLog = true;\n } else {\n shownNonPremiumLog = true;\n }\n\n\n /**\n * Check some assumptions to ensure RxDB\n * does not call the storage with an invalid write.\n */\n documentWrites.forEach(row => {\n // ensure revision is set\n if (\n !row.document._rev ||\n (\n row.previous &&\n !row.previous._rev\n )\n ) {\n throw newRxError('SNH', { args: { row } });\n }\n });\n\n const state = await this.internals;\n const ret: RxStorageBulkWriteResponse = {\n error: []\n };\n\n /**\n * Some storages might add any _meta fields\n * internally. To ensure RxDB can work with that in the\n * test suite, we add a random field here.\n * To ensure \n */\n if (this.devMode) {\n documentWrites = documentWrites.map(row => {\n const doc = flatCloneDocWithMeta(row.document);\n return {\n previous: row.previous,\n document: doc\n }\n })\n }\n\n\n const documentKeys: string[] = documentWrites.map(writeRow => writeRow.document[this.primaryPath] as any);\n let categorized: CategorizeBulkWriteRowsOutput | undefined;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n state.dexieAttachmentsTable,\n async () => {\n const docsInDbMap = new Map>();\n const docsInDbWithInternals = await getDocsInDb(this.internals, documentKeys);\n docsInDbWithInternals.forEach(docWithDexieInternals => {\n const doc = docWithDexieInternals;\n if (doc) {\n docsInDbMap.set((doc as any)[this.primaryPath], doc as any);\n }\n return doc;\n });\n\n categorized = categorizeBulkWriteRows(\n this,\n this.primaryPath as any,\n docsInDbMap,\n documentWrites,\n context\n );\n ret.error = categorized.errors;\n\n /**\n * Batch up the database operations\n * so we can later run them in bulk.\n */\n let bulkPutDocs: any[] = [];\n categorized.bulkInsertDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n categorized.bulkUpdateDocs.forEach(row => {\n bulkPutDocs.push(row.document);\n });\n bulkPutDocs = bulkPutDocs.map(d => fromStorageToDexie(state.booleanIndexes, d));\n\n if (bulkPutDocs.length > 0) {\n await state.dexieTable.bulkPut(bulkPutDocs);\n }\n\n // handle attachments\n const putAttachments: { id: string, data: string }[] = [];\n categorized.attachmentsAdd.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n categorized.attachmentsUpdate.forEach(attachment => {\n putAttachments.push({\n id: attachmentObjectId(attachment.documentId, attachment.attachmentId),\n data: attachment.attachmentData.data\n });\n });\n await state.dexieAttachmentsTable.bulkPut(putAttachments);\n await state.dexieAttachmentsTable.bulkDelete(\n categorized.attachmentsRemove.map(attachment => attachmentObjectId(attachment.documentId, attachment.attachmentId))\n );\n\n });\n\n categorized = ensureNotFalsy(categorized);\n if (categorized.eventBulk.events.length > 0) {\n const lastState = ensureNotFalsy(categorized.newestRow).document;\n categorized.eventBulk.checkpoint = {\n id: lastState[this.primaryPath],\n lwt: lastState._meta.lwt\n };\n this.changes$.next(categorized.eventBulk);\n }\n\n return ret;\n }\n\n async findDocumentsById(\n ids: string[],\n deleted: boolean\n ): Promise[]> {\n ensureNotClosed(this);\n const state = await this.internals;\n const ret: RxDocumentData[] = [];\n\n await state.dexieDb.transaction(\n 'r',\n state.dexieTable,\n async () => {\n const docsInDb = await getDocsInDb(this.internals, ids);\n docsInDb.forEach(documentInDb => {\n if (\n documentInDb &&\n (!documentInDb._deleted || deleted)\n ) {\n ret.push(documentInDb);\n }\n });\n });\n return ret;\n }\n\n query(preparedQuery: PreparedQuery): Promise> {\n ensureNotClosed(this);\n return dexieQuery(\n this,\n preparedQuery\n );\n }\n async count(\n preparedQuery: PreparedQuery\n ): Promise {\n if (preparedQuery.queryPlan.selectorSatisfiedByIndex) {\n const result = await dexieCount(this, preparedQuery);\n return {\n count: result,\n mode: 'fast'\n };\n } else {\n const result = await dexieQuery(this, preparedQuery);\n return {\n count: result.documents.length,\n mode: 'slow'\n };\n }\n }\n\n changeStream(): Observable>, RxStorageDefaultCheckpoint>> {\n ensureNotClosed(this);\n return this.changes$.asObservable();\n }\n\n async cleanup(minimumDeletedTime: number): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieDb.transaction(\n 'rw',\n state.dexieTable,\n async () => {\n const maxDeletionTime = now() - minimumDeletedTime;\n const toRemove = await state.dexieTable\n .where('_meta.lwt')\n .below(maxDeletionTime)\n .toArray();\n const removeIds: string[] = [];\n toRemove.forEach(doc => {\n if (doc._deleted === '1') {\n removeIds.push(doc[this.primaryPath]);\n }\n });\n await state.dexieTable.bulkDelete(removeIds);\n }\n );\n\n return true;\n }\n\n async getAttachmentData(documentId: string, attachmentId: string, _digest: string): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n const id = attachmentObjectId(documentId, attachmentId);\n return await state.dexieDb.transaction(\n 'r',\n state.dexieAttachmentsTable,\n async () => {\n\n const attachment = await state.dexieAttachmentsTable.get(id);\n if (attachment) {\n return attachment.data;\n } else {\n throw new Error('attachment missing documentId: ' + documentId + ' attachmentId: ' + attachmentId);\n }\n });\n }\n\n async remove(): Promise {\n ensureNotClosed(this);\n const state = await this.internals;\n await state.dexieTable.clear()\n return this.close();\n }\n\n\n close(): Promise {\n if (this.closed) {\n return this.closed;\n }\n this.closed = (async () => {\n this.changes$.complete();\n await closeDexieDb(this.internals);\n })();\n return this.closed;\n }\n}\n\n\nexport async function createDexieStorageInstance(\n storage: RxStorageDexie,\n params: RxStorageInstanceCreationParams,\n settings: DexieSettings\n): Promise> {\n const internals = getDexieDbWithTables(\n params.databaseName,\n params.collectionName,\n settings,\n params.schema\n );\n\n const instance = new RxStorageInstanceDexie(\n storage,\n params.databaseName,\n params.collectionName,\n params.schema,\n internals,\n params.options,\n settings,\n params.devMode\n );\n\n await addRxStorageMultiInstanceSupport(\n RX_STORAGE_NAME_DEXIE,\n params,\n instance\n );\n\n return Promise.resolve(instance);\n}\n\n\n\nfunction ensureNotClosed(\n instance: RxStorageInstanceDexie\n) {\n if (instance.closed) {\n throw new Error('RxStorageInstanceDexie is closed ' + instance.databaseName + '-' + instance.collectionName);\n }\n}\n"],"mappings":"AAAA,SACIA,OAAO,QAEJ,MAAM;AACb,SACIC,GAAG,EACHC,cAAc,EAIdC,cAAc,QACX,mBAAmB;AAsB1B,SACIC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,oBAAoB,EACpBC,WAAW,EACXC,qBAAqB,QAClB,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,UAAU,QAAQ,kBAAkB;AACzD,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,4BAA4B;AAC1F,SAASC,gCAAgC,QAAQ,mCAAmC;AACpF,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,IAAIC,UAAU,GAAGhB,GAAG,CAAC,CAAC;AAEtB,IAAIiB,kBAAkB,GAAG,KAAK;AAG9B,WAAaC,sBAAsB;EAW/B,SAAAA,uBACoBC,OAAuB,EACvBC,YAAoB,EACpBC,cAAsB,EACtBC,MAAyD,EACzDC,SAAgC,EAChCC,OAAgC,EAChCC,QAAuB,EACvBC,OAAgB,EAClC;IAAA,KAbMC,QAAQ,GAAoG,IAAI5B,OAAO,CAAC,CAAC;IAAA,KACjHiB,UAAU,GAAGA,UAAU,EAAE;IAAA,KAIrBG,OAAuB,GAAvBA,OAAuB;IAAA,KACvBC,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,cAAsB,GAAtBA,cAAsB;IAAA,KACtBC,MAAyD,GAAzDA,MAAyD;IAAA,KACzDC,SAAgC,GAAhCA,SAAgC;IAAA,KAChCC,OAAgC,GAAhCA,OAAgC;IAAA,KAChCC,QAAuB,GAAvBA,QAAuB;IAAA,KACvBC,OAAgB,GAAhBA,OAAgB;IAEhC,IAAI,CAACE,WAAW,GAAGjB,2BAA2B,CAAC,IAAI,CAACW,MAAM,CAACO,UAAU,CAAC;EAC1E;EAAC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AAA;AAAA;AAIL,OAAO,eAAeyG,0BAA0BA,CAC5CxG,OAAuB,EACvByG,MAAiE,EACjEnG,QAAuB,EACmB;EAC1C,IAAMF,SAAS,GAAGjB,oBAAoB,CAClCsH,MAAM,CAACxG,YAAY,EACnBwG,MAAM,CAACvG,cAAc,EACrBI,QAAQ,EACRmG,MAAM,CAACtG,MACX,CAAC;EAED,IAAMuG,QAAQ,GAAG,IAAI3G,sBAAsB,CACvCC,OAAO,EACPyG,MAAM,CAACxG,YAAY,EACnBwG,MAAM,CAACvG,cAAc,EACrBuG,MAAM,CAACtG,MAAM,EACbC,SAAS,EACTqG,MAAM,CAACpG,OAAO,EACdC,QAAQ,EACRmG,MAAM,CAAClG,OACX,CAAC;EAED,MAAMZ,gCAAgC,CAClCN,qBAAqB,EACrBoH,MAAM,EACNC,QACJ,CAAC;EAED,OAAOC,OAAO,CAACC,OAAO,CAACF,QAAQ,CAAC;AACpC;AAIA,SAAS1F,eAAeA,CACpB0F,QAAqC,EACvC;EACE,IAAIA,QAAQ,CAACJ,MAAM,EAAE;IACjB,MAAM,IAAIJ,KAAK,CAAC,mCAAmC,GAAGQ,QAAQ,CAACzG,YAAY,GAAG,GAAG,GAAGyG,QAAQ,CAACxG,cAAc,CAAC;EAChH;AACJ","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/test-utils/schema-objects.js b/dist/esm/plugins/test-utils/schema-objects.js index 52c09c78e0f..12e49ae52c4 100644 --- a/dist/esm/plugins/test-utils/schema-objects.js +++ b/dist/esm/plugins/test-utils/schema-objects.js @@ -231,7 +231,7 @@ export function humanWithTimestampData(givenData = {}) { var averageSchemaForFieldLength = schemas.averageSchema(); export function averageSchemaData(partial = {}) { return Object.assign({}, { - id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 3), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)), + id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 1), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)), var1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength)), var2: randomNumber(100, ensureNotFalsy(averageSchemaForFieldLength.properties.var2.maximum)), deep: { diff --git a/dist/esm/plugins/test-utils/schema-objects.js.map b/dist/esm/plugins/test-utils/schema-objects.js.map index 6d7bc533c53..d7a575de82b 100644 --- a/dist/esm/plugins/test-utils/schema-objects.js.map +++ b/dist/esm/plugins/test-utils/schema-objects.js.map @@ -1 +1 @@ -{"version":3,"file":"schema-objects.js","names":["randomNumber","schemas","appendToArray","ensureNotFalsy","lastOfArray","TEST_DATA_CHARSET","TEST_DATA_CHARSET_LAST_SORTED","split","sort","someEmojisArr","baseChars","allChars","slice","randomStringWithSpecialChars","minLength","maxLength","text","Error","length","Math","floor","random","humanData","passportId","age","firstName","lastName","simpleHumanData","simpleHumanV3Data","partial","defaultObj","Object","assign","simpleHumanAge","humanWithSubOther","other","NoIndexHuman","nestedHumanData","mainSkill","name","level","deepNestedHumanData","attack","good","count","bigHumanDocumentType","dnaHash","heroArrayData","skills","Array","fill","map","damage","simpleHeroArray","encryptedHumanData","secret","encryptedObjectHumanData","subname","encryptedDeepHumanDocumentType","firstLevelPassword","secretData","pw","deepSecret","darkhole","nestedSecret","compoundIndexData","passportCountry","compoundIndexNoStringData","nostringIndex","refHumanData","bestFriend","refHumanNestedData","foo","humanWithTimestampData","givenData","ret","id","updatedAt","Date","now","averageSchemaForFieldLength","averageSchema","averageSchemaData","properties","var1","var2","maximum","deep","deep1","deep2","deeper","deepNr","list","pointData","x","y","humanWithIdAndAgeIndexDocumentType","humanWithCompositePrimary","info"],"sources":["../../../../src/plugins/test-utils/schema-objects.ts"],"sourcesContent":["/**\n * this file contains objects which match the schemas in schemas.js\n */\n\nimport {\n randomNumber\n} from 'async-test-util';\nimport { HumanDocumentType } from './schemas.ts';\nimport * as schemas from './schemas.ts';\nimport { appendToArray, ensureNotFalsy, lastOfArray } from '../utils/index.ts';\n\n\n/**\n * Some storages had problems with umlauts and other special chars.\n * So we add these to all test strings.\n */\nexport const TEST_DATA_CHARSET = '0987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüÖÄßÜ[]{}\\'';\nexport const TEST_DATA_CHARSET_LAST_SORTED = ensureNotFalsy(lastOfArray(TEST_DATA_CHARSET.split('').sort()));\nconst someEmojisArr = ['😊', '💩', '👵', '🍌', '🏳️‍🌈', '😃'];\n\nconst baseChars = TEST_DATA_CHARSET.split('');\nconst allChars = baseChars.slice(0);\nappendToArray(allChars, someEmojisArr);\n\nexport function randomStringWithSpecialChars(\n minLength: number,\n /**\n * It has shown that alternating string lengths\n * can reproduce various problems. So by having variable\n * lengths we ensure that this fully works.\n */\n maxLength: number\n) {\n let text = '';\n\n if (!minLength || !maxLength || minLength > maxLength) {\n throw new Error('invalid length given ' + minLength + ' ' + maxLength);\n }\n\n const length = randomNumber(minLength, maxLength);\n\n while (text.length < length) {\n if (text.length === 0) {\n /**\n * TODO foundationdb does not work correctly when an index string starts\n * with an emoji. This can likely be fixed by upgrading foundationdb to the\n * latest version.\n */\n text += baseChars[Math.floor(Math.random() * baseChars.length)];\n } else {\n text += allChars[Math.floor(Math.random() * allChars.length)];\n }\n }\n\n /**\n * Because emojis can have a string.length of 2,\n * we can sometimes end up with strings that are longer\n * than the provided length. In that cases we have to rerun.\n */\n if (text.length > length) {\n return randomStringWithSpecialChars(minLength, maxLength);\n }\n\n return text;\n}\n\nexport interface SimpleHumanDocumentType {\n passportId: string;\n firstName: string;\n lastName: string;\n}\n\nexport function humanData(\n passportId: string = randomStringWithSpecialChars(8, 12),\n age: number = randomNumber(10, 50),\n firstName: string = randomStringWithSpecialChars(8, 12)\n): HumanDocumentType {\n return {\n passportId: passportId,\n firstName,\n lastName: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport function simpleHumanData(): SimpleHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface SimpleHumanV3DocumentType {\n passportId: string;\n age: number;\n oneOptional?: string;\n}\nexport function simpleHumanV3Data(partial: Partial = {}): SimpleHumanV3DocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface SimpleHumanAgeDocumentType {\n passportId: string;\n age: string;\n}\nexport function simpleHumanAge(partial: Partial = {}): SimpleHumanAgeDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50) + ''\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface HumanWithSubOtherDocumentType {\n passportId: string;\n other: {\n age: number;\n };\n}\nexport function humanWithSubOther(): HumanWithSubOtherDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n other: {\n age: randomNumber(10, 50)\n }\n };\n}\n\nexport interface NoIndexHumanDocumentType {\n firstName: string;\n lastName: string;\n}\nexport function NoIndexHuman(): NoIndexHumanDocumentType {\n return {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface NestedHumanDocumentType {\n passportId: string;\n firstName: string;\n mainSkill: {\n name: string;\n level: number;\n };\n}\nexport function nestedHumanData(partial: Partial = {}): NestedHumanDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n level: 5\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface DeepNestedHumanDocumentType {\n passportId: string;\n mainSkill: {\n name: string;\n attack: {\n good: boolean;\n count: number;\n };\n };\n}\nexport function deepNestedHumanData(): DeepNestedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n attack: {\n good: false,\n count: 5\n }\n }\n };\n}\n\nexport interface BigHumanDocumentType {\n passportId: string;\n dnaHash: string;\n firstName: string;\n lastName: string;\n age: number;\n}\nexport function bigHumanDocumentType(): BigHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n dnaHash: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface HeroArrayDocumentType {\n name: string;\n skills: {\n name: string;\n damage: number;\n }[];\n}\nexport function heroArrayData(): HeroArrayDocumentType {\n return {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => {\n return {\n name: randomStringWithSpecialChars(4, 6),\n damage: randomNumber(10, 50)\n };\n })\n };\n}\n\nexport interface SimpleHeroArrayDocumentType {\n name: string;\n skills: string[];\n}\nexport function simpleHeroArray(partial: Partial = {}): SimpleHeroArrayDocumentType {\n const defaultObj = {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => randomStringWithSpecialChars(3, 6))\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface EncryptedHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: string;\n}\nexport function encryptedHumanData(secret = randomStringWithSpecialChars(8, 12)): EncryptedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret\n };\n}\n\nexport interface EncryptedObjectHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: {\n name: string;\n subname: string;\n };\n}\nexport function encryptedObjectHumanData(): EncryptedObjectHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret: {\n name: randomStringWithSpecialChars(8, 12),\n subname: randomStringWithSpecialChars(8, 12)\n }\n };\n}\n\nexport interface EncryptedDeepHumanDocumentType {\n passportId: string;\n firstName: string;\n firstLevelPassword: string;\n secretData: {\n pw: string;\n };\n deepSecret: {\n darkhole: {\n pw: string;\n };\n };\n nestedSecret: {\n darkhole: {\n pw: string;\n };\n };\n}\nexport function encryptedDeepHumanDocumentType(): EncryptedDeepHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n firstLevelPassword: randomStringWithSpecialChars(8, 12),\n secretData: {\n pw: randomStringWithSpecialChars(8, 12)\n },\n deepSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n },\n nestedSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n }\n };\n}\n\nexport interface CompoundIndexDocumentType {\n passportId: string;\n passportCountry: string;\n age: number;\n}\nexport function compoundIndexData(): CompoundIndexDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface CompoundIndexNoStringDocumentType {\n passportId: string;\n passportCountry: { [prop: string]: string; };\n age: number;\n}\nexport function compoundIndexNoStringData(): CompoundIndexNoStringDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: { [randomStringWithSpecialChars(8, 12)]: randomStringWithSpecialChars(8, 12) },\n age: randomNumber(10, 50)\n };\n}\n\nexport interface NostringIndexDocumentType {\n passportId: {};\n firstName: string;\n}\nexport function nostringIndex(): NostringIndexDocumentType {\n return {\n passportId: {},\n firstName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface RefHumanDocumentType {\n name: string;\n bestFriend: string;\n}\nexport function refHumanData(bestFriend?: string): RefHumanDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n bestFriend\n } as any;\n}\n\nexport interface RefHumanNestedDocumentType {\n name: string;\n foo: {\n bestFriend: string;\n };\n}\nexport function refHumanNestedData(bestFriend?: string): RefHumanNestedDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n foo: {\n bestFriend\n } as any\n };\n}\nexport interface HumanWithTimestampNestedDocumentType extends HumanWithTimestampDocumentType {\n address?: {\n street: string;\n suite: string;\n city: string;\n zipcode: string;\n geo: {\n lat: string;\n lng: string;\n };\n }\n}\n\nexport interface HumanWithTimestampDocumentType {\n id: string;\n name: string;\n age: number;\n updatedAt: number;\n deletedAt?: number;\n}\nexport function humanWithTimestampData(givenData: Partial = {}): HumanWithTimestampDocumentType {\n let ret = {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age: randomNumber(1, 100),\n // use some time in the past week\n updatedAt: Date.now()\n };\n ret = Object.assign({}, ret, givenData);\n return ret;\n}\n\nexport interface AverageSchemaDocumentType {\n id: string;\n var1: string;\n var2: number;\n deep: {\n deep1: string;\n deep2: string;\n deeper: {\n deepNr: number;\n };\n };\n list: {\n deep1: string;\n deep2: string;\n }[];\n}\n\n\nconst averageSchemaForFieldLength = schemas.averageSchema() as any;\nexport function averageSchemaData(\n partial: Partial = {}\n): AverageSchemaDocumentType {\n return Object.assign(\n {},\n {\n id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 3), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)),\n var1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength)),\n var2: randomNumber(100, ensureNotFalsy(averageSchemaForFieldLength.properties.var2.maximum)),\n deep: {\n deep1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength)),\n deep2: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength)),\n deeper: {\n deepNr: randomNumber(0, 10)\n }\n },\n list: new Array(5).fill(0).map(() => ({\n deep1: randomStringWithSpecialChars(2, 5),\n deep2: randomStringWithSpecialChars(5, 8)\n }))\n },\n partial\n );\n}\n\nexport interface PointDocumentType {\n id: string;\n x: number;\n y: number;\n}\nexport function pointData(): PointDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n x: randomNumber(1, 100),\n y: randomNumber(1, 100)\n };\n}\n\nexport interface HumanWithIdAndAgeIndexDocumentType {\n id: string;\n name: string;\n age: number;\n}\nexport function humanWithIdAndAgeIndexDocumentType(\n age: number = randomNumber(1, 100)\n): HumanWithIdAndAgeIndexDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport type HumanWithCompositePrimary = {\n // optional because it might be created by RxDB and not known before\n id?: string;\n firstName: string;\n lastName: string;\n info: {\n age: number;\n };\n};\nexport function humanWithCompositePrimary(partial: Partial = {}): HumanWithCompositePrimary {\n const defaultObj = {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n info: {\n age: randomNumber(10, 50)\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SACIA,YAAY,QACT,iBAAiB;AAExB,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,aAAa,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;;AAG9E;AACA;AACA;AACA;AACA,OAAO,IAAMC,iBAAiB,GAAG,6EAA6E;AAC9G,OAAO,IAAMC,6BAA6B,GAAGH,cAAc,CAACC,WAAW,CAACC,iBAAiB,CAACE,KAAK,CAAC,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5G,IAAMC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAA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,EAAE,CAAC;IAC5C,CAAC,CAAC;EACN,CAAC,EACDgB,OACJ,CAAC;AACL;AAOA,OAAO,SAASgE,SAASA,CAAA,EAAsB;EAC3C,OAAO;IACHjB,EAAE,EAAE/D,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IACvCiF,CAAC,EAAE9F,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC;IACvB+F,CAAC,EAAE/F,YAAY,CAAC,CAAC,EAAE,GAAG;EAC1B,CAAC;AACL;AAOA,OAAO,SAASgG,kCAAkCA,CAC9CxE,GAAW,GAAGxB,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,EACA;EAClC,OAAO;IACH4E,EAAE,EAAE/D,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IACvC0B,IAAI,EAAE1B,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IACzCW;EACJ,CAAC;AACL;AAWA,OAAO,SAASyE,yBAAyBA,CAACpE,OAA2C,GAAG,CAAC,CAAC,EAA6B;EACnH,IAAMC,UAAU,GAAG;IACfL,SAAS,EAAEZ,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC9Ca,QAAQ,EAAEb,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7CqF,IAAI,EAAE;MACF1E,GAAG,EAAExB,YAAY,CAAC,EAAE,EAAE,EAAE;IAC5B;EACJ,CAAC;EACD,OAAO+B,MAAM,CAACC,MAAM,CAChBF,UAAU,EACVD,OACJ,CAAC;AACL","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"schema-objects.js","names":["randomNumber","schemas","appendToArray","ensureNotFalsy","lastOfArray","TEST_DATA_CHARSET","TEST_DATA_CHARSET_LAST_SORTED","split","sort","someEmojisArr","baseChars","allChars","slice","randomStringWithSpecialChars","minLength","maxLength","text","Error","length","Math","floor","random","humanData","passportId","age","firstName","lastName","simpleHumanData","simpleHumanV3Data","partial","defaultObj","Object","assign","simpleHumanAge","humanWithSubOther","other","NoIndexHuman","nestedHumanData","mainSkill","name","level","deepNestedHumanData","attack","good","count","bigHumanDocumentType","dnaHash","heroArrayData","skills","Array","fill","map","damage","simpleHeroArray","encryptedHumanData","secret","encryptedObjectHumanData","subname","encryptedDeepHumanDocumentType","firstLevelPassword","secretData","pw","deepSecret","darkhole","nestedSecret","compoundIndexData","passportCountry","compoundIndexNoStringData","nostringIndex","refHumanData","bestFriend","refHumanNestedData","foo","humanWithTimestampData","givenData","ret","id","updatedAt","Date","now","averageSchemaForFieldLength","averageSchema","averageSchemaData","properties","var1","var2","maximum","deep","deep1","deep2","deeper","deepNr","list","pointData","x","y","humanWithIdAndAgeIndexDocumentType","humanWithCompositePrimary","info"],"sources":["../../../../src/plugins/test-utils/schema-objects.ts"],"sourcesContent":["/**\n * this file contains objects which match the schemas in schemas.js\n */\n\nimport {\n randomNumber\n} from 'async-test-util';\nimport { HumanDocumentType } from './schemas.ts';\nimport * as schemas from './schemas.ts';\nimport { appendToArray, ensureNotFalsy, lastOfArray } from '../utils/index.ts';\n\n\n/**\n * Some storages had problems with umlauts and other special chars.\n * So we add these to all test strings.\n */\nexport const TEST_DATA_CHARSET = '0987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüÖÄßÜ[]{}\\'';\nexport const TEST_DATA_CHARSET_LAST_SORTED = ensureNotFalsy(lastOfArray(TEST_DATA_CHARSET.split('').sort()));\nconst someEmojisArr = ['😊', '💩', '👵', '🍌', '🏳️‍🌈', '😃'];\n\nconst baseChars = TEST_DATA_CHARSET.split('');\nconst allChars = baseChars.slice(0);\nappendToArray(allChars, someEmojisArr);\n\nexport function randomStringWithSpecialChars(\n minLength: number,\n /**\n * It has shown that alternating string lengths\n * can reproduce various problems. So by having variable\n * lengths we ensure that this fully works.\n */\n maxLength: number\n) {\n let text = '';\n\n if (!minLength || !maxLength || minLength > maxLength) {\n throw new Error('invalid length given ' + minLength + ' ' + maxLength);\n }\n\n const length = randomNumber(minLength, maxLength);\n\n while (text.length < length) {\n if (text.length === 0) {\n /**\n * TODO foundationdb does not work correctly when an index string starts\n * with an emoji. This can likely be fixed by upgrading foundationdb to the\n * latest version.\n */\n text += baseChars[Math.floor(Math.random() * baseChars.length)];\n } else {\n text += allChars[Math.floor(Math.random() * allChars.length)];\n }\n }\n\n /**\n * Because emojis can have a string.length of 2,\n * we can sometimes end up with strings that are longer\n * than the provided length. In that cases we have to rerun.\n */\n if (text.length > length) {\n return randomStringWithSpecialChars(minLength, maxLength);\n }\n\n return text;\n}\n\nexport interface SimpleHumanDocumentType {\n passportId: string;\n firstName: string;\n lastName: string;\n}\n\nexport function humanData(\n passportId: string = randomStringWithSpecialChars(8, 12),\n age: number = randomNumber(10, 50),\n firstName: string = randomStringWithSpecialChars(8, 12)\n): HumanDocumentType {\n return {\n passportId: passportId,\n firstName,\n lastName: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport function simpleHumanData(): SimpleHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface SimpleHumanV3DocumentType {\n passportId: string;\n age: number;\n oneOptional?: string;\n}\nexport function simpleHumanV3Data(partial: Partial = {}): SimpleHumanV3DocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface SimpleHumanAgeDocumentType {\n passportId: string;\n age: string;\n}\nexport function simpleHumanAge(partial: Partial = {}): SimpleHumanAgeDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50) + ''\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface HumanWithSubOtherDocumentType {\n passportId: string;\n other: {\n age: number;\n };\n}\nexport function humanWithSubOther(): HumanWithSubOtherDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n other: {\n age: randomNumber(10, 50)\n }\n };\n}\n\nexport interface NoIndexHumanDocumentType {\n firstName: string;\n lastName: string;\n}\nexport function NoIndexHuman(): NoIndexHumanDocumentType {\n return {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface NestedHumanDocumentType {\n passportId: string;\n firstName: string;\n mainSkill: {\n name: string;\n level: number;\n };\n}\nexport function nestedHumanData(partial: Partial = {}): NestedHumanDocumentType {\n const defaultObj = {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n level: 5\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface DeepNestedHumanDocumentType {\n passportId: string;\n mainSkill: {\n name: string;\n attack: {\n good: boolean;\n count: number;\n };\n };\n}\nexport function deepNestedHumanData(): DeepNestedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n mainSkill: {\n name: randomStringWithSpecialChars(4, 6),\n attack: {\n good: false,\n count: 5\n }\n }\n };\n}\n\nexport interface BigHumanDocumentType {\n passportId: string;\n dnaHash: string;\n firstName: string;\n lastName: string;\n age: number;\n}\nexport function bigHumanDocumentType(): BigHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n dnaHash: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface HeroArrayDocumentType {\n name: string;\n skills: {\n name: string;\n damage: number;\n }[];\n}\nexport function heroArrayData(): HeroArrayDocumentType {\n return {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => {\n return {\n name: randomStringWithSpecialChars(4, 6),\n damage: randomNumber(10, 50)\n };\n })\n };\n}\n\nexport interface SimpleHeroArrayDocumentType {\n name: string;\n skills: string[];\n}\nexport function simpleHeroArray(partial: Partial = {}): SimpleHeroArrayDocumentType {\n const defaultObj = {\n name: randomStringWithSpecialChars(6, 8),\n skills: new Array(3).fill(0).map(() => randomStringWithSpecialChars(3, 6))\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n\nexport interface EncryptedHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: string;\n}\nexport function encryptedHumanData(secret = randomStringWithSpecialChars(8, 12)): EncryptedHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret\n };\n}\n\nexport interface EncryptedObjectHumanDocumentType {\n passportId: string;\n firstName: string;\n secret: {\n name: string;\n subname: string;\n };\n}\nexport function encryptedObjectHumanData(): EncryptedObjectHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n secret: {\n name: randomStringWithSpecialChars(8, 12),\n subname: randomStringWithSpecialChars(8, 12)\n }\n };\n}\n\nexport interface EncryptedDeepHumanDocumentType {\n passportId: string;\n firstName: string;\n firstLevelPassword: string;\n secretData: {\n pw: string;\n };\n deepSecret: {\n darkhole: {\n pw: string;\n };\n };\n nestedSecret: {\n darkhole: {\n pw: string;\n };\n };\n}\nexport function encryptedDeepHumanDocumentType(): EncryptedDeepHumanDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n firstName: randomStringWithSpecialChars(8, 12),\n firstLevelPassword: randomStringWithSpecialChars(8, 12),\n secretData: {\n pw: randomStringWithSpecialChars(8, 12)\n },\n deepSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n },\n nestedSecret: {\n darkhole: {\n pw: randomStringWithSpecialChars(8, 12)\n }\n }\n };\n}\n\nexport interface CompoundIndexDocumentType {\n passportId: string;\n passportCountry: string;\n age: number;\n}\nexport function compoundIndexData(): CompoundIndexDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: randomStringWithSpecialChars(8, 12),\n age: randomNumber(10, 50)\n };\n}\n\nexport interface CompoundIndexNoStringDocumentType {\n passportId: string;\n passportCountry: { [prop: string]: string; };\n age: number;\n}\nexport function compoundIndexNoStringData(): CompoundIndexNoStringDocumentType {\n return {\n passportId: randomStringWithSpecialChars(8, 12),\n passportCountry: { [randomStringWithSpecialChars(8, 12)]: randomStringWithSpecialChars(8, 12) },\n age: randomNumber(10, 50)\n };\n}\n\nexport interface NostringIndexDocumentType {\n passportId: {};\n firstName: string;\n}\nexport function nostringIndex(): NostringIndexDocumentType {\n return {\n passportId: {},\n firstName: randomStringWithSpecialChars(8, 12)\n };\n}\n\nexport interface RefHumanDocumentType {\n name: string;\n bestFriend: string;\n}\nexport function refHumanData(bestFriend?: string): RefHumanDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n bestFriend\n } as any;\n}\n\nexport interface RefHumanNestedDocumentType {\n name: string;\n foo: {\n bestFriend: string;\n };\n}\nexport function refHumanNestedData(bestFriend?: string): RefHumanNestedDocumentType {\n return {\n name: randomStringWithSpecialChars(8, 12),\n foo: {\n bestFriend\n } as any\n };\n}\nexport interface HumanWithTimestampNestedDocumentType extends HumanWithTimestampDocumentType {\n address?: {\n street: string;\n suite: string;\n city: string;\n zipcode: string;\n geo: {\n lat: string;\n lng: string;\n };\n }\n}\n\nexport interface HumanWithTimestampDocumentType {\n id: string;\n name: string;\n age: number;\n updatedAt: number;\n deletedAt?: number;\n}\nexport function humanWithTimestampData(givenData: Partial = {}): HumanWithTimestampDocumentType {\n let ret = {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age: randomNumber(1, 100),\n // use some time in the past week\n updatedAt: Date.now()\n };\n ret = Object.assign({}, ret, givenData);\n return ret;\n}\n\nexport interface AverageSchemaDocumentType {\n id: string;\n var1: string;\n var2: number;\n deep: {\n deep1: string;\n deep2: string;\n deeper: {\n deepNr: number;\n };\n };\n list: {\n deep1: string;\n deep2: string;\n }[];\n}\n\n\nconst averageSchemaForFieldLength = schemas.averageSchema() as any;\nexport function averageSchemaData(\n partial: Partial = {}\n): AverageSchemaDocumentType {\n return Object.assign(\n {},\n {\n id: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength - 1), ensureNotFalsy(averageSchemaForFieldLength.properties.id.maxLength)),\n var1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.var1.maxLength)),\n var2: randomNumber(100, ensureNotFalsy(averageSchemaForFieldLength.properties.var2.maximum)),\n deep: {\n deep1: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep1.maxLength)),\n deep2: randomStringWithSpecialChars(ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength) - 3, ensureNotFalsy(averageSchemaForFieldLength.properties.deep.properties.deep2.maxLength)),\n deeper: {\n deepNr: randomNumber(0, 10)\n }\n },\n list: new Array(5).fill(0).map(() => ({\n deep1: randomStringWithSpecialChars(2, 5),\n deep2: randomStringWithSpecialChars(5, 8)\n }))\n },\n partial\n );\n}\n\nexport interface PointDocumentType {\n id: string;\n x: number;\n y: number;\n}\nexport function pointData(): PointDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n x: randomNumber(1, 100),\n y: randomNumber(1, 100)\n };\n}\n\nexport interface HumanWithIdAndAgeIndexDocumentType {\n id: string;\n name: string;\n age: number;\n}\nexport function humanWithIdAndAgeIndexDocumentType(\n age: number = randomNumber(1, 100)\n): HumanWithIdAndAgeIndexDocumentType {\n return {\n id: randomStringWithSpecialChars(8, 12),\n name: randomStringWithSpecialChars(8, 12),\n age\n };\n}\n\nexport type HumanWithCompositePrimary = {\n // optional because it might be created by RxDB and not known before\n id?: string;\n firstName: string;\n lastName: string;\n info: {\n age: number;\n };\n};\nexport function humanWithCompositePrimary(partial: Partial = {}): HumanWithCompositePrimary {\n const defaultObj = {\n firstName: randomStringWithSpecialChars(8, 12),\n lastName: randomStringWithSpecialChars(8, 12),\n info: {\n age: randomNumber(10, 50)\n }\n };\n return Object.assign(\n defaultObj,\n partial\n );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SACIA,YAAY,QACT,iBAAiB;AAExB,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,aAAa,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;;AAG9E;AACA;AACA;AACA;AACA,OAAO,IAAMC,iBAAiB,GAAG,6EAA6E;AAC9G,OAAO,IAAMC,6BAA6B,GAAGH,cAAc,CAACC,WAAW,CAACC,iBAAiB,CAACE,KAAK,CAAC,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5G,IAAMC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC;AAE9D,IAAMC,SAAS,GAAGL,iBAAiB,CAACE,KAAK,CAAC,EAAE,CAAC;AAC7C,IAAMI,QAAQ,GAAGD,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC;AACnCV,aAAa,CAACS,QAAQ,EAAEF,aAAa,CAAC;AAEtC,OAAO,SAASI,4BAA4BA,CACxCC,SAAiB;AACjB;AACJ;AACA;AACA;AACA;AACIC,SAAiB,EACnB;EACE,IAAIC,IAAI,GAAG,EAAE;EAEb,IAAI,CAACF,SAAS,IAAI,CAACC,SAAS,IAAID,SAAS,GAAGC,SAAS,EAAE;IACnD,MAAM,IAAIE,KAAK,CAAC,uBAAuB,GAAGH,SAAS,GAAG,GAAG,GAAGC,SAAS,CAAC;EAC1E;EAEA,IAAMG,MAAM,GAAGlB,YAAY,CAACc,SAAS,EAAEC,SAAS,CAAC;EAEjD,OAAOC,IAAI,CAACE,MAAM,GAAGA,MAAM,EAAE;IACzB,IAAIF,IAAI,CAACE,MAAM,KAAK,CAAC,EAA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S,EAAEZ,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC9Ca,QAAQ,EAAEb,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7CqF,IAAI,EAAE;MACF1E,GAAG,EAAExB,YAAY,CAAC,EAAE,EAAE,EAAE;IAC5B;EACJ,CAAC;EACD,OAAO+B,MAAM,CAACC,MAAM,CAChBF,UAAU,EACVD,OACJ,CAAC;AACL","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/utils/index.js b/dist/esm/plugins/utils/index.js index d08023c51c8..59810b31a08 100644 --- a/dist/esm/plugins/utils/index.js +++ b/dist/esm/plugins/utils/index.js @@ -16,4 +16,5 @@ export * from "./utils-time.js"; export * from "./utils-other.js"; export * from "./utils-rxdb-version.js"; export * from "./utils-global.js"; +export * from "./utils-premium.js"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/esm/plugins/utils/index.js.map b/dist/esm/plugins/utils/index.js.map index bb12209e2c7..096b4c395d4 100644 --- a/dist/esm/plugins/utils/index.js.map +++ b/dist/esm/plugins/utils/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":[],"sources":["../../../../src/plugins/utils/index.ts"],"sourcesContent":["export * from './utils-array.ts';\nexport * from './utils-blob.ts';\nexport * from './utils-base64.ts';\nexport * from './utils-revision.ts';\nexport * from './utils-document.ts';\nexport * from './utils-hash.ts';\nexport * from './utils-promise.ts';\nexport * from './utils-regex.ts';\nexport * from './utils-string.ts';\nexport * from './utils-object-deep-equal.ts';\nexport * from './utils-object-dot-prop.ts';\nexport * from './utils-object.ts';\nexport * from './utils-map.ts';\nexport * from './utils-error.ts';\nexport * from './utils-time.ts';\nexport * from './utils-other.ts';\nexport * from './utils-rxdb-version.ts';\nexport * from './utils-global.ts';\n"],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,4BAA4B;AAC1C,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,mBAAmB","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":[],"sources":["../../../../src/plugins/utils/index.ts"],"sourcesContent":["export * from './utils-array.ts';\nexport * from './utils-blob.ts';\nexport * from './utils-base64.ts';\nexport * from './utils-revision.ts';\nexport * from './utils-document.ts';\nexport * from './utils-hash.ts';\nexport * from './utils-promise.ts';\nexport * from './utils-regex.ts';\nexport * from './utils-string.ts';\nexport * from './utils-object-deep-equal.ts';\nexport * from './utils-object-dot-prop.ts';\nexport * from './utils-object.ts';\nexport * from './utils-map.ts';\nexport * from './utils-error.ts';\nexport * from './utils-time.ts';\nexport * from './utils-other.ts';\nexport * from './utils-rxdb-version.ts';\nexport * from './utils-global.ts';\nexport * from './utils-premium.ts';\n"],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,4BAA4B;AAC1C,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,mBAAmB;AACjC,cAAc,oBAAoB","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-global.js b/dist/esm/plugins/utils/utils-global.js index e1a6283b45d..9ccb3c7069c 100644 --- a/dist/esm/plugins/utils/utils-global.js +++ b/dist/esm/plugins/utils/utils-global.js @@ -3,5 +3,4 @@ * can be imported and mutated at will. */ export var RXDB_UTILS_GLOBAL = {}; -export var PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93'; //# sourceMappingURL=utils-global.js.map \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-global.js.map b/dist/esm/plugins/utils/utils-global.js.map index 1324087f520..cf7f6d9fdd5 100644 --- a/dist/esm/plugins/utils/utils-global.js.map +++ b/dist/esm/plugins/utils/utils-global.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-global.js","names":["RXDB_UTILS_GLOBAL","PREMIUM_FLAG_HASH"],"sources":["../../../../src/plugins/utils/utils-global.ts"],"sourcesContent":["/**\n * Can be used by some plugins to have a \"global\" object that\n * can be imported and mutated at will.\n */\nexport const RXDB_UTILS_GLOBAL: any = {};\n\n\nexport const PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,IAAMA,iBAAsB,GAAG,CAAC,CAAC;AAGxC,OAAO,IAAMC,iBAAiB,GAAG,kEAAkE","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"utils-global.js","names":["RXDB_UTILS_GLOBAL"],"sources":["../../../../src/plugins/utils/utils-global.ts"],"sourcesContent":["/**\n * Can be used by some plugins to have a \"global\" object that\n * can be imported and mutated at will.\n */\nexport const RXDB_UTILS_GLOBAL: any = {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,IAAMA,iBAAsB,GAAG,CAAC,CAAC","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-premium.js b/dist/esm/plugins/utils/utils-premium.js new file mode 100644 index 00000000000..20ad8e39fa7 --- /dev/null +++ b/dist/esm/plugins/utils/utils-premium.js @@ -0,0 +1,30 @@ +import { RXDB_UTILS_GLOBAL } from "./utils-global.js"; +import { defaultHashSha256 } from "./utils-hash.js"; +import { PROMISE_RESOLVE_FALSE } from "./utils-promise.js"; +export var PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93'; +export var NON_PREMIUM_COLLECTION_LIMIT = 16; +var hasPremiumPromise = PROMISE_RESOLVE_FALSE; +var premiumChecked = false; + +/** + * Here we check if the premium flag has been set. + * This code exists in the open source version of RxDB. + * Yes you are allowed to fork the repo and just overwrite this function. + * However you might better spend this time developing your real project + * and supporting the RxDB efforts by buying premium. + */ +export async function hasPremiumFlag() { + if (premiumChecked) { + return hasPremiumPromise; + } + premiumChecked = true; + hasPremiumPromise = (async () => { + if (RXDB_UTILS_GLOBAL.premium && typeof RXDB_UTILS_GLOBAL.premium === 'string' && (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium)) === PREMIUM_FLAG_HASH) { + return true; + } else { + return false; + } + })(); + return hasPremiumPromise; +} +//# sourceMappingURL=utils-premium.js.map \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-premium.js.map b/dist/esm/plugins/utils/utils-premium.js.map new file mode 100644 index 00000000000..016c868233f --- /dev/null +++ b/dist/esm/plugins/utils/utils-premium.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils-premium.js","names":["RXDB_UTILS_GLOBAL","defaultHashSha256","PROMISE_RESOLVE_FALSE","PREMIUM_FLAG_HASH","NON_PREMIUM_COLLECTION_LIMIT","hasPremiumPromise","premiumChecked","hasPremiumFlag","premium"],"sources":["../../../../src/plugins/utils/utils-premium.ts"],"sourcesContent":["import { RXDB_UTILS_GLOBAL } from './utils-global.ts';\nimport { defaultHashSha256 } from './utils-hash.ts';\nimport { PROMISE_RESOLVE_FALSE } from './utils-promise.ts';\n\nexport const PREMIUM_FLAG_HASH = '6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93';\nexport const NON_PREMIUM_COLLECTION_LIMIT = 16;\n\nlet hasPremiumPromise: Promise = PROMISE_RESOLVE_FALSE;\nlet premiumChecked = false;\n\n/**\n * Here we check if the premium flag has been set.\n * This code exists in the open source version of RxDB.\n * Yes you are allowed to fork the repo and just overwrite this function.\n * However you might better spend this time developing your real project\n * and supporting the RxDB efforts by buying premium.\n */\nexport async function hasPremiumFlag() {\n if (premiumChecked) {\n return hasPremiumPromise;\n }\n premiumChecked = true;\n\n hasPremiumPromise = (async () => {\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return true;\n } else {\n return false;\n }\n })();\n\n return hasPremiumPromise;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,OAAO,IAAMC,iBAAiB,GAAG,kEAAkE;AACnG,OAAO,IAAMC,4BAA4B,GAAG,EAAE;AAE9C,IAAIC,iBAAmC,GAAGH,qBAAqB;AAC/D,IAAII,cAAc,GAAG,KAAK;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAAA,EAAG;EACnC,IAAID,cAAc,EAAE;IAChB,OAAOD,iBAAiB;EAC5B;EACAC,cAAc,GAAG,IAAI;EAErBD,iBAAiB,GAAG,CAAC,YAAY;IAC7B,IACIL,iBAAiB,CAACQ,OAAO,IACzB,OAAOR,iBAAiB,CAACQ,OAAO,KAAK,QAAQ,IAC5C,OAAMP,iBAAiB,CAACD,iBAAiB,CAACQ,OAAO,CAAC,MAAKL,iBAAkB,EAC5E;MACE,OAAO,IAAI;IACf,CAAC,MAAM;MACH,OAAO,KAAK;IAChB;EACJ,CAAC,EAAE,CAAC;EAEJ,OAAOE,iBAAiB;AAC5B","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-rxdb-version.js b/dist/esm/plugins/utils/utils-rxdb-version.js index df63a75f803..9cb7708db4a 100644 --- a/dist/esm/plugins/utils/utils-rxdb-version.js +++ b/dist/esm/plugins/utils/utils-rxdb-version.js @@ -1,5 +1,5 @@ /** * This file is replaced in the 'npm run build:version' script. */ -export var RXDB_VERSION = '16.0.0-beta.5'; +export var RXDB_VERSION = '16.0.0-beta.6'; //# sourceMappingURL=utils-rxdb-version.js.map \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-rxdb-version.js.map b/dist/esm/plugins/utils/utils-rxdb-version.js.map index 9aec17857c2..b1e5261dc93 100644 --- a/dist/esm/plugins/utils/utils-rxdb-version.js.map +++ b/dist/esm/plugins/utils/utils-rxdb-version.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '16.0.0-beta.5';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,eAAe","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '16.0.0-beta.6';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,eAAe","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/rx-collection.js b/dist/esm/rx-collection.js index 040ada8bec6..fb78c4bded3 100644 --- a/dist/esm/rx-collection.js +++ b/dist/esm/rx-collection.js @@ -1,6 +1,6 @@ import _createClass from "@babel/runtime/helpers/createClass"; import { filter, map, mergeMap } from 'rxjs'; -import { ucfirst, flatClone, promiseSeries, pluginMissing, ensureNotFalsy, getFromMapOrThrow, PROMISE_RESOLVE_FALSE, PROMISE_RESOLVE_VOID } from "./plugins/utils/index.js"; +import { ucfirst, flatClone, promiseSeries, pluginMissing, ensureNotFalsy, getFromMapOrThrow, PROMISE_RESOLVE_FALSE, PROMISE_RESOLVE_VOID, NON_PREMIUM_COLLECTION_LIMIT, hasPremiumFlag } from "./plugins/utils/index.js"; import { fillObjectDataBeforeInsert, createRxCollectionStorageInstance, removeCollectionStorages, ensureRxCollectionIsNotClosed } from "./rx-collection-helper.js"; import { createRxQuery, _getDefaultQuery } from "./rx-query.js"; import { newRxError, newRxTypeError } from "./rx-error.js"; @@ -18,6 +18,7 @@ import { rxChangeEventBulkToRxChangeEvents } from "./rx-change-event.js"; var HOOKS_WHEN = ['pre', 'post']; var HOOKS_KEYS = ['insert', 'save', 'remove', 'create']; var hooksApplied = false; +export var OPEN_COLLECTIONS = new Set(); export var RxCollectionBase = /*#__PURE__*/function () { /** * Stores all 'normal' documents @@ -63,9 +64,44 @@ export var RxCollectionBase = /*#__PURE__*/function () { // might be falsy on pseudoInstance this.eventBulks$ = database.eventBulks$.pipe(filter(changeEventBulk => changeEventBulk.collectionName === this.name)); } else {} + + /** + * Must be last because the hooks might throw on dev-mode + * checks and we do not want to have broken collections here. + * RxCollection instances created for testings do not have a database + * so we do not add these to the list. + */ + if (this.database) { + OPEN_COLLECTIONS.add(this); + } } var _proto = RxCollectionBase.prototype; _proto.prepare = async function prepare() { + if (!(await hasPremiumFlag())) { + /** + * When used in a test suite, we often open and close many databases with collections + * while not awaiting the database.close() call to improve the test times. + * So when reopening collections and the OPEN_COLLECTIONS size is full, + * we retry after some times to account for this. + */ + var count = 0; + while (count < 10 && OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) { + count++; + await this.promiseWait(30); + } + if (OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) { + throw newRxError('COL23', { + database: this.database.name, + collection: this.name, + args: { + existing: Array.from(OPEN_COLLECTIONS.values()).map(c => ({ + db: c.database ? c.database.name : '', + c: c.name + })) + } + }); + } + } this.storageInstance = getWrappedStorageInstance(this.database, this.internalStorageInstance, this.schema.jsonSchema); this.incrementalWriteQueue = new IncrementalWriteQueue(this.storageInstance, this.schema.primaryPath, (newData, oldData) => beforeDocumentUpdateWrite(this, newData, oldData), result => this._runHooks('post', 'save', result)); this.$ = this.eventBulks$.pipe(mergeMap(changeEventBulk => rxChangeEventBulkToRxChangeEvents(changeEventBulk))); @@ -563,6 +599,7 @@ export var RxCollectionBase = /*#__PURE__*/function () { if (this.closed) { return PROMISE_RESOLVE_FALSE; } + OPEN_COLLECTIONS.delete(this); await Promise.all(this.onClose.map(fn => fn())); /** @@ -767,6 +804,7 @@ export function createRxCollection({ * If the collection creation fails, * we yet have to close the storage instances. */.catch(err => { + OPEN_COLLECTIONS.delete(collection); return storageInstance.close().then(() => Promise.reject(err)); }); }); diff --git a/dist/esm/rx-collection.js.map b/dist/esm/rx-collection.js.map index 03a8b99303b..50ed5419a31 100644 --- a/dist/esm/rx-collection.js.map +++ b/dist/esm/rx-collection.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-collection.js","names":["filter","map","mergeMap","ucfirst","flatClone","promiseSeries","pluginMissing","ensureNotFalsy","getFromMapOrThrow","PROMISE_RESOLVE_FALSE","PROMISE_RESOLVE_VOID","fillObjectDataBeforeInsert","createRxCollectionStorageInstance","removeCollectionStorages","ensureRxCollectionIsNotClosed","createRxQuery","_getDefaultQuery","newRxError","newRxTypeError","DocumentCache","mapDocumentsDataToCacheDocs","createQueryCache","defaultCacheReplacementPolicy","createChangeEventBuffer","runAsyncPluginHooks","runPluginHooks","createNewRxDocument","getRxDocumentConstructor","getWrappedStorageInstance","getWrittenDocumentsFromBulkWriteResponse","throwIfIsStorageWriteError","IncrementalWriteQueue","beforeDocumentUpdateWrite","overwritable","defaultConflictHandler","rxChangeEventBulkToRxChangeEvents","HOOKS_WHEN","HOOKS_KEYS","hooksApplied","RxCollectionBase","database","name","schema","internalStorageInstance","instanceCreationOptions","migrationStrategies","methods","attachments","options","cacheReplacementPolicy","statics","conflictHandler","storageInstance","timeouts","Set","incrementalWriteQueue","awaitBeforeReads","_incrementalUpsertQueues","Map","synced","hooks","_subs","_docCache","_queryCache","$","checkpoint$","_changeEventBuffer","eventBulks$","onClose","closed","onRemove","_applyHookFunctions","asRxCollection","pipe","changeEventBulk","collectionName","_proto","prototype","prepare","jsonSchema","primaryPath","newData","oldData","result","_runHooks","checkpoint","documentConstructor","bulk","isLocal","events","docData","listenToRemoveSub","internalStore","changeStream","key","version","found","find","event","documentData","context","operation","subscribe","close","Promise","all","fn","push","databaseStorageToken","storageToken","subDocs","eventBulk","id","internal","databaseToken","token","$emit","cleanup","_minimumDeletedTime","migrationNeeded","getMigrationState","startMigration","batchSize","migratePromise","insert","json","writeResult","bulkInsert","isError","error","insertResult","success","docsData","length","ids","insertRows","hasHooks","useDocData","then","add","document","Array","index","size","collection","args","documents","results","bulkWrite","rxDocuments","ret","docsMap","forEach","row","doc","set","get","primary","bulkRemove","idsOrDocs","rxDocumentMap","findByIds","exec","d","from","values","rxDocument","data","toMutableJSON","removeDocs","writeDoc","_deleted","previous","deletedRxDocuments","successIds","getCachedRxDocument","bulkUpsert","insertData","useJsonByDocId","useJson","slice","err","status","documentId","writeData","docDataInDb","documentInDb","getCachedRxDocuments","newDoc","incrementalModify","upsert","bulkResult","incrementalUpsert","queue","_incrementalUpsertEnsureRxDocumentExists","wasInserted","inserted","_incrementalUpsertUpdate","queryObj","op","query","findOne","selector","limit","count","mangoQuery","$in","exportJSON","importJSON","_exportedJSON","insertCRDT","_updateObj","addPipeline","_options","addHook","when","fun","parallel","includes","boundFun","bind","runName","series","getHooks","instance","tasks","hook","_runHooksSync","promiseWait","time","res","timeout","setTimeout","delete","clearTimeout","requestIdlePromise","sub","unsubscribe","collections","remove","storage","multiInstance","password","hashFunction","_createClass","cE","colProto","Object","getPrototypeOf","fnName","_innerDoc","rxCollection","docDataFromCache","getLatestDocumentDataIfExists","resolve","createRxCollection","autoMigrate","localDocuments","storageInstanceCreationParams","databaseInstanceToken","databaseName","devMode","isDevMode","entries","funName","defineProperty","creator","catch","reject","isRxCollection","obj"],"sources":["../../src/rx-collection.ts"],"sourcesContent":["import {\n filter,\n map,\n mergeMap\n} from 'rxjs';\n\nimport {\n ucfirst,\n flatClone,\n promiseSeries,\n pluginMissing,\n ensureNotFalsy,\n getFromMapOrThrow,\n PROMISE_RESOLVE_FALSE,\n PROMISE_RESOLVE_VOID\n} from './plugins/utils/index.ts';\nimport {\n fillObjectDataBeforeInsert,\n createRxCollectionStorageInstance,\n removeCollectionStorages,\n ensureRxCollectionIsNotClosed\n} from './rx-collection-helper.ts';\nimport {\n createRxQuery,\n _getDefaultQuery\n} from './rx-query.ts';\nimport {\n newRxError,\n newRxTypeError\n} from './rx-error.ts';\nimport type {\n RxMigrationState\n} from './plugins/migration-schema/index.ts';\nimport {\n DocumentCache,\n mapDocumentsDataToCacheDocs\n} from './doc-cache.ts';\nimport {\n QueryCache,\n createQueryCache,\n defaultCacheReplacementPolicy\n} from './query-cache.ts';\nimport {\n ChangeEventBuffer,\n createChangeEventBuffer\n} from './change-event-buffer.ts';\nimport {\n runAsyncPluginHooks,\n runPluginHooks\n} from './hooks.ts';\n\nimport {\n Subscription,\n Observable\n} from 'rxjs';\n\nimport type {\n KeyFunctionMap,\n RxCollection,\n RxDatabase,\n RxQuery,\n RxDocument,\n RxDumpCollection,\n RxDumpCollectionAny,\n MangoQuery,\n MangoQueryNoLimit,\n RxCacheReplacementPolicy,\n RxStorageWriteError,\n RxDocumentData,\n RxStorageInstanceCreationParams,\n BulkWriteRow,\n RxChangeEvent,\n RxChangeEventInsert,\n RxChangeEventUpdate,\n RxChangeEventDelete,\n RxStorageInstance,\n CollectionsOfDatabase,\n RxChangeEventBulk,\n RxLocalDocumentData,\n RxDocumentBase,\n RxConflictHandler,\n MaybePromise,\n CRDTEntry,\n MangoQuerySelectorAndIndex,\n MigrationStrategies\n} from './types/index.d.ts';\n\nimport {\n RxSchema\n} from './rx-schema.ts';\n\nimport {\n createNewRxDocument,\n getRxDocumentConstructor\n} from './rx-document-prototype-merge.ts';\nimport {\n getWrappedStorageInstance,\n getWrittenDocumentsFromBulkWriteResponse,\n throwIfIsStorageWriteError,\n WrappedRxStorageInstance\n} from './rx-storage-helper.ts';\nimport { IncrementalWriteQueue } from './incremental-write.ts';\nimport { beforeDocumentUpdateWrite } from './rx-document.ts';\nimport { overwritable } from './overwritable.ts';\nimport type { RxPipeline, RxPipelineOptions } from './plugins/pipeline/index.ts';\nimport { defaultConflictHandler } from './replication-protocol/default-conflict-handler.ts';\nimport { rxChangeEventBulkToRxChangeEvents } from './rx-change-event.ts';\n\nconst HOOKS_WHEN = ['pre', 'post'] as const;\ntype HookWhenType = typeof HOOKS_WHEN[number];\nconst HOOKS_KEYS = ['insert', 'save', 'remove', 'create'] as const;\ntype HookKeyType = typeof HOOKS_KEYS[number];\nlet hooksApplied = false;\n\nexport class RxCollectionBase<\n InstanceCreationOptions,\n RxDocumentType = { [prop: string]: any; },\n OrmMethods = {},\n StaticMethods = { [key: string]: any; },\n Reactivity = any\n> {\n\n\n /**\n * Stores all 'normal' documents\n */\n public storageInstance: WrappedRxStorageInstance = {} as any;\n public readonly timeouts: Set> = new Set();\n public incrementalWriteQueue: IncrementalWriteQueue = {} as any;\n\n\n /**\n * Before reads, all these methods are awaited. Used to \"block\" reads\n * depending on other processes, like when the RxPipeline is running.\n */\n public readonly awaitBeforeReads = new Set<() => MaybePromise>();\n\n constructor(\n public readonly database: RxDatabase,\n public name: string,\n public schema: RxSchema,\n public internalStorageInstance: RxStorageInstance,\n public instanceCreationOptions: InstanceCreationOptions = {} as any,\n public migrationStrategies: MigrationStrategies = {},\n public methods: KeyFunctionMap = {},\n public attachments: KeyFunctionMap = {},\n public options: any = {},\n public cacheReplacementPolicy: RxCacheReplacementPolicy = defaultCacheReplacementPolicy,\n public statics: KeyFunctionMap = {},\n public conflictHandler: RxConflictHandler = defaultConflictHandler\n ) {\n _applyHookFunctions(this.asRxCollection);\n\n\n if (database) { // might be falsy on pseudoInstance\n this.eventBulks$ = database.eventBulks$.pipe(\n filter(changeEventBulk => changeEventBulk.collectionName === this.name)\n );\n } else { }\n }\n\n get insert$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'INSERT')\n ) as any;\n }\n get update$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'UPDATE')\n ) as any;\n }\n get remove$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'DELETE')\n ) as any;\n }\n\n public _incrementalUpsertQueues: Map> = new Map();\n // defaults\n public synced: boolean = false;\n public hooks: {\n [key in HookKeyType]: {\n [when in HookWhenType]: {\n series: Function[];\n parallel: Function[];\n };\n }\n } = {} as any;\n public _subs: Subscription[] = [];\n\n public _docCache: DocumentCache = {} as any;\n\n public _queryCache: QueryCache = createQueryCache();\n public $: Observable> = {} as any;\n public checkpoint$: Observable = {} as any;\n public _changeEventBuffer: ChangeEventBuffer = {} as ChangeEventBuffer;\n\n /**\n * Internally only use eventBulks$\n * Do not use .$ or .observable$ because that has to transform\n * the events which decreases performance.\n */\n public readonly eventBulks$: Observable> = {} as any;\n\n\n /**\n * When the collection is closed,\n * these functions will be called an awaited.\n * Used to automatically clean up stuff that\n * belongs to this collection.\n */\n public onClose: (() => MaybePromise)[] = [];\n public closed = false;\n\n public onRemove: (() => MaybePromise)[] = [];\n\n public async prepare(): Promise {\n this.storageInstance = getWrappedStorageInstance(\n this.database,\n this.internalStorageInstance,\n this.schema.jsonSchema\n );\n this.incrementalWriteQueue = new IncrementalWriteQueue(\n this.storageInstance,\n this.schema.primaryPath,\n (newData, oldData) => beforeDocumentUpdateWrite(this as any, newData, oldData),\n result => this._runHooks('post', 'save', result)\n );\n\n this.$ = this.eventBulks$.pipe(\n mergeMap(changeEventBulk => rxChangeEventBulkToRxChangeEvents(changeEventBulk)),\n );\n this.checkpoint$ = this.eventBulks$.pipe(\n map(changeEventBulk => changeEventBulk.checkpoint),\n );\n\n this._changeEventBuffer = createChangeEventBuffer(this.asRxCollection);\n let documentConstructor: any;\n this._docCache = new DocumentCache(\n this.schema.primaryPath,\n this.eventBulks$.pipe(\n filter(bulk => !bulk.isLocal),\n map(bulk => bulk.events)\n ),\n docData => {\n if (!documentConstructor) {\n documentConstructor = getRxDocumentConstructor(this.asRxCollection);\n }\n return createNewRxDocument(this.asRxCollection, documentConstructor, docData);\n }\n );\n\n\n const listenToRemoveSub = this.database.internalStore.changeStream().pipe(\n filter(bulk => {\n const key = this.name + '-' + this.schema.version;\n const found = bulk.events.find(event => {\n return (\n event.documentData.context === 'collection' &&\n event.documentData.key === key &&\n event.operation === 'DELETE'\n );\n });\n return !!found;\n })\n ).subscribe(async () => {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n });\n this._subs.push(listenToRemoveSub);\n\n\n const databaseStorageToken = await this.database.storageToken;\n const subDocs = this.storageInstance.changeStream().subscribe(eventBulk => {\n const changeEventBulk: RxChangeEventBulk = {\n id: eventBulk.id,\n isLocal: false,\n internal: false,\n collectionName: this.name,\n storageToken: databaseStorageToken,\n events: eventBulk.events,\n databaseToken: this.database.token,\n checkpoint: eventBulk.checkpoint,\n context: eventBulk.context\n };\n this.database.$emit(changeEventBulk);\n });\n this._subs.push(subDocs);\n\n return PROMISE_RESOLVE_VOID;\n }\n\n\n /**\n * Manually call the cleanup function of the storage.\n * @link https://rxdb.info/cleanup.html\n */\n cleanup(_minimumDeletedTime?: number): Promise {\n ensureRxCollectionIsNotClosed(this);\n throw pluginMissing('cleanup');\n }\n\n // overwritten by migration-plugin\n migrationNeeded(): Promise {\n throw pluginMissing('migration-schema');\n }\n getMigrationState(): RxMigrationState {\n throw pluginMissing('migration-schema');\n }\n startMigration(batchSize: number = 10): Promise {\n ensureRxCollectionIsNotClosed(this);\n return this.getMigrationState().startMigration(batchSize);\n }\n migratePromise(batchSize: number = 10): Promise {\n return this.getMigrationState().migratePromise(batchSize);\n }\n\n async insert(\n json: RxDocumentType | RxDocument\n ): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const writeResult = await this.bulkInsert([json as any]);\n\n const isError = writeResult.error[0];\n throwIfIsStorageWriteError(this as any, (json as any)[this.schema.primaryPath] as any, json, isError as any);\n const insertResult = ensureNotFalsy(writeResult.success[0]);\n return insertResult;\n }\n\n async bulkInsert(\n docsData: RxDocumentType[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (docsData.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n const primaryPath = this.schema.primaryPath;\n\n const ids = new Set();\n\n /**\n * This code is a bit redundant for better performance.\n * Instead of iterating multiple times,\n * we directly transform the input to a write-row array.\n */\n let insertRows: BulkWriteRow[];\n if (this.hasHooks('pre', 'insert')) {\n insertRows = await Promise.all(\n docsData.map(docData => {\n const useDocData = fillObjectDataBeforeInsert(this.schema, docData);\n return this._runHooks('pre', 'insert', useDocData)\n .then(() => {\n ids.add((useDocData as any)[primaryPath]);\n return { document: useDocData };\n });\n })\n );\n } else {\n insertRows = new Array(docsData.length);\n const schema = this.schema;\n for (let index = 0; index < docsData.length; index++) {\n const docData = docsData[index];\n const useDocData = fillObjectDataBeforeInsert(schema, docData);\n ids.add((useDocData as any)[primaryPath]);\n insertRows[index] = { document: useDocData };\n }\n }\n\n\n if (ids.size !== docsData.length) {\n throw newRxError('COL22', {\n collection: this.name,\n args: {\n documents: docsData\n }\n });\n }\n\n const results = await this.storageInstance.bulkWrite(\n insertRows,\n 'rx-collection-bulk-insert'\n );\n\n\n /**\n * Often the user does not need to access the RxDocuments of the bulkInsert() call.\n * So we transform the data to RxDocuments only if needed to use less CPU performance.\n */\n let rxDocuments: RxDocument[];\n const collection = this;\n const ret = {\n get success() {\n if (!rxDocuments) {\n const success = getWrittenDocumentsFromBulkWriteResponse(\n collection.schema.primaryPath,\n insertRows,\n results\n );\n rxDocuments = mapDocumentsDataToCacheDocs(collection._docCache, success);\n }\n return rxDocuments;\n },\n error: results.error\n };\n\n if (this.hasHooks('post', 'insert')) {\n const docsMap: Map = new Map();\n insertRows.forEach(row => {\n const doc = row.document;\n docsMap.set((doc as any)[primaryPath] as any, doc);\n });\n await Promise.all(\n ret.success.map(doc => {\n return this._runHooks(\n 'post',\n 'insert',\n docsMap.get(doc.primary),\n doc\n );\n })\n );\n }\n\n return ret;\n }\n\n async bulkRemove(\n /**\n * You can either remove the documents by their ids\n * or by directly providing the RxDocument instances\n * if you have them already. This improves performance a bit.\n */\n idsOrDocs: string[] | RxDocument[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const primaryPath = this.schema.primaryPath;\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (idsOrDocs.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n let rxDocumentMap: Map>;\n if (typeof idsOrDocs[0] === 'string') {\n rxDocumentMap = await this.findByIds(idsOrDocs as string[]).exec();\n } else {\n rxDocumentMap = new Map();\n (idsOrDocs as RxDocument[]).forEach(d => rxDocumentMap.set(d.primary, d));\n }\n\n const docsData: RxDocumentData[] = [];\n const docsMap: Map> = new Map();\n Array.from(rxDocumentMap.values()).forEach(rxDocument => {\n const data: RxDocumentData = rxDocument.toMutableJSON(true) as any;\n docsData.push(data);\n docsMap.set(rxDocument.primary, data);\n });\n\n await Promise.all(\n docsData.map(doc => {\n const primary = (doc as any)[this.schema.primaryPath];\n return this._runHooks('pre', 'remove', doc, rxDocumentMap.get(primary));\n })\n );\n const removeDocs: BulkWriteRow[] = docsData.map(doc => {\n const writeDoc = flatClone(doc);\n writeDoc._deleted = true;\n return {\n previous: doc,\n document: writeDoc\n };\n });\n const results = await this.storageInstance.bulkWrite(\n removeDocs,\n 'rx-collection-bulk-remove'\n );\n\n\n const success = getWrittenDocumentsFromBulkWriteResponse(\n this.schema.primaryPath,\n removeDocs,\n results\n );\n\n const deletedRxDocuments: RxDocument[] = [];\n const successIds: string[] = success.map(d => {\n const id = d[primaryPath] as string;\n const doc = this._docCache.getCachedRxDocument(d);\n deletedRxDocuments.push(doc);\n return id;\n });\n\n // run hooks\n await Promise.all(\n successIds.map(id => {\n return this._runHooks(\n 'post',\n 'remove',\n docsMap.get(id),\n rxDocumentMap.get(id)\n );\n })\n );\n\n\n return {\n success: deletedRxDocuments,\n error: results.error\n };\n }\n\n /**\n * same as bulkInsert but overwrites existing document with same primary\n */\n async bulkUpsert(docsData: Partial[]): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const insertData: RxDocumentType[] = [];\n const useJsonByDocId: Map = new Map();\n docsData.forEach(docData => {\n const useJson = fillObjectDataBeforeInsert(this.schema, docData);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL3', {\n primaryPath: this.schema.primaryPath as string,\n data: useJson,\n schema: this.schema.jsonSchema\n });\n }\n useJsonByDocId.set(primary, useJson);\n insertData.push(useJson);\n });\n\n const insertResult = await this.bulkInsert(insertData);\n const success = insertResult.success.slice(0);\n const error: RxStorageWriteError[] = [];\n\n // update the ones that existed already\n await Promise.all(\n insertResult.error.map(async (err) => {\n if (err.status !== 409) {\n error.push(err);\n } else {\n const id = err.documentId;\n const writeData = getFromMapOrThrow(useJsonByDocId, id);\n const docDataInDb = ensureNotFalsy(err.documentInDb);\n const doc = this._docCache.getCachedRxDocuments([docDataInDb])[0];\n const newDoc = await doc.incrementalModify(() => writeData);\n success.push(newDoc);\n }\n })\n );\n return {\n error,\n success\n };\n }\n\n /**\n * same as insert but overwrites existing document with same primary\n */\n async upsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const bulkResult = await this.bulkUpsert([json]);\n throwIfIsStorageWriteError(\n this.asRxCollection,\n (json as any)[this.schema.primaryPath],\n json as any,\n bulkResult.error[0]\n );\n return bulkResult.success[0];\n }\n\n /**\n * upserts to a RxDocument, uses incrementalModify if document already exists\n */\n incrementalUpsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const useJson = fillObjectDataBeforeInsert(this.schema, json);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL4', {\n data: json\n });\n }\n\n // ensure that it won't try 2 parallel runs\n let queue = this._incrementalUpsertQueues.get(primary);\n if (!queue) {\n queue = PROMISE_RESOLVE_VOID;\n }\n queue = queue\n .then(() => _incrementalUpsertEnsureRxDocumentExists(this as any, primary as any, useJson))\n .then((wasInserted) => {\n if (!wasInserted.inserted) {\n return _incrementalUpsertUpdate(wasInserted.doc, useJson);\n } else {\n return wasInserted.doc;\n }\n });\n this._incrementalUpsertQueues.set(primary, queue);\n return queue;\n }\n\n find(queryObj?: MangoQuery): RxQuery<\n RxDocumentType,\n RxDocument[],\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'find',\n queryObj,\n collection: this\n });\n\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n const query = createRxQuery('find', queryObj, this as any);\n return query as any;\n }\n\n findOne(\n queryObj?: MangoQueryNoLimit | string\n ): RxQuery<\n RxDocumentType,\n RxDocument | null,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'findOne',\n queryObj,\n collection: this\n });\n\n let query;\n\n if (typeof queryObj === 'string') {\n query = createRxQuery('findOne', {\n selector: {\n [this.schema.primaryPath]: queryObj\n },\n limit: 1\n }, this as any);\n } else {\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n // cannot have limit on findOne queries because it will be overwritten\n if ((queryObj as MangoQuery).limit) {\n throw newRxError('QU6');\n }\n\n queryObj = flatClone(queryObj);\n (queryObj as any).limit = 1;\n query = createRxQuery('findOne', queryObj, this as any);\n }\n\n\n return query as any;\n }\n\n count(queryObj?: MangoQuerySelectorAndIndex): RxQuery<\n RxDocumentType,\n number,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n const query = createRxQuery('count', queryObj, this as any);\n return query as any;\n }\n\n /**\n * find a list documents by their primary key\n * has way better performance then running multiple findOne() or a find() with a complex $or-selected\n */\n findByIds(\n ids: string[]\n ): RxQuery<\n RxDocumentType,\n Map>,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n const mangoQuery: MangoQuery = {\n selector: {\n [this.schema.primaryPath]: {\n $in: ids.slice(0)\n }\n } as any\n };\n const query = createRxQuery('findByIds', mangoQuery, this as any);\n return query as any;\n }\n\n /**\n * Export collection to a JSON friendly format.\n */\n exportJSON(): Promise>;\n exportJSON(): Promise>;\n exportJSON(): Promise {\n throw pluginMissing('json-dump');\n }\n\n /**\n * Import the parsed JSON export into the collection.\n * @param _exportedJSON The previously exported data from the `.exportJSON()` method.\n */\n importJSON(_exportedJSON: RxDumpCollectionAny): Promise {\n throw pluginMissing('json-dump');\n }\n\n insertCRDT(_updateObj: CRDTEntry | CRDTEntry[]): RxDocument {\n throw pluginMissing('crdt');\n }\n\n\n addPipeline(_options: RxPipelineOptions): Promise> {\n throw pluginMissing('pipeline');\n }\n\n /**\n * HOOKS\n */\n addHook(when: HookWhenType, key: HookKeyType, fun: any, parallel = false) {\n if (typeof fun !== 'function') {\n throw newRxTypeError('COL7', {\n key,\n when\n });\n }\n\n if (!HOOKS_WHEN.includes(when)) {\n throw newRxTypeError('COL8', {\n key,\n when\n });\n }\n\n if (!HOOKS_KEYS.includes(key)) {\n throw newRxError('COL9', {\n key\n });\n }\n\n if (when === 'post' && key === 'create' && parallel === true) {\n throw newRxError('COL10', {\n when,\n key,\n parallel\n });\n }\n\n // bind this-scope to hook-function\n const boundFun = fun.bind(this);\n\n const runName = parallel ? 'parallel' : 'series';\n\n this.hooks[key] = this.hooks[key] || {};\n this.hooks[key][when] = this.hooks[key][when] || {\n series: [],\n parallel: []\n };\n this.hooks[key][when][runName].push(boundFun);\n }\n\n getHooks(when: HookWhenType, key: HookKeyType) {\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return {\n series: [],\n parallel: []\n };\n }\n return this.hooks[key][when];\n }\n\n hasHooks(when: HookWhenType, key: HookKeyType) {\n /**\n * Performance shortcut\n * so that we not have to build the empty object.\n */\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return false;\n }\n\n const hooks = this.getHooks(when, key);\n if (!hooks) {\n return false;\n }\n return hooks.series.length > 0 || hooks.parallel.length > 0;\n }\n\n _runHooks(when: HookWhenType, key: HookKeyType, data: any, instance?: any): Promise {\n const hooks = this.getHooks(when, key);\n\n if (!hooks) {\n return PROMISE_RESOLVE_VOID;\n }\n\n // run parallel: false\n const tasks = hooks.series.map((hook: any) => () => hook(data, instance));\n return promiseSeries(tasks)\n // run parallel: true\n .then(() => Promise.all(\n hooks.parallel\n .map((hook: any) => hook(data, instance))\n ));\n }\n\n /**\n * does the same as ._runHooks() but with non-async-functions\n */\n _runHooksSync(when: HookWhenType, key: HookKeyType, data: any, instance: any) {\n if (!this.hasHooks(when, key)) {\n return;\n }\n const hooks = this.getHooks(when, key);\n if (!hooks) return;\n hooks.series.forEach((hook: any) => hook(data, instance));\n }\n\n /**\n * Returns a promise that resolves after the given time.\n * Ensures that is properly cleans up when the collection is closed\n * so that no running timeouts prevent the exit of the JavaScript process.\n */\n promiseWait(time: number): Promise {\n const ret = new Promise(res => {\n const timeout = setTimeout(() => {\n this.timeouts.delete(timeout);\n res();\n }, time);\n this.timeouts.add(timeout);\n });\n return ret;\n }\n\n async close(): Promise {\n if (this.closed) {\n return PROMISE_RESOLVE_FALSE;\n }\n\n\n await Promise.all(this.onClose.map(fn => fn()));\n\n /**\n * Settings closed = true\n * must be the first thing to do,\n * so for example the replication can directly stop\n * instead of sending requests to a closed storage.\n */\n this.closed = true;\n\n\n Array.from(this.timeouts).forEach(timeout => clearTimeout(timeout));\n if (this._changeEventBuffer) {\n this._changeEventBuffer.close();\n }\n /**\n * First wait until the whole database is idle.\n * This ensures that the storage does not get closed\n * while some operation is running.\n * It is important that we do not intercept a running call\n * because it might lead to undefined behavior like when a doc is written\n * but the change is not added to the changes collection.\n */\n return this.database.requestIdlePromise()\n .then(() => this.storageInstance.close())\n .then(() => {\n /**\n * Unsubscribing must be done AFTER the storageInstance.close()\n * Because the conflict handling is part of the subscriptions and\n * otherwise there might be open conflicts to be resolved which\n * will then stuck and never resolve.\n */\n this._subs.forEach(sub => sub.unsubscribe());\n\n delete this.database.collections[this.name];\n return runAsyncPluginHooks('postCloseRxCollection', this).then(() => true);\n });\n }\n\n /**\n * remove all data of the collection\n */\n async remove(): Promise {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n /**\n * TODO here we should pass the already existing\n * storage instances instead of creating new ones.\n */\n await removeCollectionStorages(\n this.database.storage,\n this.database.internalStore,\n this.database.token,\n this.database.name,\n this.name,\n this.database.multiInstance,\n this.database.password,\n this.database.hashFunction\n );\n }\n\n get asRxCollection(): RxCollection {\n return this as any;\n }\n}\n\n/**\n * adds the hook-functions to the collections prototype\n * this runs only once\n */\nfunction _applyHookFunctions(\n collection: RxCollection\n) {\n if (hooksApplied) return; // already run\n hooksApplied = true;\n const colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(key => {\n HOOKS_WHEN.map(when => {\n const fnName = when + ucfirst(key);\n colProto[fnName] = function (fun: string, parallel: boolean) {\n return this.addHook(when, key, fun, parallel);\n };\n });\n });\n}\n\nfunction _incrementalUpsertUpdate(\n doc: RxDocumentBase,\n json: RxDocumentData\n): Promise> {\n return doc.incrementalModify((_innerDoc) => {\n return json;\n });\n}\n\n/**\n * ensures that the given document exists\n * @return promise that resolves with new doc and flag if inserted\n */\nfunction _incrementalUpsertEnsureRxDocumentExists(\n rxCollection: RxCollection,\n primary: string,\n json: any\n): Promise<\n {\n doc: RxDocument;\n inserted: boolean;\n }\n> {\n /**\n * Optimisation shortcut,\n * first try to find the document in the doc-cache\n */\n const docDataFromCache = rxCollection._docCache.getLatestDocumentDataIfExists(primary);\n if (docDataFromCache) {\n return Promise.resolve({\n doc: rxCollection._docCache.getCachedRxDocuments([docDataFromCache])[0],\n inserted: false\n });\n }\n return rxCollection.findOne(primary).exec()\n .then(doc => {\n if (!doc) {\n return rxCollection.insert(json).then(newDoc => ({\n doc: newDoc,\n inserted: true\n }));\n } else {\n return {\n doc,\n inserted: false\n };\n }\n });\n}\n\n/**\n * creates and prepares a new collection\n */\nexport function createRxCollection(\n {\n database,\n name,\n schema,\n instanceCreationOptions = {},\n migrationStrategies = {},\n autoMigrate = true,\n statics = {},\n methods = {},\n attachments = {},\n options = {},\n localDocuments = false,\n cacheReplacementPolicy = defaultCacheReplacementPolicy,\n conflictHandler = defaultConflictHandler\n }: any\n): Promise {\n const storageInstanceCreationParams: RxStorageInstanceCreationParams = {\n databaseInstanceToken: database.token,\n databaseName: database.name,\n collectionName: name,\n schema: schema.jsonSchema,\n options: instanceCreationOptions,\n multiInstance: database.multiInstance,\n password: database.password,\n devMode: overwritable.isDevMode()\n };\n\n runPluginHooks(\n 'preCreateRxStorageInstance',\n storageInstanceCreationParams\n );\n\n return createRxCollectionStorageInstance(\n database,\n storageInstanceCreationParams\n ).then(storageInstance => {\n const collection = new RxCollectionBase(\n database,\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n statics,\n conflictHandler\n );\n\n return collection\n .prepare()\n .then(() => {\n // ORM add statics\n Object\n .entries(statics)\n .forEach(([funName, fun]) => {\n Object.defineProperty(collection, funName, {\n get: () => (fun as any).bind(collection)\n });\n });\n\n let ret = PROMISE_RESOLVE_VOID;\n if (autoMigrate && collection.schema.version !== 0) {\n ret = collection.migratePromise();\n }\n return ret;\n })\n .then(() => {\n runPluginHooks('createRxCollection', {\n collection,\n creator: {\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n localDocuments,\n statics\n }\n });\n return collection as any;\n })\n /**\n * If the collection creation fails,\n * we yet have to close the storage instances.\n */\n .catch(err => {\n return storageInstance.close()\n .then(() => Promise.reject(err as Error));\n });\n });\n}\n\nexport function isRxCollection(obj: any): boolean {\n return obj instanceof RxCollectionBase;\n}\n"],"mappings":";AAAA,SACIA,MAAM,EACNC,GAAG,EACHC,QAAQ,QACL,MAAM;AAEb,SACIC,OAAO,EACPC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,QACjB,0BAA0B;AACjC,SACIC,0BAA0B,EAC1BC,iCAAiC,EACjCC,wBAAwB,EACxBC,6BAA6B,QAC1B,2BAA2B;AAClC,SACIC,aAAa,EACbC,gBAAgB,QACb,eAAe;AACtB,SACIC,UAAU,EACVC,cAAc,QACX,eAAe;AAItB,SACIC,aAAa,EACbC,2BAA2B,QACxB,gBAAgB;AACvB,SAEIC,gBAAgB,EAChBC,6BAA6B,QAC1B,kBAAkB;AACzB,SAEIC,uBAAuB,QACpB,0BAA0B;AACjC,SACIC,mBAAmB,EACnBC,cAAc,QACX,YAAY;AA0CnB,SACIC,mBAAmB,EACnBC,wBAAwB,QACrB,kCAAkC;AACzC,SACIC,yBAAyB,EACzBC,wCAAwC,EACxCC,0BAA0B,QAEvB,wBAAwB;AAC/B,SAASC,qBAAqB,QAAQ,wBAAwB;AAC9D,SAASC,yBAAyB,QAAQ,kBAAkB;AAC5D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,SAASC,sBAAsB,QAAQ,oDAAoD;AAC3F,SAASC,iCAAiC,QAAQ,sBAAsB;AAExE,IAAMC,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU;AAE3C,IAAMC,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,E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CAACrN,OAAO,CAAC,CAChBsG,OAAO,CAAC,CAAC,CAACgH,OAAO,EAAEhD,GAAG,CAAC,KAAK;QACzB+B,MAAM,CAACkB,cAAc,CAACzH,UAAU,EAAEwH,OAAO,EAAE;UACvC5G,GAAG,EAAEA,CAAA,KAAO4D,GAAG,CAASI,IAAI,CAAC5E,UAAU;QAC3C,CAAC,CAAC;MACN,CAAC,CAAC;MAEN,IAAIM,GAAG,GAAG5I,oBAAoB;MAC9B,IAAIsP,WAAW,IAAIhH,UAAU,CAACtG,MAAM,CAACqD,OAAO,KAAK,CAAC,EAAE;QAChDuD,GAAG,GAAGN,UAAU,CAACrB,cAAc,CAAC,CAAC;MACrC;MACA,OAAO2B,GAAG;IACd,CAAC,CAAC,CACDZ,IAAI,CAAC,MAAM;MACRjH,cAAc,CAAC,oBAAoB,EAAE;QACjCuH,UAAU;QACV0H,OAAO,EAAE;UACLjO,IAAI;UACJC,MAAM;UACNU,eAAe;UACfR,uBAAuB;UACvBC,mBAAmB;UACnBC,OAAO;UACPC,WAAW;UACXC,OAAO;UACPC,sBAAsB;UACtBgN,cAAc;UACd/M;QACJ;MACJ,CAAC,CAAC;MACF,OAAO8F,UAAU;IACrB,CAAC;IACD;AACZ;AACA;AACA,OAHY,CAIC2H,KAAK,CAACtF,GAAG,IAAI;MACV,OAAOjI,eAAe,CAACmD,KAAK,CAAC,CAAC,CACzBmC,IAAI,CAAC,MAAMlC,OAAO,CAACoK,MAAM,CAACvF,GAAY,CAAC,CAAC;IACjD,CAAC,CAAC;EACV,CAAC,CAAC;AACN;AAEA,OAAO,SAASwF,cAAcA,CAACC,GAAQ,EAAW;EAC9C,OAAOA,GAAG,YAAYvO,gBAAgB;AAC1C","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"rx-collection.js","names":["filter","map","mergeMap","ucfirst","flatClone","promiseSeries","pluginMissing","ensureNotFalsy","getFromMapOrThrow","PROMISE_RESOLVE_FALSE","PROMISE_RESOLVE_VOID","NON_PREMIUM_COLLECTION_LIMIT","hasPremiumFlag","fillObjectDataBeforeInsert","createRxCollectionStorageInstance","removeCollectionStorages","ensureRxCollectionIsNotClosed","createRxQuery","_getDefaultQuery","newRxError","newRxTypeError","DocumentCache","mapDocumentsDataToCacheDocs","createQueryCache","defaultCacheReplacementPolicy","createChangeEventBuffer","runAsyncPluginHooks","runPluginHooks","createNewRxDocument","getRxDocumentConstructor","getWrappedStorageInstance","getWrittenDocumentsFromBulkWriteResponse","throwIfIsStorageWriteError","IncrementalWriteQueue","beforeDocumentUpdateWrite","overwritable","defaultConflictHandler","rxChangeEventBulkToRxChangeEvents","HOOKS_WHEN","HOOKS_KEYS","hooksApplied","OPEN_COLLECTIONS","Set","RxCollectionBase","database","name","schema","internalStorageInstance","instanceCreationOptions","migrationStrategies","methods","attachments","options","cacheReplacementPolicy","statics","conflictHandler","storageInstance","timeouts","incrementalWriteQueue","awaitBeforeReads","_incrementalUpsertQueues","Map","synced","hooks","_subs","_docCache","_queryCache","$","checkpoint$","_changeEventBuffer","eventBulks$","onClose","closed","onRemove","_applyHookFunctions","asRxCollection","pipe","changeEventBulk","collectionName","add","_proto","prototype","prepare","count","size","promiseWait","collection","args","existing","Array","from","values","c","db","jsonSchema","primaryPath","newData","oldData","result","_runHooks","checkpoint","documentConstructor","bulk","isLocal","events","docData","listenToRemoveSub","internalStore","changeStream","key","version","found","find","event","documentData","context","operation","subscribe","close","Promise","all","fn","push","databaseStorageToken","storageToken","subDocs","eventBulk","id","internal","databaseToken","token","$emit","cleanup","_minimumDeletedTime","migrationNeeded","getMigrationState","startMigration","batchSize","migratePromise","insert","json","writeResult","bulkInsert","isError","error","insertResult","success","docsData","length","ids","insertRows","hasHooks","useDocData","then","document","index","documents","results","bulkWrite","rxDocuments","ret","docsMap","forEach","row","doc","set","get","primary","bulkRemove","idsOrDocs","rxDocumentMap","findByIds","exec","d","rxDocument","data","toMutableJSON","removeDocs","writeDoc","_deleted","previous","deletedRxDocuments","successIds","getCachedRxDocument","bulkUpsert","insertData","useJsonByDocId","useJson","slice","err","status","documentId","writeData","docDataInDb","documentInDb","getCachedRxDocuments","newDoc","incrementalModify","upsert","bulkResult","incrementalUpsert","queue","_incrementalUpsertEnsureRxDocumentExists","wasInserted","inserted","_incrementalUpsertUpdate","queryObj","op","query","findOne","selector","limit","mangoQuery","$in","exportJSON","importJSON","_exportedJSON","insertCRDT","_updateObj","addPipeline","_options","addHook","when","fun","parallel","includes","boundFun","bind","runName","series","getHooks","instance","tasks","hook","_runHooksSync","time","res","timeout","setTimeout","delete","clearTimeout","requestIdlePromise","sub","unsubscribe","collections","remove","storage","multiInstance","password","hashFunction","_createClass","cE","colProto","Object","getPrototypeOf","fnName","_innerDoc","rxCollection","docDataFromCache","getLatestDocumentDataIfExists","resolve","createRxCollection","autoMigrate","localDocuments","storageInstanceCreationParams","databaseInstanceToken","databaseName","devMode","isDevMode","entries","funName","defineProperty","creator","catch","reject","isRxCollection","obj"],"sources":["../../src/rx-collection.ts"],"sourcesContent":["import {\n filter,\n map,\n mergeMap\n} from 'rxjs';\n\nimport {\n ucfirst,\n flatClone,\n promiseSeries,\n pluginMissing,\n ensureNotFalsy,\n getFromMapOrThrow,\n PROMISE_RESOLVE_FALSE,\n PROMISE_RESOLVE_VOID,\n NON_PREMIUM_COLLECTION_LIMIT,\n hasPremiumFlag\n} from './plugins/utils/index.ts';\nimport {\n fillObjectDataBeforeInsert,\n createRxCollectionStorageInstance,\n removeCollectionStorages,\n ensureRxCollectionIsNotClosed\n} from './rx-collection-helper.ts';\nimport {\n createRxQuery,\n _getDefaultQuery\n} from './rx-query.ts';\nimport {\n newRxError,\n newRxTypeError\n} from './rx-error.ts';\nimport type {\n RxMigrationState\n} from './plugins/migration-schema/index.ts';\nimport {\n DocumentCache,\n mapDocumentsDataToCacheDocs\n} from './doc-cache.ts';\nimport {\n QueryCache,\n createQueryCache,\n defaultCacheReplacementPolicy\n} from './query-cache.ts';\nimport {\n ChangeEventBuffer,\n createChangeEventBuffer\n} from './change-event-buffer.ts';\nimport {\n runAsyncPluginHooks,\n runPluginHooks\n} from './hooks.ts';\n\nimport {\n Subscription,\n Observable\n} from 'rxjs';\n\nimport type {\n KeyFunctionMap,\n RxCollection,\n RxDatabase,\n RxQuery,\n RxDocument,\n RxDumpCollection,\n RxDumpCollectionAny,\n MangoQuery,\n MangoQueryNoLimit,\n RxCacheReplacementPolicy,\n RxStorageWriteError,\n RxDocumentData,\n RxStorageInstanceCreationParams,\n BulkWriteRow,\n RxChangeEvent,\n RxChangeEventInsert,\n RxChangeEventUpdate,\n RxChangeEventDelete,\n RxStorageInstance,\n CollectionsOfDatabase,\n RxChangeEventBulk,\n RxLocalDocumentData,\n RxDocumentBase,\n RxConflictHandler,\n MaybePromise,\n CRDTEntry,\n MangoQuerySelectorAndIndex,\n MigrationStrategies\n} from './types/index.d.ts';\n\nimport {\n RxSchema\n} from './rx-schema.ts';\n\nimport {\n createNewRxDocument,\n getRxDocumentConstructor\n} from './rx-document-prototype-merge.ts';\nimport {\n getWrappedStorageInstance,\n getWrittenDocumentsFromBulkWriteResponse,\n throwIfIsStorageWriteError,\n WrappedRxStorageInstance\n} from './rx-storage-helper.ts';\nimport { IncrementalWriteQueue } from './incremental-write.ts';\nimport { beforeDocumentUpdateWrite } from './rx-document.ts';\nimport { overwritable } from './overwritable.ts';\nimport type { RxPipeline, RxPipelineOptions } from './plugins/pipeline/index.ts';\nimport { defaultConflictHandler } from './replication-protocol/default-conflict-handler.ts';\nimport { rxChangeEventBulkToRxChangeEvents } from './rx-change-event.ts';\n\nconst HOOKS_WHEN = ['pre', 'post'] as const;\ntype HookWhenType = typeof HOOKS_WHEN[number];\nconst HOOKS_KEYS = ['insert', 'save', 'remove', 'create'] as const;\ntype HookKeyType = typeof HOOKS_KEYS[number];\nlet hooksApplied = false;\n\nexport const OPEN_COLLECTIONS = new Set>();\n\nexport class RxCollectionBase<\n InstanceCreationOptions,\n RxDocumentType = { [prop: string]: any; },\n OrmMethods = {},\n StaticMethods = { [key: string]: any; },\n Reactivity = any\n> {\n\n\n /**\n * Stores all 'normal' documents\n */\n public storageInstance: WrappedRxStorageInstance = {} as any;\n public readonly timeouts: Set> = new Set();\n public incrementalWriteQueue: IncrementalWriteQueue = {} as any;\n\n\n /**\n * Before reads, all these methods are awaited. Used to \"block\" reads\n * depending on other processes, like when the RxPipeline is running.\n */\n public readonly awaitBeforeReads = new Set<() => MaybePromise>();\n\n constructor(\n public readonly database: RxDatabase,\n public name: string,\n public schema: RxSchema,\n public internalStorageInstance: RxStorageInstance,\n public instanceCreationOptions: InstanceCreationOptions = {} as any,\n public migrationStrategies: MigrationStrategies = {},\n public methods: KeyFunctionMap = {},\n public attachments: KeyFunctionMap = {},\n public options: any = {},\n public cacheReplacementPolicy: RxCacheReplacementPolicy = defaultCacheReplacementPolicy,\n public statics: KeyFunctionMap = {},\n public conflictHandler: RxConflictHandler = defaultConflictHandler\n ) {\n _applyHookFunctions(this.asRxCollection);\n\n\n if (database) { // might be falsy on pseudoInstance\n this.eventBulks$ = database.eventBulks$.pipe(\n filter(changeEventBulk => changeEventBulk.collectionName === this.name)\n );\n } else { }\n\n\n /**\n * Must be last because the hooks might throw on dev-mode\n * checks and we do not want to have broken collections here.\n * RxCollection instances created for testings do not have a database\n * so we do not add these to the list.\n */\n if (this.database) {\n OPEN_COLLECTIONS.add(this);\n }\n }\n\n get insert$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'INSERT')\n ) as any;\n }\n get update$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'UPDATE')\n ) as any;\n }\n get remove$(): Observable> {\n return this.$.pipe(\n filter(cE => cE.operation === 'DELETE')\n ) as any;\n }\n\n public _incrementalUpsertQueues: Map> = new Map();\n // defaults\n public synced: boolean = false;\n public hooks: {\n [key in HookKeyType]: {\n [when in HookWhenType]: {\n series: Function[];\n parallel: Function[];\n };\n }\n } = {} as any;\n public _subs: Subscription[] = [];\n\n public _docCache: DocumentCache = {} as any;\n\n public _queryCache: QueryCache = createQueryCache();\n public $: Observable> = {} as any;\n public checkpoint$: Observable = {} as any;\n public _changeEventBuffer: ChangeEventBuffer = {} as ChangeEventBuffer;\n\n /**\n * Internally only use eventBulks$\n * Do not use .$ or .observable$ because that has to transform\n * the events which decreases performance.\n */\n public readonly eventBulks$: Observable> = {} as any;\n\n\n /**\n * When the collection is closed,\n * these functions will be called an awaited.\n * Used to automatically clean up stuff that\n * belongs to this collection.\n */\n public onClose: (() => MaybePromise)[] = [];\n public closed = false;\n\n public onRemove: (() => MaybePromise)[] = [];\n\n public async prepare(): Promise {\n\n if (!(await hasPremiumFlag())) {\n\n /**\n * When used in a test suite, we often open and close many databases with collections\n * while not awaiting the database.close() call to improve the test times.\n * So when reopening collections and the OPEN_COLLECTIONS size is full,\n * we retry after some times to account for this.\n */\n let count = 0;\n while (count < 10 && OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) {\n count++;\n await this.promiseWait(30);\n }\n if (OPEN_COLLECTIONS.size > NON_PREMIUM_COLLECTION_LIMIT) {\n throw newRxError('COL23', {\n database: this.database.name,\n collection: this.name,\n args: {\n existing: Array.from(OPEN_COLLECTIONS.values()).map(c => ({\n db: c.database ? c.database.name : '',\n c: c.name\n }))\n }\n });\n }\n }\n\n\n this.storageInstance = getWrappedStorageInstance(\n this.database,\n this.internalStorageInstance,\n this.schema.jsonSchema\n );\n this.incrementalWriteQueue = new IncrementalWriteQueue(\n this.storageInstance,\n this.schema.primaryPath,\n (newData, oldData) => beforeDocumentUpdateWrite(this as any, newData, oldData),\n result => this._runHooks('post', 'save', result)\n );\n\n this.$ = this.eventBulks$.pipe(\n mergeMap(changeEventBulk => rxChangeEventBulkToRxChangeEvents(changeEventBulk)),\n );\n this.checkpoint$ = this.eventBulks$.pipe(\n map(changeEventBulk => changeEventBulk.checkpoint),\n );\n\n this._changeEventBuffer = createChangeEventBuffer(this.asRxCollection);\n let documentConstructor: any;\n this._docCache = new DocumentCache(\n this.schema.primaryPath,\n this.eventBulks$.pipe(\n filter(bulk => !bulk.isLocal),\n map(bulk => bulk.events)\n ),\n docData => {\n if (!documentConstructor) {\n documentConstructor = getRxDocumentConstructor(this.asRxCollection);\n }\n return createNewRxDocument(this.asRxCollection, documentConstructor, docData);\n }\n );\n\n\n const listenToRemoveSub = this.database.internalStore.changeStream().pipe(\n filter(bulk => {\n const key = this.name + '-' + this.schema.version;\n const found = bulk.events.find(event => {\n return (\n event.documentData.context === 'collection' &&\n event.documentData.key === key &&\n event.operation === 'DELETE'\n );\n });\n return !!found;\n })\n ).subscribe(async () => {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n });\n this._subs.push(listenToRemoveSub);\n\n\n const databaseStorageToken = await this.database.storageToken;\n const subDocs = this.storageInstance.changeStream().subscribe(eventBulk => {\n const changeEventBulk: RxChangeEventBulk = {\n id: eventBulk.id,\n isLocal: false,\n internal: false,\n collectionName: this.name,\n storageToken: databaseStorageToken,\n events: eventBulk.events,\n databaseToken: this.database.token,\n checkpoint: eventBulk.checkpoint,\n context: eventBulk.context\n };\n this.database.$emit(changeEventBulk);\n });\n this._subs.push(subDocs);\n\n return PROMISE_RESOLVE_VOID;\n }\n\n\n /**\n * Manually call the cleanup function of the storage.\n * @link https://rxdb.info/cleanup.html\n */\n cleanup(_minimumDeletedTime?: number): Promise {\n ensureRxCollectionIsNotClosed(this);\n throw pluginMissing('cleanup');\n }\n\n // overwritten by migration-plugin\n migrationNeeded(): Promise {\n throw pluginMissing('migration-schema');\n }\n getMigrationState(): RxMigrationState {\n throw pluginMissing('migration-schema');\n }\n startMigration(batchSize: number = 10): Promise {\n ensureRxCollectionIsNotClosed(this);\n return this.getMigrationState().startMigration(batchSize);\n }\n migratePromise(batchSize: number = 10): Promise {\n return this.getMigrationState().migratePromise(batchSize);\n }\n\n async insert(\n json: RxDocumentType | RxDocument\n ): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const writeResult = await this.bulkInsert([json as any]);\n\n const isError = writeResult.error[0];\n throwIfIsStorageWriteError(this as any, (json as any)[this.schema.primaryPath] as any, json, isError as any);\n const insertResult = ensureNotFalsy(writeResult.success[0]);\n return insertResult;\n }\n\n async bulkInsert(\n docsData: RxDocumentType[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (docsData.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n const primaryPath = this.schema.primaryPath;\n\n const ids = new Set();\n\n /**\n * This code is a bit redundant for better performance.\n * Instead of iterating multiple times,\n * we directly transform the input to a write-row array.\n */\n let insertRows: BulkWriteRow[];\n if (this.hasHooks('pre', 'insert')) {\n insertRows = await Promise.all(\n docsData.map(docData => {\n const useDocData = fillObjectDataBeforeInsert(this.schema, docData);\n return this._runHooks('pre', 'insert', useDocData)\n .then(() => {\n ids.add((useDocData as any)[primaryPath]);\n return { document: useDocData };\n });\n })\n );\n } else {\n insertRows = new Array(docsData.length);\n const schema = this.schema;\n for (let index = 0; index < docsData.length; index++) {\n const docData = docsData[index];\n const useDocData = fillObjectDataBeforeInsert(schema, docData);\n ids.add((useDocData as any)[primaryPath]);\n insertRows[index] = { document: useDocData };\n }\n }\n\n\n if (ids.size !== docsData.length) {\n throw newRxError('COL22', {\n collection: this.name,\n args: {\n documents: docsData\n }\n });\n }\n\n const results = await this.storageInstance.bulkWrite(\n insertRows,\n 'rx-collection-bulk-insert'\n );\n\n\n /**\n * Often the user does not need to access the RxDocuments of the bulkInsert() call.\n * So we transform the data to RxDocuments only if needed to use less CPU performance.\n */\n let rxDocuments: RxDocument[];\n const collection = this;\n const ret = {\n get success() {\n if (!rxDocuments) {\n const success = getWrittenDocumentsFromBulkWriteResponse(\n collection.schema.primaryPath,\n insertRows,\n results\n );\n rxDocuments = mapDocumentsDataToCacheDocs(collection._docCache, success);\n }\n return rxDocuments;\n },\n error: results.error\n };\n\n if (this.hasHooks('post', 'insert')) {\n const docsMap: Map = new Map();\n insertRows.forEach(row => {\n const doc = row.document;\n docsMap.set((doc as any)[primaryPath] as any, doc);\n });\n await Promise.all(\n ret.success.map(doc => {\n return this._runHooks(\n 'post',\n 'insert',\n docsMap.get(doc.primary),\n doc\n );\n })\n );\n }\n\n return ret;\n }\n\n async bulkRemove(\n /**\n * You can either remove the documents by their ids\n * or by directly providing the RxDocument instances\n * if you have them already. This improves performance a bit.\n */\n idsOrDocs: string[] | RxDocument[]\n ): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const primaryPath = this.schema.primaryPath;\n /**\n * Optimization shortcut,\n * do nothing when called with an empty array\n */\n if (idsOrDocs.length === 0) {\n return {\n success: [],\n error: []\n };\n }\n\n let rxDocumentMap: Map>;\n if (typeof idsOrDocs[0] === 'string') {\n rxDocumentMap = await this.findByIds(idsOrDocs as string[]).exec();\n } else {\n rxDocumentMap = new Map();\n (idsOrDocs as RxDocument[]).forEach(d => rxDocumentMap.set(d.primary, d));\n }\n\n const docsData: RxDocumentData[] = [];\n const docsMap: Map> = new Map();\n Array.from(rxDocumentMap.values()).forEach(rxDocument => {\n const data: RxDocumentData = rxDocument.toMutableJSON(true) as any;\n docsData.push(data);\n docsMap.set(rxDocument.primary, data);\n });\n\n await Promise.all(\n docsData.map(doc => {\n const primary = (doc as any)[this.schema.primaryPath];\n return this._runHooks('pre', 'remove', doc, rxDocumentMap.get(primary));\n })\n );\n const removeDocs: BulkWriteRow[] = docsData.map(doc => {\n const writeDoc = flatClone(doc);\n writeDoc._deleted = true;\n return {\n previous: doc,\n document: writeDoc\n };\n });\n const results = await this.storageInstance.bulkWrite(\n removeDocs,\n 'rx-collection-bulk-remove'\n );\n\n\n const success = getWrittenDocumentsFromBulkWriteResponse(\n this.schema.primaryPath,\n removeDocs,\n results\n );\n\n const deletedRxDocuments: RxDocument[] = [];\n const successIds: string[] = success.map(d => {\n const id = d[primaryPath] as string;\n const doc = this._docCache.getCachedRxDocument(d);\n deletedRxDocuments.push(doc);\n return id;\n });\n\n // run hooks\n await Promise.all(\n successIds.map(id => {\n return this._runHooks(\n 'post',\n 'remove',\n docsMap.get(id),\n rxDocumentMap.get(id)\n );\n })\n );\n\n\n return {\n success: deletedRxDocuments,\n error: results.error\n };\n }\n\n /**\n * same as bulkInsert but overwrites existing document with same primary\n */\n async bulkUpsert(docsData: Partial[]): Promise<{\n success: RxDocument[];\n error: RxStorageWriteError[];\n }> {\n ensureRxCollectionIsNotClosed(this);\n const insertData: RxDocumentType[] = [];\n const useJsonByDocId: Map = new Map();\n docsData.forEach(docData => {\n const useJson = fillObjectDataBeforeInsert(this.schema, docData);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL3', {\n primaryPath: this.schema.primaryPath as string,\n data: useJson,\n schema: this.schema.jsonSchema\n });\n }\n useJsonByDocId.set(primary, useJson);\n insertData.push(useJson);\n });\n\n const insertResult = await this.bulkInsert(insertData);\n const success = insertResult.success.slice(0);\n const error: RxStorageWriteError[] = [];\n\n // update the ones that existed already\n await Promise.all(\n insertResult.error.map(async (err) => {\n if (err.status !== 409) {\n error.push(err);\n } else {\n const id = err.documentId;\n const writeData = getFromMapOrThrow(useJsonByDocId, id);\n const docDataInDb = ensureNotFalsy(err.documentInDb);\n const doc = this._docCache.getCachedRxDocuments([docDataInDb])[0];\n const newDoc = await doc.incrementalModify(() => writeData);\n success.push(newDoc);\n }\n })\n );\n return {\n error,\n success\n };\n }\n\n /**\n * same as insert but overwrites existing document with same primary\n */\n async upsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const bulkResult = await this.bulkUpsert([json]);\n throwIfIsStorageWriteError(\n this.asRxCollection,\n (json as any)[this.schema.primaryPath],\n json as any,\n bulkResult.error[0]\n );\n return bulkResult.success[0];\n }\n\n /**\n * upserts to a RxDocument, uses incrementalModify if document already exists\n */\n incrementalUpsert(json: Partial): Promise> {\n ensureRxCollectionIsNotClosed(this);\n const useJson = fillObjectDataBeforeInsert(this.schema, json);\n const primary: string = useJson[this.schema.primaryPath] as any;\n if (!primary) {\n throw newRxError('COL4', {\n data: json\n });\n }\n\n // ensure that it won't try 2 parallel runs\n let queue = this._incrementalUpsertQueues.get(primary);\n if (!queue) {\n queue = PROMISE_RESOLVE_VOID;\n }\n queue = queue\n .then(() => _incrementalUpsertEnsureRxDocumentExists(this as any, primary as any, useJson))\n .then((wasInserted) => {\n if (!wasInserted.inserted) {\n return _incrementalUpsertUpdate(wasInserted.doc, useJson);\n } else {\n return wasInserted.doc;\n }\n });\n this._incrementalUpsertQueues.set(primary, queue);\n return queue;\n }\n\n find(queryObj?: MangoQuery): RxQuery<\n RxDocumentType,\n RxDocument[],\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'find',\n queryObj,\n collection: this\n });\n\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n const query = createRxQuery('find', queryObj, this as any);\n return query as any;\n }\n\n findOne(\n queryObj?: MangoQueryNoLimit | string\n ): RxQuery<\n RxDocumentType,\n RxDocument | null,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n\n runPluginHooks('prePrepareRxQuery', {\n op: 'findOne',\n queryObj,\n collection: this\n });\n\n let query;\n\n if (typeof queryObj === 'string') {\n query = createRxQuery('findOne', {\n selector: {\n [this.schema.primaryPath]: queryObj\n },\n limit: 1\n }, this as any);\n } else {\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n\n // cannot have limit on findOne queries because it will be overwritten\n if ((queryObj as MangoQuery).limit) {\n throw newRxError('QU6');\n }\n\n queryObj = flatClone(queryObj);\n (queryObj as any).limit = 1;\n query = createRxQuery('findOne', queryObj, this as any);\n }\n\n\n return query as any;\n }\n\n count(queryObj?: MangoQuerySelectorAndIndex): RxQuery<\n RxDocumentType,\n number,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n if (!queryObj) {\n queryObj = _getDefaultQuery();\n }\n const query = createRxQuery('count', queryObj, this as any);\n return query as any;\n }\n\n /**\n * find a list documents by their primary key\n * has way better performance then running multiple findOne() or a find() with a complex $or-selected\n */\n findByIds(\n ids: string[]\n ): RxQuery<\n RxDocumentType,\n Map>,\n OrmMethods,\n Reactivity\n > {\n ensureRxCollectionIsNotClosed(this);\n const mangoQuery: MangoQuery = {\n selector: {\n [this.schema.primaryPath]: {\n $in: ids.slice(0)\n }\n } as any\n };\n const query = createRxQuery('findByIds', mangoQuery, this as any);\n return query as any;\n }\n\n /**\n * Export collection to a JSON friendly format.\n */\n exportJSON(): Promise>;\n exportJSON(): Promise>;\n exportJSON(): Promise {\n throw pluginMissing('json-dump');\n }\n\n /**\n * Import the parsed JSON export into the collection.\n * @param _exportedJSON The previously exported data from the `.exportJSON()` method.\n */\n importJSON(_exportedJSON: RxDumpCollectionAny): Promise {\n throw pluginMissing('json-dump');\n }\n\n insertCRDT(_updateObj: CRDTEntry | CRDTEntry[]): RxDocument {\n throw pluginMissing('crdt');\n }\n\n\n addPipeline(_options: RxPipelineOptions): Promise> {\n throw pluginMissing('pipeline');\n }\n\n /**\n * HOOKS\n */\n addHook(when: HookWhenType, key: HookKeyType, fun: any, parallel = false) {\n if (typeof fun !== 'function') {\n throw newRxTypeError('COL7', {\n key,\n when\n });\n }\n\n if (!HOOKS_WHEN.includes(when)) {\n throw newRxTypeError('COL8', {\n key,\n when\n });\n }\n\n if (!HOOKS_KEYS.includes(key)) {\n throw newRxError('COL9', {\n key\n });\n }\n\n if (when === 'post' && key === 'create' && parallel === true) {\n throw newRxError('COL10', {\n when,\n key,\n parallel\n });\n }\n\n // bind this-scope to hook-function\n const boundFun = fun.bind(this);\n\n const runName = parallel ? 'parallel' : 'series';\n\n this.hooks[key] = this.hooks[key] || {};\n this.hooks[key][when] = this.hooks[key][when] || {\n series: [],\n parallel: []\n };\n this.hooks[key][when][runName].push(boundFun);\n }\n\n getHooks(when: HookWhenType, key: HookKeyType) {\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return {\n series: [],\n parallel: []\n };\n }\n return this.hooks[key][when];\n }\n\n hasHooks(when: HookWhenType, key: HookKeyType) {\n /**\n * Performance shortcut\n * so that we not have to build the empty object.\n */\n if (\n !this.hooks[key] ||\n !this.hooks[key][when]\n ) {\n return false;\n }\n\n const hooks = this.getHooks(when, key);\n if (!hooks) {\n return false;\n }\n return hooks.series.length > 0 || hooks.parallel.length > 0;\n }\n\n _runHooks(when: HookWhenType, key: HookKeyType, data: any, instance?: any): Promise {\n const hooks = this.getHooks(when, key);\n\n if (!hooks) {\n return PROMISE_RESOLVE_VOID;\n }\n\n // run parallel: false\n const tasks = hooks.series.map((hook: any) => () => hook(data, instance));\n return promiseSeries(tasks)\n // run parallel: true\n .then(() => Promise.all(\n hooks.parallel\n .map((hook: any) => hook(data, instance))\n ));\n }\n\n /**\n * does the same as ._runHooks() but with non-async-functions\n */\n _runHooksSync(when: HookWhenType, key: HookKeyType, data: any, instance: any) {\n if (!this.hasHooks(when, key)) {\n return;\n }\n const hooks = this.getHooks(when, key);\n if (!hooks) return;\n hooks.series.forEach((hook: any) => hook(data, instance));\n }\n\n /**\n * Returns a promise that resolves after the given time.\n * Ensures that is properly cleans up when the collection is closed\n * so that no running timeouts prevent the exit of the JavaScript process.\n */\n promiseWait(time: number): Promise {\n const ret = new Promise(res => {\n const timeout = setTimeout(() => {\n this.timeouts.delete(timeout);\n res();\n }, time);\n this.timeouts.add(timeout);\n });\n return ret;\n }\n\n async close(): Promise {\n if (this.closed) {\n return PROMISE_RESOLVE_FALSE;\n }\n\n OPEN_COLLECTIONS.delete(this);\n\n\n await Promise.all(this.onClose.map(fn => fn()));\n\n /**\n * Settings closed = true\n * must be the first thing to do,\n * so for example the replication can directly stop\n * instead of sending requests to a closed storage.\n */\n this.closed = true;\n\n\n Array.from(this.timeouts).forEach(timeout => clearTimeout(timeout));\n if (this._changeEventBuffer) {\n this._changeEventBuffer.close();\n }\n /**\n * First wait until the whole database is idle.\n * This ensures that the storage does not get closed\n * while some operation is running.\n * It is important that we do not intercept a running call\n * because it might lead to undefined behavior like when a doc is written\n * but the change is not added to the changes collection.\n */\n return this.database.requestIdlePromise()\n .then(() => this.storageInstance.close())\n .then(() => {\n /**\n * Unsubscribing must be done AFTER the storageInstance.close()\n * Because the conflict handling is part of the subscriptions and\n * otherwise there might be open conflicts to be resolved which\n * will then stuck and never resolve.\n */\n this._subs.forEach(sub => sub.unsubscribe());\n\n delete this.database.collections[this.name];\n return runAsyncPluginHooks('postCloseRxCollection', this).then(() => true);\n });\n }\n\n /**\n * remove all data of the collection\n */\n async remove(): Promise {\n await this.close();\n await Promise.all(this.onRemove.map(fn => fn()));\n /**\n * TODO here we should pass the already existing\n * storage instances instead of creating new ones.\n */\n await removeCollectionStorages(\n this.database.storage,\n this.database.internalStore,\n this.database.token,\n this.database.name,\n this.name,\n this.database.multiInstance,\n this.database.password,\n this.database.hashFunction\n );\n }\n\n get asRxCollection(): RxCollection {\n return this as any;\n }\n}\n\n/**\n * adds the hook-functions to the collections prototype\n * this runs only once\n */\nfunction _applyHookFunctions(\n collection: RxCollection\n) {\n if (hooksApplied) return; // already run\n hooksApplied = true;\n const colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(key => {\n HOOKS_WHEN.map(when => {\n const fnName = when + ucfirst(key);\n colProto[fnName] = function (fun: string, parallel: boolean) {\n return this.addHook(when, key, fun, parallel);\n };\n });\n });\n}\n\nfunction _incrementalUpsertUpdate(\n doc: RxDocumentBase,\n json: RxDocumentData\n): Promise> {\n return doc.incrementalModify((_innerDoc) => {\n return json;\n });\n}\n\n/**\n * ensures that the given document exists\n * @return promise that resolves with new doc and flag if inserted\n */\nfunction _incrementalUpsertEnsureRxDocumentExists(\n rxCollection: RxCollection,\n primary: string,\n json: any\n): Promise<\n {\n doc: RxDocument;\n inserted: boolean;\n }\n> {\n /**\n * Optimisation shortcut,\n * first try to find the document in the doc-cache\n */\n const docDataFromCache = rxCollection._docCache.getLatestDocumentDataIfExists(primary);\n if (docDataFromCache) {\n return Promise.resolve({\n doc: rxCollection._docCache.getCachedRxDocuments([docDataFromCache])[0],\n inserted: false\n });\n }\n return rxCollection.findOne(primary).exec()\n .then(doc => {\n if (!doc) {\n return rxCollection.insert(json).then(newDoc => ({\n doc: newDoc,\n inserted: true\n }));\n } else {\n return {\n doc,\n inserted: false\n };\n }\n });\n}\n\n/**\n * creates and prepares a new collection\n */\nexport function createRxCollection(\n {\n database,\n name,\n schema,\n instanceCreationOptions = {},\n migrationStrategies = {},\n autoMigrate = true,\n statics = {},\n methods = {},\n attachments = {},\n options = {},\n localDocuments = false,\n cacheReplacementPolicy = defaultCacheReplacementPolicy,\n conflictHandler = defaultConflictHandler\n }: any\n): Promise {\n const storageInstanceCreationParams: RxStorageInstanceCreationParams = {\n databaseInstanceToken: database.token,\n databaseName: database.name,\n collectionName: name,\n schema: schema.jsonSchema,\n options: instanceCreationOptions,\n multiInstance: database.multiInstance,\n password: database.password,\n devMode: overwritable.isDevMode()\n };\n\n runPluginHooks(\n 'preCreateRxStorageInstance',\n storageInstanceCreationParams\n );\n\n return createRxCollectionStorageInstance(\n database,\n storageInstanceCreationParams\n ).then(storageInstance => {\n const collection = new RxCollectionBase(\n database,\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n statics,\n conflictHandler\n );\n\n return collection\n .prepare()\n .then(() => {\n // ORM add statics\n Object\n .entries(statics)\n .forEach(([funName, fun]) => {\n Object.defineProperty(collection, funName, {\n get: () => (fun as any).bind(collection)\n });\n });\n\n let ret = PROMISE_RESOLVE_VOID;\n if (autoMigrate && collection.schema.version !== 0) {\n ret = collection.migratePromise();\n }\n return ret;\n })\n .then(() => {\n runPluginHooks('createRxCollection', {\n collection,\n creator: {\n name,\n schema,\n storageInstance,\n instanceCreationOptions,\n migrationStrategies,\n methods,\n attachments,\n options,\n cacheReplacementPolicy,\n localDocuments,\n statics\n }\n });\n return collection as any;\n })\n /**\n * If the collection creation fails,\n * we yet have to close the storage instances.\n */\n .catch(err => {\n OPEN_COLLECTIONS.delete(collection);\n return storageInstance.close()\n .then(() => Promise.reject(err as Error));\n });\n });\n}\n\nexport function isRxCollection(obj: any): boolean {\n return obj instanceof RxCollectionBase;\n}\n"],"mappings":";AAAA,SACIA,MAAM,EACNC,GAAG,EACHC,QAAQ,QACL,MAAM;AAEb,SACIC,OAAO,EACPC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,4BAA4B,EAC5BC,cAAc,QACX,0BAA0B;AACjC,SACIC,0BAA0B,EAC1BC,iCAAiC,EACjCC,wBAAwB,EACxBC,6BAA6B,QAC1B,2BAA2B;AAClC,SACIC,aAAa,EACbC,gBAAgB,QACb,eAAe;AACtB,SACIC,UAAU,EACVC,cAAc,QACX,eAAe;AAItB,SACIC,aAAa,EACbC,2BAA2B,QACxB,gBAAgB;AACvB,SAEIC,gBAAgB,EAChBC,6BAA6B,QAC1B,kBAAkB;AACzB,SAEIC,uBAAuB,QACpB,0BAA0B;AACjC,SACIC,mBAAmB,EACnBC,cAAc,QACX,YAAY;AA0CnB,SACIC,mBAAmB,EACnBC,wBAAwB,QACrB,kCAAkC;AACzC,SACIC,yBAAyB,EACzBC,wCAAwC,EACxCC,0BAA0B,QAEvB,wBAAwB;AAC/B,SAASC,qBAAqB,QAAQ,wBAAwB;AAC9D,SAASC,yBAAyB,QAAQ,kBAAkB;AAC5D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,SAASC,sBAAsB,QAAQ,oDAAoD;AAC3F,SAASC,iCAAiC,QAAQ,sBAAsB;AAExE,IAAMC,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU;AAE3C,IAAMC,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EA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,CAASI,IAAI,CAAC7I,UAAU;QAC3C,CAAC,CAAC;MACN,CAAC,CAAC;MAEN,IAAI0E,GAAG,GAAGtJ,oBAAoB;MAC9B,IAAI4P,WAAW,IAAIhL,UAAU,CAACxC,MAAM,CAACgE,OAAO,KAAK,CAAC,EAAE;QAChDkD,GAAG,GAAG1E,UAAU,CAACoD,cAAc,CAAC,CAAC;MACrC;MACA,OAAOsB,GAAG;IACd,CAAC,CAAC,CACDP,IAAI,CAAC,MAAM;MACR9H,cAAc,CAAC,oBAAoB,EAAE;QACjC2D,UAAU;QACV0L,OAAO,EAAE;UACLnO,IAAI;UACJC,MAAM;UACNU,eAAe;UACfR,uBAAuB;UACvBC,mBAAmB;UACnBC,OAAO;UACPC,WAAW;UACXC,OAAO;UACPC,sBAAsB;UACtBkN,cAAc;UACdjN;QACJ;MACJ,CAAC,CAAC;MACF,OAAOgC,UAAU;IACrB,CAAC;IACD;AACZ;AACA;AACA,OAHY,CAIC2L,KAAK,CAACpF,GAAG,IAAI;MACVpJ,gBAAgB,CAACsM,MAAM,CAACzJ,UAAU,CAAC;MACnC,OAAO9B,eAAe,CAAC8D,KAAK,CAAC,CAAC,CACzBmC,IAAI,CAAC,MAAMlC,OAAO,CAAC2J,MAAM,CAACrF,GAAY,CAAC,CAAC;IACjD,CAAC,CAAC;EACV,CAAC,CAAC;AACN;AAEA,OAAO,SAASsF,cAAcA,CAACC,GAAQ,EAAW;EAC9C,OAAOA,GAAG,YAAYzO,gBAAgB;AAC1C","ignoreList":[]} \ No newline at end of file diff --git a/dist/types/plugins/dev-mode/error-messages.d.ts b/dist/types/plugins/dev-mode/error-messages.d.ts index 4f7cbf1e6f4..f1d6b456ee6 100644 --- a/dist/types/plugins/dev-mode/error-messages.d.ts +++ b/dist/types/plugins/dev-mode/error-messages.d.ts @@ -70,6 +70,7 @@ export declare const ERROR_MESSAGES: { COL21: string; CONFLICT: string; COL22: string; + COL23: string; DOC1: string; DOC2: string; DOC3: string; diff --git a/dist/types/plugins/storage-denokv/index.d.ts b/dist/types/plugins/storage-denokv/index.d.ts index d197fbdae75..9c58f14e206 100644 --- a/dist/types/plugins/storage-denokv/index.d.ts +++ b/dist/types/plugins/storage-denokv/index.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceDenoKV } from "./rx-storage-instance-denokv.ts"; export declare class RxStorageDenoKV implements RxStorage, DenoKVSettings> { settings: DenoKVSettings; name: string; - readonly rxdbVersion = "16.0.0-beta.5"; + readonly rxdbVersion = "16.0.0-beta.6"; constructor(settings: DenoKVSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts b/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts index f22c8e8545f..4fcf030232f 100644 --- a/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts +++ b/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceDexie } from './rx-storage-instance-dexie.ts'; export declare class RxStorageDexie implements RxStorage { settings: DexieSettings; name: string; - readonly rxdbVersion = "16.0.0-beta.5"; + readonly rxdbVersion = "16.0.0-beta.6"; constructor(settings: DexieSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts b/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts index e7855d0b44f..4a522e8a4bb 100644 --- a/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts +++ b/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceMongoDB } from './rx-storage-instance-mongodb.ts'; export declare class RxStorageMongoDB implements RxStorage { databaseSettings: MongoDBDatabaseSettings; name: string; - readonly rxdbVersion = "16.0.0-beta.5"; + readonly rxdbVersion = "16.0.0-beta.6"; constructor(databaseSettings: MongoDBDatabaseSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-remote/rx-storage-remote.d.ts b/dist/types/plugins/storage-remote/rx-storage-remote.d.ts index 46eb3bf471d..ac1fe6902f6 100644 --- a/dist/types/plugins/storage-remote/rx-storage-remote.d.ts +++ b/dist/types/plugins/storage-remote/rx-storage-remote.d.ts @@ -4,7 +4,7 @@ import type { MessageFromRemote, RemoteMessageChannel, RxStorageRemoteInternals, export declare class RxStorageRemote implements RxStorage { readonly settings: RxStorageRemoteSettings; readonly name: string; - readonly rxdbVersion = "16.0.0-beta.5"; + readonly rxdbVersion = "16.0.0-beta.6"; private seed; private lastRequestId; messageChannelIfOneMode?: Promise; diff --git a/dist/types/plugins/utils/index.d.ts b/dist/types/plugins/utils/index.d.ts index 4f3f41355fb..8601b46bae6 100644 --- a/dist/types/plugins/utils/index.d.ts +++ b/dist/types/plugins/utils/index.d.ts @@ -16,3 +16,4 @@ export * from './utils-time.ts'; export * from './utils-other.ts'; export * from './utils-rxdb-version.ts'; export * from './utils-global.ts'; +export * from './utils-premium.ts'; diff --git a/dist/types/plugins/utils/utils-global.d.ts b/dist/types/plugins/utils/utils-global.d.ts index 3dc4e24e702..ccd9a2f90bd 100644 --- a/dist/types/plugins/utils/utils-global.d.ts +++ b/dist/types/plugins/utils/utils-global.d.ts @@ -3,4 +3,3 @@ * can be imported and mutated at will. */ export declare const RXDB_UTILS_GLOBAL: any; -export declare const PREMIUM_FLAG_HASH = "6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93"; diff --git a/dist/types/plugins/utils/utils-premium.d.ts b/dist/types/plugins/utils/utils-premium.d.ts new file mode 100644 index 00000000000..aadf763c02e --- /dev/null +++ b/dist/types/plugins/utils/utils-premium.d.ts @@ -0,0 +1,10 @@ +export declare const PREMIUM_FLAG_HASH = "6da4936d1425ff3a5c44c02342c6daf791d266be3ae8479b8ec59e261df41b93"; +export declare const NON_PREMIUM_COLLECTION_LIMIT = 16; +/** + * Here we check if the premium flag has been set. + * This code exists in the open source version of RxDB. + * Yes you are allowed to fork the repo and just overwrite this function. + * However you might better spend this time developing your real project + * and supporting the RxDB efforts by buying premium. + */ +export declare function hasPremiumFlag(): Promise; diff --git a/dist/types/plugins/utils/utils-rxdb-version.d.ts b/dist/types/plugins/utils/utils-rxdb-version.d.ts index 2ffad84ebdd..8a44884b7ee 100644 --- a/dist/types/plugins/utils/utils-rxdb-version.d.ts +++ b/dist/types/plugins/utils/utils-rxdb-version.d.ts @@ -1,4 +1,4 @@ /** * This file is replaced in the 'npm run build:version' script. */ -export declare const RXDB_VERSION = "16.0.0-beta.5"; +export declare const RXDB_VERSION = "16.0.0-beta.6"; diff --git a/dist/types/rx-collection.d.ts b/dist/types/rx-collection.d.ts index 323e61005eb..af7c1743385 100644 --- a/dist/types/rx-collection.d.ts +++ b/dist/types/rx-collection.d.ts @@ -12,6 +12,9 @@ declare const HOOKS_WHEN: readonly ["pre", "post"]; type HookWhenType = typeof HOOKS_WHEN[number]; declare const HOOKS_KEYS: readonly ["insert", "save", "remove", "create"]; type HookKeyType = typeof HOOKS_KEYS[number]; +export declare const OPEN_COLLECTIONS: Set>; export declare class RxCollectionBase | undefined; readonly idleQueue: IdleQueue; - readonly rxdbVersion = "16.0.0-beta.5"; + readonly rxdbVersion = "16.0.0-beta.6"; /** * Contains all known non-closed storage instances * that belong to this database. diff --git a/package.json b/package.json index cfd7292238d..ca8a0811312 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rxdb", "description": "A local-first realtime NoSQL Database for JavaScript applications - https://rxdb.info/", - "version": "16.0.0-beta.5", + "version": "16.0.0-beta.6", "author": "pubkey", "repository": { "type": "git", diff --git a/src/plugins/utils/utils-rxdb-version.ts b/src/plugins/utils/utils-rxdb-version.ts index a4725c3113c..52636590dcd 100644 --- a/src/plugins/utils/utils-rxdb-version.ts +++ b/src/plugins/utils/utils-rxdb-version.ts @@ -1,4 +1,4 @@ /** * This file is replaced in the 'npm run build:version' script. */ -export const RXDB_VERSION = '16.0.0-beta.5'; +export const RXDB_VERSION = '16.0.0-beta.6';