cbl-ionic 0.2.4

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.
Files changed (190) hide show
  1. package/CblIonic.podspec +18 -0
  2. package/LICENSE +201 -0
  3. package/README.md +19 -0
  4. package/android/build.gradle +69 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/cbl/js/kotiln/CollectionConfigDto.kt +5 -0
  7. package/android/src/main/java/cbl/js/kotiln/CollectionDocumentResult.kt +7 -0
  8. package/android/src/main/java/cbl/js/kotiln/CollectionDto.kt +9 -0
  9. package/android/src/main/java/cbl/js/kotiln/CollectionManager.kt +232 -0
  10. package/android/src/main/java/cbl/js/kotiln/ConfigDto.kt +5 -0
  11. package/android/src/main/java/cbl/js/kotiln/DatabaseManager.kt +183 -0
  12. package/android/src/main/java/cbl/js/kotiln/DocumentDto.kt +6 -0
  13. package/android/src/main/java/cbl/js/kotiln/FileSystemHelper.kt +18 -0
  14. package/android/src/main/java/cbl/js/kotiln/LoggingManager.kt +30 -0
  15. package/android/src/main/java/cbl/js/kotiln/ReplicatorManager.kt +123 -0
  16. package/android/src/main/java/cbl/js/kotiln/ScopeDto.kt +6 -0
  17. package/android/src/main/java/com/couchbase/ionic/CblIonicPluginPlugin.kt +1832 -0
  18. package/android/src/main/java/com/couchbase/ionic/IndexDto.kt +12 -0
  19. package/android/src/main/java/com/couchbase/ionic/IndexHelper.kt +30 -0
  20. package/android/src/main/java/com/couchbase/ionic/PluginHelper.kt +283 -0
  21. package/android/src/main/java/com/couchbase/ionic/QueryHelper.kt +62 -0
  22. package/android/src/main/java/com/couchbase/ionic/ReplicatorHelper.kt +174 -0
  23. package/android/src/main/res/.gitkeep +0 -0
  24. package/dist/esm/cblite-js/cblite/core-types.d.ts +634 -0
  25. package/dist/esm/cblite-js/cblite/core-types.js +2 -0
  26. package/dist/esm/cblite-js/cblite/core-types.js.map +1 -0
  27. package/dist/esm/cblite-js/cblite/index.d.ts +2 -0
  28. package/dist/esm/cblite-js/cblite/index.js +4 -0
  29. package/dist/esm/cblite-js/cblite/index.js.map +1 -0
  30. package/dist/esm/cblite-js/cblite/src/abstract-index.d.ts +14 -0
  31. package/dist/esm/cblite-js/cblite/src/abstract-index.js +12 -0
  32. package/dist/esm/cblite-js/cblite/src/abstract-index.js.map +1 -0
  33. package/dist/esm/cblite-js/cblite/src/authenticator.d.ts +6 -0
  34. package/dist/esm/cblite-js/cblite/src/authenticator.js +3 -0
  35. package/dist/esm/cblite-js/cblite/src/authenticator.js.map +1 -0
  36. package/dist/esm/cblite-js/cblite/src/basic-authenticator.d.ts +42 -0
  37. package/dist/esm/cblite-js/cblite/src/basic-authenticator.js +59 -0
  38. package/dist/esm/cblite-js/cblite/src/basic-authenticator.js.map +1 -0
  39. package/dist/esm/cblite-js/cblite/src/blob.d.ts +58 -0
  40. package/dist/esm/cblite-js/cblite/src/blob.js +86 -0
  41. package/dist/esm/cblite-js/cblite/src/blob.js.map +1 -0
  42. package/dist/esm/cblite-js/cblite/src/collation.d.ts +20 -0
  43. package/dist/esm/cblite-js/cblite/src/collation.js +64 -0
  44. package/dist/esm/cblite-js/cblite/src/collation.js.map +1 -0
  45. package/dist/esm/cblite-js/cblite/src/collection-config.d.ts +24 -0
  46. package/dist/esm/cblite-js/cblite/src/collection-config.js +30 -0
  47. package/dist/esm/cblite-js/cblite/src/collection-config.js.map +1 -0
  48. package/dist/esm/cblite-js/cblite/src/collection.d.ts +189 -0
  49. package/dist/esm/cblite-js/cblite/src/collection.js +354 -0
  50. package/dist/esm/cblite-js/cblite/src/collection.js.map +1 -0
  51. package/dist/esm/cblite-js/cblite/src/concurrency-control.d.ts +4 -0
  52. package/dist/esm/cblite-js/cblite/src/concurrency-control.js +8 -0
  53. package/dist/esm/cblite-js/cblite/src/concurrency-control.js.map +1 -0
  54. package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.d.ts +6 -0
  55. package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.js +15 -0
  56. package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.js.map +1 -0
  57. package/dist/esm/cblite-js/cblite/src/database-configuration.d.ts +52 -0
  58. package/dist/esm/cblite-js/cblite/src/database-configuration.js +75 -0
  59. package/dist/esm/cblite-js/cblite/src/database-configuration.js.map +1 -0
  60. package/dist/esm/cblite-js/cblite/src/database-logging.d.ts +13 -0
  61. package/dist/esm/cblite-js/cblite/src/database-logging.js +13 -0
  62. package/dist/esm/cblite-js/cblite/src/database-logging.js.map +1 -0
  63. package/dist/esm/cblite-js/cblite/src/database.d.ts +254 -0
  64. package/dist/esm/cblite-js/cblite/src/database.js +514 -0
  65. package/dist/esm/cblite-js/cblite/src/database.js.map +1 -0
  66. package/dist/esm/cblite-js/cblite/src/definitions.d.ts +7 -0
  67. package/dist/esm/cblite-js/cblite/src/definitions.js +2 -0
  68. package/dist/esm/cblite-js/cblite/src/definitions.js.map +1 -0
  69. package/dist/esm/cblite-js/cblite/src/document-replication.d.ts +13 -0
  70. package/dist/esm/cblite-js/cblite/src/document-replication.js +34 -0
  71. package/dist/esm/cblite-js/cblite/src/document-replication.js.map +1 -0
  72. package/dist/esm/cblite-js/cblite/src/document.d.ts +199 -0
  73. package/dist/esm/cblite-js/cblite/src/document.js +333 -0
  74. package/dist/esm/cblite-js/cblite/src/document.js.map +1 -0
  75. package/dist/esm/cblite-js/cblite/src/endpoint.d.ts +3 -0
  76. package/dist/esm/cblite-js/cblite/src/endpoint.js +2 -0
  77. package/dist/esm/cblite-js/cblite/src/endpoint.js.map +1 -0
  78. package/dist/esm/cblite-js/cblite/src/engine-locator.d.ts +42 -0
  79. package/dist/esm/cblite-js/cblite/src/engine-locator.js +50 -0
  80. package/dist/esm/cblite-js/cblite/src/engine-locator.js.map +1 -0
  81. package/dist/esm/cblite-js/cblite/src/expression.d.ts +134 -0
  82. package/dist/esm/cblite-js/cblite/src/expression.js +374 -0
  83. package/dist/esm/cblite-js/cblite/src/expression.js.map +1 -0
  84. package/dist/esm/cblite-js/cblite/src/file-system.d.ts +7 -0
  85. package/dist/esm/cblite-js/cblite/src/file-system.js +14 -0
  86. package/dist/esm/cblite-js/cblite/src/file-system.js.map +1 -0
  87. package/dist/esm/cblite-js/cblite/src/full-text-expression.d.ts +28 -0
  88. package/dist/esm/cblite-js/cblite/src/full-text-expression.js +38 -0
  89. package/dist/esm/cblite-js/cblite/src/full-text-expression.js.map +1 -0
  90. package/dist/esm/cblite-js/cblite/src/full-text-index.d.ts +47 -0
  91. package/dist/esm/cblite-js/cblite/src/full-text-index.js +77 -0
  92. package/dist/esm/cblite-js/cblite/src/full-text-index.js.map +1 -0
  93. package/dist/esm/cblite-js/cblite/src/index-builder.d.ts +20 -0
  94. package/dist/esm/cblite-js/cblite/src/index-builder.js +25 -0
  95. package/dist/esm/cblite-js/cblite/src/index-builder.js.map +1 -0
  96. package/dist/esm/cblite-js/cblite/src/index.d.ts +42 -0
  97. package/dist/esm/cblite-js/cblite/src/index.js +43 -0
  98. package/dist/esm/cblite-js/cblite/src/index.js.map +1 -0
  99. package/dist/esm/cblite-js/cblite/src/meta-expression.d.ts +10 -0
  100. package/dist/esm/cblite-js/cblite/src/meta-expression.js +30 -0
  101. package/dist/esm/cblite-js/cblite/src/meta-expression.js.map +1 -0
  102. package/dist/esm/cblite-js/cblite/src/meta.d.ts +7 -0
  103. package/dist/esm/cblite-js/cblite/src/meta.js +8 -0
  104. package/dist/esm/cblite-js/cblite/src/meta.js.map +1 -0
  105. package/dist/esm/cblite-js/cblite/src/mutable-document.d.ts +373 -0
  106. package/dist/esm/cblite-js/cblite/src/mutable-document.js +481 -0
  107. package/dist/esm/cblite-js/cblite/src/mutable-document.js.map +1 -0
  108. package/dist/esm/cblite-js/cblite/src/ordering.d.ts +14 -0
  109. package/dist/esm/cblite-js/cblite/src/ordering.js +31 -0
  110. package/dist/esm/cblite-js/cblite/src/ordering.js.map +1 -0
  111. package/dist/esm/cblite-js/cblite/src/parameter.d.ts +18 -0
  112. package/dist/esm/cblite-js/cblite/src/parameter.js +38 -0
  113. package/dist/esm/cblite-js/cblite/src/parameter.js.map +1 -0
  114. package/dist/esm/cblite-js/cblite/src/parameters.d.ts +17 -0
  115. package/dist/esm/cblite-js/cblite/src/parameters.js +61 -0
  116. package/dist/esm/cblite-js/cblite/src/parameters.js.map +1 -0
  117. package/dist/esm/cblite-js/cblite/src/query.d.ts +83 -0
  118. package/dist/esm/cblite-js/cblite/src/query.js +146 -0
  119. package/dist/esm/cblite-js/cblite/src/query.js.map +1 -0
  120. package/dist/esm/cblite-js/cblite/src/replicated-document.d.ts +25 -0
  121. package/dist/esm/cblite-js/cblite/src/replicated-document.js +51 -0
  122. package/dist/esm/cblite-js/cblite/src/replicated-document.js.map +1 -0
  123. package/dist/esm/cblite-js/cblite/src/replicator-activity-level.d.ts +7 -0
  124. package/dist/esm/cblite-js/cblite/src/replicator-activity-level.js +14 -0
  125. package/dist/esm/cblite-js/cblite/src/replicator-activity-level.js.map +1 -0
  126. package/dist/esm/cblite-js/cblite/src/replicator-change.d.ts +14 -0
  127. package/dist/esm/cblite-js/cblite/src/replicator-change.js +14 -0
  128. package/dist/esm/cblite-js/cblite/src/replicator-change.js.map +1 -0
  129. package/dist/esm/cblite-js/cblite/src/replicator-configuration.d.ts +341 -0
  130. package/dist/esm/cblite-js/cblite/src/replicator-configuration.js +516 -0
  131. package/dist/esm/cblite-js/cblite/src/replicator-configuration.js.map +1 -0
  132. package/dist/esm/cblite-js/cblite/src/replicator-progress.d.ts +9 -0
  133. package/dist/esm/cblite-js/cblite/src/replicator-progress.js +20 -0
  134. package/dist/esm/cblite-js/cblite/src/replicator-progress.js.map +1 -0
  135. package/dist/esm/cblite-js/cblite/src/replicator-status.d.ts +13 -0
  136. package/dist/esm/cblite-js/cblite/src/replicator-status.js +29 -0
  137. package/dist/esm/cblite-js/cblite/src/replicator-status.js.map +1 -0
  138. package/dist/esm/cblite-js/cblite/src/replicator.d.ts +108 -0
  139. package/dist/esm/cblite-js/cblite/src/replicator.js +224 -0
  140. package/dist/esm/cblite-js/cblite/src/replicator.js.map +1 -0
  141. package/dist/esm/cblite-js/cblite/src/result.d.ts +4 -0
  142. package/dist/esm/cblite-js/cblite/src/result.js +2 -0
  143. package/dist/esm/cblite-js/cblite/src/result.js.map +1 -0
  144. package/dist/esm/cblite-js/cblite/src/scope.d.ts +31 -0
  145. package/dist/esm/cblite-js/cblite/src/scope.js +34 -0
  146. package/dist/esm/cblite-js/cblite/src/scope.js.map +1 -0
  147. package/dist/esm/cblite-js/cblite/src/session-authenticator.d.ts +32 -0
  148. package/dist/esm/cblite-js/cblite/src/session-authenticator.js +52 -0
  149. package/dist/esm/cblite-js/cblite/src/session-authenticator.js.map +1 -0
  150. package/dist/esm/cblite-js/cblite/src/url-endpoint.d.ts +8 -0
  151. package/dist/esm/cblite-js/cblite/src/url-endpoint.js +12 -0
  152. package/dist/esm/cblite-js/cblite/src/url-endpoint.js.map +1 -0
  153. package/dist/esm/cblite-js/cblite/src/value-index.d.ts +32 -0
  154. package/dist/esm/cblite-js/cblite/src/value-index.js +54 -0
  155. package/dist/esm/cblite-js/cblite/src/value-index.js.map +1 -0
  156. package/dist/esm/cblite-js/cblite/src/variable-expression.d.ts +7 -0
  157. package/dist/esm/cblite-js/cblite/src/variable-expression.js +15 -0
  158. package/dist/esm/cblite-js/cblite/src/variable-expression.js.map +1 -0
  159. package/dist/esm/couchbase-lite/capacitor-engine.d.ts +124 -0
  160. package/dist/esm/couchbase-lite/capacitor-engine.js +303 -0
  161. package/dist/esm/couchbase-lite/capacitor-engine.js.map +1 -0
  162. package/dist/esm/definitions.d.ts +12 -0
  163. package/dist/esm/definitions.js +4 -0
  164. package/dist/esm/definitions.js.map +1 -0
  165. package/dist/esm/index.d.ts +4 -0
  166. package/dist/esm/index.js +5 -0
  167. package/dist/esm/index.js.map +1 -0
  168. package/dist/esm/ionic-couchbase-lite.d.ts +3 -0
  169. package/dist/esm/ionic-couchbase-lite.js +4 -0
  170. package/dist/esm/ionic-couchbase-lite.js.map +1 -0
  171. package/dist/plugin.cjs.js +4400 -0
  172. package/dist/plugin.cjs.js.map +1 -0
  173. package/dist/plugin.js +4403 -0
  174. package/dist/plugin.js.map +1 -0
  175. package/ios/Plugin/CblIonicPlugin.swift +1583 -0
  176. package/ios/Plugin/CblIonicPluginPlugin.h +10 -0
  177. package/ios/Plugin/CblIonicPluginPlugin.m +86 -0
  178. package/ios/Plugin/Info.plist +24 -0
  179. package/ios/Plugin/cbl-js-swift/CollectionManager.swift +489 -0
  180. package/ios/Plugin/cbl-js-swift/DatabaseManager.swift +319 -0
  181. package/ios/Plugin/cbl-js-swift/FileSystemHelper.swift +22 -0
  182. package/ios/Plugin/cbl-js-swift/IndexHelper.swift +36 -0
  183. package/ios/Plugin/cbl-js-swift/LICENSE +201 -0
  184. package/ios/Plugin/cbl-js-swift/LoggingManager.swift +79 -0
  185. package/ios/Plugin/cbl-js-swift/MapHelper.swift +92 -0
  186. package/ios/Plugin/cbl-js-swift/QueryHelper.swift +74 -0
  187. package/ios/Plugin/cbl-js-swift/README.md +9 -0
  188. package/ios/Plugin/cbl-js-swift/ReplicatorHelper.swift +184 -0
  189. package/ios/Plugin/cbl-js-swift/ReplicatorManager.swift +157 -0
  190. package/package.json +86 -0
@@ -0,0 +1,516 @@
1
+ import { CollectionConfig } from './collection-config';
2
+ export var ReplicatorType;
3
+ (function (ReplicatorType) {
4
+ ReplicatorType["PUSH_AND_PULL"] = "PUSH_AND_PULL";
5
+ ReplicatorType["PUSH"] = "PUSH";
6
+ ReplicatorType["PULL"] = "PULL";
7
+ })(ReplicatorType || (ReplicatorType = {}));
8
+ export class ReplicatorConfiguration {
9
+ constructor(target) {
10
+ this.target = target;
11
+ this.replicatorType = ReplicatorType.PUSH_AND_PULL;
12
+ this.target = target;
13
+ this.collections = new Map();
14
+ this.continuous = ReplicatorConfiguration.defaultContinuous;
15
+ this.autoPurgeEnabled = ReplicatorConfiguration.defaultEnableAutoPurge;
16
+ this.heartbeat = ReplicatorConfiguration.defaultHeartbeat;
17
+ this.acceptOnlySelfSignedCerts =
18
+ ReplicatorConfiguration.defaultSelfSignedCertificateOnly;
19
+ this.acceptParentDomainCookies =
20
+ ReplicatorConfiguration.defaultAcceptParentDomainCookies;
21
+ this.allowReplicatingInBackground =
22
+ ReplicatorConfiguration.defaultAllowReplicatingInBackground;
23
+ this.maxAttempts = ReplicatorConfiguration.defaultMaxAttemptsSingleShot;
24
+ this.maxAttemptWaitTime =
25
+ ReplicatorConfiguration.defaultMaxAttemptsWaitTime;
26
+ this.authenticator = undefined;
27
+ this.headers = undefined;
28
+ this.pinnedServerCertificate = undefined;
29
+ }
30
+ // eslint-disable-next-line no-dupe-class-members
31
+ addCollection(collection, config) {
32
+ const cols = [];
33
+ cols.push(collection);
34
+ this.removeCollection(collection);
35
+ if (config === undefined || config === null) {
36
+ config = new CollectionConfig(undefined, undefined);
37
+ }
38
+ this.collections.set(cols, config);
39
+ }
40
+ /**
41
+ * Add multiple collections used for the replication with an optional shared collection configuration.
42
+ * If any of the collections have been added before, the previously added collections and their
43
+ * configuration if specified will be replaced. Adding an empty collection array will be no-ops. if
44
+ * specified will be replaced. If a null or undefined configuration is specified, a default empty configuration will be
45
+ * applied.
46
+ *
47
+ * @function
48
+ */
49
+ addCollections(collections, config) {
50
+ this.removeCollections(collections);
51
+ if (config === undefined || config === null) {
52
+ config = new CollectionConfig(undefined, undefined);
53
+ }
54
+ this.collections.set(collections, config);
55
+ }
56
+ /**
57
+ * returns the setting used to specify the replicator to accept any and only self-signed certs. Any non-self-signed
58
+ * certs will be rejected to avoid accidentally using this mode with the non-self-signed certs in production.
59
+ *
60
+ * @function
61
+ */
62
+ getAcceptOnlySelfSignedCerts() {
63
+ return this.acceptOnlySelfSignedCerts;
64
+ }
65
+ /**
66
+ * returns the setting used as the option to remove the restriction that does not allow the replicator to save the
67
+ * parent-domain cookies, the cookies whose domains are the parent domain of the remote host, from the HTTP
68
+ * response. For example, when the option is set to true, the cookies whose domain are “.foo.com”
69
+ * returned by “bar.foo.com” host will be permitted to save.
70
+ *
71
+ * This option is disabled by default which means that the parent-domain cookies are not permitted to save by default.
72
+ *
73
+ * @function
74
+ */
75
+ getAcceptParentDomainCookies() {
76
+ return this.acceptParentDomainCookies;
77
+ }
78
+ /**
79
+ * returns the setting which is used to allow the replicator to continue replicating in the background.
80
+ * The default value is false, which means that the replicator will suspend itself when the
81
+ * replicator detects that the application is running in the background.
82
+ *
83
+ * If setting the value to true, the developer MUST ensure that the application requests
84
+ * for extending the background task properly in the configuration. See your platforms documentation
85
+ * more information.
86
+ *
87
+ * @function
88
+ */
89
+ getAllowReplicatingInBackground() {
90
+ return this.allowReplicatingInBackground;
91
+ }
92
+ /**
93
+ * return the auto purge feature setting
94
+ *
95
+ * The default value is true which means that the document will be automatically purged by the
96
+ * pull replicator when the user loses access to the document from both removed and revoked scenarios.
97
+ *
98
+ * When the property is set to false, this behavior is disabled and access removed event
99
+ * will be sent to any document listeners that are active on the replicator. For performance
100
+ * reasons, the document listeners must be added **before** the replicator is started, or
101
+ * they will not receive the events.
102
+ *
103
+ * Note: Auto purge will not be performed when documentIDs filter is specified.
104
+ *
105
+ * @function
106
+ */
107
+ getAutoPurgeEnabled() {
108
+ return this.autoPurgeEnabled;
109
+ }
110
+ /**
111
+ * returns the Authenticator to authenticate with a remote target.
112
+ *
113
+ * @function
114
+ */
115
+ getAuthenticator() {
116
+ return this.authenticator;
117
+ }
118
+ /**
119
+ * returns collections used for the replication.
120
+ *
121
+ * @function
122
+ */
123
+ getCollections() {
124
+ const keys = this.collections.keys();
125
+ return Array.from(keys).flat();
126
+ }
127
+ /**
128
+ * returns a copy of the collection’s config. If the config needs to be changed for the collection, the
129
+ * collection will need to be re-added with the updated config.
130
+ *
131
+ * @function
132
+ */
133
+ getCollectionConfig(collection) {
134
+ for (const key of this.collections.keys()) {
135
+ if (key.includes(collection)) {
136
+ return this.collections.get(key);
137
+ }
138
+ }
139
+ return null;
140
+ }
141
+ /**
142
+ * returns the continuous flag indicating whether the replicator should stay
143
+ * active indefinitely to replicate changed documents.
144
+ *
145
+ * @function
146
+ */
147
+ getContinuous() {
148
+ return this.continuous;
149
+ }
150
+ /**
151
+ * returns extra HTTP headers to send in all requests to the remote target.
152
+ *
153
+ * @function
154
+ */
155
+ getHeaders() {
156
+ return this.headers;
157
+ }
158
+ /**
159
+ * returns the heartbeat interval in second.
160
+ *
161
+ * The interval when the replicator sends the ping message to check whether the other peer is
162
+ * still alive. Default heartbeat is ``ReplicatorConfiguration.defaultHeartbeat`` secs.
163
+ *
164
+ * Note: Setting the heartbeat to negative value will result in an Exception
165
+ * being thrown. For backward compatibility, setting it to zero will result in
166
+ * default 300 secs internally.
167
+ *
168
+ * @function
169
+ */
170
+ getHeartbeat() {
171
+ return this.heartbeat;
172
+ }
173
+ /**
174
+ * returns the maximum attempts to perform retry. The retry attempt will be reset when the replicator is
175
+ * able to connect and replicate with the remote server again.
176
+ *
177
+ * Default _maxAttempts_ is ``ReplicatorConfiguration.defaultMaxAttemptsSingleShot`` times
178
+ * for single shot replicators and ``ReplicatorConfiguration.defaultMaxAttemptsContinuous`` times
179
+ * for continuous replicators.
180
+ *
181
+ * Settings the value to 1, will perform an initial request and if there is a transient error
182
+ * occurs, will stop without retry.
183
+ *
184
+ * Note: For backward compatibility, setting it to zero will result in default 10 internally.
185
+ *
186
+ * @function
187
+ */
188
+ getMaxAttempts() {
189
+ return this.maxAttempts;
190
+ }
191
+ /**
192
+ * returns the max wait time for the next attempt(retry) in seconds.
193
+ *
194
+ * The exponential backoff for calculating the wait time will be used by default and cannot be
195
+ * customized. Default max attempts is `ReplicatorConfiguration.defaultMaxAttemptsWaitTime` secs.
196
+ *
197
+ * Set the maxAttemptWaitTime to negative value will result in an Exception
198
+ * being thrown.
199
+ *
200
+ * Note: For backward compatibility, setting it to zero will result in default secs internally.
201
+ *
202
+ * @function
203
+ */
204
+ getMaxAttemptWaitTime() {
205
+ return this.maxAttemptWaitTime;
206
+ }
207
+ /**
208
+ * returns the string value of the remote target's SSL certificate that was previously set in the configuration.
209
+ *
210
+ * Note: The pinned cert will be evaluated against any certs in a cert chain,
211
+ * and the cert chain will be valid only if the cert chain contains the pinned cert.
212
+ *
213
+ * @function
214
+ */
215
+ getPinnedServerCertificate() {
216
+ return this.pinnedServerCertificate;
217
+ }
218
+ /**
219
+ * returns the replicator type indicating the direction of the replicator.
220
+ *
221
+ * @function
222
+ */
223
+ getReplicatorType() {
224
+ return this.replicatorType;
225
+ }
226
+ /**
227
+ * Remove a group of collections from the configuration. If the collection doesn’t exist, this operation will be no ops.
228
+ *
229
+ * @function
230
+ */
231
+ removeCollections(collections) {
232
+ for (const col of collections) {
233
+ for (const key of this.collections.keys()) {
234
+ if (key.includes(col)) {
235
+ this.collections.delete(key);
236
+ }
237
+ }
238
+ }
239
+ }
240
+ /**
241
+ * Remove the collection. If the collection doesn’t exist, this operation will be no ops.
242
+ *
243
+ * @function
244
+ */
245
+ removeCollection(collection) {
246
+ for (const key of this.collections.keys()) {
247
+ if (key.includes(collection)) {
248
+ const newCols = key.filter((col) => col !== collection);
249
+ const config = this.collections.get(key);
250
+ this.collections.delete(key);
251
+ this.collections.set(newCols, config);
252
+ }
253
+ }
254
+ }
255
+ /**
256
+ * Specify the replicator to accept any and only self-signed certs. Any non-self-signed certs will be rejected
257
+ * to avoid accidentally using this mode with the non-self-signed certs in production.
258
+ * Default value is ``ReplicatorConfiguration.defaultSelfSignedCertificateOnly``
259
+ *
260
+ * @function
261
+ */
262
+ setAcceptOnlySelfSignedCerts(selfSignedCerts) {
263
+ this.acceptOnlySelfSignedCerts = selfSignedCerts;
264
+ }
265
+ /**
266
+ * The option to remove the restriction that does not allow the replicator to save the parent-domain
267
+ * cookies, the cookies whose domains are the parent domain of the remote host, from the HTTP
268
+ * response. For example, when the option is set to true, the cookies whose domain are “.foo.com”
269
+ * returned by “bar.foo.com” host will be permitted to save.
270
+ *
271
+ * This option is disabled by default (See ``ReplicatorConfiguration.defaultAcceptParentCookies``)
272
+ * which means that the parent-domain cookies are not permitted to save by default.
273
+ *
274
+ * @function
275
+ */
276
+ setAcceptParentDomainCookies(acceptParentDomainCookies) {
277
+ this.acceptParentDomainCookies = acceptParentDomainCookies;
278
+ }
279
+ /**
280
+ * Allows the replicator to continue replicating in the background. The default
281
+ * value is false, which means that the replicator will suspend itself when the
282
+ * replicator detects that the application is running in the background.
283
+ *
284
+ * If setting the value to true, the developer MUST ensure that the application requests
285
+ * for extending the background task properly in the configuration. See your platforms documentation
286
+ * more information.
287
+ *
288
+ * @function
289
+ */
290
+ setAllowReplicatingInBackground(allowReplicatingInBackground) {
291
+ this.allowReplicatingInBackground = allowReplicatingInBackground;
292
+ }
293
+ /**
294
+ * To enable/disable the auto purge feature
295
+ *
296
+ * The default value is true which means that the document will be automatically purged by the
297
+ * pull replicator when the user loses access to the document from both removed and revoked scenarios.
298
+ *
299
+ * When the property is set to false, this behavior is disabled and access removed event
300
+ * will be sent to any document listeners that are active on the replicator. For performance
301
+ * reasons, the document listeners must be added **before** the replicator is started, or
302
+ * they will not receive the events.
303
+ *
304
+ * Note: Auto purge will not be performed when documentIDs filter is specified.
305
+ *
306
+ * @function
307
+ */
308
+ setAutoPurgeEnabled(autoPurgeEnabled) {
309
+ this.autoPurgeEnabled = autoPurgeEnabled;
310
+ }
311
+ /**
312
+ * The Authenticator to authenticate with a remote target.
313
+ *
314
+ * @function
315
+ */
316
+ setAuthenticator(authenticator) {
317
+ this.authenticator = authenticator;
318
+ }
319
+ /**
320
+ * The continuous flag indicating whether the replicator should stay
321
+ * active indefinitely to replicate changed documents.
322
+ *
323
+ * @function
324
+ */
325
+ setContinuous(continuous) {
326
+ this.continuous = continuous;
327
+ }
328
+ /**
329
+ * Extra HTTP headers to send in all requests to the remote target.
330
+ *
331
+ * @function
332
+ */
333
+ setHeaders(headers) {
334
+ this.headers = headers;
335
+ }
336
+ /**
337
+ * The heartbeat interval in second.
338
+ *
339
+ * The interval when the replicator sends the ping message to check whether the other peer is
340
+ * still alive. Default heartbeat is ``ReplicatorConfiguration.defaultHeartbeat`` secs.
341
+ *
342
+ * Note: Setting the heartbeat to negative value will result in an Exception
343
+ * being thrown. For backward compatibility, setting it to zero will result in
344
+ * default 300 secs internally.
345
+ *
346
+ * @function
347
+ */
348
+ setHeartbeat(heartbeat) {
349
+ this.heartbeat = heartbeat;
350
+ }
351
+ /**
352
+ * The maximum attempts to perform retry. The retry attempt will be reset when the replicator is
353
+ * able to connect and replicate with the remote server again.
354
+ *
355
+ * Default _maxAttempts_ is ``ReplicatorConfiguration.defaultMaxAttemptsSingleShot`` times
356
+ * for single shot replicators and ``ReplicatorConfiguration.defaultMaxAttemptsContinuous`` times
357
+ * for continuous replicators.
358
+ *
359
+ * Settings the value to 1, will perform an initial request and if there is a transient error
360
+ * occurs, will stop without retry.
361
+ *
362
+ * Note: For backward compatibility, setting it to zero will result in default 10 internally.
363
+ *
364
+ * @function
365
+ */
366
+ setMaxAttempts(maxAttempts) {
367
+ this.maxAttempts = maxAttempts;
368
+ }
369
+ /**
370
+ * Max wait time for the next attempt(retry) in seconds.
371
+ *
372
+ * The exponential backoff for calculating the wait time will be used by default and cannot be
373
+ * customized. Default max attempts is `ReplicatorConfiguration.defaultMaxAttemptsWaitTime` secs.
374
+ *
375
+ * Set the maxAttemptWaitTime to negative value will result in an Exception
376
+ * being thrown.
377
+ *
378
+ * Note: For backward compatibility, setting it to zero will result in default secs internally.
379
+ *
380
+ * @function
381
+ */
382
+ setMaxAttemptWaitTime(maxAttemptWaitTime) {
383
+ if (maxAttemptWaitTime >= 0) {
384
+ this.maxAttemptWaitTime = maxAttemptWaitTime;
385
+ }
386
+ else {
387
+ throw new Error('Error: maxAttemptWaitTime cannot be negative.');
388
+ }
389
+ }
390
+ /**
391
+ * The remote target's SSL certificate.
392
+ *
393
+ * Note: The pinned cert will be evaluated against any certs in a cert chain,
394
+ * and the cert chain will be valid only if the cert chain contains the pinned cert.
395
+ *
396
+ * @function
397
+ */
398
+ setPinnedServerCertificate(pinnedServerCertificate) {
399
+ this.pinnedServerCertificate = pinnedServerCertificate;
400
+ }
401
+ /**
402
+ * Replicator type indicating the direction of the replicator.
403
+ *
404
+ * @function
405
+ */
406
+ setReplicatorType(replicatorType) {
407
+ this.replicatorType = replicatorType;
408
+ }
409
+ toJson() {
410
+ const config = {
411
+ acceptParentDomainCookies: this.acceptParentDomainCookies,
412
+ acceptSelfSignedCerts: this.acceptOnlySelfSignedCerts,
413
+ allowReplicationInBackground: this.allowReplicatingInBackground,
414
+ autoPurgeEnabled: this.autoPurgeEnabled,
415
+ authenticator: null,
416
+ collectionConfig: null,
417
+ continuous: this.continuous,
418
+ headers: null,
419
+ heartbeat: this.heartbeat,
420
+ maxAttempts: this.maxAttempts,
421
+ maxAttemptWaitTime: this.maxAttemptWaitTime,
422
+ pinnedServerCertificate: null,
423
+ replicatorType: this.replicatorType,
424
+ target: this.target.toJson(),
425
+ };
426
+ if (this.headers !== undefined) {
427
+ config.headers = this.headers;
428
+ }
429
+ else {
430
+ config.headers = '';
431
+ }
432
+ if (this.pinnedServerCertificate !== undefined) {
433
+ config.pinnedServerCertificate = this.pinnedServerCertificate;
434
+ }
435
+ else {
436
+ config.pinnedServerCertificate = '';
437
+ }
438
+ if (this.authenticator !== undefined) {
439
+ config.authenticator = {
440
+ type: this.authenticator.getType(),
441
+ data: this.authenticator.toJson(),
442
+ };
443
+ }
444
+ else {
445
+ config.authenticator = '';
446
+ }
447
+ if (this.collections.size > 0) {
448
+ if (this.checkCollectionsScopeAndDatabase()) {
449
+ const colArray = [];
450
+ for (const [collections, collectionConfig] of this.collections) {
451
+ const collectionsArray = [];
452
+ for (const collection of collections) {
453
+ collectionsArray.push({ collection: collection.toJson() });
454
+ }
455
+ if (collectionConfig !== undefined || collectionConfig !== null) {
456
+ colArray.push({
457
+ collections: collectionsArray,
458
+ config: collectionConfig,
459
+ });
460
+ }
461
+ else {
462
+ colArray.push({ collections: collectionsArray, config: '' });
463
+ }
464
+ }
465
+ config.collectionConfig = JSON.stringify(colArray);
466
+ }
467
+ else {
468
+ throw new Error('All collections must be from the same database and scope');
469
+ }
470
+ }
471
+ else {
472
+ config.collectionConfig = '';
473
+ }
474
+ return config;
475
+ }
476
+ checkCollectionsScopeAndDatabase() {
477
+ let databaseName = null;
478
+ let scopeName = null;
479
+ // eslint-disable-next-line
480
+ for (const [collections, _] of this.collections) {
481
+ for (const collection of collections) {
482
+ if (databaseName === null && scopeName === null) {
483
+ databaseName = collection.database.getName();
484
+ scopeName = collection.scope.name;
485
+ }
486
+ else if (collection.database.getName() !== databaseName ||
487
+ collection.scope.name !== scopeName) {
488
+ return false;
489
+ }
490
+ }
491
+ }
492
+ return true;
493
+ }
494
+ }
495
+ ReplicatorConfiguration.ReplicatorType = ReplicatorType;
496
+ // Authentication dictionary keys:
497
+ ReplicatorConfiguration.CBLReplicatorOptionCookies = 'cookies'; // HTTP Cookie header value; string
498
+ ReplicatorConfiguration.CBLReplicatorAuthOption = 'auth'; // Auth settings; Dict
499
+ ReplicatorConfiguration.CBLReplicatorAuthType = 'type'; // Auth property; string
500
+ ReplicatorConfiguration.CBLReplicatorAuthUserName = 'username'; // Auth property; string
501
+ ReplicatorConfiguration.CBLReplicatorAuthPassword = 'password'; // Auth property; string
502
+ ReplicatorConfiguration.CBLReplicatorAuthClientCert = 'clientCert'; // Auth property; value platform-dependent
503
+ // auth.type values:
504
+ ReplicatorConfiguration.CBLAuthTypeBasic = 'Basic'; // HTTP Basic (the default)
505
+ ReplicatorConfiguration.CBLAuthTypeSession = 'Session'; // SG session cookie
506
+ ReplicatorConfiguration.CBLAuthTypeOpenIDConnect = 'OpenID Connect';
507
+ ReplicatorConfiguration.CBLAuthTypeClientCert = 'Client Cert';
508
+ ReplicatorConfiguration.defaultContinuous = false;
509
+ ReplicatorConfiguration.defaultEnableAutoPurge = true;
510
+ ReplicatorConfiguration.defaultSelfSignedCertificateOnly = true;
511
+ ReplicatorConfiguration.defaultAcceptParentDomainCookies = false;
512
+ ReplicatorConfiguration.defaultAllowReplicatingInBackground = false;
513
+ ReplicatorConfiguration.defaultHeartbeat = 300;
514
+ ReplicatorConfiguration.defaultMaxAttemptsSingleShot = 10;
515
+ ReplicatorConfiguration.defaultMaxAttemptsWaitTime = 300;
516
+ //# sourceMappingURL=replicator-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicator-configuration.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/replicator-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,iDAA+B,CAAA;IAC/B,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,OAAO,uBAAuB;IAwClC,YAAoB,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;QAClC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC,UAAU,GAAG,uBAAuB,CAAC,iBAAiB,CAAC;QAC5D,IAAI,CAAC,gBAAgB,GAAG,uBAAuB,CAAC,sBAAsB,CAAC;QACvE,IAAI,CAAC,SAAS,GAAG,uBAAuB,CAAC,gBAAgB,CAAC;QAC1D,IAAI,CAAC,yBAAyB;YAC5B,uBAAuB,CAAC,gCAAgC,CAAC;QAC3D,IAAI,CAAC,yBAAyB;YAC5B,uBAAuB,CAAC,gCAAgC,CAAC;QAC3D,IAAI,CAAC,4BAA4B;YAC/B,uBAAuB,CAAC,mCAAmC,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,uBAAuB,CAAC,4BAA4B,CAAC;QACxE,IAAI,CAAC,kBAAkB;YACrB,uBAAuB,CAAC,0BAA0B,CA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YAAY;oBAC9C,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EACnC,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;;AAtjBe,sCAAc,GAAG,cAAc,CAAC;AAEhD,kCAAkC;AAC3B,kDAA0B,GAAG,SAAS,CAAC,CAAC,mCAAmC;AAC3E,+CAAuB,GAAG,MAAM,CAAC,CAAC,sBAAsB;AACxD,6CAAqB,GAAG,MAAM,CAAC,CAAC,wBAAwB;AACxD,iDAAyB,GAAG,UAAU,CAAC,CAAC,wBAAwB;AAChE,iDAAyB,GAAG,UAAU,CAAC,CAAC,wBAAwB;AAChE,mDAA2B,GAAG,YAAY,CAAC,CAAC,0CAA0C;AAE7F,oBAAoB;AACb,wCAAgB,GAAG,OAAO,CAAC,CAAC,2BAA2B;AACvD,0CAAkB,GAAG,SAAS,CAAC,CAAC,oBAAoB;AACpD,gDAAwB,GAAG,gBAAgB,CAAC;AAC5C,6CAAqB,GAAG,aAAa,CAAC;AAgB/B,yCAAiB,GAAY,KAAK,CAAC;AACnC,8CAAsB,GAAY,IAAI,CAAC;AACvC,wDAAgC,GAAY,IAAI,CAAC;AACjD,wDAAgC,GAAY,KAAK,CAAC;AAClD,2DAAmC,GAAY,KAAK,CAAC;AACrD,wCAAgB,GAAW,GAAG,CAAC;AAC/B,oDAA4B,GAAW,EAAE,CAAC;AAC1C,kDAA0B,GAAW,GAAG,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare class ReplicatorProgress {
2
+ private completed;
3
+ private total;
4
+ constructor(completed: number, total: number);
5
+ getCompleted(): number;
6
+ getTotal(): number;
7
+ toString(): string;
8
+ copy(): ReplicatorProgress;
9
+ }
@@ -0,0 +1,20 @@
1
+ export class ReplicatorProgress {
2
+ // eslint-disable-next-line
3
+ constructor(completed, total) {
4
+ this.completed = completed;
5
+ this.total = total;
6
+ }
7
+ getCompleted() {
8
+ return this.completed;
9
+ }
10
+ getTotal() {
11
+ return this.total;
12
+ }
13
+ toString() {
14
+ return `Progress{completed=${this.completed}, total=${this.total}}`;
15
+ }
16
+ copy() {
17
+ return new ReplicatorProgress(this.completed, this.total);
18
+ }
19
+ }
20
+ //# sourceMappingURL=replicator-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicator-progress.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/replicator-progress.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAkB;IAC7B,2BAA2B;IAC3B,YAAoB,SAAiB,EAAU,KAAa;QAAxC,cAAS,GAAT,SAAS,CAAQ;QAAU,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEhE,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,sBAAsB,IAAI,CAAC,SAAS,WAAW,IAAI,CAAC,KAAK,GAAG,CAAC;IACtE,CAAC;IAED,IAAI;QACF,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { ReplicatorActivityLevel } from './replicator-activity-level';
2
+ import { ReplicatorProgress } from './replicator-progress';
3
+ export declare class ReplicatorStatus {
4
+ private activityLevel;
5
+ private progress;
6
+ private error;
7
+ constructor(activityLevel: ReplicatorActivityLevel, progress: ReplicatorProgress, error: string | undefined);
8
+ getActivityLevel(): ReplicatorActivityLevel;
9
+ getProgress(): ReplicatorProgress;
10
+ getError(): string | undefined;
11
+ toString(): string;
12
+ copy(): ReplicatorStatus;
13
+ }
@@ -0,0 +1,29 @@
1
+ export class ReplicatorStatus {
2
+ // eslint-disable-next-line
3
+ constructor(activityLevel, progress, error) {
4
+ this.activityLevel = activityLevel;
5
+ this.progress = progress;
6
+ this.error = error;
7
+ }
8
+ getActivityLevel() {
9
+ return this.activityLevel;
10
+ }
11
+ getProgress() {
12
+ return this.progress;
13
+ }
14
+ getError() {
15
+ return this.error;
16
+ }
17
+ toString() {
18
+ if (this.error !== undefined) {
19
+ return `Status{activityLevel=${this.activityLevel}, progress=${this.progress}}, error=${this.error}`;
20
+ }
21
+ else {
22
+ return `Status{activityLevel=${this.activityLevel}, progress=${this.progress}}`;
23
+ }
24
+ }
25
+ copy() {
26
+ return new ReplicatorStatus(this.activityLevel, this.progress, this.error);
27
+ }
28
+ }
29
+ //# sourceMappingURL=replicator-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replicator-status.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/replicator-status.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,gBAAgB;IACzB,2BAA2B;IAC7B,YAAoB,aAAsC,EAAU,QAA4B,EAAU,KAAyB;QAA/G,kBAAa,GAAb,aAAa,CAAyB;QAAU,aAAQ,GAAR,QAAQ,CAAoB;QAAU,UAAK,GAAL,KAAK,CAAoB;IAAG,CAAC;IAEvI,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,wBAAwB,IAAI,CAAC,aAAa,cAAc,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QACvG,CAAC;aAAM,CAAC;YACN,OAAO,wBAAwB,IAAI,CAAC,aAAa,cAAc,IAAI,CAAC,QAAQ,GAAG,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI;QACF,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;CACF"}