├── .gitignore ├── .npmignore ├── README.md ├── couchbase.android.ts ├── couchbase.d.ts ├── couchbase.ios.ts ├── demo ├── app │ ├── App_Resources │ │ ├── Android │ │ │ ├── AndroidManifest.xml │ │ │ ├── app.gradle │ │ │ ├── drawable-hdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-ldpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ ├── drawable-xhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ └── iOS │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ ├── Default-Landscape@3x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default.png │ │ │ │ └── Default@2x.png │ │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ └── LaunchScreen-AspectFill@2x.png │ │ │ └── LaunchScreen.Center.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ └── LaunchScreen-Center@2x.png │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ └── build.xcconfig │ ├── README.md │ ├── app.css │ ├── app.ts │ ├── bundle-config.ts │ ├── package.json │ ├── references.d.ts │ ├── vendor-platform.android.ts │ ├── vendor-platform.ios.ts │ ├── vendor.ts │ └── views │ │ ├── create │ │ ├── create-view-model.ts │ │ ├── create.ts │ │ └── create.xml │ │ └── list │ │ ├── list-view-model.ts │ │ ├── list.ts │ │ └── list.xml ├── package.json ├── references.d.ts ├── sync-gateway-config.json └── tsconfig.json ├── ng-demo ├── app │ ├── App_Resources │ │ ├── Android │ │ │ ├── AndroidManifest.xml │ │ │ ├── app.gradle │ │ │ ├── drawable-hdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-ldpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ ├── drawable-xhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ └── iOS │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ ├── Default-Landscape@3x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default.png │ │ │ │ └── Default@2x.png │ │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ └── LaunchScreen-AspectFill@2x.png │ │ │ └── LaunchScreen.Center.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ └── LaunchScreen-Center@2x.png │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ └── build.xcconfig │ ├── app.component.html │ ├── app.component.ts │ ├── app.css │ ├── app.module.ts │ ├── app.routing.ts │ ├── components │ │ ├── create │ │ │ ├── create.component.html │ │ │ └── create.component.ts │ │ └── list │ │ │ ├── list.component.html │ │ │ └── list.component.ts │ ├── couchbaseinstance.ts │ ├── main.aot.ts │ ├── main.ts │ ├── package.json │ ├── vendor-platform.android.ts │ ├── vendor-platform.ios.ts │ └── vendor.ts ├── package.json ├── references.d.ts ├── sync-gateway-config.json ├── tsconfig.aot.json └── tsconfig.json ├── package.json ├── platforms ├── android │ └── include.gradle └── ios │ ├── CouchbaseLite.framework │ ├── CouchbaseLite │ ├── Headers │ │ ├── CBLAttachment.h │ │ ├── CBLAuthenticator.h │ │ ├── CBLDatabase.h │ │ ├── CBLDatabaseChange.h │ │ ├── CBLDocument.h │ │ ├── CBLGeometry.h │ │ ├── CBLJSON.h │ │ ├── CBLManager.h │ │ ├── CBLModel.h │ │ ├── CBLModelFactory.h │ │ ├── CBLQuery+FullTextSearch.h │ │ ├── CBLQuery+Geo.h │ │ ├── CBLQuery.h │ │ ├── CBLQueryBuilder.h │ │ ├── CBLReplication.h │ │ ├── CBLRevision.h │ │ ├── CBLUITableSource.h │ │ ├── CBLView.h │ │ ├── CouchbaseLite.h │ │ └── MYDynamicObject.h │ ├── Info.plist │ └── Modules │ │ └── module.modulemap │ └── build.xcconfig ├── references.d.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | hooks/ 3 | 4 | demo/node_modules/ 5 | demo/platforms/ 6 | demo/lib 7 | 8 | ng-demo/platforms 9 | ng-demo/lib 10 | 11 | npm_debug.log 12 | 13 | .DS_Store* 14 | Thumbs.db* 15 | ~* 16 | *.js 17 | *.js.map 18 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | demo/ 2 | ng-demo/ 3 | dist/ 4 | node_modules/ 5 | *.ts 6 | !*.d.ts 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This Project is No Longer Supported Or Maintained 2 | 3 | For an alternative, please visit https://github.com/triniwiz/nativescript-couchbase-plugin 4 | 5 | 6 | # Couchbase Lite Plugin for Telerik NativeScript 7 | 8 | Couchbase Lite is a NoSQL embedded database for mobile devices. It is a replacement for common database technologies like SQLite and Core Data. 9 | 10 | ## Configuration 11 | 12 | To add this plugin to your Angular or vanilla JavaScript NativeScript project, execute the following from the Terminal or Command Prompt: 13 | 14 | ``` 15 | tns plugin add nativescript-couchbase 16 | ``` 17 | 18 | If you wish to try either of the demo applications that are bundled with this project, execute the following after cloning the repository: 19 | 20 | ``` 21 | npm install 22 | npm run deploy-android-angular 23 | ``` 24 | 25 | For the third line, the list of options are: 26 | 27 | ``` 28 | npm run deploy-android-angular 29 | npm run deploy-android-vanilla 30 | npm run deploy-ios-angular 31 | npm run deploy-ios-vanilla 32 | ``` 33 | 34 | If you're using TypeScript and wish to make use of the type definitions for this plugin, add the following line to your project's **references.d.ts** file: 35 | 36 | ``` 37 | /// 38 | ``` 39 | 40 | Without the above line included, your TypeScript compiler may throw errors during the build. 41 | 42 | ## Usage 43 | 44 | ### Including the Plugin in Your Project 45 | 46 | ```javascript 47 | var couchbaseModule = require("nativescript-couchbase"); 48 | ``` 49 | 50 | ### Creating or Opening an Existing Database 51 | 52 | ```javascript 53 | var database = new couchbaseModule.Couchbase("test-database"); 54 | ``` 55 | 56 | ### Managing the Data with CRUD Operations 57 | 58 | #### Creating a New Document 59 | 60 | ```javascript 61 | var documentId = database.createDocument({ 62 | "firstname": "Nic", 63 | "lastname": "Raboy", 64 | "address": { 65 | "city": "San Francisco", 66 | "state": "CA", 67 | "country": "USA" 68 | } 69 | "twitter": "https://www.twitter.com/nraboy" 70 | }); 71 | ``` 72 | 73 | #### Retrieving an Existing Document 74 | 75 | ```javascript 76 | var person = database.getDocument(documentId); 77 | ``` 78 | 79 | #### Updating an Existing Document 80 | 81 | ```javascript 82 | database.updateDocument(documentId, { 83 | "firstname": "Nicolas", 84 | "lastname": "Raboy", 85 | "twitter": "https://www.twitter.com/nraboy" 86 | }); 87 | ``` 88 | 89 | #### Deleting a Document 90 | 91 | ```javascript 92 | var isDeleted = database.deleteDocument(documentId); 93 | ``` 94 | 95 | ### Querying with MapReduce Views 96 | 97 | Knowing the document id isn't always an option. With this in mind, multiple documents can be queried using criteria defined in a view. 98 | 99 | #### Creating a MapReduce View 100 | 101 | A MapReduce View will emit a key-value pair. Logic can be placed around the **emitter** to make the views more specific. 102 | 103 | ```javascript 104 | database.createView("people", "1", function(document, emitter) { 105 | emitter.emit(document._id, document); 106 | }); 107 | ``` 108 | 109 | #### Querying a MapReduce View 110 | 111 | ```javascript 112 | var rows = database.executeQuery("people", {descending : false, limit : 20, skip : 1, startKey: "name to strat with", endKey:"name to end at"}); 113 | for(var i = 0; i < rows.length; i++) { 114 | personList.push(rows[i]); 115 | } 116 | ``` 117 | The available options when querying a MapReduce View are as follows: 118 | 119 | * **startKey**: the key to start at. The default value, null, means to start from the beginning. 120 | 121 | * **endKey**: the last key to return. The default value, null, means to continue to the end. 122 | 123 | * **descending**: If set to true, the keys will be returned in reverse order. (This also reverses the meanings of the startKey and endKey properties, since the query will now start at the highest keys and end at lower ones!) 124 | 125 | * **limit**: If nonzero, this is the maximum number of rows that will be returned. 126 | 127 | * **skip**: If nonzero, this many rows will be skipped (starting from the startKey if any.) 128 | 129 | ## Synchronization with Couchbase Sync Gateway and Couchbase Server 130 | 131 | Couchbase Lite can work in combination with Couchbase Sync Gateway to offer synchronization support between devices and platforms. Couchbase Sync Gateway **is not** a requirement to use Couchbase Lite if the goal is to only use it for offline purposes. 132 | 133 | Couchbase Sync Gateway can be downloaded via the [Couchbase Downloads Portal](http://www.couchbase.com/downloads) in the mobile section. 134 | 135 | A demo configuration file for Sync Gateway is included in the **demo** directory. It can be started by executing the following from a Command Prompt or Terminal: 136 | 137 | ``` 138 | /path/to/sync/gateway/bin/sync_gateway /path/to/demo/sync-gateway-config.json 139 | ``` 140 | 141 | In the demo configuration file, Couchbase Server is not used, but instead an in-memory database good for prototyping. It can be accessed via **http://localhost:4985/_admin/** in your web browser. 142 | 143 | To replicate between the local device and server, the following must be added to your project: 144 | 145 | ```javascript 146 | var couchbaseModule = require("nativescript-couchbase"); 147 | database = new couchbaseModule.Couchbase("test-database"); 148 | 149 | var push = database.createPushReplication("http://sync-gateway-host:4984/test-database"); 150 | var pull = database.createPullReplication("http://sync-gateway-host:4984/test-database"); 151 | push.setContinuous(true); 152 | pull.setContinuous(true); 153 | push.start(); 154 | pull.start(); 155 | ``` 156 | 157 | Data will now continuously be replicated between the local device and Sync Gateway. 158 | 159 | ### Listening for Changes 160 | 161 | ```javascript 162 | database.addDatabaseChangeListener(function(changes) { 163 | for(var i = 0; i < changes.length; i++) { 164 | console.log(changes[i].getDocumentId()); 165 | } 166 | }); 167 | ``` 168 | 169 | ## Plugin Development 170 | 171 | The Couchbase NativeScript plugin is under active development. Changes to the API are infrequent in the underlying Couchbase Android and Couchbase iOS SDKs so as a result changes are infrequent in the JavaScript wrapper for NativeScript. 172 | 173 | If you feel something is missing or you've found a bug, open a ticket so it can be corrected or submit a pull request and be recognized for your contributions. 174 | -------------------------------------------------------------------------------- /couchbase.d.ts: -------------------------------------------------------------------------------- 1 | declare module "nativescript-couchbase" { 2 | 3 | export class Couchbase { 4 | constructor(databaseName: string); 5 | createDocument(data: Object, documentId?: string); 6 | getDocument(documentId: string); 7 | updateDocument(documentId: string, data: any); 8 | deleteDocument(documentId: string); 9 | destroyDatabase(); 10 | createView(viewName: string, viewRevision: string, callback: any); 11 | executeQuery(viewName: string, options?: any); 12 | createPullReplication(remoteUrl: string); 13 | createPushReplication(remoteUrl: string); 14 | addDatabaseChangeListener(callback: any); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /couchbase.ios.ts: -------------------------------------------------------------------------------- 1 | declare var CBLManager: any; 2 | declare var interop: any; 3 | declare var NSURL: any; 4 | declare var NSNotificationCenter: any; 5 | declare var NSOperationQueue: any; 6 | declare var NSJSONSerialization: any; 7 | declare var NSString: any; 8 | declare var NSJSONWritingPrettyPrinted: any; 9 | declare var NSUTF8StringEncoding: any; 10 | 11 | export class Couchbase { 12 | 13 | private manager: any; 14 | private database: any; 15 | 16 | constructor(databaseName: String){ 17 | this.manager = CBLManager.sharedInstance(); 18 | if (!this.manager){ 19 | console.log("MANAGER ERROR:Can not create share instance of CBLManager"); 20 | throw new Error("MANAGER ERROR:Can not create share instance of CBLManager"); 21 | } 22 | var errorRef = new interop.Reference(); 23 | 24 | this.database = this.manager.databaseNamedError(databaseName, errorRef); 25 | 26 | if (!this.database){ 27 | console.log(errorRef.value); 28 | throw new Error(errorRef.value); 29 | } 30 | } 31 | createDocument(data: Object, documentId?: string){ 32 | var doc = documentId == null ? this.database.createDocument() : this.database.documentWithID(documentId); 33 | 34 | var documentId: string = doc.documentID; 35 | 36 | var errorRef = new interop.Reference(); 37 | var revision = doc.putPropertiesError(data, errorRef); 38 | 39 | if (!errorRef){ 40 | console.log("DOCUMENT ERROR:" + errorRef.value); 41 | throw new Error("DOCUMENT ERROR:" + errorRef.value); 42 | } 43 | 44 | return documentId; 45 | } 46 | 47 | getDocument(documentId: string){ 48 | var document = this.database.documentWithID(documentId); 49 | if (document && document.properties){ 50 | return JSON.parse(this.mapToJson(document.properties)); 51 | } 52 | return null; 53 | } 54 | 55 | updateDocument(documentId: string, data: any){ 56 | var document = this.database.documentWithID(documentId); 57 | let temp: any = this.getDocument(documentId); 58 | data._id = temp._id; 59 | data._rev = temp._rev; 60 | var errorRef = new interop.Reference(); 61 | var revision = document.putPropertiesError(data, errorRef); 62 | 63 | if (!errorRef){ 64 | console.error("DOCUMENT ERROR", errorRef.value); 65 | throw new Error("DOCUMENT ERROR " + errorRef.value); 66 | } 67 | } 68 | 69 | deleteDocument(documentId: string){ 70 | var document = this.database.documentWithID(documentId); 71 | var errorRef = new interop.Reference(); 72 | 73 | document.deleteDocument(errorRef); 74 | 75 | if (!errorRef){ 76 | return false; 77 | } 78 | return true; 79 | } 80 | 81 | createView(viewName: string, viewRevision: string, callback: any) { 82 | var self = this; 83 | var view = this.database.viewNamed(viewName) 84 | view.setMapBlockVersion(function(document, emit){ 85 | callback(JSON.parse(self.mapToJson(document)), { 86 | emit: emit 87 | }); 88 | }, viewRevision); 89 | } 90 | 91 | executeQuery(viewName: string, options?: any): Array { 92 | var view = this.database.viewNamed(viewName); 93 | var query = view.createQuery(); 94 | if(options != null) { 95 | if(options.descending) { 96 | query.descending = options.descending; 97 | } 98 | if(options.limit) { 99 | query.limit = options.limit; 100 | } 101 | if(options.skip) { 102 | query.skip = options.skip; 103 | } 104 | if(options.startKey) { 105 | query.startKey = options.startKey; 106 | } 107 | if(options.endKey) { 108 | query.endKey = options.endKey; 109 | } 110 | } 111 | var errorRef = new interop.Reference(); 112 | var resultSet = query.run(errorRef); 113 | 114 | var row = resultSet.nextRow(); 115 | 116 | var results: Array = []; 117 | 118 | while(row){ 119 | if(row.value !== null) { 120 | if(typeof row.value === "object") { 121 | results.push(JSON.parse(this.mapToJson(row.value))); 122 | } else { 123 | results.push(row.value); 124 | } 125 | } 126 | row = resultSet.nextRow(); 127 | } 128 | 129 | if (!errorRef){ 130 | console.log(errorRef.value); 131 | } 132 | 133 | return results; 134 | } 135 | 136 | createPullReplication(remoteUrl: string) { 137 | var url = NSURL.URLWithString(remoteUrl); 138 | 139 | var replication = this.database.createPullReplication(url); 140 | 141 | if (!replication){ 142 | console.error("PULL ERROR"); 143 | throw new Error("PULL ERROR"); 144 | } 145 | 146 | return new Replicator(replication); 147 | } 148 | 149 | createPushReplication(remoteUrl: string) { 150 | var url = NSURL.URLWithString(remoteUrl); 151 | 152 | var replication = this.database.createPushReplication(url); 153 | 154 | if (!replication){ 155 | console.error("PUSH ERROR"); 156 | throw new Error("PUSH ERROR"); 157 | } 158 | 159 | return new Replicator(replication);; 160 | } 161 | 162 | addDatabaseChangeListener(callback: any) { 163 | var self = this; 164 | function getter(_this: any, property: T | {(): T}): T { 165 | if (typeof property === "function") { 166 | return (<{(): T}>property).call(_this); 167 | } else { 168 | return property; 169 | } 170 | } 171 | 172 | let defaultCenter = getter(NSNotificationCenter, NSNotificationCenter.defaultCenter) 173 | let mainQueue = getter(NSOperationQueue, NSOperationQueue.mainQueue) 174 | defaultCenter.addObserverForNameObjectQueueUsingBlock(`CBLDatabaseChange`, this.database, mainQueue, function(notification){ 175 | var changesList = []; 176 | if (notification.userInfo){ 177 | var changes = notification.userInfo.objectForKey("changes"); 178 | 179 | if (changes != null){ 180 | for (var i = 0; i < changes.count; i++) { 181 | changesList.push(new DatabaseChange(changes[i])); 182 | } 183 | callback(changesList); 184 | } 185 | } 186 | }); 187 | } 188 | 189 | destroyDatabase() { 190 | var errorRef = new interop.Reference(); 191 | 192 | this.database.deleteDatabase(errorRef); 193 | 194 | if (!errorRef){ 195 | console.error("DESTROY", errorRef.value); 196 | } 197 | } 198 | 199 | private mapToJson(properties: Object){ 200 | var errorRef = new interop.Reference(); 201 | var result = ""; 202 | if(NSJSONSerialization.isValidJSONObject(properties)) { 203 | var data = NSJSONSerialization.dataWithJSONObjectOptionsError(properties, NSJSONWritingPrettyPrinted, errorRef); 204 | result = NSString.alloc().initWithDataEncoding(data, NSUTF8StringEncoding); 205 | } else { 206 | result = JSON.stringify(properties); 207 | } 208 | return result; 209 | } 210 | 211 | } 212 | 213 | export class Replicator { 214 | 215 | replicator: any; 216 | 217 | constructor(replicator: any) { 218 | this.replicator = replicator; 219 | } 220 | 221 | start() { 222 | this.replicator.start(); 223 | } 224 | 225 | stop() { 226 | this.replicator.stop(); 227 | } 228 | 229 | isRunning() { 230 | this.replicator.isRunning; 231 | } 232 | 233 | setContinuous(isContinuous: boolean) { 234 | this.replicator.continuous = isContinuous; 235 | } 236 | 237 | setCookie(name: String, value: String, path: String, expirationDate: Date, secure: boolean) { 238 | this.replicator.setCookieNamedWithValuePathExpirationDateSecure(name, value, path, expirationDate, secure); 239 | }; 240 | 241 | deleteCookie(name: String) { 242 | this.replicator.deleteCookieNamed(name); 243 | } 244 | } 245 | 246 | export class DatabaseChange { 247 | 248 | change: any; 249 | 250 | constructor(change: any) { 251 | this.change = change; 252 | } 253 | 254 | getDocumentId() { 255 | return this.change.documentID; 256 | } 257 | 258 | getRevisionId() { 259 | return this.change.revisionID; 260 | } 261 | 262 | } 263 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | android { 9 | defaultConfig { 10 | generatedDensities = [] 11 | applicationId = "org.nativescript.demo" 12 | } 13 | aaptOptions { 14 | additionalParameters "--no-version-vectors" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 46 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon-29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon-29@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@3x.png", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "icon-40@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "57x57", 35 | "idiom" : "iphone", 36 | "filename" : "icon-57.png", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "size" : "57x57", 41 | "idiom" : "iphone", 42 | "filename" : "icon-57@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon-60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "icon-60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "29x29", 59 | "idiom" : "ipad", 60 | "filename" : "icon-29.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon-29@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "40x40", 71 | "idiom" : "ipad", 72 | "filename" : "icon-40.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon-40@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "50x50", 83 | "idiom" : "ipad", 84 | "filename" : "icon-50.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "50x50", 89 | "idiom" : "ipad", 90 | "filename" : "icon-50@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "72x72", 95 | "idiom" : "ipad", 96 | "filename" : "icon-72.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "72x72", 101 | "idiom" : "ipad", 102 | "filename" : "icon-72@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "76x76", 107 | "idiom" : "ipad", 108 | "filename" : "icon-76.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "76x76", 113 | "idiom" : "ipad", 114 | "filename" : "icon-76@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "83.5x83.5", 119 | "idiom" : "ipad", 120 | "filename" : "icon-83.5@2x.png", 121 | "scale" : "2x" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-736h@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "Default-Landscape@3x.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "Default-667h@2x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "filename" : "Default@2x.png", 34 | "extent" : "full-screen", 35 | "minimum-system-version" : "7.0", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "extent" : "full-screen", 40 | "idiom" : "iphone", 41 | "subtype" : "retina4", 42 | "filename" : "Default-568h@2x.png", 43 | "minimum-system-version" : "7.0", 44 | "orientation" : "portrait", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "orientation" : "portrait", 49 | "idiom" : "ipad", 50 | "filename" : "Default-Portrait.png", 51 | "extent" : "full-screen", 52 | "minimum-system-version" : "7.0", 53 | "scale" : "1x" 54 | }, 55 | { 56 | "orientation" : "landscape", 57 | "idiom" : "ipad", 58 | "filename" : "Default-Landscape.png", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "ipad", 66 | "filename" : "Default-Portrait@2x.png", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "landscape", 73 | "idiom" : "ipad", 74 | "filename" : "Default-Landscape@2x.png", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "2x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "filename" : "Default.png", 83 | "extent" : "full-screen", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "filename" : "Default@2x.png", 90 | "extent" : "full-screen", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "iphone", 96 | "filename" : "Default-568h@2x.png", 97 | "extent" : "full-screen", 98 | "subtype" : "retina4", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "orientation" : "portrait", 103 | "idiom" : "ipad", 104 | "extent" : "to-status-bar", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "orientation" : "portrait", 109 | "idiom" : "ipad", 110 | "filename" : "Default-Portrait.png", 111 | "extent" : "full-screen", 112 | "scale" : "1x" 113 | }, 114 | { 115 | "orientation" : "landscape", 116 | "idiom" : "ipad", 117 | "extent" : "to-status-bar", 118 | "scale" : "1x" 119 | }, 120 | { 121 | "orientation" : "landscape", 122 | "idiom" : "ipad", 123 | "filename" : "Default-Landscape.png", 124 | "extent" : "full-screen", 125 | "scale" : "1x" 126 | }, 127 | { 128 | "orientation" : "portrait", 129 | "idiom" : "ipad", 130 | "extent" : "to-status-bar", 131 | "scale" : "2x" 132 | }, 133 | { 134 | "orientation" : "portrait", 135 | "idiom" : "ipad", 136 | "filename" : "Default-Portrait@2x.png", 137 | "extent" : "full-screen", 138 | "scale" : "2x" 139 | }, 140 | { 141 | "orientation" : "landscape", 142 | "idiom" : "ipad", 143 | "extent" : "to-status-bar", 144 | "scale" : "2x" 145 | }, 146 | { 147 | "orientation" : "landscape", 148 | "idiom" : "ipad", 149 | "filename" : "Default-Landscape@2x.png", 150 | "extent" : "full-screen", 151 | "scale" : "2x" 152 | } 153 | ], 154 | "info" : { 155 | "version" : 1, 156 | "author" : "xcode" 157 | } 158 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiresFullScreen 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /demo/app/README.md: -------------------------------------------------------------------------------- 1 | # NativeScript TypeScript Template 2 | 3 | This template creates a NativeScript app with the NativeScript hello world example, 4 | however, in this template the example is built with TypeScript. 5 | 6 | You can create a new app that uses this template with either the `--template` option. 7 | 8 | ``` 9 | tns create my-app-name --template tns-template-hello-world-ts 10 | ``` 11 | 12 | Or the `--tsc` shorthand. 13 | 14 | ``` 15 | tns create my-app-name --tsc 16 | ``` 17 | 18 | > Note: Both commands will create a new NativeScript app that uses the latest version of this template published to [npm] (https://www.npmjs.com/package/tns-template-hello-world-ts). 19 | 20 | If you want to create a new app that uses the source of the template from the `master` branch, you can execute the following: 21 | 22 | ``` 23 | tns create my-app-name --template https://github.com/NativeScript/template-hello-world-ts.git#master 24 | ``` 25 | -------------------------------------------------------------------------------- /demo/app/app.css: -------------------------------------------------------------------------------- 1 | /* 2 | In NativeScript, the app.css file is where you place CSS rules that 3 | you would like to apply to your entire application. Check out 4 | http://docs.nativescript.org/ui/styling for a full list of the CSS 5 | selectors and properties you can use to style UI components. 6 | 7 | /* 8 | For example, the following CSS rule changes the font size of all UI 9 | components that have the btn class name. 10 | */ 11 | .btn { 12 | font-size: 18; 13 | } 14 | 15 | /* 16 | In many cases you may want to use the NativeScript core theme instead 17 | of writing your own CSS rules. For a full list of class names in the theme 18 | refer to http://docs.nativescript.org/ui/theme. 19 | */ 20 | @import 'nativescript-theme-core/css/core.light.css'; 21 | -------------------------------------------------------------------------------- /demo/app/app.ts: -------------------------------------------------------------------------------- 1 | /* 2 | In NativeScript, the app.ts file is the entry point to your application. 3 | You can use this file to perform app-level initialization, but the primary 4 | purpose of the file is to pass control to the app’s first module. 5 | */ 6 | 7 | import "./bundle-config"; 8 | import * as app from 'application'; 9 | 10 | app.start({ moduleName: 'views/list/list' }); 11 | 12 | /* 13 | Do not place any code after the application has been started as it will not 14 | be executed on iOS. 15 | */ 16 | -------------------------------------------------------------------------------- /demo/app/bundle-config.ts: -------------------------------------------------------------------------------- 1 | if ((global).TNS_WEBPACK) { 2 | //registers tns-core-modules UI framework modules 3 | require("bundle-entry-points"); 4 | 5 | //register application modules 6 | global.registerModule("list-page", () => require("./views/list/list")); 7 | global.registerModule("create-page", () => require("./views/create/create")); 8 | } 9 | -------------------------------------------------------------------------------- /demo/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": { 3 | "v8Flags": "--expose_gc" 4 | }, 5 | "main": "app.js", 6 | "name": "tns-template-hello-world-ts", 7 | "version": "2.5.0" 8 | } -------------------------------------------------------------------------------- /demo/app/references.d.ts: -------------------------------------------------------------------------------- 1 | /// Enable smart suggestions and completions in Visual Studio Code JavaScript projects. -------------------------------------------------------------------------------- /demo/app/vendor-platform.android.ts: -------------------------------------------------------------------------------- 1 | //Resolve JavaScript classes that extend a Java class, and need to resolve 2 | //their JavaScript module from a bundled script. For example: 3 | //NativeScriptApplication, NativeScriptActivity, etc. 4 | // 5 | //This module gets bundled together with the rest of the app code and the 6 | //`require` calls get resolved to the correct bundling import call. 7 | // 8 | //At runtime the module gets loaded *before* the rest of the app code, so code 9 | //placed here needs to be careful about its dependencies. 10 | 11 | require("application"); 12 | require("ui/frame"); 13 | require("ui/frame/activity"); 14 | 15 | if (global.TNS_WEBPACK) { 16 | global.__requireOverride = function (name, dir) { 17 | if (name === "./tns_modules/application/application.js") { 18 | return require("application"); 19 | } else if (name === "./tns_modules/ui/frame/frame.js") { 20 | return require("ui/frame"); 21 | } else if (name === "./tns_modules/ui/frame/activity.js") { 22 | return require("ui/frame/activity"); 23 | } 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /demo/app/vendor-platform.ios.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/demo/app/vendor-platform.ios.ts -------------------------------------------------------------------------------- /demo/app/vendor.ts: -------------------------------------------------------------------------------- 1 | require("./vendor-platform"); 2 | 3 | require("bundle-entry-points"); 4 | -------------------------------------------------------------------------------- /demo/app/views/create/create-view-model.ts: -------------------------------------------------------------------------------- 1 | import {Couchbase} from 'nativescript-couchbase'; 2 | import {Observable} from 'data/observable'; 3 | import {ObservableArray} from 'data/observable-array'; 4 | import {topmost, goBack} from 'ui/frame'; 5 | 6 | export class CreateDemo extends Observable { 7 | private database: any; 8 | private tfFirstName: any; 9 | private tfLastName: any; 10 | 11 | constructor(page: any) { 12 | super(); 13 | this.database = new Couchbase("test-database"); 14 | 15 | this.tfFirstName = page.getViewById("firstname"); 16 | this.tfLastName = page.getViewById("lastname"); 17 | } 18 | 19 | public save() { 20 | this.database.createDocument({ 21 | "firstname": this.tfFirstName.text, 22 | "lastname": this.tfLastName.text 23 | }); 24 | goBack(); 25 | } 26 | } -------------------------------------------------------------------------------- /demo/app/views/create/create.ts: -------------------------------------------------------------------------------- 1 | import {CreateDemo} from "./create-view-model"; 2 | 3 | function pageLoaded(args) { 4 | var page = args.object; 5 | page.bindingContext = new CreateDemo(page); 6 | } 7 | exports.pageLoaded = pageLoaded; -------------------------------------------------------------------------------- /demo/app/views/create/create.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /demo/app/views/list/list-view-model.ts: -------------------------------------------------------------------------------- 1 | import {Couchbase} from 'nativescript-couchbase'; 2 | import {Observable} from 'data/observable'; 3 | import {ObservableArray} from 'data/observable-array'; 4 | import {topmost} from 'ui/frame'; 5 | 6 | export class ListDemo extends Observable { 7 | public personList: ObservableArray; 8 | private database: any; 9 | 10 | constructor() { 11 | super(); 12 | this.personList = new ObservableArray([]); 13 | this.database = new Couchbase("test-database"); 14 | 15 | this.database.createView("people", "1", (document, emitter) => { 16 | emitter.emit(document._id, document); 17 | }); 18 | 19 | var push = this.database.createPushReplication("http://192.168.57.1:4984/test-database"); 20 | var pull = this.database.createPullReplication("http://192.168.57.1:4984/test-database"); 21 | 22 | push.setContinuous(true); 23 | pull.setContinuous(true); 24 | 25 | push.start(); 26 | pull.start(); 27 | 28 | this.database.addDatabaseChangeListener((changes) => { 29 | var changeIndex; 30 | for (var i = 0; i < changes.length; i++) { 31 | var documentId; 32 | 33 | documentId = changes[i].getDocumentId(); 34 | changeIndex = this.indexOfObjectId(documentId, this.personList); 35 | var document = this.database.getDocument(documentId); 36 | 37 | if (changeIndex == -1) { 38 | this.personList.push(document); 39 | } else { 40 | this.personList.setItem(changeIndex, document); 41 | } 42 | } 43 | }); 44 | 45 | this.refresh(); 46 | } 47 | 48 | public create() { 49 | topmost().navigate({ moduleName: "views/create/create" }); 50 | } 51 | 52 | private refresh() { 53 | var rows = this.database.executeQuery("people"); 54 | for(var i = 0; i < rows.length; i++) { 55 | this.personList.push(rows[i]); 56 | } 57 | } 58 | 59 | private indexOfObjectId(needle, haystack) { 60 | for (var i = 0; i < haystack.length; i++) { 61 | if (haystack.getItem(i) != undefined && haystack.getItem(i).hasOwnProperty("_id")) { 62 | if (haystack.getItem(i)._id == needle) { 63 | return i; 64 | } 65 | } 66 | } 67 | return -1; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /demo/app/views/list/list.ts: -------------------------------------------------------------------------------- 1 | import {ListDemo} from "./list-view-model"; 2 | 3 | function pageLoaded(args) { 4 | var page = args.object; 5 | page.bindingContext = new ListDemo(); 6 | } 7 | exports.pageLoaded = pageLoaded; -------------------------------------------------------------------------------- /demo/app/views/list/list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "NativeScript Application", 3 | "license": "SEE LICENSE IN ", 4 | "readme": "NativeScript Application", 5 | "repository": "", 6 | "nativescript": { 7 | "id": "org.nativescript.demo", 8 | "tns-ios": { 9 | "version": "2.5.0" 10 | }, 11 | "tns-android": { 12 | "version": "2.5.0" 13 | } 14 | }, 15 | "dependencies": { 16 | "nativescript-couchbase": "file:///Users/nraboy/Desktop/nativescript-couchbase", 17 | "nativescript-theme-core": "~1.0.2", 18 | "tns-core-modules": "2.5.0" 19 | }, 20 | "devDependencies": { 21 | "awesome-typescript-loader": "~3.0.0-beta.9", 22 | "babel-traverse": "6.22.1", 23 | "babel-types": "6.22.0", 24 | "babylon": "6.15.0", 25 | "copy-webpack-plugin": "~3.0.1", 26 | "extract-text-webpack-plugin": "~2.0.0-beta.4", 27 | "lazy": "1.0.11", 28 | "nativescript-css-loader": "~0.26.0", 29 | "nativescript-dev-android-snapshot": "^0.*.*", 30 | "nativescript-dev-typescript": "~0.3.5", 31 | "nativescript-dev-webpack": "^0.3.2", 32 | "raw-loader": "~0.5.1", 33 | "resolve-url-loader": "~1.6.0", 34 | "typescript": "~2.1.0", 35 | "webpack": "~2.1.0-beta.27", 36 | "webpack-sources": "~0.1.3" 37 | }, 38 | "scripts": { 39 | "clean-android": "tns clean-app android", 40 | "clean-ios": "tns clean-app ios", 41 | "prewebpack-android": "npm run clean-android", 42 | "prewebpack-ios": "npm run clean-ios", 43 | "webpack-android": "webpack --config=webpack.android.js --progress", 44 | "webpack-ios": "webpack --config=webpack.ios.js --progress", 45 | "prestart-android-bundle": "npm run webpack-android", 46 | "prestart-ios-bundle": "npm run webpack-ios", 47 | "start-android-bundle": "tns run android --bundle --disable-npm-install", 48 | "start-ios-bundle": "tns run ios --bundle --disable-npm-install", 49 | "prebuild-android-bundle": "npm run webpack-android", 50 | "prebuild-ios-bundle": "npm run webpack-ios", 51 | "build-android-bundle": "tns build android --bundle --disable-npm-install", 52 | "build-ios-bundle": "tns build ios --bundle --disable-npm-install" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /demo/references.d.ts: -------------------------------------------------------------------------------- 1 | /// Needed for autocompletion and compilation. 2 | /// -------------------------------------------------------------------------------- /demo/sync-gateway-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "log":["CRUD+", "REST+", "Changes+", "Attach+"], 3 | "databases": { 4 | "test-database": { 5 | "server":"walrus:data", 6 | "sync":` 7 | function (doc) { 8 | channel (doc.channels); 9 | } 10 | `, 11 | "users": { 12 | "GUEST": { 13 | "disabled": false, 14 | "admin_channels": ["*"] 15 | } 16 | } 17 | } 18 | }, 19 | "CORS": { 20 | "Origin": ["http://localhost:8100"], 21 | "LoginOrigin": ["http://localhost:8100"], 22 | "Headers": ["Content-Type"], 23 | "MaxAge": 17280000 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "noEmitHelpers": true, 8 | "noEmitOnError": true 9 | }, 10 | "exclude": [ 11 | "node_modules", 12 | "platforms", 13 | "**/*.aot.ts" 14 | ] 15 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | android { 9 | defaultConfig { 10 | generatedDensities = [] 11 | applicationId = "org.nativescript.ngdemo" 12 | } 13 | aaptOptions { 14 | additionalParameters "--no-version-vectors" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-hdpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-ldpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-mdpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/Android/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 46 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon-29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon-29@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@3x.png", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "icon-40@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "57x57", 35 | "idiom" : "iphone", 36 | "filename" : "icon-57.png", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "size" : "57x57", 41 | "idiom" : "iphone", 42 | "filename" : "icon-57@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon-60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "icon-60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "29x29", 59 | "idiom" : "ipad", 60 | "filename" : "icon-29.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon-29@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "40x40", 71 | "idiom" : "ipad", 72 | "filename" : "icon-40.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon-40@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "50x50", 83 | "idiom" : "ipad", 84 | "filename" : "icon-50.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "50x50", 89 | "idiom" : "ipad", 90 | "filename" : "icon-50@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "72x72", 95 | "idiom" : "ipad", 96 | "filename" : "icon-72.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "72x72", 101 | "idiom" : "ipad", 102 | "filename" : "icon-72@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "76x76", 107 | "idiom" : "ipad", 108 | "filename" : "icon-76.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "76x76", 113 | "idiom" : "ipad", 114 | "filename" : "icon-76@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "83.5x83.5", 119 | "idiom" : "ipad", 120 | "filename" : "icon-83.5@2x.png", 121 | "scale" : "2x" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-736h@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "Default-Landscape@3x.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "Default-667h@2x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "filename" : "Default@2x.png", 34 | "extent" : "full-screen", 35 | "minimum-system-version" : "7.0", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "extent" : "full-screen", 40 | "idiom" : "iphone", 41 | "subtype" : "retina4", 42 | "filename" : "Default-568h@2x.png", 43 | "minimum-system-version" : "7.0", 44 | "orientation" : "portrait", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "orientation" : "portrait", 49 | "idiom" : "ipad", 50 | "filename" : "Default-Portrait.png", 51 | "extent" : "full-screen", 52 | "minimum-system-version" : "7.0", 53 | "scale" : "1x" 54 | }, 55 | { 56 | "orientation" : "landscape", 57 | "idiom" : "ipad", 58 | "filename" : "Default-Landscape.png", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "ipad", 66 | "filename" : "Default-Portrait@2x.png", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "landscape", 73 | "idiom" : "ipad", 74 | "filename" : "Default-Landscape@2x.png", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "2x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "filename" : "Default.png", 83 | "extent" : "full-screen", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "filename" : "Default@2x.png", 90 | "extent" : "full-screen", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "iphone", 96 | "filename" : "Default-568h@2x.png", 97 | "extent" : "full-screen", 98 | "subtype" : "retina4", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "orientation" : "portrait", 103 | "idiom" : "ipad", 104 | "extent" : "to-status-bar", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "orientation" : "portrait", 109 | "idiom" : "ipad", 110 | "filename" : "Default-Portrait.png", 111 | "extent" : "full-screen", 112 | "scale" : "1x" 113 | }, 114 | { 115 | "orientation" : "landscape", 116 | "idiom" : "ipad", 117 | "extent" : "to-status-bar", 118 | "scale" : "1x" 119 | }, 120 | { 121 | "orientation" : "landscape", 122 | "idiom" : "ipad", 123 | "filename" : "Default-Landscape.png", 124 | "extent" : "full-screen", 125 | "scale" : "1x" 126 | }, 127 | { 128 | "orientation" : "portrait", 129 | "idiom" : "ipad", 130 | "extent" : "to-status-bar", 131 | "scale" : "2x" 132 | }, 133 | { 134 | "orientation" : "portrait", 135 | "idiom" : "ipad", 136 | "filename" : "Default-Portrait@2x.png", 137 | "extent" : "full-screen", 138 | "scale" : "2x" 139 | }, 140 | { 141 | "orientation" : "landscape", 142 | "idiom" : "ipad", 143 | "extent" : "to-status-bar", 144 | "scale" : "2x" 145 | }, 146 | { 147 | "orientation" : "landscape", 148 | "idiom" : "ipad", 149 | "filename" : "Default-Landscape@2x.png", 150 | "extent" : "full-screen", 151 | "scale" : "2x" 152 | } 153 | ], 154 | "info" : { 155 | "version" : 1, 156 | "author" : "xcode" 157 | } 158 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiresFullScreen 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ng-demo/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /ng-demo/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ng-demo/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | 3 | @Component({ 4 | selector: "ns-app", 5 | templateUrl: "app.component.html", 6 | }) 7 | export class AppComponent { } 8 | -------------------------------------------------------------------------------- /ng-demo/app/app.css: -------------------------------------------------------------------------------- 1 | /* 2 | In NativeScript, the app.css file is where you place CSS rules that 3 | you would like to apply to your entire application. Check out 4 | http://docs.nativescript.org/ui/styling for a full list of the CSS 5 | selectors and properties you can use to style UI components. 6 | 7 | /* 8 | In many cases you may want to use the NativeScript core theme instead 9 | of writing your own CSS rules. For a full list of class names in the theme 10 | refer to http://docs.nativescript.org/ui/theme. 11 | */ 12 | @import 'nativescript-theme-core/css/core.light.css'; 13 | -------------------------------------------------------------------------------- /ng-demo/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptModule } from "nativescript-angular/nativescript.module"; 3 | import { NativeScriptFormsModule } from "nativescript-angular/forms"; 4 | import { AppRoutingModule } from "./app.routing"; 5 | import { AppComponent } from "./app.component"; 6 | 7 | import { CouchbaseInstance } from "./couchbaseinstance"; 8 | import { ListComponent } from "./components/list/list.component"; 9 | import { CreateComponent } from "./components/create/create.component"; 10 | 11 | @NgModule({ 12 | bootstrap: [ 13 | AppComponent 14 | ], 15 | imports: [ 16 | NativeScriptModule, 17 | NativeScriptFormsModule, 18 | AppRoutingModule 19 | ], 20 | declarations: [ 21 | AppComponent, 22 | ListComponent, 23 | CreateComponent 24 | ], 25 | providers: [ 26 | CouchbaseInstance 27 | ], 28 | schemas: [ 29 | NO_ERRORS_SCHEMA 30 | ] 31 | }) 32 | export class AppModule { } 33 | -------------------------------------------------------------------------------- /ng-demo/app/app.routing.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from "@angular/core"; 2 | import { NativeScriptRouterModule } from "nativescript-angular/router"; 3 | import { Routes } from "@angular/router"; 4 | 5 | import { ListComponent } from "./components/list/list.component"; 6 | import { CreateComponent } from "./components/create/create.component"; 7 | 8 | export const routes: Routes = [ 9 | { path: '', component: ListComponent }, 10 | { path: "create", component: CreateComponent } 11 | ]; 12 | 13 | @NgModule({ 14 | imports: [NativeScriptRouterModule.forRoot(routes)], 15 | exports: [NativeScriptRouterModule] 16 | }) 17 | export class AppRoutingModule { } -------------------------------------------------------------------------------- /ng-demo/app/components/create/create.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ng-demo/app/components/create/create.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from "@angular/core"; 2 | import {Location} from "@angular/common"; 3 | import {CouchbaseInstance} from "../../couchbaseinstance"; 4 | 5 | @Component({ 6 | selector: "create", 7 | templateUrl: "./components/create/create.component.html" 8 | }) 9 | export class CreateComponent { 10 | 11 | private couchbaseInstance: CouchbaseInstance; 12 | private database: any; 13 | private location: Location; 14 | public firstname: string; 15 | public lastname: string; 16 | 17 | constructor(location: Location, couchbaseInstance: CouchbaseInstance) { 18 | this.database = couchbaseInstance.getDatabase(); 19 | this.location = location; 20 | this.firstname = ""; 21 | this.lastname = ""; 22 | } 23 | 24 | save() { 25 | if(this.firstname != "" && this.lastname != "") { 26 | this.database.createDocument({ 27 | "firstname": this.firstname, 28 | "lastname": this.lastname 29 | }); 30 | this.location.back(); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ng-demo/app/components/list/list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ng-demo/app/components/list/list.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, NgZone} from "@angular/core"; 2 | import {Router} from "@angular/router"; 3 | import {Location} from "@angular/common"; 4 | import {CouchbaseInstance} from "../../couchbaseinstance"; 5 | 6 | @Component({ 7 | selector: "my-app", 8 | templateUrl: "./components/list/list.component.html", 9 | }) 10 | export class ListComponent { 11 | 12 | private database: any; 13 | private router: Router; 14 | private ngZone: NgZone; 15 | public personList: Array; 16 | 17 | constructor(router: Router, location: Location, ngZone: NgZone, couchbaseInstance: CouchbaseInstance) { 18 | this.router = router; 19 | this.ngZone = ngZone; 20 | this.database = couchbaseInstance.getDatabase(); 21 | this.personList = []; 22 | 23 | couchbaseInstance.startSync(true); 24 | 25 | this.database.addDatabaseChangeListener((changes) => { 26 | let changeIndex; 27 | for (var i = 0; i < changes.length; i++) { 28 | let documentId = changes[i].getDocumentId(); 29 | changeIndex = this.indexOfObjectId(documentId, this.personList); 30 | let document = this.database.getDocument(documentId); 31 | this.ngZone.run(() => { 32 | if (changeIndex == -1) { 33 | this.personList.push(document); 34 | } else { 35 | this.personList[changeIndex] = document; 36 | } 37 | }); 38 | } 39 | }); 40 | 41 | location.subscribe((path) => { 42 | this.refresh(); 43 | }); 44 | 45 | this.refresh(); 46 | } 47 | 48 | create() { 49 | this.router.navigate(["create"]); 50 | } 51 | 52 | private refresh() { 53 | this.personList = []; 54 | let rows = this.database.executeQuery("people"); 55 | for(let i = 0; i < rows.length; i++) { 56 | this.personList.push(rows[i]); 57 | } 58 | } 59 | 60 | private indexOfObjectId(needle: string, haystack: any) { 61 | for (let i = 0; i < haystack.length; i++) { 62 | if (haystack[i] != undefined && haystack[i].hasOwnProperty("_id")) { 63 | if (haystack[i]._id == needle) { 64 | return i; 65 | } 66 | } 67 | } 68 | return -1; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /ng-demo/app/couchbaseinstance.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@angular/core"; 2 | import { Couchbase } from 'nativescript-couchbase'; 3 | 4 | @Injectable() 5 | export class CouchbaseInstance { 6 | 7 | private database: any; 8 | private pull: any; 9 | private push: any; 10 | 11 | public constructor() { 12 | this.database = new Couchbase("test-database"); 13 | this.database.createView("people", "1", (document, emitter) => { 14 | emitter.emit(document._id, document); 15 | }); 16 | } 17 | 18 | public getDatabase() { 19 | return this.database; 20 | } 21 | 22 | public startSync(continuous: boolean) { 23 | this.push = this.database.createPushReplication("http://192.168.57.1:4984/test-database"); 24 | this.pull = this.database.createPullReplication("http://192.168.57.1:4984/test-database"); 25 | 26 | this.push.setContinuous(continuous); 27 | this.pull.setContinuous(continuous); 28 | 29 | this.push.start(); 30 | this.pull.start(); 31 | } 32 | 33 | public stopSync() { 34 | this.push.stop(); 35 | this.pull.stop(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ng-demo/app/main.aot.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScript } from "nativescript-angular/platform-static"; 3 | 4 | import { AppModuleNgFactory } from "./app.module.ngfactory"; 5 | 6 | platformNativeScript().bootstrapModuleFactory(AppModuleNgFactory); 7 | -------------------------------------------------------------------------------- /ng-demo/app/main.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScriptDynamic } from "nativescript-angular/platform"; 3 | 4 | import { AppModule } from "./app.module"; 5 | 6 | platformNativeScriptDynamic().bootstrapModule(AppModule); 7 | -------------------------------------------------------------------------------- /ng-demo/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": { 3 | "v8Flags": "--expose_gc" 4 | }, 5 | "main": "main.js", 6 | "name": "tns-template-hello-world-ng", 7 | "version": "2.5.0" 8 | } -------------------------------------------------------------------------------- /ng-demo/app/vendor-platform.android.ts: -------------------------------------------------------------------------------- 1 | //Resolve JavaScript classes that extend a Java class, and need to resolve 2 | //their JavaScript module from a bundled script. For example: 3 | //NativeScriptApplication, NativeScriptActivity, etc. 4 | // 5 | //This module gets bundled together with the rest of the app code and the 6 | //`require` calls get resolved to the correct bundling import call. 7 | // 8 | //At runtime the module gets loaded *before* the rest of the app code, so code 9 | //placed here needs to be careful about its dependencies. 10 | 11 | require("application"); 12 | require("ui/frame"); 13 | require("ui/frame/activity"); 14 | 15 | if (global.TNS_WEBPACK) { 16 | global.__requireOverride = function (name, dir) { 17 | if (name === "./tns_modules/application/application.js") { 18 | return require("application"); 19 | } else if (name === "./tns_modules/ui/frame/frame.js") { 20 | return require("ui/frame"); 21 | } else if (name === "./tns_modules/ui/frame/activity.js") { 22 | return require("ui/frame/activity"); 23 | } 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /ng-demo/app/vendor-platform.ios.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/ng-demo/app/vendor-platform.ios.ts -------------------------------------------------------------------------------- /ng-demo/app/vendor.ts: -------------------------------------------------------------------------------- 1 | require("./vendor-platform"); 2 | 3 | require('reflect-metadata'); 4 | require('@angular/platform-browser'); 5 | require('@angular/core'); 6 | require('@angular/common'); 7 | require('@angular/forms'); 8 | require('@angular/http'); 9 | require('@angular/router'); 10 | 11 | require('nativescript-angular/platform-static'); 12 | require('nativescript-angular/forms'); 13 | require('nativescript-angular/router'); 14 | -------------------------------------------------------------------------------- /ng-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "NativeScript Application", 3 | "license": "SEE LICENSE IN ", 4 | "readme": "NativeScript Application", 5 | "repository": "", 6 | "nativescript": { 7 | "id": "org.nativescript.ngdemo", 8 | "tns-ios": { 9 | "version": "2.5.0" 10 | }, 11 | "tns-android": { 12 | "version": "2.5.0" 13 | } 14 | }, 15 | "dependencies": { 16 | "@angular/common": "2.4.3", 17 | "@angular/compiler": "2.4.3", 18 | "@angular/core": "2.4.3", 19 | "@angular/forms": "2.4.3", 20 | "@angular/http": "2.4.3", 21 | "@angular/platform-browser": "2.4.3", 22 | "@angular/platform-browser-dynamic": "2.4.3", 23 | "@angular/router": "3.4.3", 24 | "nativescript-angular": "1.4.0", 25 | "nativescript-couchbase": "file:///Users/nraboy/Desktop/nativescript-couchbase", 26 | "nativescript-theme-core": "~1.0.2", 27 | "reflect-metadata": "~0.1.8", 28 | "rxjs": "~5.0.1", 29 | "tns-core-modules": "2.5.0" 30 | }, 31 | "devDependencies": { 32 | "@angular/compiler-cli": "2.4.3", 33 | "@ngtools/webpack": "1.2.1", 34 | "babel-traverse": "6.22.1", 35 | "babel-types": "6.22.0", 36 | "babylon": "6.15.0", 37 | "copy-webpack-plugin": "~3.0.1", 38 | "extract-text-webpack-plugin": "~2.0.0-beta.4", 39 | "htmlparser2": "~3.9.2", 40 | "lazy": "1.0.11", 41 | "nativescript-css-loader": "~0.26.0", 42 | "nativescript-dev-android-snapshot": "^0.*.*", 43 | "nativescript-dev-typescript": "~0.3.5", 44 | "nativescript-dev-webpack": "^0.3.2", 45 | "raw-loader": "~0.5.1", 46 | "resolve-url-loader": "~1.6.0", 47 | "typescript": "~2.1.0", 48 | "webpack": "~2.1.0-beta.27", 49 | "webpack-sources": "~0.1.3", 50 | "zone.js": "~0.7.2" 51 | }, 52 | "scripts": { 53 | "clean-android": "tns clean-app android", 54 | "clean-ios": "tns clean-app ios", 55 | "prewebpack-android": "npm run clean-android", 56 | "prewebpack-ios": "npm run clean-ios", 57 | "webpack-android": "webpack --config=webpack.android.js --progress", 58 | "webpack-ios": "webpack --config=webpack.ios.js --progress", 59 | "prestart-android-bundle": "npm run webpack-android", 60 | "prestart-ios-bundle": "npm run webpack-ios", 61 | "start-android-bundle": "tns run android --bundle --disable-npm-install", 62 | "start-ios-bundle": "tns run ios --bundle --disable-npm-install", 63 | "prebuild-android-bundle": "npm run webpack-android", 64 | "prebuild-ios-bundle": "npm run webpack-ios", 65 | "build-android-bundle": "tns build android --bundle --disable-npm-install", 66 | "build-ios-bundle": "tns build ios --bundle --disable-npm-install" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ng-demo/references.d.ts: -------------------------------------------------------------------------------- 1 | /// Needed for autocompletion and compilation. 2 | /// -------------------------------------------------------------------------------- /ng-demo/sync-gateway-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "log":["CRUD+", "REST+", "Changes+", "Attach+"], 3 | "databases": { 4 | "test-database": { 5 | "server":"walrus:data", 6 | "sync":` 7 | function (doc) { 8 | channel (doc.channels); 9 | } 10 | `, 11 | "users": { 12 | "GUEST": { 13 | "disabled": false, 14 | "admin_channels": ["*"] 15 | } 16 | } 17 | } 18 | }, 19 | "CORS": { 20 | "Origin": ["http://localhost:8100"], 21 | "LoginOrigin": ["http://localhost:8100"], 22 | "Headers": ["Content-Type"], 23 | "MaxAge": 17280000 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ng-demo/tsconfig.aot.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false, 11 | "suppressImplicitAnyIndexErrors": true, 12 | "types": [], 13 | "baseUrl": ".", 14 | "paths": { 15 | "ui/*": ["node_modules/tns-core-modules/ui/*"], 16 | "platform": ["node_modules/tns-core-modules/platform"], 17 | "image-source": ["node_modules/tns-core-modules/image-source"], 18 | "xml": ["node_modules/tns-core-modules/xml"], 19 | "xhr": ["node_modules/tns-core-modules/xhr"], 20 | "text": ["node_modules/tns-core-modules/text"], 21 | "data": ["node_modules/tns-core-modules/data"], 22 | "fetch": ["node_modules/tns-core-modules/fetch"], 23 | "trace": ["node_modules/tns-core-modules/trace"], 24 | "fps-meter": ["node_modules/tns-core-modules/fps-meter"], 25 | "color": ["node_modules/tns-core-modules/color"], 26 | "application-settings": ["node_modules/tns-core-modules/application-settings"], 27 | "http": ["node_modules/tns-core-modules/http"], 28 | "camera": ["node_modules/tns-core-modules/camera"], 29 | "console": ["node_modules/tns-core-modules/console"], 30 | "timer": ["node_modules/tns-core-modules/timer"], 31 | "utils": ["node_modules/tns-core-modules/utils"], 32 | "location": ["node_modules/tns-core-modules/location"], 33 | "file-system": ["node_modules/tns-core-modules/file-system"], 34 | "application": ["node_modules/tns-core-modules/application"], 35 | "image-asset": ["node_modules/tns-core-modules/image-asset"], 36 | "connectivity": ["node_modules/tns-core-modules/connectivity"], 37 | "globals": ["node_modules/tns-core-modules/globals"] 38 | 39 | } 40 | }, 41 | "exclude": [ 42 | "node_modules", 43 | "platforms" 44 | ], 45 | "angularCompilerOptions": { 46 | "skipMetadataEmit": true, 47 | "genDir": "./" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ng-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "noEmitHelpers": true, 8 | "noEmitOnError": true 9 | }, 10 | "exclude": [ 11 | "node_modules", 12 | "platforms", 13 | "**/*.aot.ts" 14 | ] 15 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativescript-couchbase", 3 | "version": "1.0.18", 4 | "description": "Couchbase Lite plugin for Telerik NativeScript", 5 | "main": "couchbase", 6 | "typings": "couchbase.d.ts", 7 | "nativescript": { 8 | "platforms": { 9 | "android": "3.0.0", 10 | "ios": "3.0.0" 11 | } 12 | }, 13 | "scripts": { 14 | "prepare": "echo \"Preparing...\"; npm run build;", 15 | "build": "echo \"Building...\"; tsc;", 16 | "configure": "echo \"Configuring...\"; npm run configure-vanilla; npm run configure-angular;", 17 | "configure-vanilla": "echo \"Configuring Vanilla...\"; cd demo; tns install; tns plugin remove nativescript-couchbase; tns plugin add ..; cd ..", 18 | "configure-angular": "echo \"Configuring Angular...\"; cd ng-demo; tns install; tns plugin remove nativescript-couchbase; tns plugin add ..; cd ..", 19 | "deploy-android-angular": "echo \"Deploying Android Angular...\"; npm run configure-angular; cd ng-demo; tns run android", 20 | "deploy-android-vanilla": "echo \"Deploying Android Vanilla...\"; npm run configure-vanilla; cd demo; tns run android", 21 | "deploy-ios-angular": "echo \"Deploying iOS Angular...\"; npm run configure-angular; cd ng-demo; tns run ios", 22 | "deploy-ios-vanilla": "echo \"Deploying iOS Vanilla...\"; npm run configure-vanilla; cd demo; tns run ios", 23 | "webpack-vanilla": "echo \"Webpacking Vanilla...\"; npm run configure; cd demo; npm run webpack-ios; npm run webpack-android; cd ..;", 24 | "webpack-angular": "echo \"Webpacking Angular...\"; npm run configure; cd ng-demo; npm run webpack-ios; npm run webpack-android; cd ..;" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "https://github.com/couchbaselabs/nativescript-couchbase.git" 29 | }, 30 | "keywords": [ 31 | "couchbase", 32 | "couchbase mobile", 33 | "couchbase lite", 34 | "nosql", 35 | "nativescript" 36 | ], 37 | "author": { 38 | "name": "Nic Raboy", 39 | "url": "https://www.thepolyglotdeveloper.com" 40 | }, 41 | "license": "Apache-2.0", 42 | "devDependencies": { 43 | "tns-core-modules": "^3.0.0", 44 | "tns-platform-declarations": "^3.0.0", 45 | "typescript": "^2.2.2" 46 | }, 47 | "peerDependencies": { 48 | "tns-core-modules": "^3.0.0" 49 | } 50 | } -------------------------------------------------------------------------------- /platforms/android/include.gradle: -------------------------------------------------------------------------------- 1 | repositories { 2 | jcenter() 3 | } 4 | 5 | dependencies { 6 | compile 'com.couchbase.lite:couchbase-lite-android:1.3.1' 7 | compile 'com.google.code.gson:gson:2.6.2' 8 | } 9 | 10 | android { 11 | productFlavors { 12 | "nativescript-couchbase" { 13 | dimension "nativescript-couchbase" 14 | } 15 | } 16 | packagingOptions { 17 | exclude 'META-INF/ASL2.0' 18 | exclude 'META-INF/NOTICE' 19 | exclude 'META-INF/LICENSE' 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/CouchbaseLite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/platforms/ios/CouchbaseLite.framework/CouchbaseLite -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLAttachment.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/21/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDocument, CBLRevision, CBLSavedRevision; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** A binary attachment to a document revision. 21 | Existing attachments can be gotten from -[CBLRevision attachmentNamed:]. 22 | New attachments can be created by calling the -setAttachment:... methods of CBLNewRevision or 23 | CBLModel. */ 24 | @interface CBLAttachment : NSObject 25 | 26 | /** The owning document revision. */ 27 | @property (readonly, retain) CBLRevision* revision; 28 | 29 | /** The owning document. */ 30 | @property (readonly) CBLDocument* document; 31 | 32 | /** The filename. */ 33 | @property (readonly, copy) NSString* name; 34 | 35 | /** The MIME type of the contents. */ 36 | @property (readonly, nullable) NSString* contentType; 37 | 38 | /** The length in bytes of the contents. */ 39 | @property (readonly) UInt64 length; 40 | 41 | /** The CouchbaseLite metadata about the attachment, that lives in the document. */ 42 | @property (readonly) NSDictionary* metadata; 43 | 44 | /** The data of the attachment. */ 45 | @property (readonly, nullable) NSData* content; 46 | 47 | /** Returns a stream from which you can read the data of the attachment. 48 | Remember to close it when you're done. */ 49 | - (NSInputStream*) openContentStream; 50 | 51 | /** The (file:) URL of the file containing the contents. 52 | This property is somewhat deprecated and is made available only for use with platform APIs that 53 | require file paths/URLs, e.g. some media playback APIs. Whenever possible, use the `content` 54 | property or the `openContentStream` method instead. 55 | The file must be treated as read-only! DO NOT MODIFY OR DELETE IT. 56 | If the database is encrypted, attachment files are also encrypted and not directly readable, 57 | so this property will return nil. */ 58 | @property (readonly, nullable) NSURL* contentURL; 59 | 60 | @end 61 | 62 | 63 | #if __has_feature(nullability) 64 | #pragma clang assume_nonnull end 65 | #endif 66 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLAuthenticator.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLAuthenticator.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 4/11/14. 6 | // Copyright (c) 2014 Couchbase, Inc. All rights reserved. 7 | 8 | 9 | #import 10 | 11 | #if __has_feature(nullability) // Xcode 6.3+ 12 | #pragma clang assume_nonnull begin 13 | #else 14 | #define nullable 15 | #define __nullable 16 | #endif 17 | 18 | 19 | /** The CBLAuthenticator protocol defines objects that can authenticate a user to a remote database 20 | server. An object conforming to this protocol is acquired from the CBLAuthenticator _class_'s 21 | factory methods, and is used by setting it as a CBLReplication's .authenticator property. 22 | This protocol is currently entirely opaque and not intended for applications to implement. 23 | The authenticator types are limited to those createable by factory methods. */ 24 | @protocol CBLAuthenticator 25 | // No user-servicable parts inside. 26 | @end 27 | 28 | 29 | /** The CBLAuthenticator class provides factory methods for creating authenticator objects, for use 30 | with the .authenticator property of a CBLReplication. */ 31 | @interface CBLAuthenticator : NSObject 32 | 33 | /** Creates an authenticator that will log in using HTTP Basic auth with the given user name and 34 | password. This should only be used over an SSL/TLS connection, as otherwise it's very easy for 35 | anyone sniffing network traffic to read the password. */ 36 | + (id) basicAuthenticatorWithName: (NSString*)name 37 | password: (NSString*)password; 38 | 39 | /** Creates an authenticator that will authenticate to a Couchbase Sync Gateway server using 40 | Facebook credentials. The token string must be an active Facebook login token. On iOS you can 41 | acquire one from the Accounts framework, or you can use Facebook's SDK to implement the 42 | login process. */ 43 | + (id) facebookAuthenticatorWithToken: (NSString*)token; 44 | 45 | /** Creates an authenticator that will authenticate to a Couchbase Sync Gateway server using the 46 | user's email address, with the Persona protocol (http://persona.org). The "assertion" token 47 | must have been acquired using the client-side Persona auth procedure; you can use the library 48 | https://github.com/couchbaselabs/browserid-ios to do this. */ 49 | + (id) personaAuthenticatorWithAssertion: (NSString*)assertion; 50 | 51 | /** Creates an authenticator that will authenticate to a CouchDB server using OAuth version 1. 52 | The parameters must have been acquired using the client-side OAuth login procedure. There are 53 | several iOS and Mac implementations of this, such as 54 | https://github.com/couchbaselabs/ios-oauthconsumer */ 55 | + (id) OAuth1AuthenticatorWithConsumerKey: (NSString*)consumerKey 56 | consumerSecret: (NSString*)consumerSecret 57 | token: (NSString*)token 58 | tokenSecret: (NSString*)tokenSecret 59 | signatureMethod: (NSString*)signatureMethod; 60 | 61 | @end 62 | 63 | 64 | 65 | #if __has_feature(nullability) 66 | #pragma clang assume_nonnull end 67 | #endif 68 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLDatabaseChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLDatabaseChange.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 1/18/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | // 9 | 10 | #import 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** Identifies a change to a database, that is, a newly added document revision. 21 | The CBLDocumentChangeNotification contains one of these in the "change" key of its 22 | userInfo dictionary, and CBLDatabaseChangeNotification contains an NSArray in "changes". */ 23 | @interface CBLDatabaseChange : NSObject 24 | 25 | /** The ID of the document that changed. */ 26 | @property (readonly) NSString* documentID; 27 | 28 | /** The ID of the newly-added revision. */ 29 | @property (readonly) NSString* revisionID; 30 | 31 | /** Is the new revision the document's current (default, winning) one? 32 | If not, there's a conflict. */ 33 | @property (readonly) BOOL isCurrentRevision; 34 | 35 | /** YES if the document is in conflict. (The conflict might pre-date this change.) */ 36 | @property (readonly) BOOL inConflict; 37 | 38 | /** The remote database URL that this change was pulled from, if any. */ 39 | @property (readonly, nullable) NSURL* source; 40 | 41 | @end 42 | 43 | 44 | #if __has_feature(nullability) 45 | #pragma clang assume_nonnull end 46 | #endif 47 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLDocument.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/4/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import "CBLDatabase.h" 10 | @class CBLSavedRevision, CBLUnsavedRevision, CBLDatabaseChange; 11 | @protocol CBLDocumentModel; 12 | 13 | #if __has_feature(nullability) // Xcode 6.3+ 14 | #pragma clang assume_nonnull begin 15 | #else 16 | #define nullable 17 | #define __nullable 18 | #endif 19 | 20 | 21 | /** A CouchbaseLite document (as opposed to any specific revision of it.) */ 22 | @interface CBLDocument : NSObject 23 | 24 | /** The document's owning database. */ 25 | @property (readonly) CBLDatabase* database; 26 | 27 | /** The document's ID. */ 28 | @property (readonly) NSString* documentID; 29 | 30 | /** An abbreviated form of the the documentID that looks like "xxxx..xxxx". Useful in logging. */ 31 | @property (readonly) NSString* abbreviatedID; 32 | 33 | /** Is this document deleted? (That is, does its current revision have the '_deleted' property?) */ 34 | @property (readonly) BOOL isDeleted; 35 | 36 | /** Has this document either been deleted or removed from available Sync Gateway channels? 37 | (That is, does its current revision have a '_deleted' or '_removed' property?) */ 38 | @property (readonly) BOOL isGone; 39 | 40 | /** Deletes this document by adding a deletion revision. 41 | This will be replicated to other databases. */ 42 | - (BOOL) deleteDocument: (NSError**)outError; 43 | 44 | /** Purges this document from the database; this is more than deletion, it forgets entirely about it. 45 | The purge will NOT be replicated to other databases. */ 46 | - (BOOL) purgeDocument: (NSError**)outError; 47 | 48 | 49 | #pragma mark REVISIONS: 50 | 51 | /** The ID of the current revision (if known; else nil). */ 52 | @property (readonly, copy, nullable) NSString* currentRevisionID; 53 | 54 | /** The current/latest revision. This object is cached. */ 55 | @property (readonly, nullable) CBLSavedRevision* currentRevision; 56 | 57 | /** The revision with the specified ID. */ 58 | - (nullable CBLSavedRevision*) revisionWithID: (NSString*)revisionID; 59 | 60 | /** Returns the document's history as an array of CBLRevisions. (See CBLRevision's method.) */ 61 | - (nullable NSArray*) getRevisionHistory: (NSError**)outError; 62 | 63 | /** Returns all the current conflicting revisions of the document. If the document is not 64 | in conflict, only the single current revision will be returned. */ 65 | - (nullable NSArray*) getConflictingRevisions: (NSError**)outError; 66 | 67 | /** Returns all the leaf revisions in the document's revision tree, 68 | including deleted revisions (i.e. previously-resolved conflicts.) */ 69 | - (nullable NSArray*) getLeafRevisions: (NSError**)outError; 70 | 71 | /** Creates an unsaved new revision whose parent is the currentRevision, 72 | or which will be the first revision if the document doesn't exist yet. 73 | You can modify this revision's properties and attachments, then save it. 74 | No change is made to the database until/unless you save the new revision. */ 75 | - (CBLUnsavedRevision*) newRevision; 76 | 77 | 78 | #pragma mark PROPERTIES: 79 | 80 | /** The contents of the current revision of the document. 81 | This is shorthand for self.currentRevision.properties. 82 | Any keys in the dictionary that begin with "_", such as "_id" and "_rev", contain CouchbaseLite 83 | metadata. */ 84 | @property (readonly, copy, nullable) NSDictionary* properties; 85 | 86 | /** The user-defined properties, without the ones reserved by CouchDB. 87 | This is based on -properties, with every key whose name starts with "_" removed. */ 88 | @property (readonly, copy, nullable) NSDictionary* userProperties; 89 | 90 | /** Shorthand for [self.properties objectForKey: key]. */ 91 | - (nullable id) propertyForKey: (NSString*)key; 92 | 93 | /** Same as -propertyForKey:. Enables "[]" access in Xcode 4.4+ */ 94 | - (nullable id)objectForKeyedSubscript:(NSString*)key; 95 | 96 | /** Saves a new revision. The properties dictionary must have a "_rev" property whose ID matches the current revision's (as it will if it's a modified copy of this document's .properties 97 | property.) */ 98 | - (nullable CBLSavedRevision*) putProperties: (NSDictionary*)properties 99 | error: (NSError**)outError; 100 | 101 | /** Saves a new revision by letting the caller update the existing properties. 102 | This method handles conflicts by retrying (calling the block again). 103 | The block body should modify the properties of the new revision and return YES to save or 104 | NO to cancel. Be careful: the block can be called multiple times if there is a conflict! 105 | @param block Will be called on each attempt to save. Should update the given revision's 106 | properties and then return YES, or just return NO to cancel. 107 | @param outError Will point to the error, if the method returns nil. (If the callback block 108 | cancels by returning nil, the error will be nil.) If this parameter is NULL, no 109 | error will be stored. 110 | @return The new saved revision, or nil on error or cancellation. 111 | */ 112 | - (nullable CBLSavedRevision*) update: (BOOL(^)(CBLUnsavedRevision*))block 113 | error: (NSError**)outError; 114 | 115 | 116 | #pragma mark MODEL: 117 | 118 | /** Optional reference to an application-defined model object representing this document. 119 | Usually this is a CBLModel, but you can implement your own model classes if you want. 120 | Note that this is a weak reference. */ 121 | @property (weak, nullable) id modelObject; 122 | 123 | 124 | @end 125 | 126 | 127 | 128 | /** Protocol that CBLDocument model objects must implement. See the CBLModel class. */ 129 | @protocol CBLDocumentModel 130 | /** Called whenever a new revision is added to the document. 131 | (Equivalent to kCBLDocumentChangeNotification.) */ 132 | - (void) document: (CBLDocument*)doc 133 | didChange: (CBLDatabaseChange*)change; 134 | @end 135 | 136 | 137 | 138 | /** This notification is posted by a CBLDocument in response to a change, i.e. a new revision. 139 | The notification's userInfo contains a "change" property whose value is a CBLDatabaseChange 140 | containing details of the change. 141 | NOTE: This is *not* a way to detect changes to all documents. Only already-existing CBLDocument 142 | objects will post this notification, so when a document changes in the database but there is 143 | not currently any CBLDocument instance representing it, no notification will be posted. 144 | If you want to observe all document changes in a database, use kCBLDatabaseChangeNotification.*/ 145 | extern NSString* const kCBLDocumentChangeNotification; 146 | 147 | 148 | #if __has_feature(nullability) 149 | #pragma clang assume_nonnull end 150 | #endif 151 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLGeometry.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLGeometry.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 9/22/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if __has_feature(nullability) // Xcode 6.3+ 12 | #pragma clang assume_nonnull begin 13 | #else 14 | #define nullable 15 | #define __nullable 16 | #endif 17 | 18 | 19 | /** A 2D geometric point. */ 20 | typedef struct CBLGeoPoint { 21 | double x, y; 22 | } CBLGeoPoint; 23 | 24 | /** A 2D geometric rectangle. 25 | Note that unlike CGRect and NSRect, this stores max coords, not size. 26 | A rectangle with max coords equal to the min is equivalent to a point. 27 | It is illegal for the max coords to be less than the min. */ 28 | typedef struct CBLGeoRect { 29 | CBLGeoPoint min, max; 30 | } CBLGeoRect; 31 | 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | 38 | /** Compares two rectangles for equality. */ 39 | static inline BOOL CBLGeoRectEqual(CBLGeoRect a, CBLGeoRect b) { 40 | return a.min.x == b.min.x && a.min.y == b.min.y && a.max.x == b.max.x && a.max.y == b.max.y; 41 | } 42 | 43 | /** Returns YES if a rectangle is empty, i.e. equivalent to a single point. */ 44 | static inline BOOL CBLGeoRectIsEmpty(CBLGeoRect r) { 45 | return r.min.x == r.max.x && r.min.y == r.max.y; 46 | } 47 | 48 | 49 | /** Converts a string of four comma-separated numbers ("x0,y0,x1,y1") to a rectangle. */ 50 | BOOL CBLGeoCoordsStringToRect(NSString* coordsStr, CBLGeoRect* outRect); 51 | 52 | 53 | #pragma mark - CONVERTING TO/FROM JSON: 54 | 55 | /** Converts a point to GeoJSON format. 56 | For details see http://geojson.org/geojson-spec.html#point */ 57 | NSDictionary* CBLGeoPointToJSON(CBLGeoPoint pt); 58 | 59 | /** Converts a rectangle to GeoJSON format (as a polygon.) 60 | For details see http://geojson.org/geojson-spec.html#polygon */ 61 | NSDictionary* CBLGeoRectToJSON(CBLGeoRect rect); 62 | 63 | /** Computes the bounding box of a GeoJSON object. 64 | Currently only implemented for points and polygons. */ 65 | BOOL CBLGeoJSONBoundingBox(NSDictionary* geoJSON, CBLGeoRect* outBBox); 66 | 67 | 68 | /** Converts a point to a JSON-compatible array of two coordinates. */ 69 | NSArray* CBLGeoPointToCoordPair(CBLGeoPoint pt); 70 | 71 | /** Converts a JSON array of two coordinates [x,y] back into a point. */ 72 | BOOL CBLGeoCoordPairToPoint(NSArray* coords, CBLGeoPoint* outPoint); 73 | 74 | /** Converts a JSON array of four coordinates [x0, y0, x1, y1] to a rectangle. */ 75 | BOOL CBLGeoCoordsToRect(NSArray* coords, CBLGeoRect* outRect); 76 | 77 | #pragma mark - KEYS FOR MAP FUNCTIONS: 78 | 79 | /** Returns a special value that, when emitted as a key, is indexed as a geometric point. 80 | Used inside a map block, like so: `emit(CBLPointKey(3.0, 4.0), value);` */ 81 | id CBLGeoPointKey(double x, double y); 82 | 83 | /** Returns a special value that, when emitted as a key, is indexed as a geometric rectangle. */ 84 | id CBLGeoRectKey(double x0, double y0, double x1, double y1); 85 | 86 | /** Returns a special value that, when emitted as a key, is indexed as a GeoJSON 87 | shape. Currently only its bounding box is stored. 88 | Only points and polygons are supported; other shapes return nil. */ 89 | id CBLGeoJSONKey(NSDictionary* geoJSON); 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | 97 | #if __has_feature(nullability) 98 | #pragma clang assume_nonnull end 99 | #endif 100 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLJSON.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLJSON.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 2/27/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if __has_feature(nullability) // Xcode 6.3+ 12 | #pragma clang assume_nonnull begin 13 | #else 14 | #define nullable 15 | #define __nullable 16 | #endif 17 | 18 | 19 | /** Identical to the corresponding NSJSON option flags. */ 20 | enum { 21 | CBLJSONReadingMutableContainers = (1UL << 0), 22 | CBLJSONReadingMutableLeaves = (1UL << 1), 23 | CBLJSONReadingAllowFragments = (1UL << 2) 24 | }; 25 | typedef NSUInteger CBLJSONReadingOptions; 26 | 27 | /** Identical to the corresponding NSJSON option flags, with one addition. */ 28 | enum { 29 | CBLJSONWritingPrettyPrinted = (1UL << 0), 30 | 31 | CBLJSONWritingAllowFragments = (1UL << 23) /**< Allows input to be an NSString or NSValue. */ 32 | }; 33 | typedef NSUInteger CBLJSONWritingOptions; 34 | 35 | 36 | /** Useful extensions for JSON serialization/parsing. */ 37 | @interface CBLJSON : NSJSONSerialization 38 | 39 | /** Same as -dataWithJSONObject... but returns an NSString. */ 40 | + (nullable NSString*) stringWithJSONObject:(id)obj 41 | options:(CBLJSONWritingOptions)opt 42 | error:(NSError**)error; 43 | 44 | /** Given valid JSON data representing a dictionary, inserts the contents of the given NSDictionary into it and returns the resulting JSON data. 45 | This does not parse or regenerate the JSON, so it's quite fast. 46 | But it will generate invalid JSON if the input JSON begins or ends with whitespace, or if the dictionary contains any keys that are already in the original JSON. */ 47 | + (NSData*) appendDictionary: (NSDictionary*)dict 48 | toJSONDictionaryData: (NSData*)json; 49 | 50 | /** Same as above but inserts a pre-encoded JSON dictionary instead of an NSDictionary. */ 51 | + (NSData*) appendJSONDictionaryData: (NSData*)extraJson 52 | toJSONDictionaryData: (NSData*)json; 53 | 54 | /** Encodes an NSDate as a string in ISO-8601 format. */ 55 | + (NSString*) JSONObjectWithDate: (NSDate*)date; 56 | + (NSString*) JSONObjectWithDate: (NSDate*)date timeZone:(NSTimeZone *)tz; 57 | 58 | /** Parses an ISO-8601 formatted date string to an NSDate object. 59 | If the object is not a string, or not valid ISO-8601, it returns nil. */ 60 | + (nullable NSDate*) dateWithJSONObject: (id)jsonObject; 61 | 62 | /** Parses an ISO-8601 formatted date string to an absolute time (timeSinceReferenceDate). 63 | If the object is not a string, or not valid ISO-8601, it returns a NAN value. */ 64 | + (CFAbsoluteTime) absoluteTimeWithJSONObject: (id)jsonObject; 65 | 66 | /** Follows a JSON-Pointer, returning the value pointed to, or nil if nothing. 67 | See spec at: http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-04 */ 68 | + (nullable id) valueAtPointer: (NSString*)pointer inObject: (id)object; 69 | 70 | /** Encodes an NSData as a string in Base64 format. */ 71 | + (NSString*) base64StringWithData: (NSData*)data; 72 | 73 | /** Parses a Base64-encoded string into an NSData object. 74 | If the object is not a string, or not valid Base64, it returns nil. */ 75 | + (nullable NSData*) dataWithBase64String: (id)jsonObject; 76 | 77 | /** Estimates the amount of memory used by the object and those it references. */ 78 | + (size_t) estimateMemorySize: (id)object; 79 | 80 | @end 81 | 82 | 83 | /** Wrapper for an NSArray of JSON data, that avoids having to parse the data if it's not used. 84 | NSData objects in the array will be parsed into native objects before being returned to the caller from -objectAtIndex. */ 85 | @interface CBLLazyArrayOfJSON : NSArray 86 | 87 | /** Initialize a lazy array. 88 | @param array An NSArray of NSData objects, each containing JSON. */ 89 | - (instancetype) initWithMutableArray: (NSMutableArray*)array; 90 | @end 91 | 92 | 93 | typedef void (^CBLOnMutateBlock)(); 94 | 95 | /** Protocol for classes whose instances can encode themselves as JSON. 96 | Such classes can be used directly as property types in CBLModel subclasses. */ 97 | @protocol CBLJSONEncoding 98 | - (instancetype) initWithJSON: (id)jsonObject; 99 | - (id) encodeAsJSON; 100 | 101 | @optional 102 | /** If an implementation has mutable persistent state, it should implement this method. 103 | The implementation should save a copy of the block in an instance variable, and call the block 104 | whenever the instance's state has changed such that -encodeAsJSON will now return a different 105 | result. 106 | This allows the object's owner (typically a CBLModel) to detect such changes and mark itself 107 | as needing to be saved. */ 108 | - (void) setOnMutate: (CBLOnMutateBlock)onMutate; 109 | @end 110 | 111 | 112 | #if __has_feature(nullability) 113 | #pragma clang assume_nonnull end 114 | #endif 115 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLManager.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/19/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDatabase; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | /** Option flags for CBLManager initialization. */ 20 | typedef struct CBLManagerOptions { 21 | bool readOnly; /**< No modifications to databases are allowed. */ 22 | NSDataWritingOptions fileProtection; /**< File protection/encryption options (iOS only) */ 23 | } CBLManagerOptions; 24 | 25 | 26 | /** Top-level CouchbaseLite object; manages a collection of databases as a CouchDB server does. 27 | A CBLManager and all the objects descending from it may only be used on a single 28 | thread. To work with databases on another thread, copy the database manager (by calling 29 | -copy) and use the copy on the other thread. */ 30 | @interface CBLManager : NSObject 31 | 32 | /** A shared per-process instance. This should only be used on the main thread. */ 33 | + (instancetype) sharedInstance; 34 | 35 | /** Returns YES if the given name is a valid database name. 36 | (Only the characters in "abcdefghijklmnopqrstuvwxyz0123456789_$()+-/" are allowed.) */ 37 | + (BOOL) isValidDatabaseName: (NSString*)name; 38 | 39 | /** The default directory to use for a CBLManager. This is in the Application Support directory. */ 40 | + (NSString*) defaultDirectory; 41 | 42 | /** Default initializer. Stores databases in the default directory. */ 43 | - (instancetype) init; 44 | 45 | /** Initializes a CouchbaseLite manager that stores its data at the given path. 46 | @param directory Path to data directory. If it doesn't already exist it will be created. 47 | @param options If non-NULL, a pointer to options (read-only and no-replicator). 48 | @param outError On return, the error if any. */ 49 | - (instancetype) initWithDirectory: (NSString*)directory 50 | options: (const CBLManagerOptions* __nullable)options 51 | error: (NSError**)outError; 52 | 53 | /** Creates a copy of this CBLManager, which can be used on a different thread. */ 54 | - (instancetype) copy; 55 | 56 | /** Releases all resources used by the CBLManager instance and closes all its databases. */ 57 | - (void) close; 58 | 59 | /** The root directory of this manager (as specified at initialization time.) */ 60 | @property (readonly) NSString* directory; 61 | 62 | /** Should the databases and attachments be excluded from iCloud or Time Machine backup? 63 | Defaults to NO. */ 64 | @property BOOL excludedFromBackup; 65 | 66 | #pragma mark - DATABASES: 67 | 68 | /** Returns the database with the given name, creating it if it didn't already exist. 69 | Multiple calls with the same name will return the same CBLDatabase instance. 70 | NOTE: Database names may not contain capital letters! */ 71 | - (nullable CBLDatabase*) databaseNamed: (NSString*)name 72 | error: (NSError**)outError; 73 | 74 | /** Returns the database with the given name, or nil if it doesn't exist. 75 | Multiple calls with the same name will return the same CBLDatabase instance. */ 76 | - (nullable CBLDatabase*) existingDatabaseNamed: (NSString*)name 77 | error: (NSError**)outError; 78 | 79 | /** Returns YES if a database with the given name exists. Does not open the database. */ 80 | - (BOOL) databaseExistsNamed: (NSString*)name; 81 | 82 | /** Registers an encryption key for a database. This must be called before opening an encrypted 83 | database, or before creating a database that's to be encrypted. 84 | If the key is incorrect (or no key is given for an encrypted database), the subsequent call 85 | to open the database will fail with an error with code 401. 86 | To use this API, the database storage engine must support encryption. In the case of SQLite, 87 | this means the application must be linked with SQLCipher instead of 88 | regular SQLite. Otherwise opening the database will fail with an error. */ 89 | - (BOOL) registerEncryptionKey: (nullable id)encryptionKey 90 | forDatabaseNamed: (NSString*)name; 91 | 92 | /** Same as -existingDatabaseNamed:. Enables "[]" access in Xcode 4.4+ */ 93 | - (nullable CBLDatabase*) objectForKeyedSubscript: (NSString*)key; 94 | 95 | /** An array of the names of all existing databases. */ 96 | @property (readonly) NSArray* allDatabaseNames; 97 | 98 | /** Replaces or installs a database from a file. 99 | This is primarily used to install a canned database on first launch of an app, in which case you should first check .exists to avoid replacing the database if it exists already. The canned database would have been copied into your app bundle at build time. 100 | @param databaseName The name of the database to replace. 101 | @param databasePath Path of the database file that should replace it. 102 | @param attachmentsPath Path of the associated attachments directory, or nil if there are no attachments. 103 | @param outError If an error occurs, it will be stored into this parameter on return. 104 | @return YES if the database was copied, NO if an error occurred. */ 105 | - (BOOL) replaceDatabaseNamed: (NSString*)databaseName 106 | withDatabaseFile: (NSString*)databasePath 107 | withAttachments: (NSString*)attachmentsPath 108 | error: (NSError**)outError __attribute__((nonnull(1,2))); 109 | 110 | #pragma mark - CONCURRENCY: 111 | 112 | /** The dispatch queue used to serialize access to the database manager (and its child objects.) 113 | Setting this is optional: by default the objects are bound to the thread on which the database 114 | manager was instantiated. By setting a dispatch queue, you can call the objects from within that 115 | queue no matter what the underlying thread is, and notifications will be posted on that queue 116 | as well. */ 117 | @property (strong, nullable) dispatch_queue_t dispatchQueue; 118 | 119 | /** Runs the block asynchronously on the database manager's dispatch queue or thread. 120 | Unlike the rest of the API, this can be called from any thread, and provides a limited form 121 | of multithreaded access to Couchbase Lite. */ 122 | - (void) doAsync: (void (^)())block; 123 | 124 | /** Asynchronously dispatches a block to run on a background thread. The block will be given a 125 | CBLDatabase instance to use; it must use that database instead of any CBL objects that are 126 | in use on the surrounding code's thread. Otherwise thread-safety will be violated, and 127 | Really Bad Things that are intermittent and hard to debug can happen. 128 | (Note: Unlike most of the API, this method is thread-safe.) */ 129 | - (void) backgroundTellDatabaseNamed: (NSString*)dbName to: (void (^)(CBLDatabase*))block; 130 | 131 | #pragma mark - OTHER API: 132 | 133 | /** The base URL of the database manager's REST API. You can access this URL within this process, 134 | using NSURLConnection or other APIs that use that (such as XMLHTTPRequest inside a WebView), 135 | but it isn't available outside the process. 136 | This method is only available if you've linked with the CouchbaseLiteListener framework. */ 137 | @property (readonly) NSURL* internalURL; 138 | 139 | /** Enables Couchbase Lite logging of the given type, process-wide. A partial list of types is here: 140 | http://docs.couchbase.com/couchbase-lite/cbl-ios/#useful-logging-channels 141 | It's usually more convenient to enable logging via command-line args, as discussed on that 142 | same page; but in some environments you may not have access to the args, or may want to use 143 | other criteria to enable logging. */ 144 | + (void) enableLogging: (NSString*)type; 145 | 146 | /** Redirects Couchbase Lite logging: instead of writing to the console/stderr, it will call the 147 | given block. Passing a nil block restores the default behavior. */ 148 | + (void) redirectLogging: (nullable void (^)(NSString* type, NSString* message))callback; 149 | 150 | 151 | @property (readonly, nonatomic, nullable) NSMutableDictionary* customHTTPHeaders; 152 | 153 | @end 154 | 155 | 156 | /** Returns the version of Couchbase Lite */ 157 | extern NSString* CBLVersion( void ); 158 | 159 | /** NSError domain used for HTTP status codes returned by a lot of Couchbase Lite APIs -- 160 | for example code 404 is "not found", 403 is "forbidden", etc. */ 161 | extern NSString* const CBLHTTPErrorDomain; 162 | 163 | 164 | 165 | #if __has_feature(nullability) 166 | #pragma clang assume_nonnull end 167 | #endif 168 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLModelFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLModelFactory.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 11/22/11. 6 | // Copyright (c) 2011-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import "CBLDatabase.h" 10 | @class CBLDocument; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** A configurable mapping from CBLDocument to CBLModel. 21 | It associates a model class with a value of the document's "type" property. */ 22 | @interface CBLModelFactory : NSObject 23 | 24 | /** Returns a global shared CBLModelFactory that's consulted by all databases. 25 | Mappings registered in this instance will be used as a fallback by all other instances if they don't have their own. */ 26 | + (instancetype) sharedInstance; 27 | 28 | /** Given a document, attempts to return a CBLModel for it. 29 | If the document's modelObject property is set, it returns that value. 30 | If the document's "type" property has been registered, instantiates the associated class. 31 | Otherwise returns nil. */ 32 | - (id) modelForDocument: (CBLDocument*)document; 33 | 34 | /** Associates a value of the "type" property with a CBLModel subclass. 35 | When a document with this type value is loaded as a model, the given subclass will be 36 | instantiated (unless you explicitly instantiate a different CBLModel subclass.) 37 | As a bonus, when a model of this class is created with a new document, the document's "type" 38 | property will be set to the associated value. 39 | @param classOrName Either a CBLModel subclass, or its class name as an NSString. 40 | @param type The value value of a document's "type" property that should indicate this class. */ 41 | - (void) registerClass: (id)classOrName 42 | forDocumentType: (NSString*)type; 43 | 44 | /** Returns the appropriate CBLModel subclass for this document. 45 | The default implementation just passes the document's "type" property value to -classForDocumentType:, but subclasses could override this to use different properties (or even the document ID) to decide. */ 46 | - (nullable Class) classForDocument: (CBLDocument*)document; 47 | 48 | /** Looks up the CBLModel subclass that's been registered for a document type. */ 49 | - (Class) classForDocumentType: (NSString*)type; 50 | 51 | /** Looks up the document type for which the given class has been registered. 52 | If it's unregistered, or registered with multiple types, returns nil. */ 53 | - (nullable NSString*) documentTypeForClass: (Class)modelClass; 54 | 55 | /** Looks up the document types for which the given class has been registered. */ 56 | - (NSArray*) documentTypesForClass: (Class)modelClass; 57 | 58 | @end 59 | 60 | 61 | @interface CBLDatabase (CBLModelFactory) 62 | 63 | /** The CBLModel factory object to be used by this database. 64 | Every database has its own instance by default, but you can set this property to use a different one -- either to use a custom subclass, or to share a factory among multiple databases, or both. */ 65 | @property (retain, nullable) CBLModelFactory* modelFactory; 66 | 67 | @end 68 | 69 | 70 | #if __has_feature(nullability) 71 | #pragma clang assume_nonnull end 72 | #endif 73 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLQuery+FullTextSearch.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLQuery+FullTextSearch.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 9/21/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import "CBLQuery.h" 10 | 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | /** CBLQuery interface for full-text searches. 20 | To use this, the view's map function must have emitted full-text strings as keys 21 | using the CBLTextKey() function. */ 22 | @interface CBLQuery (FullTextSearch) 23 | 24 | /** Query string for a full-text search; works only if the view's map function has triggered full- 25 | text indexing by emitting strings wrapped by CBLTextKey(). 26 | The query rows produced by this search will be instances of CBLFullTextQueryRow. 27 | 28 | The query string will be broken up into words. "Noise" words like "the" and "hello" (also 29 | called "stop-words") are ignored. 30 | 31 | The result will include a row corresponding to every emitted CBLTextKey() that contains _any_ 32 | of the words in the query. Word matching tries to account for (English) grammatical variations 33 | like plurals and verb tenses, so for example "cat" will match "cats" and "type" will match 34 | "typing". 35 | 36 | **NOTE:** Full-text views have no keys, so the key-related query properties will be ignored. 37 | They also can't be reduced or grouped, so those properties are ignored too. */ 38 | @property (copy, nullable) NSString* fullTextQuery; 39 | 40 | /** If set to YES, the query will collect snippets of the text surrounding each match, available 41 | via the CBLFullTextQueryRow's -snippetWithWordStart:wordEnd: method. 42 | (NOTE: ForestDB currently does not support snippets.) */ 43 | @property BOOL fullTextSnippets; 44 | 45 | /** If YES (the default) the full-text query result rows will be sorted by (approximate) relevance. 46 | If set to NO, the rows will be returned in the order the documents were added to the database, 47 | i.e. essentially unordered; this is somewhat faster, so it can be useful if you don't care 48 | about the ordering of the rows. 49 | (NOTE: ForestDB currently does not support ranking.) */ 50 | @property BOOL fullTextRanking; 51 | 52 | @end 53 | 54 | 55 | 56 | /** A result row from a full-text query. 57 | A CBLQuery with its .fullTextQuery property set will produce CBLFullTextQueryRows. */ 58 | @interface CBLFullTextQueryRow : CBLQueryRow 59 | 60 | /** The text emitted when the view was indexed (the argument to CBLTextKey()) which contains the 61 | match(es). */ 62 | @property (readonly, nullable) NSString* fullText; 63 | 64 | /** Returns a short substring of the full text containing at least some of the matched words. 65 | This is useful to display in search results, and is faster than fetching the .fullText. 66 | NOTE: The "fullTextSnippets" property of the CBLQuery must be set to YES to enable this; 67 | otherwise the result will be nil. 68 | @param wordStart A delimiter that will be inserted before every instance of a match. 69 | @param wordEnd A delimiter that will be inserted after every instance of a match. */ 70 | - (NSString*) snippetWithWordStart: (NSString*)wordStart 71 | wordEnd: (NSString*)wordEnd; 72 | 73 | /** The number of query words that were found in the fullText. 74 | (If a query word appears more than once, only the first instance is counted.) */ 75 | @property (readonly) NSUInteger matchCount; 76 | 77 | /** The character range in the fullText of a particular match. */ 78 | - (NSRange) textRangeOfMatch: (NSUInteger)matchNumber; 79 | 80 | /** The index of the search term matched by a particular match. Search terms are the individual 81 | words in the full-text search expression, skipping duplicates and noise/stop-words. They're 82 | numbered from zero. */ 83 | - (NSUInteger) termIndexOfMatch: (NSUInteger)matchNumber; 84 | 85 | @end 86 | 87 | 88 | #if __has_feature(nullability) 89 | #pragma clang assume_nonnull end 90 | #endif 91 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLQuery+Geo.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLQuery+Geo.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 9/23/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import "CBLQuery.h" 10 | #import "CBLGeometry.h" 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** CBLQuery interface for geo-queries. 21 | To use this, the view's map function must have emitted geometries (points, rects, etc.) 22 | as keys using the functions CBLGeoPointKey(), CBLGeoRectKey(), or CBLGeoJSONKey(). */ 23 | @interface CBLQuery (Geo) 24 | 25 | /** The geometric bounding box to search. Setting this property causes the query to 26 | search geometries rather than keys. */ 27 | @property CBLGeoRect boundingBox; 28 | 29 | @end 30 | 31 | 32 | /** A result row from a CouchbaseLite geo-query. 33 | A CBLQuery with its .boundingBox property set will produce CBLGeoQueryRows. */ 34 | @interface CBLGeoQueryRow : CBLQueryRow 35 | 36 | /** The row's geo bounding box in native form. 37 | If the emitted geo object was a point, the boundingBox's min and max will be equal. 38 | Note: The coordinates may have slight round-off error, because SQLite internally stores bounding 39 | boxes as 32-bit floats, but the coordinates are always rounded outwards -- making the bounding 40 | box slightly larger -- to avoid false negatives in searches. */ 41 | @property (readonly, nonatomic) CBLGeoRect boundingBox; 42 | 43 | /** The GeoJSON object emitted as the key of the emit() call by the map function. 44 | The format is a parsed GeoJSON point or polygon; see http://geojson.org/geojson-spec */ 45 | @property (readonly, nullable) NSDictionary* geometry; 46 | 47 | /** The GeoJSON object type of the row's geometry. 48 | Usually @"Point" or @"Rectangle", but may be another type if the emitted key was GeoJSON. 49 | (The "Rectangle" type is not standard GeoJSON.) */ 50 | @property (readonly, nonatomic, nullable) NSString* geometryType; 51 | 52 | @end 53 | 54 | 55 | #if __has_feature(nullability) 56 | #pragma clang assume_nonnull end 57 | #endif 58 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLQueryBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLQueryBuilder.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 8/4/14. 6 | // Copyright (c) 2014-2015 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDatabase, CBLView, CBLQuery, CBLQueryEnumerator; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** A higher-level interface to views and queries that feels more like a traditional query language 21 | or like Core Data's NSFetchRequest. 22 | 23 | A CBLQueryBuilder is a template for creating families of queries. You should create an instance 24 | for a generalized query, leaving "$"-prefixed placeholder variables in your "where" predicate 25 | for any values that won't be known until the query needs to run. Then at query time, you give 26 | the builder values for the variables and it creates a query. 27 | 28 | (Note: CBLQueryBuilder is not cross-platform since its API is based on the Cocoa Foundation 29 | classes NSPredicate, NSExpression and NSSortDescriptor. Other implementations of Couchbase Lite 30 | will have equivalent functionality based on their platforms' APIs and idioms.) 31 | */ 32 | @interface CBLQueryBuilder : NSObject 33 | 34 | /** Initializes a CBLQueryBuilder. 35 | @param database The database to index and query. 36 | @param valueTemplate The result values you want, expressed either as keypath strings or 37 | NSExpressions; in either case they're evaluated relative to the 38 | document being indexed. 39 | @param predicateStr A predicate template string that specifies the condition(s) that a 40 | document's properties must match. Often includes "$"-prefixed variables that will 41 | be filled in at query time, like key ranges. 42 | (See Apple's predicate syntax documentation: http://goo.gl/8ty3xG ) 43 | @param sortDescriptors The sort order you want the results in. Items in the array can be 44 | NSSortDescriptors or NSStrings. A string will be interpreted as a sort descriptor 45 | with that keyPath; prefix it with "-" to indicate descending order. 46 | If the order of query rows is unimportant, pass nil. 47 | @param outError If the builder doesn't know how to handle the input, this will be filled in 48 | with an NSError describing the problem. 49 | @return The initialized CBLQueryBuilder, or nil on error. */ 50 | - (instancetype) initWithDatabase: (nullable CBLDatabase*)database 51 | select: (nullable NSArray*)valueTemplate 52 | where: (NSString*)predicateStr 53 | orderBy: (nullable NSArray*)sortDescriptors 54 | error: (NSError**)outError; 55 | 56 | /** Initializes a CBLQueryBuilder. 57 | This is an alternate initializer that takes an NSPredicate instead of a predicate template 58 | string; see the main initializer for details. */ 59 | - (instancetype) initWithDatabase: (nullable CBLDatabase*)database 60 | select: (nullable NSArray*)valueTemplate 61 | wherePredicate: (NSPredicate*)predicate 62 | orderBy: (nullable NSArray*)sortDescriptors 63 | error: (NSError**)outError; 64 | 65 | /** Initializes a CBLQueryBuilder, using an explicitly chosen view. 66 | See the main initializer for details. */ 67 | - (instancetype) initWithView: (CBLView*)view 68 | select: (NSArray*)valueTemplate 69 | wherePredicate: (NSPredicate*)predicate 70 | orderBy: (nullable NSArray*)sortDescriptors 71 | error: (NSError**)outError; 72 | 73 | /** The view the query builder is using. */ 74 | @property (readonly, nonatomic) CBLView* view; 75 | 76 | /** A human-readable string that explains in pseudocode what the query builder is doing. 77 | It shows what the map function does, and what the query's properties will be set to. 78 | This is intended for troubleshooting and debugging purposes only. */ 79 | @property (readonly, nonatomic) NSString* explanation; 80 | 81 | /** Creates a query, given a set of values for the variables. 82 | @param context A dictionary mapping variable names to values. The names should not include 83 | the dollar signs used in the predicate string; if a predicate referred to 84 | $FOO, the dictionary key should be @"FOO". 85 | @return The configured query, ready to run. */ 86 | - (CBLQuery*) createQueryWithContext: (nullable NSDictionary*)context; 87 | 88 | /** A convenience method that creates a query and runs it. See -createQueryWithContext:. */ 89 | - (nullable CBLQueryEnumerator*) runQueryWithContext: (nullable NSDictionary*)context 90 | error: (NSError**)outError; 91 | 92 | @end 93 | 94 | 95 | #if __has_feature(nullability) 96 | #pragma clang assume_nonnull end 97 | #endif 98 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLReplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLReplication.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/22/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDatabase; 11 | @protocol CBLAuthenticator; 12 | 13 | #if __has_feature(nullability) // Xcode 6.3+ 14 | #pragma clang assume_nonnull begin 15 | #else 16 | #define nullable 17 | #define __nullable 18 | #endif 19 | 20 | 21 | /** Describes the current status of a replication. */ 22 | typedef NS_ENUM(unsigned, CBLReplicationStatus) { 23 | kCBLReplicationStopped, /**< The replication is finished or hit a fatal error. */ 24 | kCBLReplicationOffline, /**< The remote host is currently unreachable. */ 25 | kCBLReplicationIdle, /**< Continuous replication is caught up and waiting for more changes.*/ 26 | kCBLReplicationActive /**< The replication is actively transferring data. */ 27 | } ; 28 | 29 | 30 | /** A 'push' or 'pull' replication between a local and a remote database. 31 | Replications can be one-shot or continuous. */ 32 | @interface CBLReplication : NSObject 33 | 34 | /** The local database being replicated to/from. */ 35 | @property (nonatomic, readonly) CBLDatabase* localDatabase; 36 | 37 | /** The URL of the remote database. */ 38 | @property (nonatomic, readonly) NSURL* remoteURL; 39 | 40 | /** Does the replication pull from (as opposed to push to) the target? */ 41 | @property (nonatomic, readonly) BOOL pull; 42 | 43 | 44 | #pragma mark - OPTIONS: 45 | 46 | /** Should the target database be created if it doesn't already exist? (Defaults to NO). */ 47 | @property (nonatomic) BOOL createTarget; 48 | 49 | /** Should the replication operate continuously? (Defaults to NO). 50 | A continuous replication keeps running (with 'idle' status) after updating the target database. 51 | It monitors the source database and copies new revisions as soon as they're available. 52 | Continuous replications keep running until the app quits or they're stopped. */ 53 | @property (nonatomic) bool continuous; 54 | 55 | /** Name of an optional filter function to run on the source server. 56 | Only documents for which the function returns true are replicated. 57 | * For a pull replication, the name looks like "designdocname/filtername". 58 | * For a push replication, use the name under which you registered the filter with the CBLDatabase. */ 59 | @property (nonatomic, copy, nullable) NSString* filter; 60 | 61 | /** Parameters to pass to the filter function. 62 | Should map strings to strings. */ 63 | @property (nonatomic, copy, nullable) NSDictionary* filterParams; 64 | 65 | /** List of Sync Gateway channel names to filter by; a nil value means no filtering, i.e. all 66 | available channels will be synced. 67 | Only valid for pull replications whose source database is on a Couchbase Sync Gateway server. 68 | (This is a convenience that just reads or changes the values of .filter and .query_params.) */ 69 | @property (nonatomic, copy, nullable) NSArray* channels; 70 | 71 | /** Sets the documents to specify as part of the replication. */ 72 | @property (copy, nullable) NSArray *documentIDs; 73 | 74 | /** Extra HTTP headers to send in all requests to the remote server. 75 | Should map strings (header names) to strings. */ 76 | @property (nonatomic, copy, nullable) NSDictionary* headers; 77 | 78 | /** Specifies which class of network the replication will operate over. 79 | Default value is nil, which means replicate over all networks. 80 | Set to "WiFi" (or "!Cell") to replicate only over WiFi, 81 | or to "Cell" (or "!WiFi") to replicate only over cellular. */ 82 | @property (nonatomic, copy, nullable) NSString* network; 83 | 84 | /** An optional JSON-compatible dictionary of extra properties for the replicator. */ 85 | @property (nonatomic, copy, nullable) NSDictionary* customProperties; 86 | 87 | 88 | #pragma mark - AUTHENTICATION: 89 | 90 | /** An object that knows how to authenticate with a remote server. 91 | CBLAuthenticator is an opaque protocol; instances can be created by calling the factory methods 92 | of the class of the same name. */ 93 | @property (nonatomic, strong, nullable) id authenticator; 94 | 95 | /** The credential (generally username+password) to use to authenticate to the remote database. 96 | This can either come from the URL itself (if it's of the form "http://user:pass@example.com") 97 | or be stored in the NSURLCredentialStorage, which is a wrapper around the Keychain. */ 98 | @property (nonatomic, strong, nullable) NSURLCredential* credential; 99 | 100 | /** OAuth parameters that the replicator should use when authenticating to the remote database. 101 | Keys in the dictionary should be "consumer_key", "consumer_secret", "token", "token_secret", 102 | and optionally "signature_method". */ 103 | @property (nonatomic, copy, nullable) NSDictionary* OAuth; 104 | 105 | /** The base URL of the remote server, for use as the "origin" parameter when requesting Persona or 106 | Facebook authentication. */ 107 | @property (readonly, nullable) NSURL* personaOrigin; 108 | 109 | /** Adds a cookie to the shared NSHTTPCookieStorage that will be sent to the remote server. This 110 | is useful if you've obtained a session cookie through some external means and need to tell the 111 | replicator to send it for authentication purposes. 112 | This method constructs an NSHTTPCookie from the given parameters, as well as the remote server 113 | URL's host, port and path. 114 | If you already have an NSHTTPCookie object for the remote server, you can simply add it to the 115 | sharedHTTPCookieStorage yourself. 116 | If you have a "Set-Cookie:" response header, you can use NSHTTPCookie's class methods to parse 117 | it to a cookie object, then add it to the sharedHTTPCookieStorage. */ 118 | - (void) setCookieNamed: (NSString*)name 119 | withValue: (NSString*)value 120 | path: (NSString*)path 121 | expirationDate: (NSDate*)expirationDate 122 | secure: (BOOL)secure; 123 | 124 | /** Deletes the named cookie from the shared NSHTTPCookieStorage for the remote server's URL. */ 125 | - (void) deleteCookieNamed: (NSString *)name; 126 | 127 | /** Adds additional SSL root certificates to be trusted by the replicator, or entirely overrides the 128 | OS's default list of trusted root certs. 129 | @param certs An array of SecCertificateRefs of root certs that should be trusted. Most often 130 | these will be self-signed certs, but they might also be the roots of nonstandard CAs. 131 | @param onlyThese If NO, the given certs are appended to the system's built-in list of trusted 132 | root certs; if YES, it replaces them (so *only* the given certs will be trusted.) */ 133 | + (void) setAnchorCerts: (nullable NSArray*)certs onlyThese: (BOOL)onlyThese; 134 | 135 | /** The server's SSL certificate. This will be NULL until the first HTTPS response is received 136 | from the server. */ 137 | @property (readonly, nullable) SecCertificateRef serverCertificate; 138 | 139 | #pragma mark - STATUS: 140 | 141 | /** Starts the replication, asynchronously. 142 | Has no effect if the replication is already running. 143 | You can monitor its progress by observing the kCBLReplicationChangeNotification it sends, 144 | or by using KVO to observe its .running, .status, .error, .total and .completed properties. */ 145 | - (void) start; 146 | 147 | /** Stops replication, asynchronously. 148 | Has no effect if the replication is not running. */ 149 | - (void) stop; 150 | 151 | /** Restarts a running replication. 152 | Has no effect if the replication is not running. */ 153 | - (void) restart; 154 | 155 | /** Suspends/resumes a replication. 156 | On iOS a replication will suspend itself when the app goes into the background, and resume 157 | when the app is re-activated. If your app receives a push notification while suspended and needs 158 | to run the replication to download new data, your handler should set suspended to NO to resume 159 | replication, and then set the property back to YES when it's done. */ 160 | @property BOOL suspended; 161 | 162 | /** The replication's current state, one of {stopped, offline, idle, active}. */ 163 | @property (nonatomic, readonly) CBLReplicationStatus status; 164 | 165 | /** YES while the replication is running, NO if it's stopped. 166 | Note that a continuous replication never actually stops; it only goes idle waiting for new 167 | data to appear. */ 168 | @property (nonatomic, readonly) BOOL running; 169 | 170 | /** The error status of the replication, or nil if there have not been any errors since it started. */ 171 | @property (nonatomic, readonly, strong, nullable) NSError* lastError; 172 | 173 | /** The number of completed changes processed, if the task is active, else 0 (observable). */ 174 | @property (nonatomic, readonly) unsigned completedChangesCount; 175 | 176 | /** The total number of changes to be processed, if the task is active, else 0 (observable). */ 177 | @property (nonatomic, readonly) unsigned changesCount; 178 | 179 | 180 | /** The IDs of documents that have local changes that have not yet been pushed to the server 181 | by this replication. This only considers documents that this replication would push: documents 182 | that aren't matched by its filter or documentIDs (if any) are ignored. 183 | If the replication hasn't started yet, or if it's encountered an error, or if it's not a push 184 | replication at all, the value of this property is nil. */ 185 | @property (readonly, nullable) NSSet* pendingDocumentIDs; 186 | 187 | /** Returns YES if a document has local changes that this replication will push to its server, but 188 | hasn't yet. This only considers documents that this replication would push: it returns NO for 189 | a document that isn't matched by its filter or documentIDs, even if that document has local 190 | changes. */ 191 | - (BOOL) isDocumentPending: (CBLDocument*)doc; 192 | 193 | 194 | #ifdef CBL_DEPRECATED 195 | @property (nonatomic, copy) NSString* facebookEmailAddress 196 | __attribute__((deprecated("set authenticator property instead"))); 197 | - (BOOL) registerFacebookToken: (NSString*)token forEmailAddress: (NSString*)email 198 | __attribute__((deprecated("set authenticator property instead"))); 199 | - (BOOL) registerPersonaAssertion: (NSString*)assertion 200 | __attribute__((deprecated("set authenticator property instead"))); 201 | @property (nonatomic, copy) NSString* personaEmailAddress 202 | __attribute__((deprecated("set authenticator property instead"))); 203 | #endif 204 | 205 | @end 206 | 207 | 208 | /** This notification is posted by a CBLReplication when any of these properties change: 209 | {status, running, error, completed, total}. It's often more convenient to observe this 210 | notification rather than observing each property individually. */ 211 | extern NSString* const kCBLReplicationChangeNotification; 212 | 213 | 214 | #if __has_feature(nullability) 215 | #pragma clang assume_nonnull end 216 | #endif 217 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLRevision.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLRevision.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/17/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDocument, CBLDatabase, CBLAttachment, CBLSavedRevision, CBLUnsavedRevision; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** A revision of a CBLDocument. 21 | This is the abstract base class of CBLSavedRevision (existing revisions) and CBLNewRevision 22 | (revisions yet to be saved). */ 23 | @interface CBLRevision : NSObject 24 | 25 | /** The document this is a revision of. */ 26 | @property (readonly, weak) CBLDocument* document; 27 | 28 | /** The database this revision's document belongs to. */ 29 | @property (readonly) CBLDatabase* database; 30 | 31 | /** Does this revision mark the deletion of its document? 32 | (In other words, does it have a "_deleted" property?) */ 33 | @property (readonly) BOOL isDeletion; 34 | 35 | /** Does this revision mark the deletion or removal (from available channels) of its document ? 36 | (In other words, does it have a "_deleted_ or "_removed" property?) */ 37 | @property (readonly) BOOL isGone; 38 | 39 | /** The ID of this revision. Will be nil if this is an unsaved CBLNewRevision. */ 40 | @property (readonly, nullable) NSString* revisionID; 41 | 42 | /** The revision this one is a child of. */ 43 | @property (readonly, nullable) CBLSavedRevision* parentRevision; 44 | 45 | /** The ID of the parentRevision. */ 46 | @property (readonly, nullable) NSString* parentRevisionID; 47 | 48 | /** Returns the ancestry of this revision as an array of CBLRevisions, in chronological order. 49 | Older revisions are NOT guaranteed to have their properties available. */ 50 | - (NSArray*) getRevisionHistory: (NSError**)outError; 51 | 52 | /** The revision's contents as parsed from JSON. 53 | Keys beginning with "_" are defined and reserved by CouchbaseLite; others are app-specific. 54 | The first call to this method may need to fetch the properties from disk, but subsequent calls 55 | are very cheap. */ 56 | @property (readonly, nullable) NSDictionary* properties; 57 | 58 | /** The user-defined properties, without the ones reserved by CouchbaseLite. 59 | This is based on -properties, with every key whose name starts with "_" removed. */ 60 | @property (readonly, copy, nullable) NSDictionary* userProperties; 61 | 62 | /** Shorthand for [self.properties objectForKey: key]. */ 63 | - (nullable id) propertyForKey: (NSString*)key; 64 | 65 | /** Same as -propertyForKey:. Enables "[]" access in Xcode 4.4+ */ 66 | - (nullable id) objectForKeyedSubscript: (NSString*)key; 67 | 68 | #pragma mark ATTACHMENTS 69 | 70 | /** The names of all attachments (an array of strings). */ 71 | @property (readonly, nullable) NSArray* attachmentNames; 72 | 73 | /** Looks up the attachment with the given name (without fetching its contents yet). */ 74 | - (nullable CBLAttachment*) attachmentNamed: (NSString*)name; 75 | 76 | /** All attachments, as CBLAttachment objects. */ 77 | @property (readonly, nullable) NSArray* attachments; 78 | 79 | @end 80 | 81 | 82 | 83 | /** An existing revision of a CBLDocument. Most of its API is inherited from CBLRevisionBase. */ 84 | @interface CBLSavedRevision : CBLRevision 85 | 86 | /** Are this revision's properties available? They may not be if the revision is an ancestor and 87 | either the database has been compacted, or the revision was replicated from another db. */ 88 | @property (readonly) BOOL propertiesAvailable; 89 | 90 | /** Creates a new mutable child revision whose properties and attachments are initially identical 91 | to this one's, which you can modify and then save. */ 92 | - (CBLUnsavedRevision*) createRevision; 93 | 94 | /** Creates and saves a new revision with the given properties. 95 | This will fail with a 412 error if the receiver is not the current revision of the document. */ 96 | - (nullable CBLSavedRevision*) createRevisionWithProperties: (nullable NSDictionary*)properties 97 | error: (NSError**)outError; 98 | 99 | /** Deletes the document by creating a new deletion-marker revision. */ 100 | - (nullable CBLSavedRevision*) deleteDocument: (NSError**)outError; 101 | 102 | @end 103 | 104 | 105 | 106 | /** An unsaved new revision. Most of its API is inherited from CBLRevisionBase. */ 107 | @interface CBLUnsavedRevision : CBLRevision 108 | 109 | // These properties are overridden to be settable: 110 | @property (readwrite) BOOL isDeletion; 111 | @property (readwrite, copy, nullable) NSMutableDictionary* properties; 112 | @property (readwrite, copy, nullable) NSDictionary* userProperties; 113 | - (void) setObject: (nullable id)object forKeyedSubscript: (NSString*)key; 114 | 115 | /** Saves the new revision to the database. 116 | This will fail with a 412 error if its parent (the revision it was created from) is not the current revision of the document. 117 | Afterwards you should use the returned CBLSavedRevision instead of this object. 118 | @return A new CBLSavedRevision representing the saved form of the revision. */ 119 | - (nullable CBLSavedRevision*) save: (NSError**)outError; 120 | 121 | /** A special variant of -save: that always adds the revision, even if its parent is not the 122 | current revision of the document. 123 | This can be used to resolve conflicts, or to create them. If you're not certain that's what you 124 | want to do, you should use the regular -save: method instead. */ 125 | - (nullable CBLSavedRevision*) saveAllowingConflict: (NSError**)outError; 126 | 127 | /** Creates, updates or deletes an attachment. 128 | The attachment data will be written to the database when the revision is saved. 129 | @param name The attachment name. By convention, this looks like a filename. 130 | @param mimeType The MIME type of the content. 131 | @param content The body of the attachment, or nil to remove the attachment. */ 132 | - (void) setAttachmentNamed: (NSString*)name 133 | withContentType: (nullable NSString*)mimeType 134 | content: (nullable NSData*)content; 135 | 136 | /** Creates, updates or deletes an attachment whose body comes from a file. 137 | (The method takes a URL, but it must be a "file:" URL. Remote resources are not supported.) 138 | The file need only be readable. It won't be moved or altered in any way. 139 | The attachment data will be copied from the file into the database when the revision is saved. 140 | The file needs to be preserved until then, but afterwards it can safely be deleted. 141 | @param name The attachment name. By convention, this looks like a filename. 142 | @param mimeType The MIME type of the content. 143 | @param fileURL The URL of a local file whose contents should be copied into the attachment. */ 144 | - (void) setAttachmentNamed: (NSString*)name 145 | withContentType: (nullable NSString*)mimeType 146 | contentURL: (nullable NSURL*)fileURL; 147 | 148 | /** Removes the attachment with the given name. 149 | When this revision is saved, it won't include the attachment. However, the attachment will 150 | still be present in the parent revision, until the database is next compacted. */ 151 | - (void) removeAttachmentNamed: (NSString*)name; 152 | 153 | @end 154 | 155 | 156 | #if __has_feature(nullability) 157 | #pragma clang assume_nonnull end 158 | #endif 159 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLUITableSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLUITableSource.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 8/2/11. 6 | // Copyright 2011-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDocument, CBLLiveQuery, CBLQueryRow; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #endif 18 | 19 | 20 | /** A UITableView data source driven by a CBLLiveQuery. 21 | It populates the table rows from the query rows, and automatically updates the table as the 22 | query results change when the database is updated. 23 | A CBLUITableSource can be created in a nib. If so, its tableView outlet should be wired up to 24 | the UITableView it manages, and the table view's dataSource outlet should be wired to it. */ 25 | @interface CBLUITableSource : NSObject = 60000) 27 | , UIDataSourceModelAssociation 28 | #endif 29 | > 30 | /** The table view to manage. */ 31 | @property (nonatomic, retain) IBOutlet UITableView* tableView; 32 | 33 | /** The query whose rows will be displayed in the table. */ 34 | @property (retain) CBLLiveQuery* query; 35 | 36 | /** Rebuilds the table from the query's current .rows property. */ 37 | -(void) reloadFromQuery; 38 | 39 | 40 | #pragma mark Row Accessors: 41 | 42 | /** The current array of CBLQueryRows being used as the data source for the table. */ 43 | @property (nonatomic, readonly, nullable) NSArray* rows; 44 | 45 | /** Convenience accessor to get the row object for a given table row index. */ 46 | - (nullable CBLQueryRow*) rowAtIndex: (NSUInteger)index; 47 | 48 | /** Convenience accessor to find the index path of the row with a given document. */ 49 | - (nullable NSIndexPath*) indexPathForDocument: (CBLDocument*)document; 50 | 51 | /** Convenience accessor to return the query row at a given index path. */ 52 | - (nullable CBLQueryRow*) rowAtIndexPath: (NSIndexPath*)path; 53 | 54 | /** Convenience accessor to return the document at a given index path. */ 55 | - (nullable CBLDocument*) documentAtIndexPath: (NSIndexPath*)path; 56 | 57 | 58 | #pragma mark Displaying The Table: 59 | 60 | /** If non-nil, specifies the property name of the query row's value that will be used for the table row's visible label. 61 | If the row's value is not a dictionary, or if the property doesn't exist, the property will next be looked up in the document's properties. 62 | If this doesn't meet your needs for labeling rows, you should implement -couchTableSource:willUseCell:forRow: in the table's delegate. */ 63 | @property (copy, nullable) NSString* labelProperty; 64 | 65 | 66 | #pragma mark Editing The Table: 67 | 68 | /** Is the user allowed to delete rows by UI gestures? (Defaults to YES.) */ 69 | @property (nonatomic) BOOL deletionAllowed; 70 | 71 | /** Deletes the documents at the given row indexes, animating the removal from the table. */ 72 | - (BOOL) deleteDocumentsAtIndexes: (NSArray*)indexPaths 73 | error: (NSError**)outError; 74 | 75 | /** Asynchronously deletes the given documents, animating the removal from the table. */ 76 | - (BOOL) deleteDocuments: (NSArray*)documents 77 | error: (NSError**)outError; 78 | 79 | @end 80 | 81 | 82 | /** Additional methods for the table view's delegate, that will be invoked by the CBLUITableSource. */ 83 | @protocol CBLUITableDelegate 84 | @optional 85 | 86 | /** Allows delegate to return its own custom cell, just like -tableView:cellForRowAtIndexPath:. 87 | If this returns nil the table source will create its own cell, as if this method were not implemented. */ 88 | - (UITableViewCell *)couchTableSource:(CBLUITableSource*)source 89 | cellForRowAtIndexPath:(NSIndexPath *)indexPath; 90 | 91 | /** Called after the query's results change, before the table view is reloaded. */ 92 | - (void)couchTableSource:(CBLUITableSource*)source 93 | willUpdateFromQuery:(CBLLiveQuery*)query; 94 | 95 | /** Called after the query's results change to update the table view. If this method is not implemented by the delegate, reloadData is called on the table view.*/ 96 | - (void)couchTableSource:(CBLUITableSource*)source 97 | updateFromQuery:(CBLLiveQuery*)query 98 | previousRows:(NSArray *)previousRows; 99 | 100 | /** Called from -tableView:cellForRowAtIndexPath: just before it returns, giving the delegate a chance to customize the new cell. */ 101 | - (void)couchTableSource:(CBLUITableSource*)source 102 | willUseCell:(UITableViewCell*)cell 103 | forRow:(CBLQueryRow*)row; 104 | 105 | /** Called when the user wants to delete a row. 106 | If the delegate implements this method, it will be called *instead of* the 107 | default behavior of deleting the associated document. 108 | @param source The CBLUITableSource 109 | @param row The query row corresponding to the row to delete 110 | @return True if the row was deleted, false if not. */ 111 | - (bool)couchTableSource:(CBLUITableSource*)source 112 | deleteRow:(CBLQueryRow*)row; 113 | 114 | /** Called upon failure of a document deletion triggered by the user deleting a row. */ 115 | - (void)couchTableSource:(CBLUITableSource*)source 116 | deleteFailed:(NSError*)error; 117 | 118 | @end 119 | 120 | 121 | #if __has_feature(nullability) 122 | #pragma clang assume_nonnull end 123 | #endif 124 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CBLView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLView.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/19/12. 6 | // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | @class CBLDatabase, CBLQuery; 11 | 12 | #if __has_feature(nullability) // Xcode 6.3+ 13 | #pragma clang assume_nonnull begin 14 | #else 15 | #define nullable 16 | #define __nullable 17 | #define __nonnull 18 | #endif 19 | 20 | 21 | typedef enum { 22 | kCBLMapReduceIndex = 1, /**< Regular map/reduce index with JSON keys. */ 23 | kCBLFullTextIndex, /**< Keys must be strings and will be indexed by the words they contain. */ 24 | kCBLGeoIndex /**< Geo-query index; not supported yet. */ 25 | } CBLViewIndexType; 26 | 27 | 28 | typedef void (^CBLMapEmitBlock)(id key, __nullable id value); 29 | 30 | 31 | /** A "map" function called when a document is to be added to a view. 32 | @param doc The contents of the document being analyzed. 33 | @param emit A block to be called to add a key/value pair to the view. Your block can call it zero, one or multiple times. */ 34 | typedef void (^CBLMapBlock)(NSDictionary* doc, CBLMapEmitBlock emit); 35 | 36 | /** A "reduce" function called to summarize the results of a view. 37 | @param keys An array of keys to be reduced (or nil if this is a rereduce). 38 | @param values A parallel array of values to be reduced, corresponding 1::1 with the keys. 39 | @param rereduce YES if the input values are the results of previous reductions. 40 | @return The reduced value; almost always a scalar or small fixed-size object. */ 41 | typedef __nonnull id (^CBLReduceBlock)(NSArray* __nonnull keys, 42 | NSArray* __nonnull values, 43 | BOOL rereduce); 44 | 45 | 46 | #define MAPBLOCK(BLOCK) ^(NSDictionary* doc, void (^emit)(id key, id value)){BLOCK} 47 | #define REDUCEBLOCK(BLOCK) ^id(NSArray* keys, NSArray* values, BOOL rereduce){BLOCK} 48 | 49 | 50 | /** Returns a special value that, when emitted as a key, causes the given text to be indexed with 51 | the full-text indexer. Used inside a map block, like so: `emit(CBLTextKey(longText), value);` */ 52 | FOUNDATION_EXTERN id CBLTextKey(NSString* text); 53 | 54 | /** An external object that knows how to map source code of some sort into executable functions. */ 55 | @protocol CBLViewCompiler 56 | - (nullable CBLMapBlock) compileMapFunction: (NSString*)mapSource language: (NSString*)language; 57 | - (nullable CBLReduceBlock) compileReduceFunction: (NSString*)reduceSource 58 | language: (NSString*)language; 59 | @end 60 | 61 | 62 | /** A "view" in a CouchbaseLite database -- essentially a persistent index managed by map/reduce. 63 | The view can be queried using a CBLQuery. */ 64 | @interface CBLView : NSObject 65 | 66 | /** The database that owns this view. */ 67 | @property (readonly) CBLDatabase* database; 68 | 69 | /** The name of the view. */ 70 | @property (readonly) NSString* name; 71 | 72 | /** The map function that controls how index rows are created from documents. */ 73 | @property (readonly, nullable) CBLMapBlock mapBlock; 74 | 75 | /** The optional reduce function, which aggregates together multiple rows. */ 76 | @property (readonly, nullable) CBLReduceBlock reduceBlock; 77 | 78 | /** Defines a view's functions. 79 | The view's definition is given as an Objective-C block (or NULL to delete the view). The body of the block should call the 'emit' block (passed in as a paramter) for every key/value pair it wants to write to the view. 80 | Since the function itself is obviously not stored in the database (only a unique string identifying it), you must re-define the view on every launch of the app! If the database needs to rebuild the view but the function hasn't been defined yet, it will fail and the view will be empty, causing weird problems later on. 81 | It is very important that this block be a law-abiding map function! As in other languages, it must be a "pure" function, with no side effects, that always emits the same values given the same input document. That means that it should not access or change any external state; be careful, since blocks make that so easy that you might do it inadvertently! 82 | The block may be called on any thread, or on multiple threads simultaneously. This won't be a problem if the code is "pure" as described above, since it will as a consequence also be thread-safe. 83 | @param mapBlock The map function. The MAPBLOCK macro makes it easier to declare this. 84 | @param reduceBlock The reduce function, or nil for none. The REDUCEBLOCK macro makes it easier to declare this. 85 | @param version An arbitrary string that will be stored persistently along with the index. Usually a string literal like @"1". If you subsequently change the functionality of the map or reduce function, change this string as well: the call will detect that it's different and will clear the index so it can be rebuilt by the new function. 86 | @return YES if the view was updated and the index cleared; NO if the version stayed the same. */ 87 | - (BOOL) setMapBlock: (CBLMapBlock)mapBlock 88 | reduceBlock: (nullable CBLReduceBlock)reduceBlock 89 | version: (NSString*)version; 90 | 91 | /** Defines a view that has no reduce function. 92 | See -setMapBlock:reduceBlock:version: for more details. */ 93 | - (BOOL) setMapBlock: (CBLMapBlock)mapBlock 94 | version: (NSString*)version; 95 | 96 | /** If this property is set, only documents whose "type" property is equal to its value will be 97 | passed to the map block and indexed. This can speed up indexing. 98 | Just like the map block, this property is not persistent; it needs to be set at runtime before 99 | the view is queried. And if its value changes, the view's version also needs to change. */ 100 | @property (copy) NSString* documentType; 101 | 102 | /** Is the view's index currently out of date? */ 103 | @property (readonly) BOOL stale; 104 | 105 | /** The last sequence number indexed so far. */ 106 | @property (readonly) SInt64 lastSequenceIndexed; 107 | 108 | /** Deletes the view's persistent index. It will be regenerated on the next query. */ 109 | - (void) deleteIndex; 110 | 111 | /** Deletes the view, persistently. */ 112 | - (void) deleteView; 113 | 114 | /** Creates a new query object for this view. The query can be customized and then executed. */ 115 | - (CBLQuery*) createQuery; 116 | 117 | /** Utility function to use in reduce blocks. Totals an array of NSNumbers. */ 118 | + (NSNumber*) totalValues: (NSArray*)values; 119 | 120 | /** Registers an object that can compile map/reduce functions from source code. */ 121 | + (void) setCompiler: (nullable id)compiler; 122 | 123 | /** The registered object, if any, that can compile map/reduce functions from source code. */ 124 | + (nullable id) compiler; 125 | 126 | @end 127 | 128 | 129 | #if __has_feature(nullability) 130 | #pragma clang assume_nonnull end 131 | #endif 132 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/CouchbaseLite.h: -------------------------------------------------------------------------------- 1 | // 2 | // CouchbaseLite.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 12/2/11. 6 | // Copyright (c) 2011-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 9 | // except in compliance with the License. You may obtain a copy of the License at 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // Unless required by applicable law or agreed to in writing, software distributed under the 12 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 13 | // either express or implied. See the License for the specific language governing permissions 14 | // and limitations under the License. 15 | 16 | 17 | #define CBL_DEPRECATED // Enable deprecated methods. 18 | 19 | #import "CBLManager.h" 20 | #import "CBLDatabase.h" 21 | #import "CBLDatabaseChange.h" 22 | #import "CBLDocument.h" 23 | #import "CBLRevision.h" 24 | #import "CBLAttachment.h" 25 | #import "CBLView.h" 26 | #import "CBLQuery.h" 27 | #import "CBLQuery+FullTextSearch.h" 28 | #import "CBLQuery+Geo.h" 29 | #import "CBLQueryBuilder.h" 30 | #import "CBLAuthenticator.h" 31 | #import "CBLReplication.h" 32 | #import "CBLModel.h" 33 | #import "CBLModelFactory.h" 34 | #import "CBLJSON.h" 35 | 36 | #if TARGET_OS_IPHONE 37 | #import "CBLUITableSource.h" 38 | #endif 39 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Headers/MYDynamicObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // MYDynamicObject.h 3 | // MYUtilities 4 | // 5 | // Created by Jens Alfke on 8/6/09. 6 | // Copyright 2009 Jens Alfke. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | /** A generic class with runtime support for dynamic properties. 13 | You can subclass this and declare properties in the subclass without needing to implement them or make instance variables; simply note them as '@@dynamic' in the @@implementation. 14 | The dynamic accessors will be bridged to calls to -getValueOfProperty: and setValue:ofProperty:, allowing you to easily store property values in an NSDictionary or other container. */ 15 | @interface MYDynamicObject : NSObject 16 | 17 | /** Returns the names of all properties defined in this class and superclasses up to MYDynamicObject. */ 18 | + (NSSet*) propertyNames; 19 | 20 | /** Returns the value of a named property. 21 | This method will only be called for properties that have been declared in the class's @@interface using @@property. 22 | You must override this method -- the base implementation just raises an exception. */ 23 | - (id) getValueOfProperty: (NSString*)property; 24 | 25 | /** Sets the value of a named property. 26 | This method will only be called for properties that have been declared in the class's @@interface using @@property, and are not declared readonly. 27 | You must override this method -- the base implementation just raises an exception. 28 | @return YES if the property was set, NO if it isn't settable; an exception will be raised. 29 | Default implementation returns NO. */ 30 | - (BOOL) setValue: (id)value ofProperty: (NSString*)property; 31 | 32 | 33 | // FOR SUBCLASSES TO CALL: 34 | 35 | /** Given the name of an object-valued property, returns the class of the property's value. 36 | Returns nil if the property doesn't exist, or if its type isn't an object pointer or is 'id'. */ 37 | + (Class) classOfProperty: (NSString*)propertyName; 38 | 39 | + (NSString*) getterKey: (SEL)sel; 40 | + (NSString*) setterKey: (SEL)sel; 41 | 42 | // ADVANCED STUFF FOR SUBCLASSES TO OVERRIDE: 43 | 44 | + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClass; 45 | + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClass; 46 | + (IMP) impForGetterOfProperty: (NSString*)property ofProtocol: (Protocol*)propertyProtocol; 47 | + (IMP) impForSetterOfProperty: (NSString*)property ofProtocol: (Protocol*)propertyProtocol; 48 | + (IMP) impForGetterOfProperty: (NSString*)property ofType: (const char*)propertyType; 49 | + (IMP) impForSetterOfProperty: (NSString*)property ofType: (const char*)propertyType; 50 | 51 | @end 52 | 53 | /** Given an Objective-C class object, a property name, and a BOOL for whether the property should be readwrite, 54 | return YES if a property with the name exists , NO otherwise. 55 | If setter argument is YES but property is declared readonly, also returns NO. 56 | Information about the property is returned by reference: the subclass of cls that declares the property, 57 | and the property string part of the property attributes string. 58 | */ 59 | BOOL MYGetPropertyInfo(Class cls, 60 | NSString *propertyName, 61 | BOOL setter, 62 | Class *declaredInClass, 63 | const char* *propertyType); 64 | 65 | 66 | /** Given an Objective-C property type string, returns the property type as a Class object, 67 | or nil if a class does not apply or no such property is present. 68 | See Property Type String section of the Objective-C Runtime Programming Guide 69 | for more information about the format of the string. */ 70 | Class MYClassFromType(const char* propertyType); 71 | 72 | /** Same as MYClassFromType, except for protocols. */ 73 | Protocol* MYProtocolFromType(const char* propertyType); 74 | -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbaselabs/nativescript-couchbase/6515525e45dbf4df18ba0d961f540b83f3c92af2/platforms/ios/CouchbaseLite.framework/Info.plist -------------------------------------------------------------------------------- /platforms/ios/CouchbaseLite.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module CouchbaseLite { 2 | umbrella header "CouchbaseLite.h" 3 | 4 | link "libsqlite3.dylib" 5 | link "libz.dylib" 6 | link framework "CFNetwork.framework" 7 | link framework "Security.framework" 8 | link framework "SystemConfiguration.framework" 9 | 10 | export * 11 | module * { export * } 12 | } 13 | -------------------------------------------------------------------------------- /platforms/ios/build.xcconfig: -------------------------------------------------------------------------------- 1 | OTHER_LDFLAGS = $(inherited) -lsqlite3 -framework CFNetwork -framework SystemConfiguration 2 | -------------------------------------------------------------------------------- /references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "noImplicitAny": false, 6 | "removeComments": true, 7 | "preserveConstEnums": true, 8 | "sourceMap": false, 9 | "declaration": false, 10 | "noLib": false, 11 | "noEmitHelpers": true, 12 | "experimentalDecorators": true, 13 | "lib": [ 14 | "es6", 15 | "dom" 16 | ], 17 | "baseUrl": ".", 18 | "paths": { 19 | "*": [ 20 | "./node_modules/tns-core-modules/*", 21 | "./node_modules/*" 22 | ] 23 | } 24 | }, 25 | "exclude": [ 26 | "node_modules", 27 | "platforms", 28 | "demo", 29 | "ng-demo" 30 | ] 31 | } --------------------------------------------------------------------------------