@connecttomahdi/rxdb 17.0.0-beta.17 → 17.1.0
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 +4 -0
- package/CHANGELOG.md +47 -4
- package/CLAUDE.md +2 -0
- package/dist/cjs/change-event-buffer.js +2 -1
- package/dist/cjs/change-event-buffer.js.map +1 -1
- package/dist/cjs/custom-index.js +85 -12
- package/dist/cjs/custom-index.js.map +1 -1
- package/dist/cjs/doc-cache.js +117 -35
- package/dist/cjs/doc-cache.js.map +1 -1
- package/dist/cjs/event-reduce.js +10 -1
- package/dist/cjs/event-reduce.js.map +1 -1
- package/dist/cjs/plugin-helpers.js +16 -0
- package/dist/cjs/plugin-helpers.js.map +1 -1
- package/dist/cjs/plugins/attachments/index.js +3 -3
- package/dist/cjs/plugins/attachments/index.js.map +1 -1
- package/dist/cjs/plugins/cleanup/cleanup.js +5 -3
- package/dist/cjs/plugins/cleanup/cleanup.js.map +1 -1
- package/dist/cjs/plugins/crdt/index.js +52 -0
- package/dist/cjs/plugins/crdt/index.js.map +1 -1
- package/dist/cjs/plugins/dev-mode/check-query.js +7 -1
- package/dist/cjs/plugins/dev-mode/check-query.js.map +1 -1
- package/dist/cjs/plugins/dev-mode/check-schema.js +2 -1
- package/dist/cjs/plugins/dev-mode/check-schema.js.map +1 -1
- package/dist/cjs/plugins/dev-mode/error-messages.js +43 -5
- package/dist/cjs/plugins/dev-mode/error-messages.js.map +1 -1
- package/dist/cjs/plugins/encryption-crypto-js/index.js +22 -6
- package/dist/cjs/plugins/encryption-crypto-js/index.js.map +1 -1
- package/dist/cjs/plugins/leader-election/index.js +5 -5
- package/dist/cjs/plugins/leader-election/index.js.map +1 -1
- package/dist/cjs/plugins/local-documents/local-documents.js +20 -13
- package/dist/cjs/plugins/local-documents/local-documents.js.map +1 -1
- package/dist/cjs/plugins/migration-schema/migration-helpers.js +3 -0
- package/dist/cjs/plugins/migration-schema/migration-helpers.js.map +1 -1
- package/dist/cjs/plugins/migration-schema/rx-migration-state.js +1 -1
- package/dist/cjs/plugins/migration-schema/rx-migration-state.js.map +1 -1
- package/dist/cjs/plugins/pipeline/rx-pipeline.js +5 -1
- package/dist/cjs/plugins/pipeline/rx-pipeline.js.map +1 -1
- package/dist/cjs/plugins/query-builder/mquery/nosql-query-builder.js +4 -2
- package/dist/cjs/plugins/query-builder/mquery/nosql-query-builder.js.map +1 -1
- package/dist/cjs/plugins/replication/index.js +40 -2
- package/dist/cjs/plugins/replication/index.js.map +1 -1
- package/dist/cjs/plugins/replication-google-drive/document-handling.js +17 -6
- package/dist/cjs/plugins/replication-google-drive/document-handling.js.map +1 -1
- package/dist/cjs/plugins/replication-google-drive/google-drive-helper.js +1 -1
- package/dist/cjs/plugins/replication-google-drive/google-drive-helper.js.map +1 -1
- package/dist/cjs/plugins/replication-google-drive/google-drive-types.js.map +1 -1
- package/dist/cjs/plugins/replication-google-drive/signaling.js +4 -1
- package/dist/cjs/plugins/replication-google-drive/signaling.js.map +1 -1
- package/dist/cjs/plugins/replication-google-drive/upstream.js +7 -4
- package/dist/cjs/plugins/replication-google-drive/upstream.js.map +1 -1
- package/dist/cjs/plugins/replication-microsoft-onedrive/signaling.js +4 -1
- package/dist/cjs/plugins/replication-microsoft-onedrive/signaling.js.map +1 -1
- package/dist/cjs/plugins/state/rx-state.js +14 -3
- package/dist/cjs/plugins/state/rx-state.js.map +1 -1
- package/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js +10 -17
- package/dist/cjs/plugins/storage-dexie/rx-storage-instance-dexie.js.map +1 -1
- package/dist/cjs/plugins/storage-memory/binary-search-bounds.js +112 -40
- package/dist/cjs/plugins/storage-memory/binary-search-bounds.js.map +1 -1
- package/dist/cjs/plugins/storage-memory/memory-helper.js +127 -40
- package/dist/cjs/plugins/storage-memory/memory-helper.js.map +1 -1
- package/dist/cjs/plugins/storage-memory/memory-indexes.js +1 -0
- package/dist/cjs/plugins/storage-memory/memory-indexes.js.map +1 -1
- package/dist/cjs/plugins/storage-memory/memory-types.js.map +1 -1
- package/dist/cjs/plugins/storage-memory/rx-storage-instance-memory.js +97 -37
- package/dist/cjs/plugins/storage-memory/rx-storage-instance-memory.js.map +1 -1
- package/dist/cjs/plugins/storage-mongodb/mongodb-helper.js +42 -1
- package/dist/cjs/plugins/storage-mongodb/mongodb-helper.js.map +1 -1
- package/dist/cjs/plugins/storage-mongodb/rx-storage-instance-mongodb.js +7 -7
- package/dist/cjs/plugins/storage-mongodb/rx-storage-instance-mongodb.js.map +1 -1
- package/dist/cjs/plugins/test-utils/config.js +1 -1
- package/dist/cjs/plugins/test-utils/config.js.map +1 -1
- package/dist/cjs/plugins/test-utils/performance.js +122 -92
- package/dist/cjs/plugins/test-utils/performance.js.map +1 -1
- package/dist/cjs/plugins/test-utils/schema-objects.js +1 -1
- package/dist/cjs/plugins/test-utils/schema-objects.js.map +1 -1
- package/dist/cjs/plugins/test-utils/test-util.js +62 -0
- package/dist/cjs/plugins/test-utils/test-util.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-map.js +2 -2
- package/dist/cjs/plugins/utils/utils-map.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-object-deep-equal.js +3 -2
- package/dist/cjs/plugins/utils/utils-object-deep-equal.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-object-dot-prop.js +25 -0
- package/dist/cjs/plugins/utils/utils-object-dot-prop.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-object.js +102 -27
- package/dist/cjs/plugins/utils/utils-object.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-other.js +9 -4
- package/dist/cjs/plugins/utils/utils-other.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-premium.js +1 -19
- package/dist/cjs/plugins/utils/utils-premium.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-revision.js +20 -10
- package/dist/cjs/plugins/utils/utils-revision.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-rxdb-version.js +1 -1
- package/dist/cjs/plugins/utils/utils-rxdb-version.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-string.js +11 -8
- package/dist/cjs/plugins/utils/utils-string.js.map +1 -1
- package/dist/cjs/plugins/utils/utils-time.js +21 -16
- package/dist/cjs/plugins/utils/utils-time.js.map +1 -1
- package/dist/cjs/query-cache.js +6 -4
- package/dist/cjs/query-cache.js.map +1 -1
- package/dist/cjs/query-planner.js +2 -2
- package/dist/cjs/query-planner.js.map +1 -1
- package/dist/cjs/replication-protocol/downstream.js +1 -1
- package/dist/cjs/replication-protocol/downstream.js.map +1 -1
- package/dist/cjs/rx-collection-helper.js +11 -6
- package/dist/cjs/rx-collection-helper.js.map +1 -1
- package/dist/cjs/rx-collection.js +34 -6
- package/dist/cjs/rx-collection.js.map +1 -1
- package/dist/cjs/rx-database.js +40 -7
- package/dist/cjs/rx-database.js.map +1 -1
- package/dist/cjs/rx-document.js +10 -3
- package/dist/cjs/rx-document.js.map +1 -1
- package/dist/cjs/rx-query-helper.js +35 -12
- package/dist/cjs/rx-query-helper.js.map +1 -1
- package/dist/cjs/rx-query-single-result.js +9 -2
- package/dist/cjs/rx-query-single-result.js.map +1 -1
- package/dist/cjs/rx-query.js +72 -29
- package/dist/cjs/rx-query.js.map +1 -1
- package/dist/cjs/rx-schema-helper.js +9 -3
- package/dist/cjs/rx-schema-helper.js.map +1 -1
- package/dist/cjs/rx-schema.js +1 -0
- package/dist/cjs/rx-schema.js.map +1 -1
- package/dist/cjs/rx-storage-helper.js +212 -129
- package/dist/cjs/rx-storage-helper.js.map +1 -1
- package/dist/cjs/types/rx-error.d.js.map +1 -1
- package/dist/cjs/types/rx-schema.d.js.map +1 -1
- package/dist/esm/change-event-buffer.js +2 -1
- package/dist/esm/change-event-buffer.js.map +1 -1
- package/dist/esm/custom-index.js +85 -12
- package/dist/esm/custom-index.js.map +1 -1
- package/dist/esm/doc-cache.js +118 -36
- package/dist/esm/doc-cache.js.map +1 -1
- package/dist/esm/event-reduce.js +10 -1
- package/dist/esm/event-reduce.js.map +1 -1
- package/dist/esm/plugin-helpers.js +16 -0
- package/dist/esm/plugin-helpers.js.map +1 -1
- package/dist/esm/plugins/attachments/index.js +3 -3
- package/dist/esm/plugins/attachments/index.js.map +1 -1
- package/dist/esm/plugins/cleanup/cleanup.js +5 -3
- package/dist/esm/plugins/cleanup/cleanup.js.map +1 -1
- package/dist/esm/plugins/crdt/index.js +52 -0
- package/dist/esm/plugins/crdt/index.js.map +1 -1
- package/dist/esm/plugins/dev-mode/check-query.js +7 -1
- package/dist/esm/plugins/dev-mode/check-query.js.map +1 -1
- package/dist/esm/plugins/dev-mode/check-schema.js +2 -1
- package/dist/esm/plugins/dev-mode/check-schema.js.map +1 -1
- package/dist/esm/plugins/dev-mode/error-messages.js +43 -5
- package/dist/esm/plugins/dev-mode/error-messages.js.map +1 -1
- package/dist/esm/plugins/encryption-crypto-js/index.js +22 -6
- package/dist/esm/plugins/encryption-crypto-js/index.js.map +1 -1
- package/dist/esm/plugins/leader-election/index.js +4 -4
- package/dist/esm/plugins/leader-election/index.js.map +1 -1
- package/dist/esm/plugins/local-documents/local-documents.js +20 -13
- package/dist/esm/plugins/local-documents/local-documents.js.map +1 -1
- package/dist/esm/plugins/migration-schema/migration-helpers.js +3 -0
- package/dist/esm/plugins/migration-schema/migration-helpers.js.map +1 -1
- package/dist/esm/plugins/migration-schema/rx-migration-state.js +1 -1
- package/dist/esm/plugins/migration-schema/rx-migration-state.js.map +1 -1
- package/dist/esm/plugins/pipeline/rx-pipeline.js +5 -1
- package/dist/esm/plugins/pipeline/rx-pipeline.js.map +1 -1
- package/dist/esm/plugins/query-builder/mquery/nosql-query-builder.js +4 -2
- package/dist/esm/plugins/query-builder/mquery/nosql-query-builder.js.map +1 -1
- package/dist/esm/plugins/replication/index.js +40 -2
- package/dist/esm/plugins/replication/index.js.map +1 -1
- package/dist/esm/plugins/replication-google-drive/document-handling.js +17 -6
- package/dist/esm/plugins/replication-google-drive/document-handling.js.map +1 -1
- package/dist/esm/plugins/replication-google-drive/google-drive-helper.js +1 -1
- package/dist/esm/plugins/replication-google-drive/google-drive-helper.js.map +1 -1
- package/dist/esm/plugins/replication-google-drive/google-drive-types.js.map +1 -1
- package/dist/esm/plugins/replication-google-drive/signaling.js +4 -1
- package/dist/esm/plugins/replication-google-drive/signaling.js.map +1 -1
- package/dist/esm/plugins/replication-google-drive/upstream.js +7 -4
- package/dist/esm/plugins/replication-google-drive/upstream.js.map +1 -1
- package/dist/esm/plugins/replication-microsoft-onedrive/signaling.js +4 -1
- package/dist/esm/plugins/replication-microsoft-onedrive/signaling.js.map +1 -1
- package/dist/esm/plugins/state/rx-state.js +15 -4
- package/dist/esm/plugins/state/rx-state.js.map +1 -1
- package/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js +11 -18
- package/dist/esm/plugins/storage-dexie/rx-storage-instance-dexie.js.map +1 -1
- package/dist/esm/plugins/storage-memory/binary-search-bounds.js +107 -40
- package/dist/esm/plugins/storage-memory/binary-search-bounds.js.map +1 -1
- package/dist/esm/plugins/storage-memory/memory-helper.js +128 -41
- package/dist/esm/plugins/storage-memory/memory-helper.js.map +1 -1
- package/dist/esm/plugins/storage-memory/memory-indexes.js +1 -0
- package/dist/esm/plugins/storage-memory/memory-indexes.js.map +1 -1
- package/dist/esm/plugins/storage-memory/memory-types.js.map +1 -1
- package/dist/esm/plugins/storage-memory/rx-storage-instance-memory.js +90 -30
- package/dist/esm/plugins/storage-memory/rx-storage-instance-memory.js.map +1 -1
- package/dist/esm/plugins/storage-mongodb/mongodb-helper.js +39 -0
- package/dist/esm/plugins/storage-mongodb/mongodb-helper.js.map +1 -1
- package/dist/esm/plugins/storage-mongodb/rx-storage-instance-mongodb.js +8 -8
- package/dist/esm/plugins/storage-mongodb/rx-storage-instance-mongodb.js.map +1 -1
- package/dist/esm/plugins/test-utils/config.js +1 -1
- package/dist/esm/plugins/test-utils/config.js.map +1 -1
- package/dist/esm/plugins/test-utils/performance.js +122 -92
- package/dist/esm/plugins/test-utils/performance.js.map +1 -1
- package/dist/esm/plugins/test-utils/schema-objects.js +1 -1
- package/dist/esm/plugins/test-utils/schema-objects.js.map +1 -1
- package/dist/esm/plugins/test-utils/test-util.js +59 -0
- package/dist/esm/plugins/test-utils/test-util.js.map +1 -1
- package/dist/esm/plugins/utils/utils-map.js +2 -2
- package/dist/esm/plugins/utils/utils-map.js.map +1 -1
- package/dist/esm/plugins/utils/utils-object-deep-equal.js +3 -2
- package/dist/esm/plugins/utils/utils-object-deep-equal.js.map +1 -1
- package/dist/esm/plugins/utils/utils-object-dot-prop.js +25 -0
- package/dist/esm/plugins/utils/utils-object-dot-prop.js.map +1 -1
- package/dist/esm/plugins/utils/utils-object.js +102 -27
- package/dist/esm/plugins/utils/utils-object.js.map +1 -1
- package/dist/esm/plugins/utils/utils-other.js +9 -4
- package/dist/esm/plugins/utils/utils-other.js.map +1 -1
- package/dist/esm/plugins/utils/utils-premium.js +1 -19
- package/dist/esm/plugins/utils/utils-premium.js.map +1 -1
- package/dist/esm/plugins/utils/utils-revision.js +20 -10
- package/dist/esm/plugins/utils/utils-revision.js.map +1 -1
- package/dist/esm/plugins/utils/utils-rxdb-version.js +1 -1
- package/dist/esm/plugins/utils/utils-rxdb-version.js.map +1 -1
- package/dist/esm/plugins/utils/utils-string.js +11 -8
- package/dist/esm/plugins/utils/utils-string.js.map +1 -1
- package/dist/esm/plugins/utils/utils-time.js +21 -16
- package/dist/esm/plugins/utils/utils-time.js.map +1 -1
- package/dist/esm/query-cache.js +7 -5
- package/dist/esm/query-cache.js.map +1 -1
- package/dist/esm/query-planner.js +2 -2
- package/dist/esm/query-planner.js.map +1 -1
- package/dist/esm/replication-protocol/downstream.js +1 -1
- package/dist/esm/replication-protocol/downstream.js.map +1 -1
- package/dist/esm/rx-collection-helper.js +12 -7
- package/dist/esm/rx-collection-helper.js.map +1 -1
- package/dist/esm/rx-collection.js +35 -7
- package/dist/esm/rx-collection.js.map +1 -1
- package/dist/esm/rx-database.js +40 -7
- package/dist/esm/rx-database.js.map +1 -1
- package/dist/esm/rx-document.js +11 -4
- package/dist/esm/rx-document.js.map +1 -1
- package/dist/esm/rx-query-helper.js +35 -12
- package/dist/esm/rx-query-helper.js.map +1 -1
- package/dist/esm/rx-query-single-result.js +10 -3
- package/dist/esm/rx-query-single-result.js.map +1 -1
- package/dist/esm/rx-query.js +72 -29
- package/dist/esm/rx-query.js.map +1 -1
- package/dist/esm/rx-schema-helper.js +9 -3
- package/dist/esm/rx-schema-helper.js.map +1 -1
- package/dist/esm/rx-schema.js +1 -0
- package/dist/esm/rx-schema.js.map +1 -1
- package/dist/esm/rx-storage-helper.js +176 -94
- package/dist/esm/rx-storage-helper.js.map +1 -1
- package/dist/esm/types/rx-error.d.js.map +1 -1
- package/dist/esm/types/rx-schema.d.js.map +1 -1
- package/dist/types/custom-index.d.ts +5 -0
- package/dist/types/doc-cache.d.ts +1 -1
- package/dist/types/index.d.ts +25 -26
- package/dist/types/plugins/dev-mode/error-messages.d.ts +36 -0
- package/dist/types/plugins/leader-election/index.d.ts +1 -0
- package/dist/types/plugins/replication-google-drive/document-handling.d.ts +4 -1
- package/dist/types/plugins/replication-google-drive/google-drive-types.d.ts +1 -0
- package/dist/types/plugins/state/rx-state.d.ts +1 -1
- package/dist/types/plugins/storage-denokv/index.d.ts +1 -1
- package/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts +1 -1
- package/dist/types/plugins/storage-localstorage/index.d.ts +1 -1
- package/dist/types/plugins/storage-memory/binary-search-bounds.d.ts +21 -10
- package/dist/types/plugins/storage-memory/memory-helper.d.ts +7 -3
- package/dist/types/plugins/storage-memory/memory-types.d.ts +5 -0
- package/dist/types/plugins/storage-mongodb/mongodb-helper.d.ts +9 -1
- package/dist/types/plugins/storage-mongodb/rx-storage-instance-mongodb.d.ts +2 -2
- package/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts +1 -1
- package/dist/types/plugins/storage-remote/rx-storage-remote.d.ts +1 -1
- package/dist/types/plugins/storage-sqlite/index.d.ts +1 -1
- package/dist/types/plugins/test-utils/performance.d.ts +36 -0
- package/dist/types/plugins/test-utils/test-util.d.ts +17 -0
- package/dist/types/plugins/utils/utils-object.d.ts +8 -3
- package/dist/types/plugins/utils/utils-premium.d.ts +0 -2
- package/dist/types/plugins/utils/utils-rxdb-version.d.ts +1 -1
- package/dist/types/rx-database.d.ts +1 -1
- package/dist/types/rx-query-single-result.d.ts +1 -1
- package/dist/types/rx-query.d.ts +3 -2
- package/dist/types/rx-storage-helper.d.ts +15 -0
- package/eslint.config.mjs +2 -1
- package/package.json +732 -729
- package/scripts/check-code-block-line-length.js +91 -0
- package/scripts/check-em-dashes.js +53 -0
- package/scripts/docs-fetch-git-history.mjs +36 -0
- package/scripts/install-foundationdb.sh +0 -6
- package/scripts/notify-indexnow.mjs +171 -0
- package/scripts/start-foundationdb-docker.sh +73 -0
- package/src/change-event-buffer.ts +4 -1
- package/src/custom-index.ts +93 -16
- package/src/doc-cache.ts +117 -41
- package/src/event-reduce.ts +10 -1
- package/src/plugin-helpers.ts +10 -0
- package/src/plugins/attachments/index.ts +10 -12
- package/src/plugins/cleanup/cleanup.ts +5 -3
- package/src/plugins/crdt/index.ts +55 -0
- package/src/plugins/dev-mode/check-query.ts +7 -1
- package/src/plugins/dev-mode/check-schema.ts +2 -1
- package/src/plugins/dev-mode/error-messages.ts +45 -5
- package/src/plugins/encryption-crypto-js/index.ts +18 -6
- package/src/plugins/leader-election/index.ts +9 -8
- package/src/plugins/local-documents/local-documents.ts +21 -12
- package/src/plugins/migration-schema/migration-helpers.ts +3 -0
- package/src/plugins/migration-schema/rx-migration-state.ts +1 -1
- package/src/plugins/pipeline/rx-pipeline.ts +5 -1
- package/src/plugins/query-builder/mquery/nosql-query-builder.ts +8 -2
- package/src/plugins/replication/index.ts +41 -3
- package/src/plugins/replication-google-drive/document-handling.ts +17 -5
- package/src/plugins/replication-google-drive/google-drive-helper.ts +1 -1
- package/src/plugins/replication-google-drive/google-drive-types.ts +1 -0
- package/src/plugins/replication-google-drive/signaling.ts +4 -1
- package/src/plugins/replication-google-drive/upstream.ts +7 -4
- package/src/plugins/replication-microsoft-onedrive/signaling.ts +4 -1
- package/src/plugins/state/rx-state.ts +17 -5
- package/src/plugins/storage-dexie/rx-storage-instance-dexie.ts +0 -27
- package/src/plugins/storage-memory/binary-search-bounds.ts +105 -40
- package/src/plugins/storage-memory/memory-helper.ts +158 -67
- package/src/plugins/storage-memory/memory-indexes.ts +1 -0
- package/src/plugins/storage-memory/memory-types.ts +5 -0
- package/src/plugins/storage-memory/rx-storage-instance-memory.ts +104 -53
- package/src/plugins/storage-mongodb/mongodb-helper.ts +43 -1
- package/src/plugins/storage-mongodb/rx-storage-instance-mongodb.ts +11 -9
- package/src/plugins/test-utils/config.ts +2 -1
- package/src/plugins/test-utils/performance.ts +159 -85
- package/src/plugins/test-utils/schema-objects.ts +1 -1
- package/src/plugins/test-utils/test-util.ts +71 -0
- package/src/plugins/utils/utils-map.ts +2 -2
- package/src/plugins/utils/utils-object-deep-equal.ts +2 -4
- package/src/plugins/utils/utils-object-dot-prop.ts +25 -0
- package/src/plugins/utils/utils-object.ts +103 -28
- package/src/plugins/utils/utils-other.ts +9 -4
- package/src/plugins/utils/utils-premium.ts +11 -37
- package/src/plugins/utils/utils-revision.ts +20 -9
- package/src/plugins/utils/utils-rxdb-version.ts +1 -1
- package/src/plugins/utils/utils-string.ts +11 -9
- package/src/plugins/utils/utils-time.ts +21 -17
- package/src/query-cache.ts +6 -5
- package/src/query-planner.ts +2 -2
- package/src/replication-protocol/downstream.ts +1 -1
- package/src/rx-collection-helper.ts +12 -6
- package/src/rx-collection.ts +39 -8
- package/src/rx-database.ts +49 -17
- package/src/rx-document.ts +12 -3
- package/src/rx-query-helper.ts +36 -15
- package/src/rx-query-single-result.ts +10 -3
- package/src/rx-query.ts +48 -8
- package/src/rx-schema-helper.ts +7 -4
- package/src/rx-schema.ts +1 -0
- package/src/rx-storage-helper.ts +210 -139
- package/src/types/rx-error.d.ts +3 -0
- package/src/types/rx-schema.d.ts +5 -0
- package/dist/esm/package.json +0 -1
- package/dist/types/types/conflict-handling.d.ts +0 -48
- package/dist/types/types/couchdb.d.ts +0 -293
- package/dist/types/types/index.d.ts +0 -32
- package/dist/types/types/modules/index.d.ts +0 -0
- package/dist/types/types/modules/mocha.parallel.d.ts +0 -1
- package/dist/types/types/plugins/backup.d.ts +0 -35
- package/dist/types/types/plugins/cleanup.d.ts +0 -38
- package/dist/types/types/plugins/crdt.d.ts +0 -76
- package/dist/types/types/plugins/dexie.d.ts +0 -30
- package/dist/types/types/plugins/local-documents.d.ts +0 -49
- package/dist/types/types/plugins/migration.d.ts +0 -14
- package/dist/types/types/plugins/reactivity.d.ts +0 -40
- package/dist/types/types/plugins/replication-graphql.d.ts +0 -98
- package/dist/types/types/plugins/replication.d.ts +0 -175
- package/dist/types/types/plugins/state.d.ts +0 -4
- package/dist/types/types/plugins/update.d.ts +0 -23
- package/dist/types/types/plugins/webmcp.d.ts +0 -40
- package/dist/types/types/query-planner.d.ts +0 -47
- package/dist/types/types/replication-protocol.d.ts +0 -296
- package/dist/types/types/rx-attachment.d.ts +0 -46
- package/dist/types/types/rx-change-event.d.ts +0 -85
- package/dist/types/types/rx-collection.d.ts +0 -117
- package/dist/types/types/rx-database-internal-store.d.ts +0 -54
- package/dist/types/types/rx-database.d.ts +0 -124
- package/dist/types/types/rx-document.d.ts +0 -160
- package/dist/types/types/rx-error.d.ts +0 -222
- package/dist/types/types/rx-plugin.d.ts +0 -167
- package/dist/types/types/rx-query.d.ts +0 -144
- package/dist/types/types/rx-schema.d.ts +0 -209
- package/dist/types/types/rx-storage.d.ts +0 -347
- package/dist/types/types/rx-storage.interface.d.ts +0 -312
- package/dist/types/types/util.d.ts +0 -180
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
BulkWriteRow,
|
|
3
|
-
EventBulk,
|
|
4
|
-
RxDocumentData,
|
|
5
|
-
RxStorageBulkWriteResponse,
|
|
6
|
-
RxStorageChangeEvent,
|
|
7
|
-
RxStorageCountResult,
|
|
8
|
-
RxStorageInstanceCreationParams,
|
|
9
|
-
RxStorageQueryResult
|
|
10
|
-
} from './rx-storage.ts';
|
|
11
|
-
import type {
|
|
12
|
-
MangoQuerySelector,
|
|
13
|
-
MangoQuerySortPart,
|
|
14
|
-
RxJsonSchema,
|
|
15
|
-
RxQueryPlan
|
|
16
|
-
} from './index.d.ts';
|
|
17
|
-
import type {
|
|
18
|
-
Observable
|
|
19
|
-
} from 'rxjs';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* RxStorage
|
|
23
|
-
* This is an interface that abstracts the storage engine.
|
|
24
|
-
* This allows us to use RxDB with different storage engines.
|
|
25
|
-
*
|
|
26
|
-
* @link https://rxdb.info/rx-storage.html
|
|
27
|
-
* @link https://github.com/pubkey/rxdb/issues/1636
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A RxStorage is a module that acts
|
|
32
|
-
* as a factory that can create multiple RxStorageInstance
|
|
33
|
-
* objects.
|
|
34
|
-
*
|
|
35
|
-
* All data inputs and outputs of a StorageInstance must be structured-cloneable.
|
|
36
|
-
* Document data must be plain JSON objects. Attachment data uses Blob.
|
|
37
|
-
* Do not use Map, Set or anything else that is not structured-cloneable.
|
|
38
|
-
* This will ensure that the storage can exchange data
|
|
39
|
-
* when it is a WebWorker or a WASM process or data is send via BroadcastChannel.
|
|
40
|
-
* The only exception is the WebSocket transport, which serializes at its boundary.
|
|
41
|
-
*/
|
|
42
|
-
export interface RxStorage<Internals, InstanceCreationOptions> {
|
|
43
|
-
/**
|
|
44
|
-
* name of the storage engine
|
|
45
|
-
* used to detect if plugins do not work so we can throw proper errors.
|
|
46
|
-
*/
|
|
47
|
-
readonly name: string;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* RxDB version is part of the storage
|
|
51
|
-
* so we can have fallbacks and stuff when
|
|
52
|
-
* multiple storages with different version are in use
|
|
53
|
-
* like in the storage migration plugin.
|
|
54
|
-
*/
|
|
55
|
-
readonly rxdbVersion: string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Creates a storage instance
|
|
59
|
-
* that can contain the NoSQL documents of a collection.
|
|
60
|
-
*/
|
|
61
|
-
createStorageInstance<RxDocType>(
|
|
62
|
-
params: RxStorageInstanceCreationParams<RxDocType, InstanceCreationOptions>
|
|
63
|
-
): Promise<RxStorageInstance<RxDocType, Internals, InstanceCreationOptions>>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* User provided mango queries will be filled up by RxDB via normalizeMangoQuery()
|
|
69
|
-
* so we do not have to do many if-field-exist tests in the internals.
|
|
70
|
-
*/
|
|
71
|
-
export type FilledMangoQuery<RxDocType> = {
|
|
72
|
-
/**
|
|
73
|
-
* The selector is required here.
|
|
74
|
-
*/
|
|
75
|
-
selector: MangoQuerySelector<RxDocumentData<RxDocType>>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* In contrast to the user-provided MangoQuery,
|
|
79
|
-
* the sorting is required here because
|
|
80
|
-
* RxDB has to ensure that the primary key is always
|
|
81
|
-
* part of the sort params.
|
|
82
|
-
*/
|
|
83
|
-
sort: MangoQuerySortPart<RxDocumentData<RxDocType>>[];
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* In the normalized mango query,
|
|
87
|
-
* the index must always be a string[],
|
|
88
|
-
* never just a string.
|
|
89
|
-
* This makes it easier to use the query because
|
|
90
|
-
* we do not have to do an array check.
|
|
91
|
-
*/
|
|
92
|
-
index?: string[];
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Skip must be set which defaults to 0
|
|
96
|
-
*/
|
|
97
|
-
skip: number;
|
|
98
|
-
|
|
99
|
-
limit?: number;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Before sending a query to the storageInstance.query()
|
|
105
|
-
* we run it through the query planner and do some normalization
|
|
106
|
-
* stuff. Notice that the queryPlan is a hint for the storage and
|
|
107
|
-
* it is not required to use it when running queries. Some storages
|
|
108
|
-
* might use their own query planning instead.
|
|
109
|
-
*/
|
|
110
|
-
export type PreparedQuery<RxDocType> = {
|
|
111
|
-
// original query from the input
|
|
112
|
-
query: FilledMangoQuery<RxDocType>;
|
|
113
|
-
queryPlan: RxQueryPlan;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export interface RxStorageInstance<
|
|
117
|
-
/**
|
|
118
|
-
* The type of the documents that can be stored in this instance.
|
|
119
|
-
* All documents in an instance must comply to the same schema.
|
|
120
|
-
* Also all documents are RxDocumentData with the meta properties like
|
|
121
|
-
* _deleted or _rev etc.
|
|
122
|
-
*/
|
|
123
|
-
RxDocType,
|
|
124
|
-
Internals,
|
|
125
|
-
InstanceCreationOptions,
|
|
126
|
-
CheckpointType = any
|
|
127
|
-
> {
|
|
128
|
-
readonly databaseName: string;
|
|
129
|
-
/**
|
|
130
|
-
* Returns the internal data that is used by the storage engine.
|
|
131
|
-
*/
|
|
132
|
-
readonly internals: Readonly<Internals>;
|
|
133
|
-
readonly options: Readonly<InstanceCreationOptions>;
|
|
134
|
-
/**
|
|
135
|
-
* The schema that defines the documents that are stored in this instance.
|
|
136
|
-
* Notice that the schema must be enhanced with the meta properties like
|
|
137
|
-
* _meta, _rev and _deleted etc. which are added by fillWithDefaultSettings()
|
|
138
|
-
*/
|
|
139
|
-
readonly schema: Readonly<RxJsonSchema<RxDocumentData<RxDocType>>>;
|
|
140
|
-
readonly collectionName: string;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* (Optional) reference to the underlying persistent storage instance.
|
|
144
|
-
* If set, things like replication will run on that storageInstance instead of the parent.
|
|
145
|
-
* This is mostly used in things like the memory-synced storage where we want to
|
|
146
|
-
* run replications and migrations on the persistent storage instead of the in-memory storage.
|
|
147
|
-
*
|
|
148
|
-
* Having this is the least hacky option. The only other option would be to toggle all calls to the
|
|
149
|
-
* storageInstance by checking the givent context-string. But this would make it impossible
|
|
150
|
-
* to run a replication on the parentStorage itself.
|
|
151
|
-
*/
|
|
152
|
-
readonly underlyingPersistentStorage?: RxStorageInstance<RxDocType, any, any, any>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Writes multiple documents to the storage instance.
|
|
156
|
-
* The write for each single document is atomic, there
|
|
157
|
-
* is no transaction around all documents.
|
|
158
|
-
* The written documents must be the newest revision of that documents data.
|
|
159
|
-
* If the previous document is not the current newest revision, a conflict error
|
|
160
|
-
* must be returned.
|
|
161
|
-
* It must be possible that some document writes succeed
|
|
162
|
-
* and others error. We need this to have a similar behavior as most NoSQL databases.
|
|
163
|
-
*/
|
|
164
|
-
bulkWrite(
|
|
165
|
-
documentWrites: BulkWriteRow<RxDocType>[],
|
|
166
|
-
/**
|
|
167
|
-
* Context will be used in all
|
|
168
|
-
* changeStream()-events that are emitted as a result
|
|
169
|
-
* of that bulkWrite() operation.
|
|
170
|
-
* Used in plugins so that we can detect that event X
|
|
171
|
-
* comes from operation Y.
|
|
172
|
-
*/
|
|
173
|
-
context: string
|
|
174
|
-
): Promise<RxStorageBulkWriteResponse<RxDocType>>;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Get Multiple documents by their primary value.
|
|
178
|
-
* This must also return deleted documents.
|
|
179
|
-
*/
|
|
180
|
-
findDocumentsById(
|
|
181
|
-
/**
|
|
182
|
-
* List of primary values
|
|
183
|
-
* of the documents to find.
|
|
184
|
-
*/
|
|
185
|
-
ids: string[],
|
|
186
|
-
/**
|
|
187
|
-
* If set to true, deleted documents will also be returned.
|
|
188
|
-
*/
|
|
189
|
-
withDeleted: boolean
|
|
190
|
-
|
|
191
|
-
): Promise<
|
|
192
|
-
/**
|
|
193
|
-
* For better performance, we return an array
|
|
194
|
-
* instead of an indexed object because most consumers
|
|
195
|
-
* of this anyway have to fill a Map() instance or
|
|
196
|
-
* even do only need the list at all.
|
|
197
|
-
*/
|
|
198
|
-
RxDocumentData<RxDocType>[]
|
|
199
|
-
>;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Runs a NoSQL 'mango' query over the storage
|
|
203
|
-
* and returns the found documents data.
|
|
204
|
-
* Having all storage instances behave similar
|
|
205
|
-
* is likely the most difficult thing when creating a new
|
|
206
|
-
* rx-storage implementation.
|
|
207
|
-
*/
|
|
208
|
-
query(
|
|
209
|
-
preparedQuery: PreparedQuery<RxDocType>
|
|
210
|
-
): Promise<RxStorageQueryResult<RxDocType>>;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Returns the amount of non-deleted documents
|
|
214
|
-
* that match the given query.
|
|
215
|
-
* Sort, skip and limit of the query must be ignored!
|
|
216
|
-
*/
|
|
217
|
-
count(
|
|
218
|
-
preparedQuery: PreparedQuery<RxDocType>
|
|
219
|
-
): Promise<RxStorageCountResult>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Returns the data of a single attachment as a Blob.
|
|
223
|
-
*/
|
|
224
|
-
getAttachmentData(
|
|
225
|
-
documentId: string,
|
|
226
|
-
attachmentId: string,
|
|
227
|
-
digest: string
|
|
228
|
-
): Promise<Blob>;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Returns the current (not the old!) data of all documents that have been changed AFTER the given checkpoint.
|
|
232
|
-
* If the returned array does not reach the limit, it can be assumed that the "end" is reached, when paginating over the changes.
|
|
233
|
-
* Also returns a new checkpoint for each document which can be used to continue with the pagination from that change on.
|
|
234
|
-
* Must never return the same document multiple times in the same call operation.
|
|
235
|
-
* This is used by RxDB to known what has changed since X so these docs can be handled by the backup or the replication
|
|
236
|
-
* plugin.
|
|
237
|
-
*
|
|
238
|
-
* Important: This method is optional. If not defined,
|
|
239
|
-
* RxDB will manually run a query and use the last returned document
|
|
240
|
-
* for checkpointing. In the future we might even remove this method completely
|
|
241
|
-
* and let RxDB do the work instead of the RxStorage.
|
|
242
|
-
*/
|
|
243
|
-
getChangedDocumentsSince?(
|
|
244
|
-
limit: number,
|
|
245
|
-
/**
|
|
246
|
-
* The checkpoint from with to start
|
|
247
|
-
* when the events are sorted in time.
|
|
248
|
-
* If we want to start from the beginning,
|
|
249
|
-
* undefined is used as a checkpoint.
|
|
250
|
-
*/
|
|
251
|
-
checkpoint?: CheckpointType
|
|
252
|
-
): Promise<{
|
|
253
|
-
documents: RxDocumentData<RxDocType>[];
|
|
254
|
-
/**
|
|
255
|
-
* The checkpoint contains data so that another
|
|
256
|
-
* call to getChangedDocumentsSince() will continue
|
|
257
|
-
* from exactly the last document that was returned before.
|
|
258
|
-
*/
|
|
259
|
-
checkpoint: CheckpointType;
|
|
260
|
-
}>;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Returns an ongoing stream
|
|
264
|
-
* of all changes that happen to the
|
|
265
|
-
* storage instance.
|
|
266
|
-
* Do not forget to unsubscribe.
|
|
267
|
-
*
|
|
268
|
-
* If the RxStorage support multi-instance,
|
|
269
|
-
* and the storage is persistent,
|
|
270
|
-
* then the emitted changes of one RxStorageInstance
|
|
271
|
-
* must be also emitted to other instances with the same databaseName+collectionName.
|
|
272
|
-
* See ./rx-storage-multiinstance.ts
|
|
273
|
-
*/
|
|
274
|
-
changeStream(): Observable<EventBulk<RxStorageChangeEvent<RxDocType>, CheckpointType>>;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Runs a cleanup that removes all tompstones
|
|
278
|
-
* of documents that have _deleted set to true
|
|
279
|
-
* to free up disc space.
|
|
280
|
-
*
|
|
281
|
-
* Returns true if all cleanable documents have been removed.
|
|
282
|
-
* Returns false if there are more documents to be cleaned up,
|
|
283
|
-
* but not all have been purged because that would block the storage for too long.
|
|
284
|
-
*/
|
|
285
|
-
cleanup(
|
|
286
|
-
/**
|
|
287
|
-
* The minimum time in milliseconds
|
|
288
|
-
* of how long a document must have been deleted
|
|
289
|
-
* until it is purged by the cleanup.
|
|
290
|
-
*/
|
|
291
|
-
minimumDeletedTime: number
|
|
292
|
-
): Promise<
|
|
293
|
-
/**
|
|
294
|
-
* True if all docs cleaned up,
|
|
295
|
-
* false if there are more docs to clean up
|
|
296
|
-
*/
|
|
297
|
-
boolean
|
|
298
|
-
>;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Closes the storage instance so it cannot be used
|
|
302
|
-
* anymore and should clear all memory.
|
|
303
|
-
* The returned promise must resolve when everything is cleaned up.
|
|
304
|
-
*/
|
|
305
|
-
close(): Promise<void>;
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Remove the database and
|
|
309
|
-
* deletes all of its data.
|
|
310
|
-
*/
|
|
311
|
-
remove(): Promise<void>;
|
|
312
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { RxStorage } from './rx-storage.interface';
|
|
2
|
-
|
|
3
|
-
export type MaybePromise<T> = Promise<T> | T;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type PlainJsonValue =
|
|
7
|
-
string |
|
|
8
|
-
number |
|
|
9
|
-
boolean |
|
|
10
|
-
PlainSimpleJsonObject |
|
|
11
|
-
PlainSimpleJsonObject[] |
|
|
12
|
-
PlainJsonValue[] |
|
|
13
|
-
{ [key: string]: PlainJsonValue; }
|
|
14
|
-
;
|
|
15
|
-
export type PlainSimpleJsonObject = {
|
|
16
|
-
[k: string]: PlainJsonValue | PlainJsonValue[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @link https://stackoverflow.com/a/49670389/3443137
|
|
21
|
-
*/
|
|
22
|
-
type DeepReadonly<T> =
|
|
23
|
-
T extends (infer R)[] ? DeepReadonlyArray<R> :
|
|
24
|
-
T extends Function ? T :
|
|
25
|
-
T extends object ? DeepReadonlyObject<T> :
|
|
26
|
-
T;
|
|
27
|
-
|
|
28
|
-
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> { }
|
|
29
|
-
|
|
30
|
-
type DeepReadonlyObject<T> = {
|
|
31
|
-
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type MaybeReadonly<T> = T | Readonly<T>;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Opposite of DeepReadonly,
|
|
39
|
-
* makes everything mutable again.
|
|
40
|
-
*/
|
|
41
|
-
type DeepMutable<T> = (
|
|
42
|
-
T extends object
|
|
43
|
-
? {
|
|
44
|
-
-readonly [K in keyof T]: (
|
|
45
|
-
T[K] extends object
|
|
46
|
-
? DeepMutable<T[K]>
|
|
47
|
-
: T[K]
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
: never
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Can be used like 'keyof'
|
|
55
|
-
* but only represents the string keys, not the Symbols or numbers.
|
|
56
|
-
* @link https://stackoverflow.com/a/51808262/3443137
|
|
57
|
-
*/
|
|
58
|
-
export type StringKeys<X> = Extract<keyof X, string>;
|
|
59
|
-
|
|
60
|
-
export type AnyKeys<T> = { [P in keyof T]?: T[P] | any };
|
|
61
|
-
export interface AnyObject {
|
|
62
|
-
[k: string]: any;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @link https://dev.to/vborodulin/ts-how-to-override-properties-with-type-intersection-554l
|
|
67
|
-
*/
|
|
68
|
-
export type Override<T1, T2> = Omit<T1, keyof T2> & T2;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export type ById<T> = {
|
|
73
|
-
[id: string]: T;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Must be async to support async hashing like from the WebCrypto API.
|
|
78
|
-
* Accepts string for document revision hashing,
|
|
79
|
-
* ArrayBuffer for raw binary hashing,
|
|
80
|
-
* or Blob for attachment digest hashing.
|
|
81
|
-
*/
|
|
82
|
-
export type HashFunction = (input: string | ArrayBuffer | Blob) => Promise<string>;
|
|
83
|
-
|
|
84
|
-
export declare type QueryMatcher<DocType> = (doc: DocType | DeepReadonly<DocType>) => boolean;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* To have a deterministic sorting, we cannot return 0,
|
|
88
|
-
* we only return 1 or -1.
|
|
89
|
-
* This ensures that we always end with the same output array, no mather of the
|
|
90
|
-
* pre-sorting of the input array.
|
|
91
|
-
*/
|
|
92
|
-
export declare type DeterministicSortComparator<DocType> = (a: DocType, b: DocType) => 1 | -1;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* To test a storage, we need these
|
|
96
|
-
* configuration values.
|
|
97
|
-
*/
|
|
98
|
-
export type RxTestStorage = {
|
|
99
|
-
// can be used to setup async stuff
|
|
100
|
-
readonly init?: () => any;
|
|
101
|
-
readonly name: string;
|
|
102
|
-
readonly getStorage: () => RxStorage<any, any>;
|
|
103
|
-
/**
|
|
104
|
-
* Returns a storage that is used in performance tests.
|
|
105
|
-
* For example in a browser it should return the storage with an IndexedDB based adapter,
|
|
106
|
-
* while in node.js it must use the filesystem.
|
|
107
|
-
*/
|
|
108
|
-
readonly getPerformanceStorage: () => {
|
|
109
|
-
storage: RxStorage<any, any>;
|
|
110
|
-
/**
|
|
111
|
-
* A description that describes the storage and setting.
|
|
112
|
-
* For example 'dexie-native'.
|
|
113
|
-
*/
|
|
114
|
-
description: string;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* True if the storage is able to
|
|
118
|
-
* keep data after an instance is closed and opened again.
|
|
119
|
-
*/
|
|
120
|
-
readonly hasPersistence: boolean;
|
|
121
|
-
readonly hasMultiInstance: boolean;
|
|
122
|
-
readonly hasAttachments: boolean;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Some storages likes the memory-synced storage,
|
|
126
|
-
* are not able to provide a replication while guaranteeing
|
|
127
|
-
* data integrity.
|
|
128
|
-
*/
|
|
129
|
-
readonly hasReplication: boolean;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* To make it possible to test alternative encryption plugins,
|
|
133
|
-
* you can specify hasEncryption to signal
|
|
134
|
-
* the test runner that the given storage already contains an
|
|
135
|
-
* encryption plugin that should be used to test encryption tests.
|
|
136
|
-
* Otherwise the encryption-crypto-js plugin will be tested.
|
|
137
|
-
*
|
|
138
|
-
* hasEncryption must contain a function that is able
|
|
139
|
-
* to create a new password.
|
|
140
|
-
*/
|
|
141
|
-
readonly hasEncryption?: () => Promise<string>;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* The paths as strings-type of nested object
|
|
147
|
-
* @link https://stackoverflow.com/a/58436959/3443137
|
|
148
|
-
*/
|
|
149
|
-
type Join<K, P> = K extends string | number ?
|
|
150
|
-
P extends string | number ?
|
|
151
|
-
`${K}${'' extends P ? '' : '.'}${P}`
|
|
152
|
-
: never : never;
|
|
153
|
-
|
|
154
|
-
export type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ?
|
|
155
|
-
{ [K in keyof T]-?: K extends string | number ?
|
|
156
|
-
`${K}` | (Paths<T[K], Prev[D]> extends infer R ? Join<K, R> : never)
|
|
157
|
-
: never
|
|
158
|
-
}[keyof T] : '';
|
|
159
|
-
|
|
160
|
-
export type Leaves<T, D extends number = 10> = [D] extends [never] ? never : T extends object ?
|
|
161
|
-
{ [K in keyof T]-?: Join<K, Leaves<T[K], Prev[D]>> }[keyof T] : '';
|
|
162
|
-
type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
163
|
-
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...0[]];
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* In the past, users had to add WeakRef to their typescript config.
|
|
169
|
-
* To create an easier setup, we use our own typings instead, because WeakRef
|
|
170
|
-
* is used internally only anyways.
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
export interface WeakRef<T extends object = any> {
|
|
174
|
-
deref(): T | undefined;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface FinalizationRegistry<T> {
|
|
178
|
-
register(target: object, heldValue: T, unregisterToken?: object): void;
|
|
179
|
-
unregister(unregisterToken: object): boolean;
|
|
180
|
-
}
|