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,42 @@
1
+ import { Dictionary } from './definitions';
2
+ import { Authenticator } from './authenticator';
3
+ export declare class BasicAuthenticator extends Authenticator {
4
+ private username;
5
+ private password;
6
+ constructor(username: string, password: string);
7
+ /**
8
+ * Configures basic authentication options for a replicator
9
+ * @param {Dictionary} options - The replicator configuration options to be modified
10
+ * @returns {Dictionary} The authentication configuration containing username and password
11
+ * @example
12
+ * const authenticator = new BasicAuthenticator('user', 'password');
13
+ * const config = {};
14
+ * const auth = authenticator.authenticate(config);
15
+ * // config now contains the auth settings
16
+ * // auth contains: { type: 'basic', username: 'user', password: 'password' }
17
+ */
18
+ authenticate(options: Dictionary): {
19
+ [x: string]: string;
20
+ };
21
+ /**
22
+ * Returns the authentication type identifier
23
+ * @returns {string} The string 'basic' indicating basic authentication
24
+ * @example
25
+ * const authenticator = new BasicAuthenticator('user', 'password');
26
+ * const type = authenticator.getType();
27
+ * // Returns: 'basic'
28
+ */
29
+ getType(): string;
30
+ /**
31
+ * Converts the authenticator to a JSON-compatible object
32
+ * @returns {{ username: string, password: string }} An object containing the authenticator's credentials
33
+ * @example
34
+ * const authenticator = new BasicAuthenticator('user', 'password');
35
+ * const json = authenticator.toJson();
36
+ * // Returns: { username: 'user', password: 'password' }
37
+ */
38
+ toJson(): {
39
+ username: string;
40
+ password: string;
41
+ };
42
+ }
@@ -0,0 +1,59 @@
1
+ import { ReplicatorConfiguration } from './replicator-configuration';
2
+ import { Authenticator } from './authenticator';
3
+ export class BasicAuthenticator extends Authenticator {
4
+ constructor(
5
+ // eslint-disable-next-line
6
+ username,
7
+ // eslint-disable-next-line
8
+ password) {
9
+ super();
10
+ this.username = username;
11
+ this.password = password;
12
+ }
13
+ /**
14
+ * Configures basic authentication options for a replicator
15
+ * @param {Dictionary} options - The replicator configuration options to be modified
16
+ * @returns {Dictionary} The authentication configuration containing username and password
17
+ * @example
18
+ * const authenticator = new BasicAuthenticator('user', 'password');
19
+ * const config = {};
20
+ * const auth = authenticator.authenticate(config);
21
+ * // config now contains the auth settings
22
+ * // auth contains: { type: 'basic', username: 'user', password: 'password' }
23
+ */
24
+ authenticate(options) {
25
+ const auth = {
26
+ [ReplicatorConfiguration.CBLReplicatorAuthType]: ReplicatorConfiguration.CBLAuthTypeBasic,
27
+ [ReplicatorConfiguration.CBLReplicatorAuthUserName]: this.username,
28
+ [ReplicatorConfiguration.CBLReplicatorAuthPassword]: this.password,
29
+ };
30
+ options[ReplicatorConfiguration.CBLReplicatorAuthOption] = auth;
31
+ return auth;
32
+ }
33
+ /**
34
+ * Returns the authentication type identifier
35
+ * @returns {string} The string 'basic' indicating basic authentication
36
+ * @example
37
+ * const authenticator = new BasicAuthenticator('user', 'password');
38
+ * const type = authenticator.getType();
39
+ * // Returns: 'basic'
40
+ */
41
+ getType() {
42
+ return 'basic';
43
+ }
44
+ /**
45
+ * Converts the authenticator to a JSON-compatible object
46
+ * @returns {{ username: string, password: string }} An object containing the authenticator's credentials
47
+ * @example
48
+ * const authenticator = new BasicAuthenticator('user', 'password');
49
+ * const json = authenticator.toJson();
50
+ * // Returns: { username: 'user', password: 'password' }
51
+ */
52
+ toJson() {
53
+ return {
54
+ username: this.username,
55
+ password: this.password,
56
+ };
57
+ }
58
+ }
59
+ //# sourceMappingURL=basic-authenticator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic-authenticator.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/basic-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD;IACE,2BAA2B;IACnB,QAAgB;IACxB,2BAA2B;IACnB,QAAgB;QAExB,KAAK,EAAE,CAAC;QAJA,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,aAAQ,GAAR,QAAQ,CAAQ;IAG1B,CAAC;IAEC;;;;;;;;;;KAUC;IACH,YAAY,CAAC,OAAmB;QAC9B,MAAM,IAAI,GAAG;YACX,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAC7C,uBAAuB,CAAC,gBAAgB;YAC1C,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,EAAE,IAAI,CAAC,QAAQ;YAClE,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,EAAE,IAAI,CAAC,QAAQ;SACnE,CAAC;QACF,OAAO,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IAEC;;;;;;;KAOC;IACH,OAAO;QACL,OAAO,OAAO,CAAC;IACjB,CAAC;IAEA;;;;;;;MAOE;IACH,MAAM;QACJ,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,58 @@
1
+ export declare class Blob {
2
+ private contentType;
3
+ digest: string;
4
+ length: number;
5
+ bytes: ArrayBuffer;
6
+ /**
7
+ * Creates a new Blob instance to store binary data with a specified content type
8
+ * @param contentType - The MIME type of the blob content (e.g., 'image/jpeg', 'text/plain')
9
+ * @param data - The binary data as either a Uint8Array or ArrayBuffer
10
+ * @example
11
+ * // Create from Uint8Array
12
+ * const uint8Array = new Uint8Array([1, 2, 3]);
13
+ * const blob1 = new Blob('text/plain', uint8Array);
14
+ *
15
+ * // Create from ArrayBuffer
16
+ * const arrayBuffer = new ArrayBuffer(3);
17
+ * const blob2 = new Blob('text/plain', arrayBuffer);
18
+ */
19
+ constructor(contentType: string, data: Uint8Array | ArrayBuffer);
20
+ /**
21
+ * Creates a new Blob instance from a JSON string representation
22
+ * @param jsonString - A JSON string containing blob data with format: { contentType: string, bytes: number[] }
23
+ * @returns A new Blob instance
24
+ * @throws {Error} If the JSON is invalid, missing required properties, or has incorrect types
25
+ * @example
26
+ * const jsonStr = '{"contentType": "image/jpeg", "bytes": [255, 216, 255, 224]}';
27
+ * const blob = Blob.fromJSON(jsonStr);
28
+ */
29
+ static fromJSON(jsonString: string): Blob;
30
+ /**
31
+ * Returns the raw binary data of the blob
32
+ * @returns {Uint8Array} The blob's content as an Uint8Array
33
+ */
34
+ getBytes(): Uint8Array;
35
+ /**
36
+ * Returns the MIME type of the blob's content
37
+ * @returns {string} The content type (MIME type) of the blob
38
+ */
39
+ getContentType(): string;
40
+ /**
41
+ * Returns the cryptographic digest (hash) of the blob's content
42
+ * @returns {string} The blob's content digest
43
+ */
44
+ getDigest(): string;
45
+ /**
46
+ * Returns the size of the blob's content in bytes
47
+ * @returns {number} The length of the blob in bytes
48
+ */
49
+ getLength(): number;
50
+ /**
51
+ * Converts the blob into a plain JavaScript object representation
52
+ * @returns {{ contentType: string, data: number[] }} An object containing the blob's content type and data as a byte array
53
+ */
54
+ toDictionary(): {
55
+ contentType: string;
56
+ data: number[];
57
+ };
58
+ }
@@ -0,0 +1,86 @@
1
+ export class Blob {
2
+ /**
3
+ * Creates a new Blob instance to store binary data with a specified content type
4
+ * @param contentType - The MIME type of the blob content (e.g., 'image/jpeg', 'text/plain')
5
+ * @param data - The binary data as either a Uint8Array or ArrayBuffer
6
+ * @example
7
+ * // Create from Uint8Array
8
+ * const uint8Array = new Uint8Array([1, 2, 3]);
9
+ * const blob1 = new Blob('text/plain', uint8Array);
10
+ *
11
+ * // Create from ArrayBuffer
12
+ * const arrayBuffer = new ArrayBuffer(3);
13
+ * const blob2 = new Blob('text/plain', arrayBuffer);
14
+ */
15
+ constructor(contentType, data) {
16
+ this.contentType = contentType;
17
+ this.contentType = contentType;
18
+ this.bytes = data instanceof Uint8Array ? data.buffer : data;
19
+ }
20
+ /**
21
+ * Creates a new Blob instance from a JSON string representation
22
+ * @param jsonString - A JSON string containing blob data with format: { contentType: string, bytes: number[] }
23
+ * @returns A new Blob instance
24
+ * @throws {Error} If the JSON is invalid, missing required properties, or has incorrect types
25
+ * @example
26
+ * const jsonStr = '{"contentType": "image/jpeg", "bytes": [255, 216, 255, 224]}';
27
+ * const blob = Blob.fromJSON(jsonStr);
28
+ */
29
+ static fromJSON(jsonString) {
30
+ try {
31
+ const data = JSON.parse(jsonString);
32
+ // Validate required properties and types
33
+ if (!data.contentType || typeof data.contentType !== 'string') {
34
+ throw new Error('Invalid or missing contentType property');
35
+ }
36
+ if (!Array.isArray(data.bytes)) {
37
+ throw new Error('Invalid or missing bytes property');
38
+ }
39
+ // Convert number array back to ArrayBuffer
40
+ const bytes = new Uint8Array(data.bytes);
41
+ return new Blob(data.contentType, bytes);
42
+ }
43
+ catch (e) {
44
+ throw new Error(`Failed to parse Blob JSON: ${e.message}`);
45
+ }
46
+ }
47
+ /**
48
+ * Returns the raw binary data of the blob
49
+ * @returns {Uint8Array} The blob's content as an Uint8Array
50
+ */
51
+ getBytes() {
52
+ return new Uint8Array(this.bytes);
53
+ }
54
+ /**
55
+ * Returns the MIME type of the blob's content
56
+ * @returns {string} The content type (MIME type) of the blob
57
+ */
58
+ getContentType() {
59
+ return this.contentType;
60
+ }
61
+ /**
62
+ * Returns the cryptographic digest (hash) of the blob's content
63
+ * @returns {string} The blob's content digest
64
+ */
65
+ getDigest() {
66
+ return this.digest;
67
+ }
68
+ /**
69
+ * Returns the size of the blob's content in bytes
70
+ * @returns {number} The length of the blob in bytes
71
+ */
72
+ getLength() {
73
+ return this.length;
74
+ }
75
+ /**
76
+ * Converts the blob into a plain JavaScript object representation
77
+ * @returns {{ contentType: string, data: number[] }} An object containing the blob's content type and data as a byte array
78
+ */
79
+ toDictionary() {
80
+ return {
81
+ contentType: this.contentType,
82
+ data: Array.from(new Uint8Array(this.bytes)),
83
+ };
84
+ }
85
+ }
86
+ //# sourceMappingURL=blob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/blob.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,IAAI;IAKb;;;;;;;;;;;;KAYC;IACH,YACU,WAAmB,EAC3B,IAA8B;QADtB,gBAAW,GAAX,WAAW,CAAQ;QAG3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/D,CAAC;IAEA;;;;;;;;MAQE;IACH,MAAM,CAAC,QAAQ,CAAC,UAAkB;QAChC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAa,CAAC;YAEhD,yCAAyC;YACzC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,CAAC;YAED,2CAA2C;YAC3C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEzC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAEC;;;KAGC;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEA;;;MAGE;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEA;;;MAGE;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEC;;;KAGC;IACH,YAAY;QACV,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC7C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ export declare class Collation {
2
+ protected _unicode: boolean;
3
+ protected _ignoreCase: boolean;
4
+ protected _ignoreAccents: boolean;
5
+ protected _locale: string;
6
+ static ascii(): CollationASCII;
7
+ static unicode(): CollationUnicode;
8
+ toString(): string;
9
+ asJSON(): any;
10
+ }
11
+ export declare class CollationASCII extends Collation {
12
+ constructor();
13
+ ignoreCase(ignoreCase: boolean): this;
14
+ }
15
+ export declare class CollationUnicode extends Collation {
16
+ constructor();
17
+ ignoreCase(ignoreCase: boolean): this;
18
+ ignoreAccents(ignoreAccents: boolean): this;
19
+ locale(locale: string): this;
20
+ }
@@ -0,0 +1,64 @@
1
+ export class Collation {
2
+ constructor() {
3
+ this._unicode = false;
4
+ this._ignoreCase = false;
5
+ this._ignoreAccents = false;
6
+ this._locale = null;
7
+ }
8
+ static ascii() {
9
+ return new CollationASCII();
10
+ }
11
+ static unicode() {
12
+ return new CollationUnicode();
13
+ }
14
+ toString() {
15
+ return ('Collation{' +
16
+ 'unicode=' +
17
+ this._unicode +
18
+ ', ignoreCase=' +
19
+ this._ignoreCase +
20
+ ', ignoreAccents=' +
21
+ this._ignoreAccents +
22
+ ", locale='" +
23
+ this._locale +
24
+ "'" +
25
+ '}');
26
+ }
27
+ asJSON() {
28
+ const json = {};
29
+ json.UNICODE = this._unicode;
30
+ json.LOCALE = this._locale == null ? null : this._locale;
31
+ json.CASE = !this._ignoreCase;
32
+ json.DIAC = !this._ignoreAccents;
33
+ return json;
34
+ }
35
+ }
36
+ export class CollationASCII extends Collation {
37
+ constructor() {
38
+ super();
39
+ this._unicode = false;
40
+ }
41
+ ignoreCase(ignoreCase) {
42
+ this._ignoreCase = ignoreCase;
43
+ return this;
44
+ }
45
+ }
46
+ export class CollationUnicode extends Collation {
47
+ constructor() {
48
+ super();
49
+ this._unicode = true;
50
+ }
51
+ ignoreCase(ignoreCase) {
52
+ this._ignoreCase = ignoreCase;
53
+ return this;
54
+ }
55
+ ignoreAccents(ignoreAccents) {
56
+ this._ignoreAccents = ignoreAccents;
57
+ return this;
58
+ }
59
+ locale(locale) {
60
+ this._locale = locale;
61
+ return this;
62
+ }
63
+ }
64
+ //# sourceMappingURL=collation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collation.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/collation.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAAtB;QACY,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,KAAK,CAAC;QACpB,mBAAc,GAAG,KAAK,CAAC;QACvB,YAAO,GAAW,IAAI,CAAC;IAkCnC,CAAC;IAhCC,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,cAAc,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAChC,CAAC;IAED,QAAQ;QACN,OAAO,CACL,YAAY;YACZ,UAAU;YACV,IAAI,CAAC,QAAQ;YACb,eAAe;YACf,IAAI,CAAC,WAAW;YAChB,kBAAkB;YAClB,IAAI,CAAC,cAAc;YACnB,YAAY;YACZ,IAAI,CAAC,OAAO;YACZ,GAAG;YACH,GAAG,CACJ,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,GAAQ,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,UAAU,CAAC,UAAmB;QAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,UAAU,CAAC,UAAmB;QAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,aAAsB;QAClC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ export declare class CollectionConfig {
2
+ private channels;
3
+ private documentIds;
4
+ /**
5
+ * The collection configuration that can be configured specifically for the replication.
6
+ */
7
+ constructor(channels: string[] | null | undefined, documentIds: string[] | null | undefined);
8
+ /**
9
+ * An array of Sync Gateway/App Services channel names to pull from. Ignored for push replication. If unset, all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.
10
+ * @param {string[]} channels - Array of channel names to configure for the collection
11
+ * @example
12
+ * const config = new CollectionConfig();
13
+ * config.setChannels(['channel1', 'channel2']);
14
+ */
15
+ setChannels(channels: string[]): void;
16
+ /**
17
+ * A set of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.
18
+ * @param {string[]} documentIds - Array of document IDs to include in replication
19
+ * @example
20
+ * const config = new CollectionConfig();
21
+ * config.setDocumentIDs(['doc1', 'doc2', 'doc3']);
22
+ */
23
+ setDocumentIDs(documentIds: string[]): void;
24
+ }
@@ -0,0 +1,30 @@
1
+ export class CollectionConfig {
2
+ /**
3
+ * The collection configuration that can be configured specifically for the replication.
4
+ */
5
+ constructor(channels, documentIds) {
6
+ this.channels = channels ?? [];
7
+ this.documentIds = documentIds ?? [];
8
+ }
9
+ /**
10
+ * An array of Sync Gateway/App Services channel names to pull from. Ignored for push replication. If unset, all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.
11
+ * @param {string[]} channels - Array of channel names to configure for the collection
12
+ * @example
13
+ * const config = new CollectionConfig();
14
+ * config.setChannels(['channel1', 'channel2']);
15
+ */
16
+ setChannels(channels) {
17
+ this.channels = channels;
18
+ }
19
+ /**
20
+ * A set of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.
21
+ * @param {string[]} documentIds - Array of document IDs to include in replication
22
+ * @example
23
+ * const config = new CollectionConfig();
24
+ * config.setDocumentIDs(['doc1', 'doc2', 'doc3']);
25
+ */
26
+ setDocumentIDs(documentIds) {
27
+ this.documentIds = documentIds;
28
+ }
29
+ }
30
+ //# sourceMappingURL=collection-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-config.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/collection-config.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAgB;IAI5B;;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;CACF"}
@@ -0,0 +1,189 @@
1
+ import { Scope } from './scope';
2
+ import { AbstractIndex } from './abstract-index';
3
+ import { Database } from './database';
4
+ import { Document } from './document';
5
+ import { ConcurrencyControl } from './concurrency-control';
6
+ import { MutableDocument } from './mutable-document';
7
+ import { DocumentChangeListener, CollectionChangeListener, ICoreEngine } from '../core-types';
8
+ interface CollectionJson {
9
+ name: string;
10
+ scopeName: string;
11
+ databaseName: string;
12
+ }
13
+ export declare class Collection {
14
+ private _engine;
15
+ private _changeListener;
16
+ private _didStartListener;
17
+ private _documentChangeListener;
18
+ private _didStartDocumentListener;
19
+ constructor(name: string | undefined, scope: Scope | undefined, database: Database);
20
+ /**
21
+ * Collection's database
22
+ *
23
+ * @property
24
+ */
25
+ database: Database;
26
+ /**
27
+ * returns Collection's fully qualified name in the '<scope-name>.<collection-name>' format.
28
+ *
29
+ * @property
30
+ */
31
+ fullName: () => string;
32
+ /**
33
+ * Collection's name.
34
+ *
35
+ * @property
36
+ */
37
+ name: string;
38
+ /**
39
+ * Collection's scope.
40
+ *
41
+ * @property
42
+ */
43
+ scope: Scope;
44
+ /**
45
+ * Set a given CollectionChangeListener to the collection.
46
+ *
47
+ * @function
48
+ */
49
+ addChangeListener(listener: CollectionChangeListener): Promise<string>;
50
+ /**
51
+ * Set a given Collection Document Change Listener to a given document in a collection.
52
+ *
53
+ * @function
54
+ */
55
+ addDocumentChangeListener(documentId: string, listener: DocumentChangeListener): Promise<string>;
56
+ /**
57
+ * Total number of documents in the collection.
58
+ *
59
+ * @function
60
+ */
61
+ count(): Promise<{
62
+ count: number;
63
+ }>;
64
+ /**
65
+ * Create an index with the index name and AbstractIndex.
66
+ *
67
+ * @function
68
+ */
69
+ createIndex(indexName: string, index: AbstractIndex): Promise<void>;
70
+ /**
71
+ * Delete a document from the collection. The default concurrency control, lastWriteWins,
72
+ * will be used when there is conflict during delete. If the document doesn’t exist in the
73
+ * collection, an error will be thrown.
74
+ *
75
+ * When deleting a document that already belongs to a collection, the collection instance of
76
+ * the document and this collection instance must be the same, otherwise, an
77
+ * error will be thrown.
78
+ *
79
+ * Throws an Error if the collection is deleted or the database is closed.
80
+ *
81
+ * @function
82
+ */
83
+ deleteDocument(document: Document, concurrencyControl?: ConcurrencyControl): Promise<void>;
84
+ /**
85
+ * Delete an index by name.
86
+ *
87
+ * @function
88
+ */
89
+ deleteIndex(indexName: string): Promise<void>;
90
+ /**
91
+ * Get an existing document by document ID.
92
+ *
93
+ * Throws an error if the collection is deleted or the database is closed.
94
+ *
95
+ * @function
96
+ */
97
+ document(id: string): Promise<Document>;
98
+ /**
99
+ * Get an existing document by document ID.
100
+ *
101
+ * Throws an error if the collection is deleted or the database is closed.
102
+ *
103
+ * @function
104
+ */
105
+ getDocument(id: string): Promise<Document>;
106
+ /**
107
+ * Get the expiration date set to the document of the given id.
108
+
109
+ * Throws an error, if the collection is deleted or the database is closed.
110
+ *
111
+ * @function
112
+ */
113
+ getDocumentExpiration(id: string): Promise<Date | null>;
114
+ /**
115
+ * Return ICoreEngine instance.
116
+ *
117
+ * @function
118
+ */
119
+ getEngine(): ICoreEngine;
120
+ /**
121
+ * Return all index names
122
+ *
123
+ * @function
124
+ */
125
+ indexes(): Promise<string[]>;
126
+ /**
127
+ * send data to the listener
128
+ *
129
+ * @function
130
+ */
131
+ private notifyChangeListeners;
132
+ /**
133
+ * send data to the document change listener
134
+ *
135
+ * @function
136
+ */
137
+ private notifyDocumentChangeListeners;
138
+ /**
139
+ * Purge a document by id from the collection. If the document doesn’t exist in the
140
+ * collection, an error will be thrown.
141
+ *
142
+ * Throws an error if the collection is deleted or the database is closed.
143
+ *
144
+ * @function
145
+ */
146
+ purge(document: Document): Promise<void>;
147
+ /**
148
+ * Purge a document by id from the collection. If the document doesn’t exist in the
149
+ * collection, an error will be thrown.
150
+ *
151
+ * Throws an error if the collection is deleted or the database is closed.
152
+ *
153
+ * @function
154
+ */
155
+ purgeById(documentId: string): Promise<void>;
156
+ /**
157
+ * Remove the collection change listener.
158
+ *
159
+ * Throws an error if the collection is deleted or the database is closed.
160
+ *
161
+ * @function
162
+ */
163
+ removeChangeListener(token: string): Promise<void>;
164
+ /**
165
+ * Remove the collection document change listener.
166
+ *
167
+ * Throws an error if the collection is deleted or the database is closed.
168
+ *
169
+ * @function
170
+ */
171
+ removeDocumentChangeListener(token: string): Promise<void>;
172
+ /**
173
+ * Save a document into the collection. The default concurrency control, lastWriteWins, will
174
+ * be used when there is conflict during save.
175
+ *
176
+ * When saving a document that already belongs to a collection, the collection instance of
177
+ * the document and this collection instance must be the same, otherwise, an
178
+ * error will be thrown.
179
+ *
180
+ * Throws an error if the collection is deleted or the database is closed.
181
+ *
182
+ * @function
183
+ */
184
+ save(document: MutableDocument, concurrencyControl?: ConcurrencyControl): Promise<void>;
185
+ setDocumentExpiration(id: string, expiration: Date | null): Promise<void>;
186
+ toJson(): CollectionJson;
187
+ private uuid;
188
+ }
189
+ export {};