@connecttomahdi/rxdb 17.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +54 -0
- package/CHANGELOG.md +2469 -0
- package/CLAUDE.md +63 -0
- package/LICENSE.txt +201 -0
- package/README.md +263 -0
- package/babel.config.js +58 -0
- package/dist/cjs/change-event-buffer.js +146 -0
- package/dist/cjs/change-event-buffer.js.map +1 -0
- package/dist/cjs/custom-index.js +284 -0
- package/dist/cjs/custom-index.js.map +1 -0
- package/dist/cjs/doc-cache.js +231 -0
- package/dist/cjs/doc-cache.js.map +1 -0
- package/dist/cjs/event-reduce.js +102 -0
- package/dist/cjs/event-reduce.js.map +1 -0
- package/dist/cjs/hooks.js +131 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/incremental-write.js +169 -0
- package/dist/cjs/incremental-write.js.map +1 -0
- package/dist/cjs/index.js +270 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/overwritable.js +39 -0
- package/dist/cjs/overwritable.js.map +1 -0
- package/dist/cjs/plugin-helpers.js +223 -0
- package/dist/cjs/plugin-helpers.js.map +1 -0
- package/dist/cjs/plugin.js +94 -0
- package/dist/cjs/plugin.js.map +1 -0
- package/dist/cjs/plugins/attachments/attachments-utils.js +49 -0
- package/dist/cjs/plugins/attachments/attachments-utils.js.map +1 -0
- package/dist/cjs/plugins/attachments/index.js +237 -0
- package/dist/cjs/plugins/attachments/index.js.map +1 -0
- package/dist/cjs/plugins/attachments-compression/index.js +143 -0
- package/dist/cjs/plugins/attachments-compression/index.js.map +1 -0
- package/dist/cjs/plugins/backup/file-util.js +102 -0
- package/dist/cjs/plugins/backup/file-util.js.map +1 -0
- package/dist/cjs/plugins/backup/index.js +206 -0
- package/dist/cjs/plugins/backup/index.js.map +1 -0
- package/dist/cjs/plugins/cleanup/cleanup-helper.js +17 -0
- package/dist/cjs/plugins/cleanup/cleanup-helper.js.map +1 -0
- package/dist/cjs/plugins/cleanup/cleanup-state.js +83 -0
- package/dist/cjs/plugins/cleanup/cleanup-state.js.map +1 -0
- package/dist/cjs/plugins/cleanup/cleanup.js +116 -0
- package/dist/cjs/plugins/cleanup/cleanup.js.map +1 -0
- package/dist/cjs/plugins/cleanup/index.js +64 -0
- package/dist/cjs/plugins/cleanup/index.js.map +1 -0
- package/dist/cjs/plugins/crdt/index.js +392 -0
- package/dist/cjs/plugins/crdt/index.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/check-document.js +158 -0
- package/dist/cjs/plugins/dev-mode/check-document.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/check-migration-strategies.js +43 -0
- package/dist/cjs/plugins/dev-mode/check-migration-strategies.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/check-orm.js +53 -0
- package/dist/cjs/plugins/dev-mode/check-orm.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/check-query.js +183 -0
- package/dist/cjs/plugins/dev-mode/check-query.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/check-schema.js +487 -0
- package/dist/cjs/plugins/dev-mode/check-schema.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/dev-mode-tracking.js +93 -0
- package/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/entity-properties.js +56 -0
- package/dist/cjs/plugins/dev-mode/entity-properties.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/error-messages.js +1295 -0
- package/dist/cjs/plugins/dev-mode/error-messages.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/index.js +195 -0
- package/dist/cjs/plugins/dev-mode/index.js.map +1 -0
- package/dist/cjs/plugins/dev-mode/unallowed-properties.js +88 -0
- package/dist/cjs/plugins/dev-mode/unallowed-properties.js.map +1 -0
- package/dist/cjs/plugins/electron/electron-helper.js +9 -0
- package/dist/cjs/plugins/electron/electron-helper.js.map +1 -0
- package/dist/cjs/plugins/electron/index.js +39 -0
- package/dist/cjs/plugins/electron/index.js.map +1 -0
- package/dist/cjs/plugins/electron/rx-storage-ipc-main.js +45 -0
- package/dist/cjs/plugins/electron/rx-storage-ipc-main.js.map +1 -0
- package/dist/cjs/plugins/electron/rx-storage-ipc-renderer.js +37 -0
- package/dist/cjs/plugins/electron/rx-storage-ipc-renderer.js.map +1 -0
- package/dist/cjs/plugins/encryption-crypto-js/index.js +165 -0
- package/dist/cjs/plugins/encryption-crypto-js/index.js.map +1 -0
- package/dist/cjs/plugins/flutter/index.js +62 -0
- package/dist/cjs/plugins/flutter/index.js.map +1 -0
- package/dist/cjs/plugins/json-dump/index.js +94 -0
- package/dist/cjs/plugins/json-dump/index.js.map +1 -0
- package/dist/cjs/plugins/key-compression/index.js +136 -0
- package/dist/cjs/plugins/key-compression/index.js.map +1 -0
- package/dist/cjs/plugins/leader-election/index.js +107 -0
- package/dist/cjs/plugins/leader-election/index.js.map +1 -0
- package/dist/cjs/plugins/local-documents/index.js +109 -0
- package/dist/cjs/plugins/local-documents/index.js.map +1 -0
- package/dist/cjs/plugins/local-documents/local-documents-helper.js +78 -0
- package/dist/cjs/plugins/local-documents/local-documents-helper.js.map +1 -0
- package/dist/cjs/plugins/local-documents/local-documents.js +107 -0
- package/dist/cjs/plugins/local-documents/local-documents.js.map +1 -0
- package/dist/cjs/plugins/local-documents/rx-local-document.js +257 -0
- package/dist/cjs/plugins/local-documents/rx-local-document.js.map +1 -0
- package/dist/cjs/plugins/migration-schema/index.js +84 -0
- package/dist/cjs/plugins/migration-schema/index.js.map +1 -0
- package/dist/cjs/plugins/migration-schema/migration-helpers.js +116 -0
- package/dist/cjs/plugins/migration-schema/migration-helpers.js.map +1 -0
- package/dist/cjs/plugins/migration-schema/migration-types.js +2 -0
- package/dist/cjs/plugins/migration-schema/migration-types.js.map +1 -0
- package/dist/cjs/plugins/migration-schema/rx-migration-state.js +410 -0
- package/dist/cjs/plugins/migration-schema/rx-migration-state.js.map +1 -0
- package/dist/cjs/plugins/migration-storage/index.js +173 -0
- package/dist/cjs/plugins/migration-storage/index.js.map +1 -0
- package/dist/cjs/plugins/pipeline/flagged-functions.js +129 -0
- package/dist/cjs/plugins/pipeline/flagged-functions.js.map +1 -0
- package/dist/cjs/plugins/pipeline/index.js +43 -0
- package/dist/cjs/plugins/pipeline/index.js.map +1 -0
- package/dist/cjs/plugins/pipeline/rx-pipeline.js +219 -0
- package/dist/cjs/plugins/pipeline/rx-pipeline.js.map +1 -0
- package/dist/cjs/plugins/pipeline/types.js +2 -0
- package/dist/cjs/plugins/pipeline/types.js.map +1 -0
- package/dist/cjs/plugins/query-builder/index.js +70 -0
- package/dist/cjs/plugins/query-builder/index.js.map +1 -0
- package/dist/cjs/plugins/query-builder/mquery/mquery-utils.js +40 -0
- package/dist/cjs/plugins/query-builder/mquery/mquery-utils.js.map +1 -0
- package/dist/cjs/plugins/query-builder/mquery/nosql-query-builder.js +488 -0
- package/dist/cjs/plugins/query-builder/mquery/nosql-query-builder.js.map +1 -0
- package/dist/cjs/plugins/react/database-context.js +15 -0
- package/dist/cjs/plugins/react/database-context.js.map +1 -0
- package/dist/cjs/plugins/react/database-provider.js +41 -0
- package/dist/cjs/plugins/react/database-provider.js.map +1 -0
- package/dist/cjs/plugins/react/hooks/index.js +50 -0
- package/dist/cjs/plugins/react/hooks/index.js.map +1 -0
- package/dist/cjs/plugins/react/hooks/use-live-rx-query.js +27 -0
- package/dist/cjs/plugins/react/hooks/use-live-rx-query.js.map +1 -0
- package/dist/cjs/plugins/react/hooks/use-rx-collection.js +39 -0
- package/dist/cjs/plugins/react/hooks/use-rx-collection.js.map +1 -0
- package/dist/cjs/plugins/react/hooks/use-rx-database.js +24 -0
- package/dist/cjs/plugins/react/hooks/use-rx-database.js.map +1 -0
- package/dist/cjs/plugins/react/hooks/use-rx-query.js +99 -0
- package/dist/cjs/plugins/react/hooks/use-rx-query.js.map +1 -0
- package/dist/cjs/plugins/react/index.js +28 -0
- package/dist/cjs/plugins/react/index.js.map +1 -0
- package/dist/cjs/plugins/reactivity-angular/index.js +30 -0
- package/dist/cjs/plugins/reactivity-angular/index.js.map +1 -0
- package/dist/cjs/plugins/reactivity-preact-signals/index.js +67 -0
- package/dist/cjs/plugins/reactivity-preact-signals/index.js.map +1 -0
- package/dist/cjs/plugins/reactivity-vue/index.js +32 -0
- package/dist/cjs/plugins/reactivity-vue/index.js.map +1 -0
- package/dist/cjs/plugins/replication/index.js +487 -0
- package/dist/cjs/plugins/replication/index.js.map +1 -0
- package/dist/cjs/plugins/replication/replication-helper.js +97 -0
- package/dist/cjs/plugins/replication/replication-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-appwrite/appwrite-helpers.js +33 -0
- package/dist/cjs/plugins/replication-appwrite/appwrite-helpers.js.map +1 -0
- package/dist/cjs/plugins/replication-appwrite/appwrite-types.js +2 -0
- package/dist/cjs/plugins/replication-appwrite/appwrite-types.js.map +1 -0
- package/dist/cjs/plugins/replication-appwrite/index.js +176 -0
- package/dist/cjs/plugins/replication-appwrite/index.js.map +1 -0
- package/dist/cjs/plugins/replication-couchdb/couchdb-helper.js +77 -0
- package/dist/cjs/plugins/replication-couchdb/couchdb-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-couchdb/couchdb-types.js +2 -0
- package/dist/cjs/plugins/replication-couchdb/couchdb-types.js.map +1 -0
- package/dist/cjs/plugins/replication-couchdb/index.js +287 -0
- package/dist/cjs/plugins/replication-couchdb/index.js.map +1 -0
- package/dist/cjs/plugins/replication-firestore/firestore-helper.js +61 -0
- package/dist/cjs/plugins/replication-firestore/firestore-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-firestore/firestore-types.js +2 -0
- package/dist/cjs/plugins/replication-firestore/firestore-types.js.map +1 -0
- package/dist/cjs/plugins/replication-firestore/index.js +266 -0
- package/dist/cjs/plugins/replication-firestore/index.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/document-handling.js +150 -0
- package/dist/cjs/plugins/replication-google-drive/document-handling.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/downstream.js +73 -0
- package/dist/cjs/plugins/replication-google-drive/downstream.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/google-drive-helper.js +349 -0
- package/dist/cjs/plugins/replication-google-drive/google-drive-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/google-drive-types.js +2 -0
- package/dist/cjs/plugins/replication-google-drive/google-drive-types.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/index.js +233 -0
- package/dist/cjs/plugins/replication-google-drive/index.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/init.js +76 -0
- package/dist/cjs/plugins/replication-google-drive/init.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/multipart.js +74 -0
- package/dist/cjs/plugins/replication-google-drive/multipart.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/signaling.js +262 -0
- package/dist/cjs/plugins/replication-google-drive/signaling.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/transaction.js +134 -0
- package/dist/cjs/plugins/replication-google-drive/transaction.js.map +1 -0
- package/dist/cjs/plugins/replication-google-drive/upstream.js +182 -0
- package/dist/cjs/plugins/replication-google-drive/upstream.js.map +1 -0
- package/dist/cjs/plugins/replication-graphql/graphql-schema-from-rx-schema.js +235 -0
- package/dist/cjs/plugins/replication-graphql/graphql-schema-from-rx-schema.js.map +1 -0
- package/dist/cjs/plugins/replication-graphql/graphql-websocket.js +43 -0
- package/dist/cjs/plugins/replication-graphql/graphql-websocket.js.map +1 -0
- package/dist/cjs/plugins/replication-graphql/helper.js +29 -0
- package/dist/cjs/plugins/replication-graphql/helper.js.map +1 -0
- package/dist/cjs/plugins/replication-graphql/index.js +215 -0
- package/dist/cjs/plugins/replication-graphql/index.js.map +1 -0
- package/dist/cjs/plugins/replication-graphql/query-builder-from-rx-schema.js +141 -0
- package/dist/cjs/plugins/replication-graphql/query-builder-from-rx-schema.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/document-handling.js +187 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/document-handling.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/downstream.js +78 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/downstream.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/index.js +222 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/index.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/init.js +76 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/init.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.js +273 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.js +2 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/signaling.js +235 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/signaling.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/transaction.js +138 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/transaction.js.map +1 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/upstream.js +190 -0
- package/dist/cjs/plugins/replication-microsoft-onedrive/upstream.js.map +1 -0
- package/dist/cjs/plugins/replication-mongodb/index.js +229 -0
- package/dist/cjs/plugins/replication-mongodb/index.js.map +1 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-checkpoint.js +140 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-checkpoint.js.map +1 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-helper.js +53 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-types.js +2 -0
- package/dist/cjs/plugins/replication-mongodb/mongodb-types.js.map +1 -0
- package/dist/cjs/plugins/replication-nats/index.js +232 -0
- package/dist/cjs/plugins/replication-nats/index.js.map +1 -0
- package/dist/cjs/plugins/replication-nats/nats-helper.js +13 -0
- package/dist/cjs/plugins/replication-nats/nats-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-nats/nats-types.js +2 -0
- package/dist/cjs/plugins/replication-nats/nats-types.js.map +1 -0
- package/dist/cjs/plugins/replication-supabase/helper.js +42 -0
- package/dist/cjs/plugins/replication-supabase/helper.js.map +1 -0
- package/dist/cjs/plugins/replication-supabase/index.js +239 -0
- package/dist/cjs/plugins/replication-supabase/index.js.map +1 -0
- package/dist/cjs/plugins/replication-supabase/types.js +2 -0
- package/dist/cjs/plugins/replication-supabase/types.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-p2pcf.js +79 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-p2pcf.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-simple-peer.js +199 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-simple-peer.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-webtorrent.js +137 -0
- package/dist/cjs/plugins/replication-webrtc/connection-handler-webtorrent.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/index.js +260 -0
- package/dist/cjs/plugins/replication-webrtc/index.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/signaling-server.js +151 -0
- package/dist/cjs/plugins/replication-webrtc/signaling-server.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/webrtc-helper.js +32 -0
- package/dist/cjs/plugins/replication-webrtc/webrtc-helper.js.map +1 -0
- package/dist/cjs/plugins/replication-webrtc/webrtc-types.js +2 -0
- package/dist/cjs/plugins/replication-webrtc/webrtc-types.js.map +1 -0
- package/dist/cjs/plugins/replication-websocket/index.js +39 -0
- package/dist/cjs/plugins/replication-websocket/index.js.map +1 -0
- package/dist/cjs/plugins/replication-websocket/websocket-client.js +133 -0
- package/dist/cjs/plugins/replication-websocket/websocket-client.js.map +1 -0
- package/dist/cjs/plugins/replication-websocket/websocket-server.js +108 -0
- package/dist/cjs/plugins/replication-websocket/websocket-server.js.map +1 -0
- package/dist/cjs/plugins/replication-websocket/websocket-types.js +2 -0
- package/dist/cjs/plugins/replication-websocket/websocket-types.js.map +1 -0
- package/dist/cjs/plugins/state/helpers.js +81 -0
- package/dist/cjs/plugins/state/helpers.js.map +1 -0
- package/dist/cjs/plugins/state/index.js +42 -0
- package/dist/cjs/plugins/state/index.js.map +1 -0
- package/dist/cjs/plugins/state/rx-state.js +293 -0
- package/dist/cjs/plugins/state/rx-state.js.map +1 -0
- package/dist/cjs/plugins/state/types.js +2 -0
- package/dist/cjs/plugins/state/types.js.map +1 -0
- package/dist/cjs/plugins/storage-denokv/denokv-helper.js +49 -0
- package/dist/cjs/plugins/storage-denokv/denokv-helper.js.map +1 -0
- package/dist/cjs/plugins/storage-denokv/denokv-query.js +99 -0
- package/dist/cjs/plugins/storage-denokv/denokv-query.js.map +1 -0
- package/dist/cjs/plugins/storage-denokv/denokv-types.js +2 -0
- package/dist/cjs/plugins/storage-denokv/denokv-types.js.map +1 -0
- package/dist/cjs/plugins/storage-denokv/index.js +31 -0
- package/dist/cjs/plugins/storage-denokv/index.js.map +1 -0
- package/dist/cjs/plugins/storage-denokv/rx-storage-instance-denokv.js +332 -0
- package/dist/cjs/plugins/storage-denokv/rx-storage-instance-denokv.js.map +1 -0
- package/dist/cjs/plugins/storage-dexie/dexie-helper.js +259 -0
- package/dist/cjs/plugins/storage-dexie/dexie-helper.js.map +1 -0
- package/dist/cjs/plugins/storage-dexie/dexie-query.js +178 -0
- package/dist/cjs/plugins/storage-dexie/dexie-query.js.map +1 -0
- package/dist/cjs/plugins/storage-dexie/index.js +50 -0
- package/dist/cjs/plugins/storage-dexie/index.js.map +1 -0
- package/dist/cjs/plugins/storage-dexie/rx-storage-dexie.js +46 -0
- package/dist/cjs/plugins/storage-dexie/rx-storage-dexie.js.map +1 -0
- package/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js +229 -0
- package/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map +1 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-helpers.js +13 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-helpers.js.map +1 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-query.js +96 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-query.js.map +1 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-types.js +2 -0
- package/dist/cjs/plugins/storage-foundationdb/foundationdb-types.js.map +1 -0
- package/dist/cjs/plugins/storage-foundationdb/index.js +62 -0
- package/dist/cjs/plugins/storage-foundationdb/index.js.map +1 -0
- package/dist/cjs/plugins/storage-foundationdb/rx-storage-instance-foundationdb.js +309 -0
- package/dist/cjs/plugins/storage-foundationdb/rx-storage-instance-foundationdb.js.map +1 -0
- package/dist/cjs/plugins/storage-localstorage/index.js +45 -0
- package/dist/cjs/plugins/storage-localstorage/index.js.map +1 -0
- package/dist/cjs/plugins/storage-localstorage/localstorage-mock.js +38 -0
- package/dist/cjs/plugins/storage-localstorage/localstorage-mock.js.map +1 -0
- package/dist/cjs/plugins/storage-localstorage/rx-storage-instance-localstorage.js +443 -0
- package/dist/cjs/plugins/storage-localstorage/rx-storage-instance-localstorage.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/binary-search-bounds.js +113 -0
- package/dist/cjs/plugins/storage-memory/binary-search-bounds.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/index.js +91 -0
- package/dist/cjs/plugins/storage-memory/index.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/memory-helper.js +177 -0
- package/dist/cjs/plugins/storage-memory/memory-helper.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/memory-indexes.js +28 -0
- package/dist/cjs/plugins/storage-memory/memory-indexes.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/memory-types.js +2 -0
- package/dist/cjs/plugins/storage-memory/memory-types.js.map +1 -0
- package/dist/cjs/plugins/storage-memory/rx-storage-instance-memory.js +371 -0
- package/dist/cjs/plugins/storage-memory/rx-storage-instance-memory.js.map +1 -0
- package/dist/cjs/plugins/storage-mongodb/index.js +50 -0
- package/dist/cjs/plugins/storage-mongodb/index.js.map +1 -0
- package/dist/cjs/plugins/storage-mongodb/mongodb-helper.js +97 -0
- package/dist/cjs/plugins/storage-mongodb/mongodb-helper.js.map +1 -0
- package/dist/cjs/plugins/storage-mongodb/mongodb-types.js +2 -0
- package/dist/cjs/plugins/storage-mongodb/mongodb-types.js.map +1 -0
- package/dist/cjs/plugins/storage-mongodb/rx-storage-instance-mongodb.js +324 -0
- package/dist/cjs/plugins/storage-mongodb/rx-storage-instance-mongodb.js.map +1 -0
- package/dist/cjs/plugins/storage-mongodb/rx-storage-mongodb.js +29 -0
- package/dist/cjs/plugins/storage-mongodb/rx-storage-mongodb.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/index.js +61 -0
- package/dist/cjs/plugins/storage-remote/index.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/message-channel-cache.js +52 -0
- package/dist/cjs/plugins/storage-remote/message-channel-cache.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/remote.js +217 -0
- package/dist/cjs/plugins/storage-remote/remote.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/rx-storage-remote.js +199 -0
- package/dist/cjs/plugins/storage-remote/rx-storage-remote.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/storage-remote-helpers.js +25 -0
- package/dist/cjs/plugins/storage-remote/storage-remote-helpers.js.map +1 -0
- package/dist/cjs/plugins/storage-remote/storage-remote-types.js +2 -0
- package/dist/cjs/plugins/storage-remote/storage-remote-types.js.map +1 -0
- package/dist/cjs/plugins/storage-remote-websocket/index.js +183 -0
- package/dist/cjs/plugins/storage-remote-websocket/index.js.map +1 -0
- package/dist/cjs/plugins/storage-remote-websocket/types.js +2 -0
- package/dist/cjs/plugins/storage-remote-websocket/types.js.map +1 -0
- package/dist/cjs/plugins/storage-sqlite/index.js +84 -0
- package/dist/cjs/plugins/storage-sqlite/index.js.map +1 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-basics-helpers.js +530 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-basics-helpers.js.map +1 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-helpers.js +203 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-helpers.js.map +1 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-storage-instance.js +291 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-storage-instance.js.map +1 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-types.js +2 -0
- package/dist/cjs/plugins/storage-sqlite/sqlite-types.js.map +1 -0
- package/dist/cjs/plugins/test-utils/config.js +120 -0
- package/dist/cjs/plugins/test-utils/config.js.map +1 -0
- package/dist/cjs/plugins/test-utils/humans-collection.js +420 -0
- package/dist/cjs/plugins/test-utils/humans-collection.js.map +1 -0
- package/dist/cjs/plugins/test-utils/index.js +130 -0
- package/dist/cjs/plugins/test-utils/index.js.map +1 -0
- package/dist/cjs/plugins/test-utils/performance.js +275 -0
- package/dist/cjs/plugins/test-utils/performance.js.map +1 -0
- package/dist/cjs/plugins/test-utils/replication-base-test-suite.js +179 -0
- package/dist/cjs/plugins/test-utils/replication-base-test-suite.js.map +1 -0
- package/dist/cjs/plugins/test-utils/replication.js +54 -0
- package/dist/cjs/plugins/test-utils/replication.js.map +1 -0
- package/dist/cjs/plugins/test-utils/revisions.js +11 -0
- package/dist/cjs/plugins/test-utils/revisions.js.map +1 -0
- package/dist/cjs/plugins/test-utils/schema-objects.js +315 -0
- package/dist/cjs/plugins/test-utils/schema-objects.js.map +1 -0
- package/dist/cjs/plugins/test-utils/schemas.js +1254 -0
- package/dist/cjs/plugins/test-utils/schemas.js.map +1 -0
- package/dist/cjs/plugins/test-utils/test-util.js +72 -0
- package/dist/cjs/plugins/test-utils/test-util.js.map +1 -0
- package/dist/cjs/plugins/update/index.js +45 -0
- package/dist/cjs/plugins/update/index.js.map +1 -0
- package/dist/cjs/plugins/update/mingo-updater.js +20 -0
- package/dist/cjs/plugins/update/mingo-updater.js.map +1 -0
- package/dist/cjs/plugins/utils/index.js +226 -0
- package/dist/cjs/plugins/utils/index.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-array.js +150 -0
- package/dist/cjs/plugins/utils/utils-array.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-base64.js +57 -0
- package/dist/cjs/plugins/utils/utils-base64.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-blob.js +62 -0
- package/dist/cjs/plugins/utils/utils-blob.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-document.js +100 -0
- package/dist/cjs/plugins/utils/utils-document.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-error.js +42 -0
- package/dist/cjs/plugins/utils/utils-error.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-global.js +12 -0
- package/dist/cjs/plugins/utils/utils-global.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-hash.js +59 -0
- package/dist/cjs/plugins/utils/utils-hash.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-map.js +25 -0
- package/dist/cjs/plugins/utils/utils-map.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-number.js +16 -0
- package/dist/cjs/plugins/utils/utils-number.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-object-deep-equal.js +42 -0
- package/dist/cjs/plugins/utils/utils-object-deep-equal.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-object-dot-prop.js +306 -0
- package/dist/cjs/plugins/utils/utils-object-dot-prop.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-object.js +245 -0
- package/dist/cjs/plugins/utils/utils-object.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-other.js +69 -0
- package/dist/cjs/plugins/utils/utils-other.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-premium.js +37 -0
- package/dist/cjs/plugins/utils/utils-premium.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-promise.js +149 -0
- package/dist/cjs/plugins/utils/utils-promise.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-regex.js +9 -0
- package/dist/cjs/plugins/utils/utils-regex.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-revision.js +60 -0
- package/dist/cjs/plugins/utils/utils-revision.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-rxdb-version.js +11 -0
- package/dist/cjs/plugins/utils/utils-rxdb-version.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-rxdb-version.template.js +11 -0
- package/dist/cjs/plugins/utils/utils-rxdb-version.template.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-string.js +97 -0
- package/dist/cjs/plugins/utils/utils-string.js.map +1 -0
- package/dist/cjs/plugins/utils/utils-time.js +42 -0
- package/dist/cjs/plugins/utils/utils-time.js.map +1 -0
- package/dist/cjs/plugins/validate-ajv/index.js +53 -0
- package/dist/cjs/plugins/validate-ajv/index.js.map +1 -0
- package/dist/cjs/plugins/validate-is-my-json-valid/index.js +29 -0
- package/dist/cjs/plugins/validate-is-my-json-valid/index.js.map +1 -0
- package/dist/cjs/plugins/validate-z-schema/index.js +58 -0
- package/dist/cjs/plugins/validate-z-schema/index.js.map +1 -0
- package/dist/cjs/plugins/vector/helper.js +2 -0
- package/dist/cjs/plugins/vector/helper.js.map +1 -0
- package/dist/cjs/plugins/vector/index.js +17 -0
- package/dist/cjs/plugins/vector/index.js.map +1 -0
- package/dist/cjs/plugins/vector/types.js +2 -0
- package/dist/cjs/plugins/vector/types.js.map +1 -0
- package/dist/cjs/plugins/vector/vector-distance.js +38 -0
- package/dist/cjs/plugins/vector/vector-distance.js.map +1 -0
- package/dist/cjs/plugins/webmcp/index.js +28 -0
- package/dist/cjs/plugins/webmcp/index.js.map +1 -0
- package/dist/cjs/plugins/webmcp/nosql-query-schema.js +360 -0
- package/dist/cjs/plugins/webmcp/nosql-query-schema.js.map +1 -0
- package/dist/cjs/plugins/webmcp/webmcp.js +315 -0
- package/dist/cjs/plugins/webmcp/webmcp.js.map +1 -0
- package/dist/cjs/query-cache.js +110 -0
- package/dist/cjs/query-cache.js.map +1 -0
- package/dist/cjs/query-planner.js +307 -0
- package/dist/cjs/query-planner.js.map +1 -0
- package/dist/cjs/replication-protocol/checkpoint.js +103 -0
- package/dist/cjs/replication-protocol/checkpoint.js.map +1 -0
- package/dist/cjs/replication-protocol/conflicts.js +36 -0
- package/dist/cjs/replication-protocol/conflicts.js.map +1 -0
- package/dist/cjs/replication-protocol/default-conflict-handler.js +39 -0
- package/dist/cjs/replication-protocol/default-conflict-handler.js.map +1 -0
- package/dist/cjs/replication-protocol/downstream.js +339 -0
- package/dist/cjs/replication-protocol/downstream.js.map +1 -0
- package/dist/cjs/replication-protocol/helper.js +58 -0
- package/dist/cjs/replication-protocol/helper.js.map +1 -0
- package/dist/cjs/replication-protocol/index.js +314 -0
- package/dist/cjs/replication-protocol/index.js.map +1 -0
- package/dist/cjs/replication-protocol/meta-instance.js +130 -0
- package/dist/cjs/replication-protocol/meta-instance.js.map +1 -0
- package/dist/cjs/replication-protocol/upstream.js +384 -0
- package/dist/cjs/replication-protocol/upstream.js.map +1 -0
- package/dist/cjs/rx-change-event.js +112 -0
- package/dist/cjs/rx-change-event.js.map +1 -0
- package/dist/cjs/rx-collection-helper.js +205 -0
- package/dist/cjs/rx-collection-helper.js.map +1 -0
- package/dist/cjs/rx-collection.js +931 -0
- package/dist/cjs/rx-collection.js.map +1 -0
- package/dist/cjs/rx-database-internal-store.js +283 -0
- package/dist/cjs/rx-database-internal-store.js.map +1 -0
- package/dist/cjs/rx-database.js +682 -0
- package/dist/cjs/rx-database.js.map +1 -0
- package/dist/cjs/rx-document-prototype-merge.js +87 -0
- package/dist/cjs/rx-document-prototype-merge.js.map +1 -0
- package/dist/cjs/rx-document.js +404 -0
- package/dist/cjs/rx-document.js.map +1 -0
- package/dist/cjs/rx-error.js +167 -0
- package/dist/cjs/rx-error.js.map +1 -0
- package/dist/cjs/rx-query-helper.js +277 -0
- package/dist/cjs/rx-query-helper.js.map +1 -0
- package/dist/cjs/rx-query-mingo.js +60 -0
- package/dist/cjs/rx-query-mingo.js.map +1 -0
- package/dist/cjs/rx-query-single-result.js +105 -0
- package/dist/cjs/rx-query-single-result.js.map +1 -0
- package/dist/cjs/rx-query.js +703 -0
- package/dist/cjs/rx-query.js.map +1 -0
- package/dist/cjs/rx-schema-helper.js +333 -0
- package/dist/cjs/rx-schema-helper.js.map +1 -0
- package/dist/cjs/rx-schema.js +189 -0
- package/dist/cjs/rx-schema.js.map +1 -0
- package/dist/cjs/rx-storage-helper.js +808 -0
- package/dist/cjs/rx-storage-helper.js.map +1 -0
- package/dist/cjs/rx-storage-multiinstance.js +121 -0
- package/dist/cjs/rx-storage-multiinstance.js.map +1 -0
- package/dist/cjs/types/conflict-handling.d.js +2 -0
- package/dist/cjs/types/conflict-handling.d.js.map +1 -0
- package/dist/cjs/types/couchdb.d.js +2 -0
- package/dist/cjs/types/couchdb.d.js.map +1 -0
- package/dist/cjs/types/index.d.js +2 -0
- package/dist/cjs/types/index.d.js.map +1 -0
- package/dist/cjs/types/modules/index.d.js +2 -0
- package/dist/cjs/types/modules/index.d.js.map +1 -0
- package/dist/cjs/types/modules/mocha.parallel.d.js +2 -0
- package/dist/cjs/types/modules/mocha.parallel.d.js.map +1 -0
- package/dist/cjs/types/plugins/backup.d.js +2 -0
- package/dist/cjs/types/plugins/backup.d.js.map +1 -0
- package/dist/cjs/types/plugins/cleanup.d.js +2 -0
- package/dist/cjs/types/plugins/cleanup.d.js.map +1 -0
- package/dist/cjs/types/plugins/crdt.d.js +2 -0
- package/dist/cjs/types/plugins/crdt.d.js.map +1 -0
- package/dist/cjs/types/plugins/dexie.d.js +2 -0
- package/dist/cjs/types/plugins/dexie.d.js.map +1 -0
- package/dist/cjs/types/plugins/local-documents.d.js +2 -0
- package/dist/cjs/types/plugins/local-documents.d.js.map +1 -0
- package/dist/cjs/types/plugins/migration.d.js +2 -0
- package/dist/cjs/types/plugins/migration.d.js.map +1 -0
- package/dist/cjs/types/plugins/reactivity.d.js +2 -0
- package/dist/cjs/types/plugins/reactivity.d.js.map +1 -0
- package/dist/cjs/types/plugins/replication-graphql.d.js +2 -0
- package/dist/cjs/types/plugins/replication-graphql.d.js.map +1 -0
- package/dist/cjs/types/plugins/replication.d.js +2 -0
- package/dist/cjs/types/plugins/replication.d.js.map +1 -0
- package/dist/cjs/types/plugins/state.d.js +2 -0
- package/dist/cjs/types/plugins/state.d.js.map +1 -0
- package/dist/cjs/types/plugins/update.d.js +2 -0
- package/dist/cjs/types/plugins/update.d.js.map +1 -0
- package/dist/cjs/types/plugins/webmcp.d.js +2 -0
- package/dist/cjs/types/plugins/webmcp.d.js.map +1 -0
- package/dist/cjs/types/query-planner.d.js +2 -0
- package/dist/cjs/types/query-planner.d.js.map +1 -0
- package/dist/cjs/types/replication-protocol.d.js +2 -0
- package/dist/cjs/types/replication-protocol.d.js.map +1 -0
- package/dist/cjs/types/rx-attachment.d.js +2 -0
- package/dist/cjs/types/rx-attachment.d.js.map +1 -0
- package/dist/cjs/types/rx-change-event.d.js +2 -0
- package/dist/cjs/types/rx-change-event.d.js.map +1 -0
- package/dist/cjs/types/rx-collection.d.js +2 -0
- package/dist/cjs/types/rx-collection.d.js.map +1 -0
- package/dist/cjs/types/rx-database-internal-store.d.js +2 -0
- package/dist/cjs/types/rx-database-internal-store.d.js.map +1 -0
- package/dist/cjs/types/rx-database.d.js +2 -0
- package/dist/cjs/types/rx-database.d.js.map +1 -0
- package/dist/cjs/types/rx-document.d.js +2 -0
- package/dist/cjs/types/rx-document.d.js.map +1 -0
- package/dist/cjs/types/rx-error.d.js +2 -0
- package/dist/cjs/types/rx-error.d.js.map +1 -0
- package/dist/cjs/types/rx-plugin.d.js +2 -0
- package/dist/cjs/types/rx-plugin.d.js.map +1 -0
- package/dist/cjs/types/rx-query.d.js +2 -0
- package/dist/cjs/types/rx-query.d.js.map +1 -0
- package/dist/cjs/types/rx-schema.d.js +2 -0
- package/dist/cjs/types/rx-schema.d.js.map +1 -0
- package/dist/cjs/types/rx-storage.d.js +2 -0
- package/dist/cjs/types/rx-storage.d.js.map +1 -0
- package/dist/cjs/types/rx-storage.interface.d.js +2 -0
- package/dist/cjs/types/rx-storage.interface.d.js.map +1 -0
- package/dist/cjs/types/util.d.js +2 -0
- package/dist/cjs/types/util.d.js.map +1 -0
- package/dist/esm/change-event-buffer.js +141 -0
- package/dist/esm/change-event-buffer.js.map +1 -0
- package/dist/esm/custom-index.js +271 -0
- package/dist/esm/custom-index.js.map +1 -0
- package/dist/esm/doc-cache.js +227 -0
- package/dist/esm/doc-cache.js.map +1 -0
- package/dist/esm/event-reduce.js +93 -0
- package/dist/esm/event-reduce.js.map +1 -0
- package/dist/esm/hooks.js +122 -0
- package/dist/esm/hooks.js.map +1 -0
- package/dist/esm/incremental-write.js +161 -0
- package/dist/esm/incremental-write.js.map +1 -0
- package/dist/esm/index.js +30 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/overwritable.js +33 -0
- package/dist/esm/overwritable.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/plugin-helpers.js +217 -0
- package/dist/esm/plugin-helpers.js.map +1 -0
- package/dist/esm/plugin.js +88 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/plugins/attachments/attachments-utils.js +41 -0
- package/dist/esm/plugins/attachments/attachments-utils.js.map +1 -0
- package/dist/esm/plugins/attachments/index.js +202 -0
- package/dist/esm/plugins/attachments/index.js.map +1 -0
- package/dist/esm/plugins/attachments-compression/index.js +134 -0
- package/dist/esm/plugins/attachments-compression/index.js.map +1 -0
- package/dist/esm/plugins/backup/file-util.js +87 -0
- package/dist/esm/plugins/backup/file-util.js.map +1 -0
- package/dist/esm/plugins/backup/index.js +183 -0
- package/dist/esm/plugins/backup/index.js.map +1 -0
- package/dist/esm/plugins/cleanup/cleanup-helper.js +11 -0
- package/dist/esm/plugins/cleanup/cleanup-helper.js.map +1 -0
- package/dist/esm/plugins/cleanup/cleanup-state.js +75 -0
- package/dist/esm/plugins/cleanup/cleanup-state.js.map +1 -0
- package/dist/esm/plugins/cleanup/cleanup.js +108 -0
- package/dist/esm/plugins/cleanup/cleanup.js.map +1 -0
- package/dist/esm/plugins/cleanup/index.js +35 -0
- package/dist/esm/plugins/cleanup/index.js.map +1 -0
- package/dist/esm/plugins/crdt/index.js +378 -0
- package/dist/esm/plugins/crdt/index.js.map +1 -0
- package/dist/esm/plugins/dev-mode/check-document.js +150 -0
- package/dist/esm/plugins/dev-mode/check-document.js.map +1 -0
- package/dist/esm/plugins/dev-mode/check-migration-strategies.js +38 -0
- package/dist/esm/plugins/dev-mode/check-migration-strategies.js.map +1 -0
- package/dist/esm/plugins/dev-mode/check-orm.js +47 -0
- package/dist/esm/plugins/dev-mode/check-orm.js.map +1 -0
- package/dist/esm/plugins/dev-mode/check-query.js +174 -0
- package/dist/esm/plugins/dev-mode/check-query.js.map +1 -0
- package/dist/esm/plugins/dev-mode/check-schema.js +478 -0
- package/dist/esm/plugins/dev-mode/check-schema.js.map +1 -0
- package/dist/esm/plugins/dev-mode/dev-mode-tracking.js +87 -0
- package/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map +1 -0
- package/dist/esm/plugins/dev-mode/entity-properties.js +49 -0
- package/dist/esm/plugins/dev-mode/entity-properties.js.map +1 -0
- package/dist/esm/plugins/dev-mode/error-messages.js +1289 -0
- package/dist/esm/plugins/dev-mode/error-messages.js.map +1 -0
- package/dist/esm/plugins/dev-mode/index.js +151 -0
- package/dist/esm/plugins/dev-mode/index.js.map +1 -0
- package/dist/esm/plugins/dev-mode/unallowed-properties.js +81 -0
- package/dist/esm/plugins/dev-mode/unallowed-properties.js.map +1 -0
- package/dist/esm/plugins/electron/electron-helper.js +3 -0
- package/dist/esm/plugins/electron/electron-helper.js.map +1 -0
- package/dist/esm/plugins/electron/index.js +4 -0
- package/dist/esm/plugins/electron/index.js.map +1 -0
- package/dist/esm/plugins/electron/rx-storage-ipc-main.js +39 -0
- package/dist/esm/plugins/electron/rx-storage-ipc-main.js.map +1 -0
- package/dist/esm/plugins/electron/rx-storage-ipc-renderer.js +31 -0
- package/dist/esm/plugins/electron/rx-storage-ipc-renderer.js.map +1 -0
- package/dist/esm/plugins/encryption-crypto-js/index.js +154 -0
- package/dist/esm/plugins/encryption-crypto-js/index.js.map +1 -0
- package/dist/esm/plugins/flutter/index.js +55 -0
- package/dist/esm/plugins/flutter/index.js.map +1 -0
- package/dist/esm/plugins/json-dump/index.js +87 -0
- package/dist/esm/plugins/json-dump/index.js.map +1 -0
- package/dist/esm/plugins/key-compression/index.js +127 -0
- package/dist/esm/plugins/key-compression/index.js.map +1 -0
- package/dist/esm/plugins/leader-election/index.js +95 -0
- package/dist/esm/plugins/leader-election/index.js.map +1 -0
- package/dist/esm/plugins/local-documents/index.js +70 -0
- package/dist/esm/plugins/local-documents/index.js.map +1 -0
- package/dist/esm/plugins/local-documents/local-documents-helper.js +67 -0
- package/dist/esm/plugins/local-documents/local-documents-helper.js.map +1 -0
- package/dist/esm/plugins/local-documents/local-documents.js +99 -0
- package/dist/esm/plugins/local-documents/local-documents.js.map +1 -0
- package/dist/esm/plugins/local-documents/rx-local-document.js +248 -0
- package/dist/esm/plugins/local-documents/rx-local-document.js.map +1 -0
- package/dist/esm/plugins/migration-schema/index.js +42 -0
- package/dist/esm/plugins/migration-schema/index.js.map +1 -0
- package/dist/esm/plugins/migration-schema/migration-helpers.js +103 -0
- package/dist/esm/plugins/migration-schema/migration-helpers.js.map +1 -0
- package/dist/esm/plugins/migration-schema/migration-types.js +3 -0
- package/dist/esm/plugins/migration-schema/migration-types.js.map +1 -0
- package/dist/esm/plugins/migration-schema/rx-migration-state.js +404 -0
- package/dist/esm/plugins/migration-schema/rx-migration-state.js.map +1 -0
- package/dist/esm/plugins/migration-storage/index.js +166 -0
- package/dist/esm/plugins/migration-storage/index.js.map +1 -0
- package/dist/esm/plugins/pipeline/flagged-functions.js +122 -0
- package/dist/esm/plugins/pipeline/flagged-functions.js.map +1 -0
- package/dist/esm/plugins/pipeline/index.js +13 -0
- package/dist/esm/plugins/pipeline/index.js.map +1 -0
- package/dist/esm/plugins/pipeline/rx-pipeline.js +210 -0
- package/dist/esm/plugins/pipeline/rx-pipeline.js.map +1 -0
- package/dist/esm/plugins/pipeline/types.js +3 -0
- package/dist/esm/plugins/pipeline/types.js.map +1 -0
- package/dist/esm/plugins/query-builder/index.js +48 -0
- package/dist/esm/plugins/query-builder/index.js.map +1 -0
- package/dist/esm/plugins/query-builder/mquery/mquery-utils.js +33 -0
- package/dist/esm/plugins/query-builder/mquery/mquery-utils.js.map +1 -0
- package/dist/esm/plugins/query-builder/mquery/nosql-query-builder.js +478 -0
- package/dist/esm/plugins/query-builder/mquery/nosql-query-builder.js.map +1 -0
- package/dist/esm/plugins/react/database-context.js +8 -0
- package/dist/esm/plugins/react/database-context.js.map +1 -0
- package/dist/esm/plugins/react/database-provider.js +34 -0
- package/dist/esm/plugins/react/database-provider.js.map +1 -0
- package/dist/esm/plugins/react/hooks/index.js +5 -0
- package/dist/esm/plugins/react/hooks/index.js.map +1 -0
- package/dist/esm/plugins/react/hooks/use-live-rx-query.js +22 -0
- package/dist/esm/plugins/react/hooks/use-live-rx-query.js.map +1 -0
- package/dist/esm/plugins/react/hooks/use-rx-collection.js +34 -0
- package/dist/esm/plugins/react/hooks/use-rx-collection.js.map +1 -0
- package/dist/esm/plugins/react/hooks/use-rx-database.js +19 -0
- package/dist/esm/plugins/react/hooks/use-rx-database.js.map +1 -0
- package/dist/esm/plugins/react/hooks/use-rx-query.js +92 -0
- package/dist/esm/plugins/react/hooks/use-rx-query.js.map +1 -0
- package/dist/esm/plugins/react/index.js +3 -0
- package/dist/esm/plugins/react/index.js.map +1 -0
- package/dist/esm/plugins/reactivity-angular/index.js +25 -0
- package/dist/esm/plugins/reactivity-angular/index.js.map +1 -0
- package/dist/esm/plugins/reactivity-preact-signals/index.js +62 -0
- package/dist/esm/plugins/reactivity-preact-signals/index.js.map +1 -0
- package/dist/esm/plugins/reactivity-vue/index.js +27 -0
- package/dist/esm/plugins/reactivity-vue/index.js.map +1 -0
- package/dist/esm/plugins/replication/index.js +479 -0
- package/dist/esm/plugins/replication/index.js.map +1 -0
- package/dist/esm/plugins/replication/replication-helper.js +86 -0
- package/dist/esm/plugins/replication/replication-helper.js.map +1 -0
- package/dist/esm/plugins/replication-appwrite/appwrite-helpers.js +26 -0
- package/dist/esm/plugins/replication-appwrite/appwrite-helpers.js.map +1 -0
- package/dist/esm/plugins/replication-appwrite/appwrite-types.js +3 -0
- package/dist/esm/plugins/replication-appwrite/appwrite-types.js.map +1 -0
- package/dist/esm/plugins/replication-appwrite/index.js +168 -0
- package/dist/esm/plugins/replication-appwrite/index.js.map +1 -0
- package/dist/esm/plugins/replication-couchdb/couchdb-helper.js +65 -0
- package/dist/esm/plugins/replication-couchdb/couchdb-helper.js.map +1 -0
- package/dist/esm/plugins/replication-couchdb/couchdb-types.js +3 -0
- package/dist/esm/plugins/replication-couchdb/couchdb-types.js.map +1 -0
- package/dist/esm/plugins/replication-couchdb/index.js +254 -0
- package/dist/esm/plugins/replication-couchdb/index.js.map +1 -0
- package/dist/esm/plugins/replication-firestore/firestore-helper.js +49 -0
- package/dist/esm/plugins/replication-firestore/firestore-helper.js.map +1 -0
- package/dist/esm/plugins/replication-firestore/firestore-types.js +3 -0
- package/dist/esm/plugins/replication-firestore/firestore-types.js.map +1 -0
- package/dist/esm/plugins/replication-firestore/index.js +233 -0
- package/dist/esm/plugins/replication-firestore/index.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/document-handling.js +140 -0
- package/dist/esm/plugins/replication-google-drive/document-handling.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/downstream.js +66 -0
- package/dist/esm/plugins/replication-google-drive/downstream.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/google-drive-helper.js +331 -0
- package/dist/esm/plugins/replication-google-drive/google-drive-helper.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/google-drive-types.js +3 -0
- package/dist/esm/plugins/replication-google-drive/google-drive-types.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/index.js +126 -0
- package/dist/esm/plugins/replication-google-drive/index.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/init.js +70 -0
- package/dist/esm/plugins/replication-google-drive/init.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/multipart.js +67 -0
- package/dist/esm/plugins/replication-google-drive/multipart.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/signaling.js +253 -0
- package/dist/esm/plugins/replication-google-drive/signaling.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/transaction.js +123 -0
- package/dist/esm/plugins/replication-google-drive/transaction.js.map +1 -0
- package/dist/esm/plugins/replication-google-drive/upstream.js +171 -0
- package/dist/esm/plugins/replication-google-drive/upstream.js.map +1 -0
- package/dist/esm/plugins/replication-graphql/graphql-schema-from-rx-schema.js +228 -0
- package/dist/esm/plugins/replication-graphql/graphql-schema-from-rx-schema.js.map +1 -0
- package/dist/esm/plugins/replication-graphql/graphql-websocket.js +35 -0
- package/dist/esm/plugins/replication-graphql/graphql-websocket.js.map +1 -0
- package/dist/esm/plugins/replication-graphql/helper.js +21 -0
- package/dist/esm/plugins/replication-graphql/helper.js.map +1 -0
- package/dist/esm/plugins/replication-graphql/index.js +161 -0
- package/dist/esm/plugins/replication-graphql/index.js.map +1 -0
- package/dist/esm/plugins/replication-graphql/query-builder-from-rx-schema.js +133 -0
- package/dist/esm/plugins/replication-graphql/query-builder-from-rx-schema.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/document-handling.js +178 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/document-handling.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/downstream.js +71 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/downstream.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/index.js +126 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/index.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/init.js +70 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/init.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.js +258 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.js +3 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/signaling.js +226 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/signaling.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/transaction.js +127 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/transaction.js.map +1 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/upstream.js +179 -0
- package/dist/esm/plugins/replication-microsoft-onedrive/upstream.js.map +1 -0
- package/dist/esm/plugins/replication-mongodb/index.js +197 -0
- package/dist/esm/plugins/replication-mongodb/index.js.map +1 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-checkpoint.js +131 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-checkpoint.js.map +1 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-helper.js +45 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-helper.js.map +1 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-types.js +3 -0
- package/dist/esm/plugins/replication-mongodb/mongodb-types.js.map +1 -0
- package/dist/esm/plugins/replication-nats/index.js +199 -0
- package/dist/esm/plugins/replication-nats/index.js.map +1 -0
- package/dist/esm/plugins/replication-nats/nats-helper.js +7 -0
- package/dist/esm/plugins/replication-nats/nats-helper.js.map +1 -0
- package/dist/esm/plugins/replication-nats/nats-types.js +3 -0
- package/dist/esm/plugins/replication-nats/nats-types.js.map +1 -0
- package/dist/esm/plugins/replication-supabase/helper.js +35 -0
- package/dist/esm/plugins/replication-supabase/helper.js.map +1 -0
- package/dist/esm/plugins/replication-supabase/index.js +231 -0
- package/dist/esm/plugins/replication-supabase/index.js.map +1 -0
- package/dist/esm/plugins/replication-supabase/types.js +3 -0
- package/dist/esm/plugins/replication-supabase/types.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-p2pcf.js +78 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-p2pcf.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-simple-peer.js +192 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-simple-peer.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-webtorrent.js +136 -0
- package/dist/esm/plugins/replication-webrtc/connection-handler-webtorrent.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/index.js +207 -0
- package/dist/esm/plugins/replication-webrtc/index.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/signaling-server.js +144 -0
- package/dist/esm/plugins/replication-webrtc/signaling-server.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/webrtc-helper.js +26 -0
- package/dist/esm/plugins/replication-webrtc/webrtc-helper.js.map +1 -0
- package/dist/esm/plugins/replication-webrtc/webrtc-types.js +3 -0
- package/dist/esm/plugins/replication-webrtc/webrtc-types.js.map +1 -0
- package/dist/esm/plugins/replication-websocket/index.js +4 -0
- package/dist/esm/plugins/replication-websocket/index.js.map +1 -0
- package/dist/esm/plugins/replication-websocket/websocket-client.js +125 -0
- package/dist/esm/plugins/replication-websocket/websocket-client.js.map +1 -0
- package/dist/esm/plugins/replication-websocket/websocket-server.js +100 -0
- package/dist/esm/plugins/replication-websocket/websocket-server.js.map +1 -0
- package/dist/esm/plugins/replication-websocket/websocket-types.js +3 -0
- package/dist/esm/plugins/replication-websocket/websocket-types.js.map +1 -0
- package/dist/esm/plugins/state/helpers.js +73 -0
- package/dist/esm/plugins/state/helpers.js.map +1 -0
- package/dist/esm/plugins/state/index.js +20 -0
- package/dist/esm/plugins/state/index.js.map +1 -0
- package/dist/esm/plugins/state/rx-state.js +285 -0
- package/dist/esm/plugins/state/rx-state.js.map +1 -0
- package/dist/esm/plugins/state/types.js +3 -0
- package/dist/esm/plugins/state/types.js.map +1 -0
- package/dist/esm/plugins/storage-denokv/denokv-helper.js +40 -0
- package/dist/esm/plugins/storage-denokv/denokv-helper.js.map +1 -0
- package/dist/esm/plugins/storage-denokv/denokv-query.js +93 -0
- package/dist/esm/plugins/storage-denokv/denokv-query.js.map +1 -0
- package/dist/esm/plugins/storage-denokv/denokv-types.js +3 -0
- package/dist/esm/plugins/storage-denokv/denokv-types.js.map +1 -0
- package/dist/esm/plugins/storage-denokv/index.js +24 -0
- package/dist/esm/plugins/storage-denokv/index.js.map +1 -0
- package/dist/esm/plugins/storage-denokv/rx-storage-instance-denokv.js +325 -0
- package/dist/esm/plugins/storage-denokv/rx-storage-instance-denokv.js.map +1 -0
- package/dist/esm/plugins/storage-dexie/dexie-helper.js +241 -0
- package/dist/esm/plugins/storage-dexie/dexie-helper.js.map +1 -0
- package/dist/esm/plugins/storage-dexie/dexie-query.js +169 -0
- package/dist/esm/plugins/storage-dexie/dexie-query.js.map +1 -0
- package/dist/esm/plugins/storage-dexie/index.js +5 -0
- package/dist/esm/plugins/storage-dexie/index.js.map +1 -0
- package/dist/esm/plugins/storage-dexie/rx-storage-dexie.js +39 -0
- package/dist/esm/plugins/storage-dexie/rx-storage-dexie.js.map +1 -0
- package/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js +222 -0
- package/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map +1 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-helpers.js +6 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-helpers.js.map +1 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-query.js +90 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-query.js.map +1 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-types.js +3 -0
- package/dist/esm/plugins/storage-foundationdb/foundationdb-types.js.map +1 -0
- package/dist/esm/plugins/storage-foundationdb/index.js +31 -0
- package/dist/esm/plugins/storage-foundationdb/index.js.map +1 -0
- package/dist/esm/plugins/storage-foundationdb/rx-storage-instance-foundationdb.js +302 -0
- package/dist/esm/plugins/storage-foundationdb/rx-storage-instance-foundationdb.js.map +1 -0
- package/dist/esm/plugins/storage-localstorage/index.js +23 -0
- package/dist/esm/plugins/storage-localstorage/index.js.map +1 -0
- package/dist/esm/plugins/storage-localstorage/localstorage-mock.js +33 -0
- package/dist/esm/plugins/storage-localstorage/localstorage-mock.js.map +1 -0
- package/dist/esm/plugins/storage-localstorage/rx-storage-instance-localstorage.js +432 -0
- package/dist/esm/plugins/storage-localstorage/rx-storage-instance-localstorage.js.map +1 -0
- package/dist/esm/plugins/storage-memory/binary-search-bounds.js +103 -0
- package/dist/esm/plugins/storage-memory/binary-search-bounds.js.map +1 -0
- package/dist/esm/plugins/storage-memory/index.js +29 -0
- package/dist/esm/plugins/storage-memory/index.js.map +1 -0
- package/dist/esm/plugins/storage-memory/memory-helper.js +165 -0
- package/dist/esm/plugins/storage-memory/memory-helper.js.map +1 -0
- package/dist/esm/plugins/storage-memory/memory-indexes.js +21 -0
- package/dist/esm/plugins/storage-memory/memory-indexes.js.map +1 -0
- package/dist/esm/plugins/storage-memory/memory-types.js +3 -0
- package/dist/esm/plugins/storage-memory/memory-types.js.map +1 -0
- package/dist/esm/plugins/storage-memory/rx-storage-instance-memory.js +364 -0
- package/dist/esm/plugins/storage-memory/rx-storage-instance-memory.js.map +1 -0
- package/dist/esm/plugins/storage-mongodb/index.js +5 -0
- package/dist/esm/plugins/storage-mongodb/index.js.map +1 -0
- package/dist/esm/plugins/storage-mongodb/mongodb-helper.js +85 -0
- package/dist/esm/plugins/storage-mongodb/mongodb-helper.js.map +1 -0
- package/dist/esm/plugins/storage-mongodb/mongodb-types.js +3 -0
- package/dist/esm/plugins/storage-mongodb/mongodb-types.js.map +1 -0
- package/dist/esm/plugins/storage-mongodb/rx-storage-instance-mongodb.js +316 -0
- package/dist/esm/plugins/storage-mongodb/rx-storage-instance-mongodb.js.map +1 -0
- package/dist/esm/plugins/storage-mongodb/rx-storage-mongodb.js +22 -0
- package/dist/esm/plugins/storage-mongodb/rx-storage-mongodb.js.map +1 -0
- package/dist/esm/plugins/storage-remote/index.js +6 -0
- package/dist/esm/plugins/storage-remote/index.js.map +1 -0
- package/dist/esm/plugins/storage-remote/message-channel-cache.js +44 -0
- package/dist/esm/plugins/storage-remote/message-channel-cache.js.map +1 -0
- package/dist/esm/plugins/storage-remote/remote.js +212 -0
- package/dist/esm/plugins/storage-remote/remote.js.map +1 -0
- package/dist/esm/plugins/storage-remote/rx-storage-remote.js +193 -0
- package/dist/esm/plugins/storage-remote/rx-storage-remote.js.map +1 -0
- package/dist/esm/plugins/storage-remote/storage-remote-helpers.js +18 -0
- package/dist/esm/plugins/storage-remote/storage-remote-helpers.js.map +1 -0
- package/dist/esm/plugins/storage-remote/storage-remote-types.js +3 -0
- package/dist/esm/plugins/storage-remote/storage-remote-types.js.map +1 -0
- package/dist/esm/plugins/storage-remote-websocket/index.js +161 -0
- package/dist/esm/plugins/storage-remote-websocket/index.js.map +1 -0
- package/dist/esm/plugins/storage-remote-websocket/types.js +3 -0
- package/dist/esm/plugins/storage-remote-websocket/types.js.map +1 -0
- package/dist/esm/plugins/storage-sqlite/index.js +31 -0
- package/dist/esm/plugins/storage-sqlite/index.js.map +1 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-basics-helpers.js +510 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-basics-helpers.js.map +1 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-helpers.js +187 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-helpers.js.map +1 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-storage-instance.js +283 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-storage-instance.js.map +1 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-types.js +3 -0
- package/dist/esm/plugins/storage-sqlite/sqlite-types.js.map +1 -0
- package/dist/esm/plugins/test-utils/config.js +104 -0
- package/dist/esm/plugins/test-utils/config.js.map +1 -0
- package/dist/esm/plugins/test-utils/humans-collection.js +397 -0
- package/dist/esm/plugins/test-utils/humans-collection.js.map +1 -0
- package/dist/esm/plugins/test-utils/index.js +22 -0
- package/dist/esm/plugins/test-utils/index.js.map +1 -0
- package/dist/esm/plugins/test-utils/performance.js +267 -0
- package/dist/esm/plugins/test-utils/performance.js.map +1 -0
- package/dist/esm/plugins/test-utils/replication-base-test-suite.js +170 -0
- package/dist/esm/plugins/test-utils/replication-base-test-suite.js.map +1 -0
- package/dist/esm/plugins/test-utils/replication.js +46 -0
- package/dist/esm/plugins/test-utils/replication.js.map +1 -0
- package/dist/esm/plugins/test-utils/revisions.js +5 -0
- package/dist/esm/plugins/test-utils/revisions.js.map +1 -0
- package/dist/esm/plugins/test-utils/schema-objects.js +283 -0
- package/dist/esm/plugins/test-utils/schema-objects.js.map +1 -0
- package/dist/esm/plugins/test-utils/schemas.js +1244 -0
- package/dist/esm/plugins/test-utils/schemas.js.map +1 -0
- package/dist/esm/plugins/test-utils/test-util.js +62 -0
- package/dist/esm/plugins/test-utils/test-util.js.map +1 -0
- package/dist/esm/plugins/update/index.js +35 -0
- package/dist/esm/plugins/update/index.js.map +1 -0
- package/dist/esm/plugins/update/mingo-updater.js +13 -0
- package/dist/esm/plugins/update/mingo-updater.js.map +1 -0
- package/dist/esm/plugins/utils/index.js +21 -0
- package/dist/esm/plugins/utils/index.js.map +1 -0
- package/dist/esm/plugins/utils/utils-array.js +130 -0
- package/dist/esm/plugins/utils/utils-array.js.map +1 -0
- package/dist/esm/plugins/utils/utils-base64.js +48 -0
- package/dist/esm/plugins/utils/utils-base64.js.map +1 -0
- package/dist/esm/plugins/utils/utils-blob.js +54 -0
- package/dist/esm/plugins/utils/utils-blob.js.map +1 -0
- package/dist/esm/plugins/utils/utils-document.js +87 -0
- package/dist/esm/plugins/utils/utils-document.js.map +1 -0
- package/dist/esm/plugins/utils/utils-error.js +36 -0
- package/dist/esm/plugins/utils/utils-error.js.map +1 -0
- package/dist/esm/plugins/utils/utils-global.js +6 -0
- package/dist/esm/plugins/utils/utils-global.js.map +1 -0
- package/dist/esm/plugins/utils/utils-hash.js +51 -0
- package/dist/esm/plugins/utils/utils-hash.js.map +1 -0
- package/dist/esm/plugins/utils/utils-map.js +18 -0
- package/dist/esm/plugins/utils/utils-map.js.map +1 -0
- package/dist/esm/plugins/utils/utils-number.js +10 -0
- package/dist/esm/plugins/utils/utils-number.js.map +1 -0
- package/dist/esm/plugins/utils/utils-object-deep-equal.js +36 -0
- package/dist/esm/plugins/utils/utils-object-deep-equal.js.map +1 -0
- package/dist/esm/plugins/utils/utils-object-dot-prop.js +296 -0
- package/dist/esm/plugins/utils/utils-object-dot-prop.js.map +1 -0
- package/dist/esm/plugins/utils/utils-object.js +228 -0
- package/dist/esm/plugins/utils/utils-object.js.map +1 -0
- package/dist/esm/plugins/utils/utils-other.js +58 -0
- package/dist/esm/plugins/utils/utils-other.js.map +1 -0
- package/dist/esm/plugins/utils/utils-premium.js +30 -0
- package/dist/esm/plugins/utils/utils-premium.js.map +1 -0
- package/dist/esm/plugins/utils/utils-promise.js +134 -0
- package/dist/esm/plugins/utils/utils-promise.js.map +1 -0
- package/dist/esm/plugins/utils/utils-regex.js +3 -0
- package/dist/esm/plugins/utils/utils-regex.js.map +1 -0
- package/dist/esm/plugins/utils/utils-revision.js +53 -0
- package/dist/esm/plugins/utils/utils-revision.js.map +1 -0
- package/dist/esm/plugins/utils/utils-rxdb-version.js +5 -0
- package/dist/esm/plugins/utils/utils-rxdb-version.js.map +1 -0
- package/dist/esm/plugins/utils/utils-rxdb-version.template.js +5 -0
- package/dist/esm/plugins/utils/utils-rxdb-version.template.js.map +1 -0
- package/dist/esm/plugins/utils/utils-string.js +83 -0
- package/dist/esm/plugins/utils/utils-string.js.map +1 -0
- package/dist/esm/plugins/utils/utils-time.js +36 -0
- package/dist/esm/plugins/utils/utils-time.js.map +1 -0
- package/dist/esm/plugins/validate-ajv/index.js +43 -0
- package/dist/esm/plugins/validate-ajv/index.js.map +1 -0
- package/dist/esm/plugins/validate-is-my-json-valid/index.js +20 -0
- package/dist/esm/plugins/validate-is-my-json-valid/index.js.map +1 -0
- package/dist/esm/plugins/validate-z-schema/index.js +47 -0
- package/dist/esm/plugins/validate-z-schema/index.js.map +1 -0
- package/dist/esm/plugins/vector/helper.js +2 -0
- package/dist/esm/plugins/vector/helper.js.map +1 -0
- package/dist/esm/plugins/vector/index.js +2 -0
- package/dist/esm/plugins/vector/index.js.map +1 -0
- package/dist/esm/plugins/vector/types.js +3 -0
- package/dist/esm/plugins/vector/types.js.map +1 -0
- package/dist/esm/plugins/vector/vector-distance.js +29 -0
- package/dist/esm/plugins/vector/vector-distance.js.map +1 -0
- package/dist/esm/plugins/webmcp/index.js +3 -0
- package/dist/esm/plugins/webmcp/index.js.map +1 -0
- package/dist/esm/plugins/webmcp/nosql-query-schema.js +354 -0
- package/dist/esm/plugins/webmcp/nosql-query-schema.js.map +1 -0
- package/dist/esm/plugins/webmcp/webmcp.js +307 -0
- package/dist/esm/plugins/webmcp/webmcp.js.map +1 -0
- package/dist/esm/query-cache.js +99 -0
- package/dist/esm/query-cache.js.map +1 -0
- package/dist/esm/query-planner.js +297 -0
- package/dist/esm/query-planner.js.map +1 -0
- package/dist/esm/replication-protocol/checkpoint.js +95 -0
- package/dist/esm/replication-protocol/checkpoint.js.map +1 -0
- package/dist/esm/replication-protocol/conflicts.js +31 -0
- package/dist/esm/replication-protocol/conflicts.js.map +1 -0
- package/dist/esm/replication-protocol/default-conflict-handler.js +33 -0
- package/dist/esm/replication-protocol/default-conflict-handler.js.map +1 -0
- package/dist/esm/replication-protocol/downstream.js +334 -0
- package/dist/esm/replication-protocol/downstream.js.map +1 -0
- package/dist/esm/replication-protocol/helper.js +49 -0
- package/dist/esm/replication-protocol/helper.js.map +1 -0
- package/dist/esm/replication-protocol/index.js +221 -0
- package/dist/esm/replication-protocol/index.js.map +1 -0
- package/dist/esm/replication-protocol/meta-instance.js +121 -0
- package/dist/esm/replication-protocol/meta-instance.js.map +1 -0
- package/dist/esm/replication-protocol/upstream.js +379 -0
- package/dist/esm/replication-protocol/upstream.js.map +1 -0
- package/dist/esm/rx-change-event.js +103 -0
- package/dist/esm/rx-change-event.js.map +1 -0
- package/dist/esm/rx-collection-helper.js +196 -0
- package/dist/esm/rx-collection-helper.js.map +1 -0
- package/dist/esm/rx-collection.js +923 -0
- package/dist/esm/rx-collection.js.map +1 -0
- package/dist/esm/rx-database-internal-store.js +270 -0
- package/dist/esm/rx-database-internal-store.js.map +1 -0
- package/dist/esm/rx-database.js +670 -0
- package/dist/esm/rx-database.js.map +1 -0
- package/dist/esm/rx-document-prototype-merge.js +78 -0
- package/dist/esm/rx-document-prototype-merge.js.map +1 -0
- package/dist/esm/rx-document.js +394 -0
- package/dist/esm/rx-document.js.map +1 -0
- package/dist/esm/rx-error.js +153 -0
- package/dist/esm/rx-error.js.map +1 -0
- package/dist/esm/rx-query-helper.js +268 -0
- package/dist/esm/rx-query-helper.js.map +1 -0
- package/dist/esm/rx-query-mingo.js +54 -0
- package/dist/esm/rx-query-mingo.js.map +1 -0
- package/dist/esm/rx-query-single-result.js +98 -0
- package/dist/esm/rx-query-single-result.js.map +1 -0
- package/dist/esm/rx-query.js +690 -0
- package/dist/esm/rx-query.js.map +1 -0
- package/dist/esm/rx-schema-helper.js +316 -0
- package/dist/esm/rx-schema-helper.js.map +1 -0
- package/dist/esm/rx-schema.js +177 -0
- package/dist/esm/rx-schema.js.map +1 -0
- package/dist/esm/rx-storage-helper.js +785 -0
- package/dist/esm/rx-storage-helper.js.map +1 -0
- package/dist/esm/rx-storage-multiinstance.js +113 -0
- package/dist/esm/rx-storage-multiinstance.js.map +1 -0
- package/dist/esm/types/conflict-handling.d.js +3 -0
- package/dist/esm/types/conflict-handling.d.js.map +1 -0
- package/dist/esm/types/couchdb.d.js +3 -0
- package/dist/esm/types/couchdb.d.js.map +1 -0
- package/dist/esm/types/index.d.js +2 -0
- package/dist/esm/types/index.d.js.map +1 -0
- package/dist/esm/types/modules/index.d.js +2 -0
- package/dist/esm/types/modules/index.d.js.map +1 -0
- package/dist/esm/types/modules/mocha.parallel.d.js +2 -0
- package/dist/esm/types/modules/mocha.parallel.d.js.map +1 -0
- package/dist/esm/types/plugins/backup.d.js +3 -0
- package/dist/esm/types/plugins/backup.d.js.map +1 -0
- package/dist/esm/types/plugins/cleanup.d.js +3 -0
- package/dist/esm/types/plugins/cleanup.d.js.map +1 -0
- package/dist/esm/types/plugins/crdt.d.js +3 -0
- package/dist/esm/types/plugins/crdt.d.js.map +1 -0
- package/dist/esm/types/plugins/dexie.d.js +3 -0
- package/dist/esm/types/plugins/dexie.d.js.map +1 -0
- package/dist/esm/types/plugins/local-documents.d.js +3 -0
- package/dist/esm/types/plugins/local-documents.d.js.map +1 -0
- package/dist/esm/types/plugins/migration.d.js +3 -0
- package/dist/esm/types/plugins/migration.d.js.map +1 -0
- package/dist/esm/types/plugins/reactivity.d.js +3 -0
- package/dist/esm/types/plugins/reactivity.d.js.map +1 -0
- package/dist/esm/types/plugins/replication-graphql.d.js +3 -0
- package/dist/esm/types/plugins/replication-graphql.d.js.map +1 -0
- package/dist/esm/types/plugins/replication.d.js +3 -0
- package/dist/esm/types/plugins/replication.d.js.map +1 -0
- package/dist/esm/types/plugins/state.d.js +3 -0
- package/dist/esm/types/plugins/state.d.js.map +1 -0
- package/dist/esm/types/plugins/update.d.js +3 -0
- package/dist/esm/types/plugins/update.d.js.map +1 -0
- package/dist/esm/types/plugins/webmcp.d.js +3 -0
- package/dist/esm/types/plugins/webmcp.d.js.map +1 -0
- package/dist/esm/types/query-planner.d.js +3 -0
- package/dist/esm/types/query-planner.d.js.map +1 -0
- package/dist/esm/types/replication-protocol.d.js +3 -0
- package/dist/esm/types/replication-protocol.d.js.map +1 -0
- package/dist/esm/types/rx-attachment.d.js +3 -0
- package/dist/esm/types/rx-attachment.d.js.map +1 -0
- package/dist/esm/types/rx-change-event.d.js +3 -0
- package/dist/esm/types/rx-change-event.d.js.map +1 -0
- package/dist/esm/types/rx-collection.d.js +3 -0
- package/dist/esm/types/rx-collection.d.js.map +1 -0
- package/dist/esm/types/rx-database-internal-store.d.js +3 -0
- package/dist/esm/types/rx-database-internal-store.d.js.map +1 -0
- package/dist/esm/types/rx-database.d.js +3 -0
- package/dist/esm/types/rx-database.d.js.map +1 -0
- package/dist/esm/types/rx-document.d.js +3 -0
- package/dist/esm/types/rx-document.d.js.map +1 -0
- package/dist/esm/types/rx-error.d.js +3 -0
- package/dist/esm/types/rx-error.d.js.map +1 -0
- package/dist/esm/types/rx-plugin.d.js +3 -0
- package/dist/esm/types/rx-plugin.d.js.map +1 -0
- package/dist/esm/types/rx-query.d.js +3 -0
- package/dist/esm/types/rx-query.d.js.map +1 -0
- package/dist/esm/types/rx-schema.d.js +3 -0
- package/dist/esm/types/rx-schema.d.js.map +1 -0
- package/dist/esm/types/rx-storage.d.js +3 -0
- package/dist/esm/types/rx-storage.d.js.map +1 -0
- package/dist/esm/types/rx-storage.interface.d.js +3 -0
- package/dist/esm/types/rx-storage.interface.d.js.map +1 -0
- package/dist/esm/types/util.d.js +3 -0
- package/dist/esm/types/util.d.js.map +1 -0
- package/dist/types/change-event-buffer.d.ts +50 -0
- package/dist/types/custom-index.d.ts +58 -0
- package/dist/types/doc-cache.d.ts +96 -0
- package/dist/types/event-reduce.d.ts +15 -0
- package/dist/types/hooks.d.ts +109 -0
- package/dist/types/incremental-write.d.ts +29 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/overwritable.d.ts +26 -0
- package/dist/types/plugin-helpers.d.ts +30 -0
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/plugins/attachments/attachments-utils.d.ts +10 -0
- package/dist/types/plugins/attachments/index.d.ts +42 -0
- package/dist/types/plugins/attachments-compression/index.d.ts +38 -0
- package/dist/types/plugins/backup/file-util.d.ts +17 -0
- package/dist/types/plugins/backup/index.d.ts +37 -0
- package/dist/types/plugins/cleanup/cleanup-helper.d.ts +2 -0
- package/dist/types/plugins/cleanup/cleanup-state.d.ts +7 -0
- package/dist/types/plugins/cleanup/cleanup.d.ts +8 -0
- package/dist/types/plugins/cleanup/index.d.ts +4 -0
- package/dist/types/plugins/crdt/index.d.ts +12 -0
- package/dist/types/plugins/dev-mode/check-document.d.ts +9 -0
- package/dist/types/plugins/dev-mode/check-migration-strategies.d.ts +6 -0
- package/dist/types/plugins/dev-mode/check-orm.d.ts +7 -0
- package/dist/types/plugins/dev-mode/check-query.d.ts +21 -0
- package/dist/types/plugins/dev-mode/check-schema.d.ts +18 -0
- package/dist/types/plugins/dev-mode/dev-mode-tracking.d.ts +4 -0
- package/dist/types/plugins/dev-mode/entity-properties.d.ts +3 -0
- package/dist/types/plugins/dev-mode/error-messages.d.ts +1230 -0
- package/dist/types/plugins/dev-mode/index.d.ts +19 -0
- package/dist/types/plugins/dev-mode/unallowed-properties.d.ts +20 -0
- package/dist/types/plugins/electron/electron-helper.d.ts +2 -0
- package/dist/types/plugins/electron/index.d.ts +3 -0
- package/dist/types/plugins/electron/rx-storage-ipc-main.d.ts +10 -0
- package/dist/types/plugins/electron/rx-storage-ipc-renderer.d.ts +13 -0
- package/dist/types/plugins/encryption-crypto-js/index.d.ts +10 -0
- package/dist/types/plugins/flutter/index.d.ts +11 -0
- package/dist/types/plugins/json-dump/index.d.ts +2 -0
- package/dist/types/plugins/key-compression/index.d.ts +18 -0
- package/dist/types/plugins/leader-election/index.d.ts +25 -0
- package/dist/types/plugins/local-documents/index.d.ts +6 -0
- package/dist/types/plugins/local-documents/local-documents-helper.d.ts +9 -0
- package/dist/types/plugins/local-documents/local-documents.d.ts +14 -0
- package/dist/types/plugins/local-documents/rx-local-document.d.ts +11 -0
- package/dist/types/plugins/migration-schema/index.d.ts +8 -0
- package/dist/types/plugins/migration-schema/migration-helpers.d.ts +29 -0
- package/dist/types/plugins/migration-schema/migration-types.d.ts +33 -0
- package/dist/types/plugins/migration-schema/rx-migration-state.d.ts +50 -0
- package/dist/types/plugins/migration-storage/index.d.ts +32 -0
- package/dist/types/plugins/pipeline/flagged-functions.d.ts +69 -0
- package/dist/types/plugins/pipeline/index.d.ts +5 -0
- package/dist/types/plugins/pipeline/rx-pipeline.d.ts +37 -0
- package/dist/types/plugins/pipeline/types.d.ts +17 -0
- package/dist/types/plugins/query-builder/index.d.ts +5 -0
- package/dist/types/plugins/query-builder/mquery/mquery-utils.d.ts +12 -0
- package/dist/types/plugins/query-builder/mquery/nosql-query-builder.d.ts +165 -0
- package/dist/types/plugins/react/database-context.d.ts +4 -0
- package/dist/types/plugins/react/database-provider.d.ts +24 -0
- package/dist/types/plugins/react/hooks/index.d.ts +4 -0
- package/dist/types/plugins/react/hooks/use-live-rx-query.d.ts +11 -0
- package/dist/types/plugins/react/hooks/use-rx-collection.d.ts +10 -0
- package/dist/types/plugins/react/hooks/use-rx-database.d.ts +9 -0
- package/dist/types/plugins/react/hooks/use-rx-query.d.ts +24 -0
- package/dist/types/plugins/react/index.d.ts +2 -0
- package/dist/types/plugins/reactivity-angular/index.d.ts +16 -0
- package/dist/types/plugins/reactivity-preact-signals/index.d.ts +27 -0
- package/dist/types/plugins/reactivity-vue/index.d.ts +17 -0
- package/dist/types/plugins/replication/index.d.ts +84 -0
- package/dist/types/plugins/replication/replication-helper.d.ts +23 -0
- package/dist/types/plugins/replication-appwrite/appwrite-helpers.d.ts +3 -0
- package/dist/types/plugins/replication-appwrite/appwrite-types.d.ts +16 -0
- package/dist/types/plugins/replication-appwrite/index.d.ts +14 -0
- package/dist/types/plugins/replication-couchdb/couchdb-helper.d.ts +19 -0
- package/dist/types/plugins/replication-couchdb/couchdb-types.d.ts +22 -0
- package/dist/types/plugins/replication-couchdb/index.d.ts +18 -0
- package/dist/types/plugins/replication-firestore/firestore-helper.d.ts +10 -0
- package/dist/types/plugins/replication-firestore/firestore-types.d.ts +46 -0
- package/dist/types/plugins/replication-firestore/index.d.ts +17 -0
- package/dist/types/plugins/replication-google-drive/document-handling.d.ts +13 -0
- package/dist/types/plugins/replication-google-drive/downstream.d.ts +10 -0
- package/dist/types/plugins/replication-google-drive/google-drive-helper.d.ts +35 -0
- package/dist/types/plugins/replication-google-drive/google-drive-types.d.ts +67 -0
- package/dist/types/plugins/replication-google-drive/index.d.ts +39 -0
- package/dist/types/plugins/replication-google-drive/init.d.ts +29 -0
- package/dist/types/plugins/replication-google-drive/multipart.d.ts +10 -0
- package/dist/types/plugins/replication-google-drive/signaling.d.ts +41 -0
- package/dist/types/plugins/replication-google-drive/transaction.d.ts +22 -0
- package/dist/types/plugins/replication-google-drive/upstream.d.ts +24 -0
- package/dist/types/plugins/replication-graphql/graphql-schema-from-rx-schema.d.ts +51 -0
- package/dist/types/plugins/replication-graphql/graphql-websocket.d.ts +12 -0
- package/dist/types/plugins/replication-graphql/helper.d.ts +15 -0
- package/dist/types/plugins/replication-graphql/index.d.ts +26 -0
- package/dist/types/plugins/replication-graphql/query-builder-from-rx-schema.d.ts +5 -0
- package/dist/types/plugins/replication-microsoft-onedrive/document-handling.d.ts +14 -0
- package/dist/types/plugins/replication-microsoft-onedrive/downstream.d.ts +10 -0
- package/dist/types/plugins/replication-microsoft-onedrive/index.d.ts +38 -0
- package/dist/types/plugins/replication-microsoft-onedrive/init.d.ts +29 -0
- package/dist/types/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.d.ts +30 -0
- package/dist/types/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.d.ts +71 -0
- package/dist/types/plugins/replication-microsoft-onedrive/signaling.d.ts +41 -0
- package/dist/types/plugins/replication-microsoft-onedrive/transaction.d.ts +22 -0
- package/dist/types/plugins/replication-microsoft-onedrive/upstream.d.ts +25 -0
- package/dist/types/plugins/replication-mongodb/index.d.ts +22 -0
- package/dist/types/plugins/replication-mongodb/mongodb-checkpoint.d.ts +15 -0
- package/dist/types/plugins/replication-mongodb/mongodb-helper.d.ts +13 -0
- package/dist/types/plugins/replication-mongodb/mongodb-types.d.ts +33 -0
- package/dist/types/plugins/replication-nats/index.d.ts +16 -0
- package/dist/types/plugins/replication-nats/nats-helper.d.ts +2 -0
- package/dist/types/plugins/replication-nats/nats-types.d.ts +21 -0
- package/dist/types/plugins/replication-supabase/helper.d.ts +5 -0
- package/dist/types/plugins/replication-supabase/index.d.ts +14 -0
- package/dist/types/plugins/replication-supabase/types.d.ts +28 -0
- package/dist/types/plugins/replication-webrtc/connection-handler-p2pcf.d.ts +0 -0
- package/dist/types/plugins/replication-webrtc/connection-handler-simple-peer.d.ts +57 -0
- package/dist/types/plugins/replication-webrtc/connection-handler-webtorrent.d.ts +0 -0
- package/dist/types/plugins/replication-webrtc/index.d.ts +27 -0
- package/dist/types/plugins/replication-webrtc/signaling-server.d.ts +17 -0
- package/dist/types/plugins/replication-webrtc/webrtc-helper.d.ts +16 -0
- package/dist/types/plugins/replication-webrtc/webrtc-types.d.ts +51 -0
- package/dist/types/plugins/replication-websocket/index.d.ts +3 -0
- package/dist/types/plugins/replication-websocket/websocket-client.d.ts +13 -0
- package/dist/types/plugins/replication-websocket/websocket-server.d.ts +6 -0
- package/dist/types/plugins/replication-websocket/websocket-types.d.ts +32 -0
- package/dist/types/plugins/state/helpers.d.ts +10 -0
- package/dist/types/plugins/state/index.d.ts +4 -0
- package/dist/types/plugins/state/rx-state.d.ts +46 -0
- package/dist/types/plugins/state/types.d.ts +28 -0
- package/dist/types/plugins/storage-denokv/denokv-helper.d.ts +16 -0
- package/dist/types/plugins/storage-denokv/denokv-query.d.ts +3 -0
- package/dist/types/plugins/storage-denokv/denokv-types.d.ts +17 -0
- package/dist/types/plugins/storage-denokv/index.d.ts +11 -0
- package/dist/types/plugins/storage-denokv/rx-storage-instance-denokv.d.ts +41 -0
- package/dist/types/plugins/storage-dexie/dexie-helper.d.ts +40 -0
- package/dist/types/plugins/storage-dexie/dexie-query.d.ts +9 -0
- package/dist/types/plugins/storage-dexie/index.d.ts +4 -0
- package/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts +11 -0
- package/dist/types/plugins/storage-dexie/rx-storage-instance-dexie.d.ts +29 -0
- package/dist/types/plugins/storage-foundationdb/foundationdb-helpers.d.ts +3 -0
- package/dist/types/plugins/storage-foundationdb/foundationdb-query.d.ts +3 -0
- package/dist/types/plugins/storage-foundationdb/foundationdb-types.d.ts +46 -0
- package/dist/types/plugins/storage-foundationdb/index.d.ts +4 -0
- package/dist/types/plugins/storage-foundationdb/rx-storage-instance-foundationdb.d.ts +26 -0
- package/dist/types/plugins/storage-localstorage/index.d.ts +11 -0
- package/dist/types/plugins/storage-localstorage/localstorage-mock.d.ts +1 -0
- package/dist/types/plugins/storage-localstorage/rx-storage-instance-localstorage.d.ts +84 -0
- package/dist/types/plugins/storage-memory/binary-search-bounds.d.ts +14 -0
- package/dist/types/plugins/storage-memory/index.d.ts +7 -0
- package/dist/types/plugins/storage-memory/memory-helper.d.ts +22 -0
- package/dist/types/plugins/storage-memory/memory-indexes.d.ts +4 -0
- package/dist/types/plugins/storage-memory/memory-types.d.ts +72 -0
- package/dist/types/plugins/storage-memory/rx-storage-instance-memory.d.ts +47 -0
- package/dist/types/plugins/storage-mongodb/index.d.ts +4 -0
- package/dist/types/plugins/storage-mongodb/mongodb-helper.d.ts +22 -0
- package/dist/types/plugins/storage-mongodb/mongodb-types.d.ts +21 -0
- package/dist/types/plugins/storage-mongodb/rx-storage-instance-mongodb.d.ts +52 -0
- package/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts +11 -0
- package/dist/types/plugins/storage-remote/index.d.ts +5 -0
- package/dist/types/plugins/storage-remote/message-channel-cache.d.ts +13 -0
- package/dist/types/plugins/storage-remote/remote.d.ts +6 -0
- package/dist/types/plugins/storage-remote/rx-storage-remote.d.ts +43 -0
- package/dist/types/plugins/storage-remote/storage-remote-helpers.d.ts +4 -0
- package/dist/types/plugins/storage-remote/storage-remote-types.d.ts +88 -0
- package/dist/types/plugins/storage-remote-websocket/index.d.ts +4 -0
- package/dist/types/plugins/storage-remote-websocket/types.d.ts +24 -0
- package/dist/types/plugins/storage-sqlite/index.d.ts +15 -0
- package/dist/types/plugins/storage-sqlite/sqlite-basics-helpers.d.ts +53 -0
- package/dist/types/plugins/storage-sqlite/sqlite-helpers.d.ts +48 -0
- package/dist/types/plugins/storage-sqlite/sqlite-storage-instance.d.ts +38 -0
- package/dist/types/plugins/storage-sqlite/sqlite-types.d.ts +116 -0
- package/dist/types/plugins/test-utils/config.d.ts +16 -0
- package/dist/types/plugins/test-utils/humans-collection.d.ts +26 -0
- package/dist/types/plugins/test-utils/index.d.ts +20 -0
- package/dist/types/plugins/test-utils/performance.d.ts +68 -0
- package/dist/types/plugins/test-utils/replication-base-test-suite.d.ts +66 -0
- package/dist/types/plugins/test-utils/replication.d.ts +10 -0
- package/dist/types/plugins/test-utils/revisions.d.ts +4 -0
- package/dist/types/plugins/test-utils/schema-objects.d.ts +219 -0
- package/dist/types/plugins/test-utils/schemas.d.ts +356 -0
- package/dist/types/plugins/test-utils/test-util.d.ts +10 -0
- package/dist/types/plugins/update/index.d.ts +5 -0
- package/dist/types/plugins/update/mingo-updater.d.ts +2 -0
- package/dist/types/plugins/utils/index.d.ts +20 -0
- package/dist/types/plugins/utils/utils-array.d.ts +40 -0
- package/dist/types/plugins/utils/utils-base64.d.ts +15 -0
- package/dist/types/plugins/utils/utils-blob.d.ts +12 -0
- package/dist/types/plugins/utils/utils-document.d.ts +26 -0
- package/dist/types/plugins/utils/utils-error.d.ts +8 -0
- package/dist/types/plugins/utils/utils-global.d.ts +5 -0
- package/dist/types/plugins/utils/utils-hash.d.ts +4 -0
- package/dist/types/plugins/utils/utils-map.d.ts +2 -0
- package/dist/types/plugins/utils/utils-number.d.ts +7 -0
- package/dist/types/plugins/utils/utils-object-deep-equal.d.ts +7 -0
- package/dist/types/plugins/utils/utils-object-dot-prop.d.ts +14 -0
- package/dist/types/plugins/utils/utils-object.d.ts +61 -0
- package/dist/types/plugins/utils/utils-other.d.ts +20 -0
- package/dist/types/plugins/utils/utils-premium.d.ts +10 -0
- package/dist/types/plugins/utils/utils-promise.d.ts +43 -0
- package/dist/types/plugins/utils/utils-regex.d.ts +2 -0
- package/dist/types/plugins/utils/utils-revision.d.ts +22 -0
- package/dist/types/plugins/utils/utils-rxdb-version.d.ts +4 -0
- package/dist/types/plugins/utils/utils-rxdb-version.template.d.ts +4 -0
- package/dist/types/plugins/utils/utils-string.d.ts +35 -0
- package/dist/types/plugins/utils/utils-time.d.ts +5 -0
- package/dist/types/plugins/validate-ajv/index.d.ts +13 -0
- package/dist/types/plugins/validate-is-my-json-valid/index.d.ts +5 -0
- package/dist/types/plugins/validate-z-schema/index.d.ts +13 -0
- package/dist/types/plugins/vector/helper.d.ts +0 -0
- package/dist/types/plugins/vector/index.d.ts +2 -0
- package/dist/types/plugins/vector/types.d.ts +1 -0
- package/dist/types/plugins/vector/vector-distance.d.ts +13 -0
- package/dist/types/plugins/webmcp/index.d.ts +2 -0
- package/dist/types/plugins/webmcp/nosql-query-schema.d.ts +549 -0
- package/dist/types/plugins/webmcp/webmcp.d.ts +12 -0
- package/dist/types/query-cache.d.ts +35 -0
- package/dist/types/query-planner.d.ts +30 -0
- package/dist/types/replication-protocol/checkpoint.d.ts +8 -0
- package/dist/types/replication-protocol/conflicts.d.ts +10 -0
- package/dist/types/replication-protocol/default-conflict-handler.d.ts +2 -0
- package/dist/types/replication-protocol/downstream.d.ts +10 -0
- package/dist/types/replication-protocol/helper.d.ts +5 -0
- package/dist/types/replication-protocol/index.d.ts +30 -0
- package/dist/types/replication-protocol/meta-instance.d.ts +12 -0
- package/dist/types/replication-protocol/upstream.d.ts +10 -0
- package/dist/types/rx-change-event.d.ts +20 -0
- package/dist/types/rx-collection-helper.d.ts +41 -0
- package/dist/types/rx-collection.d.ts +185 -0
- package/dist/types/rx-database-internal-store.d.ts +37 -0
- package/dist/types/rx-database.d.ts +213 -0
- package/dist/types/rx-document-prototype-merge.d.ts +24 -0
- package/dist/types/rx-document.d.ts +274 -0
- package/dist/types/rx-error.d.ts +37 -0
- package/dist/types/rx-query-helper.d.ts +31 -0
- package/dist/types/rx-query-mingo.d.ts +10 -0
- package/dist/types/rx-query-single-result.d.ts +31 -0
- package/dist/types/rx-query.d.ts +153 -0
- package/dist/types/rx-schema-helper.d.ts +57 -0
- package/dist/types/rx-schema.d.ts +43 -0
- package/dist/types/rx-storage-helper.d.ts +111 -0
- package/dist/types/rx-storage-multiinstance.d.ts +51 -0
- package/dist/types/types/conflict-handling.d.ts +48 -0
- package/dist/types/types/couchdb.d.ts +293 -0
- package/dist/types/types/index.d.ts +32 -0
- package/dist/types/types/modules/index.d.ts +0 -0
- package/dist/types/types/modules/mocha.parallel.d.ts +1 -0
- package/dist/types/types/plugins/backup.d.ts +35 -0
- package/dist/types/types/plugins/cleanup.d.ts +38 -0
- package/dist/types/types/plugins/crdt.d.ts +76 -0
- package/dist/types/types/plugins/dexie.d.ts +30 -0
- package/dist/types/types/plugins/local-documents.d.ts +49 -0
- package/dist/types/types/plugins/migration.d.ts +14 -0
- package/dist/types/types/plugins/reactivity.d.ts +40 -0
- package/dist/types/types/plugins/replication-graphql.d.ts +98 -0
- package/dist/types/types/plugins/replication.d.ts +175 -0
- package/dist/types/types/plugins/state.d.ts +4 -0
- package/dist/types/types/plugins/update.d.ts +23 -0
- package/dist/types/types/plugins/webmcp.d.ts +40 -0
- package/dist/types/types/query-planner.d.ts +47 -0
- package/dist/types/types/replication-protocol.d.ts +296 -0
- package/dist/types/types/rx-attachment.d.ts +46 -0
- package/dist/types/types/rx-change-event.d.ts +85 -0
- package/dist/types/types/rx-collection.d.ts +117 -0
- package/dist/types/types/rx-database-internal-store.d.ts +54 -0
- package/dist/types/types/rx-database.d.ts +124 -0
- package/dist/types/types/rx-document.d.ts +160 -0
- package/dist/types/types/rx-error.d.ts +222 -0
- package/dist/types/types/rx-plugin.d.ts +167 -0
- package/dist/types/types/rx-query.d.ts +144 -0
- package/dist/types/types/rx-schema.d.ts +209 -0
- package/dist/types/types/rx-storage.d.ts +347 -0
- package/dist/types/types/rx-storage.interface.d.ts +312 -0
- package/dist/types/types/util.d.ts +180 -0
- package/eslint.config.mjs +514 -0
- package/package.json +729 -0
- package/plugins/attachments/index.cjs +2 -0
- package/plugins/attachments/index.d.cts +1 -0
- package/plugins/attachments/index.d.mts +1 -0
- package/plugins/attachments/index.mjs +1 -0
- package/plugins/attachments/index.ts +1 -0
- package/plugins/attachments/package.json +18 -0
- package/plugins/attachments-compression/index.cjs +2 -0
- package/plugins/attachments-compression/index.d.cts +1 -0
- package/plugins/attachments-compression/index.d.mts +1 -0
- package/plugins/attachments-compression/index.mjs +1 -0
- package/plugins/attachments-compression/index.ts +1 -0
- package/plugins/attachments-compression/package.json +18 -0
- package/plugins/backup/index.cjs +2 -0
- package/plugins/backup/index.d.cts +1 -0
- package/plugins/backup/index.d.mts +1 -0
- package/plugins/backup/index.mjs +1 -0
- package/plugins/backup/index.ts +1 -0
- package/plugins/backup/package.json +18 -0
- package/plugins/cleanup/index.cjs +2 -0
- package/plugins/cleanup/index.d.cts +1 -0
- package/plugins/cleanup/index.d.mts +1 -0
- package/plugins/cleanup/index.mjs +1 -0
- package/plugins/cleanup/index.ts +1 -0
- package/plugins/cleanup/package.json +18 -0
- package/plugins/core/index.cjs +2 -0
- package/plugins/core/index.d.cts +1 -0
- package/plugins/core/index.d.mts +1 -0
- package/plugins/core/index.mjs +1 -0
- package/plugins/core/index.ts +1 -0
- package/plugins/core/package.json +18 -0
- package/plugins/crdt/index.cjs +2 -0
- package/plugins/crdt/index.d.cts +1 -0
- package/plugins/crdt/index.d.mts +1 -0
- package/plugins/crdt/index.mjs +1 -0
- package/plugins/crdt/index.ts +1 -0
- package/plugins/crdt/package.json +18 -0
- package/plugins/dev-mode/index.cjs +2 -0
- package/plugins/dev-mode/index.d.cts +1 -0
- package/plugins/dev-mode/index.d.mts +1 -0
- package/plugins/dev-mode/index.mjs +1 -0
- package/plugins/dev-mode/index.ts +1 -0
- package/plugins/dev-mode/package.json +18 -0
- package/plugins/electron/index.cjs +2 -0
- package/plugins/electron/index.d.cts +1 -0
- package/plugins/electron/index.d.mts +1 -0
- package/plugins/electron/index.mjs +1 -0
- package/plugins/electron/index.ts +1 -0
- package/plugins/electron/package.json +18 -0
- package/plugins/encryption-crypto-js/index.cjs +2 -0
- package/plugins/encryption-crypto-js/index.d.cts +1 -0
- package/plugins/encryption-crypto-js/index.d.mts +1 -0
- package/plugins/encryption-crypto-js/index.mjs +1 -0
- package/plugins/encryption-crypto-js/index.ts +1 -0
- package/plugins/encryption-crypto-js/package.json +18 -0
- package/plugins/flutter/index.cjs +2 -0
- package/plugins/flutter/index.d.cts +1 -0
- package/plugins/flutter/index.d.mts +1 -0
- package/plugins/flutter/index.mjs +1 -0
- package/plugins/flutter/index.ts +1 -0
- package/plugins/flutter/package.json +18 -0
- package/plugins/json-dump/index.cjs +2 -0
- package/plugins/json-dump/index.d.cts +1 -0
- package/plugins/json-dump/index.d.mts +1 -0
- package/plugins/json-dump/index.mjs +1 -0
- package/plugins/json-dump/index.ts +1 -0
- package/plugins/json-dump/package.json +18 -0
- package/plugins/key-compression/index.cjs +2 -0
- package/plugins/key-compression/index.d.cts +1 -0
- package/plugins/key-compression/index.d.mts +1 -0
- package/plugins/key-compression/index.mjs +1 -0
- package/plugins/key-compression/index.ts +1 -0
- package/plugins/key-compression/package.json +18 -0
- package/plugins/leader-election/index.cjs +2 -0
- package/plugins/leader-election/index.d.cts +1 -0
- package/plugins/leader-election/index.d.mts +1 -0
- package/plugins/leader-election/index.mjs +1 -0
- package/plugins/leader-election/index.ts +1 -0
- package/plugins/leader-election/package.json +18 -0
- package/plugins/local-documents/index.cjs +2 -0
- package/plugins/local-documents/index.d.cts +1 -0
- package/plugins/local-documents/index.d.mts +1 -0
- package/plugins/local-documents/index.mjs +1 -0
- package/plugins/local-documents/index.ts +1 -0
- package/plugins/local-documents/package.json +18 -0
- package/plugins/migration-schema/index.cjs +2 -0
- package/plugins/migration-schema/index.d.cts +1 -0
- package/plugins/migration-schema/index.d.mts +1 -0
- package/plugins/migration-schema/index.mjs +1 -0
- package/plugins/migration-schema/index.ts +1 -0
- package/plugins/migration-schema/package.json +18 -0
- package/plugins/migration-storage/index.cjs +2 -0
- package/plugins/migration-storage/index.d.cts +1 -0
- package/plugins/migration-storage/index.d.mts +1 -0
- package/plugins/migration-storage/index.mjs +1 -0
- package/plugins/migration-storage/index.ts +1 -0
- package/plugins/migration-storage/package.json +18 -0
- package/plugins/pipeline/index.cjs +2 -0
- package/plugins/pipeline/index.d.cts +1 -0
- package/plugins/pipeline/index.d.mts +1 -0
- package/plugins/pipeline/index.mjs +1 -0
- package/plugins/pipeline/index.ts +1 -0
- package/plugins/pipeline/package.json +18 -0
- package/plugins/query-builder/index.cjs +2 -0
- package/plugins/query-builder/index.d.cts +1 -0
- package/plugins/query-builder/index.d.mts +1 -0
- package/plugins/query-builder/index.mjs +1 -0
- package/plugins/query-builder/index.ts +1 -0
- package/plugins/query-builder/package.json +18 -0
- package/plugins/react/index.cjs +2 -0
- package/plugins/react/index.d.cts +1 -0
- package/plugins/react/index.d.mts +1 -0
- package/plugins/react/index.mjs +1 -0
- package/plugins/react/index.ts +1 -0
- package/plugins/react/package.json +18 -0
- package/plugins/reactivity-angular/index.cjs +2 -0
- package/plugins/reactivity-angular/index.d.cts +1 -0
- package/plugins/reactivity-angular/index.d.mts +1 -0
- package/plugins/reactivity-angular/index.mjs +1 -0
- package/plugins/reactivity-angular/index.ts +1 -0
- package/plugins/reactivity-angular/package.json +18 -0
- package/plugins/reactivity-preact-signals/index.cjs +2 -0
- package/plugins/reactivity-preact-signals/index.d.cts +1 -0
- package/plugins/reactivity-preact-signals/index.d.mts +1 -0
- package/plugins/reactivity-preact-signals/index.mjs +1 -0
- package/plugins/reactivity-preact-signals/index.ts +1 -0
- package/plugins/reactivity-preact-signals/package.json +18 -0
- package/plugins/reactivity-vue/index.cjs +2 -0
- package/plugins/reactivity-vue/index.d.cts +1 -0
- package/plugins/reactivity-vue/index.d.mts +1 -0
- package/plugins/reactivity-vue/index.mjs +1 -0
- package/plugins/reactivity-vue/index.ts +1 -0
- package/plugins/reactivity-vue/package.json +18 -0
- package/plugins/replication/index.cjs +2 -0
- package/plugins/replication/index.d.cts +1 -0
- package/plugins/replication/index.d.mts +1 -0
- package/plugins/replication/index.mjs +1 -0
- package/plugins/replication/index.ts +1 -0
- package/plugins/replication/package.json +18 -0
- package/plugins/replication-appwrite/index.cjs +2 -0
- package/plugins/replication-appwrite/index.d.cts +1 -0
- package/plugins/replication-appwrite/index.d.mts +1 -0
- package/plugins/replication-appwrite/index.mjs +1 -0
- package/plugins/replication-appwrite/index.ts +1 -0
- package/plugins/replication-appwrite/package.json +18 -0
- package/plugins/replication-couchdb/index.cjs +2 -0
- package/plugins/replication-couchdb/index.d.cts +1 -0
- package/plugins/replication-couchdb/index.d.mts +1 -0
- package/plugins/replication-couchdb/index.mjs +1 -0
- package/plugins/replication-couchdb/index.ts +1 -0
- package/plugins/replication-couchdb/package.json +18 -0
- package/plugins/replication-firestore/index.cjs +2 -0
- package/plugins/replication-firestore/index.d.cts +1 -0
- package/plugins/replication-firestore/index.d.mts +1 -0
- package/plugins/replication-firestore/index.mjs +1 -0
- package/plugins/replication-firestore/index.ts +1 -0
- package/plugins/replication-firestore/package.json +18 -0
- package/plugins/replication-google-drive/index.cjs +2 -0
- package/plugins/replication-google-drive/index.d.cts +1 -0
- package/plugins/replication-google-drive/index.d.mts +1 -0
- package/plugins/replication-google-drive/index.mjs +1 -0
- package/plugins/replication-google-drive/index.ts +1 -0
- package/plugins/replication-google-drive/package.json +18 -0
- package/plugins/replication-graphql/index.cjs +2 -0
- package/plugins/replication-graphql/index.d.cts +1 -0
- package/plugins/replication-graphql/index.d.mts +1 -0
- package/plugins/replication-graphql/index.mjs +1 -0
- package/plugins/replication-graphql/index.ts +1 -0
- package/plugins/replication-graphql/package.json +18 -0
- package/plugins/replication-microsoft-onedrive/index.cjs +2 -0
- package/plugins/replication-microsoft-onedrive/index.d.cts +1 -0
- package/plugins/replication-microsoft-onedrive/index.d.mts +1 -0
- package/plugins/replication-microsoft-onedrive/index.mjs +1 -0
- package/plugins/replication-microsoft-onedrive/index.ts +1 -0
- package/plugins/replication-microsoft-onedrive/package.json +18 -0
- package/plugins/replication-mongodb/index.cjs +2 -0
- package/plugins/replication-mongodb/index.d.cts +1 -0
- package/plugins/replication-mongodb/index.d.mts +1 -0
- package/plugins/replication-mongodb/index.mjs +1 -0
- package/plugins/replication-mongodb/index.ts +1 -0
- package/plugins/replication-mongodb/package.json +18 -0
- package/plugins/replication-nats/index.cjs +2 -0
- package/plugins/replication-nats/index.d.cts +1 -0
- package/plugins/replication-nats/index.d.mts +1 -0
- package/plugins/replication-nats/index.mjs +1 -0
- package/plugins/replication-nats/index.ts +1 -0
- package/plugins/replication-nats/package.json +18 -0
- package/plugins/replication-supabase/index.cjs +2 -0
- package/plugins/replication-supabase/index.d.cts +1 -0
- package/plugins/replication-supabase/index.d.mts +1 -0
- package/plugins/replication-supabase/index.mjs +1 -0
- package/plugins/replication-supabase/index.ts +1 -0
- package/plugins/replication-supabase/package.json +18 -0
- package/plugins/replication-webrtc/index.cjs +2 -0
- package/plugins/replication-webrtc/index.d.cts +1 -0
- package/plugins/replication-webrtc/index.d.mts +1 -0
- package/plugins/replication-webrtc/index.mjs +1 -0
- package/plugins/replication-webrtc/index.ts +1 -0
- package/plugins/replication-webrtc/package.json +18 -0
- package/plugins/replication-websocket/index.cjs +2 -0
- package/plugins/replication-websocket/index.d.cts +1 -0
- package/plugins/replication-websocket/index.d.mts +1 -0
- package/plugins/replication-websocket/index.mjs +1 -0
- package/plugins/replication-websocket/index.ts +1 -0
- package/plugins/replication-websocket/package.json +18 -0
- package/plugins/state/index.cjs +2 -0
- package/plugins/state/index.d.cts +1 -0
- package/plugins/state/index.d.mts +1 -0
- package/plugins/state/index.mjs +1 -0
- package/plugins/state/index.ts +1 -0
- package/plugins/state/package.json +18 -0
- package/plugins/storage-denokv/index.cjs +2 -0
- package/plugins/storage-denokv/index.d.cts +1 -0
- package/plugins/storage-denokv/index.d.mts +1 -0
- package/plugins/storage-denokv/index.mjs +1 -0
- package/plugins/storage-denokv/index.ts +1 -0
- package/plugins/storage-denokv/package.json +18 -0
- package/plugins/storage-dexie/index.cjs +2 -0
- package/plugins/storage-dexie/index.d.cts +1 -0
- package/plugins/storage-dexie/index.d.mts +1 -0
- package/plugins/storage-dexie/index.mjs +1 -0
- package/plugins/storage-dexie/index.ts +1 -0
- package/plugins/storage-dexie/package.json +18 -0
- package/plugins/storage-foundationdb/index.cjs +2 -0
- package/plugins/storage-foundationdb/index.d.cts +1 -0
- package/plugins/storage-foundationdb/index.d.mts +1 -0
- package/plugins/storage-foundationdb/index.mjs +1 -0
- package/plugins/storage-foundationdb/index.ts +1 -0
- package/plugins/storage-foundationdb/package.json +18 -0
- package/plugins/storage-localstorage/index.cjs +2 -0
- package/plugins/storage-localstorage/index.d.cts +1 -0
- package/plugins/storage-localstorage/index.d.mts +1 -0
- package/plugins/storage-localstorage/index.mjs +1 -0
- package/plugins/storage-localstorage/index.ts +1 -0
- package/plugins/storage-localstorage/package.json +18 -0
- package/plugins/storage-memory/index.cjs +2 -0
- package/plugins/storage-memory/index.d.cts +1 -0
- package/plugins/storage-memory/index.d.mts +1 -0
- package/plugins/storage-memory/index.mjs +1 -0
- package/plugins/storage-memory/index.ts +1 -0
- package/plugins/storage-memory/package.json +18 -0
- package/plugins/storage-mongodb/index.cjs +2 -0
- package/plugins/storage-mongodb/index.d.cts +1 -0
- package/plugins/storage-mongodb/index.d.mts +1 -0
- package/plugins/storage-mongodb/index.mjs +1 -0
- package/plugins/storage-mongodb/index.ts +1 -0
- package/plugins/storage-mongodb/package.json +18 -0
- package/plugins/storage-remote/index.cjs +2 -0
- package/plugins/storage-remote/index.d.cts +1 -0
- package/plugins/storage-remote/index.d.mts +1 -0
- package/plugins/storage-remote/index.mjs +1 -0
- package/plugins/storage-remote/index.ts +1 -0
- package/plugins/storage-remote/package.json +18 -0
- package/plugins/storage-remote-websocket/index.cjs +2 -0
- package/plugins/storage-remote-websocket/index.d.cts +1 -0
- package/plugins/storage-remote-websocket/index.d.mts +1 -0
- package/plugins/storage-remote-websocket/index.mjs +1 -0
- package/plugins/storage-remote-websocket/index.ts +1 -0
- package/plugins/storage-remote-websocket/package.json +18 -0
- package/plugins/storage-sqlite/index.cjs +2 -0
- package/plugins/storage-sqlite/index.d.cts +1 -0
- package/plugins/storage-sqlite/index.d.mts +1 -0
- package/plugins/storage-sqlite/index.mjs +1 -0
- package/plugins/storage-sqlite/index.ts +1 -0
- package/plugins/storage-sqlite/package.json +18 -0
- package/plugins/test-utils/index.cjs +2 -0
- package/plugins/test-utils/index.d.cts +1 -0
- package/plugins/test-utils/index.d.mts +1 -0
- package/plugins/test-utils/index.mjs +1 -0
- package/plugins/test-utils/index.ts +1 -0
- package/plugins/test-utils/package.json +18 -0
- package/plugins/update/index.cjs +2 -0
- package/plugins/update/index.d.cts +1 -0
- package/plugins/update/index.d.mts +1 -0
- package/plugins/update/index.mjs +1 -0
- package/plugins/update/index.ts +1 -0
- package/plugins/update/package.json +18 -0
- package/plugins/utils/index.cjs +2 -0
- package/plugins/utils/index.d.cts +1 -0
- package/plugins/utils/index.d.mts +1 -0
- package/plugins/utils/index.mjs +1 -0
- package/plugins/utils/index.ts +1 -0
- package/plugins/utils/package.json +18 -0
- package/plugins/validate-ajv/index.cjs +2 -0
- package/plugins/validate-ajv/index.d.cts +1 -0
- package/plugins/validate-ajv/index.d.mts +1 -0
- package/plugins/validate-ajv/index.mjs +1 -0
- package/plugins/validate-ajv/index.ts +1 -0
- package/plugins/validate-ajv/package.json +18 -0
- package/plugins/validate-is-my-json-valid/index.cjs +2 -0
- package/plugins/validate-is-my-json-valid/index.d.cts +1 -0
- package/plugins/validate-is-my-json-valid/index.d.mts +1 -0
- package/plugins/validate-is-my-json-valid/index.mjs +1 -0
- package/plugins/validate-is-my-json-valid/index.ts +1 -0
- package/plugins/validate-is-my-json-valid/package.json +18 -0
- package/plugins/validate-z-schema/index.cjs +2 -0
- package/plugins/validate-z-schema/index.d.cts +1 -0
- package/plugins/validate-z-schema/index.d.mts +1 -0
- package/plugins/validate-z-schema/index.mjs +1 -0
- package/plugins/validate-z-schema/index.ts +1 -0
- package/plugins/validate-z-schema/package.json +18 -0
- package/plugins/vector/index.cjs +2 -0
- package/plugins/vector/index.d.cts +1 -0
- package/plugins/vector/index.d.mts +1 -0
- package/plugins/vector/index.mjs +1 -0
- package/plugins/vector/index.ts +1 -0
- package/plugins/vector/package.json +18 -0
- package/plugins/webmcp/index.cjs +2 -0
- package/plugins/webmcp/index.d.cts +1 -0
- package/plugins/webmcp/index.d.mts +1 -0
- package/plugins/webmcp/index.mjs +1 -0
- package/plugins/webmcp/index.ts +1 -0
- package/plugins/webmcp/package.json +18 -0
- package/scripts/acme-challenge/.gittouch +0 -0
- package/scripts/ai-context-generator.mjs +63 -0
- package/scripts/cloud-signaling-script.sh +6 -0
- package/scripts/docs-remove-time.mjs +55 -0
- package/scripts/fix-types.mjs +23 -0
- package/scripts/generate-all-headers.ts +102 -0
- package/scripts/generate-error-messages.mjs +41 -0
- package/scripts/generate-header.ts +226 -0
- package/scripts/generate-plugins-package-json.mjs +133 -0
- package/scripts/install-foundationdb.sh +14 -0
- package/scripts/module_package.json +1 -0
- package/scripts/module_package_no_side.json +1 -0
- package/scripts/postinstall.js +33 -0
- package/scripts/profile.mjs +31 -0
- package/scripts/set-version.mjs +162 -0
- package/scripts/start-cloud-signaling-server.mjs +120 -0
- package/scripts/transpile.mjs +229 -0
- package/scripts/update-version-variable.mjs +49 -0
- package/src/change-event-buffer.ts +171 -0
- package/src/custom-index.ts +376 -0
- package/src/doc-cache.ts +294 -0
- package/src/event-reduce.ts +159 -0
- package/src/hooks.ts +128 -0
- package/src/incremental-write.ts +227 -0
- package/src/index.ts +30 -0
- package/src/overwritable.ts +41 -0
- package/src/plugin-helpers.ts +319 -0
- package/src/plugin.ts +113 -0
- package/src/plugins/attachments/attachments-utils.ts +84 -0
- package/src/plugins/attachments/index.ts +316 -0
- package/src/plugins/attachments-compression/index.ts +221 -0
- package/src/plugins/backup/file-util.ts +132 -0
- package/src/plugins/backup/index.ts +281 -0
- package/src/plugins/cleanup/cleanup-helper.ts +11 -0
- package/src/plugins/cleanup/cleanup-state.ts +92 -0
- package/src/plugins/cleanup/cleanup.ts +140 -0
- package/src/plugins/cleanup/index.ts +45 -0
- package/src/plugins/crdt/index.ts +505 -0
- package/src/plugins/dev-mode/check-document.ts +176 -0
- package/src/plugins/dev-mode/check-migration-strategies.ts +53 -0
- package/src/plugins/dev-mode/check-orm.ts +65 -0
- package/src/plugins/dev-mode/check-query.ts +231 -0
- package/src/plugins/dev-mode/check-schema.ts +564 -0
- package/src/plugins/dev-mode/dev-mode-tracking.ts +125 -0
- package/src/plugins/dev-mode/entity-properties.ts +56 -0
- package/src/plugins/dev-mode/error-messages.ts +1331 -0
- package/src/plugins/dev-mode/index.ts +203 -0
- package/src/plugins/dev-mode/unallowed-properties.ts +96 -0
- package/src/plugins/electron/electron-helper.ts +2 -0
- package/src/plugins/electron/index.ts +3 -0
- package/src/plugins/electron/rx-storage-ipc-main.ts +58 -0
- package/src/plugins/electron/rx-storage-ipc-renderer.ts +62 -0
- package/src/plugins/encryption-crypto-js/index.ts +220 -0
- package/src/plugins/flutter/dart/analysis_options.yaml +30 -0
- package/src/plugins/flutter/dart/example/rxdb_example.dart +6 -0
- package/src/plugins/flutter/dart/lib/rxdb.dart +7 -0
- package/src/plugins/flutter/dart/lib/src/rxdb_base.dart +332 -0
- package/src/plugins/flutter/dart/pubspec.yaml +15 -0
- package/src/plugins/flutter/index.ts +65 -0
- package/src/plugins/json-dump/index.ts +146 -0
- package/src/plugins/key-compression/index.ts +238 -0
- package/src/plugins/leader-election/index.ts +129 -0
- package/src/plugins/local-documents/index.ts +95 -0
- package/src/plugins/local-documents/local-documents-helper.ts +103 -0
- package/src/plugins/local-documents/local-documents.ts +146 -0
- package/src/plugins/local-documents/rx-local-document.ts +388 -0
- package/src/plugins/migration-schema/index.ts +75 -0
- package/src/plugins/migration-schema/migration-helpers.ts +162 -0
- package/src/plugins/migration-schema/migration-types.ts +42 -0
- package/src/plugins/migration-schema/rx-migration-state.ts +632 -0
- package/src/plugins/migration-storage/index.ts +255 -0
- package/src/plugins/pipeline/flagged-functions.ts +131 -0
- package/src/plugins/pipeline/index.ts +18 -0
- package/src/plugins/pipeline/rx-pipeline.ts +303 -0
- package/src/plugins/pipeline/types.ts +28 -0
- package/src/plugins/query-builder/index.ts +81 -0
- package/src/plugins/query-builder/mquery/README.md +5 -0
- package/src/plugins/query-builder/mquery/mquery-utils.ts +37 -0
- package/src/plugins/query-builder/mquery/nosql-query-builder.ts +578 -0
- package/src/plugins/react/database-context.ts +10 -0
- package/src/plugins/react/database-provider.tsx +38 -0
- package/src/plugins/react/hooks/index.ts +4 -0
- package/src/plugins/react/hooks/use-live-rx-query.ts +34 -0
- package/src/plugins/react/hooks/use-rx-collection.ts +73 -0
- package/src/plugins/react/hooks/use-rx-database.ts +35 -0
- package/src/plugins/react/hooks/use-rx-query.ts +168 -0
- package/src/plugins/react/index.ts +2 -0
- package/src/plugins/reactivity-angular/index.ts +32 -0
- package/src/plugins/reactivity-preact-signals/index.ts +85 -0
- package/src/plugins/reactivity-vue/index.ts +43 -0
- package/src/plugins/replication/index.ts +668 -0
- package/src/plugins/replication/replication-helper.ts +122 -0
- package/src/plugins/replication-appwrite/appwrite-helpers.ts +38 -0
- package/src/plugins/replication-appwrite/appwrite-types.ts +31 -0
- package/src/plugins/replication-appwrite/index.ts +269 -0
- package/src/plugins/replication-couchdb/couchdb-helper.ts +100 -0
- package/src/plugins/replication-couchdb/couchdb-types.ts +34 -0
- package/src/plugins/replication-couchdb/index.ts +341 -0
- package/src/plugins/replication-firestore/firestore-helper.ts +79 -0
- package/src/plugins/replication-firestore/firestore-types.ts +72 -0
- package/src/plugins/replication-firestore/index.ts +387 -0
- package/src/plugins/replication-google-drive/AGENTS.md +5 -0
- package/src/plugins/replication-google-drive/document-handling.ts +203 -0
- package/src/plugins/replication-google-drive/download-specs.sh +49 -0
- package/src/plugins/replication-google-drive/downstream.ts +118 -0
- package/src/plugins/replication-google-drive/google-drive-helper.ts +467 -0
- package/src/plugins/replication-google-drive/google-drive-types.ts +84 -0
- package/src/plugins/replication-google-drive/index.ts +221 -0
- package/src/plugins/replication-google-drive/init.ts +108 -0
- package/src/plugins/replication-google-drive/multipart.ts +86 -0
- package/src/plugins/replication-google-drive/signaling.ts +399 -0
- package/src/plugins/replication-google-drive/transaction.ts +222 -0
- package/src/plugins/replication-google-drive/upstream.ts +279 -0
- package/src/plugins/replication-graphql/graphql-schema-from-rx-schema.ts +337 -0
- package/src/plugins/replication-graphql/graphql-websocket.ts +56 -0
- package/src/plugins/replication-graphql/helper.ts +52 -0
- package/src/plugins/replication-graphql/index.ts +255 -0
- package/src/plugins/replication-graphql/query-builder-from-rx-schema.ts +195 -0
- package/src/plugins/replication-microsoft-onedrive/document-handling.ts +216 -0
- package/src/plugins/replication-microsoft-onedrive/downstream.ts +121 -0
- package/src/plugins/replication-microsoft-onedrive/index.ts +220 -0
- package/src/plugins/replication-microsoft-onedrive/init.ts +107 -0
- package/src/plugins/replication-microsoft-onedrive/microsoft-onedrive-helper.ts +355 -0
- package/src/plugins/replication-microsoft-onedrive/microsoft-onedrive-types.ts +88 -0
- package/src/plugins/replication-microsoft-onedrive/signaling.ts +333 -0
- package/src/plugins/replication-microsoft-onedrive/transaction.ts +220 -0
- package/src/plugins/replication-microsoft-onedrive/upstream.ts +282 -0
- package/src/plugins/replication-mongodb/index.ts +275 -0
- package/src/plugins/replication-mongodb/mongodb-checkpoint.ts +184 -0
- package/src/plugins/replication-mongodb/mongodb-helper.ts +69 -0
- package/src/plugins/replication-mongodb/mongodb-types.ts +50 -0
- package/src/plugins/replication-nats/index.ts +289 -0
- package/src/plugins/replication-nats/nats-helper.ts +15 -0
- package/src/plugins/replication-nats/nats-types.ts +43 -0
- package/src/plugins/replication-supabase/helper.ts +63 -0
- package/src/plugins/replication-supabase/index.ts +308 -0
- package/src/plugins/replication-supabase/types.ts +47 -0
- package/src/plugins/replication-webrtc/connection-handler-p2pcf.ts +77 -0
- package/src/plugins/replication-webrtc/connection-handler-simple-peer.ts +302 -0
- package/src/plugins/replication-webrtc/connection-handler-webtorrent.ts +137 -0
- package/src/plugins/replication-webrtc/index.ts +307 -0
- package/src/plugins/replication-webrtc/signaling-server.ts +193 -0
- package/src/plugins/replication-webrtc/webrtc-helper.ts +55 -0
- package/src/plugins/replication-webrtc/webrtc-types.ts +91 -0
- package/src/plugins/replication-websocket/index.ts +3 -0
- package/src/plugins/replication-websocket/websocket-client.ts +187 -0
- package/src/plugins/replication-websocket/websocket-server.ts +135 -0
- package/src/plugins/replication-websocket/websocket-types.ts +47 -0
- package/src/plugins/state/helpers.ts +86 -0
- package/src/plugins/state/index.ts +40 -0
- package/src/plugins/state/rx-state.ts +386 -0
- package/src/plugins/state/types.ts +32 -0
- package/src/plugins/storage-denokv/denokv-helper.ts +46 -0
- package/src/plugins/storage-denokv/denokv-query.ts +135 -0
- package/src/plugins/storage-denokv/denokv-types.ts +19 -0
- package/src/plugins/storage-denokv/index.ts +37 -0
- package/src/plugins/storage-denokv/rx-storage-instance-denokv.ts +426 -0
- package/src/plugins/storage-dexie/dexie-helper.ts +302 -0
- package/src/plugins/storage-dexie/dexie-query.ts +252 -0
- package/src/plugins/storage-dexie/index.ts +4 -0
- package/src/plugins/storage-dexie/rx-storage-dexie.ts +62 -0
- package/src/plugins/storage-dexie/rx-storage-instance-dexie.ts +378 -0
- package/src/plugins/storage-foundationdb/foundationdb-helpers.ts +6 -0
- package/src/plugins/storage-foundationdb/foundationdb-query.ts +140 -0
- package/src/plugins/storage-foundationdb/foundationdb-types.ts +64 -0
- package/src/plugins/storage-foundationdb/index.ts +57 -0
- package/src/plugins/storage-foundationdb/rx-storage-instance-foundationdb.ts +449 -0
- package/src/plugins/storage-localstorage/index.ts +44 -0
- package/src/plugins/storage-localstorage/localstorage-mock.ts +32 -0
- package/src/plugins/storage-localstorage/rx-storage-instance-localstorage.ts +686 -0
- package/src/plugins/storage-memory/binary-search-bounds.ts +106 -0
- package/src/plugins/storage-memory/index.ts +52 -0
- package/src/plugins/storage-memory/memory-helper.ts +259 -0
- package/src/plugins/storage-memory/memory-indexes.ts +34 -0
- package/src/plugins/storage-memory/memory-types.ts +90 -0
- package/src/plugins/storage-memory/rx-storage-instance-memory.ts +609 -0
- package/src/plugins/storage-mongodb/index.ts +4 -0
- package/src/plugins/storage-mongodb/mongodb-helper.ts +119 -0
- package/src/plugins/storage-mongodb/mongodb-types.ts +32 -0
- package/src/plugins/storage-mongodb/rx-storage-instance-mongodb.ts +464 -0
- package/src/plugins/storage-mongodb/rx-storage-mongodb.ts +33 -0
- package/src/plugins/storage-remote/index.ts +5 -0
- package/src/plugins/storage-remote/message-channel-cache.ts +88 -0
- package/src/plugins/storage-remote/remote.ts +285 -0
- package/src/plugins/storage-remote/rx-storage-remote.ts +286 -0
- package/src/plugins/storage-remote/storage-remote-helpers.ts +33 -0
- package/src/plugins/storage-remote/storage-remote-types.ts +118 -0
- package/src/plugins/storage-remote-websocket/index.ts +218 -0
- package/src/plugins/storage-remote-websocket/types.ts +34 -0
- package/src/plugins/storage-sqlite/index.ts +64 -0
- package/src/plugins/storage-sqlite/sqlite-basics-helpers.ts +656 -0
- package/src/plugins/storage-sqlite/sqlite-helpers.ts +287 -0
- package/src/plugins/storage-sqlite/sqlite-storage-instance.ts +507 -0
- package/src/plugins/storage-sqlite/sqlite-types.ts +151 -0
- package/src/plugins/test-utils/config.ts +135 -0
- package/src/plugins/test-utils/humans-collection.ts +557 -0
- package/src/plugins/test-utils/index.ts +24 -0
- package/src/plugins/test-utils/performance.ts +344 -0
- package/src/plugins/test-utils/replication-base-test-suite.ts +236 -0
- package/src/plugins/test-utils/replication.ts +95 -0
- package/src/plugins/test-utils/revisions.ts +4 -0
- package/src/plugins/test-utils/schema-objects.ts +527 -0
- package/src/plugins/test-utils/schemas.ts +1391 -0
- package/src/plugins/test-utils/test-util.ts +85 -0
- package/src/plugins/update/index.ts +57 -0
- package/src/plugins/update/mingo-updater.ts +26 -0
- package/src/plugins/utils/index.ts +20 -0
- package/src/plugins/utils/utils-array.ts +152 -0
- package/src/plugins/utils/utils-base64.ts +49 -0
- package/src/plugins/utils/utils-blob.ts +65 -0
- package/src/plugins/utils/utils-document.ts +117 -0
- package/src/plugins/utils/utils-error.ts +53 -0
- package/src/plugins/utils/utils-global.ts +5 -0
- package/src/plugins/utils/utils-hash.ts +62 -0
- package/src/plugins/utils/utils-map.ts +23 -0
- package/src/plugins/utils/utils-number.ts +9 -0
- package/src/plugins/utils/utils-object-deep-equal.ts +46 -0
- package/src/plugins/utils/utils-object-dot-prop.ts +365 -0
- package/src/plugins/utils/utils-object.ts +272 -0
- package/src/plugins/utils/utils-other.ts +58 -0
- package/src/plugins/utils/utils-premium.ts +37 -0
- package/src/plugins/utils/utils-promise.ts +171 -0
- package/src/plugins/utils/utils-regex.ts +2 -0
- package/src/plugins/utils/utils-revision.ts +55 -0
- package/src/plugins/utils/utils-rxdb-version.template.ts +4 -0
- package/src/plugins/utils/utils-rxdb-version.ts +4 -0
- package/src/plugins/utils/utils-string.ts +91 -0
- package/src/plugins/utils/utils-time.ts +37 -0
- package/src/plugins/validate-ajv/index.ts +61 -0
- package/src/plugins/validate-is-my-json-valid/index.ts +30 -0
- package/src/plugins/validate-z-schema/index.ts +58 -0
- package/src/plugins/vector/helper.ts +0 -0
- package/src/plugins/vector/index.ts +2 -0
- package/src/plugins/vector/types.ts +1 -0
- package/src/plugins/vector/vector-distance.ts +34 -0
- package/src/plugins/webmcp/index.ts +2 -0
- package/src/plugins/webmcp/nosql-query-schema.ts +299 -0
- package/src/plugins/webmcp/webmcp.ts +319 -0
- package/src/query-cache.ts +139 -0
- package/src/query-planner.ts +386 -0
- package/src/replication-protocol/checkpoint.ts +154 -0
- package/src/replication-protocol/conflicts.ts +53 -0
- package/src/replication-protocol/default-conflict-handler.ts +43 -0
- package/src/replication-protocol/downstream.ts +550 -0
- package/src/replication-protocol/helper.ts +96 -0
- package/src/replication-protocol/index.ts +348 -0
- package/src/replication-protocol/meta-instance.ts +195 -0
- package/src/replication-protocol/upstream.ts +560 -0
- package/src/rx-change-event.ts +137 -0
- package/src/rx-collection-helper.ts +262 -0
- package/src/rx-collection.ts +1306 -0
- package/src/rx-database-internal-store.ts +402 -0
- package/src/rx-database.ts +919 -0
- package/src/rx-document-prototype-merge.ts +124 -0
- package/src/rx-document.ts +557 -0
- package/src/rx-error.ts +190 -0
- package/src/rx-query-helper.ts +317 -0
- package/src/rx-query-mingo.ts +87 -0
- package/src/rx-query-single-result.ts +110 -0
- package/src/rx-query.ts +887 -0
- package/src/rx-schema-helper.ts +391 -0
- package/src/rx-schema.ts +247 -0
- package/src/rx-storage-helper.ts +1050 -0
- package/src/rx-storage-multiinstance.ts +188 -0
- package/src/types/conflict-handling.d.ts +48 -0
- package/src/types/couchdb.d.ts +293 -0
- package/src/types/index.d.ts +32 -0
- package/src/types/modules/index.d.ts +0 -0
- package/src/types/modules/mocha.parallel.d.ts +1 -0
- package/src/types/plugins/backup.d.ts +35 -0
- package/src/types/plugins/cleanup.d.ts +38 -0
- package/src/types/plugins/crdt.d.ts +76 -0
- package/src/types/plugins/dexie.d.ts +30 -0
- package/src/types/plugins/local-documents.d.ts +49 -0
- package/src/types/plugins/migration.d.ts +14 -0
- package/src/types/plugins/reactivity.d.ts +40 -0
- package/src/types/plugins/replication-graphql.d.ts +98 -0
- package/src/types/plugins/replication.d.ts +175 -0
- package/src/types/plugins/state.d.ts +4 -0
- package/src/types/plugins/update.d.ts +23 -0
- package/src/types/plugins/webmcp.d.ts +40 -0
- package/src/types/query-planner.d.ts +47 -0
- package/src/types/replication-protocol.d.ts +296 -0
- package/src/types/rx-attachment.d.ts +46 -0
- package/src/types/rx-change-event.d.ts +85 -0
- package/src/types/rx-collection.d.ts +117 -0
- package/src/types/rx-database-internal-store.d.ts +54 -0
- package/src/types/rx-database.d.ts +124 -0
- package/src/types/rx-document.d.ts +160 -0
- package/src/types/rx-error.d.ts +222 -0
- package/src/types/rx-plugin.d.ts +167 -0
- package/src/types/rx-query.d.ts +144 -0
- package/src/types/rx-schema.d.ts +209 -0
- package/src/types/rx-storage.d.ts +347 -0
- package/src/types/rx-storage.interface.d.ts +312 -0
- package/src/types/util.d.ts +180 -0
- package/tsconfig.json +54 -0
- package/tsconfig.lint.json +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rx-database.js","names":["_customIdleQueue","require","_obliviousSet","_index","_rxError","_rxSchema","_hooks","_rxjs","_operators","_rxCollection","_rxStorageHelper","_rxDatabaseInternalStore","_rxCollectionHelper","_overwritable","_rxChangeEvent","USED_DATABASE_NAMES","Set","DATABASE_UNCLOSED_INSTANCE_PROMISE_MAP","Map","DB_COUNT","RxDatabaseBase","exports","name","token","storage","instanceCreationOptions","password","multiInstance","eventReduce","options","internalStore","hashFunction","cleanupPolicy","allowSlowCount","reactivity","onClosed","idleQueue","IdleQueue","rxdbVersion","RXDB_VERSION","storageInstances","_subs","startupErrors","onClose","closed","collections","states","eventBulks$","Subject","closePromise","collectionsSubject$","observable$","pipe","mergeMap","changeEventBulk","rxChangeEventBulkToRxChangeEvents","storageToken","PROMISE_RESOLVE_FALSE","storageTokenDocument","emittedEventBulkIds","ObliviousSet","getWrappedStorageInstance","asRxDatabase","INTERNAL_STORE_SCHEMA","ensureStorageTokenDocumentExists","catch","err","push","then","doc","data","_proto","prototype","getReactivityFactory","newRxError","database","Symbol","asyncDispose","close","$emit","has","id","add","next","removeCollectionDoc","schema","getSingleDocument","getPrimaryKeyOfInternalDocument","_collectionNamePrimary","INTERNAL_CONTEXT_COLLECTION","writeDoc","flatCloneDocWithMeta","_deleted","bulkWrite","document","previous","addCollections","collectionCreators","jsonSchemas","schemas","bulkPutDocs","useArgsByCollectionName","Promise","all","Object","entries","map","args","collectionName","rxJsonSchema","createRxSchema","collectionNameWithVersion","collectionDocData","key","context","schemaHash","hash","jsonSchema","version","connectedStorages","_meta","getDefaultRxDocumentMeta","_rev","getDefaultRevision","_attachments","useArgs","assign","hookData","flatClone","runPluginHooks","conflictHandler","collectionStorageInstancePromises","keys","forEach","storageInstanceCreationParams","databaseInstanceToken","databaseName","devMode","overwritable","isDevMode","promise","createRxCollectionStorageInstance","putDocsResult","ensureNoStartupErrors","error","status","writeError","docInDb","ensureNotFalsy","documentInDb","collection","previousSchemaHash","previousSchema","values","p","instance","ret","storageInstance","createRxCollection","type","defineProperty","get","lockedRun","fn","wrapCall","requestIdlePromise","exportJSON","_collections","pluginMissing","addState","_name","importJSON","_exportedJSON","backup","_options","leaderElector","isLeader","waitForLeadership","migrationStates","resolve","createPromiseWithResolvers","resolveClosePromise","result","runAsyncPluginHooks","complete","sub","unsubscribe","col","remove","removeRxDatabase","registerWebMCP","_createClass2","default","asObservable","throwIfDatabaseNameUsed","getDatabaseNameKey","link","reject","res","rej","createRxDatabaseStorageInstance","createStorageInstance","INTERNAL_STORAGE_NAME","createRxDatabase","ignoreDuplicate","closeDuplicates","localDocuments","defaultHashSha256","databaseNameKey","databaseNameKeyUnclosedInstancesSet","instancePromiseWithResolvers","closeDuplicatesPromises","Array","from","onInstanceClosed","delete","set","unclosedInstancePromise","randomToken","rxDatabase","creator","dbInternalsStorageInstance","collectionDocs","getAllCollectionDocuments","collectionNames","removedCollectionNames","removeCollectionStorages","isRxDatabase","obj","dbCount","isRxDatabaseFirstTimeInstantiated","tokenDoc","instanceToken"],"sources":["../../src/rx-database.ts"],"sourcesContent":["import { IdleQueue } from 'custom-idle-queue';\r\nimport type {\r\n LeaderElector\r\n} from 'broadcast-channel';\r\nimport { ObliviousSet } from 'oblivious-set';\r\nimport type {\r\n CollectionsOfDatabase,\r\n RxDatabase,\r\n RxCollectionCreator,\r\n RxJsonSchema,\r\n RxCollection,\r\n RxDumpDatabase,\r\n RxDumpDatabaseAny,\r\n BackupOptions,\r\n RxStorage,\r\n RxStorageInstance,\r\n RxStorageInstanceCreationParams,\r\n BulkWriteRow,\r\n RxChangeEvent,\r\n RxDatabaseCreator,\r\n RxChangeEventBulk,\r\n RxDocumentData,\r\n RxCleanupPolicy,\r\n InternalStoreDocType,\r\n InternalStoreStorageTokenDocType,\r\n InternalStoreCollectionDocType,\r\n RxTypeError,\r\n RxError,\r\n HashFunction,\r\n MaybePromise,\r\n RxState,\r\n RxCollectionEvent,\r\n WebMCPOptions,\r\n WebMCPLogEvent\r\n} from './types/index.d.ts';\r\n\r\nimport {\r\n pluginMissing,\r\n flatClone,\r\n PROMISE_RESOLVE_FALSE,\r\n randomToken,\r\n ensureNotFalsy,\r\n getDefaultRevision,\r\n getDefaultRxDocumentMeta,\r\n defaultHashSha256,\r\n RXDB_VERSION\r\n} from './plugins/utils/index.ts';\r\nimport {\r\n newRxError\r\n} from './rx-error.ts';\r\nimport {\r\n createRxSchema,\r\n RxSchema\r\n} from './rx-schema.ts';\r\nimport {\r\n runPluginHooks,\r\n runAsyncPluginHooks\r\n} from './hooks.ts';\r\nimport {\r\n Subject,\r\n Subscription,\r\n Observable\r\n} from 'rxjs';\r\nimport {\r\n mergeMap\r\n} from 'rxjs/operators';\r\nimport {\r\n createRxCollection\r\n} from './rx-collection.ts';\r\nimport {\r\n flatCloneDocWithMeta,\r\n getSingleDocument,\r\n getWrappedStorageInstance,\r\n INTERNAL_STORAGE_NAME,\r\n WrappedRxStorageInstance\r\n} from './rx-storage-helper.ts';\r\nimport type { RxBackupState } from './plugins/backup/index.ts';\r\nimport {\r\n ensureStorageTokenDocumentExists,\r\n getAllCollectionDocuments,\r\n getPrimaryKeyOfInternalDocument,\r\n INTERNAL_CONTEXT_COLLECTION,\r\n INTERNAL_STORE_SCHEMA,\r\n _collectionNamePrimary\r\n} from './rx-database-internal-store.ts';\r\nimport { createRxCollectionStorageInstance, removeCollectionStorages } from './rx-collection-helper.ts';\r\nimport { overwritable } from './overwritable.ts';\r\nimport type { RxMigrationState } from './plugins/migration-schema/index.ts';\r\nimport type { RxReactivityFactory } from './types/plugins/reactivity.d.ts';\r\nimport { rxChangeEventBulkToRxChangeEvents } from './rx-change-event.ts';\r\n\r\n/**\r\n * stores the used database names+storage names\r\n * so we can throw when the same database is created more than once.\r\n */\r\nconst USED_DATABASE_NAMES: Set<string> = new Set();\r\nconst DATABASE_UNCLOSED_INSTANCE_PROMISE_MAP = new Map<string, Set<Promise<RxDatabase>>>();\r\n\r\nlet DB_COUNT = 0;\r\n\r\nexport class RxDatabaseBase<\r\n Internals,\r\n InstanceCreationOptions,\r\n Collections = CollectionsOfDatabase,\r\n Reactivity = unknown\r\n> {\r\n\r\n public readonly idleQueue: IdleQueue = new IdleQueue();\r\n public readonly rxdbVersion = RXDB_VERSION;\r\n\r\n /**\r\n * Contains all known non-closed storage instances\r\n * that belong to this database.\r\n * Used in plugins and unit tests.\r\n */\r\n public readonly storageInstances = new Set<WrappedRxStorageInstance<any, Internals, InstanceCreationOptions>>();\r\n\r\n constructor(\r\n public readonly name: string,\r\n /**\r\n * Uniquely identifies the instance\r\n * of this RxDatabase.\r\n */\r\n public readonly token: string,\r\n public readonly storage: RxStorage<Internals, InstanceCreationOptions>,\r\n public readonly instanceCreationOptions: InstanceCreationOptions,\r\n public readonly password: any,\r\n public readonly multiInstance: boolean,\r\n public readonly eventReduce: boolean = false,\r\n public options: any = {},\r\n /**\r\n * Stores information documents about the collections of the database\r\n */\r\n public readonly internalStore: RxStorageInstance<InternalStoreDocType, Internals, InstanceCreationOptions>,\r\n public readonly hashFunction: HashFunction,\r\n public readonly cleanupPolicy?: Partial<RxCleanupPolicy>,\r\n public readonly allowSlowCount?: boolean,\r\n public readonly reactivity?: RxReactivityFactory<any>,\r\n public readonly onClosed?: () => void,\r\n ) {\r\n DB_COUNT++;\r\n\r\n /**\r\n * In the dev-mode, we create a pseudoInstance\r\n * to get all properties of RxDatabase and ensure they do not\r\n * conflict with the collection names etc.\r\n * So only if it is not pseudoInstance,\r\n * we have all values to prepare a real RxDatabase.\r\n *\r\n * TODO this is ugly, we should use a different way in the dev-mode\r\n * so that all non-dev-mode code can be cleaner.\r\n */\r\n if (this.name !== 'pseudoInstance') {\r\n /**\r\n * Wrap the internal store\r\n * to ensure that calls to it also end up in\r\n * calculation of the idle state and the hooks.\r\n */\r\n this.internalStore = getWrappedStorageInstance(\r\n this.asRxDatabase,\r\n internalStore,\r\n INTERNAL_STORE_SCHEMA\r\n );\r\n\r\n /**\r\n * Start writing the storage token.\r\n * Do not await the creation because it would run\r\n * in a critical path that increases startup time.\r\n *\r\n * Writing the token takes about 20 milliseconds\r\n * even on a fast adapter, so this is worth it.\r\n */\r\n this.storageTokenDocument = ensureStorageTokenDocumentExists(this.asRxDatabase)\r\n .catch(err => this.startupErrors.push(err) as any);\r\n this.storageToken = this.storageTokenDocument\r\n .then(doc => doc.data.token)\r\n .catch(err => this.startupErrors.push(err) as any);\r\n }\r\n }\r\n\r\n get $(): Observable<RxChangeEvent<any>> {\r\n return this.observable$;\r\n }\r\n\r\n /**\r\n * Emits events whenever a JavaScript instance\r\n * of RxCollection is added or removed on the RxDatabase instance.\r\n * Does not emit anything across browser-tabs!\r\n */\r\n get collections$(): Observable<RxCollectionEvent> {\r\n return this.collectionsSubject$.asObservable();\r\n }\r\n\r\n public getReactivityFactory(): RxReactivityFactory<Reactivity> {\r\n if (!this.reactivity) {\r\n throw newRxError('DB14', { database: this.name });\r\n }\r\n return this.reactivity;\r\n }\r\n\r\n public _subs: Subscription[] = [];\r\n\r\n /**\r\n * Because having unhandled exceptions would fail,\r\n * we have to store the async errors of the constructor here\r\n * so we can throw them later.\r\n */\r\n public startupErrors: (RxError | RxTypeError)[] = [];\r\n\r\n /**\r\n * When the database is closed,\r\n * these functions will be called an awaited.\r\n * Used to automatically clean up stuff that\r\n * belongs to this collection.\r\n */\r\n public onClose: (() => MaybePromise<any>)[] = [];\r\n public closed: boolean = false;\r\n public collections: Collections = {} as any;\r\n public states: { [name: string]: RxState<any, Reactivity>; } = {};\r\n\r\n /**\r\n * Support for `using` / `await using` (ECMAScript explicit resource management).\r\n * This allows: `await using db = await createRxDatabase(...)`\r\n */\r\n public async [Symbol.asyncDispose](): Promise<void> {\r\n await this.close();\r\n }\r\n\r\n /**\r\n * Internally only use eventBulks$\r\n * Do not use .$ or .observable$ because that has to transform\r\n * the events which decreases performance.\r\n */\r\n public readonly eventBulks$: Subject<RxChangeEventBulk<any>> = new Subject();\r\n\r\n private closePromise: Promise<boolean> | null = null;\r\n\r\n public collectionsSubject$ = new Subject<RxCollectionEvent>();\r\n private observable$: Observable<RxChangeEvent<any>> = this.eventBulks$\r\n .pipe(\r\n mergeMap((changeEventBulk: RxChangeEventBulk<any>) => rxChangeEventBulkToRxChangeEvents(changeEventBulk))\r\n );\r\n\r\n /**\r\n * Unique token that is stored with the data.\r\n * Used to detect if the dataset has been deleted\r\n * and if two RxDatabase instances work on the same dataset or not.\r\n *\r\n * Because reading and writing the storageToken runs in the hot path\r\n * of database creation, we do not await the storageWrites but instead\r\n * work with the promise when we need the value.\r\n */\r\n public storageToken: Promise<string> = PROMISE_RESOLVE_FALSE as any;\r\n /**\r\n * Stores the whole state of the internal storage token document.\r\n * We need this in some plugins.\r\n */\r\n public storageTokenDocument: Promise<RxDocumentData<InternalStoreStorageTokenDocType>> = PROMISE_RESOLVE_FALSE as any;\r\n\r\n /**\r\n * Contains the ids of all event bulks that have been emitted\r\n * by the database.\r\n * Used to detect duplicates that come in again via BroadcastChannel\r\n * or other streams.\r\n * In the past we tried to remove this and to ensure\r\n * all storages only emit the same event bulks only once\r\n * but it turns out this is just not possible for all storages.\r\n * JavaScript processes, workers and browser tabs can be closed and started at any time\r\n * which can cause cases where it is not possible to know if an event bulk has been emitted already.\r\n */\r\n public emittedEventBulkIds: ObliviousSet<string> = new ObliviousSet(60 * 1000);\r\n\r\n /**\r\n * This is the main handle-point for all change events\r\n * ChangeEvents created by this instance go:\r\n * RxDocument -> RxCollection -> RxDatabase.$emit -> MultiInstance\r\n * ChangeEvents created by other instances go:\r\n * MultiInstance -> RxDatabase.$emit -> RxCollection -> RxDatabase\r\n */\r\n $emit(changeEventBulk: RxChangeEventBulk<any>) {\r\n if (this.emittedEventBulkIds.has(changeEventBulk.id)) {\r\n return;\r\n }\r\n this.emittedEventBulkIds.add(changeEventBulk.id);\r\n this.eventBulks$.next(changeEventBulk);\r\n }\r\n\r\n /**\r\n * removes the collection-doc from the internalStore\r\n */\r\n async removeCollectionDoc(name: string, schema: any): Promise<void> {\r\n const doc = await getSingleDocument(\r\n this.internalStore,\r\n getPrimaryKeyOfInternalDocument(\r\n _collectionNamePrimary(name, schema),\r\n INTERNAL_CONTEXT_COLLECTION\r\n )\r\n );\r\n if (!doc) {\r\n throw newRxError('SNH', { name, schema });\r\n }\r\n const writeDoc = flatCloneDocWithMeta(doc);\r\n writeDoc._deleted = true;\r\n\r\n await this.internalStore.bulkWrite([{\r\n document: writeDoc,\r\n previous: doc\r\n }], 'rx-database-remove-collection');\r\n }\r\n\r\n /**\r\n * creates multiple RxCollections at once\r\n * to be much faster by saving db txs and doing stuff in bulk-operations\r\n * This function is not called often, but mostly in the critical path at the initial page load\r\n * So it must be as fast as possible.\r\n */\r\n async addCollections<CreatedCollections = Partial<Collections>>(collectionCreators: {\r\n [key in keyof CreatedCollections]: RxCollectionCreator<any>\r\n }): Promise<{ [key in keyof CreatedCollections]: RxCollection<any, {}, {}, {}, Reactivity> }> {\r\n const jsonSchemas: { [key in keyof CreatedCollections]: RxJsonSchema<any> } = {} as any;\r\n const schemas: { [key in keyof CreatedCollections]: RxSchema<any> } = {} as any;\r\n const bulkPutDocs: BulkWriteRow<InternalStoreCollectionDocType>[] = [];\r\n const useArgsByCollectionName: any = {};\r\n\r\n await Promise.all(\r\n Object.entries(collectionCreators).map(async ([name, args]) => {\r\n const collectionName: keyof CreatedCollections = name as any;\r\n const rxJsonSchema = (args as RxCollectionCreator<any>).schema;\r\n jsonSchemas[collectionName] = rxJsonSchema;\r\n const schema = createRxSchema(rxJsonSchema, this.hashFunction);\r\n schemas[collectionName] = schema;\r\n\r\n // collection already exists\r\n if ((this.collections as any)[name]) {\r\n throw newRxError('DB3', {\r\n name\r\n });\r\n }\r\n\r\n const collectionNameWithVersion = _collectionNamePrimary(name, rxJsonSchema);\r\n const collectionDocData: RxDocumentData<InternalStoreCollectionDocType> = {\r\n id: getPrimaryKeyOfInternalDocument(\r\n collectionNameWithVersion,\r\n INTERNAL_CONTEXT_COLLECTION\r\n ),\r\n key: collectionNameWithVersion,\r\n context: INTERNAL_CONTEXT_COLLECTION,\r\n data: {\r\n name: collectionName as any,\r\n schemaHash: await schema.hash,\r\n schema: schema.jsonSchema,\r\n version: schema.version,\r\n connectedStorages: []\r\n },\r\n _deleted: false,\r\n _meta: getDefaultRxDocumentMeta(),\r\n _rev: getDefaultRevision(),\r\n _attachments: {}\r\n };\r\n bulkPutDocs.push({\r\n document: collectionDocData\r\n });\r\n\r\n const useArgs: any = Object.assign(\r\n {},\r\n args,\r\n {\r\n name: collectionName,\r\n schema,\r\n database: this\r\n }\r\n );\r\n\r\n // run hooks\r\n const hookData: RxCollectionCreator<any> & { name: string; } = flatClone(args) as any;\r\n (hookData as any).database = this;\r\n hookData.name = name;\r\n runPluginHooks('preCreateRxCollection', hookData);\r\n useArgs.conflictHandler = hookData.conflictHandler;\r\n\r\n useArgsByCollectionName[collectionName] = useArgs;\r\n })\r\n );\r\n\r\n\r\n /**\r\n * Optimization: Start creating collection storage instances\r\n * in parallel with the internal store bulkWrite and startup error check.\r\n * Storage instance creation is independent of the internal store write,\r\n * so we can overlap these I/O operations to reduce time-to-first-insert.\r\n */\r\n const collectionStorageInstancePromises: { [key: string]: Promise<RxStorageInstance<any, any, any>>; } = {};\r\n Object.keys(collectionCreators).forEach((collectionName) => {\r\n const useArgs = useArgsByCollectionName[collectionName];\r\n const storageInstanceCreationParams: RxStorageInstanceCreationParams<any, any> = {\r\n databaseInstanceToken: this.token,\r\n databaseName: this.name,\r\n collectionName: collectionName,\r\n schema: useArgs.schema.jsonSchema,\r\n options: useArgs.instanceCreationOptions || {},\r\n multiInstance: this.multiInstance,\r\n password: this.password,\r\n devMode: overwritable.isDevMode()\r\n };\r\n runPluginHooks('preCreateRxStorageInstance', storageInstanceCreationParams);\r\n const promise = createRxCollectionStorageInstance(\r\n this.asRxDatabase,\r\n storageInstanceCreationParams\r\n );\r\n /**\r\n * Prevent unhandled promise rejection warnings.\r\n * If ensureNoStartupErrors() or the bulkWrite error handling throws\r\n * (e.g. password mismatch, schema mismatch), these promises might\r\n * never be awaited. The actual errors are still propagated when\r\n * the promises are awaited in Phase 5 below.\r\n */\r\n promise.catch(() => { });\r\n collectionStorageInstancePromises[collectionName] = promise;\r\n });\r\n\r\n /**\r\n * If the ensureNoStartupErrors or the bulkWrite error handling throws,\r\n * we must close any pre-created storage instances to avoid resource leaks.\r\n */\r\n let putDocsResult;\r\n try {\r\n [putDocsResult] = await Promise.all([\r\n this.internalStore.bulkWrite(\r\n bulkPutDocs,\r\n 'rx-database-add-collection'\r\n ),\r\n ensureNoStartupErrors(this)\r\n ]);\r\n\r\n await Promise.all(\r\n putDocsResult.error.map(async (error) => {\r\n if (error.status !== 409) {\r\n throw newRxError('DB12', {\r\n database: this.name,\r\n writeError: error\r\n });\r\n }\r\n const docInDb: RxDocumentData<InternalStoreCollectionDocType> = ensureNotFalsy(error.documentInDb);\r\n const collectionName = docInDb.data.name;\r\n const schema = (schemas as any)[collectionName];\r\n // collection already exists but has different schema\r\n if (docInDb.data.schemaHash !== await schema.hash) {\r\n throw newRxError('DB6', {\r\n database: this.name,\r\n collection: collectionName,\r\n previousSchemaHash: docInDb.data.schemaHash,\r\n schemaHash: await schema.hash,\r\n previousSchema: docInDb.data.schema,\r\n schema: ensureNotFalsy((jsonSchemas as any)[collectionName])\r\n });\r\n }\r\n })\r\n );\r\n } catch (err) {\r\n /**\r\n * Close any pre-created storage instances on error.\r\n * Some instances might have failed to create (rejected promise),\r\n * so we catch and ignore errors during cleanup.\r\n */\r\n await Promise.all(\r\n Object.values(collectionStorageInstancePromises).map(\r\n p => p.then(instance => instance.close()).catch(() => { })\r\n )\r\n );\r\n throw err;\r\n }\r\n\r\n const ret: { [key in keyof CreatedCollections]: RxCollection<any, {}, {}, {}, Reactivity> } = {} as any;\r\n await Promise.all(\r\n Object.keys(collectionCreators).map(async (collectionName) => {\r\n const useArgs = useArgsByCollectionName[collectionName];\r\n const storageInstance = await collectionStorageInstancePromises[collectionName];\r\n const collection = await createRxCollection({\r\n ...useArgs,\r\n storageInstance\r\n });\r\n (ret as any)[collectionName] = collection;\r\n\r\n // set as getter to the database\r\n (this.collections as any)[collectionName] = collection;\r\n this.collectionsSubject$.next({\r\n collection,\r\n type: 'ADDED'\r\n });\r\n if (!(this as any)[collectionName]) {\r\n Object.defineProperty(this, collectionName, {\r\n get: () => (this.collections as any)[collectionName]\r\n });\r\n }\r\n })\r\n );\r\n\r\n return ret;\r\n }\r\n\r\n /**\r\n * runs the given function between idleQueue-locking\r\n */\r\n lockedRun<T>(fn: (...args: any[]) => T): T extends Promise<any> ? T : Promise<T> {\r\n return this.idleQueue.wrapCall(fn) as any;\r\n }\r\n\r\n requestIdlePromise() {\r\n return this.idleQueue.requestIdlePromise();\r\n }\r\n\r\n /**\r\n * Export database to a JSON friendly format.\r\n */\r\n exportJSON(_collections?: string[]): Promise<RxDumpDatabase<Collections>>;\r\n exportJSON(_collections?: string[]): Promise<RxDumpDatabaseAny<Collections>>;\r\n exportJSON(_collections?: string[]): Promise<any> {\r\n throw pluginMissing('json-dump');\r\n }\r\n\r\n addState<T = any>(_name?: string): Promise<RxState<T, Reactivity>> {\r\n throw pluginMissing('state');\r\n }\r\n\r\n /**\r\n * Import the parsed JSON export into the collection.\r\n * @param _exportedJSON The previously exported data from the `<db>.exportJSON()` method.\r\n * @note When an interface is loaded in this collection all base properties of the type are typed as `any`\r\n * since data could be encrypted.\r\n */\r\n importJSON(_exportedJSON: RxDumpDatabaseAny<Collections>): Promise<void> {\r\n throw pluginMissing('json-dump');\r\n }\r\n\r\n backup(_options: BackupOptions): RxBackupState {\r\n throw pluginMissing('backup');\r\n }\r\n\r\n public leaderElector(): LeaderElector {\r\n throw pluginMissing('leader-election');\r\n }\r\n\r\n public isLeader(): boolean {\r\n throw pluginMissing('leader-election');\r\n }\r\n /**\r\n * returns a promise which resolves when the instance becomes leader\r\n */\r\n public waitForLeadership(): Promise<boolean> {\r\n throw pluginMissing('leader-election');\r\n }\r\n\r\n public migrationStates(): Observable<RxMigrationState[]> {\r\n throw pluginMissing('migration-schema');\r\n }\r\n\r\n /**\r\n * closes the database-instance and all collections\r\n */\r\n public close(): Promise<boolean> {\r\n if (this.closePromise) {\r\n return this.closePromise;\r\n }\r\n\r\n const { promise, resolve } = createPromiseWithResolvers<boolean>();\r\n const resolveClosePromise = (result: boolean) => {\r\n if (this.onClosed) {\r\n this.onClosed();\r\n }\r\n this.closed = true;\r\n resolve(result);\r\n };\r\n this.closePromise = promise;\r\n\r\n (async () => {\r\n await runAsyncPluginHooks('preCloseRxDatabase', this);\r\n /**\r\n * Complete the event stream\r\n * to stop all subscribers who forgot to unsubscribe.\r\n */\r\n this.eventBulks$.complete();\r\n this.collectionsSubject$.complete();\r\n\r\n DB_COUNT--;\r\n this._subs.map(sub => sub.unsubscribe());\r\n\r\n /**\r\n * closing the pseudo instance will throw\r\n * because stuff is missing\r\n * TODO we should not need the pseudo instance on runtime.\r\n * we should generate the property list on build time.\r\n */\r\n if (this.name === 'pseudoInstance') {\r\n resolveClosePromise(false);\r\n return;\r\n }\r\n\r\n /**\r\n * First wait until the database is idle\r\n */\r\n return this.requestIdlePromise()\r\n .then(() => Promise.all(this.onClose.map(fn => fn())))\r\n // close all collections\r\n .then(() => Promise.all(\r\n Object.keys(this.collections as any)\r\n .map(key => (this.collections as any)[key])\r\n .map(col => col.close())\r\n ))\r\n // close internal storage instances\r\n .then(() => this.internalStore.close())\r\n .then(() => resolveClosePromise(true));\r\n })();\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * deletes the database and its stored data.\r\n * Returns the names of all removed collections.\r\n */\r\n remove(): Promise<string[]> {\r\n return this\r\n .close()\r\n .then(() => removeRxDatabase(this.name, this.storage, this.multiInstance, this.password));\r\n }\r\n\r\n get asRxDatabase(): RxDatabase<\r\n {},\r\n Internals,\r\n InstanceCreationOptions,\r\n Reactivity\r\n > {\r\n return this as any;\r\n }\r\n\r\n registerWebMCP(_options?: WebMCPOptions): { error$: Subject<Error>; log$: Subject<WebMCPLogEvent>; } {\r\n throw pluginMissing('webmcp');\r\n }\r\n}\r\n\r\n/**\r\n * checks if an instance with same name and storage already exists\r\n * @throws {RxError} if used\r\n */\r\nfunction throwIfDatabaseNameUsed(\r\n name: string,\r\n storage: RxStorage<any, any>\r\n) {\r\n if (USED_DATABASE_NAMES.has(getDatabaseNameKey(name, storage))) {\r\n throw newRxError('DB8', {\r\n name,\r\n storage: storage.name,\r\n link: 'https://rxdb.info/rx-database.html#ignoreduplicate'\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Polyfill for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers\r\n */\r\nfunction createPromiseWithResolvers<T>() {\r\n let resolve!: (value: T | PromiseLike<T>) => void;\r\n let reject!: (reason?: any) => void;\r\n const promise = new Promise<T>((res, rej) => {\r\n resolve = res;\r\n reject = rej;\r\n });\r\n return { promise, resolve, reject };\r\n}\r\n\r\nfunction getDatabaseNameKey(\r\n name: string,\r\n storage: RxStorage<any, any>\r\n) {\r\n return storage.name + '|' + name;\r\n}\r\n\r\n/**\r\n * Creates the storage instances that are used internally in the database\r\n * to store schemas and other configuration stuff.\r\n */\r\nexport async function createRxDatabaseStorageInstance<Internals, InstanceCreationOptions>(\r\n databaseInstanceToken: string,\r\n storage: RxStorage<Internals, InstanceCreationOptions>,\r\n databaseName: string,\r\n options: InstanceCreationOptions,\r\n multiInstance: boolean,\r\n password?: string\r\n): Promise<RxStorageInstance<InternalStoreDocType, Internals, InstanceCreationOptions>> {\r\n const internalStore = await storage.createStorageInstance<InternalStoreDocType>(\r\n {\r\n databaseInstanceToken,\r\n databaseName,\r\n collectionName: INTERNAL_STORAGE_NAME,\r\n schema: INTERNAL_STORE_SCHEMA,\r\n options,\r\n multiInstance,\r\n password,\r\n devMode: overwritable.isDevMode()\r\n }\r\n );\r\n return internalStore;\r\n}\r\n\r\nexport function createRxDatabase<\r\n Collections = { [key: string]: RxCollection; },\r\n Internals = any,\r\n InstanceCreationOptions = any,\r\n Reactivity = unknown\r\n>(\r\n {\r\n storage,\r\n instanceCreationOptions,\r\n name,\r\n password,\r\n multiInstance = true,\r\n eventReduce = true,\r\n ignoreDuplicate = false,\r\n options = {},\r\n cleanupPolicy,\r\n closeDuplicates = false,\r\n allowSlowCount = false,\r\n localDocuments = false,\r\n hashFunction = defaultHashSha256,\r\n reactivity\r\n }: RxDatabaseCreator<Internals, InstanceCreationOptions, Reactivity>\r\n): Promise<\r\n RxDatabase<Collections, Internals, InstanceCreationOptions, Reactivity>\r\n> {\r\n runPluginHooks('preCreateRxDatabase', {\r\n storage,\r\n instanceCreationOptions,\r\n name,\r\n password,\r\n multiInstance,\r\n eventReduce,\r\n ignoreDuplicate,\r\n options,\r\n localDocuments\r\n });\r\n\r\n const databaseNameKey = getDatabaseNameKey(name, storage);\r\n const databaseNameKeyUnclosedInstancesSet = DATABASE_UNCLOSED_INSTANCE_PROMISE_MAP.get(databaseNameKey) || new Set();\r\n const instancePromiseWithResolvers = createPromiseWithResolvers<RxDatabase<Collections, Internals, InstanceCreationOptions, Reactivity>>();\r\n const closeDuplicatesPromises = Array.from(databaseNameKeyUnclosedInstancesSet);\r\n const onInstanceClosed = () => {\r\n databaseNameKeyUnclosedInstancesSet.delete(instancePromiseWithResolvers.promise as any as Promise<RxDatabase>);\r\n USED_DATABASE_NAMES.delete(databaseNameKey);\r\n };\r\n\r\n databaseNameKeyUnclosedInstancesSet.add(instancePromiseWithResolvers.promise as any as Promise<RxDatabase>);\r\n DATABASE_UNCLOSED_INSTANCE_PROMISE_MAP.set(databaseNameKey, databaseNameKeyUnclosedInstancesSet);\r\n\r\n (async () => {\r\n if (closeDuplicates) {\r\n await Promise.all(\r\n closeDuplicatesPromises.map((unclosedInstancePromise) =>\r\n unclosedInstancePromise\r\n .catch(() => null)\r\n .then((instance) => instance && instance.close())\r\n )\r\n );\r\n }\r\n\r\n if (ignoreDuplicate) {\r\n if (!overwritable.isDevMode()) {\r\n throw newRxError('DB9', {\r\n database: name\r\n });\r\n }\r\n } else {\r\n // check if combination already used\r\n throwIfDatabaseNameUsed(name, storage);\r\n }\r\n\r\n USED_DATABASE_NAMES.add(databaseNameKey);\r\n\r\n const databaseInstanceToken = randomToken(10);\r\n const storageInstance = await createRxDatabaseStorageInstance<\r\n Internals,\r\n InstanceCreationOptions\r\n >(\r\n databaseInstanceToken,\r\n storage,\r\n name,\r\n instanceCreationOptions as any,\r\n multiInstance,\r\n password\r\n );\r\n const rxDatabase = new RxDatabaseBase(\r\n name,\r\n databaseInstanceToken,\r\n storage,\r\n instanceCreationOptions,\r\n password,\r\n multiInstance,\r\n eventReduce,\r\n options,\r\n storageInstance,\r\n hashFunction,\r\n cleanupPolicy,\r\n allowSlowCount,\r\n reactivity,\r\n onInstanceClosed\r\n ) as RxDatabase<Collections>;\r\n\r\n await runAsyncPluginHooks('createRxDatabase', {\r\n database: rxDatabase,\r\n creator: {\r\n storage,\r\n instanceCreationOptions,\r\n name,\r\n password,\r\n multiInstance,\r\n eventReduce,\r\n ignoreDuplicate,\r\n options,\r\n localDocuments\r\n }\r\n });\r\n\r\n return rxDatabase;\r\n })()\r\n .then((rxDatabase) => {\r\n instancePromiseWithResolvers.resolve(rxDatabase);\r\n })\r\n .catch((err) => {\r\n instancePromiseWithResolvers.reject(err);\r\n onInstanceClosed();\r\n });\r\n\r\n return instancePromiseWithResolvers.promise;\r\n}\r\n\r\n/**\r\n * Removes the database and all its known data\r\n * with all known collections and all internal meta data.\r\n *\r\n * Returns the names of the removed collections.\r\n */\r\nexport async function removeRxDatabase(\r\n databaseName: string,\r\n storage: RxStorage<any, any>,\r\n multiInstance: boolean = true,\r\n password?: string\r\n): Promise<string[]> {\r\n const databaseInstanceToken = randomToken(10);\r\n const dbInternalsStorageInstance = await createRxDatabaseStorageInstance(\r\n databaseInstanceToken,\r\n storage,\r\n databaseName,\r\n {},\r\n multiInstance,\r\n password\r\n );\r\n const collectionDocs = await getAllCollectionDocuments(dbInternalsStorageInstance);\r\n const collectionNames = new Set<string>();\r\n collectionDocs.forEach(doc => collectionNames.add(doc.data.name));\r\n const removedCollectionNames: string[] = Array.from(collectionNames);\r\n\r\n await Promise.all(\r\n removedCollectionNames.map(collectionName => removeCollectionStorages(\r\n storage,\r\n dbInternalsStorageInstance,\r\n databaseInstanceToken,\r\n databaseName,\r\n collectionName,\r\n multiInstance,\r\n password\r\n ))\r\n );\r\n\r\n await runAsyncPluginHooks('postRemoveRxDatabase', {\r\n databaseName,\r\n storage\r\n });\r\n\r\n await dbInternalsStorageInstance.remove();\r\n return removedCollectionNames;\r\n}\r\n\r\nexport function isRxDatabase(obj: any) {\r\n return obj instanceof RxDatabaseBase;\r\n}\r\n\r\nexport function dbCount(): number {\r\n return DB_COUNT;\r\n}\r\n\r\n\r\n/**\r\n * Returns true if the given RxDatabase was the first\r\n * instance that was created on the storage with this name.\r\n *\r\n * Can be used for some optimizations because on the first instantiation,\r\n * we can assume that no data was written before.\r\n */\r\nexport async function isRxDatabaseFirstTimeInstantiated(\r\n database: RxDatabase\r\n): Promise<boolean> {\r\n const tokenDoc = await database.storageTokenDocument;\r\n return tokenDoc.data.instanceToken === database.token;\r\n}\r\n\r\n\r\n/**\r\n * For better performance some tasks run async\r\n * and are awaited later.\r\n * But we still have to ensure that there have been no errors\r\n * on database creation.\r\n */\r\nexport async function ensureNoStartupErrors(\r\n rxDatabase: RxDatabaseBase<any, any, any, any>\r\n) {\r\n await rxDatabase.storageToken;\r\n if (rxDatabase.startupErrors[0]) {\r\n throw rxDatabase.startupErrors[0];\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAD,OAAA;AAgCA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,QAAA,GAAAH,OAAA;AAGA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,MAAA,GAAAL,OAAA;AAIA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAGA,IAAAQ,aAAA,GAAAR,OAAA;AAGA,IAAAS,gBAAA,GAAAT,OAAA;AAQA,IAAAU,wBAAA,GAAAV,OAAA;AAQA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAGA,IAAAa,cAAA,GAAAb,OAAA;AAEA;AACA;AACA;AACA;AACA,IAAMc,mBAAgC,GAAG,IAAIC,GAAG,CAAC,CAAC;AAClD,IAAMC,sCAAsC,GAAG,IAAIC,GAAG,CAAmC,CAAC;AAE1F,IAAIC,QAAQ,GAAG,CAAC;AAAC,IAEJC,cAAc,GAAAC,OAAA,CAAAD,cAAA;EAUvB;AACJ;AACA;AACA;AACA;;EAGI,SAAAA,eACoBE,IAAY;EAC5B;AACR;AACA;AACA;EACwBC,KAAa,EACbC,OAAsD,EACtDC,uBAAgD,EAChDC,QAAa,EACbC,aAAsB,EACtBC,WAAoB,GAAG,KAAK,EACrCC,OAAY,GAAG,CAAC,CAAC;EACxB;AACR;AACA;EACwBC,aAA0F,EAC1FC,YAA0B,EAC1BC,aAAwC,EACxCC,cAAwB,EACxBC,UAAqC,EACrCC,QAAqB,EACvC;IAAA,KAhCcC,SAAS,GAAc,IAAIC,0BAAS,CAAC,CAAC;IAAA,KACtCC,WAAW,GAAGC,mBAAY;IAAA,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,0BAA0B,EAC1BtF,qBAAqB,EACrBC,YAAY,EACZ5B,cAAc,EACdjF,aAAa,EACbD,QACJ,CAAC,CACL,CAAC;EAED,MAAM,IAAA6J,0BAAmB,EAAC,sBAAsB,EAAE;IAC9C/C,YAAY;IACZhH;EACJ,CAAC,CAAC;EAEF,MAAMqM,0BAA0B,CAACjC,MAAM,CAAC,CAAC;EACzC,OAAOqC,sBAAsB;AACjC;AAEO,SAASE,YAAYA,CAACC,GAAQ,EAAE;EACnC,OAAOA,GAAG,YAAYhN,cAAc;AACxC;AAEO,SAASiN,OAAOA,CAAA,EAAW;EAC9B,OAAOlN,QAAQ;AACnB;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAemN,iCAAiCA,CACnD3J,QAAoB,EACJ;EAChB,IAAM4J,QAAQ,GAAG,MAAM5J,QAAQ,CAACjB,oBAAoB;EACpD,OAAO6K,QAAQ,CAACjK,IAAI,CAACkK,aAAa,KAAK7J,QAAQ,CAACpD,KAAK;AACzD;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,eAAewH,qBAAqBA,CACvC4E,UAA8C,EAChD;EACE,MAAMA,UAAU,CAACnK,YAAY;EAC7B,IAAImK,UAAU,CAACjL,aAAa,CAAC,CAAC,CAAC,EAAE;IAC7B,MAAMiL,UAAU,CAACjL,aAAa,CAAC,CAAC,CAAC;EACrC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createNewRxDocument = createNewRxDocument;
|
|
7
|
+
exports.getDocumentOrmPrototype = getDocumentOrmPrototype;
|
|
8
|
+
exports.getDocumentPrototype = getDocumentPrototype;
|
|
9
|
+
exports.getRxDocumentConstructor = getRxDocumentConstructor;
|
|
10
|
+
var _rxDocument = require("./rx-document.js");
|
|
11
|
+
var _hooks = require("./hooks.js");
|
|
12
|
+
var _overwritable = require("./overwritable.js");
|
|
13
|
+
var _index = require("./plugins/utils/index.js");
|
|
14
|
+
/**
|
|
15
|
+
* For the ORM capabilities,
|
|
16
|
+
* we have to merge the document prototype
|
|
17
|
+
* with the ORM functions and the data
|
|
18
|
+
* We do this iterating over the properties and
|
|
19
|
+
* adding them to a new object.
|
|
20
|
+
* In the future we should do this by chaining the __proto__ objects
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var constructorForCollection = new WeakMap();
|
|
24
|
+
function getDocumentPrototype(rxCollection) {
|
|
25
|
+
var schemaProto = rxCollection.schema.getDocumentPrototype();
|
|
26
|
+
var ormProto = getDocumentOrmPrototype(rxCollection);
|
|
27
|
+
var baseProto = _rxDocument.basePrototype;
|
|
28
|
+
var proto = {};
|
|
29
|
+
[schemaProto, ormProto, baseProto].forEach(obj => {
|
|
30
|
+
var props = Object.getOwnPropertyNames(obj);
|
|
31
|
+
props.forEach(key => {
|
|
32
|
+
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
33
|
+
/**
|
|
34
|
+
* When enumerable is true, it will show on console dir(instance)
|
|
35
|
+
* To not pollute the output, only getters and methods are enumerable
|
|
36
|
+
*/
|
|
37
|
+
var enumerable = true;
|
|
38
|
+
if (key.startsWith('_') || key.endsWith('_') || key.startsWith('$') || key.endsWith('$')) enumerable = false;
|
|
39
|
+
if (typeof desc.value === 'function') {
|
|
40
|
+
// when getting a function, we automatically do a .bind(this)
|
|
41
|
+
Object.defineProperty(proto, key, {
|
|
42
|
+
get() {
|
|
43
|
+
return desc.value.bind(this);
|
|
44
|
+
},
|
|
45
|
+
enumerable,
|
|
46
|
+
configurable: false
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
desc.enumerable = enumerable;
|
|
50
|
+
desc.configurable = false;
|
|
51
|
+
if (desc.writable) desc.writable = false;
|
|
52
|
+
Object.defineProperty(proto, key, desc);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return proto;
|
|
57
|
+
}
|
|
58
|
+
function getRxDocumentConstructor(rxCollection) {
|
|
59
|
+
return (0, _index.getFromMapOrCreate)(constructorForCollection, rxCollection, () => (0, _rxDocument.createRxDocumentConstructor)(getDocumentPrototype(rxCollection)));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create a RxDocument-instance from the jsonData
|
|
64
|
+
* and the prototype merge.
|
|
65
|
+
* You should never call this method directly,
|
|
66
|
+
* instead you should get the document from collection._docCache.getCachedRxDocument().
|
|
67
|
+
*/
|
|
68
|
+
function createNewRxDocument(rxCollection, documentConstructor, docData) {
|
|
69
|
+
var doc = (0, _rxDocument.createWithConstructor)(documentConstructor, rxCollection, _overwritable.overwritable.deepFreezeWhenDevMode(docData));
|
|
70
|
+
rxCollection._runHooksSync('post', 'create', docData, doc);
|
|
71
|
+
(0, _hooks.runPluginHooks)('postCreateRxDocument', doc);
|
|
72
|
+
return doc;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* returns the prototype-object
|
|
77
|
+
* that contains the orm-methods,
|
|
78
|
+
* used in the proto-merge
|
|
79
|
+
*/
|
|
80
|
+
function getDocumentOrmPrototype(rxCollection) {
|
|
81
|
+
var proto = {};
|
|
82
|
+
Object.entries(rxCollection.methods).forEach(([k, v]) => {
|
|
83
|
+
proto[k] = v;
|
|
84
|
+
});
|
|
85
|
+
return proto;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=rx-document-prototype-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rx-document-prototype-merge.js","names":["_rxDocument","require","_hooks","_overwritable","_index","constructorForCollection","WeakMap","getDocumentPrototype","rxCollection","schemaProto","schema","ormProto","getDocumentOrmPrototype","baseProto","basePrototype","proto","forEach","obj","props","Object","getOwnPropertyNames","key","desc","getOwnPropertyDescriptor","enumerable","startsWith","endsWith","value","defineProperty","get","bind","configurable","writable","getRxDocumentConstructor","getFromMapOrCreate","createRxDocumentConstructor","createNewRxDocument","documentConstructor","docData","doc","createRxDocumentWithConstructor","overwritable","deepFreezeWhenDevMode","_runHooksSync","runPluginHooks","entries","methods","k","v"],"sources":["../../src/rx-document-prototype-merge.ts"],"sourcesContent":["/**\r\n * For the ORM capabilities,\r\n * we have to merge the document prototype\r\n * with the ORM functions and the data\r\n * We do this iterating over the properties and\r\n * adding them to a new object.\r\n * In the future we should do this by chaining the __proto__ objects\r\n */\r\n\r\nimport type {\r\n RxCollection,\r\n RxDocument,\r\n RxDocumentData\r\n} from './types/index.d.ts';\r\nimport {\r\n createRxDocumentConstructor,\r\n basePrototype,\r\n createWithConstructor as createRxDocumentWithConstructor\r\n} from './rx-document.ts';\r\nimport {\r\n runPluginHooks\r\n} from './hooks.ts';\r\nimport { overwritable } from './overwritable.ts';\r\nimport { getFromMapOrCreate } from './plugins/utils/index.ts';\r\n\r\nconst constructorForCollection = new WeakMap();\r\n\r\nexport function getDocumentPrototype(\r\n rxCollection: RxCollection\r\n): any {\r\n const schemaProto = rxCollection.schema.getDocumentPrototype();\r\n const ormProto = getDocumentOrmPrototype(rxCollection);\r\n const baseProto = basePrototype;\r\n const proto = {};\r\n [\r\n schemaProto,\r\n ormProto,\r\n baseProto\r\n ].forEach(obj => {\r\n const props = Object.getOwnPropertyNames(obj);\r\n props.forEach(key => {\r\n const desc: any = Object.getOwnPropertyDescriptor(obj, key);\r\n /**\r\n * When enumerable is true, it will show on console dir(instance)\r\n * To not pollute the output, only getters and methods are enumerable\r\n */\r\n let enumerable = true;\r\n if (\r\n key.startsWith('_') ||\r\n key.endsWith('_') ||\r\n key.startsWith('$') ||\r\n key.endsWith('$')\r\n ) enumerable = false;\r\n\r\n if (typeof desc.value === 'function') {\r\n // when getting a function, we automatically do a .bind(this)\r\n Object.defineProperty(proto, key, {\r\n get() {\r\n return desc.value.bind(this);\r\n },\r\n enumerable,\r\n configurable: false\r\n });\r\n\r\n } else {\r\n desc.enumerable = enumerable;\r\n desc.configurable = false;\r\n if (desc.writable)\r\n desc.writable = false;\r\n Object.defineProperty(proto, key, desc);\r\n }\r\n });\r\n });\r\n return proto;\r\n}\r\n\r\nexport function getRxDocumentConstructor<RxDocType, ORM>(\r\n rxCollection: RxCollection<RxDocType, ORM>\r\n) {\r\n return getFromMapOrCreate(\r\n constructorForCollection,\r\n rxCollection,\r\n () => createRxDocumentConstructor(\r\n getDocumentPrototype(rxCollection as any)\r\n )\r\n );\r\n}\r\n\r\n/**\r\n * Create a RxDocument-instance from the jsonData\r\n * and the prototype merge.\r\n * You should never call this method directly,\r\n * instead you should get the document from collection._docCache.getCachedRxDocument().\r\n */\r\nexport function createNewRxDocument<RxDocType, ORM, Reactivity>(\r\n rxCollection: RxCollection<RxDocType, ORM, {}, {}, Reactivity>,\r\n documentConstructor: any,\r\n docData: RxDocumentData<RxDocType>\r\n): RxDocument<RxDocType, ORM, Reactivity> {\r\n const doc = createRxDocumentWithConstructor(\r\n documentConstructor,\r\n rxCollection as any,\r\n overwritable.deepFreezeWhenDevMode(docData as any)\r\n );\r\n rxCollection._runHooksSync('post', 'create', docData, doc);\r\n runPluginHooks('postCreateRxDocument', doc);\r\n return doc as any;\r\n}\r\n\r\n\r\n/**\r\n * returns the prototype-object\r\n * that contains the orm-methods,\r\n * used in the proto-merge\r\n */\r\nexport function getDocumentOrmPrototype(rxCollection: RxCollection): any {\r\n const proto: any = {};\r\n Object\r\n .entries(rxCollection.methods)\r\n .forEach(([k, v]) => {\r\n proto[k] = v;\r\n });\r\n return proto;\r\n}\r\n"],"mappings":";;;;;;;;;AAcA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,IAAMI,wBAAwB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAEvC,SAASC,oBAA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EAAEC,IAAI,CAAC;MAC3C;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EACF,OAAOP,KAAK;AAChB;AAEO,SAASkB,wBAAwBA,CACpCzB,YAA0C,EAC5C;EACE,OAAO,IAAA0B,yBAAkB,EACrB7B,wBAAwB,EACxBG,YAAY,EACZ,MAAM,IAAA2B,uCAA2B,EAC7B5B,oBAAoB,CAACC,YAAmB,CAC5C,CACJ,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4B,mBAAmBA,CAC/B5B,YAA8D,EAC9D6B,mBAAwB,EACxBC,OAAkC,EACI;EACtC,IAAMC,GAAG,GAAG,IAAAC,iCAA+B,EACvCH,mBAAmB,EACnB7B,YAAY,EACZiC,0BAAY,CAACC,qBAAqB,CAACJ,OAAc,CACrD,CAAC;EACD9B,YAAY,CAACmC,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAEL,OAAO,EAAEC,GAAG,CAAC;EAC1D,IAAAK,qBAAc,EAAC,sBAAsB,EAAEL,GAAG,CAAC;EAC3C,OAAOA,GAAG;AACd;;AAGA;AACA;AACA;AACA;AACA;AACO,SAAS3B,uBAAuBA,CAACJ,YAA0B,EAAO;EACrE,IAAMO,KAAU,GAAG,CAAC,CAAC;EACrBI,MAAM,CACD0B,OAAO,CAACrC,YAAY,CAACsC,OAAO,CAAC,CAC7B9B,OAAO,CAAC,CAAC,CAAC+B,CAAC,EAAEC,CAAC,CAAC,KAAK;IACjBjC,KAAK,CAACgC,CAAC,CAAC,GAAGC,CAAC;EAChB,CAAC,CAAC;EACN,OAAOjC,KAAK;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.basePrototype = void 0;
|
|
7
|
+
exports.beforeDocumentUpdateWrite = beforeDocumentUpdateWrite;
|
|
8
|
+
exports.createRxDocumentConstructor = createRxDocumentConstructor;
|
|
9
|
+
exports.createWithConstructor = createWithConstructor;
|
|
10
|
+
exports.isRxDocument = isRxDocument;
|
|
11
|
+
var _operators = require("rxjs/operators");
|
|
12
|
+
var _index = require("./plugins/utils/index.js");
|
|
13
|
+
var _rxError = require("./rx-error.js");
|
|
14
|
+
var _hooks = require("./hooks.js");
|
|
15
|
+
var _rxChangeEvent = require("./rx-change-event.js");
|
|
16
|
+
var _overwritable = require("./overwritable.js");
|
|
17
|
+
var _rxSchemaHelper = require("./rx-schema-helper.js");
|
|
18
|
+
var _rxStorageHelper = require("./rx-storage-helper.js");
|
|
19
|
+
var _incrementalWrite = require("./incremental-write.js");
|
|
20
|
+
var basePrototype = exports.basePrototype = {
|
|
21
|
+
get primaryPath() {
|
|
22
|
+
var _this = this;
|
|
23
|
+
if (!_this.isInstanceOfRxDocument) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return _this.collection.schema.primaryPath;
|
|
27
|
+
},
|
|
28
|
+
get primary() {
|
|
29
|
+
var _this = this;
|
|
30
|
+
if (!_this.isInstanceOfRxDocument) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return _this._data[_this.primaryPath];
|
|
34
|
+
},
|
|
35
|
+
get revision() {
|
|
36
|
+
var _this = this;
|
|
37
|
+
if (!_this.isInstanceOfRxDocument) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return _this._data._rev;
|
|
41
|
+
},
|
|
42
|
+
get deleted$() {
|
|
43
|
+
var _this = this;
|
|
44
|
+
if (!_this.isInstanceOfRxDocument) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return _this.$.pipe((0, _operators.map)(d => d._data._deleted));
|
|
48
|
+
},
|
|
49
|
+
get deleted$$() {
|
|
50
|
+
var _this = this;
|
|
51
|
+
var reactivity = _this.collection.database.getReactivityFactory();
|
|
52
|
+
return reactivity.fromObservable(_this.deleted$, _this.getLatest().deleted, _this.collection.database);
|
|
53
|
+
},
|
|
54
|
+
get deleted() {
|
|
55
|
+
var _this = this;
|
|
56
|
+
if (!_this.isInstanceOfRxDocument) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return _this._data._deleted;
|
|
60
|
+
},
|
|
61
|
+
getLatest() {
|
|
62
|
+
var latestDocData = this.collection._docCache.getLatestDocumentData(this.primary);
|
|
63
|
+
return this.collection._docCache.getCachedRxDocument(latestDocData);
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* returns the observable which emits the plain-data of this document
|
|
67
|
+
*/
|
|
68
|
+
get $() {
|
|
69
|
+
var _this = this;
|
|
70
|
+
var id = this.primary;
|
|
71
|
+
return _this.collection.eventBulks$.pipe((0, _operators.filter)(bulk => !bulk.isLocal), (0, _operators.map)(bulk => bulk.events.find(ev => ev.documentId === id)), (0, _operators.filter)(event => !!event), (0, _operators.map)(changeEvent => (0, _rxChangeEvent.getDocumentDataOfRxChangeEvent)((0, _index.ensureNotFalsy)(changeEvent))), (0, _operators.startWith)(_this.collection._docCache.getLatestDocumentData(id)), (0, _operators.distinctUntilChanged)((prev, curr) => prev._rev === curr._rev), (0, _operators.map)(docData => this.collection._docCache.getCachedRxDocument(docData)), (0, _operators.shareReplay)(_index.RXJS_SHARE_REPLAY_DEFAULTS));
|
|
72
|
+
},
|
|
73
|
+
get $$() {
|
|
74
|
+
var _this = this;
|
|
75
|
+
var reactivity = _this.collection.database.getReactivityFactory();
|
|
76
|
+
return reactivity.fromObservable(_this.$, _this.getLatest()._data, _this.collection.database);
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* returns observable of the value of the given path
|
|
80
|
+
*/
|
|
81
|
+
get$(path) {
|
|
82
|
+
if (_overwritable.overwritable.isDevMode()) {
|
|
83
|
+
if (path.includes('.item.')) {
|
|
84
|
+
throw (0, _rxError.newRxError)('DOC1', {
|
|
85
|
+
path
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (path === this.primaryPath) {
|
|
89
|
+
throw (0, _rxError.newRxError)('DOC2');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// final fields cannot be modified and so also not observed
|
|
93
|
+
if (this.collection.schema.finalFields.includes(path)) {
|
|
94
|
+
throw (0, _rxError.newRxError)('DOC3', {
|
|
95
|
+
path
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
var schemaObj = (0, _rxSchemaHelper.getSchemaByObjectPath)(this.collection.schema.jsonSchema, path);
|
|
99
|
+
if (!schemaObj) {
|
|
100
|
+
throw (0, _rxError.newRxError)('DOC4', {
|
|
101
|
+
path
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return this.$.pipe((0, _operators.map)(data => (0, _index.getProperty)(data, path)), (0, _operators.distinctUntilChanged)());
|
|
106
|
+
},
|
|
107
|
+
get$$(path) {
|
|
108
|
+
var obs = this.get$(path);
|
|
109
|
+
var reactivity = this.collection.database.getReactivityFactory();
|
|
110
|
+
return reactivity.fromObservable(obs, this.getLatest().get(path), this.collection.database);
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* populate the given path
|
|
114
|
+
*/
|
|
115
|
+
populate(path) {
|
|
116
|
+
var schemaObj = (0, _rxSchemaHelper.getSchemaByObjectPath)(this.collection.schema.jsonSchema, path);
|
|
117
|
+
var value = this.get(path);
|
|
118
|
+
if (!value) {
|
|
119
|
+
return _index.PROMISE_RESOLVE_NULL;
|
|
120
|
+
}
|
|
121
|
+
if (!schemaObj) {
|
|
122
|
+
throw (0, _rxError.newRxError)('DOC5', {
|
|
123
|
+
path
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (!schemaObj.ref) {
|
|
127
|
+
throw (0, _rxError.newRxError)('DOC6', {
|
|
128
|
+
path,
|
|
129
|
+
schemaObj
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
var refCollection = this.collection.database.collections[schemaObj.ref];
|
|
133
|
+
if (!refCollection) {
|
|
134
|
+
throw (0, _rxError.newRxError)('DOC7', {
|
|
135
|
+
ref: schemaObj.ref,
|
|
136
|
+
path,
|
|
137
|
+
schemaObj
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (schemaObj.type === 'array') {
|
|
141
|
+
return refCollection.findByIds(value).exec().then(res => {
|
|
142
|
+
var valuesIterator = res.values();
|
|
143
|
+
return Array.from(valuesIterator);
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
return refCollection.findOne(value).exec();
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* get data by objectPath
|
|
151
|
+
* @hotPath Performance here is really important,
|
|
152
|
+
* run some tests before changing anything.
|
|
153
|
+
*/
|
|
154
|
+
get(objPath) {
|
|
155
|
+
return getDocumentProperty(this, objPath);
|
|
156
|
+
},
|
|
157
|
+
toJSON(withMetaFields = false) {
|
|
158
|
+
if (!withMetaFields) {
|
|
159
|
+
var data = (0, _index.flatClone)(this._data);
|
|
160
|
+
delete data._rev;
|
|
161
|
+
delete data._attachments;
|
|
162
|
+
delete data._deleted;
|
|
163
|
+
delete data._meta;
|
|
164
|
+
return _overwritable.overwritable.deepFreezeWhenDevMode(data);
|
|
165
|
+
} else {
|
|
166
|
+
return _overwritable.overwritable.deepFreezeWhenDevMode(this._data);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
toMutableJSON(withMetaFields = false) {
|
|
170
|
+
return (0, _index.clone)(this.toJSON(withMetaFields));
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* updates document
|
|
174
|
+
* @overwritten by plugin (optional)
|
|
175
|
+
* @param updateObj mongodb-like syntax
|
|
176
|
+
*/
|
|
177
|
+
update(_updateObj) {
|
|
178
|
+
throw (0, _index.pluginMissing)('update');
|
|
179
|
+
},
|
|
180
|
+
incrementalUpdate(_updateObj) {
|
|
181
|
+
throw (0, _index.pluginMissing)('update');
|
|
182
|
+
},
|
|
183
|
+
updateCRDT(_updateObj) {
|
|
184
|
+
throw (0, _index.pluginMissing)('crdt');
|
|
185
|
+
},
|
|
186
|
+
putAttachment() {
|
|
187
|
+
throw (0, _index.pluginMissing)('attachments');
|
|
188
|
+
},
|
|
189
|
+
putAttachmentBase64() {
|
|
190
|
+
throw (0, _index.pluginMissing)('attachments');
|
|
191
|
+
},
|
|
192
|
+
getAttachment() {
|
|
193
|
+
throw (0, _index.pluginMissing)('attachments');
|
|
194
|
+
},
|
|
195
|
+
allAttachments() {
|
|
196
|
+
throw (0, _index.pluginMissing)('attachments');
|
|
197
|
+
},
|
|
198
|
+
get allAttachments$() {
|
|
199
|
+
throw (0, _index.pluginMissing)('attachments');
|
|
200
|
+
},
|
|
201
|
+
async modify(mutationFunction,
|
|
202
|
+
// used by some plugins that wrap the method
|
|
203
|
+
_context) {
|
|
204
|
+
var oldData = this._data;
|
|
205
|
+
var newData = await (0, _incrementalWrite.modifierFromPublicToInternal)(mutationFunction)(oldData);
|
|
206
|
+
return this._saveData(newData, oldData);
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* runs an incremental update over the document
|
|
210
|
+
* @param function that takes the document-data and returns a new data-object
|
|
211
|
+
*/
|
|
212
|
+
incrementalModify(mutationFunction,
|
|
213
|
+
// used by some plugins that wrap the method
|
|
214
|
+
_context) {
|
|
215
|
+
return this.collection.incrementalWriteQueue.addWrite(this._data, (0, _incrementalWrite.modifierFromPublicToInternal)(mutationFunction)).then(result => this.collection._docCache.getCachedRxDocument(result));
|
|
216
|
+
},
|
|
217
|
+
patch(patch) {
|
|
218
|
+
var oldData = this._data;
|
|
219
|
+
var newData = (0, _index.clone)(oldData);
|
|
220
|
+
Object.entries(patch).forEach(([k, v]) => {
|
|
221
|
+
newData[k] = v;
|
|
222
|
+
});
|
|
223
|
+
return this._saveData(newData, oldData);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* patches the given properties
|
|
227
|
+
*/
|
|
228
|
+
incrementalPatch(patch) {
|
|
229
|
+
return this.incrementalModify(docData => {
|
|
230
|
+
Object.entries(patch).forEach(([k, v]) => {
|
|
231
|
+
docData[k] = v;
|
|
232
|
+
});
|
|
233
|
+
return docData;
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* saves the new document-data
|
|
238
|
+
* and handles the events
|
|
239
|
+
*/
|
|
240
|
+
async _saveData(newData, oldData) {
|
|
241
|
+
newData = (0, _index.flatClone)(newData);
|
|
242
|
+
|
|
243
|
+
// deleted documents cannot be changed
|
|
244
|
+
if (this._data._deleted) {
|
|
245
|
+
throw (0, _rxError.newRxError)('DOC11', {
|
|
246
|
+
id: this.primary,
|
|
247
|
+
document: this
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
await beforeDocumentUpdateWrite(this.collection, newData, oldData);
|
|
251
|
+
var writeRows = [{
|
|
252
|
+
previous: oldData,
|
|
253
|
+
document: newData
|
|
254
|
+
}];
|
|
255
|
+
var writeResult = await this.collection.storageInstance.bulkWrite(writeRows, 'rx-document-save-data');
|
|
256
|
+
var isError = writeResult.error[0];
|
|
257
|
+
(0, _rxStorageHelper.throwIfIsStorageWriteError)(this.collection, this.primary, newData, isError);
|
|
258
|
+
await this.collection._runHooks('post', 'save', newData, this);
|
|
259
|
+
return this.collection._docCache.getCachedRxDocument((0, _rxStorageHelper.getWrittenDocumentsFromBulkWriteResponse)(this.collection.schema.primaryPath, writeRows, writeResult)[0]);
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* Remove the document.
|
|
263
|
+
* Notice that there is no hard delete,
|
|
264
|
+
* instead deleted documents get flagged with _deleted=true.
|
|
265
|
+
*/
|
|
266
|
+
async remove() {
|
|
267
|
+
if (this.deleted) {
|
|
268
|
+
return Promise.reject((0, _rxError.newRxError)('DOC13', {
|
|
269
|
+
document: this,
|
|
270
|
+
id: this.primary
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
var removeResult = await this.collection.bulkRemove([this]);
|
|
274
|
+
if (removeResult.error.length > 0) {
|
|
275
|
+
var error = removeResult.error[0];
|
|
276
|
+
(0, _rxStorageHelper.throwIfIsStorageWriteError)(this.collection, this.primary, this._data, error);
|
|
277
|
+
}
|
|
278
|
+
return removeResult.success[0];
|
|
279
|
+
},
|
|
280
|
+
incrementalRemove() {
|
|
281
|
+
return this.incrementalModify(async docData => {
|
|
282
|
+
await this.collection._runHooks('pre', 'remove', docData, this);
|
|
283
|
+
docData._deleted = true;
|
|
284
|
+
return docData;
|
|
285
|
+
}).then(async newDoc => {
|
|
286
|
+
await this.collection._runHooks('post', 'remove', newDoc._data, newDoc);
|
|
287
|
+
return newDoc;
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
close() {
|
|
291
|
+
throw (0, _rxError.newRxError)('DOC14');
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function createRxDocumentConstructor(proto = basePrototype) {
|
|
295
|
+
var constructor = function RxDocumentConstructor(collection, docData) {
|
|
296
|
+
this.collection = collection;
|
|
297
|
+
|
|
298
|
+
// assume that this is always equal to the doc-data in the database
|
|
299
|
+
this._data = docData;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @performance
|
|
303
|
+
* Lazy-initialize _propertyCache only when first needed
|
|
304
|
+
* instead of creating a new Map for every RxDocument,
|
|
305
|
+
* since many documents (e.g. from query results) may never
|
|
306
|
+
* have their properties accessed via the cache.
|
|
307
|
+
*/
|
|
308
|
+
this._propertyCache = undefined;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* because of the prototype-merge,
|
|
312
|
+
* we can not use the native instanceof operator
|
|
313
|
+
*/
|
|
314
|
+
this.isInstanceOfRxDocument = true;
|
|
315
|
+
};
|
|
316
|
+
constructor.prototype = proto;
|
|
317
|
+
return constructor;
|
|
318
|
+
}
|
|
319
|
+
function createWithConstructor(constructor, collection, jsonData) {
|
|
320
|
+
var doc = new constructor(collection, jsonData);
|
|
321
|
+
(0, _hooks.runPluginHooks)('createRxDocument', doc);
|
|
322
|
+
return doc;
|
|
323
|
+
}
|
|
324
|
+
function isRxDocument(obj) {
|
|
325
|
+
return typeof obj === 'object' && obj !== null && 'isInstanceOfRxDocument' in obj;
|
|
326
|
+
}
|
|
327
|
+
function beforeDocumentUpdateWrite(collection, newData, oldData) {
|
|
328
|
+
/**
|
|
329
|
+
* Meta values must always be merged
|
|
330
|
+
* instead of overwritten.
|
|
331
|
+
* This ensures that different plugins do not overwrite
|
|
332
|
+
* each others meta properties.
|
|
333
|
+
*/
|
|
334
|
+
newData._meta = Object.assign({}, oldData._meta, newData._meta);
|
|
335
|
+
|
|
336
|
+
// ensure modifications are ok
|
|
337
|
+
if (_overwritable.overwritable.isDevMode()) {
|
|
338
|
+
collection.schema.validateChange(oldData, newData);
|
|
339
|
+
}
|
|
340
|
+
return collection._runHooks('pre', 'save', newData, oldData);
|
|
341
|
+
}
|
|
342
|
+
function getDocumentProperty(doc, objPath) {
|
|
343
|
+
/**
|
|
344
|
+
* @performance Lazy-initialize _propertyCache on first access
|
|
345
|
+
* to avoid creating a Map for documents that never use it.
|
|
346
|
+
*/
|
|
347
|
+
if (!doc._propertyCache) {
|
|
348
|
+
doc._propertyCache = new Map();
|
|
349
|
+
}
|
|
350
|
+
return (0, _index.getFromMapOrCreate)(doc._propertyCache, objPath, () => {
|
|
351
|
+
var valueObj = (0, _index.getProperty)(doc._data, objPath);
|
|
352
|
+
|
|
353
|
+
// direct return if array or non-object
|
|
354
|
+
if (typeof valueObj !== 'object' || valueObj === null || Array.isArray(valueObj)) {
|
|
355
|
+
return _overwritable.overwritable.deepFreezeWhenDevMode(valueObj);
|
|
356
|
+
}
|
|
357
|
+
var proxy = new Proxy(
|
|
358
|
+
/**
|
|
359
|
+
* In dev-mode, the _data is deep-frozen
|
|
360
|
+
* so we have to flat clone here so that
|
|
361
|
+
* the proxy can work.
|
|
362
|
+
*/
|
|
363
|
+
(0, _index.flatClone)(valueObj), {
|
|
364
|
+
/**
|
|
365
|
+
* @performance is really important here
|
|
366
|
+
* because people access nested properties very often
|
|
367
|
+
* and might not be aware that this is internally using a Proxy
|
|
368
|
+
*/
|
|
369
|
+
get(target, property) {
|
|
370
|
+
if (typeof property !== 'string') {
|
|
371
|
+
return target[property];
|
|
372
|
+
}
|
|
373
|
+
var lastChar = property.charAt(property.length - 1);
|
|
374
|
+
if (lastChar === '$') {
|
|
375
|
+
if (property.endsWith('$$')) {
|
|
376
|
+
var key = property.slice(0, -2);
|
|
377
|
+
return doc.get$$((0, _index.trimDots)(objPath + '.' + key));
|
|
378
|
+
} else {
|
|
379
|
+
var _key = property.slice(0, -1);
|
|
380
|
+
return doc.get$((0, _index.trimDots)(objPath + '.' + _key));
|
|
381
|
+
}
|
|
382
|
+
} else if (lastChar === '_') {
|
|
383
|
+
var _key2 = property.slice(0, -1);
|
|
384
|
+
return doc.populate((0, _index.trimDots)(objPath + '.' + _key2));
|
|
385
|
+
} else {
|
|
386
|
+
/**
|
|
387
|
+
* Performance shortcut
|
|
388
|
+
* In most cases access to nested properties
|
|
389
|
+
* will only access simple values which can be directly returned
|
|
390
|
+
* without creating a new Proxy or utilizing the cache.
|
|
391
|
+
*/
|
|
392
|
+
var plainValue = target[property];
|
|
393
|
+
if (typeof plainValue === 'number' || typeof plainValue === 'string' || typeof plainValue === 'boolean') {
|
|
394
|
+
return plainValue;
|
|
395
|
+
}
|
|
396
|
+
return getDocumentProperty(doc, (0, _index.trimDots)(objPath + '.' + property));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
return proxy;
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
;
|
|
404
|
+
//# sourceMappingURL=rx-document.js.map
|