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,199 @@
1
+ import { Dictionary } from './definitions';
2
+ import { Blob } from './blob';
3
+ import { Collection } from './collection';
4
+ export declare class Document {
5
+ protected id: string;
6
+ protected sequenceNo: number;
7
+ protected revisionID: string;
8
+ protected collection: Collection;
9
+ protected doc: Dictionary;
10
+ private _engine;
11
+ constructor(id?: string, sequenceNo?: number, revisionID?: string, collection?: Collection, data?: Dictionary);
12
+ /**
13
+ * The number of properties in the document.
14
+ *
15
+ * Throws an error if the collection is deleted or the database is closed.
16
+ *
17
+ * @function
18
+ */
19
+ count(): number;
20
+ /**
21
+ * Returns the document data as a dictionary.
22
+ *
23
+ * Throws an error if the collection is deleted or the database is closed.
24
+ *
25
+ * @function
26
+ */
27
+ getData(): Dictionary;
28
+ private _get;
29
+ /**
30
+ * Get a property’s value as a ArrayObject, which is a mapping object of an array value.
31
+ * Returns null if the property doesn’t exists, or its value is not an array.
32
+ *
33
+ * Throws an error if the collection is deleted or the database is closed.
34
+ *
35
+ * @function
36
+ */
37
+ getArray(key: string): [] | null;
38
+ /**
39
+ * Returns metadata associated with the Blob. Use getBlobContent() to get the Blob’s data.
40
+ * Throws an error if the collection is deleted or the database is closed.
41
+ *
42
+ * @function
43
+ */
44
+ getBlob(key: string): Blob | null;
45
+ /**
46
+ * @deprecated - use the Blob API getBytes() function instead
47
+ *
48
+ * Get a property’s value as a ArrayBuffer. Returns null if the property doesn’t exist,
49
+ * or its value is not a blob.
50
+ *
51
+ * Throws an error if the collection is deleted or the database is closed.
52
+ *
53
+ * @function
54
+ */
55
+ getBlobContent(key: string): Promise<ArrayBuffer>;
56
+ /**
57
+ * Gets a property’s value as a boolean value. Returns true if the value exists,
58
+ * and is either true or a nonzero number.
59
+ *
60
+ * Throws an error if the collection is deleted or the database is closed.
61
+ *
62
+ * @function
63
+ */
64
+ getBoolean(key: string): boolean | null;
65
+ /**
66
+ * The collection that the document belongs to.
67
+ *
68
+ * Throws an error if the database is closed.
69
+ *
70
+ * @function
71
+ */
72
+ getCollection(): Collection | null;
73
+ /**
74
+ * Gets a property’s value as a Date value. JSON does not directly support dates, so
75
+ * the actual property value must be a string, which is then parsed according to the
76
+ * ISO-8601 date format (the default used in JSON.) Returns null if the value doesn’t
77
+ * exist, is not a string, or is not parseable as a date. NOTE: This is not a generic
78
+ * date parser! It only recognizes the ISO-8601 format, with milliseconds.
79
+ *
80
+ * Throws an error if the collection is deleted or the database is closed.
81
+ *
82
+ * @function
83
+ */
84
+ getDate(key: string): Date | null;
85
+ /**
86
+ * Get a property’s value as a Dictionary, which is a mapping object of a dictionary
87
+ * value. Returns null if the property doesn’t exists, or its value is not a dictionary.
88
+ *
89
+ * Throws an error if the collection is deleted or the database is closed.
90
+ *
91
+ * @function
92
+ */
93
+ getDictionary(key: string): Dictionary | null;
94
+ /**
95
+ * Gets a property’s value as a double value. Integers will be converted to double.
96
+ * The value true is returned as 1.0, false as 0.0. Returns 0.0 if the property doesn’t
97
+ * exist or does not have a numeric value.
98
+ *
99
+ * Throws an error if the collection is deleted or the database is closed.
100
+ *
101
+ * @function
102
+ */
103
+ getDouble(key: string): number | null;
104
+ /**
105
+ * Gets a property’s value as a float value. Integers will be converted to float.
106
+ * The value true is returned as 1.0, false as 0.0. Returns 0.0 if the property doesn’t
107
+ * exist or does not have a numeric value.
108
+ *
109
+ * Throws an error if the collection is deleted or the database is closed.
110
+ *
111
+ * @function
112
+ */
113
+ getFloat(key: string): number | null;
114
+ /**
115
+ * Returns the document’s ID.
116
+ *
117
+ * Throws an error if the collection is deleted or the database is closed.
118
+ *
119
+ * @function
120
+ */
121
+ getId(): string;
122
+ /**
123
+ * Gets a property’s value as an int value. Floating point values will be rounded.
124
+ * The value true is returned as 1, false as 0. Returns 0 if the property doesn’t
125
+ * exist or does not have a numeric value.
126
+ *
127
+ * Throws an error if the collection is deleted or the database is closed.
128
+ *
129
+ * @function
130
+ */
131
+ getInt(key: string): number | null;
132
+ /**
133
+ * returns an array containing all keys, or an empty array if the document
134
+ * has no properties.
135
+ *
136
+ * Throws an error if the collection is deleted or the database is closed.
137
+ *
138
+ * @function
139
+ */
140
+ getKeys(): string[];
141
+ /**
142
+ * Gets a property’s value as an number value. Floating point values will be rounded.
143
+ * The value true is returned as 1, false as 0. Returns 0 if the property doesn’t
144
+ * exist or does not have a numeric value.
145
+ *
146
+ * Throws an error if the collection is deleted or the database is closed.
147
+ *
148
+ * @function
149
+ */
150
+ getLong(key: string): number | null;
151
+ /**
152
+ * The ID representing a document’s revision.
153
+ *
154
+ * Throws an error if the collection is deleted or the database is closed.
155
+ *
156
+ * @function
157
+ */
158
+ getRevisionID(): string;
159
+ /**
160
+ * Sequence number of the document in the database. This indicates how recently the
161
+ * document has been changed: every time any document is updated, the database assigns it
162
+ * the next sequential sequence number. Thus, if a document’s sequence property changes
163
+ * that means it’s been changed (on-disk); and if one document’s sequence is greater than
164
+ * another’s, that means it was changed more recently.
165
+ *
166
+ * Throws an error if the collection is deleted or the database is closed.
167
+ *
168
+ * @function
169
+ */
170
+ getSequence(): number;
171
+ /**
172
+ * Gets a property’s value as a string. Returns nil if the property doesn’t exist, i
173
+ * or its value is not a string.
174
+ *
175
+ * Throws an error if the collection is deleted or the database is closed.
176
+ *
177
+ * @function
178
+ */
179
+ getString(key: string): string | null;
180
+ /**
181
+ * @deprecated getValue is deprecated. Returns values as any.
182
+ */
183
+ getValue(key: string): any;
184
+ /**
185
+ * Returns the document data as a dictionary.
186
+ *
187
+ * Throws an error if the collection is deleted or the database is closed.
188
+ *
189
+ * @function
190
+ */
191
+ toDictionary(): Dictionary;
192
+ /**
193
+ * Converts the document content to a JSON string representation
194
+ * @returns {string} A JSON string
195
+ *
196
+ * @function
197
+ */
198
+ toJsonString(): string;
199
+ }
@@ -0,0 +1,333 @@
1
+ import { Blob } from './blob';
2
+ import { EngineLocator } from './engine-locator';
3
+ export class Document {
4
+ constructor(id = null,
5
+ // eslint-disable-next-line
6
+ sequenceNo = null,
7
+ // eslint-disable-next-line
8
+ revisionID = null,
9
+ // eslint-disable-next-line
10
+ collection = null, data = {}) {
11
+ this.id = id;
12
+ this.sequenceNo = sequenceNo;
13
+ this.revisionID = revisionID;
14
+ this.collection = collection;
15
+ this.doc = {};
16
+ this._engine = EngineLocator.getEngine(EngineLocator.key);
17
+ if (id === null) {
18
+ this.id = this._engine.getUUID();
19
+ }
20
+ this.doc = data;
21
+ }
22
+ /**
23
+ * The number of properties in the document.
24
+ *
25
+ * Throws an error if the collection is deleted or the database is closed.
26
+ *
27
+ * @function
28
+ */
29
+ count() {
30
+ return Object.keys(this.doc).length;
31
+ }
32
+ /**
33
+ * Returns the document data as a dictionary.
34
+ *
35
+ * Throws an error if the collection is deleted or the database is closed.
36
+ *
37
+ * @function
38
+ */
39
+ getData() {
40
+ return this.doc;
41
+ }
42
+ _get(key) {
43
+ return this.doc[key];
44
+ }
45
+ /**
46
+ * Get a property’s value as a ArrayObject, which is a mapping object of an array value.
47
+ * Returns null if the property doesn’t exists, or its value is not an array.
48
+ *
49
+ * Throws an error if the collection is deleted or the database is closed.
50
+ *
51
+ * @function
52
+ */
53
+ getArray(key) {
54
+ if (key in this.doc && Array.isArray(this.doc[key])) {
55
+ return this.doc[key];
56
+ }
57
+ return null;
58
+ }
59
+ /**
60
+ * Returns metadata associated with the Blob. Use getBlobContent() to get the Blob’s data.
61
+ * Throws an error if the collection is deleted or the database is closed.
62
+ *
63
+ * @function
64
+ */
65
+ getBlob(key) {
66
+ if (key in this.doc) {
67
+ const data = this._get(key);
68
+ if (data && typeof data === 'object' && 'content_type' in data) {
69
+ const b = new Blob(data.content_type, data.raw);
70
+ b.digest = data.digest;
71
+ b.length = data.length;
72
+ return b;
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ /**
78
+ * @deprecated - use the Blob API getBytes() function instead
79
+ *
80
+ * Get a property’s value as a ArrayBuffer. Returns null if the property doesn’t exist,
81
+ * or its value is not a blob.
82
+ *
83
+ * Throws an error if the collection is deleted or the database is closed.
84
+ *
85
+ * @function
86
+ */
87
+ async getBlobContent(key) {
88
+ const data = await this._engine.collection_GetBlobContent({
89
+ documentId: this.getId(),
90
+ key: key,
91
+ collectionName: this.collection.name,
92
+ scopeName: this.collection.scope.name,
93
+ name: this.collection.scope.database.getName(),
94
+ });
95
+ return data.data;
96
+ }
97
+ /**
98
+ * Gets a property’s value as a boolean value. Returns true if the value exists,
99
+ * and is either true or a nonzero number.
100
+ *
101
+ * Throws an error if the collection is deleted or the database is closed.
102
+ *
103
+ * @function
104
+ */
105
+ getBoolean(key) {
106
+ if (key in this.doc) {
107
+ const value = this.doc[key];
108
+ if (typeof value === 'boolean') {
109
+ return value;
110
+ }
111
+ if (value === 0 || value === '0.0') {
112
+ return false;
113
+ }
114
+ if (value === null) {
115
+ return false;
116
+ }
117
+ return true;
118
+ }
119
+ return false;
120
+ }
121
+ /**
122
+ * The collection that the document belongs to.
123
+ *
124
+ * Throws an error if the database is closed.
125
+ *
126
+ * @function
127
+ */
128
+ getCollection() {
129
+ return this.collection;
130
+ }
131
+ /**
132
+ * Gets a property’s value as a Date value. JSON does not directly support dates, so
133
+ * the actual property value must be a string, which is then parsed according to the
134
+ * ISO-8601 date format (the default used in JSON.) Returns null if the value doesn’t
135
+ * exist, is not a string, or is not parseable as a date. NOTE: This is not a generic
136
+ * date parser! It only recognizes the ISO-8601 format, with milliseconds.
137
+ *
138
+ * Throws an error if the collection is deleted or the database is closed.
139
+ *
140
+ * @function
141
+ */
142
+ getDate(key) {
143
+ if (key in this.doc) {
144
+ const value = this.doc[key];
145
+ if (typeof value === 'string') {
146
+ const date = new Date(value);
147
+ // Check if the date is valid (not "Invalid Date")
148
+ return !isNaN(date.getTime()) ? date : null;
149
+ }
150
+ }
151
+ return null;
152
+ }
153
+ /**
154
+ * Get a property’s value as a Dictionary, which is a mapping object of a dictionary
155
+ * value. Returns null if the property doesn’t exists, or its value is not a dictionary.
156
+ *
157
+ * Throws an error if the collection is deleted or the database is closed.
158
+ *
159
+ * @function
160
+ */
161
+ getDictionary(key) {
162
+ if (key in this.doc) {
163
+ const value = this.doc[key];
164
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
165
+ return value;
166
+ }
167
+ }
168
+ return null;
169
+ }
170
+ /**
171
+ * Gets a property’s value as a double value. Integers will be converted to double.
172
+ * The value true is returned as 1.0, false as 0.0. Returns 0.0 if the property doesn’t
173
+ * exist or does not have a numeric value.
174
+ *
175
+ * Throws an error if the collection is deleted or the database is closed.
176
+ *
177
+ * @function
178
+ */
179
+ getDouble(key) {
180
+ if (key in this.doc) {
181
+ const value = this.doc[key];
182
+ if (typeof value === 'number') {
183
+ return value;
184
+ }
185
+ if (typeof value === 'boolean') {
186
+ return value ? 1.0 : 0.0;
187
+ }
188
+ }
189
+ return 0.0;
190
+ }
191
+ /**
192
+ * Gets a property’s value as a float value. Integers will be converted to float.
193
+ * The value true is returned as 1.0, false as 0.0. Returns 0.0 if the property doesn’t
194
+ * exist or does not have a numeric value.
195
+ *
196
+ * Throws an error if the collection is deleted or the database is closed.
197
+ *
198
+ * @function
199
+ */
200
+ getFloat(key) {
201
+ if (key in this.doc) {
202
+ const value = this.doc[key];
203
+ if (typeof value === 'number') {
204
+ return value;
205
+ }
206
+ if (typeof value === 'boolean') {
207
+ return value ? 1.0 : 0.0;
208
+ }
209
+ }
210
+ return 0.0;
211
+ }
212
+ /**
213
+ * Returns the document’s ID.
214
+ *
215
+ * Throws an error if the collection is deleted or the database is closed.
216
+ *
217
+ * @function
218
+ */
219
+ getId() {
220
+ return this.id;
221
+ }
222
+ /**
223
+ * Gets a property’s value as an int value. Floating point values will be rounded.
224
+ * The value true is returned as 1, false as 0. Returns 0 if the property doesn’t
225
+ * exist or does not have a numeric value.
226
+ *
227
+ * Throws an error if the collection is deleted or the database is closed.
228
+ *
229
+ * @function
230
+ */
231
+ getInt(key) {
232
+ if (key in this.doc) {
233
+ const value = this.doc[key];
234
+ if (typeof value === 'number') {
235
+ return Math.floor(value);
236
+ }
237
+ if (typeof value === 'boolean') {
238
+ return value ? 1 : 0;
239
+ }
240
+ }
241
+ return 0;
242
+ }
243
+ /**
244
+ * returns an array containing all keys, or an empty array if the document
245
+ * has no properties.
246
+ *
247
+ * Throws an error if the collection is deleted or the database is closed.
248
+ *
249
+ * @function
250
+ */
251
+ getKeys() {
252
+ return Object.keys(this.doc);
253
+ }
254
+ /**
255
+ * Gets a property’s value as an number value. Floating point values will be rounded.
256
+ * The value true is returned as 1, false as 0. Returns 0 if the property doesn’t
257
+ * exist or does not have a numeric value.
258
+ *
259
+ * Throws an error if the collection is deleted or the database is closed.
260
+ *
261
+ * @function
262
+ */
263
+ getLong(key) {
264
+ return key in this.doc ? this.doc[key] : 0;
265
+ }
266
+ /**
267
+ * The ID representing a document’s revision.
268
+ *
269
+ * Throws an error if the collection is deleted or the database is closed.
270
+ *
271
+ * @function
272
+ */
273
+ getRevisionID() {
274
+ return this.revisionID;
275
+ }
276
+ /**
277
+ * Sequence number of the document in the database. This indicates how recently the
278
+ * document has been changed: every time any document is updated, the database assigns it
279
+ * the next sequential sequence number. Thus, if a document’s sequence property changes
280
+ * that means it’s been changed (on-disk); and if one document’s sequence is greater than
281
+ * another’s, that means it was changed more recently.
282
+ *
283
+ * Throws an error if the collection is deleted or the database is closed.
284
+ *
285
+ * @function
286
+ */
287
+ getSequence() {
288
+ return this.sequenceNo;
289
+ }
290
+ /**
291
+ * Gets a property’s value as a string. Returns nil if the property doesn’t exist, i
292
+ * or its value is not a string.
293
+ *
294
+ * Throws an error if the collection is deleted or the database is closed.
295
+ *
296
+ * @function
297
+ */
298
+ getString(key) {
299
+ if (key in this.doc) {
300
+ const value = this.doc[key];
301
+ if (typeof value === 'string') {
302
+ return value;
303
+ }
304
+ }
305
+ return null;
306
+ }
307
+ /**
308
+ * @deprecated getValue is deprecated. Returns values as any.
309
+ */
310
+ getValue(key) {
311
+ return key in this.doc ? this.doc[key] : null;
312
+ }
313
+ /**
314
+ * Returns the document data as a dictionary.
315
+ *
316
+ * Throws an error if the collection is deleted or the database is closed.
317
+ *
318
+ * @function
319
+ */
320
+ toDictionary() {
321
+ return this.doc;
322
+ }
323
+ /**
324
+ * Converts the document content to a JSON string representation
325
+ * @returns {string} A JSON string
326
+ *
327
+ * @function
328
+ */
329
+ toJsonString() {
330
+ return JSON.stringify(this.doc);
331
+ }
332
+ }
333
+ //# sourceMappingURL=document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,OAAO,QAAQ;IAInB,YACY,KAAa,IAAI;I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,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,GAAW;QACjB,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;;;;;;OAUG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,GAAW;QAClB,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAEC;;;;;KAKC;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export interface Endpoint {
2
+ toJson(): any;
3
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/endpoint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ import { ICoreEngine } from '../core-types';
2
+ export declare class EngineLocator {
3
+ private static instance;
4
+ static readonly key: string;
5
+ private static engines;
6
+ private constructor();
7
+ /**
8
+ * Returns the singleton instance of EngineLocator
9
+ * @returns {EngineLocator} The singleton instance of the EngineLocator
10
+ * @example
11
+ * const locator = EngineLocator.getInstance();
12
+ * // Use the same instance throughout the application
13
+ * const sameLocator = EngineLocator.getInstance(); // Returns the same instance
14
+ */
15
+ static getInstance(): EngineLocator;
16
+ /**
17
+ * Registers a core engine implementation with the EngineLocator
18
+ * @param {string} key - The unique identifier for the engine
19
+ * @param {ICoreEngine} service - The core engine implementation to register
20
+ * @example
21
+ * const engine = new MyCoreEngine();
22
+ * EngineLocator.registerEngine('myEngine', engine);
23
+ *
24
+ * // Later, retrieve the engine
25
+ * const sameEngine = EngineLocator.getEngine('myEngine');
26
+ */
27
+ static registerEngine(key: string, service: ICoreEngine): void;
28
+ /**
29
+ * Retrieves a registered core engine implementation by its key
30
+ * @param {string} key - The unique identifier of the engine to retrieve
31
+ * @returns {ICoreEngine} The registered core engine implementation
32
+ * @example
33
+ * // First register an engine
34
+ * const engine = new MyCoreEngine();
35
+ * EngineLocator.registerEngine('myEngine', engine);
36
+ *
37
+ * // Then retrieve it
38
+ * const retrievedEngine = EngineLocator.getEngine('myEngine');
39
+ * // retrievedEngine === engine
40
+ */
41
+ static getEngine(key: string): ICoreEngine;
42
+ }
@@ -0,0 +1,50 @@
1
+ export class EngineLocator {
2
+ constructor() { }
3
+ /**
4
+ * Returns the singleton instance of EngineLocator
5
+ * @returns {EngineLocator} The singleton instance of the EngineLocator
6
+ * @example
7
+ * const locator = EngineLocator.getInstance();
8
+ * // Use the same instance throughout the application
9
+ * const sameLocator = EngineLocator.getInstance(); // Returns the same instance
10
+ */
11
+ static getInstance() {
12
+ if (!EngineLocator.instance) {
13
+ EngineLocator.instance = new EngineLocator();
14
+ }
15
+ return EngineLocator.instance;
16
+ }
17
+ /**
18
+ * Registers a core engine implementation with the EngineLocator
19
+ * @param {string} key - The unique identifier for the engine
20
+ * @param {ICoreEngine} service - The core engine implementation to register
21
+ * @example
22
+ * const engine = new MyCoreEngine();
23
+ * EngineLocator.registerEngine('myEngine', engine);
24
+ *
25
+ * // Later, retrieve the engine
26
+ * const sameEngine = EngineLocator.getEngine('myEngine');
27
+ */
28
+ static registerEngine(key, service) {
29
+ EngineLocator.engines.set(key, service);
30
+ }
31
+ /**
32
+ * Retrieves a registered core engine implementation by its key
33
+ * @param {string} key - The unique identifier of the engine to retrieve
34
+ * @returns {ICoreEngine} The registered core engine implementation
35
+ * @example
36
+ * // First register an engine
37
+ * const engine = new MyCoreEngine();
38
+ * EngineLocator.registerEngine('myEngine', engine);
39
+ *
40
+ * // Then retrieve it
41
+ * const retrievedEngine = EngineLocator.getEngine('myEngine');
42
+ * // retrievedEngine === engine
43
+ */
44
+ static getEngine(key) {
45
+ return EngineLocator.engines.get(key);
46
+ }
47
+ }
48
+ EngineLocator.key = 'default';
49
+ EngineLocator.engines = new Map();
50
+ //# sourceMappingURL=engine-locator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-locator.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/engine-locator.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IAKxB,gBAAuB,CAAC;IAEvB;;;;;;;MAOE;IACH,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC5B,aAAa,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IAEA;;;;;;;;;;MAUE;IACH,MAAM,CAAC,cAAc,CAAC,GAAW,EAAE,OAAoB;QACrD,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAEC;;;;;;;;;;;;KAYC;IACH,MAAM,CAAC,SAAS,CAAC,GAAW;QAC1B,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;;AAjDe,iBAAG,GAAW,SAAS,CAAC;AACzB,qBAAO,GAA6B,IAAI,GAAG,EAAE,CAAC"}