cbl-ionic 0.2.6 → 1.0.1
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/CblIonic.podspec +1 -1
- package/README.md +12 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/cbl/js/kotiln/DatabaseManager.kt +19 -6
- package/android/src/main/java/cbl/js/kotiln/URLEndpointListenerManager.kt +143 -0
- package/android/src/main/java/com/couchbase/ionic/CblIonicPluginPlugin.kt +186 -30
- package/android/src/main/java/com/couchbase/ionic/PluginHelper.kt +27 -38
- package/android/src/main/java/com/couchbase/ionic/QueryHelper.kt +14 -4
- package/android/src/main/java/com/couchbase/ionic/ReplicatorHelper.kt +33 -11
- package/dist/esm/cblite-js/cblite/core-types.d.ts +148 -5
- package/dist/esm/cblite-js/cblite/src/collection-config.d.ts +34 -0
- package/dist/esm/cblite-js/cblite/src/collection-config.js +40 -0
- package/dist/esm/cblite-js/cblite/src/collection-config.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/collection.d.ts +1 -2
- package/dist/esm/cblite-js/cblite/src/collection.js +17 -17
- package/dist/esm/cblite-js/cblite/src/collection.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/database-logging.js +1 -1
- package/dist/esm/cblite-js/cblite/src/database-logging.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/database.d.ts +13 -2
- package/dist/esm/cblite-js/cblite/src/database.js +50 -34
- package/dist/esm/cblite-js/cblite/src/database.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/document.d.ts +3 -4
- package/dist/esm/cblite-js/cblite/src/document.js +6 -6
- package/dist/esm/cblite-js/cblite/src/document.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/index.d.ts +1 -0
- package/dist/esm/cblite-js/cblite/src/index.js +1 -0
- package/dist/esm/cblite-js/cblite/src/index.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/query.js +6 -11
- package/dist/esm/cblite-js/cblite/src/query.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/replicated-document.js +2 -2
- package/dist/esm/cblite-js/cblite/src/replicated-document.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.d.ts +2 -1
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.js +29 -3
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/replicator.js +8 -5
- package/dist/esm/cblite-js/cblite/src/replicator.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/scope.js +2 -2
- package/dist/esm/cblite-js/cblite/src/scope.js.map +1 -1
- package/dist/esm/cblite-js/cblite/src/url-endpoint-listener.d.ts +84 -0
- package/dist/esm/cblite-js/cblite/src/url-endpoint-listener.js +109 -0
- package/dist/esm/cblite-js/cblite/src/url-endpoint-listener.js.map +1 -0
- package/dist/esm/couchbase-lite/capacitor-engine.d.ts +17 -2
- package/dist/esm/couchbase-lite/capacitor-engine.js +19 -1
- package/dist/esm/couchbase-lite/capacitor-engine.js.map +1 -1
- package/dist/plugin.cjs.js +288 -82
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +288 -82
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CblIonicPlugin.swift +120 -7
- package/ios/Plugin/CblIonicPluginPlugin.m +7 -0
- package/ios/Plugin/cbl-js-swift/CollectionManager.swift +24 -3
- package/ios/Plugin/cbl-js-swift/DatabaseManager.swift +29 -13
- package/ios/Plugin/cbl-js-swift/FileSystemHelper.swift +0 -2
- package/ios/Plugin/cbl-js-swift/IndexHelper.swift +0 -2
- package/ios/Plugin/cbl-js-swift/LoggingManager.swift +0 -2
- package/ios/Plugin/cbl-js-swift/MapHelper.swift +0 -25
- package/ios/Plugin/cbl-js-swift/QueryHelper.swift +0 -2
- package/ios/Plugin/cbl-js-swift/README.md +12 -0
- package/ios/Plugin/cbl-js-swift/ReplicatorHelper.swift +116 -5
- package/ios/Plugin/cbl-js-swift/ReplicatorManager.swift +0 -2
- package/ios/Plugin/cbl-js-swift/URLEndpointListenerManager.swift +154 -0
- package/package.json +8 -3
|
@@ -18,6 +18,10 @@ import com.getcapacitor.JSObject
|
|
|
18
18
|
import org.json.JSONArray
|
|
19
19
|
import org.json.JSONObject
|
|
20
20
|
import java.net.URI
|
|
21
|
+
import java.security.cert.X509Certificate
|
|
22
|
+
import java.security.cert.CertificateFactory
|
|
23
|
+
import java.util.Base64
|
|
24
|
+
import java.io.ByteArrayInputStream
|
|
21
25
|
import com.couchbase.lite.Collection as CBLCollection
|
|
22
26
|
|
|
23
27
|
object ReplicatorHelper {
|
|
@@ -39,14 +43,28 @@ object ReplicatorHelper {
|
|
|
39
43
|
val acceptSelfSignedCerts = config.getBoolean("acceptSelfSignedCerts")
|
|
40
44
|
val autoPurgeEnabled = config.getBoolean("autoPurgeEnabled")
|
|
41
45
|
val replicatorType = getReplicatorTypeFromString(replicatorTypeString)
|
|
46
|
+
val pinnedServerCertificateString = config.getString("pinnedServerCertificate")
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
var pinnedServerCertificate: X509Certificate? = null
|
|
49
|
+
if (!pinnedServerCertificateString.isNullOrBlank()) {
|
|
50
|
+
try {
|
|
51
|
+
val decodedBytes = Base64.getDecoder().decode(pinnedServerCertificateString)
|
|
52
|
+
val inputStream = ByteArrayInputStream(decodedBytes)
|
|
53
|
+
val certificateFactory = CertificateFactory.getInstance("X.509")
|
|
54
|
+
pinnedServerCertificate = certificateFactory.generateCertificate(inputStream) as X509Certificate
|
|
55
|
+
} catch (e: Throwable) {
|
|
56
|
+
throw IllegalArgumentException("Invalid pinned certificate")
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
val configBuilder = ReplicatorConfigurationFactory.newConfig(
|
|
61
|
+
target = endpoint,
|
|
62
|
+
continuous = continuous,
|
|
63
|
+
acceptParentDomainCookies = acceptParentDomainCookies,
|
|
64
|
+
acceptOnlySelfSignedServerCertificate = acceptSelfSignedCerts,
|
|
65
|
+
enableAutoPurge = autoPurgeEnabled,
|
|
66
|
+
type = replicatorType,
|
|
67
|
+
pinnedServerCertificate = pinnedServerCertificate
|
|
50
68
|
)
|
|
51
69
|
|
|
52
70
|
//optional values
|
|
@@ -117,8 +135,8 @@ object ReplicatorHelper {
|
|
|
117
135
|
BasicAuthenticator(username, password.toCharArray())
|
|
118
136
|
}
|
|
119
137
|
"session" -> {
|
|
120
|
-
val sessionId =
|
|
121
|
-
val cookieName =
|
|
138
|
+
val sessionId = data.getString("sessionId")
|
|
139
|
+
val cookieName = data.getString("cookieName")
|
|
122
140
|
SessionAuthenticator(sessionId, cookieName)
|
|
123
141
|
}
|
|
124
142
|
else -> throw IllegalArgumentException("Invalid authenticator type")
|
|
@@ -143,7 +161,7 @@ object ReplicatorHelper {
|
|
|
143
161
|
}
|
|
144
162
|
progressJson.put("completed", status.progress.completed)
|
|
145
163
|
progressJson.put("total", status.progress.total)
|
|
146
|
-
json.put("
|
|
164
|
+
json.put("activityLevel", status.activityLevel.ordinal)
|
|
147
165
|
json.put("progress", progressJson)
|
|
148
166
|
json.put("error", errorJson)
|
|
149
167
|
return json
|
|
@@ -155,6 +173,11 @@ object ReplicatorHelper {
|
|
|
155
173
|
for (doc in change.documents) {
|
|
156
174
|
val docJson = JSObject()
|
|
157
175
|
val flags = JSArray()
|
|
176
|
+
val errorJson = JSObject()
|
|
177
|
+
doc.error?.let {
|
|
178
|
+
errorJson.put("message", it.message)
|
|
179
|
+
docJson.put("error", errorJson)
|
|
180
|
+
}
|
|
158
181
|
if (doc.flags.contains(DocumentFlag.DELETED)) {
|
|
159
182
|
flags.put("DELETED")
|
|
160
183
|
} else if (doc.flags.contains(DocumentFlag.ACCESS_REMOVED)) {
|
|
@@ -164,7 +187,6 @@ object ReplicatorHelper {
|
|
|
164
187
|
docJson.put("id", doc.id)
|
|
165
188
|
docJson.put("scopeName", doc.scope)
|
|
166
189
|
docJson.put("collectionName", doc.collection)
|
|
167
|
-
docJson.put("error", doc.error?.message)
|
|
168
190
|
docs.put(docJson)
|
|
169
191
|
}
|
|
170
192
|
json.put("documents", docs)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractIndex, Collection, ConcurrencyControl, Database, DatabaseConfiguration, DatabaseFileLoggingConfiguration, DocumentReplicationRepresentation, Dictionary, Document, MaintenanceType, Query, ReplicatorStatus, Result, ResultSet, Scope } from './src';
|
|
1
|
+
import { AbstractIndex, Collection, ConcurrencyControl, Database, DatabaseConfiguration, DatabaseFileLoggingConfiguration, DocumentReplicationRepresentation, Dictionary, Document, MaintenanceType, Query, ReplicatorStatus, Result, ResultSet, Scope, CollectionJson } from './src';
|
|
2
2
|
/**
|
|
3
3
|
* Represents the data that is returned from a listener callback
|
|
4
4
|
*
|
|
@@ -42,6 +42,7 @@ export interface CollectionArgs {
|
|
|
42
42
|
*/
|
|
43
43
|
export interface CollectionChange {
|
|
44
44
|
documentIDs: string[];
|
|
45
|
+
collection: Collection;
|
|
45
46
|
}
|
|
46
47
|
export type CollectionChangeListener = (change: CollectionChange) => void;
|
|
47
48
|
/**
|
|
@@ -417,12 +418,114 @@ export interface ScopeArgs {
|
|
|
417
418
|
export interface ScopesResult {
|
|
418
419
|
scopes: Scope[];
|
|
419
420
|
}
|
|
421
|
+
export interface ListenerAuthenticatorConfig {
|
|
422
|
+
type: 'basic';
|
|
423
|
+
data: {
|
|
424
|
+
[key: string]: any;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Common TLS identity options shared between both self-signed and imported certs.
|
|
429
|
+
*/
|
|
430
|
+
type CommonTlsConfig = {
|
|
431
|
+
/**
|
|
432
|
+
* Optional label to identify the certificate (used by Couchbase Lite).
|
|
433
|
+
*/
|
|
434
|
+
label?: string;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* TLS Identity configuration for the Couchbase Lite plugin.
|
|
438
|
+
*
|
|
439
|
+
* Supports two modes:
|
|
440
|
+
* - 'selfSigned': Generate a self-signed certificate on the device.
|
|
441
|
+
* - 'imported': Load a user-provided certificate file (e.g., .p12).
|
|
442
|
+
*
|
|
443
|
+
* @note 'imported' mode is not implemented on Android and will throw an error if used.
|
|
444
|
+
*/
|
|
445
|
+
export type TlsIdentityConfig = ({
|
|
446
|
+
/**
|
|
447
|
+
* Mode indicating that a self-signed certificate should be created.
|
|
448
|
+
*/
|
|
449
|
+
mode: 'selfSigned';
|
|
450
|
+
/**
|
|
451
|
+
* Optional expiration date for self-signed certificates in ISO format (e.g., "2026-12-31").
|
|
452
|
+
* Ignored for imported certificates.
|
|
453
|
+
*/
|
|
454
|
+
expiration?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Certificate attributes required to generate a self-signed identity.
|
|
457
|
+
* At minimum, `certAttrCommonName` must be provided.
|
|
458
|
+
*/
|
|
459
|
+
attributes: {
|
|
460
|
+
certAttrCommonName: string;
|
|
461
|
+
[key: string]: string;
|
|
462
|
+
};
|
|
463
|
+
} & CommonTlsConfig) | ({
|
|
464
|
+
/**
|
|
465
|
+
* Mode indicating that a certificate should be imported from a file.
|
|
466
|
+
*/
|
|
467
|
+
mode: 'imported';
|
|
468
|
+
/**
|
|
469
|
+
* Base64 of the certificate
|
|
470
|
+
*/
|
|
471
|
+
certBase64: string;
|
|
472
|
+
/**
|
|
473
|
+
* Optional password for the certificate
|
|
474
|
+
*/
|
|
475
|
+
password?: string;
|
|
476
|
+
} & CommonTlsConfig);
|
|
477
|
+
/**
|
|
478
|
+
* Represents arguments for creating a URL Endpoint Listener.
|
|
479
|
+
*
|
|
480
|
+
* @interface
|
|
481
|
+
* @property {CollectionJson[]} collections - The list of collections to include in the listener.
|
|
482
|
+
* @property {number} port - The port to listen on.
|
|
483
|
+
* @property {string} [networkInterface] - Optional network interface to bind to.
|
|
484
|
+
* @property {boolean} [disableTLS] - Optional flag to disable TLS.
|
|
485
|
+
* @property {boolean} [enableDeltaSync] - Optional flag to enable delta sync.
|
|
486
|
+
* @property {ListenerAuthenticatorConfig} [authenticatorConfig] - Optional authentication configuration for the listener.
|
|
487
|
+
* @property {TlsIdentityConfig} [tlsIdentityConfig] - Optional TLS identity configuration for the listener.
|
|
488
|
+
*/
|
|
489
|
+
export interface URLEndpointListenerCreateArgs {
|
|
490
|
+
collections: CollectionJson[];
|
|
491
|
+
port: number;
|
|
492
|
+
networkInterface?: string;
|
|
493
|
+
disableTLS?: boolean;
|
|
494
|
+
enableDeltaSync?: boolean;
|
|
495
|
+
authenticatorConfig?: ListenerAuthenticatorConfig;
|
|
496
|
+
tlsIdentityConfig?: TlsIdentityConfig;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Represents arguments for starting or stopping a URL Endpoint Listener.
|
|
500
|
+
*
|
|
501
|
+
* @interface
|
|
502
|
+
* @property {string} listenerId - The unique ID of the listener.
|
|
503
|
+
*/
|
|
504
|
+
export interface URLEndpointListenerArgs {
|
|
505
|
+
listenerId: string;
|
|
506
|
+
}
|
|
507
|
+
export interface URLEndpointListenerTLSIdentityArgs {
|
|
508
|
+
label: string;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Represents the status of a URL Endpoint Listener.
|
|
512
|
+
*
|
|
513
|
+
* @interface
|
|
514
|
+
* @property {number} connectionsCount - The total number of connections.
|
|
515
|
+
* @property {number} activeConnectionCount - The number of active connections.
|
|
516
|
+
*/
|
|
517
|
+
export interface URLEndpointListenerStatus {
|
|
518
|
+
connectionsCount: number;
|
|
519
|
+
activeConnectionCount: number;
|
|
520
|
+
}
|
|
420
521
|
/**
|
|
421
522
|
* Represents engine for the core functionality of the Couchbase Lite Plugin
|
|
422
523
|
*
|
|
423
524
|
* @interface
|
|
424
525
|
*/
|
|
425
526
|
export interface ICoreEngine {
|
|
527
|
+
debugConsole: boolean;
|
|
528
|
+
platform: string;
|
|
426
529
|
collection_AddChangeListener(args: CollectionChangeListenerArgs, lcb: ListenerCallback): Promise<void>;
|
|
427
530
|
collection_AddDocumentChangeListener(args: DocumentChangeListenerArgs, lcb: ListenerCallback): Promise<void>;
|
|
428
531
|
collection_CreateCollection(args: CollectionArgs): Promise<Collection>;
|
|
@@ -438,7 +541,7 @@ export interface ICoreEngine {
|
|
|
438
541
|
collection_DeleteCollection(args: CollectionArgs): Promise<void>;
|
|
439
542
|
/**
|
|
440
543
|
* Delete a document from the collection. The default concurrency control, lastWriteWins,
|
|
441
|
-
* will be used when there is conflict during delete. If the document doesn
|
|
544
|
+
* will be used when there is conflict during delete. If the document doesn't exist in the
|
|
442
545
|
* collection, an error will be thrown.
|
|
443
546
|
*
|
|
444
547
|
* When deleting a document that already belongs to a collection, the collection instance of
|
|
@@ -501,7 +604,7 @@ export interface ICoreEngine {
|
|
|
501
604
|
indexes: string[];
|
|
502
605
|
}>;
|
|
503
606
|
/**
|
|
504
|
-
* Purge a document by id from the collection. If the document doesn
|
|
607
|
+
* Purge a document by id from the collection. If the document doesn't exist in the
|
|
505
608
|
* collection, an error will be thrown.
|
|
506
609
|
*
|
|
507
610
|
* Throws an error if the collection is deleted or the database is closed.
|
|
@@ -553,7 +656,7 @@ export interface ICoreEngine {
|
|
|
553
656
|
exists: boolean;
|
|
554
657
|
}>;
|
|
555
658
|
/**
|
|
556
|
-
* @deprecated This will be removed in future versions. Use
|
|
659
|
+
* @deprecated This will be removed in future versions. Use Collection_GetCount instead.
|
|
557
660
|
*/
|
|
558
661
|
database_GetCount(args: DatabaseArgs): Promise<{
|
|
559
662
|
count: number;
|
|
@@ -571,7 +674,9 @@ export interface ICoreEngine {
|
|
|
571
674
|
database_GetPath(args: DatabaseArgs): Promise<{
|
|
572
675
|
path: string;
|
|
573
676
|
}>;
|
|
574
|
-
database_Open(args: DatabaseOpenArgs): Promise<
|
|
677
|
+
database_Open(args: DatabaseOpenArgs): Promise<{
|
|
678
|
+
databaseUniqueName: string;
|
|
679
|
+
}>;
|
|
575
680
|
database_PerformMaintenance(args: DatabasePerformMaintenanceArgs): Promise<void>;
|
|
576
681
|
/**
|
|
577
682
|
* @deprecated This will be removed in future versions. Use collection_PurgeDocument instead.
|
|
@@ -631,4 +736,42 @@ export interface ICoreEngine {
|
|
|
631
736
|
scope_GetScope(args: ScopeArgs): Promise<Scope>;
|
|
632
737
|
scope_GetScopes(args: DatabaseArgs): Promise<ScopesResult>;
|
|
633
738
|
getUUID(): string;
|
|
739
|
+
/**
|
|
740
|
+
* Creates a URL Endpoint Listener.
|
|
741
|
+
*
|
|
742
|
+
* @param args - The arguments for creating the listener.
|
|
743
|
+
* @returns A promise that resolves with the listener ID.
|
|
744
|
+
*/
|
|
745
|
+
URLEndpointListener_createListener(args: URLEndpointListenerCreateArgs): Promise<{
|
|
746
|
+
listenerId: string;
|
|
747
|
+
}>;
|
|
748
|
+
/**
|
|
749
|
+
* Starts a URL Endpoint Listener.
|
|
750
|
+
*
|
|
751
|
+
* @param args - The arguments for starting the listener.
|
|
752
|
+
* @returns A promise that resolves when the listener is started.
|
|
753
|
+
*/
|
|
754
|
+
URLEndpointListener_startListener(args: URLEndpointListenerArgs): Promise<void>;
|
|
755
|
+
/**
|
|
756
|
+
* Stops a URL Endpoint Listener.
|
|
757
|
+
*
|
|
758
|
+
* @param args - The arguments for stopping the listener.
|
|
759
|
+
* @returns A promise that resolves when the listener is stopped.
|
|
760
|
+
*/
|
|
761
|
+
URLEndpointListener_stopListener(args: URLEndpointListenerArgs): Promise<void>;
|
|
762
|
+
/**
|
|
763
|
+
* Gets the status of a URL Endpoint Listener.
|
|
764
|
+
*
|
|
765
|
+
* @param args - The arguments for getting the listener status.
|
|
766
|
+
* @returns A promise that resolves with the listener status.
|
|
767
|
+
*/
|
|
768
|
+
URLEndpointListener_getStatus(args: URLEndpointListenerArgs): Promise<URLEndpointListenerStatus>;
|
|
769
|
+
/**
|
|
770
|
+
* Deletes the identity of a URL Endpoint Listener.
|
|
771
|
+
*
|
|
772
|
+
* @param args - The arguments for deleting the listener identity.
|
|
773
|
+
* @returns A promise that resolves when the identity is deleted.
|
|
774
|
+
*/
|
|
775
|
+
URLEndpointListener_deleteIdentity(args: URLEndpointListenerTLSIdentityArgs): Promise<void>;
|
|
634
776
|
}
|
|
777
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { ReplicatedDocumentFlag } from "./replicated-document";
|
|
2
|
+
export type ReplicationFilter = (document: Document, flags: ReplicatedDocumentFlag[]) => boolean;
|
|
1
3
|
export declare class CollectionConfig {
|
|
2
4
|
private channels;
|
|
3
5
|
private documentIds;
|
|
6
|
+
private pushFilter?;
|
|
7
|
+
private pullFilter?;
|
|
4
8
|
/**
|
|
5
9
|
* The collection configuration that can be configured specifically for the replication.
|
|
6
10
|
*/
|
|
@@ -21,4 +25,34 @@ export declare class CollectionConfig {
|
|
|
21
25
|
* config.setDocumentIDs(['doc1', 'doc2', 'doc3']);
|
|
22
26
|
*/
|
|
23
27
|
setDocumentIDs(documentIds: string[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Set a filter function for push replication. Only documents for which the function returns true will be pushed.
|
|
30
|
+
* Inside filter body document and flag object methods can't be used.
|
|
31
|
+
* @param {ReplicationFilter} filter - Function that returns true to replicate the document
|
|
32
|
+
* @example
|
|
33
|
+
* const config = new CollectionConfig();
|
|
34
|
+
* config.setPushFilter((doc, flags) => {
|
|
35
|
+
* return doc["type"] === 'user' && !flags.includes(ReplicatedDocumentFlag.DELETED);
|
|
36
|
+
* });
|
|
37
|
+
*/
|
|
38
|
+
setPushFilter(filter: ReplicationFilter): void;
|
|
39
|
+
/**
|
|
40
|
+
* Set a filter function for pull replication. Only documents for which the function returns true will be pulled.
|
|
41
|
+
* Inside filter body document and flag object methods can't be used.
|
|
42
|
+
* @param {ReplicationFilter} filter - Function that returns true to replicate the document
|
|
43
|
+
* @example
|
|
44
|
+
* const config = new CollectionConfig();
|
|
45
|
+
* config.setPullFilter((doc, flags) => {
|
|
46
|
+
* return doc["type"] === 'user' && !flags.includes(ReplicatedDocumentFlag.DELETED);
|
|
47
|
+
* });
|
|
48
|
+
*/
|
|
49
|
+
setPullFilter(filter: ReplicationFilter): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the pull filter function string
|
|
52
|
+
*/
|
|
53
|
+
getPushFilter(): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Get the pull filter function string
|
|
56
|
+
*/
|
|
57
|
+
getPullFilter(): string | undefined;
|
|
24
58
|
}
|
|
@@ -26,5 +26,45 @@ export class CollectionConfig {
|
|
|
26
26
|
setDocumentIDs(documentIds) {
|
|
27
27
|
this.documentIds = documentIds;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Set a filter function for push replication. Only documents for which the function returns true will be pushed.
|
|
31
|
+
* Inside filter body document and flag object methods can't be used.
|
|
32
|
+
* @param {ReplicationFilter} filter - Function that returns true to replicate the document
|
|
33
|
+
* @example
|
|
34
|
+
* const config = new CollectionConfig();
|
|
35
|
+
* config.setPushFilter((doc, flags) => {
|
|
36
|
+
* return doc["type"] === 'user' && !flags.includes(ReplicatedDocumentFlag.DELETED);
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
39
|
+
setPushFilter(filter) {
|
|
40
|
+
// Convert function to string for bridge transport
|
|
41
|
+
this.pushFilter = filter.toString();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Set a filter function for pull replication. Only documents for which the function returns true will be pulled.
|
|
45
|
+
* Inside filter body document and flag object methods can't be used.
|
|
46
|
+
* @param {ReplicationFilter} filter - Function that returns true to replicate the document
|
|
47
|
+
* @example
|
|
48
|
+
* const config = new CollectionConfig();
|
|
49
|
+
* config.setPullFilter((doc, flags) => {
|
|
50
|
+
* return doc["type"] === 'user' && !flags.includes(ReplicatedDocumentFlag.DELETED);
|
|
51
|
+
* });
|
|
52
|
+
*/
|
|
53
|
+
setPullFilter(filter) {
|
|
54
|
+
// Convert function to string for bridge transport
|
|
55
|
+
this.pullFilter = filter.toString();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the pull filter function string
|
|
59
|
+
*/
|
|
60
|
+
getPushFilter() {
|
|
61
|
+
return this.pushFilter;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the pull filter function string
|
|
65
|
+
*/
|
|
66
|
+
getPullFilter() {
|
|
67
|
+
return this.pullFilter;
|
|
68
|
+
}
|
|
29
69
|
}
|
|
30
70
|
//# sourceMappingURL=collection-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-config.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/collection-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection-config.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/collection-config.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,gBAAgB;IAM5B;;OAEG;IACF,YACE,QAAqC,EACrC,WAAwC;QAExC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;IACvC,CAAC;IAEA;;;;;;MAME;IACH,WAAW,CAAC,QAAkB;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEC;;;;;;KAMC;IACH,cAAc,CAAC,WAAqB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CAAC,MAAyB;QACrC,kDAAkD;QAClD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAEA;;;;;;;;;MASE;IACH,aAAa,CAAC,MAAyB;QACrC,kDAAkD;QAClD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CAEF"}
|
|
@@ -5,7 +5,7 @@ import { Document } from './document';
|
|
|
5
5
|
import { ConcurrencyControl } from './concurrency-control';
|
|
6
6
|
import { MutableDocument } from './mutable-document';
|
|
7
7
|
import { DocumentChangeListener, CollectionChangeListener, ICoreEngine } from '../core-types';
|
|
8
|
-
interface CollectionJson {
|
|
8
|
+
export interface CollectionJson {
|
|
9
9
|
name: string;
|
|
10
10
|
scopeName: string;
|
|
11
11
|
databaseName: string;
|
|
@@ -186,4 +186,3 @@ export declare class Collection {
|
|
|
186
186
|
toJson(): CollectionJson;
|
|
187
187
|
private uuid;
|
|
188
188
|
}
|
|
189
|
-
export {};
|
|
@@ -28,7 +28,7 @@ export class Collection {
|
|
|
28
28
|
const token = this.uuid();
|
|
29
29
|
if (!this._didStartListener) {
|
|
30
30
|
await this._engine.collection_AddChangeListener({
|
|
31
|
-
name: this.scope.database.
|
|
31
|
+
name: this.scope.database.getUniqueName(),
|
|
32
32
|
scopeName: this.scope.name,
|
|
33
33
|
collectionName: this.name,
|
|
34
34
|
changeListenerToken: token,
|
|
@@ -55,7 +55,7 @@ export class Collection {
|
|
|
55
55
|
if (!this._didStartDocumentListener.has(documentId) &&
|
|
56
56
|
!this._documentChangeListener[documentId]) {
|
|
57
57
|
await this._engine.collection_AddDocumentChangeListener({
|
|
58
|
-
name: this.scope.database.
|
|
58
|
+
name: this.scope.database.getUniqueName(),
|
|
59
59
|
scopeName: this.scope.name,
|
|
60
60
|
collectionName: this.name,
|
|
61
61
|
changeListenerToken: token,
|
|
@@ -81,7 +81,7 @@ export class Collection {
|
|
|
81
81
|
*/
|
|
82
82
|
count() {
|
|
83
83
|
return this._engine.collection_GetCount({
|
|
84
|
-
name: this.scope.database.
|
|
84
|
+
name: this.scope.database.getUniqueName(),
|
|
85
85
|
scopeName: this.scope.name,
|
|
86
86
|
collectionName: this.name,
|
|
87
87
|
});
|
|
@@ -93,7 +93,7 @@ export class Collection {
|
|
|
93
93
|
*/
|
|
94
94
|
createIndex(indexName, index) {
|
|
95
95
|
return this._engine.collection_CreateIndex({
|
|
96
|
-
name: this.scope.database.
|
|
96
|
+
name: this.scope.database.getUniqueName(),
|
|
97
97
|
scopeName: this.scope.name,
|
|
98
98
|
collectionName: this.name,
|
|
99
99
|
indexName: indexName,
|
|
@@ -116,7 +116,7 @@ export class Collection {
|
|
|
116
116
|
deleteDocument(document, concurrencyControl = null) {
|
|
117
117
|
const id = document.getId();
|
|
118
118
|
return this._engine.collection_DeleteDocument({
|
|
119
|
-
name: this.scope.database.
|
|
119
|
+
name: this.scope.database.getUniqueName(),
|
|
120
120
|
scopeName: this.scope.name,
|
|
121
121
|
collectionName: this.name,
|
|
122
122
|
docId: id,
|
|
@@ -130,7 +130,7 @@ export class Collection {
|
|
|
130
130
|
*/
|
|
131
131
|
deleteIndex(indexName) {
|
|
132
132
|
return this._engine.collection_DeleteIndex({
|
|
133
|
-
name: this.scope.database.
|
|
133
|
+
name: this.scope.database.getUniqueName(),
|
|
134
134
|
scopeName: this.scope.name,
|
|
135
135
|
collectionName: this.name,
|
|
136
136
|
indexName: indexName,
|
|
@@ -146,7 +146,7 @@ export class Collection {
|
|
|
146
146
|
async document(id) {
|
|
147
147
|
const docJson = await this._engine.collection_GetDocument({
|
|
148
148
|
docId: id,
|
|
149
|
-
name: this.scope.database.
|
|
149
|
+
name: this.scope.database.getUniqueName(),
|
|
150
150
|
scopeName: this.scope.name,
|
|
151
151
|
collectionName: this.name,
|
|
152
152
|
});
|
|
@@ -186,11 +186,11 @@ export class Collection {
|
|
|
186
186
|
async getDocumentExpiration(id) {
|
|
187
187
|
const date = await this._engine.collection_GetDocumentExpiration({
|
|
188
188
|
docId: id,
|
|
189
|
-
name: this.scope.database.
|
|
189
|
+
name: this.scope.database.getUniqueName(),
|
|
190
190
|
scopeName: this.scope.name,
|
|
191
191
|
collectionName: this.name,
|
|
192
192
|
});
|
|
193
|
-
if (date
|
|
193
|
+
if (!!date && date?.date) {
|
|
194
194
|
return date.date;
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
@@ -212,7 +212,7 @@ export class Collection {
|
|
|
212
212
|
*/
|
|
213
213
|
async indexes() {
|
|
214
214
|
const indexes = await this._engine.collection_GetIndexes({
|
|
215
|
-
name: this.scope.database.
|
|
215
|
+
name: this.scope.database.getUniqueName(),
|
|
216
216
|
scopeName: this.scope.name,
|
|
217
217
|
collectionName: this.name,
|
|
218
218
|
});
|
|
@@ -250,7 +250,7 @@ export class Collection {
|
|
|
250
250
|
*/
|
|
251
251
|
purge(document) {
|
|
252
252
|
return this._engine.collection_PurgeDocument({
|
|
253
|
-
name: this.database.
|
|
253
|
+
name: this.database.getUniqueName(),
|
|
254
254
|
scopeName: this.scope.name,
|
|
255
255
|
collectionName: this.name,
|
|
256
256
|
docId: document.getId(),
|
|
@@ -266,7 +266,7 @@ export class Collection {
|
|
|
266
266
|
*/
|
|
267
267
|
purgeById(documentId) {
|
|
268
268
|
return this._engine.collection_PurgeDocument({
|
|
269
|
-
name: this.database.
|
|
269
|
+
name: this.database.getUniqueName(),
|
|
270
270
|
scopeName: this.scope.name,
|
|
271
271
|
collectionName: this.name,
|
|
272
272
|
docId: documentId,
|
|
@@ -281,7 +281,7 @@ export class Collection {
|
|
|
281
281
|
*/
|
|
282
282
|
async removeChangeListener(token) {
|
|
283
283
|
await this._engine.collection_RemoveChangeListener({
|
|
284
|
-
name: this.database.
|
|
284
|
+
name: this.database.getUniqueName(),
|
|
285
285
|
scopeName: this.scope.name,
|
|
286
286
|
collectionName: this.name,
|
|
287
287
|
changeListenerToken: token,
|
|
@@ -296,7 +296,7 @@ export class Collection {
|
|
|
296
296
|
*/
|
|
297
297
|
async removeDocumentChangeListener(token) {
|
|
298
298
|
await this._engine.collection_RemoveDocumentChangeListener({
|
|
299
|
-
name: this.database.
|
|
299
|
+
name: this.database.getUniqueName(),
|
|
300
300
|
scopeName: this.scope.name,
|
|
301
301
|
collectionName: this.name,
|
|
302
302
|
changeListenerToken: token,
|
|
@@ -322,7 +322,7 @@ export class Collection {
|
|
|
322
322
|
document: documentString,
|
|
323
323
|
blobs: blobString,
|
|
324
324
|
concurrencyControl: concurrencyControl,
|
|
325
|
-
name: this.scope.database.
|
|
325
|
+
name: this.scope.database.getUniqueName(),
|
|
326
326
|
scopeName: this.scope.name,
|
|
327
327
|
collectionName: this.name,
|
|
328
328
|
});
|
|
@@ -334,7 +334,7 @@ export class Collection {
|
|
|
334
334
|
async setDocumentExpiration(id, expiration) {
|
|
335
335
|
await this._engine.collection_SetDocumentExpiration({
|
|
336
336
|
docId: id,
|
|
337
|
-
name: this.database.
|
|
337
|
+
name: this.database.getUniqueName(),
|
|
338
338
|
scopeName: this.scope.name,
|
|
339
339
|
collectionName: this.name,
|
|
340
340
|
expiration: expiration,
|
|
@@ -344,7 +344,7 @@ export class Collection {
|
|
|
344
344
|
return {
|
|
345
345
|
name: this.name,
|
|
346
346
|
scopeName: this.scope.name,
|
|
347
|
-
databaseName: this.database.
|
|
347
|
+
databaseName: this.database.getUniqueName(),
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
uuid() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC,MAAM,OAAO,UAAU;IAYrB,YACE,IAAwB,EACxB,KAAwB,EACxB,QAAkB;QAdpB,uBAAuB;QACf,YAAO,GAAgB,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAIlE,sBAAiB,GAAG,KAAK,CAAC;QAyBlC;;;;WAIG;QACH,aAAQ,GAAG,G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zC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YAC1B,cAAc,EAAE,IAAI,CAAC,IAAI;SAC1B,CAAC,CAAC;QAEH,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxB,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,EAAU,EACV,UAAuB;QAEvB,MAAM,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC;YAClD,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;YACnC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YAC1B,cAAc,EAAE,IAAI,CAAC,IAAI;YACzB,UAAU,EAAE,UAAU;SACvB,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YAC1B,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;SAC5C,CAAC;IACJ,CAAC;IAEO,IAAI;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-logging.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/database-logging.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,eAAe;IAC1B,2BAA2B;IAC3B,YAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;
|
|
1
|
+
{"version":3,"file":"database-logging.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/database-logging.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,eAAe;IAC1B,2BAA2B;IAC3B,YAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAI,CAAC;IAE3C,aAAa,CAAC,MAAwC;QACpD,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,6BAA6B,CAAC;YAC7D,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;YACnC,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -36,17 +36,20 @@ export declare enum MaintenanceType {
|
|
|
36
36
|
export declare class Database {
|
|
37
37
|
private _databaseName;
|
|
38
38
|
private _databaseConfig;
|
|
39
|
+
private _databaseUniqueName;
|
|
39
40
|
private _isClosed;
|
|
40
41
|
private _engine;
|
|
41
42
|
log: DatabaseLogging;
|
|
42
|
-
constructor(_databaseName: string, _databaseConfig?: DatabaseConfiguration);
|
|
43
|
+
constructor(_databaseName: string, _databaseConfig?: DatabaseConfiguration, _databaseUniqueName?: string);
|
|
43
44
|
getEngine(): ICoreEngine;
|
|
44
45
|
/**
|
|
45
46
|
* Open a database with the given name and configuration.
|
|
47
|
+
* Returns the unique internal name of the database which consists of the provided name and nanoId.
|
|
48
|
+
* The unique name is used to allow multiple instances of the same database to be opened at the same time.
|
|
46
49
|
*
|
|
47
50
|
* @function
|
|
48
51
|
*/
|
|
49
|
-
open(): Promise<
|
|
52
|
+
open(): Promise<string>;
|
|
50
53
|
/**
|
|
51
54
|
* Changes the database’s encryption key, or removes
|
|
52
55
|
* encryption if the new key is nil.
|
|
@@ -108,6 +111,14 @@ export declare class Database {
|
|
|
108
111
|
* @function
|
|
109
112
|
*/
|
|
110
113
|
getName(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Return the database unique name.
|
|
116
|
+
* Unique name is generated by adding a nanoId to the database name.
|
|
117
|
+
* This is used to allow multiple instances of the same database to be opened at the same time.
|
|
118
|
+
*
|
|
119
|
+
* @function
|
|
120
|
+
*/
|
|
121
|
+
getUniqueName(): string;
|
|
111
122
|
/**
|
|
112
123
|
* Returns a READONLY config object which will throw a runtime exception when any setter methods are called.
|
|
113
124
|
*
|