nabil-mansouri / nativescript-couchbaselite Goto Github PK
View Code? Open in Web Editor NEWFull fetures couchbase lite plugin for nativescript
License: Apache License 2.0
Full fetures couchbase lite plugin for nativescript
License: Apache License 2.0
I need to know how to do a like query or match for a string with a View.
db.createView({
name: "ProductName",
revision: "1",
map: (product: Product, emitter) => {
if (product.docType == "Product") {
emitter.emit(product.name.toLowerCase(), null);
}
}
});
getProducts(name: string = "", limit: number = 0, skip: number = 0) {
let filter = { mapOnly: true, startKey: name, endKey: name, inclusiveEnd: true };
if (limit != 0)
(filter as any).limit = limit;
if (skip != 0)
(filter as any).skip = skip;
let founded = db.queryView("ProductName", filter);
console.dir(founded.getDocuments());
}
and this retrieves an empty array.
Regards.
Kudos nabil for the nice plugin; However, the adapted AGPL licence really prohibit us from using it in our apps since it will require opening the source code of the app.
Do you offer commercial licence or are there any plans to change to more friendly licence like MIT
I'm wondering if you have in plan to update the version of couchbase lite to 2.0.
When I build with webpack enabled:
tns build android --bundle
The plugin has an error compilation:
ERROR in ../node_modules/nativescript-couchbaselite/commons.ts
Module build failed: Error: **$PATH**/commons.ts is missing fromthe TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at NativeScriptAngularCompilerPlugin.getCompiledFile (**$PATH**/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:663:23)
at NativeScriptAngularCompilerPlugin.getCompiledFile (**$PATH**/node_modules/nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin.ts:76:22)
at plugin.done.then (**$PATH**/node_modules/@ngtools/webpack/src/loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ../node_modules/nativescript-couchbaselite/index.js 5:16-36 6:16-36
@ ./services/couchbase.instance.ts
@ ./modules/app.module.ts
@ ./main.ts
I don´t know how to include the commons.ts file to the webpack compilation. This is my package.json:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"nativescript": {
"id": "org.nativescript.test",
"tns-ios": {
"version": "4.0.1"
},
"tns-android": {
"version": "4.0.1"
}
},
"dependencies": {
"@angular/animations": "~5.2.0",
"@angular/common": "~5.2.0",
"@angular/compiler": "~5.2.0",
"@angular/core": "~5.2.0",
"@angular/forms": "~5.2.0",
"@angular/http": "~5.2.0",
"@angular/platform-browser": "~5.2.0",
"@angular/platform-browser-dynamic": "~5.2.0",
"@angular/router": "~5.2.0",
"@types/lodash": "^4.14.88",
"angular2-uuid": "^1.1.1",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"nativescript-angular": "~5.2.0",
"nativescript-appavailability": "^1.3.1",
"nativescript-barcodescanner": "^2.7.6",
"nativescript-bluetooth": "^1.3.0",
"nativescript-camera": "^3.2.1",
"nativescript-cardview": "^3.0.1",
"nativescript-checkbox": "^3.0.3",
"nativescript-contacts": "^1.5.4",
"nativescript-couchbaselite": "^1.0.11",
"nativescript-drop-down": "^3.2.4",
"nativescript-enumerable": "^3.5.2",
"nativescript-geolocation": "3.0.1",
"nativescript-google-maps-sdk": "^2.6.0",
"nativescript-imagecropper": "^0.1.2",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-local-notifications": "^2.0.3",
"nativescript-modal-datetimepicker": "^1.0.3",
"nativescript-ngx-fonticon": "^4.0.0",
"nativescript-permissions": "^1.2.3",
"nativescript-phone": "^1.3.1",
"nativescript-plugin-firebase": "5.1.8",
"nativescript-pro-ui": "3.3.0",
"nativescript-sqlite": "file:nativescript-sqlite-commercial-1.1.6.tgz",
"nativescript-swift-3.0": "^1.0.0",
"nativescript-telephony": "^1.0.4",
"nativescript-textinputlayout": "file:nativescript-textinputlayout-2.0.2.tgz",
"nativescript-theme-core": "~1.0.4",
"nativescript-toast": "^1.4.6",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.5.0",
"tns-core-modules": "^4.0.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/compiler-cli": "~5.2.0",
"@ngtools/webpack": "~1.9.4",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"chai": "^3.5.0",
"clean-webpack-plugin": "~0.1.19",
"codelyzer": "^4.0.0",
"copy-webpack-plugin": "~4.3.0",
"css-loader": "~0.28.7",
"extract-text-webpack-plugin": "~3.0.2",
"filewalker": "0.1.3",
"karma": "^1.6.0",
"karma-chai": "^0.1.0",
"karma-mocha": "^1.3.0",
"karma-nativescript-launcher": "^0.4.0",
"lazy": "1.0.11",
"mocha": "^3.3.0",
"nativescript-css-loader": "~0.26.0",
"nativescript-custom-entitlements": "^0.2.0",
"nativescript-dev-typescript": "^0.6.0",
"nativescript-dev-webpack": "^0.10.2",
"nativescript-worker-loader": "~0.8.1",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.2.1",
"tns-platform-declarations": "3.4.0",
"tslib": "1.7.1",
"tslint": "^5.1.0",
"typescript": "~2.6.2",
"uglifyjs-webpack-plugin": "~1.1.6",
"webpack": "~3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"webpack-sources": "~1.1.0"
},
"scripts": {
"tslint": "tslint --project tsconfig.json --config tslint.json",
"ns-bundle": "ns-bundle",
"start-android-bundle": "npm run ns-bundle --android --run-app",
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
}
}
I get the following error when trying to do a live query:
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method changed failed
TypeError: Cannot read property 'equals' of null
File: "file:///data/data/org.nativescript.cbp/files/app/tns_modules/nativescript-couchbaselite/index.js, line: 422, column: 23
StackTrace:
Frame: function:'changed', file:'file:///data/data/org.nativescript.cbp/files/app/tns_modules/nativescript-couchbaselite/index.js', line: 422, column: 24
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.access$2400(Runtime.java:34)
at com.tns.Runtime$3.run(Runtime.java:1095)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I use the following code based on your sample:
let listener = { onRows(rows: QueryResult) { console.log("liveQuery"); console.dir(rows); this._dataItems = new ObservableArray( rows ); } }; let live = this.database.liveQuery("movie-live", { mapOnly: true }, listener); live.start();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.