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.
- package/CblIonic.podspec +18 -0
- package/LICENSE +201 -0
- package/README.md +19 -0
- package/android/build.gradle +69 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/cbl/js/kotiln/CollectionConfigDto.kt +5 -0
- package/android/src/main/java/cbl/js/kotiln/CollectionDocumentResult.kt +7 -0
- package/android/src/main/java/cbl/js/kotiln/CollectionDto.kt +9 -0
- package/android/src/main/java/cbl/js/kotiln/CollectionManager.kt +232 -0
- package/android/src/main/java/cbl/js/kotiln/ConfigDto.kt +5 -0
- package/android/src/main/java/cbl/js/kotiln/DatabaseManager.kt +183 -0
- package/android/src/main/java/cbl/js/kotiln/DocumentDto.kt +6 -0
- package/android/src/main/java/cbl/js/kotiln/FileSystemHelper.kt +18 -0
- package/android/src/main/java/cbl/js/kotiln/LoggingManager.kt +30 -0
- package/android/src/main/java/cbl/js/kotiln/ReplicatorManager.kt +123 -0
- package/android/src/main/java/cbl/js/kotiln/ScopeDto.kt +6 -0
- package/android/src/main/java/com/couchbase/ionic/CblIonicPluginPlugin.kt +1832 -0
- package/android/src/main/java/com/couchbase/ionic/IndexDto.kt +12 -0
- package/android/src/main/java/com/couchbase/ionic/IndexHelper.kt +30 -0
- package/android/src/main/java/com/couchbase/ionic/PluginHelper.kt +283 -0
- package/android/src/main/java/com/couchbase/ionic/QueryHelper.kt +62 -0
- package/android/src/main/java/com/couchbase/ionic/ReplicatorHelper.kt +174 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/esm/cblite-js/cblite/core-types.d.ts +634 -0
- package/dist/esm/cblite-js/cblite/core-types.js +2 -0
- package/dist/esm/cblite-js/cblite/core-types.js.map +1 -0
- package/dist/esm/cblite-js/cblite/index.d.ts +2 -0
- package/dist/esm/cblite-js/cblite/index.js +4 -0
- package/dist/esm/cblite-js/cblite/index.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/abstract-index.d.ts +14 -0
- package/dist/esm/cblite-js/cblite/src/abstract-index.js +12 -0
- package/dist/esm/cblite-js/cblite/src/abstract-index.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/authenticator.d.ts +6 -0
- package/dist/esm/cblite-js/cblite/src/authenticator.js +3 -0
- package/dist/esm/cblite-js/cblite/src/authenticator.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/basic-authenticator.d.ts +42 -0
- package/dist/esm/cblite-js/cblite/src/basic-authenticator.js +59 -0
- package/dist/esm/cblite-js/cblite/src/basic-authenticator.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/blob.d.ts +58 -0
- package/dist/esm/cblite-js/cblite/src/blob.js +86 -0
- package/dist/esm/cblite-js/cblite/src/blob.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/collation.d.ts +20 -0
- package/dist/esm/cblite-js/cblite/src/collation.js +64 -0
- package/dist/esm/cblite-js/cblite/src/collation.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/collection-config.d.ts +24 -0
- package/dist/esm/cblite-js/cblite/src/collection-config.js +30 -0
- package/dist/esm/cblite-js/cblite/src/collection-config.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/collection.d.ts +189 -0
- package/dist/esm/cblite-js/cblite/src/collection.js +354 -0
- package/dist/esm/cblite-js/cblite/src/collection.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/concurrency-control.d.ts +4 -0
- package/dist/esm/cblite-js/cblite/src/concurrency-control.js +8 -0
- package/dist/esm/cblite-js/cblite/src/concurrency-control.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.d.ts +6 -0
- package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.js +15 -0
- package/dist/esm/cblite-js/cblite/src/couchbase-lite-exception.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/database-configuration.d.ts +52 -0
- package/dist/esm/cblite-js/cblite/src/database-configuration.js +75 -0
- package/dist/esm/cblite-js/cblite/src/database-configuration.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/database-logging.d.ts +13 -0
- package/dist/esm/cblite-js/cblite/src/database-logging.js +13 -0
- package/dist/esm/cblite-js/cblite/src/database-logging.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/database.d.ts +254 -0
- package/dist/esm/cblite-js/cblite/src/database.js +514 -0
- package/dist/esm/cblite-js/cblite/src/database.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/definitions.d.ts +7 -0
- package/dist/esm/cblite-js/cblite/src/definitions.js +2 -0
- package/dist/esm/cblite-js/cblite/src/definitions.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/document-replication.d.ts +13 -0
- package/dist/esm/cblite-js/cblite/src/document-replication.js +34 -0
- package/dist/esm/cblite-js/cblite/src/document-replication.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/document.d.ts +199 -0
- package/dist/esm/cblite-js/cblite/src/document.js +333 -0
- package/dist/esm/cblite-js/cblite/src/document.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/endpoint.d.ts +3 -0
- package/dist/esm/cblite-js/cblite/src/endpoint.js +2 -0
- package/dist/esm/cblite-js/cblite/src/endpoint.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/engine-locator.d.ts +42 -0
- package/dist/esm/cblite-js/cblite/src/engine-locator.js +50 -0
- package/dist/esm/cblite-js/cblite/src/engine-locator.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/expression.d.ts +134 -0
- package/dist/esm/cblite-js/cblite/src/expression.js +374 -0
- package/dist/esm/cblite-js/cblite/src/expression.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/file-system.d.ts +7 -0
- package/dist/esm/cblite-js/cblite/src/file-system.js +14 -0
- package/dist/esm/cblite-js/cblite/src/file-system.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/full-text-expression.d.ts +28 -0
- package/dist/esm/cblite-js/cblite/src/full-text-expression.js +38 -0
- package/dist/esm/cblite-js/cblite/src/full-text-expression.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/full-text-index.d.ts +47 -0
- package/dist/esm/cblite-js/cblite/src/full-text-index.js +77 -0
- package/dist/esm/cblite-js/cblite/src/full-text-index.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/index-builder.d.ts +20 -0
- package/dist/esm/cblite-js/cblite/src/index-builder.js +25 -0
- package/dist/esm/cblite-js/cblite/src/index-builder.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/index.d.ts +42 -0
- package/dist/esm/cblite-js/cblite/src/index.js +43 -0
- package/dist/esm/cblite-js/cblite/src/index.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/meta-expression.d.ts +10 -0
- package/dist/esm/cblite-js/cblite/src/meta-expression.js +30 -0
- package/dist/esm/cblite-js/cblite/src/meta-expression.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/meta.d.ts +7 -0
- package/dist/esm/cblite-js/cblite/src/meta.js +8 -0
- package/dist/esm/cblite-js/cblite/src/meta.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/mutable-document.d.ts +373 -0
- package/dist/esm/cblite-js/cblite/src/mutable-document.js +481 -0
- package/dist/esm/cblite-js/cblite/src/mutable-document.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/ordering.d.ts +14 -0
- package/dist/esm/cblite-js/cblite/src/ordering.js +31 -0
- package/dist/esm/cblite-js/cblite/src/ordering.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/parameter.d.ts +18 -0
- package/dist/esm/cblite-js/cblite/src/parameter.js +38 -0
- package/dist/esm/cblite-js/cblite/src/parameter.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/parameters.d.ts +17 -0
- package/dist/esm/cblite-js/cblite/src/parameters.js +61 -0
- package/dist/esm/cblite-js/cblite/src/parameters.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/query.d.ts +83 -0
- package/dist/esm/cblite-js/cblite/src/query.js +146 -0
- package/dist/esm/cblite-js/cblite/src/query.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicated-document.d.ts +25 -0
- package/dist/esm/cblite-js/cblite/src/replicated-document.js +51 -0
- package/dist/esm/cblite-js/cblite/src/replicated-document.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator-activity-level.d.ts +7 -0
- package/dist/esm/cblite-js/cblite/src/replicator-activity-level.js +14 -0
- package/dist/esm/cblite-js/cblite/src/replicator-activity-level.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator-change.d.ts +14 -0
- package/dist/esm/cblite-js/cblite/src/replicator-change.js +14 -0
- package/dist/esm/cblite-js/cblite/src/replicator-change.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.d.ts +341 -0
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.js +516 -0
- package/dist/esm/cblite-js/cblite/src/replicator-configuration.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator-progress.d.ts +9 -0
- package/dist/esm/cblite-js/cblite/src/replicator-progress.js +20 -0
- package/dist/esm/cblite-js/cblite/src/replicator-progress.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator-status.d.ts +13 -0
- package/dist/esm/cblite-js/cblite/src/replicator-status.js +29 -0
- package/dist/esm/cblite-js/cblite/src/replicator-status.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/replicator.d.ts +108 -0
- package/dist/esm/cblite-js/cblite/src/replicator.js +224 -0
- package/dist/esm/cblite-js/cblite/src/replicator.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/result.d.ts +4 -0
- package/dist/esm/cblite-js/cblite/src/result.js +2 -0
- package/dist/esm/cblite-js/cblite/src/result.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/scope.d.ts +31 -0
- package/dist/esm/cblite-js/cblite/src/scope.js +34 -0
- package/dist/esm/cblite-js/cblite/src/scope.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/session-authenticator.d.ts +32 -0
- package/dist/esm/cblite-js/cblite/src/session-authenticator.js +52 -0
- package/dist/esm/cblite-js/cblite/src/session-authenticator.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/url-endpoint.d.ts +8 -0
- package/dist/esm/cblite-js/cblite/src/url-endpoint.js +12 -0
- package/dist/esm/cblite-js/cblite/src/url-endpoint.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/value-index.d.ts +32 -0
- package/dist/esm/cblite-js/cblite/src/value-index.js +54 -0
- package/dist/esm/cblite-js/cblite/src/value-index.js.map +1 -0
- package/dist/esm/cblite-js/cblite/src/variable-expression.d.ts +7 -0
- package/dist/esm/cblite-js/cblite/src/variable-expression.js +15 -0
- package/dist/esm/cblite-js/cblite/src/variable-expression.js.map +1 -0
- package/dist/esm/couchbase-lite/capacitor-engine.d.ts +124 -0
- package/dist/esm/couchbase-lite/capacitor-engine.js +303 -0
- package/dist/esm/couchbase-lite/capacitor-engine.js.map +1 -0
- package/dist/esm/definitions.d.ts +12 -0
- package/dist/esm/definitions.js +4 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/ionic-couchbase-lite.d.ts +3 -0
- package/dist/esm/ionic-couchbase-lite.js +4 -0
- package/dist/esm/ionic-couchbase-lite.js.map +1 -0
- package/dist/plugin.cjs.js +4400 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +4403 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CblIonicPlugin.swift +1583 -0
- package/ios/Plugin/CblIonicPluginPlugin.h +10 -0
- package/ios/Plugin/CblIonicPluginPlugin.m +86 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/cbl-js-swift/CollectionManager.swift +489 -0
- package/ios/Plugin/cbl-js-swift/DatabaseManager.swift +319 -0
- package/ios/Plugin/cbl-js-swift/FileSystemHelper.swift +22 -0
- package/ios/Plugin/cbl-js-swift/IndexHelper.swift +36 -0
- package/ios/Plugin/cbl-js-swift/LICENSE +201 -0
- package/ios/Plugin/cbl-js-swift/LoggingManager.swift +79 -0
- package/ios/Plugin/cbl-js-swift/MapHelper.swift +92 -0
- package/ios/Plugin/cbl-js-swift/QueryHelper.swift +74 -0
- package/ios/Plugin/cbl-js-swift/README.md +9 -0
- package/ios/Plugin/cbl-js-swift/ReplicatorHelper.swift +184 -0
- package/ios/Plugin/cbl-js-swift/ReplicatorManager.swift +157 -0
- package/package.json +86 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AbstractIndex, IndexType } from './abstract-index';
|
|
2
|
+
import { Expression } from './expression';
|
|
3
|
+
/**
|
|
4
|
+
* Index for Full-Text search
|
|
5
|
+
*/
|
|
6
|
+
export class FullTextIndex extends AbstractIndex {
|
|
7
|
+
constructor(...indexItems) {
|
|
8
|
+
super();
|
|
9
|
+
this._language = FullTextIndex.getDefaultLanguage();
|
|
10
|
+
this._ignoreAccents = false;
|
|
11
|
+
this.indexItems = indexItems;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The language code which is an ISO-639 language such as "en", "fr", etc.
|
|
15
|
+
* Setting the language code affects how word breaks and word stems are parsed.
|
|
16
|
+
* Without setting the value, the current locale's language will be used. Setting
|
|
17
|
+
* a nil or "" value to disable the language features.
|
|
18
|
+
*/
|
|
19
|
+
setLanguage(language) {
|
|
20
|
+
this._language = language;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set the true value to ignore accents/diacritical marks. The default value is false.
|
|
25
|
+
*/
|
|
26
|
+
setIgnoreAccents(ignoreAccents) {
|
|
27
|
+
this._ignoreAccents = ignoreAccents;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
type() {
|
|
31
|
+
return IndexType.FullText;
|
|
32
|
+
}
|
|
33
|
+
language() {
|
|
34
|
+
return this._language;
|
|
35
|
+
}
|
|
36
|
+
ignoreAccents() {
|
|
37
|
+
return this._ignoreAccents;
|
|
38
|
+
}
|
|
39
|
+
items() {
|
|
40
|
+
const items = [];
|
|
41
|
+
for (let item of this.indexItems) {
|
|
42
|
+
items.push(item.expression.asJSON());
|
|
43
|
+
}
|
|
44
|
+
return items;
|
|
45
|
+
}
|
|
46
|
+
toJson() {
|
|
47
|
+
return {
|
|
48
|
+
type: 'full-text',
|
|
49
|
+
language: this._language,
|
|
50
|
+
ignoreAccents: this._ignoreAccents,
|
|
51
|
+
items: this.items(),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static getDefaultLanguage() {
|
|
55
|
+
return 'en';
|
|
56
|
+
//return Locale.getDefault().getLanguage();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Full-text Index Item.
|
|
61
|
+
*/
|
|
62
|
+
export class FullTextIndexItem {
|
|
63
|
+
constructor(expression) {
|
|
64
|
+
this.expression = expression;
|
|
65
|
+
this.expression = expression;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Creates a full-text search index item with the given property.
|
|
69
|
+
*
|
|
70
|
+
* @param property A property used to perform the match operation against with.
|
|
71
|
+
* @return The full-text search index item.
|
|
72
|
+
*/
|
|
73
|
+
static property(property) {
|
|
74
|
+
return new FullTextIndexItem(Expression.property(property));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=full-text-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-text-index.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/full-text-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAK9C,YAAY,GAAG,UAA+B;QAC5C,KAAK,EAAE,CAAC;QAJF,cAAS,GAAG,aAAa,CAAC,kBAAkB,EAAE,CAAC;QAC/C,mBAAc,GAAG,KAAK,CAAC;QAI7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,aAAsB;QAC5C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,KAAK;QACH,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,aAAa,EAAE,IAAI,CAAC,cAAc;YAClC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACpB,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,kBAAkB;QAC/B,OAAO,IAAI,CAAC;QACZ,2CAA2C;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,YAA2B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAC/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ,CAAC,QAAgB;QACrC,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ValueIndexItem, ValueIndex } from './value-index';
|
|
2
|
+
import { FullTextIndex, FullTextIndexItem } from './full-text-index';
|
|
3
|
+
export declare class IndexBuilder {
|
|
4
|
+
/**
|
|
5
|
+
* Create a value index with the given index items. The index items are a list of
|
|
6
|
+
* the properties or expressions to be indexed.
|
|
7
|
+
*
|
|
8
|
+
* @param items The index items
|
|
9
|
+
* @return The value index
|
|
10
|
+
*/
|
|
11
|
+
static valueIndex(...items: ValueIndexItem[]): ValueIndex;
|
|
12
|
+
/**
|
|
13
|
+
* Create a full-text search index with the given index item and options. Typically the index item is
|
|
14
|
+
* the property that is used to perform the match operation against with.
|
|
15
|
+
*
|
|
16
|
+
* @param items The index items.
|
|
17
|
+
* @return The full-text search index.
|
|
18
|
+
*/
|
|
19
|
+
static fullTextIndex(...items: FullTextIndexItem[]): FullTextIndex;
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ValueIndex } from './value-index';
|
|
2
|
+
import { FullTextIndex } from './full-text-index';
|
|
3
|
+
export class IndexBuilder {
|
|
4
|
+
/**
|
|
5
|
+
* Create a value index with the given index items. The index items are a list of
|
|
6
|
+
* the properties or expressions to be indexed.
|
|
7
|
+
*
|
|
8
|
+
* @param items The index items
|
|
9
|
+
* @return The value index
|
|
10
|
+
*/
|
|
11
|
+
static valueIndex(...items) {
|
|
12
|
+
return new ValueIndex(...items);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a full-text search index with the given index item and options. Typically the index item is
|
|
16
|
+
* the property that is used to perform the match operation against with.
|
|
17
|
+
*
|
|
18
|
+
* @param items The index items.
|
|
19
|
+
* @return The full-text search index.
|
|
20
|
+
*/
|
|
21
|
+
static fullTextIndex(...items) {
|
|
22
|
+
return new FullTextIndex(...items);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-builder.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/index-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAErE,MAAM,OAAO,YAAY;IACvB;;;;;;OAMG;IACI,MAAM,CAAC,UAAU,CAAC,GAAG,KAAuB;QACjD,OAAO,IAAI,UAAU,CAAC,GAAG,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,aAAa,CAAC,GAAG,KAA0B;QACvD,OAAO,IAAI,aAAa,CAAC,GAAG,KAAK,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export * from './abstract-index';
|
|
2
|
+
export * from './authenticator';
|
|
3
|
+
export * from './basic-authenticator';
|
|
4
|
+
export * from './blob';
|
|
5
|
+
export * from './collation';
|
|
6
|
+
export * from './collection';
|
|
7
|
+
export * from './collection-config';
|
|
8
|
+
export * from './concurrency-control';
|
|
9
|
+
export * from './couchbase-lite-exception';
|
|
10
|
+
export * from './database-configuration';
|
|
11
|
+
export * from './database';
|
|
12
|
+
export * from './database-logging';
|
|
13
|
+
export * from './definitions';
|
|
14
|
+
export * from './document';
|
|
15
|
+
export * from './document-replication';
|
|
16
|
+
export * from './endpoint';
|
|
17
|
+
export * from './engine-locator';
|
|
18
|
+
export * from './expression';
|
|
19
|
+
export * from './file-system';
|
|
20
|
+
export * from './full-text-expression';
|
|
21
|
+
export * from './full-text-index';
|
|
22
|
+
export * from './index-builder';
|
|
23
|
+
export * from './meta';
|
|
24
|
+
export * from './meta-expression';
|
|
25
|
+
export * from './mutable-document';
|
|
26
|
+
export * from './ordering';
|
|
27
|
+
export * from './parameter';
|
|
28
|
+
export * from './parameters';
|
|
29
|
+
export * from './query';
|
|
30
|
+
export * from './replicator';
|
|
31
|
+
export * from './replicator-activity-level';
|
|
32
|
+
export * from './replicator-progress';
|
|
33
|
+
export * from './replicator-status';
|
|
34
|
+
export * from './replicator-change';
|
|
35
|
+
export * from './replicator-configuration';
|
|
36
|
+
export * from './replicated-document';
|
|
37
|
+
export * from './result';
|
|
38
|
+
export * from './scope';
|
|
39
|
+
export * from './session-authenticator';
|
|
40
|
+
export * from './url-endpoint';
|
|
41
|
+
export * from './value-index';
|
|
42
|
+
export * from './variable-expression';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export * from './abstract-index';
|
|
2
|
+
export * from './authenticator';
|
|
3
|
+
export * from './basic-authenticator';
|
|
4
|
+
export * from './blob';
|
|
5
|
+
export * from './collation';
|
|
6
|
+
export * from './collection';
|
|
7
|
+
export * from './collection-config';
|
|
8
|
+
export * from './concurrency-control';
|
|
9
|
+
export * from './couchbase-lite-exception';
|
|
10
|
+
export * from './database-configuration';
|
|
11
|
+
export * from './database';
|
|
12
|
+
export * from './database-logging';
|
|
13
|
+
export * from './definitions';
|
|
14
|
+
export * from './document';
|
|
15
|
+
export * from './document-replication';
|
|
16
|
+
export * from './endpoint';
|
|
17
|
+
export * from './engine-locator';
|
|
18
|
+
export * from './expression';
|
|
19
|
+
export * from './file-system';
|
|
20
|
+
export * from './full-text-expression';
|
|
21
|
+
export * from './full-text-index';
|
|
22
|
+
export * from './index-builder';
|
|
23
|
+
export * from './meta';
|
|
24
|
+
export * from './meta-expression';
|
|
25
|
+
export * from './mutable-document';
|
|
26
|
+
export * from './ordering';
|
|
27
|
+
export * from './parameter';
|
|
28
|
+
export * from './parameters';
|
|
29
|
+
export * from './query';
|
|
30
|
+
export * from './replicator';
|
|
31
|
+
export * from './replicator-activity-level';
|
|
32
|
+
export * from './replicator-progress';
|
|
33
|
+
export * from './replicator-status';
|
|
34
|
+
export * from './replicator-change';
|
|
35
|
+
export * from './replicator-configuration';
|
|
36
|
+
export * from './replicated-document';
|
|
37
|
+
export * from './result';
|
|
38
|
+
export * from './scope';
|
|
39
|
+
export * from './session-authenticator';
|
|
40
|
+
export * from './url-endpoint';
|
|
41
|
+
export * from './value-index';
|
|
42
|
+
export * from './variable-expression';
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Expression } from './expression';
|
|
2
|
+
export declare class MetaExpression extends Expression {
|
|
3
|
+
private _keyPath;
|
|
4
|
+
private _columnName;
|
|
5
|
+
private _from;
|
|
6
|
+
constructor(_keyPath: string, _columnName: string, _from: string);
|
|
7
|
+
from(alias: string): MetaExpression;
|
|
8
|
+
asJSON(): any[];
|
|
9
|
+
getColumnName(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Expression } from './expression';
|
|
2
|
+
export class MetaExpression extends Expression {
|
|
3
|
+
constructor(_keyPath, _columnName, _from) {
|
|
4
|
+
super();
|
|
5
|
+
this._keyPath = _keyPath;
|
|
6
|
+
this._columnName = _columnName;
|
|
7
|
+
this._from = _from;
|
|
8
|
+
}
|
|
9
|
+
from(alias) {
|
|
10
|
+
return new MetaExpression(this._keyPath, null, alias);
|
|
11
|
+
}
|
|
12
|
+
asJSON() {
|
|
13
|
+
const json = [];
|
|
14
|
+
if (this._from) {
|
|
15
|
+
json.push('.' + this._from + '.' + this._keyPath);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
json.push('.' + this._keyPath);
|
|
19
|
+
}
|
|
20
|
+
return json;
|
|
21
|
+
}
|
|
22
|
+
getColumnName() {
|
|
23
|
+
if (!this._columnName) {
|
|
24
|
+
const paths = this._keyPath.split('.');
|
|
25
|
+
this._columnName = paths[paths.length - 1];
|
|
26
|
+
}
|
|
27
|
+
return this._columnName;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=meta-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta-expression.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/meta-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YACU,QAAgB,EAChB,WAAmB,EACnB,KAAa;QAErB,KAAK,EAAE,CAAC;QAJA,aAAQ,GAAR,QAAQ,CAAQ;QAChB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAQ;IAGvB,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MetaExpression } from './meta-expression';
|
|
2
|
+
export class Meta {
|
|
3
|
+
}
|
|
4
|
+
Meta.id = new MetaExpression('_id', 'id', null);
|
|
5
|
+
Meta.sequence = new MetaExpression('_sequence', 'sequence', null);
|
|
6
|
+
Meta.deleted = new MetaExpression('_deleted', 'deleted', null);
|
|
7
|
+
Meta.expiration = new MetaExpression('_expiration', 'expiration', null);
|
|
8
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../../src/cblite-js/cblite/src/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,OAAO,IAAI;;AACR,OAAE,GAAmB,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3D,aAAQ,GAAmB,IAAI,cAAc,CAClD,WAAW,EACX,UAAU,EACV,IAAI,CACL,CAAC;AACK,YAAO,GAAmB,IAAI,cAAc,CACjD,UAAU,EACV,SAAS,EACT,IAAI,CACL,CAAC;AACK,eAAU,GAAmB,IAAI,cAAc,CACpD,aAAa,EACb,YAAY,EACZ,IAAI,CACL,CAAC"}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { Collection } from './collection';
|
|
2
|
+
import { Document } from './document';
|
|
3
|
+
import { Dictionary } from './definitions';
|
|
4
|
+
import { Blob } from './blob';
|
|
5
|
+
export declare class MutableDocument extends Document {
|
|
6
|
+
private _blobs;
|
|
7
|
+
constructor();
|
|
8
|
+
constructor(id: string);
|
|
9
|
+
constructor(id: string, data: Dictionary);
|
|
10
|
+
constructor(id: string | null, sequenceNo: number | null, data: Dictionary | null);
|
|
11
|
+
constructor(id?: string, sequenceNo?: number, revisionID?: string, data?: Dictionary, collection?: Collection);
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new MutableDocument instance from an existing Document
|
|
14
|
+
* @param {Document} document - The source Document to create a mutable copy from
|
|
15
|
+
* @returns {MutableDocument} A new MutableDocument containing the same data as the source document
|
|
16
|
+
* @example
|
|
17
|
+
* const doc = await collection.document('doc1');
|
|
18
|
+
* const mutableDoc = MutableDocument.fromDocument(doc);
|
|
19
|
+
*
|
|
20
|
+
* // Now you can modify the document
|
|
21
|
+
* mutableDoc.setString('name', 'John');
|
|
22
|
+
* await collection.save(mutableDoc);
|
|
23
|
+
*/
|
|
24
|
+
static fromDocument(document: Document): MutableDocument;
|
|
25
|
+
static fromJSON(documentId: string, jsonString: string): MutableDocument;
|
|
26
|
+
/**
|
|
27
|
+
* Removes a property from the document
|
|
28
|
+
* @param {string} key - The property key to remove. Can be a dot-notation path for nested properties
|
|
29
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
30
|
+
* @example
|
|
31
|
+
* // Remove a top-level property
|
|
32
|
+
* doc.remove('name');
|
|
33
|
+
*
|
|
34
|
+
* // Remove a nested property
|
|
35
|
+
* doc.remove('address.city');
|
|
36
|
+
*
|
|
37
|
+
* // Chain with other methods
|
|
38
|
+
* doc.remove('name')
|
|
39
|
+
* .setString('title', 'Mr.')
|
|
40
|
+
* .setNumber('age', 30);
|
|
41
|
+
*/
|
|
42
|
+
remove(key: string): MutableDocument;
|
|
43
|
+
/**
|
|
44
|
+
* Internal method to set a value in the document
|
|
45
|
+
* @param {string} key - The property key where the value will be stored
|
|
46
|
+
* @param {T | null} value - The value to store, can be null
|
|
47
|
+
* @template T - The type of the value being stored
|
|
48
|
+
* @private
|
|
49
|
+
* @example
|
|
50
|
+
* // This is an internal method, typically used by public setters:
|
|
51
|
+
* // Instead of using _set directly, use public methods like:
|
|
52
|
+
* doc.setString('name', 'John');
|
|
53
|
+
* doc.setNumber('age', 30);
|
|
54
|
+
*/
|
|
55
|
+
_set<T>(key: string, value: T | null): void;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the document's ID
|
|
58
|
+
* @param {string} id - The new ID for the document
|
|
59
|
+
* @example
|
|
60
|
+
* const doc = new MutableDocument();
|
|
61
|
+
* doc.setId('user123');
|
|
62
|
+
*
|
|
63
|
+
* // Note: Changing an existing document's ID is generally not recommended
|
|
64
|
+
* // as it may affect document tracking and replication
|
|
65
|
+
*/
|
|
66
|
+
setId(id: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Sets an array value for a given key in the document
|
|
69
|
+
* @param {string} key - The property key where the array will be stored
|
|
70
|
+
* @param {T[]} value - The array to store
|
|
71
|
+
* @template T - The type of elements in the array
|
|
72
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
73
|
+
* @example
|
|
74
|
+
* // Set an array of strings
|
|
75
|
+
* doc.setArray('tags', ['important', 'urgent']);
|
|
76
|
+
*
|
|
77
|
+
* // Set an array of numbers
|
|
78
|
+
* doc.setArray('scores', [85, 92, 78]);
|
|
79
|
+
*
|
|
80
|
+
* // Chain with other methods
|
|
81
|
+
* doc.setArray('items', ['a', 'b'])
|
|
82
|
+
* .setString('status', 'active');
|
|
83
|
+
*/
|
|
84
|
+
setArray<T>(key: string, value: T[]): MutableDocument;
|
|
85
|
+
/**
|
|
86
|
+
* Sets a blob value for a given key in the document
|
|
87
|
+
* @param {string} key - The property key where the blob will be stored
|
|
88
|
+
* @param {Blob | null} value - The blob to store, or null to remove existing blob
|
|
89
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
90
|
+
* @example
|
|
91
|
+
* // Create and set a new blob
|
|
92
|
+
* const bytes = new Uint8Array([72, 101, 108, 108, 111]);
|
|
93
|
+
* const blob = new Blob('text/plain', bytes);
|
|
94
|
+
* doc.setBlob('attachment', blob);
|
|
95
|
+
*
|
|
96
|
+
* // Remove a blob
|
|
97
|
+
* doc.setBlob('attachment', null);
|
|
98
|
+
*
|
|
99
|
+
* // Chain with other methods
|
|
100
|
+
* doc.setBlob('attachment', blob)
|
|
101
|
+
* .setString('filename', 'hello.txt');
|
|
102
|
+
*/
|
|
103
|
+
setBlob(key: string, value: Blob | null): MutableDocument;
|
|
104
|
+
/**
|
|
105
|
+
* Sets a boolean value for a given key in the document
|
|
106
|
+
* @param {string} key - The property key where the boolean will be stored
|
|
107
|
+
* @param {boolean} value - The boolean value to store
|
|
108
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
109
|
+
* @example
|
|
110
|
+
* // Set a boolean value
|
|
111
|
+
* doc.setBoolean('isActive', true);
|
|
112
|
+
*
|
|
113
|
+
* // Set multiple boolean values using method chaining
|
|
114
|
+
* doc.setBoolean('isEnabled', true)
|
|
115
|
+
* .setBoolean('isVisible', false)
|
|
116
|
+
* .setBoolean('isLocked', true);
|
|
117
|
+
*/
|
|
118
|
+
setBoolean(key: string, value: boolean): MutableDocument;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the collection that this document belongs to
|
|
121
|
+
* @param {Collection} collection - The collection instance to associate with this document
|
|
122
|
+
* @example
|
|
123
|
+
* const collection = await database.collection('users');
|
|
124
|
+
* const doc = new MutableDocument('user123');
|
|
125
|
+
* doc.setCollection(collection);
|
|
126
|
+
*
|
|
127
|
+
* // Note: This method is typically used internally.
|
|
128
|
+
* // Documents are usually associated with collections when created through the collection itself
|
|
129
|
+
*/
|
|
130
|
+
setCollection(collection: Collection): void;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the entire document's data content
|
|
133
|
+
* @param {Dictionary} data - An object containing all the data to be stored in the document
|
|
134
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
135
|
+
* @example
|
|
136
|
+
* // Set complete document data
|
|
137
|
+
* doc.setData({
|
|
138
|
+
* name: 'John Doe',
|
|
139
|
+
* age: 30,
|
|
140
|
+
* email: 'john@example.com'
|
|
141
|
+
* });
|
|
142
|
+
*
|
|
143
|
+
* // Chain with other methods
|
|
144
|
+
* doc.setData({ name: 'John' })
|
|
145
|
+
* .setString('title', 'Mr.');
|
|
146
|
+
*
|
|
147
|
+
* // Replace existing data
|
|
148
|
+
* const newData = { status: 'active', type: 'user' };
|
|
149
|
+
* doc.setData(newData); // Previous data is completely replaced
|
|
150
|
+
*/
|
|
151
|
+
setData(data: Dictionary): MutableDocument;
|
|
152
|
+
/**
|
|
153
|
+
* Sets a date value for a given key in the document
|
|
154
|
+
* @param {string} key - The property key where the date will be stored
|
|
155
|
+
* @param {Date | null} value - The date to store, or null to remove the date
|
|
156
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
157
|
+
* @example
|
|
158
|
+
* // Set current date
|
|
159
|
+
* doc.setDate('createdAt', new Date());
|
|
160
|
+
*
|
|
161
|
+
* // Set specific date
|
|
162
|
+
* doc.setDate('dueDate', new Date('2024-12-31'));
|
|
163
|
+
*
|
|
164
|
+
* // Remove date
|
|
165
|
+
* doc.setDate('expiredAt', null);
|
|
166
|
+
*
|
|
167
|
+
* // Chain with other methods
|
|
168
|
+
* doc.setDate('createdAt', new Date())
|
|
169
|
+
* .setString('status', 'active');
|
|
170
|
+
*
|
|
171
|
+
* // Note: Dates are stored as ISO 8601 strings in the document
|
|
172
|
+
*/
|
|
173
|
+
setDate(key: string, value: Date | null): MutableDocument;
|
|
174
|
+
/**
|
|
175
|
+
* Sets a dictionary (object) value for a given key in the document
|
|
176
|
+
* @param {string} key - The property key where the dictionary will be stored
|
|
177
|
+
* @param {Dictionary | null} value - The dictionary to store, or null to remove the dictionary
|
|
178
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
179
|
+
* @example
|
|
180
|
+
* // Set a dictionary
|
|
181
|
+
* doc.setDictionary('address', {
|
|
182
|
+
* street: '123 Main St',
|
|
183
|
+
* city: 'Boston',
|
|
184
|
+
* state: 'MA',
|
|
185
|
+
* zip: '02108'
|
|
186
|
+
* });
|
|
187
|
+
*
|
|
188
|
+
* // Remove a dictionary
|
|
189
|
+
* doc.setDictionary('oldAddress', null);
|
|
190
|
+
*
|
|
191
|
+
* // Chain with other methods
|
|
192
|
+
* doc.setDictionary('contact', { email: 'john@example.com' })
|
|
193
|
+
* .setString('status', 'active');
|
|
194
|
+
*/
|
|
195
|
+
setDictionary(key: string, value: Dictionary | null): MutableDocument;
|
|
196
|
+
/**
|
|
197
|
+
* Sets a double-precision floating point number for a given key in the document
|
|
198
|
+
* @param {string} key - The property key where the number will be stored
|
|
199
|
+
* @param {number} value - The double value to store
|
|
200
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
201
|
+
* @example
|
|
202
|
+
* // Set a double value
|
|
203
|
+
* doc.setDouble('price', 99.99);
|
|
204
|
+
*
|
|
205
|
+
* // Set a scientific notation
|
|
206
|
+
* doc.setDouble('distance', 1.23e-4);
|
|
207
|
+
*
|
|
208
|
+
* // Chain with other methods
|
|
209
|
+
* doc.setDouble('weight', 75.5)
|
|
210
|
+
* .setDouble('height', 182.3)
|
|
211
|
+
* .setString('unit', 'metric');
|
|
212
|
+
*/
|
|
213
|
+
setDouble(key: string, value: number): MutableDocument;
|
|
214
|
+
/**
|
|
215
|
+
* Sets a single-precision floating point number for a given key in the document
|
|
216
|
+
* @param {string} key - The property key where the number will be stored
|
|
217
|
+
* @param {number} value - The float value to store
|
|
218
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
219
|
+
* @example
|
|
220
|
+
* // Set a float value
|
|
221
|
+
* doc.setFloat('temperature', 98.6);
|
|
222
|
+
*
|
|
223
|
+
* // Set a scientific notation
|
|
224
|
+
* doc.setFloat('measurement', 3.14e2);
|
|
225
|
+
*
|
|
226
|
+
* // Chain with other methods
|
|
227
|
+
* doc.setFloat('latitude', 42.3601)
|
|
228
|
+
* .setFloat('longitude', -71.0589)
|
|
229
|
+
* .setString('location', 'Boston');
|
|
230
|
+
*
|
|
231
|
+
* // Note: Use setDouble() instead if you need higher precision
|
|
232
|
+
*/
|
|
233
|
+
setFloat(key: string, value: number): MutableDocument;
|
|
234
|
+
/**
|
|
235
|
+
* Sets a 32-bit integer value for a given key in the document
|
|
236
|
+
* @param {string} key - The property key where the integer will be stored
|
|
237
|
+
* @param {number} value - The integer value to store
|
|
238
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
239
|
+
* @example
|
|
240
|
+
* // Set an integer value
|
|
241
|
+
* doc.setInt('age', 25);
|
|
242
|
+
*
|
|
243
|
+
* // Set a negative integer
|
|
244
|
+
* doc.setInt('temperature', -5);
|
|
245
|
+
*
|
|
246
|
+
* // Chain with other methods
|
|
247
|
+
* doc.setInt('quantity', 100)
|
|
248
|
+
* .setInt('minStock', 10)
|
|
249
|
+
* .setString('status', 'in-stock');
|
|
250
|
+
*
|
|
251
|
+
* // Note: For larger numbers, use setLong() instead
|
|
252
|
+
*/
|
|
253
|
+
setInt(key: string, value: number): MutableDocument;
|
|
254
|
+
/**
|
|
255
|
+
* Sets a 64-bit integer value for a given key in the document
|
|
256
|
+
* @param {string} key - The property key where the long integer will be stored
|
|
257
|
+
* @param {number} value - The long integer value to store
|
|
258
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
259
|
+
* @example
|
|
260
|
+
* // Set a large integer value
|
|
261
|
+
* doc.setLong('fileSize', 2147483648);
|
|
262
|
+
*
|
|
263
|
+
* // Set a timestamp
|
|
264
|
+
* doc.setLong('timestamp', Date.now());
|
|
265
|
+
*
|
|
266
|
+
* // Chain with other methods
|
|
267
|
+
* doc.setLong('userId', 9876543210)
|
|
268
|
+
* .setString('status', 'active');
|
|
269
|
+
*
|
|
270
|
+
* // Note: Use this instead of setInt() for numbers larger than 2^31 - 1
|
|
271
|
+
*/
|
|
272
|
+
setLong(key: string, value: number): MutableDocument;
|
|
273
|
+
/**
|
|
274
|
+
* Sets a numeric value for a given key in the document
|
|
275
|
+
* @param {string} key - The property key where the number will be stored
|
|
276
|
+
* @param {number} value - The numeric value to store
|
|
277
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
278
|
+
* @example
|
|
279
|
+
* // Set various types of numbers
|
|
280
|
+
* doc.setNumber('integer', 42);
|
|
281
|
+
* doc.setNumber('decimal', 3.14);
|
|
282
|
+
* doc.setNumber('scientific', 1.23e-4);
|
|
283
|
+
* doc.setNumber('negative', -10);
|
|
284
|
+
*
|
|
285
|
+
* // Chain with other methods
|
|
286
|
+
* doc.setNumber('price', 99.99)
|
|
287
|
+
* .setString('currency', 'USD');
|
|
288
|
+
*
|
|
289
|
+
* // Note: For specific number types, consider using:
|
|
290
|
+
* // setInt() for 32-bit integers
|
|
291
|
+
* // setLong() for 64-bit integers
|
|
292
|
+
* // setFloat() for single-precision decimals
|
|
293
|
+
* // setDouble() for double-precision decimals
|
|
294
|
+
*/
|
|
295
|
+
setNumber(key: string, value: number): MutableDocument;
|
|
296
|
+
/**
|
|
297
|
+
* Sets the revision ID for the document
|
|
298
|
+
* @param {string} revisionID - The new revision ID to set
|
|
299
|
+
* @example
|
|
300
|
+
* const doc = new MutableDocument('user123');
|
|
301
|
+
* doc.setRevisionID('1-abc123');
|
|
302
|
+
*
|
|
303
|
+
* // Note: THIS METHOD IS USED INTERNALLY ONLY - DO NOT SET THIS MANUALLY.
|
|
304
|
+
* // Revision IDs ARE MANAGED AUTOMATICALLY BY THE DATABASE
|
|
305
|
+
*/
|
|
306
|
+
setRevisionID(revisionID: string): void;
|
|
307
|
+
/**
|
|
308
|
+
* Sets the sequence number for the document
|
|
309
|
+
* @param {string} revisionID - The new sequence number to set
|
|
310
|
+
* @example
|
|
311
|
+
* const doc = new MutableDocument('user123');
|
|
312
|
+
* doc.setSequence(123);
|
|
313
|
+
*
|
|
314
|
+
* // Note: THIS METHOD IS USED INTERNALLY ONLY - DO NOT SET THIS MANUALLY.
|
|
315
|
+
* // SEQUENCE NUMBERS ARE MANAGED AUTOMATICALLY BY THE DATABASE
|
|
316
|
+
*/
|
|
317
|
+
setSequence(sequence: number): void;
|
|
318
|
+
/**
|
|
319
|
+
* Sets a string value for a given key in the document
|
|
320
|
+
* @param {string} key - The property key where the string will be stored
|
|
321
|
+
* @param {string | null} value - The string value to store, or null to remove the value
|
|
322
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
323
|
+
* @example
|
|
324
|
+
* // Set a string value
|
|
325
|
+
* doc.setString('name', 'John Doe');
|
|
326
|
+
*
|
|
327
|
+
* // Remove a string value
|
|
328
|
+
* doc.setString('middleName', null);
|
|
329
|
+
*
|
|
330
|
+
* // Chain with other methods
|
|
331
|
+
* doc.setString('firstName', 'John')
|
|
332
|
+
* .setString('lastName', 'Doe')
|
|
333
|
+
* .setString('email', 'john@example.com');
|
|
334
|
+
*/
|
|
335
|
+
setString(key: string, value: string | null): MutableDocument;
|
|
336
|
+
/**
|
|
337
|
+
* Sets a value of any type for a given key in the document
|
|
338
|
+
* @param {string} key - The property key where the value will be stored
|
|
339
|
+
* @param {T} value - The value to store
|
|
340
|
+
* @template T - The type of the value being stored
|
|
341
|
+
* @returns {MutableDocument} The current document instance for method chaining
|
|
342
|
+
* @example
|
|
343
|
+
* // Set values of different types
|
|
344
|
+
* doc.setValue('name', 'John')
|
|
345
|
+
* .setValue('age', 30)
|
|
346
|
+
* .setValue('isActive', true)
|
|
347
|
+
* .setValue('scores', [85, 92, 78])
|
|
348
|
+
* .setValue('address', {
|
|
349
|
+
* street: '123 Main St',
|
|
350
|
+
* city: 'Boston'
|
|
351
|
+
* });
|
|
352
|
+
*
|
|
353
|
+
* // Note: Consider using type-specific setters (setString, setNumber, etc.)
|
|
354
|
+
* // when the type is known at development time
|
|
355
|
+
*/
|
|
356
|
+
setValue<T>(key: string, value: T): MutableDocument;
|
|
357
|
+
/**
|
|
358
|
+
* Converts the document's blob attachments to a JSON string representation
|
|
359
|
+
* @returns {string} A JSON string containing all blob attachments in the document
|
|
360
|
+
* @example
|
|
361
|
+
* // First, add some blobs to the document
|
|
362
|
+
* const imageBlob = new Blob('image/jpeg', imageBytes);
|
|
363
|
+
* const pdfBlob = new Blob('application/pdf', pdfBytes);
|
|
364
|
+
*
|
|
365
|
+
* doc.setBlob('profile_image', imageBlob)
|
|
366
|
+
* .setBlob('resume', pdfBlob);
|
|
367
|
+
*
|
|
368
|
+
* // Get JSON string of all blobs
|
|
369
|
+
* const blobsJson = doc.blobsToJsonString();
|
|
370
|
+
* // Returns: '{"profile_image":{"_type":"blob","data":{...}},"resume":{...}}'
|
|
371
|
+
*/
|
|
372
|
+
blobsToJsonString(): string;
|
|
373
|
+
}
|